]> Kevux Git Server - fll/commitdiff
Progress: Continue working on getting FSS Embedded Read working and tweak allocations.
authorKevin Day <Kevin@kevux.org>
Tue, 27 Aug 2024 04:22:59 +0000 (23:22 -0500)
committerKevin Day <Kevin@kevux.org>
Tue, 27 Aug 2024 04:22:59 +0000 (23:22 -0500)
The extended list needs a separate parameter and make the `line_start` match the `newline_last` at the start of the function.
Record `newline_last` and `line_start` whenever possible once a new line is found.
Use the variable `comment_start` to make the purpose more clear.

The `closes` array should be initialized before calling `fl_fss_extended_list_content_read()`.
Make sure the `closes` array value is reset when the Content is not found.
Make sure the `closes` array used length is incremented.

The FSS Read functions now handle printing the close strings.
I am now considering adding an `open` variable.
Doing this would then merit moving most things into the `f_fss_item_t`.

Tweak some of the allocations in other FSS functions for allocations that need explicit sizes (`f_memory_array_increase_by()`).

16 files changed:
level_1/fl_fss/c/fss/basic.c
level_1/fl_fss/c/fss/basic_list.c
level_1/fl_fss/c/fss/embedded_list.c
level_1/fl_fss/c/fss/extended.c
level_1/fl_fss/c/fss/extended_list.c
level_2/fll_fss/c/fss/embedded_list.c
level_2/fll_fss/c/fss/extended_list.c
level_3/fss_read/c/embedded_list/print.c
level_3/fss_read/c/embedded_list/print.h
level_3/fss_read/c/embedded_list/process_normal.c
level_3/fss_read/c/extended_list/print.c
level_3/fss_read/c/extended_list/print.h
level_3/fss_read/c/main/common/type.h
level_3/fss_read/c/main/print/data.c
level_3/fss_read/c/main/print/data.h
level_3/fss_read/c/main/process_normal.c

index 5d6e287cf53bb0345c082ec2784db7b4d18c1f68..bac889015d48771ff3ce43634c738018b3fcb925 100644 (file)
@@ -209,7 +209,7 @@ extern "C" {
 
       // Objects cannot be empty, so write a quote empty string.
       {
-        const f_status_t status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+        const f_status_t status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
         if (F_status_is_error(status)) {
           destination->used = destination_used;
index 24b00fc9e81578924c29245d815bec3c6d98d3e7..5c0fcf8c9d8b2246fd8e9d45f254257e575d86df 100644 (file)
@@ -340,7 +340,7 @@ extern "C" {
     }
 
     // Ensure that there is room for a slash delimit and possibly the end of content character.
-    state->status = f_memory_array_increase_by(state->step_small + 3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+    state->status = f_memory_array_increase_by(3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
     if (F_status_is_error(state->status)) return;
 
     const f_number_unsigned_t destination_used = destination->used;
@@ -451,7 +451,7 @@ extern "C" {
         if (content.string[range->start] == f_fss_eol_s.string[0] || range->start >= content.used || range->start > range->stop) {
 
           // Increase by slash and basic list open and possible newline.
-          state->status = f_memory_array_increase_by(state->step_small + 3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+          state->status = f_memory_array_increase_by(3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
           destination->string[destination->used++] = f_fss_slash_s.string[0];
@@ -893,7 +893,7 @@ extern "C" {
     if (state->status == F_okay_stop || state->status == F_okay_eos) {
       if (complete == f_fss_complete_partial_e || complete == f_fss_complete_partial_trim_e || complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) {
         {
-          const f_status_t status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+          const f_status_t status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
           if (F_status_is_error(status)) {
             state->status = status;
index e001f6ec4c590145c5b023a5b6237921e9def51b..668f1d6fe6828019c57fbd176482696122106506 100644 (file)
@@ -776,7 +776,7 @@ extern "C" {
 
     if (range->start > range->stop || range->start >= content.used) {
       if (complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e || complete == f_fss_complete_end_e) {
-        const f_status_t status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+        const f_status_t status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
         if (F_status_is_error(status)) {
           state->status = status;
@@ -888,7 +888,7 @@ extern "C" {
           }
 
           // Increase by character at "start" and possible newline.
-          state->status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+          state->status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
           destination->string[destination->used++] = content.string[start];
@@ -949,7 +949,7 @@ extern "C" {
           }
 
           // Increase by slash and extended list open and possible newline.
-          state->status = f_memory_array_increase_by(state->step_small + 3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+          state->status = f_memory_array_increase_by(3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
           destination->string[destination->used++] = f_fss_slash_s.string[0];
@@ -1022,7 +1022,7 @@ extern "C" {
     }
 
     if (complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e || complete == f_fss_complete_end_e) {
-      state->status = f_memory_array_increase_by(state->step_small + 3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+      state->status = f_memory_array_increase_by(3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
       if (F_status_is_error(state->status)) return;
 
       if (!ends_on_eol) {
@@ -1427,7 +1427,7 @@ extern "C" {
     if (state->status == F_data_not_stop || state->status == F_data_not_eos) {
       if (complete == f_fss_complete_partial_e || complete == f_fss_complete_partial_trim_e || complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) {
         {
-          const f_status_t status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+          const f_status_t status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
           if (F_status_is_error(status)) {
             state->status = status;
@@ -1447,7 +1447,7 @@ extern "C" {
     }
 
     // Ensure that there is room for a slash delimit, the object open character, and the end of line character.
-    state->status = f_memory_array_increase_by(state->step_small + 4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+    state->status = f_memory_array_increase_by(4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
     if (F_status_is_error(state->status)) return;
 
     const f_number_unsigned_t destination_used = destination->used;
@@ -1625,7 +1625,7 @@ extern "C" {
       }
 
       if (complete != f_fss_complete_trim_e) {
-        state->status = f_memory_array_increase_by(state->step_small + 3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+        state->status = f_memory_array_increase_by(3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
         if (F_status_is_error(state->status)) {
           destination->used = destination_used;
index 69d20dc5521c2871bb97f2374d1a4a3d446e71e4..e723471d99f99efe11f8de6f92d1839db73d3a72 100644 (file)
@@ -174,7 +174,7 @@ extern "C" {
     if (state->status == F_data_not_stop || state->status == F_data_not_eos) {
 
       // Content that is empty must be represented by a quote empty string.
-      status = f_memory_array_increase_by(state->step_small + 4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+      status = f_memory_array_increase_by(4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
       if (F_status_is_error(status)) {
         state->status = status;
@@ -198,7 +198,7 @@ extern "C" {
     }
 
     // Ensure that there is room, including the slash delimit and possibly the end of content characters.
-    status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+    status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
     if (F_status_is_error(status)) {
       state->status = status;
@@ -272,7 +272,7 @@ void fl_fss_extended_object_write(const f_string_static_t object, const uint8_t
     if (state->status == F_data_not_stop || state->status == F_data_not_eos) {
 
       // Objects cannot be empty, so write a quote empty string.
-      status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+      status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
       if (F_status_is_error(status)) {
         destination->used = destination_used;
index 58fb27d92acd9996b56b5517c6ad7745f9164455..4ae954018406092e098d2f7cf1937d081ce7e817 100644 (file)
@@ -45,10 +45,11 @@ extern "C" {
 
     found->array[found->used].start = range->start;
 
+    f_number_unsigned_t line_start = range->start;
     f_number_unsigned_t newline_last = range->start;
     f_number_unsigned_t slash_first = 0;
     f_number_unsigned_t slash_count = 0;
-    f_number_unsigned_t line_start = 0;
+    f_number_unsigned_t comment_start = 0;
 
     // Identify where the content ends.
     while (range->start <= range->stop && range->start < buffer.used) {
@@ -117,6 +118,9 @@ extern "C" {
           if (range->start > range->stop || range->start >= buffer.used) break;
 
           if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
+            newline_last = range->start;
+            line_start = range->start + 1;
+
             state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
             if (F_status_is_error(state->status)) break;
 
@@ -161,7 +165,6 @@ extern "C" {
         } // while
 
         if (F_status_is_error(state->status)) break;
-
         if (range->start > range->stop || range->start >= buffer.used) break;
 
         // Found a valid content close, set stop point to last newline.
@@ -193,26 +196,24 @@ extern "C" {
       if (buffer.string[range->start] == f_fss_comment_s.string[0]) {
 
         // The newline_last is initialized to the range->start, which may not actually be a new line.
-        line_start = (buffer.string[newline_last] == f_string_eol_s.string[0]) ? newline_last + 1 : newline_last;
+        comment_start = (buffer.string[newline_last] == f_string_eol_s.string[0]) ? newline_last + 1 : newline_last;
 
         f_fss_seek_to_eol(buffer, range, state);
         if (F_status_is_error(state->status)) break;
 
-        state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &comments->array, &comments->used, &comments->size);
-        if (F_status_is_error(state->status)) break;
-
         if (range->start > range->stop || range->start >= buffer.used) {
           --range->start;
         }
         else {
           newline_last = range->start;
+          line_start = newline_last + 1;
         }
 
-        comments->array[comments->used].start = line_start;
-        comments->array[comments->used++].stop = range->start++;
+        state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &comments->array, &comments->used, &comments->size);
+        if (F_status_is_error(state->status)) break;
 
-        // The newline_last is initialized to the range->start, which may not actually be a new line.
-        line_start = (buffer.string[newline_last] == f_string_eol_s.string[0]) ? newline_last + 1 : newline_last;
+        comments->array[comments->used].start = comment_start;
+        comments->array[comments->used++].stop = range->start++;
 
         continue;
       }
@@ -259,7 +260,7 @@ extern "C" {
     if (range->start > range->stop || range->start >= content.used) {
       if (complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e || complete == f_fss_complete_end_e) {
         {
-          const f_status_t status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+          const f_status_t status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
           if (F_status_is_error(status)) {
             state->status = status;
@@ -276,7 +277,7 @@ extern "C" {
     }
 
     // Ensure that there is room for a slash delimit and possibly the end of content characters.
-    state->status = f_memory_array_increase_by(state->step_small + 4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+    state->status = f_memory_array_increase_by(4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
     if (F_status_is_error(state->status)) return;
 
     const f_number_unsigned_t destination_used = destination->used;
@@ -303,7 +304,7 @@ extern "C" {
         slash_count = 1;
 
         if (do_prepend) {
-          state->status = f_memory_array_increase_by(state->step_small + prepend->used, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+          state->status = f_memory_array_increase_by(prepend->used, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
           state->status = f_string_dynamic_append(*prepend, destination);
@@ -354,7 +355,7 @@ extern "C" {
             // Do nothing.
           }
           else if (content.string[range->start] == f_fss_eol_s.string[0] || range->start >= content.used || range->start > range->stop) {
-            state->status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+            state->status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
             if (F_status_is_error(state->status)) break;
 
             destination->string[destination->used++] = f_fss_slash_s.string[0];
@@ -373,7 +374,7 @@ extern "C" {
           }
 
           // Increase by character at "start" and possible newline.
-          state->status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+          state->status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
           destination->string[destination->used++] = content.string[start];
@@ -434,7 +435,7 @@ extern "C" {
           }
 
           // Increase by slash and extended list close.
-          state->status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+          state->status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
           destination->string[destination->used++] = f_fss_slash_s.string[0];
@@ -507,7 +508,7 @@ extern "C" {
     }
 
     if (complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e || complete == f_fss_complete_end_e) {
-      state->status = f_memory_array_increase_by(state->step_small + 3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+      state->status = f_memory_array_increase_by(3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
       if (F_status_is_error(state->status)) {
         destination->used = destination_used;
@@ -622,7 +623,7 @@ extern "C" {
     f_number_unsigned_t slash_first = 0;
     f_number_unsigned_t slash_count = 0;
 
-    bool graph_first = F_true;
+    uint8_t graph_first = F_true;
 
     // Identify where the object ends.
     while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) {
@@ -923,7 +924,7 @@ extern "C" {
     if (state->status == F_data_not_stop || state->status == F_data_not_eos) {
       if (complete == f_fss_complete_partial_e || complete == f_fss_complete_partial_trim_e || complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) {
         {
-          const f_status_t status = f_memory_array_increase_by(state->step_small + 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+          const f_status_t status = f_memory_array_increase_by(2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
           if (F_status_is_error(status)) {
             state->status = status;
@@ -943,7 +944,7 @@ extern "C" {
     }
 
     // Ensure that there is room for a slash delimit, the object open character, and the end of line character.
-    state->status = f_memory_array_increase_by(state->step_small + 4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+    state->status = f_memory_array_increase_by(4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
     if (F_status_is_error(state->status)) return;
 
     const f_number_unsigned_t destination_used = destination->used;
@@ -1122,7 +1123,7 @@ extern "C" {
       }
 
       if (complete != f_fss_complete_trim_e) {
-        state->status = f_memory_array_increase_by(state->step_small + 3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+        state->status = f_memory_array_increase_by(3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
         if (F_status_is_error(state->status)) {
           destination->used = destination_used;
index f795fe44b7b1b1fefa55de3a79fa6a088319c535..947f5b94b2ac638d3e35b43eeaafd6c091be80b9 100644 (file)
@@ -18,7 +18,7 @@ extern "C" {
 
     f_number_unsigned_t initial_used = 0;
 
-    bool found_data = F_false;
+    uint8_t found_data = F_false;
 
     if (!nest->used) {
       state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_nest_t), (void **) &nest->depth, &nest->used, &nest->size);
index 5ef33a9019fa6570425360e8b134470336fa3e6c..7edd7b30a71b3fc5b894776c7585ad3fb428f6d6 100644 (file)
@@ -19,7 +19,7 @@ extern "C" {
     f_status_t status = F_okay;
     f_number_unsigned_t initial_used = objects->used;
 
-    bool found_data = F_false;
+    uint8_t found_data = F_false;
 
     do {
       state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &objects->array, &objects->used, &objects->size);
@@ -59,6 +59,8 @@ extern "C" {
         if (state->status == F_fss_found_object) {
           found_data = F_true;
           contents->array[contents->used].used = 0;
+          closes->array[closes->used].start = 1;
+          closes->array[closes->used].stop = 0;
 
           fl_fss_extended_list_content_read(buffer, range, &contents->array[contents->used], &closes->array[closes->used], contents_delimits ? contents_delimits : objects_delimits, comments, state);
           if (F_status_is_error(state->status)) return;
@@ -74,6 +76,10 @@ extern "C" {
         ++contents->array[contents->used++].used;
         ++objects->used;
 
+        // The Content end is not found so make sure the closes designates that the close is not found.
+        closes->array[closes->used].start = 1;
+        closes->array[closes->used++].stop = 0;
+
         return;
       }
 
@@ -103,6 +109,8 @@ extern "C" {
         }
 
         contents->array[contents->used].used = 0;
+        closes->array[closes->used].start = 1;
+        closes->array[closes->used].stop = 0;
       }
 
       if (range->start >= range->stop || range->start >= buffer.used) {
@@ -111,6 +119,7 @@ extern "C" {
         if (state->status == F_fss_found_object || state->status == F_fss_found_content || state->status == F_fss_found_content_not || state->status == F_fss_found_object_content_not) {
           ++objects->used;
           ++contents->used;
+          ++closes->used;
         }
 
         state->status = (range->start >= buffer.used) ? F_okay_eos : F_okay_stop;
@@ -120,6 +129,7 @@ extern "C" {
 
       ++objects->used;
       ++contents->used;
+      ++closes->used;
 
     } while (range->start < F_string_t_size_d);
 
index dc5e6aaec7341b61d600d13124c6e8cecbfee4d8..cec5896425899d5b176d085e6da42cb7f56568ed 100644 (file)
@@ -58,7 +58,7 @@ extern "C" {
 #endif // _di_fss_read_embedded_list_print_object_end_empty_
 
 #ifndef _di_fss_read_embedded_list_print_set_end_
-  f_status_t fss_read_embedded_list_print_set_end(fl_print_t * const print) {
+  f_status_t fss_read_embedded_list_print_set_end(fl_print_t * const print, const f_number_unsigned_t close) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
 
@@ -67,7 +67,13 @@ extern "C" {
     if ((main->setting.flag & fss_read_main_flag_object_d) && (main->setting.flag & fss_read_main_flag_content_d)) {
       f_file_stream_lock(print->to);
 
-      f_print_dynamic_raw(f_fss_embedded_list_close_s, print->to);
+      if (close < main->setting.closes.used) {
+        f_print_dynamic_partial(main->setting.buffer, main->setting.closes.array[close], print->to);
+      }
+      else {
+        f_print_dynamic_raw(f_fss_embedded_list_close_s, print->to);
+      }
+
       f_print_dynamic_raw(f_fss_embedded_list_close_end_s, print->to);
 
       f_file_stream_unlock(print->to);
index 406e0d277b599892675685798be8d79a8fe9b605..8b5a415f054c1391fe6f0384b01da1d66c1d8171 100644 (file)
@@ -100,6 +100,8 @@ extern "C" {
  *   The print.custom is expected to be of type fss_read_main_t.
  *
  *   This does not alter print.custom.setting.state.status.
+ * @param close
+ *   The position within the close array representing the range within the buffer for the close string.
  *
  * @return
  *   F_okay on success.
@@ -108,7 +110,7 @@ extern "C" {
  *   F_output_not (with error bit) if a parameter is NULL.
  */
 #ifndef _di_fss_read_embedded_list_print_set_end_
-  extern f_status_t fss_read_embedded_list_print_set_end(fl_print_t * const print);
+  extern f_status_t fss_read_embedded_list_print_set_end(fl_print_t * const print, const f_number_unsigned_t close);
 #endif // _di_fss_read_embedded_list_print_set_end_
 
 /**
index 34f8e89a53c2f6d37128a1b28d8d70525a77f6b0..15ee63992f568eb54bfa67820bd76e26dc73c791 100644 (file)
@@ -122,7 +122,7 @@ extern "C" {
       return;
     }
 
-    if ((main->setting.flag & fss_read_main_flag_depth_d) && main->setting.nest.used > 1) {
+    if ((main->setting.flag & fss_read_main_flag_depth_d) && depth && main->setting.nest.used > 1) {
       f_number_unsigned_t i = 0;
 
       // @todo make an array of depths based on size.
@@ -143,12 +143,16 @@ extern "C" {
     main->setting.state.status = f_memory_array_resize(main->setting.nest.depth[depth].used, sizeof(f_range_t), (void **) &main->setting.objects.array, &main->setting.objects.used, &main->setting.objects.size);
     if (F_status_is_error(main->setting.state.status)) return;
 
+    main->setting.state.status = f_memory_array_resize(main->setting.nest.depth[depth].used, sizeof(f_range_t), (void **) &main->setting.closes.array, &main->setting.closes.used, &main->setting.closes.size);
+    if (F_status_is_error(main->setting.state.status)) return;
+
     main->setting.state.status = f_memory_array_resize(main->setting.nest.depth[depth].used, sizeof(f_ranges_t), (void **) &main->setting.contents.array, &main->setting.contents.used, &main->setting.contents.size);
     if (F_status_is_error(main->setting.state.status)) return;
 
     for (; main->setting.objects.used < main->setting.nest.depth[depth].used; ++main->setting.objects.used) {
 
       main->setting.objects.array[main->setting.objects.used] = main->setting.nest.depth[depth].array[main->setting.objects.used].object;
+      main->setting.closes.array[main->setting.objects.used] = main->setting.nest.depth[depth].array[main->setting.objects.used].close;
 
       // Use a static array for the inner Content that points to the depth, and so ensure the size is 0 to designate this is not dynamically allocated here.
       if (main->setting.nest.depth[depth].array[main->setting.objects.used].content.used) {
@@ -163,6 +167,7 @@ extern "C" {
       }
     } // for
 
+    main->setting.closes.used = main->setting.objects.used;
     main->setting.contents.used = main->setting.objects.used;
 
     fss_read_ensure_quotes_length(main);
index 82c3a879dacc34495b8e7546c80acb85f1724d03..eeaf18b407cbb5da88fc2780e28723562bd857c9 100644 (file)
@@ -58,7 +58,7 @@ extern "C" {
 #endif // _di_fss_read_extended_list_print_object_end_content_
 
 #ifndef _di_fss_read_extended_list_print_set_end_
-  f_status_t fss_read_extended_list_print_set_end(fl_print_t * const print) {
+  f_status_t fss_read_extended_list_print_set_end(fl_print_t * const print, const f_number_unsigned_t close) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
 
@@ -67,7 +67,13 @@ extern "C" {
     if ((main->setting.flag & fss_read_main_flag_object_d) && main->setting.flag & fss_read_main_flag_content_d) {
       f_file_stream_lock(print->to);
 
-      f_print_dynamic_raw(f_fss_extended_list_close_s, print->to);
+      if (close < main->setting.closes.used) {
+        f_print_dynamic_partial(main->setting.buffer, main->setting.closes.array[close], print->to);
+      }
+      else {
+        f_print_dynamic_raw(f_fss_extended_list_close_s, print->to);
+      }
+
       f_print_dynamic_raw(f_fss_extended_list_close_end_s, print->to);
 
       f_file_stream_unlock(print->to);
index bcc5a09b41aaa03d0df868936a24efc449b3b9a1..59d896c5d5f7765586f943627b08f6f91328b08d 100644 (file)
@@ -101,6 +101,8 @@ extern "C" {
  *   The print.custom is expected to be of type fss_read_main_t.
  *
  *   This does not alter print.custom.setting.state.status.
+ * @param close
+ *   The position within the close array representing the range within the buffer for the close string.
  *
  * @return
  *   F_okay on success.
@@ -109,7 +111,7 @@ extern "C" {
  *   F_output_not (with error bit) if a parameter is NULL.
  */
 #ifndef _di_fss_read_extended_list_print_set_end_
-  extern f_status_t fss_read_extended_list_print_set_end(fl_print_t * const print);
+  extern f_status_t fss_read_extended_list_print_set_end(fl_print_t * const print, const f_number_unsigned_t close);
 #endif // _di_fss_read_extended_list_print_set_end_
 
 /**
index 1511b4c77fade12a54b372741969743973770e7f..02a908f33a7f339b03b45b6e9ccfb6703d453721 100644 (file)
@@ -118,19 +118,17 @@ extern "C" {
  * The FSS Read cache.
  *
  * objects:   An Objects array used by the fll_fss_embedded_list_read() function.
- * closes:    An Object closes array used by the fll_fss_embedded_list_read() function.
  * positions: A positions array used by the fll_fss_embedded_list_read() function.
  * slashes:   A slashes array used by the fll_fss_embedded_list_read() function.
  */
 #ifndef _di_fss_read_cache_t_
   typedef struct {
     f_ranges_t objects;
-    f_ranges_t closes;
     f_number_unsigneds_t positions;
     f_number_unsigneds_t slashes;
   } fss_read_cache_t;
 
-  #define fss_read_cache_t_initialize { f_ranges_t_initialize, f_ranges_t_initialize, f_number_unsigneds_t_initialize, f_number_unsigneds_t_initialize }
+  #define fss_read_cache_t_initialize { f_ranges_t_initialize, f_number_unsigneds_t_initialize, f_number_unsigneds_t_initialize }
 #endif // _di_fss_read_cache_t_
 
 /**
@@ -179,7 +177,7 @@ extern "C" {
     f_status_t (*print_content_next)(fl_print_t * const print);
     f_status_t (*print_object_end)(fl_print_t * const print);
     f_status_t (*print_object_end_empty)(fl_print_t * const print);
-    f_status_t (*print_set_end)(fl_print_t * const print);
+    f_status_t (*print_set_end)(fl_print_t * const print, const f_number_unsigned_t close);
     f_status_t (*print_set_end_empty)(fl_print_t * const print);
   } fss_read_callback_t;
 
index 235675634b99577680ef0ec02bf6c40fa7ec8ec2..e0d6e92acf5309946ebf5f0ef418fa9b088f8a8f 100644 (file)
@@ -136,7 +136,7 @@ extern "C" {
 
         if ((print_state & 0x1) || !(print_state & 0x10)) {
           if (main->callback.print_set_end) {
-            main->callback.print_set_end(&main->program.output);
+            main->callback.print_set_end(&main->program.output, at);
           }
         }
       }
@@ -148,7 +148,7 @@ extern "C" {
         }
 
         if (main->callback.print_set_end) {
-          main->callback.print_set_end(&main->program.output);
+          main->callback.print_set_end(&main->program.output, at);
         }
       }
     }
@@ -158,7 +158,7 @@ extern "C" {
       }
 
       if (main->callback.print_set_end) {
-        main->callback.print_set_end(&main->program.output);
+        main->callback.print_set_end(&main->program.output, at);
       }
     }
 
@@ -326,7 +326,7 @@ extern "C" {
 #endif // _di_fss_read_print_quote_
 
 #ifndef _di_fss_read_print_set_end_
-  f_status_t fss_read_print_set_end(fl_print_t * const print) {
+  f_status_t fss_read_print_set_end(fl_print_t * const print, const f_number_unsigned_t close) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
 
@@ -337,7 +337,7 @@ extern "C" {
 #endif // _di_fss_read_print_set_end_
 
 #ifndef _di_fss_read_print_set_end_no_eol_
-  f_status_t fss_read_print_set_end_no_eol(fl_print_t * const print) {
+  f_status_t fss_read_print_set_end_no_eol(fl_print_t * const print, const f_number_unsigned_t close) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
 
index 35ee3302cacbf313615a008c288e5c2ec54a4c3a..9c0028591dab6eac318186e9ed82ceade19b79e3 100644 (file)
@@ -265,6 +265,8 @@ extern "C" {
  *   The print.custom is expected to be of type fss_read_main_t.
  *
  *   This does not alter print.custom.setting.state.status.
+ * @param close
+ *   The position within the close array representing the range within the buffer for the close string.
  *
  * @return
  *   F_okay on success.
@@ -273,7 +275,7 @@ extern "C" {
  *   F_output_not (with error bit) if a parameter is NULL.
  */
 #ifndef _di_fss_read_print_set_end_
-  extern f_status_t fss_read_print_set_end(fl_print_t * const print);
+  extern f_status_t fss_read_print_set_end(fl_print_t * const print, const f_number_unsigned_t close);
 #endif // _di_fss_read_print_set_end_
 
 /**
@@ -289,6 +291,8 @@ extern "C" {
  *   The print.custom is expected to be of type fss_read_main_t.
  *
  *   This does not alter print.custom.setting.state.status.
+ * @param close
+ *   The position within the close array representing the range within the buffer for the close string.
  *
  * @return
  *   F_okay on success.
@@ -297,7 +301,7 @@ extern "C" {
  *   F_output_not (with error bit) if a parameter is NULL.
  */
 #ifndef _di_fss_read_print_set_end_no_eol_
-  extern f_status_t fss_read_print_set_end_no_eol(fl_print_t * const print);
+  extern f_status_t fss_read_print_set_end_no_eol(fl_print_t * const print, const f_number_unsigned_t close);
 #endif // _di_fss_read_print_set_end_no_eol_
 
 #ifdef __cplusplus
index 5972fa6faa421a9b278b1898977008e6bf780720..7999ea0969cc5bf5194759f357dc62fea36d5345 100644 (file)
@@ -210,7 +210,7 @@ extern "C" {
 
           if (!(main->setting.flag & fss_read_main_flag_object_as_line_d)) {
             if (main->callback.print_set_end) {
-              main->callback.print_set_end(&main->program.output);
+              main->callback.print_set_end(&main->program.output, at);
             }
           }
 
@@ -240,7 +240,7 @@ extern "C" {
             if (!(main->setting.flag & fss_read_main_flag_object_as_line_d)) {
               if (*line == main->setting.line) {
                 if (main->callback.print_set_end) {
-                  main->callback.print_set_end(&main->program.output);
+                  main->callback.print_set_end(&main->program.output, at);
                 }
 
                 main->setting.state.status = F_success;
@@ -254,7 +254,7 @@ extern "C" {
           else if (main->setting.flag & fss_read_main_flag_empty_d) {
             if (*line == main->setting.line) {
               if (main->callback.print_set_end) {
-                main->callback.print_set_end(&main->program.output);
+                main->callback.print_set_end(&main->program.output, at);
               }
 
               main->setting.state.status = F_success;
@@ -269,7 +269,7 @@ extern "C" {
           if (main->setting.flag & fss_read_main_flag_empty_d) {
             if (*line == main->setting.line) {
               if (main->callback.print_set_end) {
-                main->callback.print_set_end(&main->program.output);
+                main->callback.print_set_end(&main->program.output, at);
               }
 
               main->setting.state.status = F_success;
@@ -322,7 +322,7 @@ extern "C" {
           }
 
           if (main->callback.print_set_end) {
-            main->callback.print_set_end(&main->program.output);
+            main->callback.print_set_end(&main->program.output, at);
           }
 
           main->setting.state.status = F_success;
@@ -389,7 +389,7 @@ extern "C" {
       if ((main->setting.flag & fss_read_main_flag_object_d) && (main->setting.flag & fss_read_main_flag_content_has_close_d)) {
         if (*line == main->setting.line) {
           if (main->callback.print_set_end) {
-            main->callback.print_set_end(&main->program.output);
+            main->callback.print_set_end(&main->program.output, at);
           }
 
           main->setting.state.status = F_success;