]> Kevux Git Server - fll/commitdiff
Progress: Begin adding FSS Payload processing code.
authorKevin Day <thekevinday@gmail.com>
Thu, 12 Oct 2023 04:12:03 +0000 (23:12 -0500)
committerKevin Day <thekevinday@gmail.com>
Thu, 12 Oct 2023 04:12:03 +0000 (23:12 -0500)
I haven't gotten much time lately but I wanted to at least move this forward even if only a little.

This only performs some basic or minor progress regarding the f_abstruse project.

level_0/f_fss/c/fss/payload.h
level_1/fl_fss/c/fss/basic.c
level_1/fl_fss/c/fss/extended.c
level_1/fl_fss/c/fss/payload.c
level_1/fl_fss/c/fss/payload.h
level_1/fl_fss/c/private-fss.c
level_1/fl_fss/c/private-fss.h
level_1/fl_fss/data/build/dependencies
level_1/fl_fss/data/build/settings

index 28e42b62543715aaa55b498b6c330dc1b1e951ad..f881f442f6bb546f1197830b5a993edbd41bf29f 100644 (file)
@@ -21,6 +21,11 @@ extern "C" {
  *
  * Values of f_fss_payload_write_*_e:
  *   - none:              No write flag set.
+ *   - base_2:            Convert number to string using base 2.
+ *   - base_8:            Convert number to string using base 8.
+ *   - base_10:           Convert number to string using base 10.
+ *   - base_12:           Convert number to string using base 12.
+ *   - base_16:           Convert number to string using base 16.
  *   - comment_header:    Print the header comment for the Simple Packet, "# fss-000f\n".
  *   - header_content:    Print the header content.
  *   - header_object:     Print the header object, "header:\n".
@@ -31,26 +36,31 @@ extern "C" {
 #ifndef _di_f_fss_payload_write_e_
   enum {
     f_fss_payload_write_none_e              = 0x0,
-    f_fss_payload_write_comment_header_e    = 0x1,
-    f_fss_payload_write_header_content_e    = 0x2,
-    f_fss_payload_write_header_object_e     = 0x4,
-    f_fss_payload_write_payload_object_e    = 0x8,
-    f_fss_payload_write_signature_content_e = 0x10,
-    f_fss_payload_write_signature_object_e  = 0x20,
+    f_fss_payload_write_base_2_e            = 0x1,
+    f_fss_payload_write_base_8_e            = 0x2,
+    f_fss_payload_write_base_10_e           = 0x4,
+    f_fss_payload_write_base_12_e           = 0x8,
+    f_fss_payload_write_base_16_e           = 0x10,
+    f_fss_payload_write_comment_header_e    = 0x20,
+    f_fss_payload_write_header_content_e    = 0x40,
+    f_fss_payload_write_header_object_e     = 0x80,
+    f_fss_payload_write_payload_object_e    = 0x100,
+    f_fss_payload_write_signature_content_e = 0x200,
+    f_fss_payload_write_signature_object_e  = 0x400,
   }; // enum
 #endif // _di_f_fss_payload_write_e_
 
 /**
- * FSS Simple Packet strings.
+ * FSS Payload strings.
  *
  * f_fss_payload_*_s:
- *   - header_comment:   The header comment string for Simple Packet (FSS-000E).
+ *   - header_comment:   The header comment string for Payload (FSS-000E).
  *   - header_object:    The header object.
  *   - payload_object:   The payload object.
  *   - signature_object: The signature object.
  */
 #ifndef _di_f_fss_payload_s_
-  #define F_fss_payload_comment_header_s   "# fss-000e"
+  #define F_fss_payload_comment_header_s   "# fss-000e\n"
   #define F_fss_payload_object_header_s    "header:\n"
   #define F_fss_payload_object_payload_s   "payload:\n"
   #define F_fss_payload_object_signature_s "signature:\n"
index a674842e38649d005bc2a13c0fd88e39144ef245..af35355c99dc77d37c54afed771bb619ba9f1166 100644 (file)
@@ -190,7 +190,7 @@ extern "C" {
 
     const f_number_unsigned_t destination_used = destination->used;
 
-    private_fl_fss_basic_write(F_true, object, quote ? quote : f_fss_quote_double_s.string[0], range, destination, state);
+    private_fl_fss_basic_write(F_true, object, quote ? quote : f_fss_quote_double_s.string[0], range, destination, state, 0);
 
     if (F_status_is_error(state->status)) {
       destination->used = destination_used;
index 745706e408d1c46916c40a7bb06bd84d3c3bc644..14c7376a2e760ca015003446dde22c52536f99fb 100644 (file)
@@ -152,7 +152,7 @@ extern "C" {
     const f_number_unsigned_t destination_used = destination->used;
 
     // This operates exactly like an object, syntax-wise.
-    private_fl_fss_basic_write(F_false, content, quote ? quote : f_fss_quote_double_s.string[0], range, destination, state);
+    private_fl_fss_basic_write(F_false, content, quote ? quote : f_fss_quote_double_s.string[0], range, destination, state, 0);
 
     if (F_status_is_error(state->status)) {
       destination->used = destination_used;
@@ -250,7 +250,7 @@ void fl_fss_extended_object_write(const f_string_static_t object, const uint8_t
 
     const f_number_unsigned_t destination_used = destination->used;
 
-    private_fl_fss_basic_write(F_true, object, quote ? quote : f_fss_quote_double_s.string[0], range, destination, state);
+    private_fl_fss_basic_write(F_true, object, quote ? quote : f_fss_quote_double_s.string[0], range, destination, state, 0);
 
     if (F_status_is_error(state->status)) {
       destination->used = destination_used;
index bc9f29d363a355f80202d19fef309565c5b78ae9..d6c7564dcdb804581cefcd04d1ecd86aabeb83bd 100644 (file)
@@ -10,166 +10,397 @@ extern "C" {
     #ifndef _di_level_1_parameter_checking_
       if (!state) return;
 
-      if (!destination) {
+      if (!destination || !state->data) {
         state->status = F_status_set_error(F_parameter);
 
+        if (state->handle) {
+          state->handle((void * const) state, 0);
+        }
+
         return;
       }
     #endif // _di_level_1_parameter_checking_
 
+    f_fss_payload_header_write_state_t * const data = (f_fss_payload_header_write_state_t *) state->data;
+    f_fss_payload_header_write_internal_t internal = macro_f_fss_payload_header_write_internal_t_initialize_2(destination, destination->used);
+
+    if (!data->cache) {
+      state->status = F_status_set_error(F_parameter);
+
+      if (state->handle) {
+        state->handle((void * const) state, 0);
+      }
+
+      return;
+    }
+
+    // Pre-allocate as much as possible to reduce memory reallocation chances, using 'j'.
+    {
+      internal.j = 0;
+
+      if (state->code & f_fss_payload_write_comment_header_e) {
+        internal.j += f_fss_payload_comment_header_s.used + 1;
+      }
+
+      if (state->code & f_fss_payload_write_header_object_e) {
+        internal.j += f_fss_payload_object_header_s.used + 1;
+      }
+
+      // This uses step large to at least do something for header content.
+      if (state->code & f_fss_payload_write_header_content_e) {
+        internal.j += state->step_large + headers.used + 1;
+      }
+
+      if (state->code & f_fss_payload_write_signature_object_e) {
+        internal.j += f_fss_payload_object_signature_s.used + 1;
+      }
+
+      // This uses step large to at least do something for signature content.
+      if ((state->code & f_fss_payload_write_signature_content_e) && signatures) {
+        internal.j += state->step_large + signatures->used + 1;
+      }
+
+      if (state->code & f_fss_payload_write_payload_object_e) {
+        internal.j += f_fss_payload_object_payload_s.used + 1;
+      }
+
+      state->status = f_memory_array_increase_by(internal.j + 1, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+
+      internal.j = 0;
+
+      if (F_status_is_error(state->status)) {
+        if (state->handle) {
+          state->handle((void * const) state, (void * const) &internal);
+
+          if (F_status_is_error(state->status)) {
+            destination->used = internal.original;
+
+            return;
+          }
+        }
+        else {
+          destination->used = internal.original;
+
+          return;
+        }
+      }
+    }
+
     if (state->code & f_fss_payload_write_comment_header_e) {
-      // @todo flag for writing "# fss-000c"
+      internal.step = f_fss_payload_write_comment_header_e;
+
+      state->status = f_string_dynamic_append(f_fss_payload_comment_header_s, destination);
+
+      if (F_status_is_error(state->status)) {
+        if (state->handle) {
+          state->handle((void * const) state, (void * const) &internal);
+
+          if (F_status_is_error(state->status)) {
+            destination->used = internal.original;
+
+            return;
+          }
+        }
+        else {
+          destination->used = internal.original;
+
+          return;
+        }
+      }
     }
 
     if (state->code & f_fss_payload_write_header_object_e) {
-      // @todo flag for writing "header:"
+      internal.step = f_fss_payload_write_header_object_e;
+
+      state->status = f_string_dynamic_append(f_fss_payload_object_header_s, destination);
+
+      if (F_status_is_error(state->status)) {
+        if (state->handle) {
+          state->handle((void * const) state, (void * const) &internal);
+
+          if (F_status_is_error(state->status)) {
+            destination->used = internal.original;
+
+            return;
+          }
+        }
+        else {
+          destination->used = internal.original;
+
+          return;
+        }
+      }
     }
 
-/*
     if (state->code & f_fss_payload_write_header_content_e) {
-      for (f_number_unsigned_t i = 0; i < headers.used ; ++i) {
+      internal.step = f_fss_payload_write_header_content_e;
 
-        switch () {
-          f_abstruse_none_e:
-          f_abstruse_void_e:
-          f_abstruse_voids_e:
-          f_abstruse_strings_e:
-            break;
+      f_string_static_t string_static = f_string_static_t_initialize;
 
-          f_abstruse_signed_e:
-          f_abstruse_unsigned_e:
-            // @todo
-            break;
+      for (; internal.i < headers.used ; ++internal.i) {
 
-          f_abstruse_int8s_e:
-          f_abstruse_int16s_e:
-          f_abstruse_int32s_e:
-          f_abstruse_int64s_e:
-          f_abstruse_signeds_e:
-            // @todo
-            break;
+        if (state->interrupt) {
+          state->interrupt((void * const) state, (void * const) &internal);
+          if (F_status_set_fine(state->status) == F_interrupt) return;
+        }
 
-          f_abstruse_uint8s_e:
-          f_abstruse_uint16s_e:
-          f_abstruse_uint32s_e:
-          f_abstruse_uint64s_e:
-          f_abstruse_unsigneds_e:
-            // @todo
-            break;
+        if (!headers.array[internal.i].key.used) continue;
 
-          f_abstruse_string_e:
-          f_abstruse_strings_e:
-            // @todo
-            break;
+        internal.range.start = 0;
+        internal.range.stop = headers.array[internal.i].key.used - 1;
+        data->cache->used = 0;
 
-          f_abstruse_dynamic_e:
-          f_abstruse_dynamics_e:
-            // @todo
-            break;
+        // Pre-allocate space for the key, value (using step_large), separator space, EOL, and terminating NULL if necessary.
+        state->status = f_memory_array_increase_by(headers.array[internal.i].key.used + state->step_large + 3, sizeof(f_char_t), (void **) &data->cache->string, &data->cache->used, &data->cache->size);
 
-          f_abstruse_map_e:
-          f_abstruse_maps_e:
-            // @todo
-            break;
+        if (F_status_is_error_not(state->status)) {
+          data->cache->string[data->cache->used++] = f_fss_extended_open_s.string[0];
 
-          f_abstruse_map_multi_e:
-          f_abstruse_map_multis_e:
-            // @todo
-            break;
+          private_fl_fss_basic_write(F_true, headers.array[internal.i].key, 0, &internal.range, data->cache, state, (void * const) &internal);
+        }
 
-          f_abstruse_quantity_e:
-          f_abstruse_quantitys_e:
-            // @todo
-            break;
+        if (F_status_is_error_not(state->status)) {
+          switch (headers.array[internal.i].value.type) {
+            case f_abstruse_none_e:
+            case f_abstruse_void_e:
+            case f_abstruse_voids_e:
+              break;
+
+            case f_abstruse_signed_e:
+              data->cache->used = 0;
+
+              state->status = f_conversion_number_signed_to_string(headers.array[internal.i].value.is.a_signed, data->conversion, data->cache);
+
+              break;
+
+            case f_abstruse_unsigned_e:
+              data->cache->used = 0;
+
+              state->status = f_conversion_number_unsigned_to_string(headers.array[internal.i].value.is.a_unsigned, data->conversion, data->cache);
+
+              break;
+
+            case f_abstruse_int8s_e:
+            case f_abstruse_int16s_e:
+            case f_abstruse_int32s_e:
+            case f_abstruse_int64s_e:
+            case f_abstruse_signeds_e:
+              // @todo
+              break;
+
+            case f_abstruse_uint8s_e:
+            case f_abstruse_uint16s_e:
+            case f_abstruse_uint32s_e:
+            case f_abstruse_uint64s_e:
+            case f_abstruse_unsigneds_e:
+              // @todo
+              break;
+
+            case f_abstruse_string_e:
+              string_static.string = headers.array[internal.i].value.is.a_string;
+              string_static.used = strnlen(headers.array[internal.i].value.is.a_string, F_string_t_size_d);
+
+              internal.range.start = 0;
+              internal.range.stop = string_static.used;
+
+              private_fl_fss_basic_write(F_false, string_static, 0, &internal.range, data->cache, state, (void * const) &internal);
+
+              if (F_status_is_error(state->status)) {
+                destination->used = internal.original;
+              }
+
+            case f_abstruse_strings_e:
+              // @todo
+              break;
+
+            case f_abstruse_dynamic_e:
+            case f_abstruse_dynamics_e:
+              // @todo
+              break;
+
+            case f_abstruse_map_e:
+            case f_abstruse_maps_e:
+              // @todo
+              break;
+
+            case f_abstruse_map_multi_e:
+            case f_abstruse_map_multis_e:
+              // @todo
+              break;
+
+            case f_abstruse_quantity_e:
+            case f_abstruse_quantitys_e:
+              // @todo
+              break;
+
+            case f_abstruse_range_e:
+            case f_abstruse_ranges_e:
+              // @todo
+              break;
+
+            case f_abstruse_triple_e:
+            case f_abstruse_triples_e:
+              // @todo
+              break;
+
+            default:
+              break;
+          }
+        }
 
-          f_abstruse_range_e:
-          f_abstruse_ranges_e:
-            // @todo
-            break;
+        if (F_status_is_error_not(state->status)) {
+          if (data->cache->used) {
 
-          f_abstruse_triple_e:
-          f_abstruse_triples_e:
-            // @todo
-            break;
+            // Pre-allocate space for the built string and terminating NULL if necessary.
+            state->status = f_memory_array_increase_by(data->cache->used + 1, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+
+            if (F_status_is_error_not(state->status)) {
+              state->status = f_string_dynamic_append(*data->cache, destination);
+            }
+          }
+        }
+
+        if (F_status_is_error(state->status)) {
+          if (state->handle) {
+            state->handle((void * const) state, (void * const) &internal);
+
+            if (F_status_is_error(state->status)) {
+              destination->used = internal.original;
+
+              return;
+            }
+          }
+          else {
+            destination->used = internal.original;
+
+            return;
+          }
         }
       } // for
     }
 
     if (state->code & f_fss_payload_write_signature_object_e) {
-      // @todo flag for writing "signature:"
+      internal.step = f_fss_payload_write_signature_object_e;
+
+      state->status = f_string_dynamic_append(f_fss_payload_object_signature_s, destination);
+
+      if (F_status_is_error(state->status)) {
+        if (state->handle) {
+          state->handle((void * const) state, (void * const) &internal);
+
+          if (F_status_is_error(state->status)) {
+            destination->used = internal.original;
+
+            return;
+          }
+        }
+        else {
+          destination->used = internal.original;
+
+          return;
+        }
+      }
     }
 
     if ((state->code & f_fss_payload_write_signature_content_e) && !signatures) {
-      for (f_number_unsigned_t i = 0; i < signatures->used ; ++i) {
+      internal.step = f_fss_payload_write_signature_content_e;
+
+      for (internal.i = 0; internal.i < signatures->used ; ++internal.i) {
+
+        if (state->interrupt) {
+          state->interrupt((void * const) state, (void * const) &internal);
+          if (F_status_set_fine(state->status) == F_interrupt) return;
+        }
 
-        switch () {
-          f_abstruse_none_e:
-          f_abstruse_void_e:
-          f_abstruse_voids_e:
-          f_abstruse_strings_e:
+        switch (signatures->array[internal.i].value.type) {
+          case f_abstruse_none_e:
+          case f_abstruse_void_e:
+          case f_abstruse_voids_e:
             break;
 
-          f_abstruse_signed_e:
-          f_abstruse_unsigned_e:
+          case f_abstruse_signed_e:
+          case f_abstruse_unsigned_e:
             // @todo
             break;
 
-          f_abstruse_int8s_e:
-          f_abstruse_int16s_e:
-          f_abstruse_int32s_e:
-          f_abstruse_int64s_e:
-          f_abstruse_signeds_e:
+          case f_abstruse_int8s_e:
+          case f_abstruse_int16s_e:
+          case f_abstruse_int32s_e:
+          case f_abstruse_int64s_e:
+          case f_abstruse_signeds_e:
             // @todo
             break;
 
-          f_abstruse_uint8s_e:
-          f_abstruse_uint16s_e:
-          f_abstruse_uint32s_e:
-          f_abstruse_uint64s_e:
-          f_abstruse_unsigneds_e:
+          case f_abstruse_uint8s_e:
+          case f_abstruse_uint16s_e:
+          case f_abstruse_uint32s_e:
+          case f_abstruse_uint64s_e:
+          case f_abstruse_unsigneds_e:
             // @todo
             break;
 
-          f_abstruse_string_e:
-          f_abstruse_strings_e:
+          case f_abstruse_string_e:
+          case f_abstruse_strings_e:
             // @todo
             break;
 
-          f_abstruse_dynamic_e:
-          f_abstruse_dynamics_e:
+          case f_abstruse_dynamic_e:
+          case f_abstruse_dynamics_e:
             // @todo
             break;
 
-          f_abstruse_map_e:
-          f_abstruse_maps_e:
+          case f_abstruse_map_e:
+          case f_abstruse_maps_e:
             // @todo
             break;
 
-          f_abstruse_map_multi_e:
-          f_abstruse_map_multis_e:
+          case f_abstruse_map_multi_e:
+          case f_abstruse_map_multis_e:
             // @todo
             break;
 
-          f_abstruse_quantity_e:
-          f_abstruse_quantitys_e:
+          case f_abstruse_quantity_e:
+          case f_abstruse_quantitys_e:
             // @todo
             break;
 
-          f_abstruse_range_e:
-          f_abstruse_ranges_e:
+          case f_abstruse_range_e:
+          case f_abstruse_ranges_e:
             // @todo
             break;
 
-          f_abstruse_triple_e:
-          f_abstruse_triples_e:
+          case f_abstruse_triple_e:
+          case f_abstruse_triples_e:
             // @todo
             break;
+
+          default:
+            break;
         }
       } // for
     }
-*/
+
     if (state->code & f_fss_payload_write_payload_object_e) {
-      // @todo flag for writing "payload:"
+      internal.step = f_fss_payload_write_payload_object_e;
+
+      state->status = f_string_dynamic_append(f_fss_payload_object_payload_s, destination);
+
+      if (F_status_is_error(state->status)) {
+        if (state->handle) {
+          state->handle((void * const) state, (void * const) &internal);
+
+          if (F_status_is_error(state->status)) {
+            destination->used = internal.original;
+
+            return;
+          }
+        }
+        else {
+          destination->used = internal.original;
+
+          return;
+        }
+      }
     }
 
     state->status = F_okay;
index 729328b660025b68ae9dc29014ea402a60eacc1c..0b17b04592148479da5e82b32fbc07aabb9c8492 100644 (file)
@@ -21,6 +21,7 @@
 #include <fll/level_0/string.h>
 #include <fll/level_0/utf.h>
 #include <fll/level_0/abstruse.h>
+#include <fll/level_0/conversion.h>
 #include <fll/level_0/fss.h>
 
 // FLL-1 includes.
 extern "C" {
 #endif
 
+/**
+ * An internal structure for the fss_payload_header_write() passed to callbacks.
+ *
+ * Properties:
+ *   - step:        The current step.
+ *   - i:           A counter used for the "headers" and "signatures" outer arrays.
+ *   - j:           A counter used for the inner loop or for pre-allocation counting.
+ *   - conversion:  The conversion data.
+ *   - destination: The destination string being written to.
+ *   - original:    The original destination used length.
+ */
+#ifndef _di_f_fss_payload_header_write_internal_t_
+  typedef struct {
+    uint16_t step;
+    f_number_unsigned_t i;
+    f_number_unsigned_t j;
+    f_string_range_t range;
+    f_conversion_data_t conversion;
+
+    f_string_dynamic_t * const destination;
+    const f_number_unsigned_t original;
+  } f_fss_payload_header_write_internal_t;
+
+  #define f_fss_payload_header_write_internal_t_initialize { \
+    0, \
+    0, \
+    0, \
+    f_string_range_t_initialize, \
+    f_conversion_data_base_10_c, \
+    0, \
+    0, \
+  }
+
+  #define macro_f_fss_payload_header_write_internal_t_initialize_1(step, i, j, range, conversion, destination, original) { \
+    step, \
+    i, \
+    j, \
+    range, \
+    conversion, \
+    destination, \
+    original, \
+  }
+
+  #define macro_f_fss_payload_header_write_internal_t_initialize_2(destination, original) { \
+    0, \
+    0, \
+    0, \
+    f_string_range_t_initialize, \
+    f_conversion_data_base_10_c, \
+    destination, \
+    original, \
+  }
+#endif // _di_f_fss_payload_header_write_internal_t_
+
+/**
+ * A state structure for passing data to fss_payload_header_write().
+ *
+ * Properties:
+ *   - conversion: The conversion data.
+ *   - cache:      A string cache to use (generally required to be not NULL).
+ */
+#ifndef _di_f_fss_payload_header_write_state_t_
+  typedef struct {
+    f_conversion_data_t conversion;
+
+    f_string_dynamic_t *cache;
+  } f_fss_payload_header_write_state_t;
+
+  #define f_fss_payload_header_write_state_t_initialize { \
+    f_conversion_data_base_10_c, \
+    0, \
+  }
+
+  #define macro_f_fss_payload_header_write_state_t_initialize_1(conversion, destination) { \
+    conversion, \
+    destination, \
+  }
+
+  #define macro_f_fss_payload_header_write_state_t_initialize_2(destination) { \
+    f_conversion_data_base_10_c, \
+    destination, \
+  }
+#endif // _di_f_fss_payload_header_write_state_t_
+
 // @todo fl_fss_payload_header_read() to build an array of f_abstruse for the headers?
 
 /**
@@ -52,15 +137,20 @@ extern "C" {
  *   The string in which the resulting header is appended to.
  *   Must not be NULL.
  * @param state
- *   @todo update this as appropriate after implementing this function.
  *   A state for providing flags and handling interrupts during long running operations.
- *   There is no state.handle().
+ *   The state.handle() is optionally allowed.
  *   There is no "callbacks" structure.
- *   There is no data structure passed to these functions.
+ *   The data is required and set to f_fss_payload_header_write_state_t.
+ *   The data.cache must not be NULL.
+ *
+ *   The optional state->handle() is called on error and the handler may alter the status to not have an error bit step to prevent returning except for when there is an invalid parameter passed to this function.
+ *   The second parameter is a f_fss_payload_header_write_internal_t.
+ *   The second parameter to state->handle() is NULL on invalid paramter passed to this function.
  *
  *   When state.interrupt() returns, only F_interrupt and F_interrupt_not are processed.
  *   Error bit designates an error but must be passed along with F_interrupt.
  *   All other statuses are ignored.
+ *   The second parameter is a f_fss_payload_header_write_internal_t.
  *
  *   Must not be NULL.
  *
index df75c6b1f130c33c74a6a56fd6a091b5d9b1afc6..bf14a8e7181681f703ef0eb8f2fee1d131e98450 100644 (file)
@@ -728,7 +728,7 @@ extern "C" {
 #endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_)
 
 #if !defined(_di_fl_fss_basic_object_write_) || !defined(_di_fl_fss_extended_object_write_) || !defined(_di_fl_fss_extended_content_write_)
-  void private_fl_fss_basic_write(const bool object_as, const f_string_static_t object, const uint8_t quote, f_string_range_t *range, f_string_dynamic_t *destination, f_state_t * const state) {
+  void private_fl_fss_basic_write(const bool object_as, const f_string_static_t object, const uint8_t quote, f_string_range_t *range, f_string_dynamic_t *destination, f_state_t * const state, void * const internal) {
 
     f_fss_skip_past_space(object, range, state);
     if (F_status_is_error(state->status)) return;
@@ -785,7 +785,7 @@ extern "C" {
     for (; range->start <= range->stop && range->start < object.used; ) {
 
       if (state->interrupt) {
-        state->interrupt((void *) state, 0);
+        state->interrupt((void *) state, internal);
         if (F_status_set_fine(state->status) == F_interrupt) break;
       }
 
@@ -796,7 +796,7 @@ extern "C" {
         for (; range->start <= range->stop && range->start < object.used; ++range->start) {
 
           if (state->interrupt) {
-            state->interrupt((void *) state, 0);
+            state->interrupt((void *) state, internal);
             if (F_status_set_fine(state->status) == F_interrupt) break;
           }
 
@@ -1076,7 +1076,7 @@ extern "C" {
         for (i = input_start + 1; i <= range->stop && i < object.used; ++i) {
 
           if (state->interrupt) {
-            state->interrupt((void *) state, 0);
+            state->interrupt((void *) state, internal);
 
             if (F_status_set_fine(state->status) == F_interrupt) {
               destination->used = used_start;
index a769749db0bc7b62764d87595c907a4cda275433..422d9eb46f4824938c63e01c47a11c36e0c98b90 100644 (file)
@@ -209,6 +209,9 @@ extern "C" {
  *     Errors (with error bit) from: f_memory_array_increase().
  *     Errors (with error bit) from: f_memory_array_increase_by().
  *     Errors (with error bit) from: f_utf_buffer_increment().
+ * @param internal
+ *   (optional) Used by certain functions to pass local data to the interrupt() and similar callbacks.
+ *   Set to NULL to not use.
  *
  * @see f_fss_is_space()
  * @see f_fss_skip_past_delimit()
@@ -221,7 +224,7 @@ extern "C" {
  * @see fl_fss_extended_content_write()
  */
 #if !defined(fl_fss_basic_object_write) || !defined(fl_fss_extended_object_write) || !defined(_di_fl_fss_extended_content_write_)
-  extern void private_fl_fss_basic_write(const bool object_as, const f_string_static_t object, const uint8_t quote, f_string_range_t * const range, f_string_dynamic_t * const destination, f_state_t * const state) F_attribute_visibility_internal_d;
+  extern void private_fl_fss_basic_write(const bool object_as, const f_string_static_t object, const uint8_t quote, f_string_range_t * const range, f_string_dynamic_t * const destination, f_state_t * const state, void * const internal) F_attribute_visibility_internal_d;
 #endif // !defined(fl_fss_basic_object_write) || !defined(fl_fss_extended_object_write) || !defined(_di_fl_fss_extended_content_write_)
 
 /**
index e01bf7b5867645c21759972637b8029aa2280818..c8bde3c52d8343e2ee0f9e717bdde203077144b4 100644 (file)
@@ -6,5 +6,6 @@ f_memory
 f_string
 f_utf
 f_abstruse
+f_conversion
 f_file
 f_fss
index 84ebe7eb9a0b0e9e04bbac9387ce36ca451c3fa1..b46fa47c7a5b0fc9853cecf033c66c29a5323002 100644 (file)
@@ -30,7 +30,7 @@ build_indexer_arguments rcs
 build_language c
 
 build_libraries -lc
-build_libraries-individual -lf_abstruse -lf_file -lf_fss -lf_memory -lf_string -lf_type_array -lf_utf
+build_libraries-individual -lf_abstruse -lf_conversion -lf_file -lf_fss -lf_memory -lf_string -lf_type_array -lf_utf
 
 build_sources_library private-fss.c fss/basic.c fss/basic_list.c fss/embedded_list.c fss/extended.c fss/extended_list.c fss/payload.c