]> Kevux Git Server - fll/commitdiff
Progress: Continue work on refactoring fss_*_read into fss_read.
authorKevin Day <kevin@kevux.org>
Mon, 15 May 2023 02:18:12 +0000 (21:18 -0500)
committerKevin Day <kevin@kevux.org>
Mon, 15 May 2023 02:18:12 +0000 (21:18 -0500)
Break out the callbacks into its own type as a sibling to the program and settings structures.
Do this in both fss_read and fss_write.

Remove unused "escaped" variable from fss_write.

56 files changed:
level_3/fss_extended_read/c/private-read.c
level_3/fss_read/c/basic/fss_read.c
level_3/fss_read/c/basic/fss_read.h
level_3/fss_read/c/basic/main.c
level_3/fss_read/c/basic_list/fss_read.c
level_3/fss_read/c/basic_list/fss_read.h
level_3/fss_read/c/basic_list/main.c
level_3/fss_read/c/embedded_list/fss_read.c
level_3/fss_read/c/embedded_list/fss_read.h
level_3/fss_read/c/embedded_list/main.c
level_3/fss_read/c/extended/fss_read.c
level_3/fss_read/c/extended/fss_read.h
level_3/fss_read/c/extended/main.c
level_3/fss_read/c/extended_list/fss_read.c
level_3/fss_read/c/extended_list/fss_read.h
level_3/fss_read/c/extended_list/main.c
level_3/fss_read/c/main/common.c
level_3/fss_read/c/main/common.h
level_3/fss_read/c/main/common/enumeration.h
level_3/fss_read/c/main/common/print.c
level_3/fss_read/c/main/common/print.h
level_3/fss_read/c/main/common/static.c [new file with mode: 0644]
level_3/fss_read/c/main/common/static.h [new file with mode: 0644]
level_3/fss_read/c/main/common/type.c
level_3/fss_read/c/main/common/type.h
level_3/fss_read/c/main/fss_read.c
level_3/fss_read/c/main/fss_read.h
level_3/fss_read/c/main/main.c
level_3/fss_read/c/main/main.h
level_3/fss_read/c/main/print/data.c
level_3/fss_read/c/main/print/data.h
level_3/fss_read/c/main/process_normal.c
level_3/fss_read/c/main/process_normal.h
level_3/fss_read/c/main/thread.h
level_3/fss_read/c/payload/fss_read.h
level_3/fss_read/c/payload/main.c
level_3/fss_read/c/payload/print.c
level_3/fss_read/data/build/settings
level_3/fss_write/c/basic/fss_write.h
level_3/fss_write/c/basic/main.c
level_3/fss_write/c/basic_list/fss_write.h
level_3/fss_write/c/basic_list/main.c
level_3/fss_write/c/embedded_list/fss_write.h
level_3/fss_write/c/embedded_list/main.c
level_3/fss_write/c/extended/fss_write.h
level_3/fss_write/c/extended/main.c
level_3/fss_write/c/extended_list/fss_write.h
level_3/fss_write/c/extended_list/main.c
level_3/fss_write/c/main/common/type.c
level_3/fss_write/c/main/common/type.h
level_3/fss_write/c/main/fss_write.c
level_3/fss_write/c/main/fss_write.h
level_3/fss_write/c/main/main.c
level_3/fss_write/c/main/main.h
level_3/fss_write/c/payload/fss_write.h
level_3/fss_write/c/payload/main.c

index b68db62a9bda84ff16a099a049bef985bf19de07..be48d0d442add9f528d70b9b085c1dbb9f54e502 100644 (file)
@@ -405,6 +405,7 @@ extern "C" {
             }
           }
           else {
+            // @fixme: is this block correct? It makes no sense here with the print at function below printing both Object and Content.
             if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_object.array[at]) {
               f_print_dynamic_raw(
                 data->quotes_object.array[at] == f_fss_quote_type_single_e
@@ -418,6 +419,7 @@ extern "C" {
 
             fss_extended_read_print_at(main, i, *delimits_object, *delimits_content, data);
 
+            // @fixme: is this block correct? It makes no sense here with the print at function above printing both Object and Content.
             if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_object.array[at]) {
               f_print_dynamic_raw(
                 data->quotes_object.array[at] == f_fss_quote_type_single_e
@@ -439,6 +441,7 @@ extern "C" {
           }
         }
         else {
+          // @fixme: is this block correct? It makes no sense here with the print at function below printing both Object and Content.
           if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_content.array[at].array[i]) {
             f_print_dynamic_raw(
               data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e
@@ -452,6 +455,7 @@ extern "C" {
 
           fss_extended_read_print_at(main, i, *delimits_object, *delimits_content, data);
 
+          // @fixme: is this block correct? It makes no sense here with the print at function above printing both Object and Content.
           if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_content.array[at].array[i]) {
             f_print_dynamic_raw(
               data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e
index 8bca96f7729a65532730181d666ad24f1fff3be9..29b4ea14ab93877af6891d1c42b890fae0aa42ce 100644 (file)
@@ -5,51 +5,6 @@
 extern "C" {
 #endif
 
-#ifndef _di_fss_read_basic_process_content_
-  void fss_read_basic_process_content(void * const void_main, const bool last) {
-
-    if (!void_main) return;
-
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
-
-    if (main->setting.content) {
-      fl_fss_basic_content_write(
-        *main->setting.content,
-        (main->setting.flag & fss_read_main_flag_partial_e)
-          ? f_fss_complete_partial_e
-          : f_fss_complete_full_e,
-        &main->setting.range,
-        &main->setting.buffer,
-        &main->setting.state
-      );
-
-      if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
-        main->setting.state.status = F_status_set_error(F_support_not);
-
-        fss_read_print_error_unsupported_eol(&main->program.error);
-
-        return;
-      }
-
-      if (F_status_is_error(main->setting.state.status)) {
-        fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_basic_content_write));
-
-        return;
-      }
-    }
-
-    if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_object_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
-      if (main->setting.flag & fss_read_main_flag_content_end_e) {
-        main->setting.state.status = f_string_dynamic_append(f_fss_basic_close_s, &main->setting.buffer);
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-        }
-      }
-    }
-  }
-#endif // _di_fss_read_basic_process_content_
-
 #ifndef _di_fss_read_basic_process_help_
   void fss_read_basic_process_help(void * const void_main) {
 
@@ -59,57 +14,45 @@ extern "C" {
   }
 #endif // _di_fss_read_basic_process_help_
 
-#ifndef _di_fss_read_basic_process_object_
-  void fss_read_basic_process_object(void * const void_main) {
+#ifndef _di_fss_read_basic_process_load_
+  void fss_read_basic_process_load(fss_read_main_t * const main) {
 
-    if (!void_main) return;
+    if (!main) return;
 
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
-
-    if (main->setting.object) {
-      fl_fss_basic_object_write(
-        *main->setting.object,
-        main->setting.quote.used
-          ? main->setting.quote.string[0]
-          : f_fss_quote_double_s.string[0],
-        (main->setting.flag & fss_read_main_flag_partial_e)
-          ? (main->setting.flag & fss_read_main_flag_trim_e)
-            ? f_fss_complete_trim_e
-            : f_fss_complete_none_e
-          : (main->setting.flag & fss_read_main_flag_trim_e)
-            ? f_fss_complete_full_trim_e
-            : f_fss_complete_full_e,
-        &main->setting.range,
-        &main->setting.buffer,
-        &main->setting.state
-      );
+    f_string_range_t input = macro_f_string_range_t_initialize_2(main->setting.buffer.used);
 
-      if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
-        main->setting.state.status = F_status_set_error(F_support_not);
+    main->setting.delimits.used = 0;
+    main->setting.quotes.used = 0;
 
-        fss_read_print_error_unsupported_eol(&main->program.error);
+    fll_fss_basic_read(main->setting.buffer, &input, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.delimits, 0, &main->setting.state);
 
-        return;
-      }
+    if (F_status_is_error(data.setting.state.status)) {
+      if (F_status_set_fine(data.setting.state.status) == F_interrupt) return;
 
-      if (F_status_is_error(main->setting.state.status)) {
-        fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_basic_object_write));
+      fll_error_file_print(
+        &main->error,
+        F_status_set_fine(data.setting.state.status),
+        macro_fss_read_f(fll_fss_basic_read),
+        fll_error_file_flag_fallback_e,
+        fss_read_file_identify(input.start, main->setting.files),
+        f_file_operation_process_s,
+        fll_error_file_type_file_e
+      );
 
-        return;
-      }
+      return;
     }
 
-    if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_content_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
-      if (main->setting.flag & fss_read_main_flag_object_open_e) {
-        main->setting.state.status = f_string_dynamic_append(f_fss_basic_open_s, &main->setting.buffer);
+    if (data.setting.state.status == F_data_not_stop || data.setting.state.status == F_data_not_eos) {
+      if (!(main->setting.flag & fss_read_main_flag_total_e)) {
+        data.setting.state.status = F_status_set_warning(status);
 
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-        }
+        return;
       }
     }
+
+    data.setting.state.status = F_none;
   }
-#endif // _di_fss_read_basic_process_object_
+#endif // _di_fss_read_basic_process_load_
 
 #ifdef __cplusplus
 } // extern "C"
index 1000e1011231f42de992a60ddc6f1ec62e6c4cd7..11d551d2ba1dc19fc488acf075a6f87c64c626eb 100644 (file)
 #include <fll/level_2/print.h>
 #include <fll/level_2/program.h>
 
-// FSS Write includes.
+// FSS Read includes.
 #include <program/fss_read/main/common/define.h>
 #include <program/fss_read/main/common/enumeration.h>
 #include <program/fss_read/main/common/print.h>
+#include <program/fss_read/main/common/static.h>
 #include <program/fss_read/main/common/string.h>
 #include <program/fss_read/main/common/type.h>
 #include <program/fss_read/main/common.h>
-#include <program/fss_read/basic/common.h>
 #include <program/fss_read/main/print/error.h>
 #include <program/fss_read/main/print/message.h>
+#include <program/fss_read/main/process_normal.h>
+#include <program/fss_read/main/signal.h>
+#include <program/fss_read/main/thread.h>
+#include <program/fss_read/basic/common.h>
 #include <program/fss_read/basic/print.h>
 
 #ifdef __cplusplus
@@ -60,27 +64,12 @@ extern "C" {
 #endif
 
 /**
- * Process a single Content, printing the FSS-0000 (Basic) if valid or an error if invalid.
- *
- * @param main
- *   The program and settings data.
- *   Must be of type fss_read_main_t.
- *
- *   This alters main.setting.state.status.
- *   This uses and alters main.setting.buffer.
- * @param last
- *   If TRUE, then this is the last Content in the Content set.
- *   If FALSE, then this is not the last Content in the Content set.
- */
-#ifndef _di_fss_read_basic_process_content_
-  extern void fss_read_basic_process_content(void * const main, const bool last);
-#endif // _di_fss_read_basic_process_content_
-
-/**
  * Process help for FSS-0000 (Basic).
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -94,18 +83,30 @@ extern "C" {
 #endif // _di_fss_read_basic_process_help_
 
 /**
- * Process a single Object, printing the FSS-0000 (Basic) if valid or an error if invalid.
+ * Process the buffer, loading the FSS data.
+ *
+ * This will print an error message on error.
  *
  * @param main
  *   The program and settings data.
- *   Must be of type fss_read_main_t.
  *
- *   This alters main.setting.state.status.
- *   This uses and alters main.setting.buffer.
+ *   Must not be NULL.
+ *
+ *   This alters main.setting.state.status:
+ *     F_none on success.
+ *
+ *     F_data_not_stop (with warning bit) on no valid FSS data found and reached stopping point.
+ *     F_data_not_eos (with warning bit) on no valid FSS data found and reached end of string.
+ *
+ *     Errors (with error bit) from: fll_fss_basic_read()
+ *
+ * @see fll_fss_basic_read()
+ *
+ * @see fss_read_file_identify()
  */
-#ifndef _di_fss_read_basic_process_object_
-  extern void fss_read_basic_process_object(void * const main);
-#endif // _di_fss_read_basic_process_object_
+#ifndef _di_fss_read_basic_process_load_
+  extern f_status_t fss_read_basic_process_load(fss_read_main_t * const main);
+#endif // _di_fss_read_basic_process_load_
 
 #ifdef __cplusplus
 } // extern "C"
index f099e5f7d584e0d958603d099e62267dfc27c4c9..7f7d1821afdc62c22f9d5d755389c55f7c3d79f5 100644 (file)
@@ -16,11 +16,29 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.custom = (void *) &data;
   data.program.warning.custom = (void *) &data;
 
+  data.setting.flag |= fss_read_main_flag_quote_content_e | fss_read_main_flag_quote_object_e | fss_read_main_flag_line_single_e;
+
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_basic_standard_s;
-  data.setting.process_help = &fss_read_basic_process_help;
-  data.setting.process_last_line = &fss_read_process_last_line;
-  data.setting.process_normal = &fss_read_process_normal;
+
+  data.callback.process_help = &fss_read_basic_process_help;
+  data.callback.process_last_line = &fss_read_process_last_line;
+  data.callback.process_load_depth = &fss_read_setting_load_depth;
+  data.callback.process_normal = &fss_read_process_normal;
+
+  data.callback.process_at = &fss_read_process_normal_at;
+  data.callback.process_columns = &fss_read_process_normal_columns;
+  data.callback.process_line = &fss_read_process_normal_line;
+  data.callback.process_load = &fss_read_basic_process_load;
+  data.callback.process_name = &fss_read_process_normal_name;
+  data.callback.process_total = &fss_read_process_normal_total;
+
+  data.callback.print_at = &fss_read_print_at;
+  data.callback.print_content = &fss_read_print_content;
+  data.callback.print_content_ignore = 0;
+  data.callback.print_object = &fss_read_print_object;
+  data.callback.print_object_end = &fss_read_print_object_end;
+  data.callback.print_set_end = &fss_read_print_set_end;
 
   f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
index 6e4a750930ec2551bb9eb17830350164c0e57f84..cef2b09e6c85d5090723acb9568298e230ee4984 100644 (file)
@@ -5,54 +5,6 @@
 extern "C" {
 #endif
 
-#ifndef _di_fss_read_basic_list_process_content_
-  void fss_read_basic_list_process_content(void * const void_main, const bool last) {
-
-    if (!void_main) return;
-
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
-
-    if (main->setting.content) {
-      fl_fss_basic_list_content_write(
-        *main->setting.content,
-        (main->setting.flag & fss_read_main_flag_partial_e)
-          ? f_fss_complete_partial_e
-          : (main->setting.flag & fss_read_main_flag_trim_e)
-            ? f_fss_complete_full_trim_e
-            : f_fss_complete_full_e,
-        &main->setting.prepend,
-        &main->setting.range,
-        &main->setting.buffer,
-        &main->setting.state
-      );
-
-      if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
-        main->setting.state.status = F_status_set_error(F_support_not);
-
-        fss_read_print_error_unsupported_eol(&main->program.error);
-
-        return;
-      }
-
-      if (F_status_is_error(main->setting.state.status)) {
-        fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_basic_list_content_write));
-
-        return;
-      }
-    }
-
-    if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_object_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
-      if (main->setting.flag & fss_read_main_flag_content_end_e) {
-        main->setting.state.status = f_string_dynamic_append(f_fss_basic_list_close_s, &main->setting.buffer);
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-        }
-      }
-    }
-  }
-#endif // _di_fss_read_basic_list_process_content_
-
 #ifndef _di_fss_read_basic_list_process_help_
   void fss_read_basic_list_process_help(void * const void_main) {
 
@@ -62,59 +14,6 @@ extern "C" {
   }
 #endif // _di_fss_read_basic_list_process_help_
 
-#ifndef _di_fss_read_basic_list_process_object_
-  void fss_read_basic_list_process_object(void * const void_main) {
-
-    if (!void_main) return;
-
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
-
-    if (main->setting.object) {
-      fl_fss_basic_list_object_write(
-        *main->setting.object,
-        (main->setting.flag & fss_read_main_flag_partial_e)
-          ? (main->setting.flag & fss_read_main_flag_trim_e)
-            ? f_fss_complete_trim_e
-            : f_fss_complete_none_e
-          : (main->setting.flag & fss_read_main_flag_trim_e)
-            ? f_fss_complete_full_trim_e
-            : f_fss_complete_full_e,
-        &main->setting.range,
-        &main->setting.buffer,
-        &main->setting.state
-      );
-
-      if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
-        main->setting.state.status = F_status_set_error(F_support_not);
-
-        fss_read_print_error_unsupported_eol(&main->program.error);
-
-        return;
-      }
-
-      if (F_status_is_error(main->setting.state.status)) {
-        fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_basic_list_object_write));
-
-        return;
-      }
-    }
-
-    if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_content_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
-      if (main->setting.flag & fss_read_main_flag_object_open_e) {
-        main->setting.state.status = f_string_dynamic_append(f_fss_basic_list_open_s, &main->setting.buffer);
-
-        if (F_status_is_error_not(main->setting.state.status)) {
-          main->setting.state.status = f_string_dynamic_append(f_fss_basic_list_open_end_s, &main->setting.buffer);
-        }
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-        }
-      }
-    }
-  }
-#endif // _di_fss_read_basic_list_process_object_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index fe2d2b79d194ad63aed32bcb2d50ef3ab95be888..2c5a958d4bc46ffcf1feaa896361263342bb6f8d 100644 (file)
 #include <fll/level_2/print.h>
 #include <fll/level_2/program.h>
 
-// FSS Write includes.
+// FSS Read includes.
 #include <program/fss_read/main/common/define.h>
 #include <program/fss_read/main/common/enumeration.h>
 #include <program/fss_read/main/common/print.h>
+#include <program/fss_read/main/common/static.h>
 #include <program/fss_read/main/common/string.h>
 #include <program/fss_read/main/common/type.h>
 #include <program/fss_read/main/common.h>
-#include <program/fss_read/basic_list/common.h>
 #include <program/fss_read/main/print/error.h>
 #include <program/fss_read/main/print/message.h>
+#include <program/fss_read/main/process_normal.h>
+#include <program/fss_read/main/signal.h>
+#include <program/fss_read/main/thread.h>
+#include <program/fss_read/basic_list/common.h>
 #include <program/fss_read/basic_list/print.h>
 
 #ifdef __cplusplus
@@ -61,27 +65,12 @@ extern "C" {
 #endif
 
 /**
- * Process a single Content, printing the FSS-0002 (Basic List) if valid or an error if invalid.
- *
- * @param main
- *   The program and settings data.
- *   Must be of type fss_read_main_t.
- *
- *   This alters main.setting.state.status.
- *   This uses and alters main.setting.buffer.
- * @param last
- *   If TRUE, then this is the last Content in the Content set.
- *   If FALSE, then this is not the last Content in the Content set.
- */
-#ifndef _di_fss_read_basic_list_process_content_
-  extern void fss_read_basic_list_process_content(void * const main, const bool last);
-#endif // _di_fss_read_basic_list_process_content_
-
-/**
  * Process help for FSS-0002 (Basic List).
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -94,20 +83,6 @@ extern "C" {
   extern void fss_read_basic_list_process_help(void * const main);
 #endif // _di_fss_read_basic_list_process_help_
 
-/**
- * Process a single Object, printing the FSS-0002 (Basic List) if valid or an error if invalid.
- *
- * @param main
- *   The program and settings data.
- *   Must be of type fss_read_main_t.
- *
- *   This alters main.setting.state.status.
- *   This uses and alters main.setting.buffer.
- */
-#ifndef _di_fss_read_basic_list_process_object_
-  extern void fss_read_basic_list_process_object(void * const main);
-#endif // _di_fss_read_basic_list_process_object_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 31d0e36887ae6e6779ec2a4d45e8f5c39dc40081..f3739229752b981b651e5a36440db35e1ce27e39 100644 (file)
@@ -18,9 +18,25 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_basic_list_standard_s;
-  data.setting.process_help = &fss_read_basic_list_process_help;
-  data.setting.process_last_line = &fss_read_process_last_line;
-  data.setting.process_normal = &fss_read_process_normal;
+
+  data.callback.process_help = &fss_read_basic_list_process_help;
+  data.callback.process_last_line = &fss_read_process_last_line;
+  //data.callback.process_load_depth = &fss_read_setting_load_depth;
+  data.callback.process_normal = &fss_read_process_normal;
+
+  //data.callback.process_at = &fss_read_process_normal_at;
+  //data.callback.process_columns = &fss_read_process_normal_columns;
+  //data.callback.process_line = &fss_read_process_normal_line;
+  //data.callback.process_load = &fss_read_basic_process_load;
+  //data.callback.process_name = &fss_read_process_normal_name;
+  //data.callback.process_total = &fss_read_process_normal_total;
+
+  //data.callback.print_at = &fss_read_print_at;
+  //data.callback.print_content = &fss_read_print_content;
+  //data.callback.print_content_ignore = &fss_read_print_content_ignore;
+  //data.callback.print_object = &fss_read_print_object;
+  //data.callback.print_object_end = &fss_read_print_object_end;
+  //data.callback.print_set_end = &fss_read_print_set_end;
 
   f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
index a2e0d07dcd236b9fd24915bbb15a4412d5f45817..1c1e944a0a78bedc20fed0648ed94999662d18ed 100644 (file)
@@ -5,59 +5,6 @@
 extern "C" {
 #endif
 
-#ifndef _di_fss_read_embedded_list_process_content_
-  void fss_read_embedded_list_process_content(void * const void_main, const bool last) {
-
-    if (!void_main) return;
-
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
-
-    if (main->setting.content) {
-      fl_fss_embedded_list_content_write(
-        *main->setting.content,
-        (main->setting.flag & fss_read_main_flag_partial_e)
-          ? f_fss_complete_partial_e
-          : last
-            ? f_fss_complete_end_e
-            : f_fss_complete_next_e,
-        &main->setting.prepend,
-        main->setting.ignores,
-        &main->setting.range,
-        &main->setting.buffer,
-        &main->setting.state
-      );
-
-      if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
-        main->setting.state.status = F_status_set_error(F_support_not);
-
-        fss_read_print_error_unsupported_eol(&main->program.error);
-
-        return;
-      }
-
-      if (F_status_is_error(main->setting.state.status)) {
-        fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_embedded_list_content_write));
-
-        return;
-      }
-    }
-
-    if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_object_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
-      if (main->setting.flag & fss_read_main_flag_content_end_e) {
-        main->setting.state.status = f_string_dynamic_append(f_fss_embedded_list_close_s, &main->setting.buffer);
-
-        if (F_status_is_error_not(main->setting.state.status)) {
-          main->setting.state.status = f_string_dynamic_append(f_fss_embedded_list_close_end_s, &main->setting.buffer);
-        }
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-        }
-      }
-    }
-  }
-#endif // _di_fss_read_embedded_list_process_content_
-
 #ifndef _di_fss_read_embedded_list_process_help_
   void fss_read_embedded_list_process_help(void * const void_main) {
 
@@ -67,59 +14,6 @@ extern "C" {
   }
 #endif // _di_fss_read_embedded_list_process_help_
 
-#ifndef _di_fss_read_embedded_list_process_object_
-  void fss_read_embedded_list_process_object(void * const void_main) {
-
-    if (!void_main) return;
-
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
-
-    if (main->setting.object) {
-      fl_fss_embedded_list_object_write(
-        *main->setting.object,
-        (main->setting.flag & fss_read_main_flag_partial_e)
-          ? (main->setting.flag & fss_read_main_flag_trim_e)
-            ? f_fss_complete_trim_e
-            : f_fss_complete_none_e
-          : (main->setting.flag & fss_read_main_flag_trim_e)
-            ? f_fss_complete_full_trim_e
-            : f_fss_complete_full_e,
-        &main->setting.range,
-        &main->setting.buffer,
-        &main->setting.state
-      );
-
-      if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
-        main->setting.state.status = F_status_set_error(F_support_not);
-
-        fss_read_print_error_unsupported_eol(&main->program.error);
-
-        return;
-      }
-
-      if (F_status_is_error(main->setting.state.status)) {
-        fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_embedded_list_object_write));
-
-        return;
-      }
-    }
-
-    if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_content_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
-      if (main->setting.flag & fss_read_main_flag_object_open_e) {
-        main->setting.state.status = f_string_dynamic_append(f_fss_embedded_list_open_s, &main->setting.buffer);
-
-        if (F_status_is_error_not(main->setting.state.status)) {
-          main->setting.state.status = f_string_dynamic_append(f_fss_embedded_list_open_end_s, &main->setting.buffer);
-        }
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-        }
-      }
-    }
-  }
-#endif // _di_fss_read_embedded_list_process_object_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 58a3b0fab8ef1c591c4031a448693a985c26df3f..836c18c06ebc2285438cc171604d59244b46676d 100644 (file)
 #include <fll/level_2/print.h>
 #include <fll/level_2/program.h>
 
-// FSS Write includes.
+// FSS Read includes.
 #include <program/fss_read/main/common/define.h>
 #include <program/fss_read/main/common/enumeration.h>
 #include <program/fss_read/main/common/print.h>
+#include <program/fss_read/main/common/static.h>
 #include <program/fss_read/main/common/string.h>
 #include <program/fss_read/main/common/type.h>
 #include <program/fss_read/main/common.h>
-#include <program/fss_read/embedded_list/common.h>
 #include <program/fss_read/main/print/error.h>
 #include <program/fss_read/main/print/message.h>
+#include <program/fss_read/main/process_normal.h>
+#include <program/fss_read/main/signal.h>
+#include <program/fss_read/main/thread.h>
+#include <program/fss_read/embedded_list/common.h>
 #include <program/fss_read/embedded_list/print.h>
 
 #ifdef __cplusplus
@@ -60,27 +64,12 @@ extern "C" {
 #endif
 
 /**
- * Process a single Content, printing the FSS-0008 (Embedded List) if valid or an error if invalid.
- *
- * @param main
- *   The program and settings data.
- *   Must be of type fss_read_main_t.
- *
- *   This alters main.setting.state.status.
- *   This uses and alters main.setting.buffer.
- * @param last
- *   If TRUE, then this is the last Content in the Content set.
- *   If FALSE, then this is not the last Content in the Content set.
- */
-#ifndef _di_fss_read_embedded_list_process_content_
-  extern void fss_read_embedded_list_process_content(void * const main, const bool last);
-#endif // _di_fss_read_embedded_list_process_content_
-
-/**
  * Process help for FSS-0008 (Embedded List).
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -93,20 +82,6 @@ extern "C" {
   extern void fss_read_embedded_list_process_help(void * const main);
 #endif // _di_fss_read_embedded_list_process_help_
 
-/**
- * Process a single Object, printing the FSS-0008 (Embedded List) if valid or an error if invalid.
- *
- * @param main
- *   The program and settings data.
- *   Must be of type fss_read_main_t.
- *
- *   This alters main.setting.state.status.
- *   This uses and alters main.setting.buffer.
- */
-#ifndef _di_fss_read_embedded_list_process_object_
-  extern void fss_read_embedded_list_process_object(void * const main);
-#endif // _di_fss_read_embedded_list_process_object_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index ea8c84de20d21940e1533fc25ba227185332013e..7eb92514e9ac986283896c2e7329f0791a356fbf 100644 (file)
@@ -18,13 +18,30 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_embedded_list_standard_s;
-  data.setting.process_help = &fss_read_embedded_list_process_help;
-  data.setting.process_last_line = &fss_read_process_last_line;
-  data.setting.process_normal = &fss_read_process_normal;
+
   data.setting.flag |= fss_read_main_flag_ignore_e;
   data.setting.flag |= fss_read_main_flag_content_multiple_e;
   data.setting.flag |= fss_read_main_flag_depth_support_e | fss_read_main_flag_select_support_e;
 
+  data.callback.process_help = &fss_read_embedded_list_process_help;
+  data.callback.process_last_line = &fss_read_process_last_line;
+  //data.callback.process_load_depth = &fss_read_setting_load_depth;
+  data.callback.process_normal = &fss_read_process_normal;
+
+  //data.callback.process_at = &fss_read_process_normal_at;
+  //data.callback.process_columns = &fss_read_process_normal_columns;
+  //data.callback.process_line = &fss_read_process_normal_line;
+  //data.callback.process_load = &fss_read_basic_process_load;
+  //data.callback.process_name = &fss_read_process_normal_name;
+  //data.callback.process_total = &fss_read_process_normal_total;
+
+  //data.callback.print_at = &fss_read_print_at;
+  //data.callback.print_content = &fss_read_print_content;
+  //data.callback.print_content_ignore = &fss_read_print_content_ignore;
+  //data.callback.print_object = &fss_read_print_object;
+  //data.callback.print_object_end = &fss_read_print_object_end;
+  //data.callback.print_set_end = &fss_read_print_set_end;
+
   f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
   data.program.parameters.array[fss_read_parameter_as_e].flag |= f_console_flag_disable_e;
index 580efe8a8acbf2628d8c70caa66a0c07e41e46d2..899e67f34cf02f0d35bf06a3f093a00ba04dae71 100644 (file)
@@ -5,63 +5,6 @@
 extern "C" {
 #endif
 
-#ifndef _di_fss_read_extended_process_content_
-  void fss_read_extended_process_content(void * const void_main, const bool last) {
-
-    if (!void_main) return;
-
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
-
-    if (main->setting.content) {
-      fl_fss_extended_content_write(
-        *main->setting.content,
-        main->setting.quote.used
-          ? main->setting.quote.string[0]
-          : f_fss_quote_double_s.string[0],
-        (main->setting.flag & fss_read_main_flag_partial_e)
-          ? f_fss_complete_partial_e
-          : last
-            ? f_fss_complete_end_e
-            : f_fss_complete_next_e,
-        &main->setting.range,
-        &main->setting.buffer,
-        &main->setting.state
-      );
-
-      if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
-        main->setting.state.status = F_status_set_error(F_support_not);
-
-        fss_read_print_error_unsupported_eol(&main->program.error);
-
-        return;
-      }
-
-      if (F_status_is_error(main->setting.state.status)) {
-        fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_extended_content_write));
-
-        return;
-      }
-    }
-
-    if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_object_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
-      if (main->setting.flag & fss_read_main_flag_content_end_e) {
-        main->setting.state.status = f_string_dynamic_append(f_fss_extended_close_s, &main->setting.buffer);
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-        }
-      }
-      else if (main->setting.flag & fss_read_main_flag_content_next_e) {
-        main->setting.state.status = f_string_dynamic_append(f_fss_extended_next_s, &main->setting.buffer);
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-        }
-      }
-    }
-  }
-#endif // _di_fss_read_extended_process_content_
-
 #ifndef _di_fss_read_extended_process_help_
   void fss_read_extended_process_help(void * const void_main) {
 
@@ -71,57 +14,6 @@ extern "C" {
   }
 #endif // _di_fss_read_extended_process_help_
 
-#ifndef _di_fss_read_extended_process_object_
-  void fss_read_extended_process_object(void * const void_main) {
-
-    if (!void_main) return;
-
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
-
-    if (main->setting.object) {
-      fl_fss_extended_object_write(
-        *main->setting.object,
-        main->setting.quote.used
-          ? main->setting.quote.string[0]
-          : f_fss_quote_double_s.string[0],
-        (main->setting.flag & fss_read_main_flag_partial_e)
-          ? (main->setting.flag & fss_read_main_flag_trim_e)
-            ? f_fss_complete_trim_e
-            : f_fss_complete_none_e
-          : (main->setting.flag & fss_read_main_flag_trim_e)
-            ? f_fss_complete_full_trim_e
-            : f_fss_complete_full_e,
-        &main->setting.range,
-        &main->setting.buffer,
-        &main->setting.state
-      );
-
-      if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
-        main->setting.state.status = F_status_set_error(F_support_not);
-
-        fss_read_print_error_unsupported_eol(&main->program.error);
-
-        return;
-      }
-
-      if (F_status_is_error(main->setting.state.status)) {
-        fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_extended_object_write));
-
-        return;
-      }
-    }
-
-    if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_content_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
-      if (main->setting.flag & fss_read_main_flag_object_open_e) {
-        main->setting.state.status = f_string_dynamic_append(f_fss_extended_open_s, &main->setting.buffer);
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-        }
-      }
-    }
-  }
-#endif // _di_fss_read_extended_process_object_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index e361c6cef94f003fc2d0ffda134ce16dc7362b0b..9d6c8bd151bb0a824631f7ebc6d0bd178fb86feb 100644 (file)
 #include <fll/level_2/print.h>
 #include <fll/level_2/program.h>
 
-// FSS Write includes.
+// FSS Read includes.
 #include <program/fss_read/main/common/define.h>
 #include <program/fss_read/main/common/enumeration.h>
 #include <program/fss_read/main/common/print.h>
+#include <program/fss_read/main/common/static.h>
 #include <program/fss_read/main/common/string.h>
 #include <program/fss_read/main/common/type.h>
 #include <program/fss_read/main/common.h>
-#include <program/fss_read/extended/common.h>
 #include <program/fss_read/main/print/error.h>
 #include <program/fss_read/main/print/message.h>
+#include <program/fss_read/main/process_normal.h>
+#include <program/fss_read/main/signal.h>
+#include <program/fss_read/main/thread.h>
+#include <program/fss_read/extended/common.h>
 #include <program/fss_read/extended/print.h>
 
 #ifdef __cplusplus
@@ -64,6 +68,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status.
@@ -81,6 +87,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This does not alter main.setting.state.status.
index c75a0ba7d093077c904e9619a8f255b24465b754..28eda37487768d91e970f8568c59d536fe0eecc8 100644 (file)
@@ -18,10 +18,28 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_extended_standard_s;
-  data.setting.process_help = &fss_read_extended_process_help;
-  data.setting.process_last_line = &fss_read_process_last_line;
-  data.setting.process_normal = &fss_read_process_normal;
+
   data.setting.flag |= fss_read_main_flag_content_multiple_e;
+  data.setting.flag |= fss_read_main_flag_quote_content_e | fss_read_main_flag_quote_object_e;
+
+  data.callback.process_help = &fss_read_extended_process_help;
+  data.callback.process_last_line = &fss_read_process_last_line;
+  //data.callback.process_load_depth = &fss_read_setting_load_depth;
+  data.callback.process_normal = &fss_read_process_normal;
+
+  //data.callback.process_at = &fss_read_process_normal_at;
+  //data.callback.process_columns = &fss_read_process_normal_columns;
+  //data.callback.process_line = &fss_read_process_normal_line;
+  //data.callback.process_load = &fss_read_basic_process_load;
+  //data.callback.process_name = &fss_read_process_normal_name;
+  //data.callback.process_total = &fss_read_process_normal_total;
+
+  //data.callback.print_at = &fss_read_print_at;
+  //data.callback.print_content = &fss_read_print_content;
+  //data.callback.print_content_ignore = &fss_read_print_content_ignore;
+  //data.callback.print_object = &fss_read_print_object;
+  //data.callback.print_object_end = &fss_read_print_object_end;
+  //data.callback.print_set_end = &fss_read_print_set_end;
 
   f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
index e3f18e7ff45a18dd896da5a67e534daf3e19ee22..1f786c618ed48e646676a16010132608cbd55697 100644 (file)
@@ -5,59 +5,6 @@
 extern "C" {
 #endif
 
-#ifndef _di_fss_read_extended_list_process_content_
-  void fss_read_extended_list_process_content(void * const void_main, const bool last) {
-
-    if (!void_main) return;
-
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
-
-    if (main->setting.content) {
-      fl_fss_extended_list_content_write(
-        *main->setting.content,
-        (main->setting.flag & fss_read_main_flag_partial_e)
-          ? last
-            ? f_fss_complete_none_e
-            : f_fss_complete_partial_e
-          : f_fss_complete_full_e,
-        &main->setting.prepend,
-        main->setting.ignores,
-        &main->setting.range,
-        &main->setting.buffer,
-        &main->setting.state
-      );
-
-      if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
-        main->setting.state.status = F_status_set_error(F_support_not);
-
-        fss_read_print_error_unsupported_eol(&main->program.error);
-
-        return;
-      }
-
-      if (F_status_is_error(main->setting.state.status)) {
-        fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_extended_list_content_write));
-
-        return;
-      }
-    }
-
-    if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_object_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
-      if (main->setting.flag & fss_read_main_flag_content_end_e) {
-        main->setting.state.status = f_string_dynamic_append(f_fss_extended_list_close_s, &main->setting.buffer);
-
-        if (F_status_is_error_not(main->setting.state.status)) {
-          main->setting.state.status = f_string_dynamic_append(f_fss_extended_list_close_end_s, &main->setting.buffer);
-        }
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-        }
-      }
-    }
-  }
-#endif // _di_fss_read_extended_list_process_content_
-
 #ifndef _di_fss_read_extended_list_process_help_
   void fss_read_extended_list_process_help(void * const void_main) {
 
@@ -67,59 +14,6 @@ extern "C" {
   }
 #endif // _di_fss_read_extended_list_process_help_
 
-#ifndef _di_fss_read_extended_list_process_object_
-  void fss_read_extended_list_process_object(void * const void_main) {
-
-    if (!void_main) return;
-
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
-
-    if (main->setting.object) {
-      fl_fss_extended_list_object_write(
-        *main->setting.object,
-        (main->setting.flag & fss_read_main_flag_partial_e)
-          ? (main->setting.flag & fss_read_main_flag_trim_e)
-            ? f_fss_complete_trim_e
-            : f_fss_complete_none_e
-          : (main->setting.flag & fss_read_main_flag_trim_e)
-            ? f_fss_complete_full_trim_e
-            : f_fss_complete_full_e,
-        &main->setting.range,
-        &main->setting.buffer,
-        &main->setting.state
-      );
-
-      if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
-        main->setting.state.status = F_status_set_error(F_support_not);
-
-        fss_read_print_error_unsupported_eol(&main->program.error);
-
-        return;
-      }
-
-      if (F_status_is_error(main->setting.state.status)) {
-        fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_extended_list_object_write));
-
-        return;
-      }
-    }
-
-    if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_content_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
-      if (main->setting.flag & fss_read_main_flag_object_open_e) {
-        main->setting.state.status = f_string_dynamic_append(f_fss_extended_list_open_s, &main->setting.buffer);
-
-        if (F_status_is_error_not(main->setting.state.status)) {
-          main->setting.state.status = f_string_dynamic_append(f_fss_extended_list_open_end_s, &main->setting.buffer);
-        }
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-        }
-      }
-    }
-  }
-#endif // _di_fss_read_extended_list_process_object_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index eb228415244dac9cdf7ebb4a1f9d926da5b65721..d05a015e3d58a3b649e6df40cb5f812fbb7a4726 100644 (file)
 #include <fll/level_2/print.h>
 #include <fll/level_2/program.h>
 
-// FSS Write includes.
+// FSS Read includes.
 #include <program/fss_read/main/common/define.h>
 #include <program/fss_read/main/common/enumeration.h>
 #include <program/fss_read/main/common/print.h>
+#include <program/fss_read/main/common/static.h>
 #include <program/fss_read/main/common/string.h>
 #include <program/fss_read/main/common/type.h>
 #include <program/fss_read/main/common.h>
-#include <program/fss_read/extended_list/common.h>
 #include <program/fss_read/main/print/error.h>
 #include <program/fss_read/main/print/message.h>
+#include <program/fss_read/main/process_normal.h>
+#include <program/fss_read/main/signal.h>
+#include <program/fss_read/main/thread.h>
+#include <program/fss_read/extended_list/common.h>
 #include <program/fss_read/extended_list/print.h>
 
 #ifdef __cplusplus
@@ -60,27 +64,12 @@ extern "C" {
 #endif
 
 /**
- * Process a single Content, printing the FSS-0003 (Extended List) if valid or an error if invalid.
- *
- * @param main
- *   The program and settings data.
- *   Must be of type fss_read_main_t.
- *
- *   This alters main.setting.state.status.
- *   This uses and alters main.setting.buffer.
- * @param last
- *   If TRUE, then this is the last Content in the Content set.
- *   If FALSE, then this is not the last Content in the Content set.
- */
-#ifndef _di_fss_read_extended_list_process_content_
-  extern void fss_read_extended_list_process_content(void * const main, const bool last);
-#endif // _di_fss_read_extended_list_process_content_
-
-/**
  * Process help for FSS-0003 (Extended List).
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -93,20 +82,6 @@ extern "C" {
   extern void fss_read_extended_list_process_help(void * const main);
 #endif // _di_fss_read_extended_list_process_help_
 
-/**
- * Process a single Object, printing the FSS-0003 (Extended List) if valid or an error if invalid.
- *
- * @param main
- *   The program and settings data.
- *   Must be of type fss_read_main_t.
- *
- *   This alters main.setting.state.status.
- *   This uses and alters main.setting.buffer.
- */
-#ifndef _di_fss_read_extended_list_process_object_
-  extern void fss_read_extended_list_process_object(void * const main);
-#endif // _di_fss_read_extended_list_process_object_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index b242a69370e61eee96169e51de2a74d26b021097..c630257f3bd9a886381e2b1edb96e339f0df7091 100644 (file)
@@ -18,11 +18,28 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_extended_list_standard_s;
-  data.setting.process_help = &fss_read_extended_list_process_help;
-  data.setting.process_last_line = &fss_read_process_last_line;
-  data.setting.process_normal = &fss_read_process_normal;
+
   data.setting.flag |= fss_read_main_flag_ignore_e;
 
+  data.callback.process_help = &fss_read_extended_list_process_help;
+  data.callback.process_last_line = &fss_read_process_last_line;
+  //data.callback.process_load_depth = &fss_read_setting_load_depth;
+  data.callback.process_normal = &fss_read_process_normal;
+
+  //data.callback.process_at = &fss_read_process_normal_at;
+  //data.callback.process_columns = &fss_read_process_normal_columns;
+  //data.callback.process_line = &fss_read_process_normal_line;
+  //data.callback.process_load = &fss_read_basic_process_load;
+  //data.callback.process_name = &fss_read_process_normal_name;
+  //data.callback.process_total = &fss_read_process_normal_total;
+
+  //data.callback.print_at = &fss_read_print_at;
+  //data.callback.print_content = &fss_read_print_content;
+  //data.callback.print_content_ignore = &fss_read_print_content_ignore;
+  //data.callback.print_object = &fss_read_print_object;
+  //data.callback.print_object_end = &fss_read_print_object_end;
+  //data.callback.print_set_end = &fss_read_print_set_end;
+
   f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
   data.program.parameters.array[fss_read_parameter_as_e].flag |= f_console_flag_disable_e;
index d7c81cb1c0779d671b7388d734a55f039efa5b54..f08f2511fbbf0d825a36b2515c73dfb88d1d220d 100644 (file)
@@ -499,8 +499,8 @@ extern "C" {
       if (main->setting.buffer.used) {
         main->setting.files.array[0].range.stop = main->setting.buffer.used - 1;
 
-        if (main->setting.process_last_line) {
-          main->setting.process_last_line((void *) &main);
+        if (main->callback.process_last_line) {
+          main->callback.process_last_line((void *) &main);
           if (F_status_is_error(main->setting.state.status)) return;
         }
       }
@@ -603,8 +603,8 @@ extern "C" {
           if (main->setting.buffer.used > main->setting.files.array[main->setting.files.used].range.start) {
             main->setting.files.array[main->setting.files.used++].range.stop = main->setting.buffer.used - 1;
 
-            if (main->setting.process_last_line) {
-              main->setting.process_last_line((void *) &main);
+            if (main->callback.process_last_line) {
+              main->callback.process_last_line((void *) &main);
               if (F_status_is_error(main->setting.state.status)) break;
             }
           }
@@ -780,8 +780,8 @@ extern "C" {
       } // for
     } // for
 
-    if (main->setting.process_load_depth) {
-      main->setting.process_load_depth(arguments, (void *) main);
+    if (main->callback.process_load_depth) {
+      main->callback.process_load_depth(arguments, (void *) main);
       if (F_status_is_error(main->setting.state.status)) return;
     }
 
index 1e90cafe31e371f6f1b038711937fd36f3b44d70..c2d64427f1af62f85abefcaa3022fc6d61e2151e 100644 (file)
@@ -28,7 +28,7 @@ extern "C" {
  * @param main
  *   The main program data.
  *
- *   This calls main.setting.process_last_line() if not NULL.
+ *   This calls main.callback.process_last_line() if not NULL.
  *
  *   This alters main.setting.range.
  *
@@ -79,7 +79,7 @@ extern "C" {
  * @param main
  *   The main program data.
  *
- *   This calls main.setting.process_load_depth() if not NULL.
+ *   This calls main.callback.process_load_depth() if not NULL.
  *
  *   This alters main.setting.state.status:
  *     F_none on success.
index 0a88f7fc040910b974a4a7d8f097e21956703f7b..365210c5547f55d511c00d85000c4c2e43e99c97 100644 (file)
@@ -39,6 +39,8 @@ extern "C" {
  *   - pipe:             Print using the special pipe format.
  *   - print_first:      When set, print new line to message output on program begin after loading settings.
  *   - print_last:       When set, print new line to message output on program end.
+ *   - quote_content:    Designate that the standard supports quotes on Content.
+ *   - quote_object:     Designate that the standard supports quotes on Objects.
  *   - select:           A specific Content at a given position is to be selected (Think of this as select a column for some Content).
  *   - total:            The total lines found and selected is printed instead of the Content.
  *   - trim:             Empty space before and after Objects and Content will not be printed (They will be trimmed).
@@ -65,10 +67,12 @@ extern "C" {
     fss_read_main_flag_pipe_e             = 0x8000,
     fss_read_main_flag_print_first_e      = 0x10000,
     fss_read_main_flag_print_last_e       = 0x20000,
-    fss_read_main_flag_select_e           = 0x40000,
-    fss_read_main_flag_total_e            = 0x80000,
-    fss_read_main_flag_trim_e             = 0x100000,
-    fss_read_main_flag_version_e          = 0x200000,
+    fss_read_main_flag_quote_content_e    = 0x40000,
+    fss_read_main_flag_quote_object_e     = 0x80000,
+    fss_read_main_flag_select_e           = 0x100000,
+    fss_read_main_flag_total_e            = 0x200000,
+    fss_read_main_flag_trim_e             = 0x400000,
+    fss_read_main_flag_version_e          = 0x800000,
   }; // enum
 #endif // _di_fss_read_main_flag_e_
 
index 4551b8adbf5157455779e0a22cb1ee41b231e5da..1edbe00aaa45fb4b1b7c00e185481c8ad8198c63 100644 (file)
@@ -42,9 +42,10 @@ extern "C" {
     "fl_fss_extended_list_object_read",
     "fl_fss_extended_object_read",
     "fl_fss_payload_content_read",
+    "fll_fss_basic_read",
+    "fll_fss_payload_read",
     "fll_program_parameter_process_context",
     "fll_program_parameter_process_verbosity",
-    "fll_fss_payload_read",
     "fss_read_depths_resize",
     "fss_read_setting_load_depth",
   };
index a8b9573a60a1a5f26c14b9b7d4470f15cbf1b1e4..074aae04090023e3889ba5d3fe9fe0c2f84c9472 100644 (file)
@@ -75,9 +75,10 @@ extern "C" {
     fss_read_f_fl_fss_extended_list_object_read_e,
     fss_read_f_fl_fss_extended_object_read_e,
     fss_read_f_fl_fss_payload_content_read_e,
+    fss_read_f_fll_fss_basic_read_e,
+    fss_read_f_fll_fss_payload_read_e,
     fss_read_f_fll_program_parameter_process_context_e,
     fss_read_f_fll_program_parameter_process_verbosity_e,
-    fss_read_f_fll_fss_payload_read_e,
     fss_read_f_fss_read_depths_resize_e,
     fss_read_f_fss_read_setting_load_depth_e,
   }; // enum
diff --git a/level_3/fss_read/c/main/common/static.c b/level_3/fss_read/c/main/common/static.c
new file mode 100644 (file)
index 0000000..e33f99c
--- /dev/null
@@ -0,0 +1,13 @@
+#include "../fss_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_read_except_none_c_
+  const f_array_lengths_t fss_read_except_none_c = macro_f_array_lengths_t_initialize_1(0, 0, 0);
+#endif // _di_fss_read_except_none_c_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_read/c/main/common/static.h b/level_3/fss_read/c/main/common/static.h
new file mode 100644 (file)
index 0000000..f496fe4
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Read
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common static structures.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _fss_read_common_static_h
+#define _fss_read_common_static_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Provide a static empty array lengths.
+ *
+ * This is intended to represent an empty array lengths structure.
+ */
+#ifndef _di_fss_read_except_none_c_
+  extern const f_array_lengths_t fss_read_except_none_c;
+#endif // _di_fss_read_except_none_c_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_read_common_static_h
index b414df2fb55f2a3b94a826f4716df3c3a359905e..a2397276894263b9fc63a970c1b92b194937bc4a 100644 (file)
@@ -13,6 +13,52 @@ extern "C" {
   }
 #endif // _di_fss_read_depth_delete_
 
+#ifndef _di_fss_read_depths_resize_
+  f_status_t fss_read_depths_resize(const f_array_length_t length, fss_read_depths_t * const depths) {
+
+    if (!depths) return F_status_set_error(F_parameter);
+    if (depths->used + length > F_array_length_t_size_d) return F_status_set_error(F_array_too_large);
+
+    f_status_t status = F_none;
+
+    for (f_array_length_t i = length; i < depths->size; ++i) {
+
+      status = private_f_string_ranges_adjust(0, &depths->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    status = f_memory_adjust(depths->size, length, sizeof(fss_read_file_t), (void **) & depths->array);
+    if (F_status_is_error(status)) return status;
+
+    depths->size = length;
+
+    if (depths->used > depths->size) {
+      depths->used = length;
+    }
+
+    return F_none;
+  }
+#endif // _di_fss_read_depths_resize_
+
+#ifndef _di_fss_read_files_resize_
+  f_status_t fss_read_files_resize(const f_array_length_t length, fss_read_files_t * const files) {
+
+    if (!files) return F_status_set_error(F_parameter);
+    if (files->used + length > F_array_length_t_size_d) return F_status_set_error(F_array_too_large);
+
+    const f_status_t status = f_memory_adjust(files->size, length, sizeof(fss_read_file_t), (void **) & files->array);
+    if (F_status_is_error(status)) return status;
+
+    files->size = length;
+
+    if (files->used > files->size) {
+      files->used = length;
+    }
+
+    return F_none;
+  }
+#endif // _di_fss_read_files_resize_
+
 #ifndef _di_fss_read_main_data_delete_
   void fss_read_main_delete(fss_read_main_t * const main) {
 
@@ -33,9 +79,18 @@ extern "C" {
     f_string_dynamic_resize(0, &setting->buffer);
     f_string_dynamic_resize(0, &setting->prepend);
 
-    f_string_rangess_resize(0, &setting->ignoress);
-    f_string_dynamics_resize(0, &setting->objects);
-    f_string_dynamicss_resize(0, &setting->contentss);
+    fss_read_files_resize(0, &setting->files);
+    fss_read_depths_resize(0, &setting->depths);
+
+    f_string_ranges_resize(0, &setting->objects);
+    f_string_ranges_resize(0, &setting->comments);
+    f_string_rangess_resize(0, &setting->contents);
+
+    f_array_lengths_resize(0, &setting->delimits_object);
+    f_array_lengths_resize(0, &setting->delimits_content);
+
+    f_uint8s_resize(0, &setting->quotes_object);
+    f_uint8ss_resize(0, &setting->quotes_content);
 
     return F_none;
   }
index 72637b406bd6bc89a88417fe4a4e65b5b9920410..b14f227005b36a2acd55a8925dfbe0ffb6106775 100644 (file)
@@ -117,6 +117,71 @@ extern "C" {
 #endif // _di_fss_read_files_t_
 
 /**
+ * The FSS read callbacks.
+ *
+ * process_help:       Process help (generally printing help).
+ * process_last_line:  Process printing last line if necessary when loading in a file (or pipe).
+ * process_load_depth: Process loading of the depth related parameters when loading the settings.
+ * process_normal:     Process normally (data from parameters and files).
+ *
+ * process_at:       Process at parameter, usually called by the process_normal() callback.
+ * process_columns:  Process columns parameter, usually called by the process_normal() callback.
+ * process_line:     Process line parameter, usually called by the process_normal() callback.
+ * process_load:     Process loading of FSS data from buffer (not to be confused with loading settings), usually called by the process_normal() callback.
+ * process_name:     Process name parameter, usually called by the process_normal() callback.
+ * process_total:    Process total parameter, usually called by the process_normal() callback.
+ *
+ * print_at:             Print at the given location, usually called by the process_normal() callback.
+ * print_object:         Print the Object, usually called by the process_normal() callback.
+ * print_content:        Print the Object, usually called by the process_normal() callback.
+ * print_content_ignore: Print the Content ignore character, usually called by several callbacks within the process_normal() callback for a pipe.
+ * print_object_end:     Print the Object end, usually called by several callbacks within the process_normal() callback.
+ * print_set_end:        Print the set end, usually called by several callbacks within the process_normal() callback.
+ */
+#ifndef _di_fss_read_callback_t_
+  typedef struct {
+    void (*process_help)(void * const main);
+    void (*process_last_line)(void * const main);
+    void (*process_load_depth)(const f_console_arguments_t arguments, void * const main);
+    void (*process_normal)(void * const main);
+
+    void (*process_at)(void * const main, const bool names[], const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
+    void (*process_columns)(void * const main, const bool names[]);
+    void (*process_line)(void * const main, const bool names[]);
+    void (*process_load)(void * const main);
+    void (*process_name)(void * const main, bool names[]);
+    void (*process_total)(void * const main, const bool names[]);
+
+    void (*print_at)(void * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
+    void (*print_object)(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits);
+    void (*print_content)(fl_print_t * const print, const f_array_length_t at, const uint8_t quote, const f_fss_delimits_t delimits);
+    void (*print_content_ignore)(fl_print_t * const print);
+    void (*print_object_end)(fl_print_t * const print);
+    void (*print_set_end)(fl_print_t * const print);
+  } fss_read_callback_t;
+
+  #define fss_read_callback_t_initialize \
+    { \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+    }
+#endif // _di_fss_read_callback_t_
+
+/**
  * The fss read main program settings.
  *
  * This is passed to the program-specific main entry point to designate program settings.
@@ -147,19 +212,6 @@ extern "C" {
  * delimits_object:  The positions within the buffer representing Object character delimits.
  * delimits_content: The positions within the buffer representing Content character delimits.
  * comments:         The positions within the buffer representing comments.
- *
- * process_help:       Process help (generally printing help).
- * process_last_line:  Process printing last line if necessary when loading in a file (or pipe).
- * process_load_depth: Process loading of the depth related parameters when loading the settings.
- * process_normal:     Process normally (data from parameters and files).
- *
- * process_at:       Process at parameter, usually called by process_normal() callback.
- * process_columns:  Process columns parameter, usually called by process_normal() callback.
- * process_line:     Process line parameter, usually called by process_normal() callback.
- * process_load:     Process loading of FSS data from buffer (not to be confused with loading settings), usually called by process_normal() callback.
- * process_name:     Process name parameter, usually called by process_normal() callback.
- * process_print_at: Process printing a given line, usually called by process_normal() callback.
- * process_total:    Process total parameter, usually called by process_normal() callback.
  */
 #ifndef _di_fss_read_setting_t_
   typedef struct {
@@ -186,19 +238,8 @@ extern "C" {
     f_fss_delimits_t delimits_object;
     f_fss_delimits_t delimits_content;
     f_fss_comments_t comments;
-
-    void (*process_help)(void * const main);
-    void (*process_last_line)(void * const main);
-    void (*process_load_depth)(const f_console_arguments_t arguments, void * const main);
-    void (*process_normal)(void * const main);
-
-    void (*process_at)(void * const main, const bool names[], const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
-    void (*process_columns)(void * const main, const bool names[]);
-    void (*process_line)(void * const main, const bool names[]);
-    void (*process_load)(void * const main);
-    void (*process_name)(void * const main, bool names[]);
-    void (*process_print_at)(void * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
-    void (*process_total)(void * const main, const bool names[]);
+    f_uint8s_t quotes_object;
+    f_uint8ss_t quotes_content;
   } fss_read_setting_t;
 
   #define fss_read_setting_t_initialize \
@@ -220,34 +261,28 @@ extern "C" {
       f_fss_delimits_t_initialize, \
       f_fss_delimits_t_initialize, \
       f_fss_comments_t_initialize, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
+      f_uint8s_t_initialize, \
+      f_uint8ss_t_initialize, \
     }
 #endif // _di_fss_read_setting_t_
 
 /**
  * The main program data as a single structure.
  *
- * program: The main program data.
- * setting: The settings data.
+ * callback: The callback data.
+ * program:  The main program data.
+ * setting:  The settings data.
  */
 #ifndef _di_fss_read_main_t_
   typedef struct {
+    fss_read_callback_t callback;
     fll_program_data_t program;
     fss_read_setting_t setting;
   } fss_read_main_t;
 
   #define fss_read_main_t_initialize \
     { \
+      fss_read_callback_t_initialize, \
       fll_program_data_t_initialize, \
       fss_read_setting_t_initialize, \
     }
@@ -258,18 +293,66 @@ extern "C" {
  *
  * @param depth
  *   The depth to deallocate.
+ *   Must not be NULL.
  */
 #ifndef _di_fss_read_depth_delete_
-  extern void fss_read_depth_delete(fss_read_depth_t * const depth);
+  extern f_status_t fss_read_depth_delete(fss_read_depth_t * const depth);
 #endif // _di_fss_read_depth_delete_
 
 /**
+ * Resize the program setting depths data.
+ *
+ * @param length
+ *   The new size to use.
+ * @param depths
+ *   The depths to resize.
+ *   Must not be NULL.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ */
+#ifndef _di_fss_read_depths_resize_
+  extern f_status_t fss_read_depths_resize(const f_array_length_t length, fss_read_depths_t * const depths);
+#endif // _di_fss_read_depths_resize_
+
+/**
+ * Resize the program setting files data.
+ *
+ * @param length
+ *   The new size to use.
+ * @param files
+ *   The files to resize.
+ *   Must not be NULL.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ */
+#ifndef _di_fss_read_files_resize_
+  extern f_status_t fss_read_files_resize(const f_array_length_t length, fss_read_files_t * const files);
+#endif // _di_fss_read_files_resize_
+
+/**
  * Deallocate main program data.
  *
- * @param setting_make
- *   The make setting data.
+ * @param main
+ *   The program and settings data.
  *
- *   This does not alter data_make.main.setting.state.status.
+ *   Must not be NULL.
+ *   Must be of type fss_read_main_t.
+ *
+ *   This does not alter main.setting.state.status.
  */
 #ifndef _di_fss_read_main_data_delete_
   extern void fss_read_main_delete(fss_read_main_t * const main);
@@ -281,6 +364,8 @@ extern "C" {
  * @param setting
  *   The program main setting data.
  *
+ *   Must not be NULL.
+ *
  *   This does not alter setting.state.status.
  *
  * @return
index 9094b0227c124ccae92d65016c63ccb1021a82cb..f5e0f51526346f45eced8033a5b9fda7d140bae6 100644 (file)
@@ -4,6 +4,58 @@
 extern "C" {
 #endif
 
+#ifndef _di_fss_read_delimit_content_is_
+  f_status_t fss_read_delimit_content_is(fss_read_main_t * const main, const f_array_length_t depth) {
+
+    if (!main) return F_false;
+
+    if (main->setting.delimit_mode == fss_read_delimit_mode_none_e) {
+      return F_false;
+    }
+
+    if (main->setting.delimit_mode == fss_read_delimit_mode_all_e) {
+      return F_true;
+    }
+
+    if (depth < main->setting.delimit_depth) {
+      return main->setting.delimit_mode == fss_read_delimit_mode_content_lesser_e;
+    }
+
+    if (depth == main->setting.delimit_depth) {
+      return F_true;
+    }
+
+    return main->setting.delimit_mode == fss_read_delimit_mode_content_greater_e;
+  }
+#endif // _di_fss_read_delimit_content_is_
+
+#ifndef _di_fss_read_delimit_object_is_
+  f_status_t fss_read_delimit_object_is(fss_read_main_t * const main, const f_array_length_t depth) {
+
+    if (!main) return F_false;
+
+    switch (main->setting.delimit_mode) {
+      case fss_read_delimit_mode_none_e:
+      case fss_read_delimit_mode_content_e:
+      case fss_read_delimit_mode_content_greater_e:
+      case fss_read_delimit_mode_content_lesser_e:
+        return F_false;
+
+      case fss_read_delimit_mode_all_e:
+      case fss_read_delimit_mode_content_object_e:
+      case fss_read_delimit_mode_content_greater_object_e:
+      case fss_read_delimit_mode_content_lesser_object_e:
+      case fss_read_delimit_mode_object_e:
+        return F_true;
+
+      default:
+        break;
+    }
+
+    return depth == main->setting.delimit_depth || main->setting.delimit_mode == fss_read_delimit_mode_content_lesser_e;
+  }
+#endif // _di_fss_read_delimit_object_is_
+
 #ifndef _di_fss_read_main_
   void fss_read_main(void * const void_main) {
 
@@ -27,8 +79,8 @@ extern "C" {
 
     if (main->setting.flag & (fss_read_main_flag_help_e | fss_read_main_flag_version_e | fss_read_main_flag_copyright_e)) {
       if (main->setting.flag & fss_read_main_flag_help_e) {
-        if (main->setting.process_help) {
-          main->setting.process_help(void_main);
+        if (main->callback.process_help) {
+          main->callback.process_help(void_main);
         }
         else {
           fss_read_print_message_help(&main->program.message);
@@ -48,18 +100,16 @@ extern "C" {
       return;
     }
 
-    main->setting.escaped.used = 0;
-
     if (main->program.pipe & fll_program_data_pipe_input_e) {
-      if (main->setting.process_pipe) {
-        main->setting.process_pipe(void_main);
+      if (main->callback.process_pipe) {
+        main->callback.process_pipe(void_main);
       }
     }
 
     if (F_status_is_error_not(main->setting.state.status)) {
       if (main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e | fss_read_main_flag_object_open_e | fss_read_main_flag_content_next_e | fss_read_main_flag_content_end_e)) {
-        if (main->setting.process_normal) {
-          main->setting.process_normal(void_main);
+        if (main->callback.process_normal) {
+          main->callback.process_normal(void_main);
         }
       }
     }
@@ -71,22 +121,27 @@ extern "C" {
 #endif // _di_fss_read_main_
 
 #ifndef _di_fss_read_process_at_line_
-  f_status_t fss_read_process_at_line(fss_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, f_array_length_t * const line) {
+  void fss_read_process_at_line(fss_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, f_array_length_t * const line) {
 
     if (!main || !line) return;
 
     if (main->setting.flag & fss_read_main_flag_object_e) {
       if (*line == main->setting.line) {
-        f_file_stream_lock(main->program.output.to);
 
         if (main->setting.flag & fss_read_main_flag_total_e) {
           fss_read_print_number(&main->program.output, 1);
         }
         else {
-          fss_read_print_object_at(&main->program.output, at, delimits_object);
-        }
+          if (main->callback.print_object) {
+            main->callback.print_object(&main->program.output, at, delimits_object);
+          }
 
-        f_file_stream_unlock(main->program.output.to);
+          if (main->setting.flag & fss_read_main_flag_content_e) {
+            if (main->callback.print_object_end) {
+              main->callback.print_object_end(&main->program.output);
+            }
+          }
+        }
 
         main->setting.state.status = F_success;
 
@@ -121,17 +176,13 @@ extern "C" {
           if (*line == main->setting.line) {
             range.stop = i;
 
-            f_file_stream_lock(main->program.output.to);
-
             if (main->setting.flag & fss_read_main_flag_total_e) {
               fss_read_print_number(&main->program.output, 1);
             }
             else {
-              fss_read_print_content(&main->program.output, range, delimits_content);
+              fss_read_print_content(&main->program.output, range, main->setting.quotes_content.array[at], delimits_content);
             }
 
-            f_file_stream_unlock(main->program.output.to);
-
             main->setting.state.status = F_success;
 
             return;
@@ -150,20 +201,16 @@ extern "C" {
         ++(*line);
 
         if (*line == main->setting.line) {
-          f_file_stream_lock(main->program.output.to);
-
           if (main->setting.flag & fss_read_main_flag_total_e) {
             fss_read_print_number(&main->program.output, 1);
           }
           else {
             range.stop = main->setting.contents.array[at].array[0].stop;
 
-            fss_read_print_content(&main->program.output, range, delimits_content);
+            fss_read_print_content(&main->program.output, range, main->setting.quotes_content.array[at], delimits_content);
             f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
           }
 
-          f_file_stream_unlock(main->program.output.to);
-
           main->setting.state.status = F_success;
 
           return;
@@ -175,6 +222,25 @@ extern "C" {
   }
 #endif // _di_fss_read_process_at_line_
 
+#ifndef _di_fss_read_file_identify_
+  f_string_static_t fss_read_file_identify(const f_array_length_t at, const fss_read_files_t files) {
+
+    for (f_array_length_t i = 0; i < files.used; ++i) {
+
+      if (at >= files.array[i].range.start && at <= files.array[i].range.stop) {
+        return files.array[i].name;
+      }
+    } // for
+
+    // When stopped after the end of the buffer, the last file in the list is the correct file.
+    if (at > files.array[files.used - 1].range.stop) {
+      return files.array[files.used - 1].name;
+    }
+
+    return f_string_empty_s;
+  }
+#endif // _di_fss_read_file_identify_
+
 #ifndef _di_fss_read_process_last_line_
   void fss_read_process_last_line(void * const void_main) {
 
index 85cf661e5823bb4378d264cb1512cd9d1714c71e..25c5f9f483c3951839174ed3a0f03c10f986b385 100644 (file)
 #include <fll/level_2/print.h>
 #include <fll/level_2/program.h>
 
-// FSS Write includes.
+// FSS Read includes.
 #include <program/fss_read/main/common/define.h>
 #include <program/fss_read/main/common/enumeration.h>
 #include <program/fss_read/main/common/print.h>
+#include <program/fss_read/main/common/static.h>
 #include <program/fss_read/main/common/string.h>
 #include <program/fss_read/main/common/type.h>
 #include <program/fss_read/main/common.h>
-#include <program/fss_read/basic/common.h>
 #include <program/fss_read/main/print/error.h>
 #include <program/fss_read/main/print/message.h>
-#include <program/fss_read/basic/print.h>
 #include <program/fss_read/main/process_normal.h>
 #include <program/fss_read/main/signal.h>
 #include <program/fss_read/main/thread.h>
@@ -66,6 +65,46 @@ extern "C" {
 #endif
 
 /**
+ * Determine if the given depth is to be delimited or not for Content.
+ *
+ * @param main
+ *   The program and settings data.
+ *
+ *   Must not be NULL.
+ *
+ *   This does not alter main.setting.state.status.
+ * @param depth
+ *   The depth to check.
+ *
+ * @return
+ *   F_true if to apply delimits.
+ *   F_false if to not apply delimits (fallback when main is NULL).
+ */
+#ifndef _di_fss_read_delimit_content_is_
+  extern f_status_t fss_read_delimit_content_is(fss_read_main_t * const main, const f_array_length_t depth) F_attribute_visibility_internal_d;
+#endif // _di_fss_read_delimit_content_is_
+
+/**
+ * Determine if the given depth is to be delimited or not for an Object.
+ *
+ * @param main
+ *   The program and settings data.
+ *
+ *   Must not be NULL.
+ *
+ *   This does not alter main.setting.state.status.
+ * @param depth
+ *   The depth to check.
+ *
+ * @return
+ *   F_true if to apply delimits.
+ *   F_false if to not apply delimits (fallback when main is NULL).
+ */
+#ifndef _di_fss_read_delimit_object_is_
+  extern f_status_t fss_read_delimit_object_is(fss_read_main_t * const main, const f_array_length_t depth) F_attribute_visibility_internal_d;
+#endif // _di_fss_read_delimit_object_is_
+
+/**
  * Execute main program.
  *
  * If main.signal is non-zero, then this blocks and handles the following signals:
@@ -78,6 +117,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status:
@@ -93,10 +134,12 @@ extern "C" {
 #endif // _di_fss_read_main_
 
 /**
- * Process based on at parameter.
+ * Process based on at parameter for a specific line.
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status:
@@ -122,12 +165,28 @@ extern "C" {
  *
  * @return
  *   F_none on success.
+ */
+#ifndef _di_fss_read_process_at_line_
+  extern void fss_read_process_at_line(fss_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, f_array_length_t * const line);
+#endif // _di_fss_read_process_at_line_
+
+/**
+ * Get the name of the file the given position represents within the buffer.
+ *
+ * @param at
+ *   The position within the buffer.
+ * @param files
+ *   The representation of files and their respective ranges within the buffer.
  *
- * @see fss_read_process_at_line()
+ * @return
+ *   A string with the name when found.
+ *   NULL is returned if the range represents the STDIN pipe.
+ *
+ *   On failure to identify, an empty string is returned.
  */
-#ifndef _di_fss_read_process_at_
-  extern f_status_t fss_read_process_at_line(fss_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, f_array_length_t * const line);
-#endif // _di_fss_read_process_at_
+#ifndef _di_fss_read_file_identify_
+  extern f_string_static_t fss_read_file_identify(const f_array_length_t at, const fss_read_files_t files) F_attribute_visibility_internal_d;
+#endif // _di_fss_read_file_identify_
 
 /**
  * Process the current buffer, guarantee that a newline exists at the end of the buffer.
@@ -137,6 +196,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status:
index 8a81e2e1138b160f877cd5e46c942bd62e37e226..2a66c2b8135ad575418e48778b433fcc6148448f 100644 (file)
@@ -96,12 +96,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
     if (!main || F_status_is_error(main->setting.state.status) || (main->setting.flag & fss_read_main_flag_version_e)) return;
 
     main->setting.standard = fss_read_basic_standard_s;
-    main->setting.process_content = &fss_read_basic_process_content;
-    main->setting.process_help = &fss_read_main_process_help;
-    main->setting.process_load_depth = 0;
-    main->setting.process_normal = &fss_read_process_normal;
-    main->setting.process_object = &fss_read_basic_process_object;
-    main->setting.process_set = &fss_read_process_set;
+
+    main->callback.process_content = &fss_read_basic_process_content;
+    main->callback.process_help = &fss_read_main_process_help;
+    main->callback.process_load_depth = 0;
+    main->callback.process_normal = &fss_read_process_normal;
+    main->callback.process_object = &fss_read_basic_process_object;
+    main->callback.process_set = &fss_read_process_set;
 
     if (main->program.parameters.array[fss_read_parameter_as_e].result & f_console_result_value_e && main->program.parameters.array[fss_read_parameter_as_e].values.used) {
 
@@ -118,14 +119,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
             f_compare_dynamic(argv[index], fss_read_format_code_machine_0000_s) == F_equal_to) {
 
           main->setting.standard = fss_read_basic_standard_s;
-          main->setting.process_content = &fss_read_basic_process_content;
-          main->setting.process_help = &fss_read_basic_process_help;
-          main->setting.process_load_depth = 0;
-          main->setting.process_object = &fss_read_basic_process_object;
-          main->setting.process_normal = &fss_read_process_normal;
-          main->setting.process_set = &fss_read_process_set;
+
           main->setting.flag -= main->setting.flag & fss_read_main_flag_ignore_e; // Not supported by basic.
           main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e; // Not supported by basic.
+
+          main->callback.process_content = &fss_read_basic_process_content;
+          main->callback.process_help = &fss_read_basic_process_help;
+          main->callback.process_load_depth = 0;
+          main->callback.process_object = &fss_read_basic_process_object;
+          main->callback.process_normal = &fss_read_process_normal;
+          main->callback.process_set = &fss_read_process_set;
         }
         else if (f_compare_dynamic(argv[index], fss_read_format_code_short_0001_s) == F_equal_to ||
                  f_compare_dynamic(argv[index], fss_read_format_code_long_0001_s) == F_equal_to ||
@@ -133,14 +136,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
                  f_compare_dynamic(argv[index], fss_read_format_code_machine_0001_s) == F_equal_to) {
 
           main->setting.standard = fss_read_extended_standard_s;
-          main->setting.process_content = &fss_read_extended_process_content;
-          main->setting.process_help = &fss_read_extended_process_help;
-          main->setting.process_load_depth = 0;
-          main->setting.process_object = &fss_read_extended_process_object;
-          main->setting.process_normal = &fss_read_process_normal;
-          main->setting.process_set = &fss_read_process_set;
+
           main->setting.flag -= main->setting.flag & fss_read_main_flag_ignore_e; // Not supported by extended.
           main->setting.flag |= fss_read_main_flag_content_multiple_e;
+
+          main->callback.process_content = &fss_read_extended_process_content;
+          main->callback.process_help = &fss_read_extended_process_help;
+          main->callback.process_load_depth = 0;
+          main->callback.process_object = &fss_read_extended_process_object;
+          main->callback.process_normal = &fss_read_process_normal;
+          main->callback.process_set = &fss_read_process_set;
         }
         else if (f_compare_dynamic(argv[index], fss_read_format_code_short_0002_s) == F_equal_to ||
                  f_compare_dynamic(argv[index], fss_read_format_code_long_0002_s) == F_equal_to ||
@@ -148,14 +153,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
                  f_compare_dynamic(argv[index], fss_read_format_code_machine_0002_s) == F_equal_to) {
 
           main->setting.standard = fss_read_basic_list_standard_s;
-          main->setting.process_content = &fss_read_basic_list_process_content;
-          main->setting.process_help = &fss_read_basic_list_process_help;
-          main->setting.process_load_depth = 0;
-          main->setting.process_object = &fss_read_basic_list_process_object;
-          main->setting.process_normal = &fss_read_process_normal;
-          main->setting.process_set = &fss_read_process_set;
+
           main->setting.flag -= main->setting.flag & fss_read_main_flag_ignore_e; // Not supported by basic list.
           main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e; // Not supported by basic list.
+
+          main->callback.process_content = &fss_read_basic_list_process_content;
+          main->callback.process_help = &fss_read_basic_list_process_help;
+          main->callback.process_load_depth = 0;
+          main->callback.process_object = &fss_read_basic_list_process_object;
+          main->callback.process_normal = &fss_read_process_normal;
+          main->callback.process_set = &fss_read_process_set;
         }
         else if (f_compare_dynamic(argv[index], fss_read_format_code_short_0003_s) == F_equal_to ||
                  f_compare_dynamic(argv[index], fss_read_format_code_long_0003_s) == F_equal_to ||
@@ -163,14 +170,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
                  f_compare_dynamic(argv[index], fss_read_format_code_machine_0003_s) == F_equal_to) {
 
           main->setting.standard = fss_read_extended_list_standard_s;
-          main->setting.process_content = &fss_read_extended_list_process_content;
-          main->setting.process_help = &fss_read_extended_list_process_help;
-          main->setting.process_load_depth = 0;
-          main->setting.process_object = &fss_read_extended_list_process_object;
-          main->setting.process_normal = &fss_read_process_normal;
-          main->setting.process_set = &fss_read_process_set;
+
           main->setting.flag |= fss_read_main_flag_ignore_e;
           main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e; // Not supported by extended list.
+
+          main->callback.process_content = &fss_read_extended_list_process_content;
+          main->callback.process_help = &fss_read_extended_list_process_help;
+          main->callback.process_load_depth = 0;
+          main->callback.process_object = &fss_read_extended_list_process_object;
+          main->callback.process_normal = &fss_read_process_normal;
+          main->callback.process_set = &fss_read_process_set;
         }
         else if (f_compare_dynamic(argv[index], fss_read_format_code_short_0008_s) == F_equal_to ||
                  f_compare_dynamic(argv[index], fss_read_format_code_long_0008_s) == F_equal_to ||
@@ -178,14 +187,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
                  f_compare_dynamic(argv[index], fss_read_format_code_machine_0008_s) == F_equal_to) {
 
           main->setting.standard = fss_read_embedded_list_standard_s;
-          main->setting.process_content = &fss_read_embedded_list_process_content;
-          main->setting.process_help = &fss_read_embedded_list_process_help;
-          main->setting.process_load_depth = 0;
-          main->setting.process_object = &fss_read_embedded_list_process_object;
-          main->setting.process_normal = &fss_read_process_normal;
-          main->setting.process_set = &fss_read_process_set;
+
           main->setting.flag |= fss_read_main_flag_ignore_e;
           main->setting.flag |= fss_read_main_flag_content_multiple_e;
+
+          main->callback.process_content = &fss_read_embedded_list_process_content;
+          main->callback.process_help = &fss_read_embedded_list_process_help;
+          main->callback.process_load_depth = 0;
+          main->callback.process_object = &fss_read_embedded_list_process_object;
+          main->callback.process_normal = &fss_read_process_normal;
+          main->callback.process_set = &fss_read_process_set;
         }
         else if (f_compare_dynamic(argv[index], fss_read_format_code_short_000e_s) == F_equal_to ||
                  f_compare_dynamic(argv[index], fss_read_format_code_long_000e_s) == F_equal_to ||
@@ -193,14 +204,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
                  f_compare_dynamic(argv[index], fss_read_format_code_machine_000e_s) == F_equal_to) {
 
           main->setting.standard = fss_read_payload_standard_s;
-          main->setting.process_content = 0; // Not used by payload.
-          main->setting.process_help = &fss_read_payload_process_help;
-          main->setting.process_load_depth = 0;
-          main->setting.process_normal = &fss_read_process_normal;
-          main->setting.process_object = 0; // Not used by payload.
-          main->setting.process_set = &fss_read_payload_process_set;
+
           main->setting.flag -= main->setting.flag & fss_read_main_flag_ignore_e; // Not supported by payload.
           main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e; // Not supported by payload.
+
+          main->callback.process_content = 0; // Not used by payload.
+          main->callback.process_help = &fss_read_payload_process_help;
+          main->callback.process_load_depth = 0;
+          main->callback.process_normal = &fss_read_process_normal;
+          main->callback.process_object = 0; // Not used by payload.
+          main->callback.process_set = &fss_read_payload_process_set;
         }
         else {
           if (main->setting.flag & fss_read_main_flag_help_e) {
index 614cf6a66a079de4ecf0c8d38e8b90ef1ab44832..86e79b964a756d75270a1ccef15338d828f2a23f 100644 (file)
@@ -36,6 +36,8 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp);
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -60,7 +62,7 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp);
  * @param main
  *   The main program and settings data.
  *
- *   This alters main.setting.process_help, main.setting.process_normal, and main.setting.process_pipe.
+ *   This alters main.callback.process_help, main.callback.process_normal, and main.callback.process_pipe.
  *
  *   This alters main.setting.state.status:
  *     F_none on success.
index 63136a6b5995706da058cab45310b2e19197474e..1e823f193a563e981320429b2fccd859165d334a 100644 (file)
@@ -4,19 +4,89 @@
 extern "C" {
 #endif
 
+#ifndef _di_fss_read_print_at_
+  void fss_read_print_at(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content) {
+
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+    fss_read_main_t * const main = (fss_read_main_t *) print->custom;
+
+    if (at >= main->setting.contents.used) return F_output_not;
+
+    if ((main->setting.flag & fss_read_main_flag_object_e) || (main->setting.flag & fss_read_main_flag_content_e) && (main->setting.contents.array[at].used || (main->setting.flag & fss_read_main_flag_empty_e))) {
+      if (main->setting.flag & fss_read_main_flag_object_e) {
+        if (main->callback.print_object) {
+          main->callback.print_object(&main->program.output, at, delimits_object);
+        }
+
+        if (main->setting.flag & fss_read_main_flag_content_e) {
+          if (main->callback.print_object_end) {
+            main->callback.print_object_end(&main->program.output);
+          }
+        }
+      }
+
+      if ((main->setting.flag & fss_read_main_flag_content_e) && main->setting.contents.array[at].used) {
+        if (main->callback.print_content) {
+          main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[0], main->setting.quotes_content.array[at], delimits_content);
+        }
+      }
+
+      if (main->callback.print_set_end) {
+        main->callback.print_set_end(&main->program.output);
+      }
+    }
+
+    return F_none;
+  }
+#endif // _di_fss_read_print_at_
+
 #ifndef _di_fss_read_print_content_
-  f_status_t fss_read_print_content(fl_print_t * const print, const f_string_range_t range, const f_fss_delimits_t delimits) {
+  f_status_t fss_read_print_content(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_fss_delimits_t delimits) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
 
-    fss_read_main_t * const main = (fss_read_main_t *) print->custom,
+    fss_read_main_t * const main = (fss_read_main_t *) print->custom;
 
-    f_print_except_in_dynamic_partial(main->setting.buffer, range, delimits, main->setting.comments, print->to);
+    if (data.callback.print_content_ignore) {
+      data.callback.print_content_ignore(&main->program.output);
+    }
+
+    if (main->setting.flag & fss_read_main_flag_original_e) {
+      if ((main->setting.flag & fss_read_main_flag_quote_content_e) && quote) {
+        fss_read_print_quote(&main->program.output, quote);
+      }
+    }
+
+    fll_print_except_in_dynamic_partial(main->setting.buffer, range, delimits, main->setting.comments, print->to);
+
+    if (main->setting.flag & fss_read_main_flag_original_e) {
+      if ((main->setting.flag & fss_read_main_flag_quote_content_e) && quote) {
+        fss_read_print_quote(&main->program.output, quote);
+      }
+    }
+
+    if (data.callback.print_content_ignore) {
+      data.callback.print_content_ignore(&main->program.output);
+    }
 
     return F_none;
   }
 #endif _di_fss_read_print_content_
 
+#ifndef _di_fss_read_print_content_ignore_
+  void fss_read_print_content_ignore(fl_print_t * const print) {
+
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+    fss_read_main_t * const main = (fss_read_main_t *) print->custom,
+
+    if (main->setting.flag & fss_read_main_flag_pipe_e) {
+      fll_print_dynamic_raw(fss_read_pipe_content_ignore_s, print->to);
+    }
+  }
+#endif // _di_fss_read_print_content_ignore_
+
 #ifndef _di_fss_read_print_number_
   f_status_t fss_read_print_number(fl_print_t * const print, const f_number_unsigned_t number) {
 
@@ -28,8 +98,8 @@ extern "C" {
   }
 #endif // _di_fss_read_print_number_
 
-#ifndef _di_fss_read_print_object_at_
-  f_status_t fss_read_print_object_at(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits) {
+#ifndef _di_fss_read_print_object_
+  f_status_t fss_read_print_object(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
 
@@ -37,18 +107,105 @@ extern "C" {
 
     if (at >= main->setting.objects.used) return F_output_not;
 
-    if (main->setting.flag & fss_read_main_flag_trim_e) {
-      fl_print_trim_except_dynamic_partial(main->setting.buffer, main->setting.array[at], delimits, print->to);
+    if (main->setting.flag & fss_read_data_option_trim_d) {
+      if (main->setting.flag & fss_read_data_option_original_d) {
+        if (main->setting.quotes.array[at]) {
+          fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
+        }
+
+        fll_print_trim_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], main->program.output.to);
+
+        if (main->setting.quotes.array[at]) {
+          fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
+        }
+      }
+      else {
+        fll_print_trim_except_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], delimits_object, main->program.output.to);
+      }
     }
     else {
-      f_print_except_dynamic_partial(main->setting.buffer, main->setting.array[at], delimits, print->to);
+      if (main->setting.flag & fss_read_main_flag_original_e) {
+        if (main->setting.quotes.array[at]) {
+          fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
+        }
+
+        fll_print_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], main->program.output.to);
+
+        if (main->setting.quotes.array[at]) {
+          fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
+        }
+      }
+      else {
+        fll_print_except_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], delimits_object, main->program.output.to);
+      }
     }
 
-    fss_read_print_object_end(print); // @todo replace with a callback because each standard may have a different Object end.
+    return F_none;
+  }
+#endif // _di_fss_read_print_object_
+
+#ifndef _di_fss_read_print_object_end_
+  f_status_t fss_read_print_object_end(fl_print_t * const print) {
+
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+    fss_read_main_t * const main = (fss_read_main_t *) print->custom,
+
+    if (main->setting.flag & fss_read_main_flag_pipe_e) {
+      fll_print_dynamic_raw(fss_read_pipe_content_start_s, print->to);
+    }
+    else {
+      fll_print_dynamic_raw(f_fss_space_s, main->program.output.to);
+
+      // @todo this is basic list read, move this appropriately and use "basic" for the common object end, which is a space.
+      /*
+      if (main->parameters.array[fss_read_parameter_content_e].result & f_console_result_found_e) {
+        f_print_dynamic_raw(f_fss_basic_list_open_s, print->to);
+        f_print_dynamic_raw(f_fss_basic_list_open_end_s, print->to);
+      }
+      else {
+        f_print_dynamic_raw(f_fss_eol_s, print->to);
+      }
+      */
+    }
+  }
+#endif // _di_fss_read_print_object_end_
+
+#ifndef _di_fss_read_print_quote_
+  f_status_t fss_read_print_quote(fl_print_t * const print, const uint8_t type) {
+
+    if (!print) return F_status_set_error(F_output_not);
+
+    fll_print_dynamic_raw(
+      type == f_fss_quote_type_single_e
+        ? f_fss_quote_single_s
+        : type == f_fss_quote_type_backtick_e
+          ? f_fss_quote_backtick_s
+          : f_fss_quote_double_s,
+      print->to
+    );
+
+    return F_none;
+  }
+#endif // _di_fss_read_print_quote_
+
+#ifndef _di_fss_read_print_set_end_
+  f_status_t fss_read_print_set_end(fl_print_t * const print) {
+
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+    fss_read_main_t * const main = (fss_read_main_t *) print->custom,
+
+    if (main->setting.flag & fss_read_main_flag_pipe_e) {
+      fll_print_dynamic_raw(fss_read_pipe_content_end_s, print->to);
+    }
+    else {
+      fll_print_dynamic_raw(f_string_eol_s, main->program.output.to);
+    }
 
     return F_none;
   }
-#endif // _di_fss_read_print_object_at_
+#endif // _di_fss_read_print_set_end_
 
 #ifdef __cplusplus
 } // extern "C"
index 14d83c4edb413fe2e10b4ee0183de485a2ac4cac..500a281dbc3058c77b310f64b98c2265087185de 100644 (file)
@@ -17,9 +17,50 @@ extern "C" {
 #endif
 
 /**
+ * Process printing the buffer according to "at" position and given delimits.
+ *
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @param print
+ *   The output structure to print to.
+ *
+ *   The print.custom is expected to be of type fss_read_main_t.
+ *
+ *   This does not alter print.custom.setting.state.status.
+ * @param at
+ *   The "at" position to be printed.
+ * @param delimits_object
+ *   The delimits array representing a delimited Object.
+ *   This represents the positions within the current Object at the "at" position.
+ * @param delimits_content
+ *   The delimits array representing a delimited Content.
+ *   This represents the positions within the current Content at the "at" position.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if a parameter is NULL.
+ *
+ * @see fll_print_dynamic_partial()
+ * @see fll_print_except_dynamic_partial()
+ * @see fll_print_trim_dynamic_partial()
+ * @see fll_print_trim_except_dynamic_partial()
+ *
+ * @see fss_read_print_quote()
+ * @see fss_read_signal_check()
+ * @see main.callback.print_object()
+ * @see main.callback.print_object_end()
+ * @see main.callback.print_set_end()
+ */
+#ifndef _di_fss_read_print_at_
+  extern f_status_t fss_read_print_at(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
+#endif // _di_fss_read_print_at_
+
+/**
  * Print the Content.
  *
- * This does not lock the stream.
+ * This locks, uses, and unlocks the file stream.
  *
  * This does not print a new line after the Content.
  *
@@ -31,6 +72,8 @@ extern "C" {
  *   This does not alter print.custom.setting.state.status.
  * @param range
  *   The range within the buffer representing the Content to print.
+ * @param quote
+ *   The quote in use, if any.
  * @param delimits
  *   The delimits array representing a delimited Content.
  *
@@ -40,16 +83,43 @@ extern "C" {
  *
  *   F_output_not (with error bit) if a parameter is NULL.
  *
- * @see f_print_except_in_dynamic_partial()
+ * @see fll_print_except_in_dynamic_partial()
+ * @see main.callback.print_content()
+ * @see main.callback.print_object_end()
+ * @see main.callback.print_set_end()
  */
 #ifndef _di_fss_read_print_content_
-  extern f_status_t fss_read_print_content(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits);
+  extern f_status_t fss_read_print_content(fl_print_t * const print, const f_array_length_t at, const uint8_t quote, const f_fss_delimits_t delimits);
 #endif // _di_fss_read_print_content_
 
 /**
+ * Print the ignore character for Content.
+ *
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @param print
+ *   The output structure to print to.
+ *
+ *   The print.custom is expected to be of type fss_read_main_t.
+ *
+ *   This does not alter print.custom.setting.state.status.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if a parameter is NULL.
+ *
+ * @see fll_print_dynamic_raw()
+ */
+#ifndef _di_fss_read_print_content_ignore_
+  extern f_status_t fss_read_print_content_ignore(fl_print_t * const print);
+#endif // _di_fss_read_print_content_ignore_
+
+/**
  * Print the number and a newline.
  *
- * This does not lock the stream.
+ * This locks, uses, and unlocks the file stream.
  *
  * @param print
  *   The output structure to print to.
@@ -75,7 +145,9 @@ extern "C" {
 /**
  * Print the Object at the given position.
  *
- * This does not lock the stream.
+ * This locks, uses, and unlocks the file stream.
+ *
+ * Different standards may want to call this before they perform their final printing.
  *
  * @param print
  *   The output structure to print to.
@@ -95,14 +167,93 @@ extern "C" {
  *
  *   F_output_not (with error bit) if a parameter is NULL.
  *
- * @see f_print_except_dynamic_partial()
- * @see fl_print_trim_except_dynamic_partial()
+ * @see fll_print_dynamic_partial()
+ * @see fll_print_except_dynamic_partial()
+ * @see fll_print_trim_dynamic_partial()
+ * @see fll_print_trim_except_dynamic_partial()
+ *
+ * @see fss_read_print_quote()
+ */
+#ifndef _di_fss_read_print_object_
+  extern f_status_t fss_read_print_object(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits);
+#endif // _di_fss_read_print_object_
+
+/**
+ * Print the end of an Object (which is often the start of Content).
+ *
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @param print
+ *   The output structure to print to.
+ *
+ *   The print.custom is expected to be of type fss_read_main_t.
+ *
+ *   This does not alter print.custom.setting.state.status.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if a parameter is NULL.
+ *
+ * @see fll_print_dynamic_raw()
+ */
+#ifndef _di_fss_read_print_object_end_
+  extern f_status_t fss_read_print_object_end(fl_print_t * const print);
+#endif // _di_fss_read_print_object_end_
+
+/**
+ * Print the Object at the given position.
+ *
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @param print
+ *   The output structure to print to.
+ *
+ *   The print.custom is expected to be of type fss_read_main_t.
+ *
+ *   This does not alter print.custom.setting.state.status.
+ * @param at
+ *   The "at" position to be printed.
+ * @param delimits
+ *   The delimits array representing a delimited Object.
+ *   This represents the positions within the current Object at the "at" position.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if a parameter is NULL.
+ *
+ * @see fll_print_dynamic_raw()
+ */
+#ifndef _di_fss_read_print_quote_
+  extern f_status_t fss_read_print_quote(fl_print_t * const print, const uint8_t type);
+#endif // _di_fss_read_print_quote_
+
+/**
+ * Print the end of an Object/Content set.
+ *
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @param print
+ *   The output structure to print to.
+ *
+ *   The print.custom is expected to be of type fss_read_main_t.
+ *
+ *   This does not alter print.custom.setting.state.status.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if a parameter is NULL.
  *
- * @see fss_read_print_object_end() @todo replace this with appropriate print callback.
+ * @see fll_print_dynamic_raw()
  */
-#ifndef _di_fss_read_print_object_at_
-  extern f_status_t fss_read_print_object_at(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits);
-#endif // _di_fss_read_print_object_at_
+#ifndef _di_fss_read_print_set_end_
+  extern f_status_t fss_read_print_set_end(fl_print_t * const print);
+#endif // _di_fss_read_print_set_end_
 
 #ifdef __cplusplus
 } // extern "C"
index 07ddf069324ee992fdf2b5de934de293ad132c7f..93512c76c714b82590de67d0361d7dd3b3113d13 100644 (file)
@@ -18,11 +18,7 @@ extern "C" {
     // For select, most standards do not support multiple select, so any select greater than 0 can be predicted without processing the buffer.
     if (!(main->setting.flag & fss_read_main_flag_depth_multiple_e) && main->setting.depths.array[0].depth || !(main->setting.flag & fss_read_main_flag_content_multiple_e) && ((main->setting.flag & fss_read_main_flag_select_e) && data->select)) {
       if (main->setting.flag & fss_read_main_flag_total_e) {
-        f_file_stream_lock(main->program.output.to);
-
         fss_read_print_number(&main->program.output, 0);
-
-        f_file_stream_unlock(main->program.output.to);
       }
 
       main->setting.state.status = F_none;
@@ -31,61 +27,57 @@ extern "C" {
     }
 
     // The process_load() callback is required to be non-NULL.
-    if (!main->setting.process_load) return;
+    if (!main->callback.process_load) return;
 
-    main->setting.process_load(main);
+    main->callback.process_load(main);
     if (F_status_is_error(main->setting.state.status)) return;
 
-    f_array_lengths_t except_none = f_array_lengths_t_initialize;
-    f_array_lengths_t *delimits_object = fss_read_delimit_object_is(main, 0) ? &main->setting.delimits_object : &except_none;
-    f_array_lengths_t *delimits_content = fss_read_delimit_content_is(main, 0) ? &main->setting.delimits_content : &except_none;
-
-    if (main->setting.flag & fss_read_main_flag_original_e) {
-      delimits_object = &except_none;
-      delimits_content = &except_none;
-    }
+    const f_array_lengths_t * const delimits_object = !(main->setting.flag & fss_read_main_flag_original_e) && fss_read_delimit_object_is(main, 0) ? &main->setting.delimits_object : &fss_read_except_none_c;
+    const f_array_lengths_t * const delimits_content = !(main->setting.flag & fss_read_main_flag_original_e) && fss_read_delimit_content_is(main, 0) ? &main->setting.delimits_content : &fss_read_except_none_c;
 
     bool names[main->setting.objects.used];
 
-    if (main->setting.process_name) {
-      main->setting.process_name(main, names);
+    if (main->callback.process_name) {
+      main->callback.process_name(main, names);
       if (F_status_is_error(main->setting.state.status)) return;
     }
     else if (main->setting.objects.used) {
-      memset(names, 0, sizeof(bool) * main->setting.objects.used);
+
+      // If no processing is enabled, then default to F_true to enable all names.
+      memset(names, F_true, sizeof(bool) * main->setting.objects.used);
     }
 
-    if (main->setting.process_at) {
-      main->setting.process_at(main, names, *delimits_object, *delimits_content);
+    if (main->callback.process_at) {
+      main->callback.process_at(main, names, *delimits_object, *delimits_content);
 
       return;
     }
 
-    if ((main->setting.flag & fss_read_main_flag_columns_e) && main->setting.process_columns) {
-      main->setting.process_columns(main, names);
+    if ((main->setting.flag & fss_read_main_flag_columns_e) && main->callback.process_columns) {
+      main->callback.process_columns(main, names);
 
       return;
     }
 
-    if ((main->setting.flag & fss_read_main_flag_total_e) && main->setting.process_total) {
-      main->setting.process_total(main, names);
+    if ((main->setting.flag & fss_read_main_flag_total_e) && main->callback.process_total) {
+      main->callback.process_total(main, names);
 
       return;
     }
 
-    if ((main->setting.flag & fss_read_main_flag_line_e) && main->setting.process_line) {
-      main->setting.process_line(main, names);
+    if ((main->setting.flag & fss_read_main_flag_line_e) && main->callback.process_line) {
+      main->callback.process_line(main, names);
 
       return;
     }
 
-    if (main->setting.process_print_at) {
+    if (main->callback.print_at) {
       for (f_array_length_t i = 0; i < main->setting.contents.used; ++i) {
 
         if (!names[i]) continue;
         if (fss_read_signal_check(main)) return;
 
-        main->setting.process_print_at(main, i, *delimits_object, *delimits_content);
+        main->callback.print_at(main, i, *delimits_object, *delimits_content);
       } // for
     }
 
@@ -102,11 +94,7 @@ extern "C" {
 
     if (main->setting.depths.array[0].value_at >= main->setting.objects.used) {
       if (main->setting.flag & (fss_read_main_flag_columns_e | fss_read_main_flag_total_e)) {
-        f_file_stream_lock(main->program.output.to);
-
         fss_read_print_number(&main->program.output, 0);
-
-        f_file_stream_unlock(main->program.output.to);
       }
 
       main->setting.state.status = F_none;
@@ -118,11 +106,7 @@ extern "C" {
     if (main->setting.flag & (fss_read_main_flag_line_e | fss_read_main_flag_line_single_e) == (fss_read_main_flag_line_e | fss_read_main_flag_line_single_e)) {
       if (main->setting.line) {
         if (main->setting.flag & fss_read_main_flag_total_e) {
-          f_file_stream_lock(main->program.output.to);
-
           fss_read_print_zero(main);
-
-          f_file_stream_unlock(main->program.output.to);
         }
 
         main->setting.state.status = F_none;
@@ -138,19 +122,6 @@ extern "C" {
     f_array_length_t line = 0;
     f_array_length_t total = 0;
 
-    // @todo this is originally from basic list, compare this against extended and determine what else needs to be done when it comes to quotes (consider checking if flags exist and performing appropriate modifications,  or perhaps custom callback). There probably should be a standard flag for designating that quotes should be printed around Objects and the same for Contents.
-    // Example:
-    /*
-              f_print_dynamic_raw(
-                data->quotes_object.array[at] == f_fss_quote_type_single_e
-                  ? f_fss_quote_single_s
-                  : data->quotes_object.array[at] == f_fss_quote_type_backtick_e
-                    ? f_fss_quote_backtick_s
-                    : f_fss_quote_double_s,
-                main->program.output.to
-              );
-    */
-
     for (; i < main->setting.objects.used; ++i) {
 
       if (!names[i]) continue;
@@ -183,31 +154,34 @@ extern "C" {
           fss_read_print_number(&main->program.output, main->setting.contents.array[i].used);
         }
         else if (main->setting.flag & fss_read_main_flag_total_e) {
-          total = 0;
-          k = 0;
-
-          // @todo this is originally from basic list, compare this against extended list and determine what else needs to be done.
+          if (main->setting.flag & fss_read_main_flag_line_single_e) {
+            fss_read_print_number(main, main->setting.contents.array[i].used ? 1 : 0);
+          }
+          else {
+            total = 0;
+            k = 0;
 
-          // Count each new line.
-          for (j = 0; j < main->setting.contents.array[i].used; ++j) {
+            // Count each new line.
+            for (j = 0; j < main->setting.contents.array[i].used; ++j) {
 
-            if (main->setting.contents.array[i].array[j].start > main->setting.contents.array[i].array[j].stop) continue;
-            if (main->setting.contents.array[i].array[j].start > main->setting.buffer.used) continue;
+              if (main->setting.contents.array[i].array[j].start > main->setting.contents.array[i].array[j].stop) continue;
+              if (main->setting.contents.array[i].array[j].start > main->setting.buffer.used) continue;
 
-            for (k = main->setting.contents.array[i].array[j].start; k <= main->setting.contents.array[i].array[j].stop && k < main->setting.buffer.used; ++k) {
-              if (main->setting.buffer.string[k] == f_string_eol_s.string[0]) ++total;
+              for (k = main->setting.contents.array[i].array[j].start; k <= main->setting.contents.array[i].array[j].stop && k < main->setting.buffer.used; ++k) {
+                if (main->setting.buffer.string[k] == f_string_eol_s.string[0]) ++total;
+              } // for
             } // for
-          } // for
 
-          // If there are no newline characters but there is data, then this represents a single line.
-          if (main->setting.contents.array[i].used && !total) {
-            total = 1;
-          }
+            // If there are no newline characters but there is data, then this represents a single line.
+            if (main->setting.contents.array[i].used && !total) {
+              total = 1;
+            }
 
-          fss_read_print_number(&main->program.output, total);
+            fss_read_print_number(&main->program.output, total);
+          }
         }
-        else if (main->setting.process_print_at) {
-          main->setting.process_print_at(main, i, delimits_object, delimits_content);
+        else if (main->callback.print_at) {
+          main->callback.print_at(main, i, delimits_object, delimits_content);
         }
 
         main->setting.state.status = F_none;
@@ -219,11 +193,7 @@ extern "C" {
     } // for
 
     if (main->setting.flag & fss_read_main_flag_total_e) {
-      f_file_stream_lock(main->program.output.to);
-
       fss_read_print_number(&main->program.output, 0);
-
-      f_file_stream_unlock(main->program.output.to);
     }
 
     main->setting.state.status = F_none;
@@ -237,6 +207,28 @@ extern "C" {
 
     fss_read_main_t * const main = (fss_read_main_t *) void_main;
 
+    if (!(main->setting.flag & fss_read_main_flag_content_e)) {
+      fss_read_print_number(&main->program.output, 0);
+
+      main->setting.state.status = F_none;
+
+      return;
+    }
+
+    f_array_length_t max = 0;
+
+    for (f_array_length_t at = 0; at < main->setting.contents.used; ++at) {
+
+      if (!names[at]) continue;
+      if (fss_read_signal_check(main)) return;
+
+      if (main->setting.contents.array[at].used > max) {
+        max = main->setting.contents.array[at].used;
+      }
+    } // for
+
+    fss_read_print_number(&main->program.output, max);
+
     main->setting.state.status = F_none;
   }
 #endif // _di_fss_read_process_normal_columns_
@@ -248,20 +240,47 @@ extern "C" {
 
     fss_read_main_t * const main = (fss_read_main_t *) void_main;
 
-    main->setting.state.status = F_none;
-  }
-#endif // _di_fss_read_process_normal_line_
+    const f_array_lengths_t * const delimits = !(main->setting.flag & fss_read_main_flag_original_e) && fss_read_delimit_object_is(main, 0) ? &main->setting.delimits : &fss_read_except_none_c;
+
+    f_array_length_t line = 0;
 
-#ifndef _di_fss_read_process_normal_load_
-  void fss_read_process_normal_load(void * const main) {
+    for (f_array_length_t i = 0; i < main->setting.contents.used; ++i) {
 
-    if (!void_main) return;
+      if (!names[i]) continue;
+      if (fss_read_signal_check(main)) return;
 
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
+      if (!(main->setting.flag & fss_read_main_flag_object_e) && (main->setting.flag & fss_read_main_flag_content_e)) {
+        if (!main->setting.contents.array[i].used) {
+          if (main->setting.flag & fss_read_main_flag_empty_e) {
+            if (line == main->setting.line) {
+              if (main->callback.print_set_end) {
+                main->callback.print_set_end(&main->program.output);
+              }
+
+              break;
+            }
+
+            ++line;
+          }
+
+          continue;
+        }
+      }
+
+      if (line == main->setting.line) {
+        if (main->callback.print_at) {
+          main->callback.print_at(main, i, *delimits, fss_read_except_none_c);
+        }
+
+        break;
+      }
+
+      ++line;
+    } // for
 
     main->setting.state.status = F_none;
   }
-#endif // _di_fss_read_process_normal_load_
+#endif // _di_fss_read_process_normal_line_
 
 #ifndef _di_fss_read_process_normal_name_
   void fss_read_process_normal_name(void * const main, const bool names[]) {
@@ -270,31 +289,39 @@ extern "C" {
 
     fss_read_main_t * const main = (fss_read_main_t *) void_main;
 
-    main->setting.state.status = F_none;
-  }
-#endif // _di_fss_read_process_normal_name_
-
-#ifndef _di_fss_read_process_normal_print_at_
-  void fss_read_process_normal_print_at(void * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content) {
+    if (main->setting.depths.array[0].index_name) {
+      f_array_length_t i = 0;
 
-    if (!void_main) return;
+      memset(names, F_false, sizeof(bool) * main->setting.objects.used);
 
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
+      if (main->setting.flag & fss_read_main_flag_trim_e) {
+        for (i = 0; i < main->setting.objects.used; ++i) {
 
-    main->setting.state.status = F_none;
-  }
-#endif // _di_fss_read_process_normal_print_at_
+          if (fss_read_signal_check(main)) return;
 
-#ifndef _di_fss_read_process_normal_read_
-  void fss_read_process_normal_read(void * const main, const bool names[]) {
+          if (f_compare_dynamic_partial_except_trim_dynamic(main->setting.depths.array[0].value_name, main->setting.buffer, main->setting.objects.array[i], fss_read_except_none_c, main->setting.delimits) == F_equal_to) {
+            names[i] = F_true;
+          }
+        } // for
+      }
+      else {
+        for (i = 0; i < main->setting.objects.used; ++i) {
 
-    if (!void_main) return;
+          if (fss_read_signal_check(main)) return;
 
-    fss_read_main_t * const main = (fss_read_main_t *) void_main;
+          if (f_compare_dynamic_partial_except_dynamic(main->setting.depths.array[0].value_name, main->setting.buffer, main->setting.objects.array[i], fss_read_except_none_c, main->setting.delimits) == F_equal_to) {
+            names[i] = F_true;
+          }
+        } // for
+      }
+    }
+    else {
+      memset(names, F_true, sizeof(bool) * main->setting.objects.used);
+    }
 
     main->setting.state.status = F_none;
   }
-#endif // _di_fss_read_process_normal_read_
+#endif // _di_fss_read_process_normal_name_
 
 #ifndef _di_fss_read_process_normal_total_
   void fss_read_process_normal_total(void * const main, const bool names[]) {
@@ -303,6 +330,27 @@ extern "C" {
 
     fss_read_main_t * const main = (fss_read_main_t *) void_main;
 
+    f_array_length_t total = 0;
+
+    for (f_array_length_t i = 0; i < main->setting.objects.used; ++i) {
+
+      if (!names[i]) continue;
+      if (fss_read_signal_check(main)) return;
+
+      if (!(main->setting.flag & fss_read_main_flag_object_e) && main->setting.flag & fss_read_main_flag_content_e) {
+        if (!(main->setting.contents.array[i].used || (main->setting.flag & fss_read_main_flag_empty_e))) continue;
+      }
+
+      ++total;
+    } // for
+
+    fss_read_print_number(
+      &main->program.output,
+      main->setting.flag & fss_read_main_flag_line_e
+        ? main->setting.line < total ? 1 : 0
+        : total
+    );
+
     main->setting.state.status = F_none;
   }
 #endif // _di_fss_read_process_normal_total_
index 7c745eecfaece57a13acbd1aba98cd15037444a7..177a1d791be3cfdb72c0713e76ecef0d095e7241 100644 (file)
@@ -21,19 +21,21 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status:
  *     F_none on success.
  *
- *     Errors (with error bit) from: main.setting.process_at().
- *     Errors (with error bit) from: main.setting.process_columns().
- *     Errors (with error bit) from: main.setting.process_line().
- *     Errors (with error bit) from: main.setting.process_load().
- *     Errors (with error bit) from: main.setting.process_name().
- *     Errors (with error bit) from: main.setting.process_print_at().
- *     Errors (with error bit) from: main.setting.process_read().
- *     Errors (with error bit) from: main.setting.process_total().
+ *     Errors (with error bit) from: main.callback.process_at().
+ *     Errors (with error bit) from: main.callback.process_columns().
+ *     Errors (with error bit) from: main.callback.process_line().
+ *     Errors (with error bit) from: main.callback.process_load().
+ *     Errors (with error bit) from: main.callback.process_name().
+ *     Errors (with error bit) from: main.callback.print_at().
+ *     Errors (with error bit) from: main.callback.process_read().
+ *     Errors (with error bit) from: main.callback.process_total().
  *
  *     Errors (with error bit) from: fss_read_signal_check().
  *
@@ -48,6 +50,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status:
@@ -75,6 +79,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status:
@@ -96,6 +102,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status:
@@ -107,34 +115,19 @@ extern "C" {
  *   (If TRUE, then the name is to be used and if FALSE, then the name is not to be used.)
  *
  * @see fss_read_signal_check()
+ * @see main.callback.print_set_end()
  */
 #ifndef _di_fss_read_process_normal_line_
   extern void fss_read_process_normal_line(void * const main, const bool names[]);
 #endif // _di_fss_read_process_normal_line_
 
 /**
- * Process buffer according to "load" parameter rules.
- *
- * @param main
- *   The program and settings data.
- *   Must be of type fss_read_main_t.
- *
- *   This alters main.setting.state.status:
- *     F_none on success.
- *
- *     Errors (with error bit) from: fss_read_signal_check().
- *
- * @see fss_read_signal_check()
- */
-#ifndef _di_fss_read_process_normal_load_
-  extern void fss_read_process_normal_load(void * const main);
-#endif // _di_fss_read_process_normal_load_
-
-/**
  * Process buffer according to "name" parameter rules.
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status:
@@ -152,57 +145,12 @@ extern "C" {
 #endif // _di_fss_read_process_normal_name_
 
 /**
- * Process printing the buffer according to "at" position and given delimits.
- *
- * @param main
- *   The program and settings data.
- *   Must be of type fss_read_main_t.
- *
- *   This alters main.setting.state.status:
- *     F_none on success.
- *
- *     Errors (with error bit) from: fss_read_signal_check().
- * @param at
- *   The "at" position to be printed.
- * @param delimits_object
- *   The delimits array representing a delimited Object.
- *   This represents the positions within the current Object at the "at" position.
- * @param delimits_content
- *   The delimits array representing a delimited Content.
- *   This represents the positions within the current Content at the "at" position.
- *
- * @see fss_read_signal_check()
- */
-#ifndef _di_fss_read_process_normal_print_at_
-  extern void fss_read_process_normal_print_at(void * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
-#endif // _di_fss_read_process_normal_print_at_
-
-/**
- * Process buffer according to "read" parameter rules.
- *
- * @param main
- *   The program and settings data.
- *   Must be of type fss_read_main_t.
- *
- *   This alters main.setting.state.status:
- *     F_none on success.
- *
- *     Errors (with error bit) from: fss_read_signal_check().
- * @param names
- *   An array of booleans representing if the name at a given index is enabled.
- *   (If TRUE, then the name is to be used and if FALSE, then the name is not to be used.)
- *
- * @see fss_read_signal_check()
- */
-#ifndef _di_fss_read_process_normal_read_
-  extern void fss_read_process_normal_read(void * const main, const bool names[]);
-#endif // _di_fss_read_process_normal_read_
-
-/**
  * Process buffer according to "total" parameter rules.
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status:
index e4b668256757ef835733bfeff939a75413a3c3b8..156b59427c7b662cb08fdc0fdf72980d2516a75f 100644 (file)
@@ -26,6 +26,7 @@
  * @param main
  *   The program and settings data.
  *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  * @return
index 6033db7b76eb9f97655485d64dfe1ffaa962571f..618b1c407c236305fbfe36716130761cfff53460 100644 (file)
 #include <fll/level_2/print.h>
 #include <fll/level_2/program.h>
 
-// FSS Write includes.
+// FSS Read includes.
 #include <program/fss_read/main/common/define.h>
 #include <program/fss_read/main/common/enumeration.h>
 #include <program/fss_read/main/common/print.h>
+#include <program/fss_read/main/common/static.h>
 #include <program/fss_read/main/common/string.h>
 #include <program/fss_read/main/common/type.h>
 #include <program/fss_read/main/common.h>
-#include <program/fss_read/payload/common.h>
 #include <program/fss_read/main/print/error.h>
 #include <program/fss_read/main/print/message.h>
+#include <program/fss_read/main/process_normal.h>
+#include <program/fss_read/main/signal.h>
+#include <program/fss_read/main/thread.h>
+#include <program/fss_read/payload/common.h>
 #include <program/fss_read/payload/print.h>
 
 #ifdef __cplusplus
@@ -65,6 +69,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -82,6 +88,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status:
@@ -105,6 +113,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_read_main_t.
  *
  *   This alters main.setting.state.status:
index af54ccfebcb0343e92d3af2ada5bd091eca667f0..a629b5e73a5ab398a57f8728f243dcdb8a1e318c 100644 (file)
@@ -18,10 +18,26 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_payload_standard_s;
-  data.setting.process_help = &fss_read_payload_process_help;
-  data.setting.process_last_line = &fss_read_process_last_line;
-  data.setting.process_normal = &fss_read_process_normal;
-  data.setting.process_pipe = &fss_read_payload_process_pipe;
+
+  // @todo see if there needs to be this: data.callback.process_pipe = &fss_read_payload_process_pipe;
+  data.callback.process_help = &fss_read_payload_process_help;
+  data.callback.process_last_line = &fss_read_process_last_line;
+  //data.callback.process_load_depth = &fss_read_setting_load_depth;
+  data.callback.process_normal = &fss_read_process_normal;
+
+  //data.callback.process_at = &fss_read_process_normal_at;
+  //data.callback.process_columns = &fss_read_process_normal_columns;
+  //data.callback.process_line = &fss_read_process_normal_line;
+  //data.callback.process_load = &fss_read_basic_process_load;
+  //data.callback.process_name = &fss_read_process_normal_name;
+  //data.callback.process_total = &fss_read_process_normal_total;
+
+  //data.callback.print_at = &fss_read_print_at;
+  //data.callback.print_content = &fss_read_print_content;
+  //data.callback.print_content_ignore = &fss_read_print_content_ignore;
+  //data.callback.print_object = &fss_read_print_object;
+  //data.callback.print_object_end = &fss_read_print_object_end;
+  //data.callback.print_set_end = &fss_read_print_set_end;
 
   f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
index 3f0cdff5acdccd2a94c49b5bb4cfa6127baa7747..ffd9c101edfc8a409c4a2eea55b7a04bad3aa227 100644 (file)
@@ -10,11 +10,7 @@ extern "C" {
     if (!print) return F_status_set_error(F_output_not);
     if (!print || print->verbosity == f_console_verbosity_quiet_e) return F_output_not;
 
-    f_file_stream_lock(print->to);
-
-    fl_print_format("%r%[%QThe payload may only be specified last.%]%r", print->to, f_string_eol_s, print->set->error, print->prefix, print->set->error, f_string_eol_s);
-
-    f_file_stream_unlock(print->to);
+    fll_print_format("%r%[%QThe payload may only be specified last.%]%r", print->to, f_string_eol_s, print->set->error, print->prefix, print->set->error, f_string_eol_s);
 
     return F_none;
   }
index 7988c53582d0e7c97d199a21d36e83a14f00d60a..fb7a0c212e38c4e0437f6d8da637d5593f71f438 100644 (file)
@@ -37,7 +37,7 @@ build_libraries-individual_thread -lf_thread
 build_libraries-level -lfll_2 -lfll_1 -lfll_0
 build_libraries-monolithic -lfll
 
-build_sources_library main/fss_read.c main/common.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/string.c main/common/type.c main/print/error.c main/print/message.c main/process_normal.c main/signal.c main/thread.c
+build_sources_library main/fss_read.c main/common.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/static.c main/common/string.c main/common/type.c main/print/error.c main/print/message.c main/process_normal.c main/signal.c main/thread.c
 build_sources_library basic/fss_read.c basic/common.c basic/print.c
 build_sources_library basic_list/fss_read.c basic_list/common.c basic_list/print.c
 build_sources_library embedded_list/fss_read.c embedded_list/common.c embedded_list/print.c
@@ -45,7 +45,7 @@ build_sources_library extended/fss_read.c extended/common.c extended/print.c
 build_sources_library extended_list/fss_read.c extended_list/common.c extended_list/print.c
 build_sources_library payload/fss_read.c payload/common.c payload/print.c
 
-build_sources_headers main/fss_read.h main/common.h main/common/define.h main/common/enumeration.h main/common/print.h main/common/string.h main/common/type.h main/print/error.h main/print/message.h main/process_normal.h main/signal.h main/thread.h
+build_sources_headers main/fss_read.h main/common.h main/common/define.h main/common/enumeration.h main/common/print.h main/common/static.h main/common/string.h main/common/type.h main/print/error.h main/print/message.h main/process_normal.h main/signal.h main/thread.h
 build_sources_headers basic/fss_read.h basic/common.h basic/print.h basic/private-common.h
 build_sources_headers basic_list/fss_read.h basic_list/common.h basic_list/print.h
 build_sources_headers embedded_list/fss_read.h embedded_list/common.h embedded_list/print.h
index 93fdfa83a5f7b657fb4116c5ca1ef87baaf5af7f..c1b9e4b1e84d00053a936090506f8fe8a9f5a1ad 100644 (file)
@@ -50,9 +50,9 @@
 #include <program/fss_write/main/common/string.h>
 #include <program/fss_write/main/common/type.h>
 #include <program/fss_write/main/common.h>
-#include <program/fss_write/basic/common.h>
 #include <program/fss_write/main/print/error.h>
 #include <program/fss_write/main/print/message.h>
+#include <program/fss_write/basic/common.h>
 #include <program/fss_write/basic/print.h>
 
 #ifdef __cplusplus
@@ -64,6 +64,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status.
@@ -81,6 +83,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -98,6 +102,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status.
index 15d11d0554d3bff921626853c3bf65eeba09f76f..0e8f7130b14212ae20d9ab7badd612a7627e054a 100644 (file)
@@ -18,12 +18,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_write_basic_standard_s;
-  data.setting.process_content = &fss_write_basic_process_content;
-  data.setting.process_help = &fss_write_basic_process_help;
-  data.setting.process_normal = &fss_write_process_normal;
-  data.setting.process_object = &fss_write_basic_process_object;
-  data.setting.process_pipe = &fss_write_process_pipe;
-  data.setting.process_set = &fss_write_process_set;
+
+  data.callback.process_content = &fss_write_basic_process_content;
+  data.callback.process_help = &fss_write_basic_process_help;
+  data.callback.process_normal = &fss_write_process_normal;
+  data.callback.process_object = &fss_write_basic_process_object;
+  data.callback.process_pipe = &fss_write_process_pipe;
+  data.callback.process_set = &fss_write_process_set;
 
   f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
index b311f8d8a82fde4810d14c96eade4bea5b28152d..ff46c2d8f5bc249cfd7b4f7c41534844242d1ee3 100644 (file)
@@ -51,9 +51,9 @@
 #include <program/fss_write/main/common/string.h>
 #include <program/fss_write/main/common/type.h>
 #include <program/fss_write/main/common.h>
-#include <program/fss_write/basic_list/common.h>
 #include <program/fss_write/main/print/error.h>
 #include <program/fss_write/main/print/message.h>
+#include <program/fss_write/basic_list/common.h>
 #include <program/fss_write/basic_list/print.h>
 
 #ifdef __cplusplus
@@ -65,6 +65,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status.
@@ -82,6 +84,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -99,6 +103,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status.
index 7eb63a12ee5cee129ac5ee0bba2a11c6844b009f..58eab5755a97fa3575f06c2fd62fa3a1d1f3d7b7 100644 (file)
@@ -18,12 +18,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_write_basic_list_standard_s;
-  data.setting.process_content = &fss_write_basic_list_process_content;
-  data.setting.process_help = &fss_write_basic_list_process_help;
-  data.setting.process_normal = &fss_write_process_normal;
-  data.setting.process_object = &fss_write_basic_list_process_object;
-  data.setting.process_pipe = &fss_write_process_pipe;
-  data.setting.process_set = &fss_write_process_set;
+
+  data.callback.process_content = &fss_write_basic_list_process_content;
+  data.callback.process_help = &fss_write_basic_list_process_help;
+  data.callback.process_normal = &fss_write_process_normal;
+  data.callback.process_object = &fss_write_basic_list_process_object;
+  data.callback.process_pipe = &fss_write_process_pipe;
+  data.callback.process_set = &fss_write_process_set;
 
   f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
index ff1fe6d33779f9f8f47652d5b2fa6bafcd46caf7..68c44563be439c02a39c77c62a06c6a9c08dc5a8 100644 (file)
@@ -50,9 +50,9 @@
 #include <program/fss_write/main/common/string.h>
 #include <program/fss_write/main/common/type.h>
 #include <program/fss_write/main/common.h>
-#include <program/fss_write/embedded_list/common.h>
 #include <program/fss_write/main/print/error.h>
 #include <program/fss_write/main/print/message.h>
+#include <program/fss_write/embedded_list/common.h>
 #include <program/fss_write/embedded_list/print.h>
 
 #ifdef __cplusplus
@@ -64,6 +64,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status.
@@ -81,6 +83,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -98,6 +102,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status.
index 7d038638c12d598ddf84af8bd34c6ce790228576..4d12014e7da1a291e14a9a65b6c130528ba8b284 100644 (file)
@@ -16,17 +16,19 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.custom = (void *) &data;
   data.program.warning.custom = (void *) &data;
 
-  data.setting.state.custom = (void *) &data;
-  data.setting.standard = fss_write_embedded_list_standard_s;
-  data.setting.process_content = &fss_write_embedded_list_process_content;
-  data.setting.process_help = &fss_write_embedded_list_process_help;
-  data.setting.process_normal = &fss_write_process_normal;
-  data.setting.process_object = &fss_write_embedded_list_process_object;
-  data.setting.process_pipe = &fss_write_process_pipe;
-  data.setting.process_set = &fss_write_process_set;
   data.setting.flag |= fss_write_main_flag_ignore_e;
   data.setting.flag |= fss_write_main_flag_content_multiple_e;
 
+  data.setting.state.custom = (void *) &data;
+  data.setting.standard = fss_write_embedded_list_standard_s;
+
+  data.callback.process_content = &fss_write_embedded_list_process_content;
+  data.callback.process_help = &fss_write_embedded_list_process_help;
+  data.callback.process_normal = &fss_write_process_normal;
+  data.callback.process_object = &fss_write_embedded_list_process_object;
+  data.callback.process_pipe = &fss_write_process_pipe;
+  data.callback.process_set = &fss_write_process_set;
+
   f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
   data.program.parameters.array[fss_write_parameter_as_e].flag |= f_console_flag_disable_e;
index ecec6091639d32ef651b510194f91b1dbe561fdb..cc9e01caa4033d3b4d4758baae57212026769996 100644 (file)
@@ -50,9 +50,9 @@
 #include <program/fss_write/main/common/string.h>
 #include <program/fss_write/main/common/type.h>
 #include <program/fss_write/main/common.h>
-#include <program/fss_write/extended/common.h>
 #include <program/fss_write/main/print/error.h>
 #include <program/fss_write/main/print/message.h>
+#include <program/fss_write/extended/common.h>
 #include <program/fss_write/extended/print.h>
 
 #ifdef __cplusplus
@@ -64,6 +64,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status.
@@ -81,6 +83,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -98,6 +102,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status.
index 408ea35ff8e08c3b145cd5a37a506b02d7c5dfb1..c99ffa520895198d938ffa4f4ddf63673c217f75 100644 (file)
@@ -16,15 +16,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.custom = (void *) &data;
   data.program.warning.custom = (void *) &data;
 
+  data.setting.flag |= fss_write_main_flag_content_multiple_e;
+
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_write_extended_standard_s;
-  data.setting.process_content = &fss_write_extended_process_content;
-  data.setting.process_help = &fss_write_extended_process_help;
-  data.setting.process_normal = &fss_write_process_normal;
-  data.setting.process_object = &fss_write_extended_process_object;
-  data.setting.process_pipe = &fss_write_process_pipe;
-  data.setting.process_set = &fss_write_process_set;
-  data.setting.flag |= fss_write_main_flag_content_multiple_e;
+
+  data.callback.process_content = &fss_write_extended_process_content;
+  data.callback.process_help = &fss_write_extended_process_help;
+  data.callback.process_normal = &fss_write_process_normal;
+  data.callback.process_object = &fss_write_extended_process_object;
+  data.callback.process_pipe = &fss_write_process_pipe;
+  data.callback.process_set = &fss_write_process_set;
 
   f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
index 6742a8d93ff7c664f16d6d32ae0a67a4cb6359f6..c91afc8255bc8a3e0bcac1abe5556a1f8820d13f 100644 (file)
@@ -50,9 +50,9 @@
 #include <program/fss_write/main/common/string.h>
 #include <program/fss_write/main/common/type.h>
 #include <program/fss_write/main/common.h>
-#include <program/fss_write/extended_list/common.h>
 #include <program/fss_write/main/print/error.h>
 #include <program/fss_write/main/print/message.h>
+#include <program/fss_write/extended_list/common.h>
 #include <program/fss_write/extended_list/print.h>
 
 #ifdef __cplusplus
@@ -64,6 +64,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status.
@@ -81,6 +83,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -98,6 +102,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status.
index fa5d19fd2c299c9de7e04abde6b1f589937a503a..71d77dd620a9eb5749ebb818012f751ec9bcfc18 100644 (file)
@@ -18,14 +18,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_write_extended_list_standard_s;
-  data.setting.process_content = &fss_write_extended_list_process_content;
-  data.setting.process_help = &fss_write_extended_list_process_help;
-  data.setting.process_normal = &fss_write_process_normal;
-  data.setting.process_object = &fss_write_extended_list_process_object;
-  data.setting.process_pipe = &fss_write_process_pipe;
-  data.setting.process_set = &fss_write_process_set;
+
   data.setting.flag |= fss_write_main_flag_ignore_e;
 
+  data.callback.process_content = &fss_write_extended_list_process_content;
+  data.callback.process_help = &fss_write_extended_list_process_help;
+  data.callback.process_normal = &fss_write_process_normal;
+  data.callback.process_object = &fss_write_extended_list_process_object;
+  data.callback.process_pipe = &fss_write_process_pipe;
+  data.callback.process_set = &fss_write_process_set;
+
   f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
   data.program.parameters.array[fss_write_parameter_as_e].flag |= f_console_flag_disable_e;
index e2075a0c2886f12a01c3799f357078cd971e28e4..6870cb9b3e314972ae54356ad4993620b782f6ce 100644 (file)
@@ -19,7 +19,6 @@ extern "C" {
 
     if (!setting) return F_status_set_error(F_parameter);
 
-    f_string_dynamic_resize(0, &setting->escaped);
     f_string_dynamic_resize(0, &setting->block);
     f_string_dynamic_resize(0, &setting->buffer);
     f_string_dynamic_resize(0, &setting->prepend);
index 4a290bd5251470eea941ad5bc46073a08e4aa2c7..6754cb5c2f1c97068359861893b448c041c9b6a0 100644 (file)
@@ -17,6 +17,37 @@ extern "C" {
 #endif
 
 /**
+ * The FSS write callbacks.
+ *
+ * process_content: Process a single Content.
+ * process_help:    Process help (generally printing help).
+ * process_normal:  Process normally (data from parameters and files).
+ * process_object:  Process a single Object.
+ * process_pipe:    Process using the data from input pipe.
+ * process_set:     Process a set of Object and one or more Content.
+ */
+#ifndef _di_fss_write_callback_t_
+  typedef struct {
+    void (*process_content)(void * const main, const bool last);
+    void (*process_help)(void * const main);
+    void (*process_normal)(void * const main);
+    void (*process_object)(void * const main);
+    void (*process_pipe)(void * const main);
+    void (*process_set)(void * const main);
+  } fss_write_callback_t;
+
+  #define fss_write_callback_t_initialize \
+    { \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+    }
+#endif // _di_fss_write_callback_t_
+
+/**
  * The fss write main program settings.
  *
  * This is passed to the program-specific main entry point to designate program settings.
@@ -46,13 +77,6 @@ extern "C" {
  * object:   A pointer to a specific Object used during processing.
  * content:  A pointer to a specific Content used during processing.
  * contents: A pointer to a specific set of Content used during processing.
- *
- * process_content: Process a single Content.
- * process_help:    Process help (generally printing help).
- * process_normal:  Process normally (data from parameters and files).
- * process_object:  Process a single Object.
- * process_pipe:    Process using the data from input pipe.
- * process_set:     Process a set of Object and one or more Content.
  */
 #ifndef _di_fss_write_setting_t_
   typedef struct {
@@ -66,7 +90,6 @@ extern "C" {
     f_string_static_t quote;
     f_string_static_t standard;
 
-    f_string_dynamic_t escaped;
     f_string_dynamic_t block;
     f_string_dynamic_t buffer;
     f_string_dynamic_t prepend;
@@ -79,13 +102,6 @@ extern "C" {
     f_string_static_t *object;
     f_string_static_t *content;
     f_string_statics_t *contents;
-
-    void (*process_content)(void * const main, const bool last);
-    void (*process_help)(void * const main);
-    void (*process_normal)(void * const main);
-    void (*process_object)(void * const main);
-    void (*process_pipe)(void * const main);
-    void (*process_set)(void * const main);
   } fss_write_setting_t;
 
   #define fss_write_setting_t_initialize \
@@ -99,7 +115,6 @@ extern "C" {
       f_string_dynamic_t_initialize, \
       f_string_dynamic_t_initialize, \
       f_string_dynamic_t_initialize, \
-      f_string_dynamic_t_initialize, \
       f_string_rangess_t_initialize, \
       f_string_dynamics_t_initialize, \
       f_string_dynamicss_t_initialize, \
@@ -107,29 +122,26 @@ extern "C" {
       0, \
       0, \
       0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
     }
 #endif // _di_fss_write_setting_t_
 
 /**
  * The main program data as a single structure.
  *
- * program: The main program data.
- * setting: The settings data.
+ * callback: The callback data.
+ * program:  The main program data.
+ * setting:  The settings data.
  */
 #ifndef _di_fss_write_main_t_
   typedef struct {
+    fss_write_callback_t callback;
     fll_program_data_t program;
     fss_write_setting_t setting;
   } fss_write_main_t;
 
   #define fss_write_main_t_initialize \
     { \
+      fss_write_callback_t_initialize, \
       fll_program_data_t_initialize, \
       fss_write_setting_t_initialize, \
     }
index 17208c05f0c122b809f3b985914ea4a38af4f504..a85cce6b5796215c4882bfcc940bcfec42f1fec6 100644 (file)
@@ -27,8 +27,8 @@ extern "C" {
 
     if (main->setting.flag & (fss_write_main_flag_help_e | fss_write_main_flag_version_e | fss_write_main_flag_copyright_e)) {
       if (main->setting.flag & fss_write_main_flag_help_e) {
-        if (main->setting.process_help) {
-          main->setting.process_help(void_main);
+        if (main->callback.process_help) {
+          main->callback.process_help(void_main);
         }
         else {
           fss_write_print_message_help(&main->program.message);
@@ -48,18 +48,16 @@ extern "C" {
       return;
     }
 
-    main->setting.escaped.used = 0;
-
     if (main->program.pipe & fll_program_data_pipe_input_e) {
-      if (main->setting.process_pipe) {
-        main->setting.process_pipe(void_main);
+      if (main->callback.process_pipe) {
+        main->callback.process_pipe(void_main);
       }
     }
 
     if (F_status_is_error_not(main->setting.state.status)) {
       if (main->setting.flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e | fss_write_main_flag_object_open_e | fss_write_main_flag_content_next_e | fss_write_main_flag_content_end_e)) {
-        if (main->setting.process_normal) {
-          main->setting.process_normal(void_main);
+        if (main->callback.process_normal) {
+          main->callback.process_normal(void_main);
         }
       }
     }
@@ -122,7 +120,7 @@ extern "C" {
           main->setting.ignores = &main->setting.ignoress.array[i];
         }
 
-        main->setting.process_set(void_main);
+        main->callback.process_set(void_main);
         if (F_status_is_error(main->setting.state.status)) break;
       } // for
     }
@@ -132,7 +130,7 @@ extern "C" {
         main->setting.contents = 0;
         main->setting.ignores = 0;
 
-        main->setting.process_set(void_main);
+        main->callback.process_set(void_main);
       }
     }
   }
@@ -145,7 +143,7 @@ extern "C" {
 
     fss_write_main_t * const main = (fss_write_main_t *) void_main;
 
-    if (!main->setting.process_set) return;
+    if (!main->callback.process_set) return;
 
     if (main->program.message.verbosity > f_console_verbosity_error_e) {
       fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
@@ -416,7 +414,7 @@ extern "C" {
 
       // End Object or Content set.
       if (state == 0x3) {
-        main->setting.process_set(void_main);
+        main->callback.process_set(void_main);
         if (F_status_is_error(main->setting.state.status)) break;
 
         state = 0;
@@ -433,7 +431,7 @@ extern "C" {
 
     // If the pipe ended before finishing, then attempt to wrap up.
     if (F_status_is_error_not(main->setting.state.status) && status_pipe == F_none_eof && state) {
-      main->setting.process_set(void_main);
+      main->callback.process_set(void_main);
 
       flag |= 0x1;
     }
@@ -475,15 +473,15 @@ extern "C" {
         }
       }
 
-      if (main->setting.process_object) {
-        main->setting.process_object(void_main);
+      if (main->callback.process_object) {
+        main->callback.process_object(void_main);
         if (F_status_is_error(main->setting.state.status)) return;
       }
     }
 
     if ((!(main->setting.flag & fss_write_main_flag_partial_e) || (main->setting.flag & fss_write_main_flag_partial_e) && (main->setting.flag & fss_write_main_flag_content_e)) && main->setting.contents || (main->setting.flag & (fss_write_main_flag_content_next_e | fss_write_main_flag_content_end_e))) {
 
-      if (main->setting.process_content) {
+      if (main->callback.process_content) {
         if (main->setting.contents && main->setting.contents->used) {
           for (f_array_length_t i = 0; i < main->setting.contents->used; ++i) {
 
@@ -498,14 +496,14 @@ extern "C" {
 
             main->setting.content = &main->setting.contents->array[i];
 
-            main->setting.process_content(void_main, i + 1 == main->setting.contents->used);
+            main->callback.process_content(void_main, i + 1 == main->setting.contents->used);
             if (F_status_is_error(main->setting.state.status)) return;
           } // for
         }
         else {
           main->setting.content = 0;
 
-          main->setting.process_content(void_main, F_true);
+          main->callback.process_content(void_main, F_true);
           if (F_status_is_error(main->setting.state.status)) return;
         }
       }
index d10765074a4b8b39825bf7bc1614311858a3d865..d4b2725e23a6593e964a915e9080fe1e770fbd44 100644 (file)
 #include <program/fss_write/main/common/string.h>
 #include <program/fss_write/main/common/type.h>
 #include <program/fss_write/main/common.h>
-#include <program/fss_write/basic/common.h>
 #include <program/fss_write/main/print/error.h>
 #include <program/fss_write/main/print/message.h>
-#include <program/fss_write/basic/print.h>
 #include <program/fss_write/main/signal.h>
 #include <program/fss_write/main/thread.h>
 
@@ -77,6 +75,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.custom.setting.state.status:
@@ -96,6 +96,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.custom.setting.state.status:
@@ -114,6 +116,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.custom.setting.state.status:
@@ -131,6 +135,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status:
@@ -150,6 +156,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status:
index 592b32a4ef13575e80ea1909398eabbf37405cc4..f9e2d5bc9c8bf3eac123012112584223a96113b3 100644 (file)
@@ -96,12 +96,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
     if (!main || F_status_is_error(main->setting.state.status) || (main->setting.flag & fss_write_main_flag_version_e)) return;
 
     main->setting.standard = fss_write_basic_standard_s;
-    main->setting.process_content = &fss_write_basic_process_content;
-    main->setting.process_help = &fss_write_main_process_help;
-    main->setting.process_normal = &fss_write_process_normal;
-    main->setting.process_object = &fss_write_basic_process_object;
-    main->setting.process_pipe = &fss_write_process_pipe;
-    main->setting.process_set = &fss_write_process_set;
+
+    main->callback.process_content = &fss_write_basic_process_content;
+    main->callback.process_help = &fss_write_main_process_help;
+    main->callback.process_normal = &fss_write_process_normal;
+    main->callback.process_object = &fss_write_basic_process_object;
+    main->callback.process_pipe = &fss_write_process_pipe;
+    main->callback.process_set = &fss_write_process_set;
 
     if (main->program.parameters.array[fss_write_parameter_as_e].result & f_console_result_value_e && main->program.parameters.array[fss_write_parameter_as_e].values.used) {
 
@@ -118,14 +119,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
             f_compare_dynamic(argv[index], fss_write_format_code_machine_0000_s) == F_equal_to) {
 
           main->setting.standard = fss_write_basic_standard_s;
-          main->setting.process_content = &fss_write_basic_process_content;
-          main->setting.process_help = &fss_write_basic_process_help;
-          main->setting.process_object = &fss_write_basic_process_object;
-          main->setting.process_pipe = &fss_write_process_pipe;
-          main->setting.process_normal = &fss_write_process_normal;
-          main->setting.process_set = &fss_write_process_set;
+
           main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e; // Not supported by basic.
           main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e; // Not supported by basic.
+
+          main->callback.process_content = &fss_write_basic_process_content;
+          main->callback.process_help = &fss_write_basic_process_help;
+          main->callback.process_object = &fss_write_basic_process_object;
+          main->callback.process_pipe = &fss_write_process_pipe;
+          main->callback.process_normal = &fss_write_process_normal;
+          main->callback.process_set = &fss_write_process_set;
         }
         else if (f_compare_dynamic(argv[index], fss_write_format_code_short_0001_s) == F_equal_to ||
                  f_compare_dynamic(argv[index], fss_write_format_code_long_0001_s) == F_equal_to ||
@@ -133,14 +136,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
                  f_compare_dynamic(argv[index], fss_write_format_code_machine_0001_s) == F_equal_to) {
 
           main->setting.standard = fss_write_extended_standard_s;
-          main->setting.process_content = &fss_write_extended_process_content;
-          main->setting.process_help = &fss_write_extended_process_help;
-          main->setting.process_object = &fss_write_extended_process_object;
-          main->setting.process_pipe = &fss_write_process_pipe;
-          main->setting.process_normal = &fss_write_process_normal;
-          main->setting.process_set = &fss_write_process_set;
+
           main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e; // Not supported by extended.
           main->setting.flag |= fss_write_main_flag_content_multiple_e;
+
+          main->callback.process_content = &fss_write_extended_process_content;
+          main->callback.process_help = &fss_write_extended_process_help;
+          main->callback.process_object = &fss_write_extended_process_object;
+          main->callback.process_pipe = &fss_write_process_pipe;
+          main->callback.process_normal = &fss_write_process_normal;
+          main->callback.process_set = &fss_write_process_set;
         }
         else if (f_compare_dynamic(argv[index], fss_write_format_code_short_0002_s) == F_equal_to ||
                  f_compare_dynamic(argv[index], fss_write_format_code_long_0002_s) == F_equal_to ||
@@ -148,14 +153,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
                  f_compare_dynamic(argv[index], fss_write_format_code_machine_0002_s) == F_equal_to) {
 
           main->setting.standard = fss_write_basic_list_standard_s;
-          main->setting.process_content = &fss_write_basic_list_process_content;
-          main->setting.process_help = &fss_write_basic_list_process_help;
-          main->setting.process_object = &fss_write_basic_list_process_object;
-          main->setting.process_pipe = &fss_write_process_pipe;
-          main->setting.process_normal = &fss_write_process_normal;
-          main->setting.process_set = &fss_write_process_set;
+
           main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e; // Not supported by basic list.
           main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e; // Not supported by basic list.
+
+          main->callback.process_content = &fss_write_basic_list_process_content;
+          main->callback.process_help = &fss_write_basic_list_process_help;
+          main->callback.process_object = &fss_write_basic_list_process_object;
+          main->callback.process_pipe = &fss_write_process_pipe;
+          main->callback.process_normal = &fss_write_process_normal;
+          main->callback.process_set = &fss_write_process_set;
         }
         else if (f_compare_dynamic(argv[index], fss_write_format_code_short_0003_s) == F_equal_to ||
                  f_compare_dynamic(argv[index], fss_write_format_code_long_0003_s) == F_equal_to ||
@@ -163,14 +170,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
                  f_compare_dynamic(argv[index], fss_write_format_code_machine_0003_s) == F_equal_to) {
 
           main->setting.standard = fss_write_extended_list_standard_s;
-          main->setting.process_content = &fss_write_extended_list_process_content;
-          main->setting.process_help = &fss_write_extended_list_process_help;
-          main->setting.process_object = &fss_write_extended_list_process_object;
-          main->setting.process_pipe = &fss_write_process_pipe;
-          main->setting.process_normal = &fss_write_process_normal;
-          main->setting.process_set = &fss_write_process_set;
+
           main->setting.flag |= fss_write_main_flag_ignore_e;
           main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e; // Not supported by extended list.
+
+          main->callback.process_content = &fss_write_extended_list_process_content;
+          main->callback.process_help = &fss_write_extended_list_process_help;
+          main->callback.process_object = &fss_write_extended_list_process_object;
+          main->callback.process_pipe = &fss_write_process_pipe;
+          main->callback.process_normal = &fss_write_process_normal;
+          main->callback.process_set = &fss_write_process_set;
         }
         else if (f_compare_dynamic(argv[index], fss_write_format_code_short_0008_s) == F_equal_to ||
                  f_compare_dynamic(argv[index], fss_write_format_code_long_0008_s) == F_equal_to ||
@@ -178,14 +187,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
                  f_compare_dynamic(argv[index], fss_write_format_code_machine_0008_s) == F_equal_to) {
 
           main->setting.standard = fss_write_embedded_list_standard_s;
-          main->setting.process_content = &fss_write_embedded_list_process_content;
-          main->setting.process_help = &fss_write_embedded_list_process_help;
-          main->setting.process_object = &fss_write_embedded_list_process_object;
-          main->setting.process_pipe = &fss_write_process_pipe;
-          main->setting.process_normal = &fss_write_process_normal;
-          main->setting.process_set = &fss_write_process_set;
+
           main->setting.flag |= fss_write_main_flag_ignore_e;
           main->setting.flag |= fss_write_main_flag_content_multiple_e;
+
+          main->callback.process_content = &fss_write_embedded_list_process_content;
+          main->callback.process_help = &fss_write_embedded_list_process_help;
+          main->callback.process_object = &fss_write_embedded_list_process_object;
+          main->callback.process_pipe = &fss_write_process_pipe;
+          main->callback.process_normal = &fss_write_process_normal;
+          main->callback.process_set = &fss_write_process_set;
         }
         else if (f_compare_dynamic(argv[index], fss_write_format_code_short_000e_s) == F_equal_to ||
                  f_compare_dynamic(argv[index], fss_write_format_code_long_000e_s) == F_equal_to ||
@@ -193,14 +204,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
                  f_compare_dynamic(argv[index], fss_write_format_code_machine_000e_s) == F_equal_to) {
 
           main->setting.standard = fss_write_payload_standard_s;
-          main->setting.process_content = 0; // Not used by payload.
-          main->setting.process_help = &fss_write_payload_process_help;
-          main->setting.process_normal = &fss_write_process_normal;
-          main->setting.process_object = 0; // Not used by payload.
-          main->setting.process_pipe = &fss_write_payload_process_pipe;
-          main->setting.process_set = &fss_write_payload_process_set;
+
           main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e; // Not supported by payload.
           main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e; // Not supported by payload.
+
+          main->callback.process_content = 0;
+          main->callback.process_help = &fss_write_payload_process_help;
+          main->callback.process_normal = &fss_write_process_normal;
+          main->callback.process_object = 0;
+          main->callback.process_pipe = &fss_write_payload_process_pipe;
+          main->callback.process_set = &fss_write_payload_process_set;
         }
         else {
           if (main->setting.flag & fss_write_main_flag_help_e) {
index f46764634b4796b90946020add2311fee7d5b2f9..f7e5fa50b5bff36b3b56cfde0df8d2e37f3baa4c 100644 (file)
@@ -36,6 +36,8 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp);
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This does not alter main.setting.state.status.
index 9ac3fd58ba58b74f0808a448a4e254c0e33340cf..8aa5dc588c137062ab6e241a3bdd8e87081714f4 100644 (file)
@@ -51,9 +51,9 @@
 #include <program/fss_write/main/common/string.h>
 #include <program/fss_write/main/common/type.h>
 #include <program/fss_write/main/common.h>
-#include <program/fss_write/payload/common.h>
 #include <program/fss_write/main/print/error.h>
 #include <program/fss_write/main/print/message.h>
+#include <program/fss_write/payload/common.h>
 #include <program/fss_write/payload/print.h>
 
 #ifdef __cplusplus
@@ -65,6 +65,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This does not alter main.setting.state.status.
@@ -82,6 +84,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status:
@@ -101,6 +105,8 @@ extern "C" {
  *
  * @param main
  *   The program and settings data.
+ *
+ *   Must not be NULL.
  *   Must be of type fss_write_main_t.
  *
  *   This alters main.setting.state.status:
index 9fa4273e0e54bad4deaca7aa4231c35c3c1d418a..9e2bd11712321754ba6fa5cc8ea76b78529e8745 100644 (file)
@@ -18,12 +18,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_write_payload_standard_s;
-  data.setting.process_content = 0; // Not used by payload.
-  data.setting.process_help = &fss_write_payload_process_help;
-  data.setting.process_normal = &fss_write_process_normal;
-  data.setting.process_object = 0; // Not used by payload.
-  data.setting.process_pipe = &fss_write_payload_process_pipe;
-  data.setting.process_set = &fss_write_payload_process_set;
+
+  data.callback.process_content = 0;
+  data.callback.process_help = &fss_write_payload_process_help;
+  data.callback.process_normal = &fss_write_process_normal;
+  data.callback.process_object = 0;
+  data.callback.process_pipe = &fss_write_payload_process_pipe;
+  data.callback.process_set = &fss_write_payload_process_set;
 
   f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
   data.program.parameters.array = parameters;