]> Kevux Git Server - fll/commitdiff
Update: The FSS Lists (FSS-0002, FSS-0003, FSS-0008, etc..) to match recent specifica...
authorKevin Day <Kevin@kevux.org>
Sat, 31 Aug 2024 23:43:50 +0000 (18:43 -0500)
committerKevin Day <Kevin@kevux.org>
Sun, 1 Sep 2024 00:55:13 +0000 (19:55 -0500)
Update the Object read functions to be in compliance with the latest specification changes.
Review and update the code, fixing any observed problems and perform some clean ups.

I noticed that several of the list functions for Object read are almost identical.
Move this logic into into a shared private function to reduce repeated code.

The runtime tests are also updated.

I still need to review the Content read functions.
I probably may be able to also find similar, if not identical, code for the list write functions as well.
I will review the code and create a private function similar to what is done here if deemed possible and reasonable.

106 files changed:
build/level_1/settings
build/monolithic/settings
build/stand_alone/fake.settings
build/stand_alone/firewall.settings
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_1/fl_fss/c/private-fss-list.c [new file with mode: 0644]
level_1/fl_fss/c/private-fss-list.h [new file with mode: 0644]
level_1/fl_fss/c/private-fss.c
level_1/fl_fss/c/private-fss.h
level_1/fl_fss/data/build/settings
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object-name-hi-select-0-empty.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object-name-hi-select-0.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object-name-hi.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object-name-привет_has_space.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object-select-0.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object_and_content-name-hi-select-0-empty.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object_and_content-name-hi-select-0.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object_and_content-name-hi.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object_and_content-name-привет_has_space-select-0.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object_and_content-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object_and_content-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object_and_content-select-0.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0000-basic-object_and_content.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object-name-a-original-empty.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object-name-a-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object-name-a-select-0.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object-name-a.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object-select-0.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object_and_content-line-6-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object_and_content-line-6.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object_and_content-name-a-original-empty.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object_and_content-name-a-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object_and_content-name-a-select-0.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object_and_content-name-a.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object_and_content-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object_and_content-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object_and_content-select-0.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0001-empty_name_list-object_and_content.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object-at-6.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object-line-6-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object-line-6.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object-select-0.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object_and_content-at-6.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object_and_content-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object_and_content-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object_and_content-select-0.expect
level_3/fss_read/tests/runtime/fss_0003/expect/test-0002-mixed-object_and_content.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object-name-hi-select-0-empty.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object-name-hi-select-0.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object-name-hi.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object-name-привет_has_space.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object-select-0.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object_and_content-name-hi-select-0-empty.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object_and_content-name-hi-select-0.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object_and_content-name-hi.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object_and_content-name-привет_has_space-select-0.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object_and_content-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object_and_content-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object_and_content-select-0.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0000-basic-object_and_content.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object-name-a-original-empty.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object-name-a-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object-name-a-select-0.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object-name-a.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object-select-0.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object_and_content-line-6-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object_and_content-line-6.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object_and_content-name-a-original-empty.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object_and_content-name-a-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object_and_content-name-a-select-0.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object_and_content-name-a.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object_and_content-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object_and_content-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object_and_content-select-0.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0001-empty_name_list-object_and_content.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object-at-6.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object-line-6-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object-line-6.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object-select-0.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object_and_content-at-6.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object_and_content-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object_and_content-select-0-original.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object_and_content-select-0.expect
level_3/fss_read/tests/runtime/fss_0008/expect/test-0002-mixed-object_and_content.expect

index 366120c6aee407fb14edd4fb53bf511d9eb45520..307b3997944dff5da6776b1b292da3616413895a 100644 (file)
@@ -41,7 +41,7 @@ build_sources_library control_group.c
 build_sources_library conversion.c private-conversion.c conversion/common.c
 build_sources_library directory.c private-directory.c
 build_sources_library environment.c
-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 fss/private-payload.c fss/private-payload-helper.c
+build_sources_library private-fss.c private-fss-list.c fss/basic.c fss/basic_list.c fss/embedded_list.c fss/extended.c fss/extended_list.c fss/payload.c fss/private-payload.c fss/private-payload-helper.c
 build_sources_library iki.c
 build_sources_library path.c
 build_sources_library print.c private-print.c print/common.c
index 5155e3584d2cd13e9cda580c40567007e326d27b..69f81228ef5dddb2bd90a7c7854eb21071890cfb 100644 (file)
@@ -88,7 +88,7 @@ build_sources_library level_1/control_group.c
 build_sources_library level_1/conversion.c level_1/private-conversion.c level_1/conversion/common.c
 build_sources_library level_1/directory.c level_1/private-directory.c
 build_sources_library level_1/environment.c
-build_sources_library level_1/private-fss.c level_1/fss/basic.c level_1/fss/basic_list.c level_1/fss/embedded_list.c level_1/fss/extended.c level_1/fss/extended_list.c level_1/fss/payload.c level_1/fss/private-payload.c level_1/fss/private-payload-helper.c
+build_sources_library level_1/private-fss.c level_1/private-fss-list.c level_1/fss/basic.c level_1/fss/basic_list.c level_1/fss/embedded_list.c level_1/fss/extended.c level_1/fss/extended_list.c level_1/fss/payload.c level_1/fss/private-payload.c level_1/fss/private-payload-helper.c
 build_sources_library level_1/iki.c
 build_sources_library level_1/path.c
 build_sources_library level_1/print.c level_1/private-print.c level_1/print/common.c
index b0ebfce47169c07dc702cb3f675707ef2fd8743e..663231169d95c79d96a8fa5088ed5da6e5a494c1 100644 (file)
@@ -71,7 +71,7 @@ build_sources_program fll/level_1/control_group.c
 build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c
 build_sources_program fll/level_1/directory.c fll/level_1/private-directory.c
 build_sources_program fll/level_1/environment.c
-build_sources_program fll/level_1/private-fss.c fll/level_1/fss/basic.c fll/level_1/fss/basic_list.c fll/level_1/fss/embedded_list.c fll/level_1/fss/extended.c fll/level_1/fss/extended_list.c fll/level_1/fss/payload.c
+build_sources_program fll/level_1/private-fss.c fll/level_1/private-fss-list.c fll/level_1/fss/basic.c fll/level_1/fss/basic_list.c fll/level_1/fss/embedded_list.c fll/level_1/fss/extended.c fll/level_1/fss/extended_list.c fll/level_1/fss/payload.c
 build_sources_program fll/level_1/iki.c
 build_sources_program fll/level_1/path.c
 build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c
index 84d8a75d92b612219758a25c4f8fe5f7558316c9..8e93b44c08e343ee25f2607d19a3b4b0b0837db6 100644 (file)
@@ -67,7 +67,7 @@ build_sources_program-thread fll/level_0/thread.c fll/level_0/thread/attribute.c
 build_sources_program fll/level_1/control_group.c
 build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c
 build_sources_program fll/level_1/environment.c
-build_sources_program fll/level_1/private-fss.c fll/level_1/fss/basic.c fll/level_1/fss/basic_list.c fll/level_1/fss/embedded_list.c fll/level_1/fss/extended.c fll/level_1/fss/extended_list.c fll/level_1/fss/payload.c
+build_sources_program fll/level_1/private-fss.c fll/level_1/private-fss-list.c fll/level_1/fss/basic.c fll/level_1/fss/basic_list.c fll/level_1/fss/embedded_list.c fll/level_1/fss/extended.c fll/level_1/fss/extended_list.c fll/level_1/fss/payload.c
 build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c
 
 build_sources_program fll/level_2/error.c fll/level_2/private-error.c fll/level_2/error/common.c
index bac889015d48771ff3ce43634c738018b3fcb925..ccfd431eea537522ee91ca341cdb37beea9025ed 100644 (file)
@@ -183,7 +183,7 @@ extern "C" {
   }
 #endif // _di_fl_fss_basic_object_read_
 
-#ifndef _di_fl_fss_basic_object_write_
+#ifndef _di_fl_fss_basic_list_object_read_
   void fl_fss_basic_object_write(const f_string_static_t object, const uint8_t quote, const uint8_t complete, f_range_t * const range, f_string_dynamic_t * const destination, f_state_t * const state) {
     #ifndef _di_level_1_parameter_checking_
       if (!state) return;
@@ -257,7 +257,7 @@ extern "C" {
       destination->used = destination_used;
     }
   }
-#endif // _di_fl_fss_basic_object_write_
+#endif // _di_fl_fss_basic_list_object_read_
 
 #ifdef __cplusplus
 } // extern "C"
index a9b131c261f656b8d9062a959dc977eb4acdb5a8..e7a081ca8713ba7c633b655c0281967fe847c1e7 100644 (file)
@@ -1,5 +1,6 @@
 #include "basic_list.h"
 #include "../private-fss.h"
+#include "../private-fss-list.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -17,17 +18,10 @@ extern "C" {
       }
     #endif // _di_level_1_parameter_checking_
 
-    const f_number_unsigned_t delimits_used = delimits->used;
-    const f_number_unsigned_t comments_used = comments->used;
-
     f_fss_skip_past_delimit(buffer, range, state);
-    if (F_status_is_error(state->status)) return;
-    if (state->status == F_data_not) return;
+    if (F_status_is_error(state->status) || state->status == F_data_not) return;
 
     if (range->start >= buffer.used || range->start > range->stop) {
-      delimits->used = delimits_used;
-      comments->used = comments_used;
-
       if (range->start >= buffer.used) {
         found->array[found->used].stop = buffer.used - 1;
         state->status = F_okay_eos;
@@ -43,6 +37,9 @@ extern "C" {
     state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &found->array, &found->used, &found->size);
     if (F_status_is_error(state->status)) return;
 
+    const f_number_unsigned_t delimits_used = delimits->used;
+    const f_number_unsigned_t comments_used = comments->used;
+
     const f_number_unsigned_t begin = range->start;
     found->array[found->used].start = range->start;
 
@@ -108,12 +105,7 @@ extern "C" {
             }
 
             if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
-
-            if (f_fss_is_space(buffer, *range, state) == F_false) {
-              if (F_status_is_error(state->status)) break;
-
-              break;
-            }
+            if (f_fss_is_space(buffer, *range, state) == F_false) break;
 
             state->status = f_utf_buffer_increment(buffer, range, 1);
             if (F_status_is_error(state->status)) break;
@@ -184,13 +176,7 @@ extern "C" {
           }
 
           if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
-
-          if (f_fss_is_space(buffer, *range, state) == F_false) {
-            if (F_status_is_error(state->status)) break;
-
-
-            break;
-          }
+          if (f_fss_is_space(buffer, *range, state) == F_false) break;
 
           state->status = f_utf_buffer_increment(buffer, range, 1);
           if (F_status_is_error(state->status)) break;
@@ -417,7 +403,7 @@ extern "C" {
 
             range->start = start + 1;
 
-            private_fl_fss_basic_list_write_add_until_end(content, range, destination, state);
+            private_fl_fss_list_write_add_until_end(content, range, destination, state);
             if (F_status_is_error(state->status)) break;
 
             continue;
@@ -458,7 +444,7 @@ extern "C" {
 
           range->start = start + 1;
 
-          private_fl_fss_basic_list_write_add_until_end(content, range, destination, state);
+          private_fl_fss_list_write_add_until_end(content, range, destination, state);
           if (F_status_is_error(state->status)) break;
 
           continue;
@@ -565,276 +551,7 @@ extern "C" {
       }
     #endif // _di_level_1_parameter_checking_
 
-    const f_number_unsigned_t delimits_used = delimits->used;
-
-    f_fss_skip_past_space(buffer, range, state);
-    if (F_status_is_error(state->status)) return;
-    if (state->status == F_data_not) return;
-
-    if (state->status == F_okay_eol) {
-
-      // Move the start position to after the EOL.
-      ++range->start;
-      state->status = F_fss_found_object_not;
-
-      return;
-    }
-
-    if (state->status == F_okay_eos || state->status == F_okay_stop) {
-      state->status = state->status == F_okay_eos ? F_data_not_eos : F_data_not_stop;
-
-      return;
-    }
-
-    // Begin the search.
-    found->start = range->start;
-
-    // Ignore all comment lines.
-    if (buffer.string[range->start] == f_fss_comment_s.string[0]) {
-      found->start = 1;
-      found->stop = 0;
-
-      f_fss_seek_to_eol(buffer, range, state);
-      if (F_status_is_error(state->status)) return;
-
-      if (state->status == F_okay_eos || state->status == F_okay_stop) {
-        state->status = state->status == F_okay_eos ? F_data_not_eos : F_data_not_stop;
-
-        return;
-      }
-
-      // Move the start position to after the EOL.
-      ++range->start;
-      state->status = F_fss_found_object_not;
-
-      return;
-    }
-
-    f_number_unsigned_t slash_first = 0;
-    f_number_unsigned_t slash_count = 0;
-    f_number_unsigned_t start = 1;
-    f_number_unsigned_t stop = 0;
-
-    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]) {
-
-      if (state->interrupt) {
-        state->interrupt((void *) state, 0);
-        if (F_status_set_fine(state->status) == F_interrupt) break;
-      }
-
-      if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
-        slash_first = range->start;
-        slash_count = 1;
-
-        for (++range->start; range->start <= range->stop && range->start < buffer.used; ++range->start) {
-
-          if (state->interrupt) {
-            state->interrupt((void *) state, 0);
-            if (F_status_set_fine(state->status) == F_interrupt) break;
-          }
-
-          if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) continue;
-          else if (buffer.string[range->start] != f_fss_slash_s.string[0]) break;
-
-          ++slash_count;
-        } // for
-
-        if (range->start >= buffer.used || range->start > range->stop) {
-          delimits->used = delimits_used;
-          found->start = 1;
-          found->stop = 0;
-          state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
-
-          return;
-        }
-
-        if (buffer.string[range->start] == f_fss_basic_list_open_s.string[0]) {
-          state->status = f_utf_buffer_increment(buffer, range, 1);
-          if (F_status_is_error(state->status)) return;
-
-          while (range->start <= range->stop && range->start < buffer.used) {
-
-            if (state->interrupt) {
-              state->interrupt((void *) state, 0);
-              if (F_status_set_fine(state->status) == F_interrupt) break;
-            }
-
-            if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
-
-            if (f_fss_is_space(buffer, *range, state) == F_false) {
-              if (F_status_is_error(state->status)) break;
-
-              break;
-            }
-
-            state->status = f_utf_buffer_increment(buffer, range, 1);
-            if (F_status_is_error(state->status)) break;
-          } // while
-
-          if (range->start >= buffer.used || range->start > range->stop) {
-            delimits->used = delimits_used;
-            found->start = 1;
-            found->stop = 0;
-            state->status = range->start >= buffer.used ?  F_data_not_eos : F_data_not_stop;
-
-            return;
-          }
-
-          if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-            found->stop = range->start;
-            range->start = slash_first;
-
-            state->status = f_memory_array_increase_by((slash_count / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
-            if (F_status_is_error(state->status)) break;
-
-            if (slash_count % 2 == 0) {
-              while (slash_count > 0) {
-
-                if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
-                  if (slash_count % 2 == 1) {
-                    delimits->array[delimits->used] = range->start;
-                    ++delimits->used;
-                  }
-
-                  --slash_count;
-                }
-
-                state->status = f_utf_buffer_increment(buffer, range, 1);
-
-                if (F_status_is_error(state->status)) {
-                  delimits->used = delimits_used;
-                  found->start = 1;
-                  found->stop = 0;
-
-                  return;
-                }
-              } // while
-
-              range->start = found->stop + 1;
-              found->start = start;
-              found->stop = stop + macro_f_utf_byte_width(buffer.string[stop]) - 1;
-              state->status = F_fss_found_object;
-
-              return;
-            }
-
-            range->start = found->stop + 1;
-            state->status = F_fss_found_object_not;
-
-            return;
-          }
-        }
-        else if (graph_first && buffer.string[range->start] == f_fss_comment_s.string[0]) {
-          if (graph_first) {
-            graph_first = F_false;
-            start = slash_first;
-          }
-
-          // Comments may only have white space before the '#', therefore only the first slash needs to be delimited.
-          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;
-
-          delimits->array[delimits->used++] = slash_first;
-          stop = range->start++;
-        }
-        else {
-          graph_first = F_false;
-          stop = range->start;
-        }
-
-        continue;
-      }
-
-      if (buffer.string[range->start] == f_fss_basic_list_open_s.string[0]) {
-        state->status = f_utf_buffer_increment(buffer, range, 1);
-        if (F_status_is_error(state->status)) break;
-
-        while (range->start <= range->stop && range->start < buffer.used) {
-
-          if (state->interrupt) {
-            state->interrupt((void *) state, 0);
-            if (F_status_set_fine(state->status) == F_interrupt) break;
-          }
-
-          if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
-
-          state->status = f_fss_is_space(buffer, *range, state);
-          if (F_status_is_error(state->status) || state->status == F_false) break;
-
-          state->status = f_utf_buffer_increment(buffer, range, 1);
-          if (F_status_is_error(state->status)) break;
-        } // while
-
-        if (range->start >= buffer.used || range->start > range->stop) {
-          found->start = 1;
-          found->stop = 0;
-          state->status = range->start >= buffer.used ? F_okay_eos : F_okay_stop;
-
-          return;
-        }
-
-        if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-          found->start = start;
-          found->stop = stop + macro_f_utf_byte_width(buffer.string[stop]) - 1;
-          ++range->start;
-          state->status = F_fss_found_object;
-
-          return;
-        }
-
-        if (graph_first) {
-          graph_first = F_false;
-          start = 1;
-          stop = 0;
-        }
-        else {
-          stop = range->start;
-        }
-
-        continue;
-      }
-      else {
-        state->status = f_fss_is_space(buffer, *range, state);
-        if (F_status_is_error(state->status)) break;
-
-        if (state->status == F_false) {
-          if (graph_first) {
-            graph_first = F_false;
-            start = range->start;
-          }
-
-          stop = range->start;
-        }
-      }
-
-      state->status = f_utf_buffer_increment(buffer, range, 1);
-      if (F_status_is_error(state->status)) break;
-    } // while
-
-    found->start = 1;
-    found->stop = 0;
-
-    if (F_status_is_error(state->status)) {
-      delimits->used = delimits_used;
-
-      return;
-    }
-
-    if (state->status == F_okay_eos || state->status == F_okay_stop) {
-      state->status = state->status == F_okay_eos ? F_data_not_eos : F_data_not_stop;
-
-      return;
-    }
-
-    // Seek to the end of the line when no valid object is found.
-    f_fss_seek_to_eol(buffer, range, state);
-
-    // Move the start position to after the EOL.
-    ++range->start;
-    state->status = F_fss_found_object_not;
+    return private_fl_fss_list_object_read(f_fss_basic_list_open_s, buffer, range, found, delimits, state);
   }
 #endif // _di_fl_fss_basic_list_object_read_
 
@@ -1018,7 +735,7 @@ extern "C" {
 
     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 || complete == f_fss_complete_trim_e) {
       if (complete == f_fss_complete_full_trim_e || complete == f_fss_complete_trim_e) {
-        private_fl_fss_basic_list_write_object_trim(destination_used, destination, state);
+        private_fl_fss_list_write_object_trim(destination_used, destination, state);
 
         if (F_status_is_error(state->status)) {
           destination->used = destination_used;
index 2e18dcee08cc32b0b281cf8095efee3370009023..e010e48773e6f366f41ad6ebd58acac3736d451e 100644 (file)
@@ -1,5 +1,6 @@
 #include "embedded_list.h"
 #include "../private-fss.h"
+#include "../private-fss-list.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -18,8 +19,7 @@ extern "C" {
     #endif // _di_level_1_parameter_checking_
 
     f_fss_skip_past_delimit(buffer, range, state);
-    if (F_status_is_error(state->status)) return;
-    if (state->status == F_data_not || state->status == F_okay_eos || state->status == F_okay_stop) return;
+    if (F_status_is_error(state->status) || state->status == F_data_not || state->status == F_okay_eos || state->status == F_okay_stop) return;
 
     fl_fss_data_embedded_list_t * const cache = (fl_fss_data_embedded_list_t *) state->data;
 
@@ -34,15 +34,19 @@ extern "C" {
     cache->slashes->used = 0;
 
     state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_nest_t), (void **) &found->depth, &found->used, &found->size);
-    if (F_status_is_error(state->status)) return;
 
-    state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &cache->objects->array, &cache->objects->used, &cache->objects->size);
-    if (F_status_is_error(state->status)) return;
+    if (F_status_is_error_not(state->status)) {
+      state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &cache->objects->array, &cache->objects->used, &cache->objects->size);
+    }
 
-    state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &cache->positions->array, &cache->positions->used, &cache->positions->size);
-    if (F_status_is_error(state->status)) return;
+    if (F_status_is_error_not(state->status)) {
+      state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &cache->positions->array, &cache->positions->used, &cache->positions->size);
+    }
+
+    if (F_status_is_error_not(state->status)) {
+      state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &cache->slashes->array, &cache->slashes->used, &cache->slashes->size);
+    }
 
-    state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &cache->slashes->array, &cache->slashes->used, &cache->slashes->size);
     if (F_status_is_error(state->status)) return;
 
     const f_number_unsigned_t delimits_used = delimits->used;
@@ -50,21 +54,18 @@ extern "C" {
 
     f_number_unsigned_t depth = 0;
     f_number_unsigned_t position = 0;
-
     f_number_unsigned_t position_previous = range->start;
     f_number_unsigned_t line_start = range->start;
     f_number_unsigned_t newline_last = range->start;
     f_number_unsigned_t comment_delimit = 0;
-
     f_number_unsigned_t slash_first = 0;
     f_number_unsigned_t slash_last = 0;
-
     f_number_unsigned_t before_list_open = position_previous;
 
-    uint8_t is_open = F_false;
-
     // 0x0 = false, 0x1 = true, 0x2 = false, but there is a delimited comment, comment_delimit is set.
     uint8_t graph_first = 0x1;
+    uint8_t is_open = F_false;
+    uint8_t is_object = F_false;
 
     // Initialize depth 1 start position.
     // Positions_start.used is used as a max depth (such that cache->positions->used == max depth + 1).
@@ -78,13 +79,25 @@ extern "C" {
 
       if (state->interrupt) {
         state->interrupt((void *) state, 0);
-        if (F_status_set_fine(state->status) == F_interrupt) break;
+
+        if (F_status_set_fine(state->status) == F_interrupt) {
+          delimits->used = delimits_used;
+          comments->used = comments_used;
+
+          return;
+        }
       }
 
       if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
         if (graph_first == 0x2) {
           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;
+
+          if (F_status_is_error(state->status))  {
+            delimits->used = delimits_used;
+            comments->used = comments_used;
+
+            return;
+          }
 
           delimits->array[delimits->used++] = comment_delimit;
         }
@@ -94,22 +107,18 @@ extern "C" {
         graph_first = 0x1;
         line_start = range->start;
 
-        if (depth) {
-          if (range->start >= buffer.used || range->start > range->stop) {
-            delimits->used = delimits_used;
-            comments->used = comments_used;
+        if (range->start >= buffer.used || range->start > range->stop) {
+          delimits->used = delimits_used;
+          comments->used = comments_used;
 
+          if (depth) {
             state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
-
-            return;
           }
-        }
-        else {
-          if (range->start >= buffer.used || range->start > range->stop) {
-            state->status = (range->start >= buffer.used) ? F_okay_eos : F_okay_stop;
-
-            return;
+          else {
+            state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
           }
+
+          return;
         }
 
         continue;
@@ -119,49 +128,41 @@ extern "C" {
         slash_first = range->start;
         slash_last = range->start;
         cache->slashes->array[depth] = 1;
-
         position_previous = range->start++;
 
-        while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_placeholder_s.string[0] || buffer.string[range->start] == f_fss_slash_s.string[0])) {
+        for (; range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_placeholder_s.string[0] || buffer.string[range->start] == f_fss_slash_s.string[0]); ++range->start) {
 
           if (state->interrupt) {
             state->interrupt((void *) state, 0);
-            if (F_status_set_fine(state->status) == F_interrupt) break;
+
+            if (F_status_set_fine(state->status) == F_interrupt) {
+              delimits->used = delimits_used;
+              comments->used = comments_used;
+
+              return;
+            }
           }
 
           position_previous = range->start;
 
-          if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
-            slash_last = range->start++;
+          if (buffer.string[position_previous] == f_fss_slash_s.string[0]) {
+            slash_last = position_previous;
             ++cache->slashes->array[depth];
           }
-          else {
-            state->status = f_utf_buffer_increment(buffer, range, 1);
-            if (F_status_is_error(state->status)) break;
-          }
-        } // while
-
-        if (F_status_is_error(state->status)) break;
+        } // for
 
-        if (depth) {
-          if (range->start >= buffer.used || range->start > range->stop) {
-            delimits->used = delimits_used;
-            comments->used = comments_used;
+        if (range->start >= buffer.used || range->start > range->stop) {
+          delimits->used = delimits_used;
+          comments->used = comments_used;
 
+          if (depth) {
             state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
-
-            return;
           }
-        }
-        else {
-          if (range->start >= buffer.used || range->start > range->stop) {
-            delimits->used = delimits_used;
-            comments->used = comments_used;
-
+          else {
             state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
-
-            return;
           }
+
+          return;
         }
 
         // All slashes for an open are delimited (because it could represent a slash in the object name).
@@ -172,7 +173,13 @@ extern "C" {
         if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
           if (graph_first == 0x2) {
             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;
+
+            if (F_status_is_error(state->status))  {
+              delimits->used = delimits_used;
+              comments->used = comments_used;
+
+              return;
+            }
 
             delimits->array[delimits->used++] = comment_delimit;
           }
@@ -197,7 +204,13 @@ extern "C" {
 
             if (state->interrupt) {
               state->interrupt((void *) state, 0);
-              if (F_status_set_fine(state->status) == F_interrupt) break;
+
+              if (F_status_set_fine(state->status) == F_interrupt) {
+                delimits->used = delimits_used;
+                comments->used = comments_used;
+
+                return;
+              }
             }
 
             if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
@@ -216,11 +229,7 @@ extern "C" {
             }
 
             if (buffer.string[range->start] != f_fss_placeholder_s.string[0]) {
-              if (f_fss_is_space(buffer, *range, state) == F_false) {
-                if (F_status_is_error(state->status)) break;
-
-                break;
-              }
+              if (f_fss_is_space(buffer, *range, state) == F_false) break;
             }
 
             position_previous = range->start;
@@ -229,27 +238,27 @@ extern "C" {
             if (F_status_is_error(state->status)) break;
           } // while
 
-          if (F_status_is_error(state->status)) break;
-
-          if (depth) {
-            if (range->start >= buffer.used || range->start > range->stop) {
-              delimits->used = delimits_used;
-              comments->used = comments_used;
-
-              state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
+          if (F_status_is_error(state->status))  {
+            delimits->used = delimits_used;
+            comments->used = comments_used;
 
-              return;
-            }
+            return;
           }
-          else {
-            if (range->start >= buffer.used || range->start > range->stop) {
-              delimits->used = delimits_used;
-              comments->used = comments_used;
 
-              state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
+          if (F_status_is_error(state->status) || range->start >= buffer.used || range->start > range->stop) {
+            delimits->used = delimits_used;
+            comments->used = comments_used;
 
-              return;
+            if (F_status_is_error_not(state->status)) {
+              if (depth) {
+                state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
+              }
+              else {
+                state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
+              }
             }
+
+            return;
           }
 
           // This is a valid object open/close that has been delimited, save the slash delimit positions.
@@ -259,16 +268,17 @@ extern "C" {
             graph_first = 0x1;
 
             if (is_open) {
-              bool is_object = F_false;
-
-              if (cache->slashes->array[depth] % 2 == 0) {
-                is_object = F_true;
-              }
-
+              is_object = cache->slashes->array[depth] % 2 == 0 ? F_true : F_false;
               range->start = slash_first;
 
               state->status = f_memory_array_increase_by((cache->slashes->array[depth] / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
-              if (F_status_is_error(state->status)) break;
+
+              if (F_status_is_error(state->status))  {
+                delimits->used = delimits_used;
+                comments->used = comments_used;
+
+                return;
+              }
 
               // Apply slash delimits, only slashes and placeholders should be present.
               while (cache->slashes->array[depth]) {
@@ -285,23 +295,29 @@ extern "C" {
                 position_previous = range->start++;
               } // while
 
-              if (F_status_is_error(state->status)) break;
-
               // When slashes are even, the object is valid and needs to be processed.
               if (is_object) {
                 if (++depth >= cache->objects->size) {
                   state->status = f_memory_array_resize(depth + 2, sizeof(f_range_t), (void **) &cache->objects->array, &cache->objects->used, &cache->objects->size);
-                  if (F_status_is_error(state->status)) break;
                 }
 
                 if (depth >= cache->positions->size) {
-                  state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->positions->array, &cache->positions->used, &cache->positions->size);
-                  if (F_status_is_error(state->status)) break;
+                  if (F_status_is_error_not(state->status)) {
+                    state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->positions->array, &cache->positions->used, &cache->positions->size);
+                  }
                 }
 
                 if (depth >= cache->slashes->size) {
-                  state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->slashes->array, &cache->slashes->used, &cache->slashes->size);
-                  if (F_status_is_error(state->status)) break;
+                  if (F_status_is_error_not(state->status)) {
+                    state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->slashes->array, &cache->slashes->used, &cache->slashes->size);
+                  }
+                }
+
+                if (F_status_is_error(state->status))  {
+                  delimits->used = delimits_used;
+                  comments->used = comments_used;
+
+                  return;
                 }
 
                 cache->objects->array[depth].start = line_start;
@@ -324,7 +340,13 @@ extern "C" {
             }
             else {
               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;
+
+              if (F_status_is_error(state->status))  {
+                delimits->used = delimits_used;
+                comments->used = comments_used;
+
+                return;
+              }
 
               delimits->array[delimits->used++] = slash_last;
             }
@@ -346,23 +368,31 @@ extern "C" {
         position_previous = range->start;
 
         state->status = f_utf_buffer_increment(buffer, range, 1);
-        if (F_status_is_error(state->status)) break;
+
+        if (F_status_is_error(state->status))  {
+          delimits->used = delimits_used;
+          comments->used = comments_used;
+
+          return;
+        }
 
         while (range->start <= range->stop && range->start < buffer.used) {
 
           if (state->interrupt) {
             state->interrupt((void *) state, 0);
-            if (F_status_set_fine(state->status) == F_interrupt) break;
+
+            if (F_status_set_fine(state->status) == F_interrupt) {
+              delimits->used = delimits_used;
+              comments->used = comments_used;
+
+              return;
+            }
           }
 
           if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
 
           if (buffer.string[range->start] != f_fss_placeholder_s.string[0]) {
-            if (f_fss_is_space(buffer, *range, state) == F_false) {
-              if (F_status_is_error(state->status)) break;
-
-              break;
-            }
+            if (f_fss_is_space(buffer, *range, state) == F_false) break;
           }
 
           position_previous = range->start;
@@ -371,43 +401,44 @@ extern "C" {
           if (F_status_is_error(state->status)) break;
         } // while
 
-        if (F_status_is_error(state->status)) break;
-
-        if (depth) {
-          if (range->start >= buffer.used || range->start > range->stop) {
-            delimits->used = delimits_used;
-            comments->used = comments_used;
-
-            state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
-
-            return;
-          }
-        }
-        else {
-          if (range->start >= buffer.used || range->start > range->stop) {
+          if (F_status_is_error(state->status) || range->start >= buffer.used || range->start > range->stop) {
             delimits->used = delimits_used;
             comments->used = comments_used;
 
-            state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
+            if (F_status_is_error_not(state->status)) {
+              if (depth) {
+                state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
+              }
+              else {
+                state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
+              }
+            }
 
             return;
           }
-        }
 
         if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
           if (++depth >= cache->objects->size) {
             state->status = f_memory_array_resize(depth + 2, sizeof(f_range_t), (void **) &cache->objects->array, &cache->objects->used, &cache->objects->size);
-            if (F_status_is_error(state->status)) break;
           }
 
           if (depth >= cache->positions->size) {
-            state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->positions->array, &cache->positions->used, &cache->positions->size);
-            if (F_status_is_error(state->status)) break;
+            if (F_status_is_error_not(state->status)) {
+              state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->positions->array, &cache->positions->used, &cache->positions->size);
+            }
           }
 
           if (depth >= cache->slashes->size) {
-            state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->slashes->array, &cache->slashes->used, &cache->slashes->size);
-            if (F_status_is_error(state->status)) break;
+            if (F_status_is_error_not(state->status)) {
+              state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->slashes->array, &cache->slashes->used, &cache->slashes->size);
+            }
+          }
+
+          if (F_status_is_error(state->status))  {
+            delimits->used = delimits_used;
+            comments->used = comments_used;
+
+            return;
           }
 
           cache->objects->array[depth].start = line_start;
@@ -429,7 +460,13 @@ extern "C" {
 
           if (graph_first == 0x2) {
             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;
+
+            if (F_status_is_error(state->status))  {
+              delimits->used = delimits_used;
+              comments->used = comments_used;
+
+              return;
+            }
 
             delimits->array[delimits->used++] = comment_delimit;
           }
@@ -442,11 +479,23 @@ extern "C" {
 
           // No valid object close found, seek until EOL.
           f_fss_seek_to_eol(buffer, range, state);
-          if (F_status_is_error(state->status)) break;
+
+          if (F_status_is_error(state->status))  {
+            delimits->used = delimits_used;
+            comments->used = comments_used;
+
+            return;
+          }
 
           if (graph_first == 0x2) {
             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;
+
+            if (F_status_is_error(state->status))  {
+              delimits->used = delimits_used;
+              comments->used = comments_used;
+
+              return;
+            }
 
             delimits->array[delimits->used++] = comment_delimit;
           }
@@ -459,7 +508,13 @@ extern "C" {
 
             if (state->interrupt) {
               state->interrupt((void *) state, 0);
-              if (F_status_set_fine(state->status) == F_interrupt) break;
+
+              if (F_status_set_fine(state->status) == F_interrupt) {
+                delimits->used = delimits_used;
+                comments->used = comments_used;
+
+                return;
+              }
             }
 
             if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
@@ -473,30 +528,27 @@ extern "C" {
             position_previous = range->start;
 
             state->status = f_utf_buffer_increment(buffer, range, 1);
-            if (F_status_is_error(state->status)) break;
-          } // while
-
-          if (F_status_is_error(state->status)) break;
 
-          if (depth) {
-            if (range->start >= buffer.used || range->start > range->stop) {
+            if (F_status_is_error(state->status))  {
               delimits->used = delimits_used;
               comments->used = comments_used;
 
-              state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
-
               return;
             }
-          }
-          else {
-            if (range->start >= buffer.used || range->start > range->stop) {
-              delimits->used = delimits_used;
-              comments->used = comments_used;
+          } // while
 
-              state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
+          if (range->start >= buffer.used || range->start > range->stop) {
+            delimits->used = delimits_used;
+            comments->used = comments_used;
 
-              return;
+            if (depth) {
+              state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
+            }
+            else {
+              state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
             }
+
+            return;
           }
         }
       }
@@ -505,64 +557,65 @@ extern "C" {
 
           if (state->interrupt) {
             state->interrupt((void *) state, 0);
-            if (F_status_set_fine(state->status) == F_interrupt) break;
+
+            if (F_status_set_fine(state->status) == F_interrupt) {
+              delimits->used = delimits_used;
+              comments->used = comments_used;
+
+              return;
+            }
           }
 
           position_previous = range->start;
 
           state->status = f_utf_buffer_increment(buffer, range, 1);
-          if (F_status_is_error(state->status)) break;
-
-          if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
+          if (F_status_is_error(state->status) || buffer.string[range->start] == f_fss_eol_s.string[0]) break;
 
           if (buffer.string[range->start] != f_fss_placeholder_s.string[0]) {
-            if (f_fss_is_space(buffer, *range, state) == F_false) {
-              if (F_status_is_error(state->status)) break;
-
-              break;
-            }
+            if (f_fss_is_space(buffer, *range, state) == F_false) break;
           }
         } // while
 
-        if (F_status_is_error(state->status)) break;
+        if (F_status_is_error(state->status) || range->start >= buffer.used || range->start > range->stop) {
+          delimits->used = delimits_used;
+          comments->used = comments_used;
 
-        if (depth) {
-          if (range->start >= buffer.used || range->start > range->stop) {
-            delimits->used = delimits_used;
-            comments->used = comments_used;
+          if (F_status_is_error_not(state->status)) {
+            if (depth) {
+              state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
+            }
+            else {
+              state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
+            }
+          }
 
-            state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
-
-            return;
-          }
-        }
-        else {
-          if (range->start >= buffer.used || range->start > range->stop) {
-            delimits->used = delimits_used;
-            comments->used = comments_used;
-
-            state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
-
-            return;
-          }
-        }
+          return;
+        }
 
         if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
           if (depth >= found->used) {
             state->status = f_memory_array_resize(depth + 2, sizeof(f_fss_nest_t), (void **) &found->depth, &found->used, &found->size);
-            if (F_status_is_error(state->status)) break;
           }
 
           if (found->depth[depth].used >= found->depth[depth].size) {
-            state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_item_t), (void **) &found->depth[depth].array, &found->depth[depth].used, &found->depth[depth].size);
-            if (F_status_is_error(state->status)) break;
+            if (F_status_is_error_not(state->status)) {
+              state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_item_t), (void **) &found->depth[depth].array, &found->depth[depth].used, &found->depth[depth].size);
+            }
           }
 
           position = found->depth[depth].used;
 
           if (found->depth[depth].array[position].content.size != 1) {
-            state->status = f_memory_array_resize(1, sizeof(f_range_t), (void **) &found->depth[depth].array[position].content.array, &found->depth[depth].array[position].content.used, &found->depth[depth].array[position].content.size);
-            if (F_status_is_error(state->status)) break;
+            if (F_status_is_error_not(state->status)) {
+              state->status = f_memory_array_resize(1, sizeof(f_range_t), (void **) &found->depth[depth].array[position].content.array, &found->depth[depth].array[position].content.used, &found->depth[depth].array[position].content.size);
+            }
+          }
+
+          if (F_status_is_error(state->status))  {
+            delimits->used = delimits_used;
+            comments->used = comments_used;
+
+            return;
           }
 
           if (depth) {
@@ -595,7 +648,13 @@ extern "C" {
 
           if (graph_first == 0x2) {
             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;
+
+            if (F_status_is_error(state->status))  {
+              delimits->used = delimits_used;
+              comments->used = comments_used;
+
+              return;
+            }
 
             delimits->array[delimits->used++] = comment_delimit;
           }
@@ -609,7 +668,13 @@ extern "C" {
 
           if (!depth) {
             state->status = f_utf_buffer_increment(buffer, range, 1);
-            if (F_status_is_error(state->status)) break;
+
+            if (F_status_is_error(state->status))  {
+              delimits->used = delimits_used;
+              comments->used = comments_used;
+
+              return;
+            }
 
             if (range->start >= buffer.used) {
               state->status = F_okay_eos;
@@ -632,13 +697,25 @@ extern "C" {
 
             if (state->interrupt) {
               state->interrupt((void *) state, 0);
-              if (F_status_set_fine(state->status) == F_interrupt) break;
+
+              if (F_status_set_fine(state->status) == F_interrupt) {
+                delimits->used = delimits_used;
+                comments->used = comments_used;
+
+                return;
+              }
             }
 
             if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
               if (graph_first == 0x2) {
                 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;
+
+                if (F_status_is_error(state->status))  {
+                  delimits->used = delimits_used;
+                  comments->used = comments_used;
+
+                  return;
+                }
 
                 delimits->array[delimits->used++] = comment_delimit;
               }
@@ -653,30 +730,27 @@ extern "C" {
             position_previous = range->start;
 
             state->status = f_utf_buffer_increment(buffer, range, 1);
-            if (F_status_is_error(state->status)) break;
-          } // while
 
-          if (F_status_is_error(state->status)) break;
-
-          if (depth) {
-            if (range->start >= buffer.used || range->start > range->stop) {
+            if (F_status_is_error(state->status))  {
               delimits->used = delimits_used;
               comments->used = comments_used;
 
-              state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
-
               return;
             }
-          }
-          else {
-            if (range->start >= buffer.used || range->start > range->stop) {
-              delimits->used = delimits_used;
-              comments->used = comments_used;
+          } // while
 
-              state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
+          if (range->start >= buffer.used || range->start > range->stop) {
+            delimits->used = delimits_used;
+            comments->used = comments_used;
 
-              return;
+            if (depth) {
+              state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
+            }
+            else {
+              state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
             }
+
+            return;
           }
         }
       }
@@ -686,7 +760,13 @@ extern "C" {
         position = (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;
+
+        if (F_status_is_error(state->status))  {
+          delimits->used = delimits_used;
+          comments->used = comments_used;
+
+          return;
+        }
 
         if (range->start > range->stop || range->start >= buffer.used) {
           --range->start;
@@ -694,7 +774,13 @@ extern "C" {
         else {
           if (graph_first == 0x2) {
             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;
+
+            if (F_status_is_error(state->status))  {
+              delimits->used = delimits_used;
+              comments->used = comments_used;
+
+              return;
+            }
 
             delimits->array[delimits->used++] = comment_delimit;
           }
@@ -704,7 +790,13 @@ extern "C" {
         }
 
         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 (F_status_is_error(state->status))  {
+          delimits->used = delimits_used;
+          comments->used = comments_used;
+
+          return;
+        }
 
         comments->array[comments->used].start = position;
         comments->array[comments->used++].stop = range->start++;
@@ -716,14 +808,20 @@ extern "C" {
 
         if (graph_first == 0x1) {
           if (f_fss_is_space(buffer, *range, state) == F_false) {
-            if (F_status_is_error(state->status)) break;
-
             graph_first = 0x0;
           }
         }
 
-        state->status = f_utf_buffer_increment(buffer, range, 1);
-        if (F_status_is_error(state->status)) break;
+        if (F_status_is_error_not(state->status)) {
+          state->status = f_utf_buffer_increment(buffer, range, 1);
+        }
+
+        if (F_status_is_error(state->status))  {
+          delimits->used = delimits_used;
+          comments->used = comments_used;
+
+          return;
+        }
 
         if (range->start >= buffer.used || range->start > range->stop) break;
 
@@ -733,21 +831,24 @@ extern "C" {
       position_previous = range->start;
 
       state->status = f_utf_buffer_increment(buffer, range, 1);
-      if (F_status_is_error(state->status)) break;
+
+      if (F_status_is_error(state->status))  {
+        delimits->used = delimits_used;
+        comments->used = comments_used;
+
+        return;
+      }
     } // while
 
     delimits->used = delimits_used;
     comments->used = comments_used;
 
-    if (F_status_is_error(state->status)) return;
-
     if (range->start > range->stop) {
       state->status = F_status_set_error(depth ? F_end_not_nest_stop : F_end_not_stop);
-
-      return;
     }
-
-    state->status = F_status_set_error(depth ? F_end_not_nest_eos : F_end_not_eos);
+    else {
+      state->status = F_status_set_error(depth ? F_end_not_nest_eos : F_end_not_eos);
+    }
   }
 #endif // _di_fl_fss_embedded_list_content_read_
 
@@ -875,7 +976,7 @@ extern "C" {
 
             range->start = start + 1;
 
-            private_fl_fss_basic_list_write_add_until_end(content, range, destination, state);
+            private_fl_fss_list_write_add_until_end(content, range, destination, state);
             if (F_status_is_error(state->status)) break;
 
             if (content.string[range->start] != f_fss_eol_s.string[0]) {
@@ -955,7 +1056,7 @@ extern "C" {
 
           range->start = start + 1;
 
-          private_fl_fss_basic_list_write_add_until_end(content, range, destination, state);
+          private_fl_fss_list_write_add_until_end(content, range, destination, state);
           if (F_status_is_error(state->status)) break;
 
           continue;
@@ -1055,347 +1156,7 @@ extern "C" {
       }
     #endif // _di_level_1_parameter_checking_
 
-    const f_number_unsigned_t delimits_used = delimits->used;
-
-    f_fss_skip_past_space(buffer, range, state);
-    if (F_status_is_error(state->status)) return;
-    if (state->status == F_data_not) return;
-
-    if (state->status == F_okay_eol) {
-
-      // Move the start position to after the EOL.
-      ++range->start;
-      state->status = F_fss_found_object_not;
-
-      return;
-    }
-
-    if (state->status == F_okay_eos) {
-      state->status = F_data_not_eos;
-
-      return;
-    }
-
-    if (state->status == F_okay_stop) {
-      state->status = F_data_not_stop;
-
-      return;
-    }
-
-    // Return found nothing if this line only contains white space and delimit placeholders.
-    if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-
-      // Move the start position to after the EOL.
-      ++range->start;
-      state->status = F_fss_found_object_not;
-
-      return;
-    }
-
-    // Begin the search.
-    const f_number_unsigned_t begin = range->start;
-    found->start = range->start;
-
-    // Ignore all comment lines.
-    if (buffer.string[range->start] == f_fss_comment_s.string[0]) {
-      f_fss_seek_to_eol(buffer, range, state);
-
-      if (F_status_is_error(state->status)) {
-        delimits->used = delimits_used;
-
-        return;
-      }
-
-      if (state->status == F_okay_eos) {
-        state->status = F_data_not_eos;
-
-        return;
-      }
-
-      if (state->status == F_okay_stop) {
-        state->status = F_data_not_stop;
-
-        return;
-      }
-
-      // Move the start position to after the EOL.
-      ++range->start;
-      state->status = F_fss_found_object_not;
-
-      return;
-    }
-
-    f_number_unsigned_t start = 0;
-    f_number_unsigned_t stop = 0;
-    f_number_unsigned_t slash_first = 0;
-    f_number_unsigned_t slash_count = 0;
-
-    bool 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]) {
-
-      if (state->interrupt) {
-        state->interrupt((void *) state, 0);
-        if (F_status_set_fine(state->status) == F_interrupt) break;
-      }
-
-      if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
-        slash_first = range->start;
-        slash_count = 1;
-
-        state->status = f_utf_buffer_increment(buffer, range, 1);
-        if (F_status_is_error(state->status)) break;
-
-        while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_placeholder_s.string[0] || buffer.string[range->start] == f_fss_slash_s.string[0])) {
-
-          if (state->interrupt) {
-            state->interrupt((void *) state, 0);
-            if (F_status_set_fine(state->status) == F_interrupt) break;
-          }
-
-          if (buffer.string[range->start] == f_fss_slash_s.string[0]) slash_count++;
-
-          state->status = f_utf_buffer_increment(buffer, range, 1);
-          if (F_status_is_error(state->status)) break;
-        } // while
-
-        if (F_status_is_error(state->status)) break;
-
-        if (range->start >= buffer.used || range->start > range->stop) {
-          delimits->used = delimits_used;
-
-          if (range->start >= buffer.used) {
-            found->stop = buffer.used - 1;
-            state->status = F_data_not_eos;
-          }
-          else {
-            found->stop = range->stop;
-            state->status =  F_data_not_stop;
-          }
-
-          return;
-        }
-
-        if (buffer.string[range->start] == f_fss_embedded_list_open_s.string[0]) {
-          graph_first = F_false;
-          stop = range->start++;
-
-          while (range->start <= range->stop && range->start < buffer.used) {
-
-            if (state->interrupt) {
-              state->interrupt((void *) state, 0);
-              if (F_status_set_fine(state->status) == F_interrupt) break;
-            }
-
-            if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
-
-            if (f_fss_is_graph(buffer, *range, state) == F_false) {
-              if (F_status_is_error(state->status)) break;
-            }
-            else {
-              break;
-            }
-
-            state->status = f_utf_buffer_increment(buffer, range, 1);
-            if (F_status_is_error(state->status)) break;
-          } // while
-
-          if (range->start >= buffer.used || range->start > range->stop) {
-            delimits->used = delimits_used;
-
-            if (range->start >= buffer.used) {
-              found->stop = buffer.used - 1;
-              state->status = F_data_not_eos;
-            }
-            else {
-              found->stop = range->stop;
-              state->status =  F_data_not_stop;
-            }
-
-            return;
-          }
-
-          if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-            start = range->start;
-
-            range->start = slash_first;
-
-            state->status = f_memory_array_increase_by((slash_count / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
-            if (F_status_is_error(state->status)) break;
-
-            if (slash_count % 2 == 0) {
-              while (slash_count > 0) {
-
-                if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
-                  if (slash_count % 2 == 1) {
-                    delimits->array[delimits->used++] = range->start;
-                  }
-
-                  --slash_count;
-                }
-
-                state->status = f_utf_buffer_increment(buffer, range, 1);
-                if (F_status_is_error(state->status)) break;
-              } // while
-
-              if (F_status_is_error(state->status)) break;
-
-              if (stop > begin) {
-                found->stop = stop - 1;
-              }
-              else {
-                found->start = 1;
-                found->stop = 0;
-              }
-
-              range->start = start + 1;
-              state->status = F_fss_found_object;
-
-              return;
-            }
-
-            range->start = start + 1;
-            state->status = F_fss_found_object_not;
-
-            return;
-          }
-        }
-        else if (graph_first && buffer.string[range->start] == f_fss_comment_s.string[0]) {
-          graph_first = F_false;
-
-          // Comments may only have white space before the '#', therefore only the first slash needs to be delimited.
-          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;
-
-          delimits->array[delimits->used++] = slash_first;
-          ++range->start;
-        }
-        else {
-          graph_first = F_false;
-        }
-
-        continue;
-      }
-      else if (buffer.string[range->start] == f_fss_embedded_list_open_s.string[0]) {
-        graph_first = F_false;
-        stop = range->start;
-
-        state->status = f_utf_buffer_increment(buffer, range, 1);
-        if (F_status_is_error(state->status)) break;
-
-        while (range->start <= range->stop && range->start < buffer.used) {
-
-          if (state->interrupt) {
-            state->interrupt((void *) state, 0);
-            if (F_status_set_fine(state->status) == F_interrupt) break;
-          }
-
-          if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
-
-          if (f_fss_is_space(buffer, *range, state) == F_false) {
-            if (F_status_is_error(state->status)) break;
-
-            break;
-          }
-
-          state->status = f_utf_buffer_increment(buffer, range, 1);
-          if (F_status_is_error(state->status)) break;
-        } // while
-
-        if (F_status_is_error(state->status)) break;
-
-        if (range->start >= buffer.used) {
-          found->stop = buffer.used - 1;
-          state->status = F_okay_eos;
-
-          return;
-        }
-
-        if (range->start > range->stop) {
-          found->stop = range->stop;
-          state->status = F_okay_stop;
-
-          return;
-        }
-
-        if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-          if (stop > begin) {
-            found->stop = stop - 1;
-          }
-          else {
-            found->start = 1;
-            found->stop = 0;
-          }
-
-          // Move the start position to after the EOL.
-          ++range->start;
-          state->status = F_fss_found_object;
-
-          return;
-        }
-
-        continue;
-      }
-      else if (graph_first) {
-        if (f_fss_is_space(buffer, *range, state) == F_false) {
-          if (F_status_is_error(state->status)) break;
-
-          graph_first = F_false;
-        }
-      }
-
-      state->status = f_utf_buffer_increment(buffer, range, 1);
-      if (F_status_is_error(state->status)) break;
-    } // while
-
-    if (F_status_is_error(state->status)) {
-      delimits->used = delimits_used;
-
-      return;
-    }
-
-    // Seek to the end of the line when no valid object is found.
-    while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) {
-
-      if (state->interrupt) {
-        state->interrupt((void *) state, 0);
-        if (F_status_set_fine(state->status) == F_interrupt) break;
-      }
-
-      state->status = f_utf_buffer_increment(buffer, range, 1);
-
-      if (F_status_is_error(state->status)) {
-        delimits->used = delimits_used;
-
-        return;
-      }
-    } // while
-
-    if (range->start >= buffer.used || range->start > range->stop) {
-      delimits->used = delimits_used;
-
-      if (range->start >= buffer.used) {
-        found->stop = buffer.used - 1;
-        state->status = F_data_not_eos;
-      }
-      else {
-        found->stop = range->stop;
-        state->status =  F_data_not_stop;
-      }
-
-      return;
-    }
-
-    state->status = f_utf_buffer_increment(buffer, range, 1);
-
-    if (F_status_is_error(state->status)) {
-      delimits->used = delimits_used;
-
-      return;
-    }
-
-    state->status = F_fss_found_object_not;
+    return private_fl_fss_list_object_read(f_fss_embedded_list_open_s, buffer, range, found, delimits, state);
   }
 #endif // _di_fl_fss_embedded_list_object_read_
 
@@ -1610,7 +1371,7 @@ extern "C" {
 
     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 || complete == f_fss_complete_trim_e) {
       if (complete == f_fss_complete_full_trim_e || complete == f_fss_complete_trim_e) {
-        private_fl_fss_basic_list_write_object_trim(destination_used, destination, state);
+        private_fl_fss_list_write_object_trim(destination_used, destination, state);
 
         if (F_status_is_error(state->status)) {
           destination->used = destination_used;
index e723471d99f99efe11f8de6f92d1839db73d3a72..2d64e5402050df62988ca1c7bd8317aa51430b5e 100644 (file)
@@ -45,12 +45,14 @@ extern "C" {
 
     uint8_t content_found = 0;
     uint8_t quote = f_fss_quote_type_none_e;
+    f_range_t content_partial = f_range_t_initialize;
 
     f_status_t status = F_okay;
 
     while (range->start <= range->stop && range->start < buffer.used) {
 
-      f_range_t content_partial = f_range_t_initialize;
+      content_partial.start = 1;
+      content_partial.stop = 0;
 
       private_fl_fss_basic_or_extended_read(buffer, (state->flag & f_fss_state_quote_not_e) ? 0x2 : 0x0, range, &content_partial, &quote, delimits, state);
 
index 4ae954018406092e098d2f7cf1937d081ce7e817..1569f1de1ee29bdabdd68325f89244bd8a690a6d 100644 (file)
@@ -1,5 +1,6 @@
 #include "extended_list.h"
 #include "../private-fss.h"
+#include "../private-fss-list.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -17,17 +18,10 @@ extern "C" {
       }
     #endif // _di_level_1_parameter_checking_
 
-    const f_number_unsigned_t delimits_used = delimits->used;
-    const f_number_unsigned_t comments_used = comments->used;
-
     f_fss_skip_past_delimit(buffer, range, state);
-    if (F_status_is_error(state->status)) return;
-    if (state->status == F_data_not) return;
+    if (F_status_is_error(state->status) || state->status == F_data_not) return;
 
     if (range->start >= buffer.used || range->start > range->stop) {
-      delimits->used = delimits_used;
-      comments->used = comments_used;
-
       if (range->start >= buffer.used) {
         found->array[found->used].stop = buffer.used - 1;
         state->status = F_okay_eos;
@@ -43,7 +37,8 @@ extern "C" {
     state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &found->array, &found->used, &found->size);
     if (F_status_is_error(state->status)) return;
 
-    found->array[found->used].start = range->start;
+    const f_number_unsigned_t delimits_used = delimits->used;
+    const f_number_unsigned_t comments_used = comments->used;
 
     f_number_unsigned_t line_start = range->start;
     f_number_unsigned_t newline_last = range->start;
@@ -51,6 +46,8 @@ extern "C" {
     f_number_unsigned_t slash_count = 0;
     f_number_unsigned_t comment_start = 0;
 
+    found->array[found->used].start = range->start;
+
     // Identify where the content ends.
     while (range->start <= range->stop && range->start < buffer.used) {
 
@@ -363,7 +360,7 @@ extern "C" {
 
             range->start = start + 1;
 
-            private_fl_fss_basic_list_write_add_until_end(content, range, destination, state);
+            private_fl_fss_list_write_add_until_end(content, range, destination, state);
             if (F_status_is_error(state->status)) break;
 
             if (content.string[range->start] != f_fss_eol_s.string[0]) {
@@ -443,7 +440,7 @@ extern "C" {
 
           range->start = start + 1;
 
-          private_fl_fss_basic_list_write_add_until_end(content, range, destination, state);
+          private_fl_fss_list_write_add_until_end(content, range, destination, state);
           if (F_status_is_error(state->status)) break;
 
           continue;
@@ -548,353 +545,7 @@ extern "C" {
       }
     #endif // _di_level_1_parameter_checking_
 
-    const f_number_unsigned_t delimits_used = delimits->used;
-
-    f_fss_skip_past_space(buffer, range, state);
-    if (F_status_is_error(state->status)) return;
-    if (state->status == F_data_not) return;
-
-    if (state->status == F_okay_eol) {
-
-      // Move the start position to after the EOL.
-      ++range->start;
-      state->status = F_fss_found_object_not;
-
-      return;
-    }
-
-    if (state->status == F_okay_eos) {
-      state->status = F_data_not_eos;
-
-      return;
-    }
-
-    if (state->status == F_okay_stop) {
-      state->status = F_data_not_stop;
-
-      return;
-    }
-
-    // Return found nothing if this line only contains white space and delimit placeholders.
-    if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-
-      // Move the start position to after the EOL.
-      ++range->start;
-      state->status = F_fss_found_object_not;
-
-      return;
-    }
-
-    // Begin the search.
-    const f_number_unsigned_t begin = range->start;
-    found->start = range->start;
-
-    // Ignore all comment lines.
-    if (buffer.string[range->start] == f_fss_comment_s.string[0]) {
-      f_fss_seek_to_eol(buffer, range, state);
-
-      if (F_status_is_error(state->status)) {
-        delimits->used = delimits_used;
-
-        return;
-      }
-
-      if (state->status == F_okay_eos) {
-        state->status = F_data_not_eos;
-
-        return;
-      }
-
-      if (state->status == F_okay_stop) {
-        state->status = F_data_not_stop;
-
-        return;
-      }
-
-      // Move the start position to after the EOL.
-      ++range->start;
-      state->status = F_fss_found_object_not;
-
-      return;
-    }
-
-    f_number_unsigned_t start = 0;
-    f_number_unsigned_t stop = 0;
-    f_number_unsigned_t slash_first = 0;
-    f_number_unsigned_t slash_count = 0;
-
-    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]) {
-
-      if (state->interrupt) {
-        state->interrupt((void *) state, 0);
-        if (F_status_set_fine(state->status) == F_interrupt) break;
-      }
-
-      if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
-        slash_first = range->start;
-        slash_count = 1;
-
-        state->status = f_utf_buffer_increment(buffer, range, 1);
-        if (F_status_is_error(state->status)) break;
-
-        while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_placeholder_s.string[0] || buffer.string[range->start] == f_fss_slash_s.string[0])) {
-
-          if (state->interrupt) {
-            state->interrupt((void *) state, 0);
-            if (F_status_set_fine(state->status) == F_interrupt) break;
-          }
-
-          if (buffer.string[range->start] == f_fss_slash_s.string[0]) ++slash_count;
-
-          state->status = f_utf_buffer_increment(buffer, range, 1);
-          if (F_status_is_error(state->status)) break;
-        } // while
-
-        if (F_status_is_error(state->status)) break;
-
-        if (range->start >= buffer.used || range->start > range->stop) {
-          delimits->used = delimits_used;
-
-          if (range->start >= buffer.used) {
-            found->stop = buffer.used - 1;
-            state->status = F_data_not_eos;
-          }
-          else {
-            found->stop = range->stop;
-            state->status =  F_data_not_stop;
-          }
-
-          return;
-        }
-
-        if (buffer.string[range->start] == f_fss_extended_list_open_s.string[0]) {
-          graph_first = F_false;
-          stop = range->start++;
-
-          while (range->start <= range->stop && range->start < buffer.used) {
-
-            if (state->interrupt) {
-              state->interrupt((void *) state, 0);
-              if (F_status_set_fine(state->status) == F_interrupt) break;
-            }
-
-            if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
-
-            if (f_fss_is_graph(buffer, *range, state) == F_false) {
-              if (F_status_is_error(state->status)) break;
-            }
-            else {
-              break;
-            }
-
-            state->status = f_utf_buffer_increment(buffer, range, 1);
-            if (F_status_is_error(state->status)) break;
-          } // while
-
-          if (range->start >= buffer.used || range->start > range->stop) {
-            delimits->used = delimits_used;
-
-            if (range->start >= buffer.used) {
-              found->stop = buffer.used - 1;
-              state->status = F_data_not_eos;
-            }
-            else {
-              if (stop > begin) {
-                found->stop = stop - 1;
-              }
-              else {
-                found->start = 1;
-                found->stop = 0;
-              }
-
-              state->status =  F_data_not_stop;
-            }
-
-            return;
-          }
-
-          if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-            start = range->start;
-            range->start = slash_first;
-
-            state->status = f_memory_array_increase_by((slash_count / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
-            if (F_status_is_error(state->status)) break;
-
-            if (slash_count % 2 == 0) {
-              while (slash_count > 0) {
-
-                if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
-                  if (slash_count % 2 == 1) {
-                    delimits->array[delimits->used++] = range->start;
-                  }
-
-                  --slash_count;
-                }
-
-                state->status = f_utf_buffer_increment(buffer, range, 1);
-                if (F_status_is_error(state->status)) break;
-              } // while
-
-              if (F_status_is_error(state->status)) break;
-
-              if (stop > begin) {
-                found->stop = stop - 1;
-              }
-              else {
-                found->start = 1;
-                found->stop = 0;
-              }
-
-              range->start = start + 1;
-              state->status = F_fss_found_object;
-
-              return;
-            }
-
-            range->start = start + 1;
-            state->status = F_fss_found_object_not;
-
-            return;
-          }
-        }
-        else if (graph_first && buffer.string[range->start] == f_fss_comment_s.string[0]) {
-          graph_first = F_false;
-
-          // Comments may only have white space before the '#', therefore only the first slash needs to be delimited.
-          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;
-
-          delimits->array[delimits->used++] = slash_first;
-          ++range->start;
-        }
-        else {
-          graph_first = F_false;
-        }
-
-        continue;
-      }
-      else if (buffer.string[range->start] == f_fss_extended_list_open_s.string[0]) {
-        graph_first = F_false;
-        stop = range->start;
-
-        state->status = f_utf_buffer_increment(buffer, range, 1);
-        if (F_status_is_error(state->status)) break;
-
-        while (range->start <= range->stop && range->start < buffer.used) {
-
-          if (state->interrupt) {
-            state->interrupt((void *) state, 0);
-            if (F_status_set_fine(state->status) == F_interrupt) break;
-          }
-
-          if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
-
-          if (f_fss_is_space(buffer, *range, state) == F_false) {
-            if (F_status_is_error(state->status)) break;
-
-            break;
-          }
-
-          state->status = f_utf_buffer_increment(buffer, range, 1);
-          if (F_status_is_error(state->status)) break;
-        } // while
-
-        if (F_status_is_error(state->status)) break;
-
-        if (range->start >= buffer.used) {
-          found->stop = buffer.used - 1;
-          state->status = F_okay_eos;
-
-          return;
-        }
-
-        if (range->start > range->stop) {
-          found->stop = range->stop;
-          state->status = F_okay_stop;
-
-          return;
-        }
-
-        if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-          if (stop > begin) {
-            found->stop = stop - 1;
-          }
-          else {
-            found->start = 1;
-            found->stop = 0;
-          }
-
-          // Move the start position to after the EOL.
-          ++range->start;
-          state->status = F_fss_found_object;
-
-          return;
-        }
-
-        continue;
-      }
-      else if (graph_first) {
-        if (f_fss_is_space(buffer, *range, state) == F_false) {
-          if (F_status_is_error(state->status)) break;
-
-          graph_first = F_false;
-        }
-      }
-
-      state->status = f_utf_buffer_increment(buffer, range, 1);
-      if (F_status_is_error(state->status)) break;
-    } // while
-
-    if (F_status_is_error(state->status)) {
-      delimits->used = delimits_used;
-
-      return;
-    }
-
-    // Seek to the end of the line when no valid object is found.
-    while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) {
-
-      if (state->interrupt) {
-        state->interrupt((void *) state, 0);
-        if (F_status_set_fine(state->status) == F_interrupt) break;
-      }
-
-      state->status = f_utf_buffer_increment(buffer, range, 1);
-
-      if (F_status_is_error(state->status)) {
-        delimits->used = delimits_used;
-
-        return;
-      }
-    } // while
-
-    if (range->start >= buffer.used || range->start > range->stop) {
-      delimits->used = delimits_used;
-
-      if (range->start >= buffer.used) {
-        found->stop = buffer.used - 1;
-        state->status = F_data_not_eos;
-      }
-      else {
-        found->stop = range->stop;
-        state->status =  F_data_not_stop;
-      }
-
-      return;
-    }
-
-    state->status = f_utf_buffer_increment(buffer, range, 1);
-
-    if (F_status_is_error(state->status)) {
-      delimits->used = delimits_used;
-
-      return;
-    }
-
-    state->status = F_fss_found_object_not;
+    return private_fl_fss_list_object_read(f_fss_extended_list_open_s, buffer, range, found, delimits, state);
   }
 #endif // _di_fl_fss_extended_list_object_read_
 
@@ -1110,7 +761,7 @@ extern "C" {
 
     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 || complete == f_fss_complete_trim_e) {
       if (complete == f_fss_complete_full_trim_e || complete == f_fss_complete_trim_e) {
-        private_fl_fss_basic_list_write_object_trim(destination_used, destination, state);
+        private_fl_fss_list_write_object_trim(destination_used, destination, state);
 
         if (F_status_is_error(state->status)) {
           destination->used = destination_used;
diff --git a/level_1/fl_fss/c/private-fss-list.c b/level_1/fl_fss/c/private-fss-list.c
new file mode 100644 (file)
index 0000000..6cf1478
--- /dev/null
@@ -0,0 +1,455 @@
+#include "fss.h"
+#include "private-fss-list.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_extended_list_object_read_)
+  void private_fl_fss_list_object_read(const f_string_static_t list_open, const f_string_static_t buffer, f_range_t * const range, f_range_t * const found, f_number_unsigneds_t * const delimits, f_state_t * const state) {
+
+    f_fss_skip_past_space(buffer, range, state);
+    if (F_status_is_error(state->status) || state->status == F_data_not) return;
+
+    if (state->status == F_okay_eol) {
+
+      // Move the start position to after the EOL.
+      ++range->start;
+      state->status = F_fss_found_object_not;
+
+      return;
+    }
+
+    if (state->status == F_okay_eos || state->status == F_okay_stop) {
+      state->status = state->status == F_okay_eos ? F_data_not_eos : F_data_not_stop;
+
+      return;
+    }
+
+    // Return found nothing if this line only contains white space and delimit placeholders.
+    if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
+
+      // Move the start position to after the EOL.
+      ++range->start;
+      state->status = F_fss_found_object_not;
+
+      return;
+    }
+
+    // Ignore all comment lines.
+    if (buffer.string[range->start] == f_fss_comment_s.string[0]) {
+      f_fss_seek_to_eol(buffer, range, state);
+      if (F_status_is_error(state->status)) return;
+
+      if (state->status == F_okay_eos || state->status == F_okay_stop) {
+        state->status = state->status == F_okay_eos ? F_data_not_eos : F_data_not_stop;
+
+        return;
+      }
+
+      // Move the start position to after the EOL.
+      ++range->start;
+      state->status = F_fss_found_object_not;
+
+      return;
+    }
+
+    const f_number_unsigned_t delimits_used = delimits->used;
+
+    f_number_unsigned_t slash_first = 0;
+    f_number_unsigned_t slash_count = 0;
+    f_number_unsigned_t start = 1;
+    f_number_unsigned_t stop = 0;
+
+    uint8_t graph_first = F_true;
+
+    found->start = range->start;
+
+    // Identify where the object ends.
+    while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) {
+
+      if (state->interrupt) {
+        state->interrupt((void *) state, 0);
+
+        if (F_status_is_error(state->status)) {
+          delimits->used = delimits_used;
+
+          return;
+        }
+      }
+
+      if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
+        slash_first = range->start++;
+        slash_count = 1;
+
+        for (; range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_placeholder_s.string[0] || buffer.string[range->start] == f_fss_slash_s.string[0]); ++range->start) {
+
+          if (state->interrupt) {
+            state->interrupt((void *) state, 0);
+
+            if (F_status_is_error(state->status)) {
+              delimits->used = delimits_used;
+
+              return;
+            }
+          }
+
+          if (buffer.string[range->start] == f_fss_slash_s.string[0]) ++slash_count;
+        } // for
+
+        if (range->start >= buffer.used || range->start > range->stop) {
+          delimits->used = delimits_used;
+
+          if (range->start >= buffer.used) {
+            found->stop = buffer.used - 1;
+            state->status = F_data_not_eos;
+          }
+          else {
+            found->stop = range->stop;
+            state->status = F_data_not_stop;
+          }
+
+          return;
+        }
+
+        if (buffer.string[range->start] == list_open.string[0]) {
+          graph_first = F_false;
+          stop = range->start++;
+
+          while (range->start <= range->stop && range->start < buffer.used) {
+
+            if (state->interrupt) {
+              state->interrupt((void *) state, 0);
+
+              if (F_status_is_error(state->status)) {
+                delimits->used = delimits_used;
+
+                return;
+              }
+            }
+
+            if (buffer.string[range->start] == f_fss_eol_s.string[0] || f_fss_is_space(buffer, *range, state) == F_false) break;
+
+            state->status = f_utf_buffer_increment(buffer, range, 1);
+
+            if (F_status_is_error(state->status)) {
+              delimits->used = delimits_used;
+
+              return;
+            }
+          } // while
+
+          if (range->start >= buffer.used || range->start > range->stop) {
+            delimits->used = delimits_used;
+
+            if (range->start >= buffer.used) {
+              found->stop = buffer.used - 1;
+              state->status = F_data_not_eos;
+            }
+            else {
+              found->stop = range->stop;
+              state->status = F_data_not_stop;
+            }
+
+            return;
+          }
+
+          if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
+            found->stop = range->start;
+            range->start = slash_first;
+
+            state->status = f_memory_array_increase_by((slash_count / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
+
+            if (F_status_is_error(state->status)) {
+              range->start = found->stop;
+              delimits->used = delimits_used;
+
+              return;
+            }
+
+            if (slash_count % 2 == 0) {
+              while (slash_count > 0) {
+
+                if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
+                  if (slash_count % 2 == 1) {
+                    delimits->array[delimits->used++] = range->start;
+                  }
+
+                  --slash_count;
+                  ++range->start;
+                }
+                else {
+                  state->status = f_utf_buffer_increment(buffer, range, 1);
+
+                  if (F_status_is_error(state->status)) {
+                    range->start = found->stop;
+                    delimits->used = delimits_used;
+
+                    return;
+                  }
+                }
+              } // while
+
+              range->start = found->stop + 1;
+              found->start = start;
+              found->stop = stop + macro_f_utf_byte_width(buffer.string[stop]) - 1;
+              state->status = F_fss_found_object;
+            }
+            else {
+              range->start = found->stop + 1;
+              state->status = F_fss_found_object_not;
+            }
+
+            return;
+          }
+        }
+        else if (graph_first && buffer.string[range->start] == f_fss_comment_s.string[0]) {
+          if (graph_first) {
+            graph_first = F_false;
+            start = slash_first;
+          }
+
+          // Comments may only have white space before the '#', therefore only the first slash needs to be delimited.
+          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)) {
+            range->start = found->stop;
+            delimits->used = delimits_used;
+
+            return;
+          }
+
+          delimits->array[delimits->used++] = slash_first;
+          stop = range->start++;
+        }
+        else {
+          graph_first = F_false;
+          stop = range->start;
+        }
+
+        continue;
+      }
+
+      if (buffer.string[range->start] == list_open.string[0]) {
+        ++range->start;
+
+        while (range->start <= range->stop && range->start < buffer.used) {
+
+          if (state->interrupt) {
+            state->interrupt((void *) state, 0);
+
+            if (F_status_is_error(state->status)) {
+              delimits->used = delimits_used;
+
+              return;
+            }
+          }
+
+          if (buffer.string[range->start] == f_fss_eol_s.string[0] || f_fss_is_space(buffer, *range, state) == F_false) break;
+
+          state->status = f_utf_buffer_increment(buffer, range, 1);
+
+          if (F_status_is_error(state->status)) {
+            delimits->used = delimits_used;
+
+            return;
+          }
+        } // while
+
+        if (range->start >= buffer.used) {
+          found->stop = buffer.used - 1;
+          state->status = F_okay_eos;
+
+          return;
+        }
+
+        if (range->start > range->stop) {
+          found->stop = range->stop;
+          state->status = F_okay_stop;
+
+          return;
+        }
+
+        if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
+          found->start = start;
+          found->stop = stop + macro_f_utf_byte_width(buffer.string[stop]) - 1;
+          ++range->start;
+          state->status = F_fss_found_object;
+
+          return;
+        }
+
+        if (graph_first) {
+          graph_first = F_false;
+          start = 1;
+          stop = 0;
+        }
+        else {
+          stop = range->start;
+        }
+
+        continue;
+      }
+      else {
+        if (f_fss_is_space(buffer, *range, state) == F_false) {
+          if (F_status_is_error(state->status)) {
+            delimits->used = delimits_used;
+
+            return;
+          }
+
+          if (graph_first) {
+            graph_first = F_false;
+            start = range->start;
+          }
+
+          stop = range->start;
+        }
+      }
+
+      state->status = f_utf_buffer_increment(buffer, range, 1);
+
+      if (F_status_is_error(state->status)) {
+        delimits->used = delimits_used;
+
+        return;
+      }
+    } // while
+
+    if (range->start >= buffer.used) {
+      found->stop = buffer.used - 1;
+      state->status = F_data_not_eos;
+
+      return;
+    }
+
+    if (range->start > range->stop) {
+      found->stop = range->stop;
+      state->status = F_data_not_stop;
+
+      return;
+    }
+
+    // Seek to the end of the line when no valid object is found.
+    f_fss_seek_to_eol(buffer, range, state);
+
+    if (F_status_is_error(state->status)) {
+      delimits->used = delimits_used;
+    }
+    else {
+      state->status = F_fss_found_object_not;
+
+      // Move the start position to after the EOL.
+      ++range->start;
+    }
+  }
+#endif // !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_extended_list_object_read_)
+
+#if !defined(_di_fl_fss_basic_list_content_write_) || !defined(_di_fl_fss_extended_list_content_write_) || !defined(_di_fl_fss_embedded_list_content_write_)
+  void private_fl_fss_list_write_add_until_end(const f_string_static_t buffer, f_range_t * const range, f_string_dynamic_t * const destination, f_state_t * const state) {
+
+    state->status = F_okay;
+
+    for (; range->start <= range->stop && range->start < buffer.used; ++range->start) {
+
+      if (state->interrupt) {
+        state->interrupt((void *) state, 0);
+        if (F_status_set_fine(state->status) == F_interrupt) return;
+      }
+
+      if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) continue;
+      if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
+
+      state->status = f_memory_array_increase(state->step_large, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+      if (F_status_is_error(state->status)) break;
+
+      destination->string[destination->used++] = buffer.string[range->start];
+    } // for
+  }
+#endif // !defined(_di_fl_fss_basic_list_content_write_) || !defined(_di_fl_fss_extended_list_content_write_) || !defined(_di_fl_fss_embedded_list_content_write_)
+
+#if !defined(_di_fl_fss_basic_list_object_write_) || !defined(_di_fl_fss_extended_list_object_write_)
+  void private_fl_fss_list_write_object_trim(const f_number_unsigned_t used_start, f_string_dynamic_t * const destination, f_state_t * const state) {
+
+    f_range_t destination_range = macro_f_range_t_initialize_2(destination->used);
+    f_number_unsigned_t i = 0;
+    uint8_t width = 0;
+
+    state->status = F_okay;
+
+    for (; destination_range.start < destination->used; ++destination_range.start) {
+
+      if (state->interrupt) {
+        state->interrupt((void *) state, 0);
+        if (F_status_set_fine(state->status) == F_interrupt) return;
+      }
+
+      if (destination->string[destination_range.start] == f_fss_placeholder_s.string[0]) continue;
+
+      if (f_fss_is_space(*destination, destination_range, state) == F_false) {
+        if (F_status_is_error(state->status)) {
+          destination->used = used_start;
+
+          return;
+        }
+
+        break;
+      }
+
+      width = macro_f_utf_byte_width(destination->string[destination_range.start]);
+
+      for (i = 0; i < width; ++i) {
+        destination->string[destination_range.start + i] = f_fss_placeholder_s.string[0];
+      } // for
+    } // for
+
+    for (destination_range.start = destination->used - 1; destination_range.start > 0; --destination_range.start) {
+
+      if (state->interrupt) {
+        state->interrupt((void *) state, 0);
+        if (F_status_set_fine(state->status) == F_interrupt) return;
+      }
+
+      if (destination->string[destination_range.start] == f_fss_placeholder_s.string[0]) {
+        --destination->used;
+
+        continue;
+      }
+
+      if (f_fss_is_space(*destination, destination_range, state) == F_false) {
+
+        // When going backwards, getting incomplete UTF-8 sequences is not an error.
+        if (F_status_set_fine(state->status) == F_complete_not_utf) continue;
+
+        if (F_status_is_error(state->status)) {
+          destination->used = used_start;
+
+          return;
+        }
+
+        break;
+      }
+
+      destination->used -= macro_f_utf_byte_width(destination->string[destination_range.start]);
+    } // for
+
+    if (destination_range.start == 0) {
+      if (f_fss_is_space(*destination, destination_range, state) == F_false) {
+        if (F_status_is_error(state->status)) {
+          destination->used = used_start;
+
+          return;
+        }
+      }
+      else {
+        destination->used = 0;
+      }
+    }
+
+    state->status = F_okay;
+  }
+#endif // !defined(_di_fl_fss_basic_list_object_write_) || !defined(_di_fl_fss_extended_list_object_write_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_1/fl_fss/c/private-fss-list.h b/level_1/fl_fss/c/private-fss-list.h
new file mode 100644 (file)
index 0000000..c4f60e7
--- /dev/null
@@ -0,0 +1,166 @@
+/**
+ * FLL - Level 1
+ *
+ * Project: FSS
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * These are provided for internal reduction in redundant code.
+ * These should not be exposed/used outside of this project.
+ */
+#ifndef _PRIVATE_FL_fss_list_h
+#define _PRIVATE_FL_fss_list_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Read a standard list Object where the list open is specific to a given FSS standard.
+ *
+ * This will record where delimit placeholders exist but will not apply the delimits.
+ *
+ * @param list_open
+ *   The list open character for the given standard.
+ *   This must be defined where list_open.used = 1.
+ * @param buffer
+ *   The buffer to read from.
+ * @param range
+ *   The start/stop location within the buffer to be processed.
+ *   The start location will be updated as the buffer is being processed.
+ *   The start location will represent where the read stopped on return.
+ *   A start location past the stop location or buffer used means that the entire range was processed.
+ *
+ *   Must not be NULL.
+ * @param found
+ *   A location where a valid Object is found.
+ *
+ *   Must not be NULL.
+ * @param delimits
+ *   A delimits array representing where delimits exist within the buffer.
+ *
+ *   Must not be NULL.
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
+ *   There is no state.handle().
+ *   There is no "callbacks" structure.
+ *   There is no data structure passed to these functions.
+ *
+ *   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.
+ *
+ *   Must not be NULL.
+ *
+ *   This alters state.status:
+ *     F_fss_found_object on success and Object is found (start location is at end of Object).
+ *     F_fss_found_object_not on success and no Object is found (start location is after character designating this is not an Object).
+ *     F_okay_eos on success after reaching the end of the buffer (a valid Object is not yet confirmed).
+ *     F_okay_stop on success after reaching stopping point (a valid Object is not yet confirmed).
+ *     F_data_not if buffer is empty (buffer.used is 0).
+ *     F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found).
+ *     F_data_not_stop no data found after reaching stopping point (essentially only comments are found).
+ *     F_end_not_group_eos if EOS was reached before the a group termination was reached.
+ *     F_end_not_group_stop if stop point was reached before the a group termination was reached.
+ *
+ *     F_interrupt (with error bit) if stopping due to an interrupt.
+ *     F_parameter (with error bit) if a parameter is invalid.
+ *
+ *     Errors (with error bit) from: f_fss_is_graph().
+ *     Errors (with error bit) from: f_fss_is_space().
+ *     Errors (with error bit) from: f_fss_is_zero_width().
+ *     Errors (with error bit) from: f_fss_seek_to_eol().
+ *     Errors (with error bit) from: f_fss_skip_past_delimit().
+ *     Errors (with error bit) from: f_fss_skip_past_space().
+ *     Errors (with error bit) from: f_memory_array_increase_by().
+ *     Errors (with error bit) from: f_utf_buffer_increment().
+ *
+ * @see f_fss_is_graph()
+ * @see f_fss_is_space()
+ * @see f_fss_is_zero_width()
+ * @see f_fss_seek_to_eol()
+ * @see f_fss_skip_past_delimit()
+ * @see f_fss_skip_past_space()
+ * @see f_memory_array_increase_by()
+ * @see f_utf_buffer_increment()
+ *
+ * @see fl_fss_basic_list_object_read()
+ * @see fl_fss_embedded_list_object_read()
+ * @see fl_fss_extended_list_object_read()
+ */
+#if !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_extended_list_object_read_)
+  extern void private_fl_fss_list_object_read(const f_string_static_t list_open, const f_string_static_t buffer, f_range_t * const range, f_range_t * const found, f_number_unsigneds_t * const delimits, f_state_t * const state) F_attribute_visibility_internal_d;
+#endif // !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_extended_list_object_read_)
+
+/**
+ * Add all bytes to destination until stop point, buffer end, or EOL.
+ *
+ * @param buffer
+ *   The buffer to seek through.
+ * @param range
+ *   The start/stop location within the buffer string to process.
+ * @param destination
+ *   The buffer where the bytes are written to.
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
+ *   There is no state.handle().
+ *   There is no "callbacks" structure.
+ *   There is no data structure passed to these functions.
+ *
+ *   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.
+ *
+ *   This alters state.status:
+ *     F_okay on success.
+ *
+ *     F_interrupt (with error bit) if stopping due to an interrupt.
+ *
+ *     Errors (with error bit) from: f_memory_array_increase().
+ *
+ * @see f_memory_array_increase()
+ * @see fl_fss_basic_list_content_write()
+ * @see fl_fss_embedded_list_content_write()
+ * @see fl_fss_extended_list_content_write()
+ */
+#if !defined(_di_fl_fss_basic_list_content_write_) || !defined(_di_fl_fss_extended_list_content_write_) || !defined(_di_fl_fss_embedded_list_content_write_)
+  extern void private_fl_fss_list_write_add_until_end(const f_string_static_t buffer, f_range_t * const range, f_string_dynamic_t * const destination, f_state_t * const state) F_attribute_visibility_internal_d;
+#endif // !defined(_di_fl_fss_basic_list_content_write_) || !defined(_di_fl_fss_extended_list_content_write_) || !defined(_di_fl_fss_embedded_list_content_write_)
+
+/**
+ * Trim a given object used by the basic list and extended list object write functions.
+ *
+ * @param used_start
+ *   The destination.used value before any operations were performed.
+ * @param destination
+ *   The buffer where the object is written to.
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
+ *   There is no state.handle().
+ *   There is no "callbacks" structure.
+ *   There is no data structure passed to these functions.
+ *
+ *   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.
+ *
+ *   This alters state.status:
+ *     F_okay on success.
+ *
+ *     F_interrupt (with error bit) if stopping due to an interrupt.
+ *
+ *     Errors (with error bit) from: f_fss_is_space().
+ *
+ * @see f_fss_is_space()
+ * @see fl_fss_basic_list_object_write()
+ * @see fl_fss_extended_list_object_write()
+ */
+#if !defined(_di_fl_fss_basic_list_object_write_) || !defined(_di_fl_fss_extended_list_object_write_)
+  extern void private_fl_fss_list_write_object_trim(const f_number_unsigned_t used_start, f_string_dynamic_t * const destination, f_state_t * const state) F_attribute_visibility_internal_d;
+#endif // !defined(_di_fl_fss_basic_list_object_write_) || !defined(_di_fl_fss_extended_list_object_write_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_FL_fss_list_h
index df5cfeb7f325b1bda6c008215e5f0eaefb358391..419cad841784dd24f3fcf5fd497a9e9bb44226bf 100644 (file)
 extern "C" {
 #endif
 
-#if !defined(_di_fl_fss_basic_list_content_write_) || !defined(_di_fl_fss_extended_list_content_write_) || !defined(_di_fl_fss_embedded_list_content_write_)
-  void private_fl_fss_basic_list_write_add_until_end(const f_string_static_t buffer, f_range_t * const range, f_string_dynamic_t * const destination, f_state_t * const state) {
-
-    state->status = F_okay;
-
-    for (; range->start <= range->stop && range->start < buffer.used; ++range->start) {
-
-      if (state->interrupt) {
-        state->interrupt((void *) state, 0);
-        if (F_status_set_fine(state->status) == F_interrupt) return;
-      }
-
-      if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) continue;
-      if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
-
-      state->status = f_memory_array_increase(state->step_large, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
-      if (F_status_is_error(state->status)) break;
-
-      destination->string[destination->used++] = buffer.string[range->start];
-    } // for
-  }
-#endif // !defined(_di_fl_fss_basic_list_content_write_) || !defined(_di_fl_fss_extended_list_content_write_) || !defined(_di_fl_fss_embedded_list_content_write_)
-
-#if !defined(_di_fl_fss_basic_list_object_write_) || !defined(_di_fl_fss_extended_list_object_write_)
-  void private_fl_fss_basic_list_write_object_trim(const f_number_unsigned_t used_start, f_string_dynamic_t * const destination, f_state_t * const state) {
-
-    f_range_t destination_range = macro_f_range_t_initialize_2(destination->used);
-    f_number_unsigned_t i = 0;
-    uint8_t width = 0;
-
-    state->status = F_okay;
-
-    for (; destination_range.start < destination->used; ++destination_range.start) {
-
-      if (state->interrupt) {
-        state->interrupt((void *) state, 0);
-        if (F_status_set_fine(state->status) == F_interrupt) return;
-      }
-
-      if (destination->string[destination_range.start] == f_fss_placeholder_s.string[0]) continue;
-
-      if (f_fss_is_space(*destination, destination_range, state) == F_false) {
-        if (F_status_is_error(state->status)) {
-          destination->used = used_start;
-
-          return;
-        }
-
-        break;
-      }
-
-      width = macro_f_utf_byte_width(destination->string[destination_range.start]);
-
-      for (i = 0; i < width; ++i) {
-        destination->string[destination_range.start + i] = f_fss_placeholder_s.string[0];
-      } // for
-    } // for
-
-    for (destination_range.start = destination->used - 1; destination_range.start > 0; --destination_range.start) {
-
-      if (state->interrupt) {
-        state->interrupt((void *) state, 0);
-        if (F_status_set_fine(state->status) == F_interrupt) return;
-      }
-
-      if (destination->string[destination_range.start] == f_fss_placeholder_s.string[0]) {
-        --destination->used;
-
-        continue;
-      }
-
-      if (f_fss_is_space(*destination, destination_range, state) == F_false) {
-
-        // When going backwards, getting incomplete UTF-8 sequences is not an error.
-        if (F_status_set_fine(state->status) == F_complete_not_utf) continue;
-
-        if (F_status_is_error(state->status)) {
-          destination->used = used_start;
-
-          return;
-        }
-
-        break;
-      }
-
-      destination->used -= macro_f_utf_byte_width(destination->string[destination_range.start]);
-    } // for
-
-    if (destination_range.start == 0) {
-      if (f_fss_is_space(*destination, destination_range, state) == F_false) {
-        if (F_status_is_error(state->status)) {
-          destination->used = used_start;
-
-          return;
-        }
-      }
-      else {
-        destination->used = 0;
-      }
-    }
-
-    state->status = F_okay;
-  }
-#endif // !defined(_di_fl_fss_basic_list_object_write_) || !defined(_di_fl_fss_extended_list_object_write_)
-
 #if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_)
   void private_fl_fss_basic_or_extended_read(const f_string_static_t buffer, const uint8_t flag, f_range_t * const range, f_range_t * const found, uint8_t * const quote, f_number_unsigneds_t * const delimits, f_state_t * const state) {
 
     f_fss_skip_past_space(buffer, range, state);
-    if (F_status_is_error(state->status)) return;
-    if (state->status == F_data_not) return;
+    if (F_status_is_error(state->status) || state->status == F_data_not) return;
 
     if (state->status == F_okay_eol) {
-
       // Move the start position to after the EOL.
       ++range->start;
       state->status = F_fss_found_object_not;
@@ -126,14 +19,8 @@ extern "C" {
       return;
     }
 
-    if (state->status == F_okay_eos) {
-      state->status = F_data_not_eos;
-
-      return;
-    }
-
-    if (state->status == F_okay_stop) {
-      state->status = F_data_not_stop;
+    if (state->status == F_okay_eos || state->status == F_okay_stop) {
+      state->status = state->status == F_okay_eos ? F_data_not_eos : F_data_not_stop;
 
       return;
     }
@@ -147,28 +34,14 @@ extern "C" {
 
     // Ignore all comment lines.
     if ((flag & 0x1) && buffer.string[range->start] == f_fss_comment_s.string[0]) {
+      f_fss_seek_to_eol(buffer, range, state);
+      if (F_status_is_error(state->status)) return;
 
-      while (buffer.string[range->start] != f_fss_eol_s.string[0]) {
-
-        if (state->interrupt) {
-          state->interrupt((void *) state, 0);
-          if (F_status_set_fine(state->status) == F_interrupt) return;
-        }
-
-        ++range->start;
-
-        if (range->start >= buffer.used) {
-          state->status = F_data_not_eos;
-
-          return;
-        }
-
-        if (range->start > range->stop) {
-          state->status = F_data_not_stop;
+      if (range->start >= buffer.used || range->start > range->stop) {
+        state->status = range->start >= buffer.used ? F_data_not_eos : F_data_not_stop;
 
-          return;
-        }
-      } // while
+        return;
+      }
 
       // Move the start position to after the EOL.
       ++range->start;
@@ -180,9 +53,7 @@ extern "C" {
     // Handle quote support.
     f_char_t quote_found = 0;
 
-    if (quote) {
-      *quote = f_fss_quote_type_none_e;
-    }
+    if (quote) *quote = f_fss_quote_type_none_e;
 
     // Identify where the object begins.
     if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
@@ -191,62 +62,56 @@ extern "C" {
       found->start = range->start;
 
       state->status = f_utf_buffer_increment(buffer, range, 1);
-      if (F_status_is_error(state->status)) return;
-
-      while (range->start <= range->stop && range->start < buffer.used) {
-
-        if (state->interrupt) {
-          state->interrupt((void *) state, 0);
-          if (F_status_set_fine(state->status) == F_interrupt) return;
-        }
 
-        if (f_fss_is_zero_width(buffer, *range, state) == F_false) {
-          if (F_status_is_error(state->status)) return;
-        }
-        else {
-          state->status = f_utf_buffer_increment(buffer, range, 1);
-          if (F_status_is_error(state->status)) break;
+      if (F_status_is_error_not(state->status)) {
+        while (range->start <= range->stop && range->start < buffer.used) {
 
-          continue;
-        }
+          if (state->interrupt) {
+            state->interrupt((void *) state, 0);
+            if (F_status_is_error(state->status)) return;
+          }
 
-        if (buffer.string[range->start] != f_fss_slash_s.string[0]) {
-          if (f_fss_is_space(buffer, *range, state) == F_false) {
+          if (f_fss_is_zero_width(buffer, *range, state) == F_false) {
             if (F_status_is_error(state->status)) return;
           }
+          else {
+            state->status = f_utf_buffer_increment(buffer, range, 1);
+            if (F_status_is_error(state->status)) return;
 
-          // Found the end of the object while processing the slash for potential delimits.
-          if (state->status == F_true) {
-            if (range->start > begin) {
-              found->stop = range->start - 1;
-            }
-            else {
-              found->start = 1;
-              found->stop = 0;
+            continue;
+          }
+
+          if (buffer.string[range->start] != f_fss_slash_s.string[0]) {
+            if (f_fss_is_space(buffer, *range, state) == F_false) {
+              if (F_status_is_error(state->status)) return;
             }
 
-            state->status = f_utf_buffer_increment(buffer, range, 1);
-            if (F_status_is_error(state->status)) break;
+            // Found the end of the object while processing the slash for potential delimits.
+            if (state->status == F_true) {
+              if (range->start > begin) {
+                found->stop = range->start - 1;
+              }
+              else {
+                found->start = 1;
+                found->stop = 0;
+              }
 
-            if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-              state->status = F_fss_found_object_content_not;
+              state->status = f_utf_buffer_increment(buffer, range, 1);
+
+              if (F_status_is_error_not(state->status)) {
+                state->status = buffer.string[range->start] == f_fss_eol_s.string[0] ? F_fss_found_object_content_not : F_fss_found_object;
+              }
 
               return;
             }
 
-            state->status = F_fss_found_object;
-
-            return;
+            break;
           }
 
-          break;
-        }
-
-        state->status = f_utf_buffer_increment(buffer, range, 1);
-        if (F_status_is_error(state->status)) break;
-      } // while
-
-      if (F_status_is_error(state->status)) return;
+          state->status = f_utf_buffer_increment(buffer, range, 1);
+          if (F_status_is_error(state->status)) return;
+        } // while
+      }
 
       if (range->start >= buffer.used) {
         found->stop = buffer.used - 1;
@@ -270,18 +135,12 @@ extern "C" {
         if (F_status_is_error(state->status)) return;
 
         delimits->array[delimits->used++] = first_slash;
-
-        state->status = f_utf_buffer_increment(buffer, range, 1);
-        if (F_status_is_error(state->status)) return;
+        ++range->start;
       }
     }
     else if (!(flag & 0x2) && (buffer.string[range->start] == f_fss_quote_single_s.string[0] || buffer.string[range->start] == f_fss_quote_double_s.string[0] || buffer.string[range->start] == f_fss_quote_grave_s.string[0])) {
       quote_found = buffer.string[range->start];
-
-      state->status = f_utf_buffer_increment(buffer, range, 1);
-      if (F_status_is_error(state->status)) return;
-
-      found->start = range->start;
+      found->start = ++range->start;
     }
 
     // Identify where the object ends.
@@ -392,7 +251,7 @@ extern "C" {
                 state->status = f_memory_array_increase_by(slash_count / 2, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
                 if (F_status_is_error(state->status)) return;
 
-                while (slash_count > 0) {
+                while (slash_count) {
 
                   if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
                     if (slash_count % 2 == 1) {
@@ -401,10 +260,12 @@ extern "C" {
                     }
 
                     --slash_count;
+                    ++range->start;
+                  }
+                  else {
+                    state->status = f_utf_buffer_increment(buffer, range, 1);
+                    if (F_status_is_error(state->status)) return;
                   }
-
-                  state->status = f_utf_buffer_increment(buffer, range, 1);
-                  if (F_status_is_error(state->status)) return;
                 } // while
 
                 range->start = location + 1;
@@ -433,7 +294,6 @@ extern "C" {
                   if (F_status_is_error(state->status)) return;
                 }
                 else {
-
                   while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) {
 
                     if (state->interrupt) {
@@ -445,24 +305,27 @@ extern "C" {
                     if (F_status_is_error(state->status)) return;
                   } // while
 
-                  if (range->start >= buffer.used) {
-                    found->stop = buffer.used - 1;
-                    state->status = F_data_not_eos;
+                  if (F_status_is_error_not(state->status)) {
+                    if (range->start >= buffer.used) {
+                      found->stop = buffer.used - 1;
+                      state->status = F_data_not_eos;
 
-                    return;
-                  }
+                      return;
+                    }
 
-                  if (range->start > range->stop) {
-                    found->stop = range->stop;
-                    state->status = F_data_not_stop;
+                    if (range->start > range->stop) {
+                      found->stop = range->stop;
+                      state->status = F_data_not_stop;
 
-                    return;
-                  }
+                      return;
+                    }
 
-                  state->status = f_utf_buffer_increment(buffer, range, 1);
-                  if (F_status_is_error(state->status)) return;
+                    state->status = f_utf_buffer_increment(buffer, range, 1);
+                  }
 
-                  state->status = F_fss_found_object_not;
+                  if (F_status_is_error_not(state->status)) {
+                    state->status = F_fss_found_object_not;
+                  }
 
                   return;
                 }
@@ -490,7 +353,7 @@ extern "C" {
               state->status = f_memory_array_increase_by((slash_count / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
               if (F_status_is_error(state->status)) return;
 
-              while (slash_count > 0) {
+              while (slash_count) {
 
                 if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
                   if (slash_count % 2 == 1) {
@@ -498,10 +361,12 @@ extern "C" {
                   }
 
                   --slash_count;
+                  ++range->start;
+                }
+                else {
+                  state->status = f_utf_buffer_increment(buffer, range, 1);
+                  if (F_status_is_error(state->status)) return;
                 }
-
-                state->status = f_utf_buffer_increment(buffer, range, 1);
-                if (F_status_is_error(state->status)) return;
               } // while
 
               range->start = location;
@@ -590,10 +455,13 @@ extern "C" {
                 if (F_status_is_error(state->status)) return;
               }
               else {
-                state->status = f_utf_buffer_increment(buffer, range, 1);
-                if (F_status_is_error(state->status)) return;
+                if (F_status_is_error_not(state->status)) {
+                  state->status = f_utf_buffer_increment(buffer, range, 1);
 
-                state->status = F_fss_found_object;
+                  if (F_status_is_error_not(state->status)) {
+                    state->status = F_fss_found_object;
+                  }
+                }
 
                 return;
               }
@@ -625,9 +493,10 @@ extern "C" {
                 }
 
                 state->status = f_utf_buffer_increment(buffer, range, 1);
-                if (F_status_is_error(state->status)) return;
 
-                state->status = F_fss_found_object_not;
+                if (F_status_is_error_not(state->status)) {
+                  state->status = F_fss_found_object_not;
+                }
 
                 return;
               }
@@ -706,7 +575,7 @@ extern "C" {
 
         if (state->interrupt) {
           state->interrupt((void *) state, 0);
-          if (F_status_set_fine(state->status) == F_interrupt) break;
+          if (F_status_set_fine(state->status) == F_interrupt) return;
         }
 
         if (f_fss_is_space(buffer, *range, state) == F_false) {
@@ -717,11 +586,9 @@ extern "C" {
         }
 
         state->status = f_utf_buffer_increment(buffer, range, 1);
-        if (F_status_is_error(state->status)) break;
+        if (F_status_is_error(state->status)) return;
       } // while
 
-      if (F_status_is_error(state->status)) return;
-
       if (range->start > begin) {
         found->stop = range->start - 1;
       }
@@ -763,8 +630,7 @@ extern "C" {
   void private_fl_fss_basic_write(const uint8_t flag, const f_string_static_t object, const uint8_t quote, f_range_t * const range, f_string_dynamic_t * const 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;
-    if (state->status == F_data_not) return;
+    if (F_status_is_error(state->status) || state->status == F_data_not) return;
 
     if (state->status == F_okay_eos) {
       state->status = F_data_not_eos;
@@ -791,15 +657,14 @@ extern "C" {
     const f_number_unsigned_t input_start = range->start;
     const f_number_unsigned_t used_start = destination->used;
 
-    bool quoted_is = F_false;
-    bool commented = F_false;
+    uint8_t quoted_is = F_false;
+    uint8_t commented = F_false;
+    uint8_t width = 0;
 
     f_number_unsigned_t item_first = 0;
     f_number_unsigned_t item_total = 0;
     f_number_unsigned_t i = 0;
 
-    uint8_t width = 0;
-
     const f_char_t quote_char = quote ? quote : f_string_ascii_quote_double_s.string[0];
 
     // Use placeholders for potential quote and potential delimited quote to avoid doing things such as memmove().
@@ -885,7 +750,6 @@ extern "C" {
           if (F_status_is_error(state->status)) break;
 
           if (range->start > range->stop || range->start >= object.used) {
-
             state->status = f_memory_array_increase_by(item_total + 1, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
             if (F_status_is_error(state->status)) break;
 
@@ -1057,10 +921,7 @@ extern "C" {
             f_fss_skip_past_delimit(object, range, state);
             if (F_status_is_error(state->status)) return;
 
-            if (range->start > range->stop || range->start >= object.used) {
-              quoted_is = F_true;
-            }
-            else if (object.string[range->start] == object.string[item_first]) {
+            if (range->start > range->stop || range->start >= object.used || object.string[range->start] == object.string[item_first]) {
               quoted_is = F_true;
             }
             else if (f_fss_is_space(object, *range, state) == F_true) {
@@ -1115,7 +976,6 @@ extern "C" {
 
       // The start quote may or may not need to be delimited in this case.
       if (destination->string[input_start] == quote_char) {
-
         for (i = input_start + macro_f_utf_byte_width(object.string[input_start]); i <= range->stop && i < object.used; i += macro_f_utf_byte_width(object.string[i])) {
 
           if (state->interrupt) {
index 3bd7b135ae74bbcfa52033e0913e105e4bd08440..46afae7d2a2a1e7b68ee0e2f1b622391a2bbfc4e 100644 (file)
@@ -16,73 +16,6 @@ extern "C" {
 #endif
 
 /**
- * Add all bytes to destination until stop point, buffer end, or EOL.
- *
- * @param buffer
- *   The buffer to seek through.
- * @param range
- *   The start/stop location within the buffer string to process.
- * @param destination
- *   The buffer where the bytes are written to.
- * @param state
- *   A state for providing flags and handling interrupts during long running operations.
- *   There is no state.handle().
- *   There is no "callbacks" structure.
- *   There is no data structure passed to these functions.
- *
- *   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.
- *
- *   This alters state.status:
- *     F_okay on success.
- *
- *     F_interrupt (with error bit) if stopping due to an interrupt.
- *
- *     Errors (with error bit) from: f_memory_array_increase().
- *
- * @see f_memory_array_increase()
- * @see fl_fss_basic_list_content_write()
- * @see fl_fss_embedded_list_content_write()
- * @see fl_fss_extended_list_content_write()
- */
-#if !defined(_di_fl_fss_basic_list_content_write_) || !defined(_di_fl_fss_extended_list_content_write_) || !defined(_di_fl_fss_embedded_list_content_write_)
-  extern void private_fl_fss_basic_list_write_add_until_end(const f_string_static_t buffer, f_range_t * const range, f_string_dynamic_t * const destination, f_state_t * const state) F_attribute_visibility_internal_d;
-#endif // !defined(_di_fl_fss_basic_list_content_write_) || !defined(_di_fl_fss_extended_list_content_write_) || !defined(_di_fl_fss_embedded_list_content_write_)
-
-/**
- * Trim a given object used by the basic list and extended list object write functions.
- *
- * @param used_start
- *   The destination.used value before any operations were performed.
- * @param destination
- *   The buffer where the object is written to.
- * @param state
- *   A state for providing flags and handling interrupts during long running operations.
- *   There is no state.handle().
- *   There is no "callbacks" structure.
- *   There is no data structure passed to these functions.
- *
- *   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.
- *
- *   This alters state.status:
- *     F_okay on success.
- *
- *     F_interrupt (with error bit) if stopping due to an interrupt.
- *
- *     Errors (with error bit) from: f_fss_is_space().
- *
- * @see f_fss_is_space()
- * @see fl_fss_basic_list_object_write()
- * @see fl_fss_extended_list_object_write()
- */
-#if !defined(_di_fl_fss_basic_list_object_write_) || !defined(_di_fl_fss_extended_list_object_write_)
-  extern void private_fl_fss_basic_list_write_object_trim(const f_number_unsigned_t used_start, f_string_dynamic_t * const destination, f_state_t * const state) F_attribute_visibility_internal_d;
-#endif // !defined(_di_fl_fss_basic_list_object_write_) || !defined(_di_fl_fss_extended_list_object_write_)
-
-/**
  * Provide common processing for Basic and Extended Object and Content read.
  *
  * @param buffer
index a4574f008b66ede062a6b38fcabc74e64fe69354..d10a5e493791c171abd039ff8e7289932287a2df 100644 (file)
@@ -35,7 +35,7 @@ build_language c
 build_libraries -lc
 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 fss/private-payload.c fss/private-payload-helper.c
+build_sources_library private-fss.c private-fss-list.c fss/basic.c fss/basic_list.c fss/embedded_list.c fss/extended.c fss/extended_list.c fss/payload.c fss/private-payload.c fss/private-payload-helper.c
 
 build_sources_headers fss.h fss/basic.h fss/basic_list.h fss/embedded_list.h fss/extended.h fss/extended_list.h fss/payload.h fss/payload/define.h fss/payload/type.h
 
index 65b0a48c6425f622a732200ffd9e43a94511843a..8b46f9e4caf9209502375d3a8bee7231c7d67642 100644 (file)
@@ -2,12 +2,12 @@ empty
 d
 a
 привет
-y 
+y
 "мир"
 привет has space
 "This is quoted"
 AlsoGood
-hi     
-привет has space   
+hi
+привет has space
 a
 also_empty
index 65b0a48c6425f622a732200ffd9e43a94511843a..8b46f9e4caf9209502375d3a8bee7231c7d67642 100644 (file)
@@ -2,12 +2,12 @@ empty
 d
 a
 привет
-y 
+y
 "мир"
 привет has space
 "This is quoted"
 AlsoGood
-hi     
-привет has space   
+hi
+привет has space
 a
 also_empty
index 65b0a48c6425f622a732200ffd9e43a94511843a..8b46f9e4caf9209502375d3a8bee7231c7d67642 100644 (file)
@@ -2,12 +2,12 @@ empty
 d
 a
 привет
-y 
+y
 "мир"
 привет has space
 "This is quoted"
 AlsoGood
-hi     
-привет has space   
+hi
+привет has space
 a
 also_empty
index 65b0a48c6425f622a732200ffd9e43a94511843a..8b46f9e4caf9209502375d3a8bee7231c7d67642 100644 (file)
@@ -2,12 +2,12 @@ empty
 d
 a
 привет
-y 
+y
 "мир"
 привет has space
 "This is quoted"
 AlsoGood
-hi     
-привет has space   
+hi
+привет has space
 a
 also_empty
index a3d6a83895d0106cc7e163b51eb098074a41f8c7..40efceb3112da24e68b3beb647d6d3794b3d0de0 100644 (file)
@@ -10,7 +10,7 @@ a{
 привет{
   мир
 }
-y {
+y{
   z
 }
 "мир"{
@@ -24,10 +24,10 @@ y {
 }
 AlsoGood{
 }
-hi     {
+hi{
   Check this.
 }
-привет has space   {
+привет has space{
   ...
 }
 a{
index a3d6a83895d0106cc7e163b51eb098074a41f8c7..40efceb3112da24e68b3beb647d6d3794b3d0de0 100644 (file)
@@ -10,7 +10,7 @@ a{
 привет{
   мир
 }
-y {
+y{
   z
 }
 "мир"{
@@ -24,10 +24,10 @@ y {
 }
 AlsoGood{
 }
-hi     {
+hi{
   Check this.
 }
-привет has space   {
+привет has space{
   ...
 }
 a{
index a3d6a83895d0106cc7e163b51eb098074a41f8c7..40efceb3112da24e68b3beb647d6d3794b3d0de0 100644 (file)
@@ -10,7 +10,7 @@ a{
 привет{
   мир
 }
-y {
+y{
   z
 }
 "мир"{
@@ -24,10 +24,10 @@ y {
 }
 AlsoGood{
 }
-hi     {
+hi{
   Check this.
 }
-привет has space   {
+привет has space{
   ...
 }
 a{
index a3d6a83895d0106cc7e163b51eb098074a41f8c7..40efceb3112da24e68b3beb647d6d3794b3d0de0 100644 (file)
@@ -10,7 +10,7 @@ a{
 привет{
   мир
 }
-y {
+y{
   z
 }
 "мир"{
@@ -24,10 +24,10 @@ y {
 }
 AlsoGood{
 }
-hi     {
+hi{
   Check this.
 }
-привет has space   {
+привет has space{
   ...
 }
 a{
index 65b0a48c6425f622a732200ffd9e43a94511843a..8b46f9e4caf9209502375d3a8bee7231c7d67642 100644 (file)
@@ -2,12 +2,12 @@ empty
 d
 a
 привет
-y 
+y
 "мир"
 привет has space
 "This is quoted"
 AlsoGood
-hi     
-привет has space   
+hi
+привет has space
 a
 also_empty
index 65b0a48c6425f622a732200ffd9e43a94511843a..8b46f9e4caf9209502375d3a8bee7231c7d67642 100644 (file)
@@ -2,12 +2,12 @@ empty
 d
 a
 привет
-y 
+y
 "мир"
 привет has space
 "This is quoted"
 AlsoGood
-hi     
-привет has space   
+hi
+привет has space
 a
 also_empty
index 65b0a48c6425f622a732200ffd9e43a94511843a..8b46f9e4caf9209502375d3a8bee7231c7d67642 100644 (file)
@@ -2,12 +2,12 @@ empty
 d
 a
 привет
-y 
+y
 "мир"
 привет has space
 "This is quoted"
 AlsoGood
-hi     
-привет has space   
+hi
+привет has space
 a
 also_empty
index 65b0a48c6425f622a732200ffd9e43a94511843a..8b46f9e4caf9209502375d3a8bee7231c7d67642 100644 (file)
@@ -2,12 +2,12 @@ empty
 d
 a
 привет
-y 
+y
 "мир"
 привет has space
 "This is quoted"
 AlsoGood
-hi     
-привет has space   
+hi
+привет has space
 a
 also_empty
index a3d6a83895d0106cc7e163b51eb098074a41f8c7..40efceb3112da24e68b3beb647d6d3794b3d0de0 100644 (file)
@@ -10,7 +10,7 @@ a{
 привет{
   мир
 }
-y {
+y{
   z
 }
 "мир"{
@@ -24,10 +24,10 @@ y {
 }
 AlsoGood{
 }
-hi     {
+hi{
   Check this.
 }
-привет has space   {
+привет has space{
   ...
 }
 a{
index a3d6a83895d0106cc7e163b51eb098074a41f8c7..40efceb3112da24e68b3beb647d6d3794b3d0de0 100644 (file)
@@ -10,7 +10,7 @@ a{
 привет{
   мир
 }
-y {
+y{
   z
 }
 "мир"{
@@ -24,10 +24,10 @@ y {
 }
 AlsoGood{
 }
-hi     {
+hi{
   Check this.
 }
-привет has space   {
+привет has space{
   ...
 }
 a{
index a3d6a83895d0106cc7e163b51eb098074a41f8c7..40efceb3112da24e68b3beb647d6d3794b3d0de0 100644 (file)
@@ -10,7 +10,7 @@ a{
 привет{
   мир
 }
-y {
+y{
   z
 }
 "мир"{
@@ -24,10 +24,10 @@ y {
 }
 AlsoGood{
 }
-hi     {
+hi{
   Check this.
 }
-привет has space   {
+привет has space{
   ...
 }
 a{
index a3d6a83895d0106cc7e163b51eb098074a41f8c7..40efceb3112da24e68b3beb647d6d3794b3d0de0 100644 (file)
@@ -10,7 +10,7 @@ a{
 привет{
   мир
 }
-y {
+y{
   z
 }
 "мир"{
@@ -24,10 +24,10 @@ y {
 }
 AlsoGood{
 }
-hi     {
+hi{
   Check this.
 }
-привет has space   {
+привет has space{
   ...
 }
 a{