]> Kevux Git Server - fll/commitdiff
Feature: Add support for "trim" in "complete" enumeration for FSS writing.
authorKevin Day <thekevinday@gmail.com>
Sun, 11 Dec 2022 03:57:21 +0000 (21:57 -0600)
committerKevin Day <thekevinday@gmail.com>
Sun, 11 Dec 2022 03:57:21 +0000 (21:57 -0600)
There is now a "none" equivalent that performs a "trim".

level_0/f_fss/c/fss/common.h
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

index e96f749d80375fea04cdc42615401012c9a28461..7211392009497976cbb7e682d1c958839e0a4c09 100644 (file)
@@ -188,6 +188,7 @@ extern "C" {
  *   - next:         Complete as if this is a piece of a set (such as FSS-0001, adding a separating space).
  *   - partial:      Complete, but do not add terminating EOL, where applicable.
  *   - partial_trim: Complete, but do not add terminating EOL and remove any leading or trailing whitespace, where applicable.
+ *   - trim:         Only print the Object or Content, trimmed where applicable, without any closing or terminating characters.
  */
 #ifndef _di_f_fss_complete_e_
   enum {
@@ -198,6 +199,7 @@ extern "C" {
     f_fss_complete_next_e,
     f_fss_complete_partial_e,
     f_fss_complete_partial_trim_e,
+    f_fss_complete_trim_e,
   }; // enum
 #endif // _di_f_fss_complete_e_
 
index 2765896634379313bbb1b65d4eaf731e763f3bea..527e40463053948dd63d9bf3014a069487332006 100644 (file)
@@ -189,11 +189,11 @@ extern "C" {
       destination->string[destination->used++] = quote ? quote : f_fss_quote_double_s.string[0];
     }
 
-    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) {
+    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 (status == F_none_stop || status == F_none_eos || status == F_data_not_stop || status == F_data_not_eos) {
         f_status_t status2 = F_none;
 
-        if (complete == f_fss_complete_full_trim_e) {
+        if (complete == f_fss_complete_full_trim_e || complete == f_fss_complete_trim_e) {
           status2 = private_fl_fss_basic_write_object_trim(quote ? quote : f_fss_quote_double_s.string[0], destination_used, state, destination);
 
           if (F_status_is_error(status2)) {
@@ -203,15 +203,17 @@ extern "C" {
           }
         }
 
-        status2 = f_string_dynamic_increase(state.step_large, destination);
+        if (complete != f_fss_complete_trim_e) {
+          status2 = f_string_dynamic_increase(state.step_large, destination);
 
-        if (F_status_is_error(status2)) {
-          destination->used = destination_used;
+          if (F_status_is_error(status2)) {
+            destination->used = destination_used;
 
-          return status2;
-        }
+            return status2;
+          }
 
-        destination->string[destination->used++] = f_fss_basic_open_s.string[0];
+          destination->string[destination->used++] = f_fss_basic_open_s.string[0];
+        }
       }
     }
 
index 89c4228aa3232b51cedc941a194782df7516021f..a1f40b11ecd1c730935f231ece0ad7891dae87db 100644 (file)
@@ -968,8 +968,8 @@ extern "C" {
       return status;
     }
 
-    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) {
-      if (complete == f_fss_complete_full_trim_e) {
+    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) {
         status = private_fl_fss_basic_list_write_object_trim(destination_used, state, destination);
 
         if (F_status_is_error(status)) {
@@ -979,18 +979,20 @@ extern "C" {
         }
       }
 
-      status = f_string_dynamic_increase(state.step_small + 2, destination);
+      if (complete != f_fss_complete_trim_e) {
+        status = f_string_dynamic_increase(state.step_small + 2, destination);
 
-      if (F_status_is_error(status)) {
-        destination->used = destination_used;
+        if (F_status_is_error(status)) {
+          destination->used = destination_used;
 
-        return status;
-      }
+          return status;
+        }
 
-      destination->string[destination->used++] = f_fss_basic_list_open_s.string[0];
+        destination->string[destination->used++] = f_fss_basic_list_open_s.string[0];
 
-      if (complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) {
-        destination->string[destination->used++] = f_fss_basic_list_open_end_s.string[0];
+        if (complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) {
+          destination->string[destination->used++] = f_fss_basic_list_open_end_s.string[0];
+        }
       }
     }
 
index cae62613d6afc1d828251a2847b77b0c00ecf92b..eb69e16c8efff71f357b933021821e445457c7b2 100644 (file)
@@ -1442,8 +1442,8 @@ extern "C" {
       return status;
     }
 
-    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) {
-      if (complete == f_fss_complete_full_trim_e) {
+    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) {
         status = private_fl_fss_basic_list_write_object_trim(destination_used, state, destination);
 
         if (F_status_is_error(status)) {
@@ -1456,22 +1456,24 @@ extern "C" {
         ends_on_space = F_true;
       }
 
-      status = f_string_dynamic_increase_by(state.step_small + 3, destination);
+      if (complete != f_fss_complete_trim_e) {
+        status = f_string_dynamic_increase_by(state.step_small + 3, destination);
 
-      if (F_status_is_error(status)) {
-        destination->used = destination_used;
+        if (F_status_is_error(status)) {
+          destination->used = destination_used;
 
-        return status;
-      }
+          return status;
+        }
 
-      if (!ends_on_space) {
-        destination->string[destination->used++] = f_fss_space_s.string[0];
-      }
+        if (!ends_on_space) {
+          destination->string[destination->used++] = f_fss_space_s.string[0];
+        }
 
-      destination->string[destination->used++] = f_fss_embedded_list_open_s.string[0];
+        destination->string[destination->used++] = f_fss_embedded_list_open_s.string[0];
 
-      if (complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) {
-        destination->string[destination->used++] = f_fss_embedded_list_open_end_s.string[0];
+        if (complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) {
+          destination->string[destination->used++] = f_fss_embedded_list_open_end_s.string[0];
+        }
       }
     }
 
index 488820602a536d1eb427ce572be41a6ccabe4342..77dc91f8230659be6fd677496939c82418fd6fd3 100644 (file)
@@ -243,11 +243,11 @@ f_status_t fl_fss_extended_object_write(const f_string_static_t object, const ui
       destination->string[destination->used++] = quote ? quote : f_fss_quote_double_s.string[0];
     }
 
-    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) {
+    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 (status == F_none_stop || status == F_none_eos || status == F_data_not_stop || status == F_data_not_eos) {
         f_status_t status2 = F_none;
 
-        if (complete == f_fss_complete_full_trim_e) {
+        if (complete == f_fss_complete_full_trim_e || complete == f_fss_complete_trim_e) {
           status2 = private_fl_fss_basic_write_object_trim(quote ? quote : f_fss_quote_double_s.string[0], destination_used, state, destination);
 
           if (F_status_is_error(status2)) {
@@ -257,15 +257,17 @@ f_status_t fl_fss_extended_object_write(const f_string_static_t object, const ui
           }
         }
 
-        status2 = f_string_dynamic_increase(state.step_large, destination);
+        if (complete != f_fss_complete_trim_e) {
+          status2 = f_string_dynamic_increase(state.step_large, destination);
 
-        if (F_status_is_error(status2)) {
-          destination->used = destination_used;
+          if (F_status_is_error(status2)) {
+            destination->used = destination_used;
 
-          return status2;
-        }
+            return status2;
+          }
 
-        destination->string[destination->used++] = f_fss_extended_open_s.string[0];
+          destination->string[destination->used++] = f_fss_extended_open_s.string[0];
+        }
       }
     }
 
index 653dd0508b8f9b9589481479b9219e93f3adacfc..32eead38a6fadfe659657cd047aa7e965d96d16c 100644 (file)
@@ -1003,8 +1003,8 @@ extern "C" {
       return status;
     }
 
-    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) {
-      if (complete == f_fss_complete_full_trim_e) {
+    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) {
         status = private_fl_fss_basic_list_write_object_trim(destination_used, state, destination);
 
         if (F_status_is_error(status)) {
@@ -1017,22 +1017,24 @@ extern "C" {
         ends_on_space = F_true;
       }
 
-      status = f_string_dynamic_increase_by(state.step_small + 3, destination);
+      if (complete != f_fss_complete_trim_e) {
+        status = f_string_dynamic_increase_by(state.step_small + 3, destination);
 
-      if (F_status_is_error(status)) {
-        destination->used = destination_used;
+        if (F_status_is_error(status)) {
+          destination->used = destination_used;
 
-        return status;
-      }
+          return status;
+        }
 
-      if (!ends_on_space) {
-        destination->string[destination->used++] = f_fss_space_s.string[0];
-      }
+        if (!ends_on_space) {
+          destination->string[destination->used++] = f_fss_space_s.string[0];
+        }
 
-      destination->string[destination->used++] = f_fss_extended_list_open_s.string[0];
+        destination->string[destination->used++] = f_fss_extended_list_open_s.string[0];
 
-      if (complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) {
-        destination->string[destination->used++] = f_fss_extended_list_open_end_s.string[0];
+        if (complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) {
+          destination->string[destination->used++] = f_fss_extended_list_open_end_s.string[0];
+        }
       }
     }