]> Kevux Git Server - fll/commitdiff
Progress: Continue work.
authorKevin Day <Kevin@kevux.org>
Sat, 7 Nov 2026 02:17:27 +0000 (20:17 -0600)
committerKevin Day <Kevin@kevux.org>
Sat, 7 Nov 2026 02:17:27 +0000 (20:17 -0600)
level_1/fl_fss/c/private-fss.c

index 521de26..cabf100 100644 (file)
@@ -814,19 +814,18 @@ extern "C" {
     #define ___fl_flag_as_object___ 0x1
 
     #define ___fl_flag_has_combining___        0x1
-    #define ___fl_flag_has_combining_joiner___ 0x5
-    #define ___fl_flag_has_increased___        0x2
-    #define ___fl_flag_has_joiner___           0x4
-    #define ___fl_flag_is_quoted___            0x8
-    #define ___fl_flag_is_commented___         0x10
-    #define ___fl_flag_save_character___       0x20
-    #define ___fl_flag_save_comment___         0x40
-    #define ___fl_flag_save_normal___          0x80
-    #define ___fl_flag_save_partial___         0x100
-    #define ___fl_flag_save_quote___           0x200
-    #define ___fl_flag_save_quote_character___ 0x220
-    #define ___fl_flag_save_slash___           0x400
-    #define ___fl_flag_save_slash_quote___     0x600
+    #define ___fl_flag_has_combining_joiner___ 0x3
+    #define ___fl_flag_has_joiner___           0x2
+    #define ___fl_flag_is_quoted___            0x4
+    #define ___fl_flag_is_commented___         0x8
+    #define ___fl_flag_save_character___       0x10
+    #define ___fl_flag_save_comment___         0x20
+    #define ___fl_flag_save_normal___          0x40
+    #define ___fl_flag_save_partial___         0x80
+    #define ___fl_flag_save_quote___           0x100
+    #define ___fl_flag_save_quote_character___ 0x110
+    #define ___fl_flag_save_slash___           0x200
+    #define ___fl_flag_save_slash_quote___     0x300
 
     const f_number_unsigned_t input_start = range->start;
     const f_number_unsigned_t used_start = destination->used;
@@ -1117,7 +1116,9 @@ 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(state->step_large, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+
+          // quote, 2 (for both open and close quotes), 1 (for terminating NULL).
+          state->status = f_memory_array_increase_by(4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
           destination->string[destination->used++] = quote_char;
@@ -1127,7 +1128,9 @@ extern "C" {
 
         if (object.string[range->start] == quote_char) {
           // TODO: Verify no combining joiners following.
-          state->status = f_memory_array_increase(state->step_large, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+
+          // quote, 2 (for both open and close quotes), 1 (for terminating NULL).
+          state->status = f_memory_array_increase_by(4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
           destination->string[destination->used++] = quote_char;
@@ -1148,7 +1151,8 @@ extern "C" {
             break;
           }
 
-          state->status = f_memory_array_increase(state->step_large, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
+          // slash, 2 (for both open and close quotes), 1 (for terminating NULL).
+          state->status = f_memory_array_increase_by(4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
           destination->string[destination->used++] = f_fss_slash_s.string[0];
@@ -1158,6 +1162,7 @@ extern "C" {
 
         width = macro_f_utf_byte_width(object.string[range->start]);
 
+        // width, 2 (for both open and close quotes), 1 (for terminating NULL).
         state->status = f_memory_array_increase_by(width + 3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
         if (F_status_is_error(state->status)) break;
 
@@ -1170,6 +1175,7 @@ extern "C" {
         flag_fl &= ~___fl_flag_save_normal___;
       }
       else if (object.string[range->start] == f_fss_eol_s.string[0]) {
+        // TODO: same as above EOL cases.
         state->status = F_status_set_error(F_okay_eol);
 
         break;
@@ -1179,6 +1185,8 @@ extern "C" {
         flag_fl &= ~___fl_flag_save_partial___;
 
         if (partial.start <= partial.stop) {
+
+          // (partial.stop - partial.start) + 1 (range), 2 (for both open and close quotes), 1 (for terminating NULL).
           state->status = f_memory_array_increase_by((partial.stop - partial.start) + 4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
           if (F_status_is_error_not(state->status)) {
@@ -1220,6 +1228,7 @@ extern "C" {
 
         width = macro_f_utf_byte_width(object.string[range->start]);
 
+        // width, 2 (for both open and close quotes), 1 (for terminating NULL).
         state->status = f_memory_array_increase_by(width + 3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
         if (F_status_is_error(state->status)) break;
 
@@ -1236,11 +1245,11 @@ extern "C" {
       if (flag_fl & ___fl_flag_save_partial___) {
         if (range->start > range->stop || range->start >= object.used) {
           if (partial.start <= partial.stop) {
+
+            // (partial.stop - partial.start) + 1 (range), 2 (for both open and close quotes), 1 (for terminating NULL).
             state->status = f_memory_array_increase_by((partial.stop - partial.start) + 4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
 
             if (F_status_is_error_not(state->status)) {
-              flag_fl |= ___fl_flag_has_increased___;
-
               state->status = f_string_dynamic_partial_append_nulless(object, partial, destination);
             }
           }
@@ -1268,10 +1277,6 @@ extern "C" {
       }
     }
 
-    if (F_status_is_error_not(state->status) && (flag_fl & ___fl_flag_is_quoted___) && !(flag_fl & ___fl_flag_has_increased___)) {
-      state->status = f_memory_array_increase_by(state->step_small + 3, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
-    }
-
     if (F_status_is_error(state->status)) {
       destination->used = used_start;
 
@@ -1281,45 +1286,6 @@ extern "C" {
     if (flag_fl & ___fl_flag_is_quoted___) {
       destination->string[used_start] = quote_char;
       destination->string[destination->used++] = quote_char;
-
-      // The start quote may or may not need to be delimited in this case. // TODO: save start quote position? Review this logic.
-      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) {
-            state->interrupt((void *) state, internal);
-
-            if (F_status_set_fine(state->status) == F_interrupt) {
-              destination->used = used_start;
-
-              return;
-            }
-          }
-
-          if (object.string[i] != f_fss_placeholder_s.string[0]) break;
-        } // for
-
-        // Only when followed by a space must the start quote be delimited.
-        // TODO: is this logic now redundant/irrelevant?
-        if (i <= range->stop && i < object.used) {
-          f_range_t range_i = *range;
-
-          range_i.start = i;
-
-          if (f_fss_is_space(object, range_i, state) == F_false) { // TODO: Verify no combining joiners following.
-            destination->string[used_start + 1] = f_fss_placeholder_s.string[0];
-          }
-          else if (object.string[i] == f_fss_eol_s.string[0]) {
-            state->status = F_status_set_error(F_okay_eol);
-          }
-
-          if (F_status_is_error(state->status)) {
-            destination->used = used_start;
-
-            return;
-          }
-        }
-      }
     }
     else if (flag_fl & ___fl_flag_is_commented___) {
       destination->string[used_start] = f_fss_slash_s.string[0];
@@ -1331,7 +1297,6 @@ extern "C" {
 
     #undef ___fl_flag_has_combining___
     #undef ___fl_flag_has_combining_joiner___
-    #undef ___fl_flag_has_increased___
     #undef ___fl_flag_has_joiner___
     #undef ___fl_flag_is_quoted___
     #undef ___fl_flag_is_commented___