]> Kevux Git Server - fll/commitdiff
Progress: Continue work on refactoring fss_*_read into fss_read.
authorKevin Day <kevin@kevux.org>
Fri, 26 May 2023 04:23:07 +0000 (23:23 -0500)
committerKevin Day <kevin@kevux.org>
Fri, 26 May 2023 04:23:07 +0000 (23:23 -0500)
This gets the programs compiling.
I decided not to get everything correct and instead decided to get everything compiling.

The memory allocation needs to be fixed.
There are a lot of fixme and todo comments to address.
The payload and embedded list need special handling and are very much not implemented.
Individual standard differences need to be handled (and some are stubbed out or copied over, making them invalid).

45 files changed:
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/print.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/basic_list/print.c
level_3/fss_read/c/basic_list/print.h
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/embedded_list/print.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/print.c
level_3/fss_read/c/extended/print.h
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/extended_list/print.c
level_3/fss_read/c/extended_list/print.h
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/string.c
level_3/fss_read/c/main/common/string.h
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/main.c
level_3/fss_read/c/main/main/print.c
level_3/fss_read/c/main/print/data.c
level_3/fss_read/c/main/print/data.h
level_3/fss_read/c/main/print/message.c
level_3/fss_read/c/main/process_normal.c
level_3/fss_read/c/payload/fss_read.c
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_write/c/main/main.c
level_3/fss_write/c/payload/main.c

index de01cdd3de0f4576d3d641ba053cc2dfec2f52c6..e29857a63b94865f57319228ee4fd35524f12fc5 100644 (file)
@@ -15,18 +15,29 @@ extern "C" {
 #endif // _di_fss_read_basic_process_help_
 
 #ifndef _di_fss_read_basic_process_load_
-  void fss_read_basic_process_load(fss_read_main_t * const main) {
+  void fss_read_basic_process_load(void * const void_main) {
 
-    if (!main) return;
+    if (!void_main) return;
+
+    fss_read_main_t * const main = (fss_read_main_t *) void_main;
 
-    f_string_range_t input = macro_f_string_range_t_initialize_2(main->setting.buffer.used);
+    if (main->setting.buffer.used) {
+      main->setting.range.start = 0;
+      main->setting.range.stop = main->setting.buffer.used;
+    }
+    else {
+      main->setting.range.start = 1;
+      main->setting.range.stop = 0;
+    }
 
+    main->setting.comments.used = 0;
     main->setting.delimits_object.used = 0;
     main->setting.delimits_content.used = 0;
+    main->setting.nest.used = 0;
     main->setting.quotes_object.used = 0;
     main->setting.quotes_content.used = 0;
 
-    fll_fss_basic_read(main->setting.buffer, &input, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.state);
+    fll_fss_basic_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.state);
 
     if (F_status_is_error(main->setting.state.status)) {
       if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
@@ -36,7 +47,7 @@ extern "C" {
         F_status_set_fine(main->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),
+        fss_read_file_identify(main->setting.range.start, main->setting.files),
         f_file_operation_process_s,
         fll_error_file_type_file_e
       );
index 8775908059b2fd52c194e076a25e0e57d97b556c..3d8973549912c22efebe329e8b23247ec98ddc34 100644 (file)
@@ -93,6 +93,7 @@ extern "C" {
  *   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.
@@ -107,7 +108,7 @@ extern "C" {
  * @see fss_read_file_identify()
  */
 #ifndef _di_fss_read_basic_process_load_
-  extern void fss_read_basic_process_load(fss_read_main_t * const main);
+  extern void fss_read_basic_process_load(void * const main);
 #endif // _di_fss_read_basic_process_load_
 
 #ifdef __cplusplus
index 7f7d1821afdc62c22f9d5d755389c55f7c3d79f5..a46a8f71ff70cb6e7a0939f99d14eb7a73d04022 100644 (file)
@@ -10,13 +10,15 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.flag |= fss_read_print_flag_out_e;
   data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
   data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
   data.program.error.custom = (void *) &data;
   data.program.debug.custom = (void *) &data;
   data.program.message.custom = (void *) &data;
   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.flag |= fss_read_main_flag_line_single_e;
+  data.setting.flag |= fss_read_main_flag_quote_content_e | fss_read_main_flag_quote_object_e;
 
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_basic_standard_s;
index d3eee9e1c0a6d70274c67efbc3c8c3cd190c7fa2..e71324a3cafe068cb8e4ae8b7b0171e90a380aae 100644 (file)
@@ -19,6 +19,8 @@ extern "C" {
 
     fll_program_print_help_usage(print, fss_read_basic_program_name_s, f_string_empty_s);
 
+    f_print_dynamic_raw(f_string_eol_s, print->to);
+
     fss_read_print_message_help_note_header(print, fss_read_format_code_short_0000_s, fss_read_format_code_name_0000_s);
 
     fss_read_print_message_help_pipe(print);
index cef2b09e6c85d5090723acb9568298e230ee4984..36574dde1cad28c5f327345cc5b1a8ed3cb81315 100644 (file)
@@ -14,6 +14,59 @@ extern "C" {
   }
 #endif // _di_fss_read_basic_list_process_help_
 
+#ifndef _di_fss_read_basic_list_process_load_
+  void fss_read_basic_list_process_load(void * const void_main) {
+
+    if (!void_main) return;
+
+    fss_read_main_t * const main = (fss_read_main_t *) void_main;
+
+    if (main->setting.buffer.used) {
+      main->setting.range.start = 0;
+      main->setting.range.stop = main->setting.buffer.used;
+    }
+    else {
+      main->setting.range.start = 1;
+      main->setting.range.stop = 0;
+    }
+
+    main->setting.comments.used = 0;
+    main->setting.delimits_object.used = 0;
+    main->setting.delimits_content.used = 0;
+    main->setting.nest.used = 0;
+    main->setting.quotes_object.used = 0;
+    main->setting.quotes_content.used = 0;
+
+    fll_fss_basic_list_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state);
+
+    if (F_status_is_error(main->setting.state.status)) {
+      if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+
+      fll_error_file_print(
+        &main->program.error,
+        F_status_set_fine(main->setting.state.status),
+        macro_fss_read_f(fll_fss_basic_list_read),
+        fll_error_file_flag_fallback_e,
+        fss_read_file_identify(main->setting.range.start, main->setting.files),
+        f_file_operation_process_s,
+        fll_error_file_type_file_e
+      );
+
+      return;
+    }
+
+    if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {
+      if (!(main->setting.flag & fss_read_main_flag_total_e)) {
+        main->setting.state.status = F_status_set_warning(main->setting.state.status);
+
+        return;
+      }
+    }
+
+    main->setting.state.status = F_none;
+  }
+#endif // _di_fss_read_basic_list_process_load_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 08f31a92eb6a9d9d24a0c69c468e130211fe46bf..5ff936b8a3c43c84c0afa6c73391fd7038136260 100644 (file)
@@ -84,6 +84,33 @@ extern "C" {
   extern void fss_read_basic_list_process_help(void * const main);
 #endif // _di_fss_read_basic_list_process_help_
 
+/**
+ * Process the buffer, loading the FSS data.
+ *
+ * This will print an error message on error.
+ *
+ * @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.
+ *
+ *     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_list_read()
+ *
+ * @see fll_fss_basic_list_read()
+ *
+ * @see fss_read_file_identify()
+ */
+#ifndef _di_fss_read_basic_list_process_load_
+  extern void fss_read_basic_list_process_load(void * const main);
+#endif // _di_fss_read_basic_list_process_load_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index f3739229752b981b651e5a36440db35e1ce27e39..d12db003ca8810920720f146cd47bcd7655b4609 100644 (file)
@@ -10,33 +10,36 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.flag |= fss_read_print_flag_out_e;
   data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
   data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
   data.program.error.custom = (void *) &data;
   data.program.debug.custom = (void *) &data;
   data.program.message.custom = (void *) &data;
   data.program.output.custom = (void *) &data;
   data.program.warning.custom = (void *) &data;
 
+  data.setting.flag |= fss_read_main_flag_trim_object_e;
+
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_basic_list_standard_s;
 
   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_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;
+  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_list_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_basic_list_print_object_end;
+  data.callback.print_set_end = &fss_read_print_set_end_no_eol;
 
   f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
index 66f64e455677f4c2f2272b601e172f4fadba1fe6..21c45d54b1e823d1166aea5c9c0a84c9ee3bbee5 100644 (file)
@@ -19,6 +19,8 @@ extern "C" {
 
     fll_program_print_help_usage(print, fss_read_basic_list_program_name_s, f_string_empty_s);
 
+    f_print_dynamic_raw(f_string_eol_s, print->to);
+
     fss_read_print_message_help_note_header(print, fss_read_format_code_short_0002_s, fss_read_format_code_name_0002_s);
 
     fss_read_print_message_help_pipe(print);
@@ -32,6 +34,34 @@ extern "C" {
   }
 #endif // _di_fss_read_basic_list_print_help_
 
+#ifndef _di_fss_read_basic_list_print_object_end_
+  f_status_t fss_read_basic_list_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;
+
+    f_file_stream_lock(print->to);
+
+    if (main->setting.flag & fss_read_main_flag_pipe_e) {
+      f_print_dynamic_raw(fss_read_pipe_content_start_s, print->to);
+    }
+    else {
+      if (main->setting.flag & fss_read_main_flag_content_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);
+      }
+    }
+
+    f_file_stream_unlock(print->to);
+
+    return F_none;
+  }
+#endif // _di_fss_read_basic_list_print_object_end_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 6115a2c9060d7891997b571cc4ecf68d602704b4..f99fb8be7927f8a40ac454e6651e18619f63039e 100644 (file)
@@ -30,6 +30,32 @@ extern "C" {
   extern f_status_t fss_read_basic_list_print_help(fl_print_t * const print);
 #endif // _di_fss_read_basic_list_print_help_
 
+/**
+ * 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 f_file_stream_lock()
+ * @see f_file_stream_unlock()
+ * @see f_print_dynamic_raw()
+ */
+#ifndef _di_fss_read_basic_list_print_object_end_
+  extern f_status_t fss_read_basic_list_print_object_end(fl_print_t * const print);
+#endif // _di_fss_read_basic_list_print_object_end_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 1c1e944a0a78bedc20fed0648ed94999662d18ed..e6a1434f3aa074e2ef27aa6a3ce6c1e4b8d655d8 100644 (file)
@@ -14,6 +14,59 @@ extern "C" {
   }
 #endif // _di_fss_read_embedded_list_process_help_
 
+#ifndef _di_fss_read_embedded_list_process_load_
+  void fss_read_embedded_list_process_load(void * const void_main) {
+
+    if (!void_main) return;
+
+    fss_read_main_t * const main = (fss_read_main_t *) void_main;
+
+    if (main->setting.buffer.used) {
+      main->setting.range.start = 0;
+      main->setting.range.stop = main->setting.buffer.used;
+    }
+    else {
+      main->setting.range.start = 1;
+      main->setting.range.stop = 0;
+    }
+
+    main->setting.comments.used = 0;
+    main->setting.delimits_object.used = 0;
+    main->setting.delimits_content.used = 0;
+    main->setting.nest.used = 0;
+    main->setting.quotes_object.used = 0;
+    main->setting.quotes_content.used = 0;
+
+    fll_fss_embedded_list_read(main->setting.buffer, &main->setting.range, &main->setting.nest, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state);
+
+    if (F_status_is_error(main->setting.state.status)) {
+      if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+
+      fll_error_file_print(
+        &main->program.error,
+        F_status_set_fine(main->setting.state.status),
+        macro_fss_read_f(fll_fss_embedded_list_read),
+        fll_error_file_flag_fallback_e,
+        fss_read_file_identify(main->setting.range.start, main->setting.files),
+        f_file_operation_process_s,
+        fll_error_file_type_file_e
+      );
+
+      return;
+    }
+
+    if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {
+      if (!(main->setting.flag & fss_read_main_flag_total_e)) {
+        main->setting.state.status = F_status_set_warning(main->setting.state.status);
+
+        return;
+      }
+    }
+
+    main->setting.state.status = F_none;
+  }
+#endif // _di_fss_read_embedded_list_process_load_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index a41e739e65458bafab6c0107a56c66c5c40e9366..ea7b932cd68270c5bcb80cd1f2d171afab90833a 100644 (file)
@@ -84,6 +84,33 @@ extern "C" {
   extern void fss_read_embedded_list_process_help(void * const main);
 #endif // _di_fss_read_embedded_list_process_help_
 
+/**
+ * Process the buffer, loading the FSS data.
+ *
+ * This will print an error message on error.
+ *
+ * @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.
+ *
+ *     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_embedded_list_read()
+ *
+ * @see fll_fss_embedded_list_read()
+ *
+ * @see fss_read_file_identify()
+ */
+#ifndef _di_fss_read_embedded_list_process_load_
+  extern void fss_read_embedded_list_process_load(void * const main);
+#endif // _di_fss_read_embedded_list_process_load_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 7eb92514e9ac986283896c2e7329f0791a356fbf..f07e183bb24c9d0b29da0de7a0e9eec8832f39ff 100644 (file)
@@ -10,37 +10,36 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.flag |= fss_read_print_flag_out_e;
   data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
   data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
   data.program.error.custom = (void *) &data;
   data.program.debug.custom = (void *) &data;
   data.program.message.custom = (void *) &data;
   data.program.output.custom = (void *) &data;
   data.program.warning.custom = (void *) &data;
 
+  data.setting.flag |= fss_read_main_flag_depth_multiple_e;
+
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_embedded_list_standard_s;
 
-  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_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;
+  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_embedded_list_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 bac7ecf7b3f946044ecb894699d1bddbe24f79e6..5ea1df981817337b3e280a8f82071b26e3b79d03 100644 (file)
@@ -19,6 +19,8 @@ extern "C" {
 
     fll_program_print_help_usage(print, fss_read_embedded_list_program_name_s, f_string_empty_s);
 
+    f_print_dynamic_raw(f_string_eol_s, print->to);
+
     fss_read_print_message_help_note_header(print, fss_read_format_code_short_0008_s, fss_read_format_code_name_0008_s);
 
     fss_read_print_message_help_pipe(print);
index 899e67f34cf02f0d35bf06a3f093a00ba04dae71..d79b7bb71c7a4e42ad11d13b423c35d88288c6cb 100644 (file)
@@ -14,6 +14,59 @@ extern "C" {
   }
 #endif // _di_fss_read_extended_process_help_
 
+#ifndef _di_fss_read_extended_process_load_
+  void fss_read_extended_process_load(void * const void_main) {
+
+    if (!void_main) return;
+
+    fss_read_main_t * const main = (fss_read_main_t *) void_main;
+
+    if (main->setting.buffer.used) {
+      main->setting.range.start = 0;
+      main->setting.range.stop = main->setting.buffer.used;
+    }
+    else {
+      main->setting.range.start = 1;
+      main->setting.range.stop = 0;
+    }
+
+    main->setting.comments.used = 0;
+    main->setting.delimits_object.used = 0;
+    main->setting.delimits_content.used = 0;
+    main->setting.nest.used = 0;
+    main->setting.quotes_object.used = 0;
+    main->setting.quotes_content.used = 0;
+
+    fll_fss_extended_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.quotes_content, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.state);
+
+    if (F_status_is_error(main->setting.state.status)) {
+      if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+
+      fll_error_file_print(
+        &main->program.error,
+        F_status_set_fine(main->setting.state.status),
+        macro_fss_read_f(fll_fss_extended_read),
+        fll_error_file_flag_fallback_e,
+        fss_read_file_identify(main->setting.range.start, main->setting.files),
+        f_file_operation_process_s,
+        fll_error_file_type_file_e
+      );
+
+      return;
+    }
+
+    if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {
+      if (!(main->setting.flag & fss_read_main_flag_total_e)) {
+        main->setting.state.status = F_status_set_warning(main->setting.state.status);
+
+        return;
+      }
+    }
+
+    main->setting.state.status = F_none;
+  }
+#endif // _di_fss_read_extended_process_load_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index dd5ac8661bb05acbe3f6547a31bc270ba7cb256e..477f27b23e965bcc6b89a40805f2db7e44507291 100644 (file)
@@ -104,18 +104,31 @@ extern "C" {
 #endif // _di_fss_read_extended_process_help_
 
 /**
- * Process a single Object, printing the FSS-0001 (Extended) 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 not be NULL.
  *   Must be of type fss_read_main_t.
  *
- *   This alters main.setting.state.status.
- *   This uses and alters main.setting.buffer.
+ *   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_extended_read()
+ *
+ * @see fll_fss_extended_read()
+ *
+ * @see fss_read_file_identify()
  */
-#ifndef _di_fss_read_extended_process_object_
-  extern void fss_read_extended_process_object(void * const main);
-#endif // _di_fss_read_extended_process_object_
+#ifndef _di_fss_read_extended_process_load_
+  extern void fss_read_extended_process_load(void * const main);
+#endif // _di_fss_read_extended_process_load_
 
 #ifdef __cplusplus
 } // extern "C"
index 28eda37487768d91e970f8568c59d536fe0eecc8..0c78dd57de3e7c9aacc7c4b50b4a4777ec835aff 100644 (file)
@@ -10,36 +10,37 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.flag |= fss_read_print_flag_out_e;
   data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
   data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
   data.program.error.custom = (void *) &data;
   data.program.debug.custom = (void *) &data;
   data.program.message.custom = (void *) &data;
   data.program.output.custom = (void *) &data;
   data.program.warning.custom = (void *) &data;
 
+  data.setting.flag |= fss_read_main_flag_line_single_e | 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.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_extended_standard_s;
 
-  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_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;
+  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_extended_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_extended_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 cc763dd4bf0f148b7e7288788c961954a962a0de..7f321e27f780d337afe8ef96bd5780eccf816f46 100644 (file)
@@ -4,6 +4,45 @@
 extern "C" {
 #endif
 
+#ifndef _di_fss_read_extended_print_at_
+  f_status_t fss_read_extended_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;
+
+    // @todo This is copied from fss_read_print_at() and needs to be updated to handle multiple content.
+
+    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].array[0], delimits_content);
+        }
+      }
+
+      if (main->callback.print_set_end) {
+        main->callback.print_set_end(&main->program.output);
+      }
+    }
+
+    return F_none;
+  }
+#endif // _di_fss_read_extended_print_at_
+
 #ifndef _di_fss_read_extended_print_help_
   f_status_t fss_read_extended_print_help(fl_print_t * const print) {
 
@@ -19,6 +58,8 @@ extern "C" {
 
     fll_program_print_help_usage(print, fss_read_extended_program_name_s, f_string_empty_s);
 
+    f_print_dynamic_raw(f_string_eol_s, print->to);
+
     fss_read_print_message_help_note_header(print, fss_read_format_code_short_0001_s, fss_read_format_code_name_0001_s);
 
     fss_read_print_message_help_pipe(print);
index de3b7e8e09ab110892cba5cb393a89c1752e6d53..51d60a9244ff637cad695b12a57561ad5e39aa04 100644 (file)
@@ -13,6 +13,45 @@ 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 main.callback.print_object()
+ * @see main.callback.print_object_end()
+ * @see main.callback.print_set_end()
+ */
+#ifndef _di_fss_read_extended_print_at_
+  extern f_status_t fss_read_extended_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_extended_print_at_
+
+/**
  * Print help for FSS-0001 (Extended).
  *
  * @param print
index 1f786c618ed48e646676a16010132608cbd55697..d332ce5bc2d5a50e316e486ddac8a10a93793aa8 100644 (file)
@@ -14,6 +14,59 @@ extern "C" {
   }
 #endif // _di_fss_read_extended_list_process_help_
 
+#ifndef _di_fss_read_extended_list_process_load_
+  void fss_read_extended_list_process_load(void * const void_main) {
+
+    if (!void_main) return;
+
+    fss_read_main_t * const main = (fss_read_main_t *) void_main;
+
+    if (main->setting.buffer.used) {
+      main->setting.range.start = 0;
+      main->setting.range.stop = main->setting.buffer.used;
+    }
+    else {
+      main->setting.range.start = 1;
+      main->setting.range.stop = 0;
+    }
+
+    main->setting.comments.used = 0;
+    main->setting.delimits_object.used = 0;
+    main->setting.delimits_content.used = 0;
+    main->setting.nest.used = 0;
+    main->setting.quotes_object.used = 0;
+    main->setting.quotes_content.used = 0;
+
+    fll_fss_extended_list_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state);
+
+    if (F_status_is_error(main->setting.state.status)) {
+      if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+
+      fll_error_file_print(
+        &main->program.error,
+        F_status_set_fine(main->setting.state.status),
+        macro_fss_read_f(fll_fss_extended_list_read),
+        fll_error_file_flag_fallback_e,
+        fss_read_file_identify(main->setting.range.start, main->setting.files),
+        f_file_operation_process_s,
+        fll_error_file_type_file_e
+      );
+
+      return;
+    }
+
+    if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {
+      if (!(main->setting.flag & fss_read_main_flag_total_e)) {
+        main->setting.state.status = F_status_set_warning(main->setting.state.status);
+
+        return;
+      }
+    }
+
+    main->setting.state.status = F_none;
+  }
+#endif // _di_fss_read_extended_list_process_load_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 5b0c76de83400b50542720f3c82c63b420a042b7..0a3a4d886f63aeeb1609ccf0029bd8d488051fbe 100644 (file)
@@ -84,6 +84,33 @@ extern "C" {
   extern void fss_read_extended_list_process_help(void * const main);
 #endif // _di_fss_read_extended_list_process_help_
 
+/**
+ * Process the buffer, loading the FSS data.
+ *
+ * This will print an error message on error.
+ *
+ * @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.
+ *
+ *     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_extended_list_read()
+ *
+ * @see fll_fss_extended_list_read()
+ *
+ * @see fss_read_file_identify()
+ */
+#ifndef _di_fss_read_extended_list_process_load_
+  extern void fss_read_extended_list_process_load(void * const main);
+#endif // _di_fss_read_extended_list_process_load_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index c630257f3bd9a886381e2b1edb96e339f0df7091..3adffc55558fd5ed265e5b783f95fe02030997dc 100644 (file)
@@ -10,35 +10,36 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.flag |= fss_read_print_flag_out_e;
   data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
   data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
   data.program.error.custom = (void *) &data;
   data.program.debug.custom = (void *) &data;
   data.program.message.custom = (void *) &data;
   data.program.output.custom = (void *) &data;
   data.program.warning.custom = (void *) &data;
 
+  data.setting.flag |= fss_read_main_flag_trim_object_e;
+
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_extended_list_standard_s;
 
-  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_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;
+  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_extended_list_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_extended_list_print_set_end;
 
   f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
index 5652239c54bbff61da58bda550c69bf18cc2011c..391a1e3978733baf728d8c6d5a591d7772a63103 100644 (file)
@@ -19,6 +19,8 @@ extern "C" {
 
     fll_program_print_help_usage(print, fss_read_extended_list_program_name_s, f_string_empty_s);
 
+    f_print_dynamic_raw(f_string_eol_s, print->to);
+
     fss_read_print_message_help_note_header(print, fss_read_format_code_short_0003_s, fss_read_format_code_name_0003_s);
 
     fss_read_print_message_help_pipe(print);
@@ -32,6 +34,20 @@ extern "C" {
   }
 #endif // _di_fss_read_extended_list_print_help_
 
+#ifndef _di_fss_read_extended_list_print_set_end_
+  f_status_t fss_read_extended_list_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;
+
+    // @todo
+    //fll_print_dynamic_raw((main->setting.flag & fss_read_main_flag_pipe_e) ? fss_read_pipe_content_end_s : f_string_eol_s, print->to);
+
+    return F_none;
+  }
+#endif // _di_fss_read_extended_list_print_set_end_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index aef9744511e9209ee69ecfa1cd8cf1e8043282ac..c3d655da663a07eee949c58fe0db2b9e27aff19f 100644 (file)
@@ -30,6 +30,30 @@ extern "C" {
   extern f_status_t fss_read_extended_list_print_help(fl_print_t * const print);
 #endif // _di_fss_read_extended_list_print_help_
 
+/**
+ * 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 fll_print_dynamic_raw()
+ */
+#ifndef _di_fss_read_extended_list_print_set_end_
+  extern f_status_t fss_read_extended_list_print_set_end(fl_print_t * const print);
+#endif // _di_fss_read_extended_list_print_set_end_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 2e7acb92efa49f0ed16c3162bc5d8ea84f21fc77..0ed95ceb0500fc2fa833ec0779196d167d2fabeb 100644 (file)
@@ -480,20 +480,34 @@ extern "C" {
 
     f_file_t file = f_file_t_initialize;
 
+    fss_read_files_resize(((main->program.pipe & fll_program_data_pipe_input_e) ? 1 : 0) + parameters->remaining.used, &main->setting.files);
+
+    if (F_status_is_error(main->setting.state.status)) {
+      fss_read_print_error(&main->program.error, macro_fss_read_f(fss_read_files_resize));
+
+      return;
+    }
+
     if (main->program.pipe & fll_program_data_pipe_input_e) {
       file.id = F_type_descriptor_input_d;
       file.stream = F_type_input_d;
 
       main->setting.files.array[0].range.start = 0;
 
-      main->setting.state.status = f_file_stream_read(file, &main->setting.buffer);
+      while (main->setting.state.status != F_none_eof) {
+
+        if (fss_read_signal_check(main)) break;
+
+        main->setting.state.status = f_file_stream_read_block(file, &main->setting.buffer);
+        if (F_status_is_error(main->setting.state.status)) break;
+      } // while
 
       if (F_status_is_error(main->setting.state.status)) {
         if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
           fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
         }
 
-        fll_error_file_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_stream_read), fll_error_file_flag_fallback_e, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
+        fll_error_file_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_stream_read_block), fll_error_file_flag_fallback_e, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
 
         return;
       }
@@ -627,9 +641,11 @@ extern "C" {
 #endif // _di_fss_read_setting_load_
 
 #ifndef _di_fss_read_setting_load_depth_
-  void fss_read_setting_load_depth(const f_console_arguments_t arguments, fss_read_main_t * const main, f_console_parameters_t * const parameters) {
+  void fss_read_setting_load_depth(const f_console_arguments_t arguments, void * const void_main, f_console_parameters_t * const parameters) {
 
-    if (!main || !parameters) return;
+    if (!void_main || !parameters) return;
+
+    fss_read_main_t * const main = (fss_read_main_t *) void_main;
 
     f_array_length_t i = 1;
 
@@ -637,8 +653,9 @@ extern "C" {
       i = parameters->array[fss_read_parameter_depth_e].values.used;
     }
 
-    if (i > main->setting.depths.size) {
-      main->setting.state.status = fss_read_depths_resize(i, &main->setting.depths);
+    // @fixme: much of the logic in this depths handling was static and is now dynamic, this needs to be reviewed and updated.
+    if (i + 1 > main->setting.depths.size) {
+      main->setting.state.status = fss_read_depths_resize(i + 1, &main->setting.depths);
 
       if (F_status_is_error(main->setting.state.status)) {
         if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
@@ -665,9 +682,7 @@ extern "C" {
       main->setting.depths.array[i].index_at = 0;
       main->setting.depths.array[i].index_name = 0;
       main->setting.depths.array[i].value_at = 0;
-
-      // This dynamic string is actually a static string, so clear it between loops.
-      macro_f_string_dynamic_t_clear(main->setting.depths.array[i].value_name);
+      main->setting.depths.array[i].value_name.used = 0; // @fixme this needs to be fully reset to 0.
 
       if (!parameters->array[fss_read_parameter_depth_e].values.used) {
         position_depth = 0;
@@ -783,7 +798,7 @@ extern "C" {
     } // for
 
     if (main->callback.process_load_depth) {
-      main->callback.process_load_depth(arguments, (void *) main);
+      main->callback.process_load_depth(arguments, (void *) main, parameters);
       if (F_status_is_error(main->setting.state.status)) return;
     }
 
index c2d64427f1af62f85abefcaa3022fc6d61e2151e..a4f96dc865e1264500368385c0dfeb67339299c6 100644 (file)
@@ -79,6 +79,9 @@ extern "C" {
  * @param main
  *   The main program data.
  *
+ *   Must not be NULL.
+ *   Must be of type fss_read_main_t.
+ *
  *   This calls main.callback.process_load_depth() if not NULL.
  *
  *   This alters main.setting.state.status:
@@ -106,7 +109,7 @@ extern "C" {
  * @see fss_read_setting_load()
  */
 #ifndef _di_fss_read_setting_load_depth_
-  extern void fss_read_setting_load_depth(const f_console_arguments_t arguments, fss_read_main_t * const main, f_console_parameters_t * const parameters);
+  extern void fss_read_setting_load_depth(const f_console_arguments_t arguments, void * const main, f_console_parameters_t * const parameters);
 #endif // _di_fss_read_setting_load_depth_
 
 #ifdef __cplusplus
index 365210c5547f55d511c00d85000c4c2e43e99c97..7fee9bd733345189708e193081a2513b6f9a7b92 100644 (file)
@@ -44,6 +44,7 @@ extern "C" {
  *   - 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).
+ *   - trim_object:      Empty space before and after Objects (but not Content) will not be printed (They will be trimmed).
  *   - version:          Print version.
  */
 #ifndef _di_fss_read_main_flag_e_
@@ -72,12 +73,11 @@ extern "C" {
     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,
+    fss_read_main_flag_trim_object_e      = 0x800000,
+    fss_read_main_flag_version_e          = 0x1000000,
   }; // enum
 #endif // _di_fss_read_main_flag_e_
 
-//@todo figure out if fss_read_main_flag_ignore_e is needed
-
 /**
  * The main program parameters.
  */
@@ -97,6 +97,7 @@ extern "C" {
     fss_read_parameter_line_first_no_e,
     fss_read_parameter_line_last_no_e,
 
+    fss_read_parameter_as_e,
     fss_read_parameter_at_e,
     fss_read_parameter_content_e,
     fss_read_parameter_columns_e,
@@ -117,23 +118,24 @@ extern "C" {
     { \
       macro_fll_program_console_parameter_standard_initialize, \
       \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_at_s, fss_read_long_at_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_content_s, fss_read_long_content_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_columns_s, fss_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_delimit_s, fss_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_depth_s, fss_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_empty_s, fss_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_line_s, fss_read_long_line_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_name_s, fss_read_long_name_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_object_s, fss_read_long_object_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_pipe_s, fss_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_original_s, fss_read_long_original_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_select_s, fss_read_long_select_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_total_s, fss_read_long_total_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(fss_read_short_trim_s, fss_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_as_s,       fss_read_long_as_s,       1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_at_s,       fss_read_long_at_s,       1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_content_s,  fss_read_long_content_s,  0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_columns_s,  fss_read_long_columns_s,  0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_delimit_s,  fss_read_long_delimit_s,  1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_depth_s,    fss_read_long_depth_s,    1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_empty_s,    fss_read_long_empty_s,    0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_line_s,     fss_read_long_line_s,     1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_name_s,     fss_read_long_name_s,     1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_object_s,   fss_read_long_object_s,   0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_pipe_s,     fss_read_long_pipe_s,     0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_original_s, fss_read_long_original_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_select_s,   fss_read_long_select_s,   1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_total_s,    fss_read_long_total_s,    0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_read_short_trim_s,     fss_read_long_trim_s,     0, f_console_flag_normal_e), \
     }
 
-  #define fss_read_total_parameters_d 27
+  #define fss_read_total_parameters_d 28
 #endif // _di_fss_read_parameter_e_
 
 /**
index 1edbe00aaa45fb4b1b7c00e185481c8ad8198c63..b773af0c7b9d372e16868c8962d4bfb49e75b24d 100644 (file)
@@ -11,6 +11,7 @@ extern "C" {
     "f_file_size_by_id",
     "f_file_stream_open",
     "f_file_stream_read",
+    "f_file_stream_read_block",
     "f_file_stream_read_until",
     "f_fss_is_space",
     "f_rip_dynamic",
@@ -43,10 +44,15 @@ extern "C" {
     "fl_fss_extended_object_read",
     "fl_fss_payload_content_read",
     "fll_fss_basic_read",
+    "fll_fss_basic_list_read",
+    "fll_fss_embedded_list_read",
+    "fll_fss_extended_read",
+    "fll_fss_extended_list_read",
     "fll_fss_payload_read",
     "fll_program_parameter_process_context",
     "fll_program_parameter_process_verbosity",
     "fss_read_depths_resize",
+    "fss_read_files_resize",
     "fss_read_setting_load_depth",
   };
 #endif // _di_fss_read_f_a_
index 074aae04090023e3889ba5d3fe9fe0c2f84c9472..d49f1cf46e7c9868097131bae6a476474723233f 100644 (file)
@@ -44,6 +44,7 @@ extern "C" {
     fss_read_f_f_file_size_by_id_e,
     fss_read_f_f_file_stream_open_e,
     fss_read_f_f_file_stream_read_e,
+    fss_read_f_f_file_stream_read_block_e,
     fss_read_f_f_file_stream_read_until_e,
     fss_read_f_f_fss_is_space_e,
     fss_read_f_f_rip_dynamic_e,
@@ -76,10 +77,15 @@ extern "C" {
     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_basic_list_read_e,
+    fss_read_f_fll_fss_embedded_list_read_e,
+    fss_read_f_fll_fss_extended_read_e,
+    fss_read_f_fll_fss_extended_list_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_fss_read_depths_resize_e,
+    fss_read_f_fss_read_files_resize_e,
     fss_read_f_fss_read_setting_load_depth_e,
   }; // enum
 #endif // _di_fss_read_f_e_
index 3c65073bb80129de183a2c6c0799ac1923613b1d..987a8960dc9cce116f20a866de97621f087e0c07 100644 (file)
@@ -32,6 +32,7 @@ extern "C" {
 #endif // _di_fss_read_delimit_mode_s_
 
 #ifndef _di_fss_read_parameter_s_
+  const f_string_static_t fss_read_short_as_s = macro_f_string_static_t_initialize_1(FSS_READ_short_as_s, 0, FSS_READ_short_as_s_length);
   const f_string_static_t fss_read_short_at_s = macro_f_string_static_t_initialize_1(FSS_READ_short_at_s, 0, FSS_READ_short_at_s_length);
   const f_string_static_t fss_read_short_content_s = macro_f_string_static_t_initialize_1(FSS_READ_short_content_s, 0, FSS_READ_short_content_s_length);
   const f_string_static_t fss_read_short_columns_s = macro_f_string_static_t_initialize_1(FSS_READ_short_columns_s, 0, FSS_READ_short_columns_s_length);
@@ -47,6 +48,7 @@ extern "C" {
   const f_string_static_t fss_read_short_total_s = macro_f_string_static_t_initialize_1(FSS_READ_short_total_s, 0, FSS_READ_short_total_s_length);
   const f_string_static_t fss_read_short_trim_s = macro_f_string_static_t_initialize_1(FSS_READ_short_trim_s, 0, FSS_READ_short_trim_s_length);
 
+  const f_string_static_t fss_read_long_as_s = macro_f_string_static_t_initialize_1(FSS_READ_long_as_s, 0, FSS_READ_long_as_s_length);
   const f_string_static_t fss_read_long_at_s = macro_f_string_static_t_initialize_1(FSS_READ_long_at_s, 0, FSS_READ_long_at_s_length);
   const f_string_static_t fss_read_long_content_s = macro_f_string_static_t_initialize_1(FSS_READ_long_content_s, 0, FSS_READ_long_content_s_length);
   const f_string_static_t fss_read_long_columns_s = macro_f_string_static_t_initialize_1(FSS_READ_long_columns_s, 0, FSS_READ_long_columns_s_length);
index 08c4dd7e7b7b40e0de31e5d5156da8aa5a5fb135..154ea9a7324acd2388b8ba69df922729fc7ae8d0 100644 (file)
@@ -136,6 +136,7 @@ extern "C" {
  * The main program parameters.
  */
 #ifndef _di_fss_read_parameter_s_
+  #define FSS_READ_short_as_s       "A"
   #define FSS_READ_short_at_s       "a"
   #define FSS_READ_short_content_s  "c"
   #define FSS_READ_short_columns_s  "C"
@@ -151,6 +152,7 @@ extern "C" {
   #define FSS_READ_short_total_s    "t"
   #define FSS_READ_short_trim_s     "T"
 
+  #define FSS_READ_long_as_s       "as"
   #define FSS_READ_long_at_s       "at"
   #define FSS_READ_long_content_s  "content"
   #define FSS_READ_long_columns_s  "columns"
@@ -166,6 +168,7 @@ extern "C" {
   #define FSS_READ_long_total_s    "total"
   #define FSS_READ_long_trim_s     "trim"
 
+  #define FSS_READ_short_as_s_length       1
   #define FSS_READ_short_at_s_length       1
   #define FSS_READ_short_content_s_length  1
   #define FSS_READ_short_columns_s_length  1
@@ -181,6 +184,7 @@ extern "C" {
   #define FSS_READ_short_total_s_length    1
   #define FSS_READ_short_trim_s_length     1
 
+  #define FSS_READ_long_as_s_length       2
   #define FSS_READ_long_at_s_length       2
   #define FSS_READ_long_content_s_length  7
   #define FSS_READ_long_columns_s_length  7
@@ -196,6 +200,7 @@ extern "C" {
   #define FSS_READ_long_total_s_length    5
   #define FSS_READ_long_trim_s_length     4
 
+  extern const f_string_static_t fss_read_short_as_s;
   extern const f_string_static_t fss_read_short_at_s;
   extern const f_string_static_t fss_read_short_content_s;
   extern const f_string_static_t fss_read_short_columns_s;
@@ -211,6 +216,7 @@ extern "C" {
   extern const f_string_static_t fss_read_short_total_s;
   extern const f_string_static_t fss_read_short_trim_s;
 
+  extern const f_string_static_t fss_read_long_as_s;
   extern const f_string_static_t fss_read_long_at_s;
   extern const f_string_static_t fss_read_long_content_s;
   extern const f_string_static_t fss_read_long_columns_s;
index d5205132b82e69db5b12dd2d066b656f8f2bd305..5315e618c28efb34171e1adefb86267e25171436 100644 (file)
@@ -81,6 +81,8 @@ extern "C" {
     f_string_ranges_resize(0, &setting->comments);
     f_string_rangess_resize(0, &setting->contents);
 
+    f_fss_nest_resize(0, &setting->nest);
+
     f_array_lengths_resize(0, &setting->delimits_object);
     f_array_lengths_resize(0, &setting->delimits_content);
 
index dc18df28c89823bd52a8c5c4cf4c469cb40e86e6..e239c4f7b460124703d95335dc7a5436f02dc645 100644 (file)
@@ -123,7 +123,6 @@ extern "C" {
  * 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_pipe:       Process data piped to the program from standard input (stdin).
  *
  * process_at:       Process at parameter, usually called by the process_normal() callback.
  * process_columns:  Process columns parameter, usually called by the process_normal() callback.
@@ -134,18 +133,17 @@ extern "C" {
  *
  * 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:        Print the Content, 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.
+ * print_set_end:        Print the Content 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_load_depth)(const f_console_arguments_t arguments, void * const main, f_console_parameters_t * const parameters);
     void (*process_normal)(void * const main);
-    void (*process_pipe)(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[]);
@@ -154,12 +152,12 @@ extern "C" {
     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_string_range_t range, 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);
+    f_status_t (*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);
+    f_status_t (*print_object)(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits);
+    f_status_t (*print_content)(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_fss_delimits_t delimits);
+    f_status_t (*print_content_ignore)(fl_print_t * const print);
+    f_status_t (*print_object_end)(fl_print_t * const print);
+    f_status_t (*print_set_end)(fl_print_t * const print);
   } fss_read_callback_t;
 
   #define fss_read_callback_t_initialize \
@@ -179,7 +177,6 @@ extern "C" {
       0, \
       0, \
       0, \
-      0, \
     }
 #endif // _di_fss_read_callback_t_
 
@@ -209,11 +206,14 @@ extern "C" {
  * standard: A human-friendly string describing the standard in use, such as "FSS-0000 (Basic)".
  * buffer:   The buffer containing all loaded files (and STDIN pipe).
  *
- * objects:          The positions within the buffer representing Objects.
+ * comments:         The positions within the buffer representing comments.
  * contents:         The positions within the buffer representing Contents.
  * 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.
+ * nests:            The positions within the buffer representing nested Objects and Contents.
+ * objects:          The positions within the buffer representing Objects.
+ * quotes_object:    The quotes within the Object structure.
+ * quotes_content:   The quotes within the Content structure.
  */
 #ifndef _di_fss_read_setting_t_
   typedef struct {
@@ -235,11 +235,13 @@ extern "C" {
     f_string_static_t standard;
     f_string_dynamic_t buffer;
 
-    f_fss_objects_t objects;
+    f_fss_comments_t comments;
     f_fss_contents_t contents;
     f_fss_delimits_t delimits_object;
     f_fss_delimits_t delimits_content;
-    f_fss_comments_t comments;
+    f_fss_nest_t nest;
+    f_fss_objects_t objects;
+
     f_uint8s_t quotes_object;
     f_uint8ss_t quotes_content;
   } fss_read_setting_t;
@@ -258,11 +260,12 @@ extern "C" {
       fss_read_depths_t_initialize, \
       f_string_static_t_initialize, \
       f_string_dynamic_t_initialize, \
-      f_fss_objects_t_initialize, \
+      f_fss_comments_t_initialize, \
       f_fss_contents_t_initialize, \
       f_fss_delimits_t_initialize, \
       f_fss_delimits_t_initialize, \
-      f_fss_comments_t_initialize, \
+      f_fss_nest_t_initialize, \
+      f_fss_objects_t_initialize, \
       f_uint8s_t_initialize, \
       f_uint8ss_t_initialize, \
     }
index 3053a80c6f7b1a4a9f265f6011747d565ae2189c..5c2d4c86f2e04c7a140c1a56627c87403515bda4 100644 (file)
@@ -89,17 +89,9 @@ extern "C" {
       return;
     }
 
-    if (main->program.pipe & fll_program_data_pipe_input_e) {
-      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)) {
-        if (main->callback.process_normal) {
-          main->callback.process_normal(void_main);
-        }
+    if (main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e)) {
+      if (main->callback.process_normal) {
+        main->callback.process_normal(void_main);
       }
     }
 
index 2a66c2b8135ad575418e48778b433fcc6148448f..ff36084c63eb2ad0d44c95e9601be80c6b296819 100644 (file)
@@ -17,6 +17,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.flag |= fss_read_print_flag_out_e;
   data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
   data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
   data.program.error.custom = (void *) &data;
   data.program.debug.custom = (void *) &data;
   data.program.message.custom = (void *) &data;
@@ -97,12 +98,24 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
     main->setting.standard = fss_read_basic_standard_s;
 
-    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_last_line = &fss_read_process_last_line;
+    main->callback.process_load_depth = &fss_read_setting_load_depth;
     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;
+
+    main->callback.process_at = &fss_read_process_normal_at;
+    main->callback.process_columns = &fss_read_process_normal_columns;
+    main->callback.process_line = &fss_read_process_normal_line;
+    main->callback.process_load = 0;
+    main->callback.process_name = &fss_read_process_normal_name;
+    main->callback.process_total = &fss_read_process_normal_total;
+
+    main->callback.print_at = &fss_read_print_at;
+    main->callback.print_content = &fss_read_print_content;
+    main->callback.print_content_ignore = &fss_read_print_content_ignore;
+    main->callback.print_object = &fss_read_print_object;
+    main->callback.print_object_end = &fss_read_print_object_end;
+    main->callback.print_set_end = &fss_read_print_set_end;
 
     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) {
 
@@ -120,15 +133,19 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
           main->setting.standard = fss_read_basic_standard_s;
 
-          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.
+          // Remove flags not supported for this standard.
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_trim_object_e;
+
+          main->setting.flag |= fss_read_main_flag_line_single_e;
+          main->setting.flag |= fss_read_main_flag_quote_content_e | fss_read_main_flag_quote_object_e;
 
-          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;
+          main->callback.process_load = &fss_read_basic_process_load;
+          main->callback.print_set_end = &fss_read_print_set_end;
+
+          main->callback.print_object_end = &fss_read_print_object_end;
         }
         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 ||
@@ -137,15 +154,18 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
           main->setting.standard = fss_read_extended_standard_s;
 
-          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;
+          // Remove flags not supported for this standard.
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_trim_object_e;
+
+          main->setting.flag |= fss_read_main_flag_line_single_e | fss_read_main_flag_content_multiple_e;
+          main->setting.flag |= fss_read_main_flag_quote_content_e | fss_read_main_flag_quote_object_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;
+          main->callback.process_load = &fss_read_extended_process_load;
+          main->callback.print_set_end = &fss_read_print_set_end_no_eol;
+
+          main->callback.print_object_end = &fss_read_print_object_end;
         }
         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 ||
@@ -154,15 +174,20 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
           main->setting.standard = fss_read_basic_list_standard_s;
 
-          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.
+          // Remove flags not supported for this standard.
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
+
+          main->setting.flag |= fss_read_main_flag_trim_object_e;
 
-          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;
+          main->callback.process_load = &fss_read_basic_list_process_load;
+          main->callback.print_set_end = &fss_read_print_set_end;
+
+          main->callback.print_object_end = &fss_read_basic_list_print_object_end;
         }
         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 ||
@@ -171,15 +196,20 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
           main->setting.standard = fss_read_extended_list_standard_s;
 
-          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.
+          // Remove flags not supported for this standard.
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
+
+          main->setting.flag |= fss_read_main_flag_trim_object_e;
 
-          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;
+          main->callback.process_load = &fss_read_extended_list_process_load;
+          main->callback.print_set_end = &fss_read_print_set_end;
+
+          main->callback.print_object_end = &fss_read_print_object_end;
         }
         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 ||
@@ -188,15 +218,19 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
           main->setting.standard = fss_read_embedded_list_standard_s;
 
-          main->setting.flag |= fss_read_main_flag_ignore_e;
-          main->setting.flag |= fss_read_main_flag_content_multiple_e;
+          // Remove flags not supported for this standard.
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
+
+          main->setting.flag |= fss_read_main_flag_trim_object_e;
+          main->setting.flag |= fss_read_main_flag_content_multiple_e | fss_read_main_flag_depth_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;
+          main->callback.process_load = &fss_read_embedded_list_process_load;
+          main->callback.print_set_end = &fss_read_print_set_end;
+
+          main->callback.print_object_end = &fss_read_print_object_end;
         }
         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 ||
@@ -205,15 +239,20 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
           main->setting.standard = fss_read_payload_standard_s;
 
-          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.
+          // Remove flags not supported for this standard.
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
+          main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
+
+          main->setting.flag |= fss_read_main_flag_trim_object_e;
 
-          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;
+          main->callback.process_load = &fss_read_payload_process_load;
+          main->callback.print_set_end = &fss_read_print_set_end;
+
+          main->callback.print_object_end = &fss_read_print_object_end;
         }
         else {
           if (main->setting.flag & fss_read_main_flag_help_e) {
index 3647488401de83759aad2a1706a866fdac97c2f7..816578452a4b21736777accc90f819bcf9710c40 100644 (file)
@@ -48,6 +48,8 @@ extern "C" {
 
     fll_program_print_help_usage(print, fss_read_program_name_s, f_string_empty_s);
 
+    f_print_dynamic_raw(f_string_eol_s, print->to);
+
     fss_read_print_message_help_note_header(print, f_string_empty_s, f_string_empty_s);
 
     fss_read_print_message_help_pipe(print);
index 8b95673db3da08e6e930a2e84b0ac6662ccad3cc..a7cd1b267853a2acb068a5c15c5a25ecc8709c39 100644 (file)
@@ -109,7 +109,7 @@ extern "C" {
 
     if (at >= main->setting.objects.used) return F_output_not;
 
-    if (main->setting.flag & fss_read_main_flag_trim_e) {
+    if (main->setting.flag & (fss_read_main_flag_trim_e | fss_read_main_flag_trim_object_e)) {
       if (main->setting.flag & fss_read_main_flag_original_e) {
         if (main->setting.quotes_object.array[at]) {
           fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
@@ -153,23 +153,7 @@ extern "C" {
 
     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);
-      }
-      */
-    }
+    fll_print_dynamic_raw((main->setting.flag & fss_read_main_flag_pipe_e) ? fss_read_pipe_content_start_s : f_fss_space_s, print->to);
 
     return F_none;
   }
@@ -200,16 +184,26 @@ extern "C" {
 
     fss_read_main_t * const main = (fss_read_main_t *) print->custom;
 
+    fll_print_dynamic_raw((main->setting.flag & fss_read_main_flag_pipe_e) ? fss_read_pipe_content_end_s : f_string_eol_s, print->to);
+
+    return F_none;
+  }
+#endif // _di_fss_read_print_set_end_
+
+#ifndef _di_fss_read_print_set_end_no_eol_
+  f_status_t fss_read_print_set_end_no_eol(fl_print_t * const print) {
+
+    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_set_end_
+#endif // _di_fss_read_print_set_end_no_eol_
 
 #ifdef __cplusplus
 } // extern "C"
index da206d286a1de0de7e4304d1fdf6f5937b2f4017..d013f0960848719603fcb93569aa598246ffc072 100644 (file)
@@ -47,8 +47,7 @@ extern "C" {
  * @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_content()
  * @see main.callback.print_object()
  * @see main.callback.print_object_end()
  * @see main.callback.print_set_end()
@@ -255,6 +254,32 @@ extern "C" {
   extern f_status_t fss_read_print_set_end(fl_print_t * const print);
 #endif // _di_fss_read_print_set_end_
 
+/**
+ * Print the end of an Object/Content set.
+ *
+ * This is a variation of fss_read_print_set_end() that does not print the EOL.
+ *
+ * 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_set_end_no_eol_
+  extern f_status_t fss_read_print_set_end_no_eol(fl_print_t * const print);
+#endif // _di_fss_read_print_set_end_no_eol_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 6af60321022bf008d90e8b9bb4b12378b6abe0a6..9f7f282e02a692cb9767adb264936f3cb4c53280 100644 (file)
@@ -35,7 +35,7 @@ extern "C" {
 
     if (!print) return;
 
-    fl_print_format(" %[Notes:%]%r  This program will print the data associated with the given Object and Content based on the FSS", print->to, f_string_eol_s);
+    fl_print_format(" %[Notes:%]%r  This program will print the data associated with the given Object and Content based on the FSS", print->to, print->set->notable, print->set->notable, f_string_eol_s);
 
     if (number.used) {
       fl_print_format("-%Q", print->to, number);
index f39c25f697730bf9fad5bb2da9ea09a8c1204b43..09ac7da1fe1cafa796a1ccd2ab18dcd95502f275 100644 (file)
@@ -77,7 +77,7 @@ extern "C" {
         if (!names[i]) continue;
         if (fss_read_signal_check(main)) return;
 
-        main->callback.print_at(main, i, *delimits_object, *delimits_content);
+        main->callback.print_at(&main->program.output, i, *delimits_object, *delimits_content);
       } // for
     }
 
@@ -181,7 +181,7 @@ extern "C" {
           }
         }
         else if (main->callback.print_at) {
-          main->callback.print_at(main, i, delimits_object, delimits_content);
+          main->callback.print_at(&main->program.output, i, delimits_object, delimits_content);
         }
 
         main->setting.state.status = F_none;
@@ -217,15 +217,28 @@ extern "C" {
 
     f_array_length_t max = 0;
 
-    for (f_array_length_t at = 0; at < main->setting.contents.used; ++at) {
+    if (main->setting.flag & fss_read_main_flag_content_multiple_e) {
+      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 (!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
+        if (main->setting.contents.array[at].used > max) {
+          max = main->setting.contents.array[at].used;
+        }
+      } // for
+    }
+    else {
+      for (f_array_length_t at = 0; at < main->setting.contents.used; ++at) {
+
+        if (names[at]) {
+          max = 1;
+          break;
+        }
+
+        if (fss_read_signal_check(main)) return;
+      } // for
+    }
 
     fss_read_print_number(&main->program.output, max);
 
@@ -268,7 +281,7 @@ extern "C" {
       if (line == main->setting.line) {
         if (main->callback.print_at) {
           main->callback.print_at(
-            main,
+            &main->program.output,
             i,
             !(main->setting.flag & fss_read_main_flag_original_e) && fss_read_delimit_object_is(main, 0)
               ? main->setting.delimits_object
@@ -301,7 +314,7 @@ extern "C" {
 
       memset(names, F_false, sizeof(bool) * main->setting.objects.used);
 
-      if (main->setting.flag & fss_read_main_flag_trim_e) {
+      if (main->setting.flag & (fss_read_main_flag_trim_e | fss_read_main_flag_trim_object_e)) {
         for (i = 0; i < main->setting.objects.used; ++i) {
 
           if (fss_read_signal_check(main)) return;
index fb2073d4469b45ae63905296529f6195bcead3e1..5a69c750835513158b0a9ccc0ba5b8e411ef182f 100644 (file)
@@ -14,346 +14,58 @@ extern "C" {
   }
 #endif // _di_fss_read_payload_process_help_
 
-#ifndef _di_fss_read_payload_process_pipe_
-  void fss_read_payload_process_pipe(void * const void_main) {
+#ifndef _di_fss_read_payload_process_load_
+  void fss_read_payload_process_load(void * const void_main) {
 
     if (!void_main) return;
 
     fss_read_main_t * const main = (fss_read_main_t *) void_main;
 
-    f_status_t status_pipe = F_none;
-    f_file_t input = f_file_t_initialize;
-    input.id = F_type_descriptor_input_d;
-    input.size_read = fss_read_allocation_large_d;
-
-    f_array_length_t total = 0;
-    f_array_length_t length = 0;
-    f_string_range_t range = f_string_range_t_initialize;
-
-    // @todo much of this is copied from fss_write and needs to be updated or removed accordingly.
-
-    const f_array_length_t used_objects = main->setting.objects.used;
-    const f_array_length_t used_contents = main->setting.contents.used;
-
-    // @fixme really? why am I setting a pointer to the used position, which may not even be allocated? Review this and perhaps first pre-allocate the space so the used is within the size.
-    main->setting.object = &main->setting.objects.array[used_objects];
-    main->setting.contents = &main->setting.contents.array[used_contents];
-
-    // 0x0 = nothing printed, 0x1 = something printed, 0x2 = ignore enabled, 0x4 = added Content for Object, 0x8 = "payload" matched.
-    uint8_t flag = 0;
-
-    // 0x0 = start new object/content set, 0x1 = processing object, 0x2 = processing content, 0x3 = end object/content set, 0x4 = processing payload content.
-    uint8_t state = 0;
-
-    // This is processed in a single set, so there is only ever one Object added.
-    main->setting.state.status = f_string_dynamics_increase(main->setting.state.step_small, &main->setting.objects);
-
-    if (F_status_is_error(main->setting.state.status)) {
-      fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamics_increase));
-
-      return;
+    if (main->setting.buffer.used) {
+      main->setting.range.start = 0;
+      main->setting.range.stop = main->setting.buffer.used;
     }
-
-    // This is processed in a single set, so there is only ever one Content added.
-    main->setting.state.status = f_string_dynamicss_increase(main->setting.state.step_small, &main->setting.contentss);
-
-    if (F_status_is_error(main->setting.state.status)) {
-      fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamicss_increase));
-
-      return;
+    else {
+      main->setting.range.start = 1;
+      main->setting.range.stop = 0;
     }
 
-    main->setting.state.status = f_string_dynamics_increase(main->setting.state.step_small, main->setting.contents);
+    main->setting.comments.used = 0;
+    main->setting.delimits_object.used = 0;
+    main->setting.delimits_content.used = 0;
+    main->setting.nest.used = 0;
+    main->setting.quotes_object.used = 0;
+    main->setting.quotes_content.used = 0;
+
+    fll_fss_payload_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state);
 
     if (F_status_is_error(main->setting.state.status)) {
-      fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamics_increase));
+      if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+
+      fll_error_file_print(
+        &main->program.error,
+        F_status_set_fine(main->setting.state.status),
+        macro_fss_read_f(fll_fss_payload_read),
+        fll_error_file_flag_fallback_e,
+        fss_read_file_identify(main->setting.range.start, main->setting.files),
+        f_file_operation_process_s,
+        fll_error_file_type_file_e
+      );
 
       return;
     }
 
-    // Reset all of the used data before starting the loop.
-    main->setting.object->used = 0;
-    main->setting.contents->used = 0;
-
-    for (;;) {
-
-      if (fss_read_signal_check(main)) return;
-
-      if (range.start > range.stop) {
-        if (status_pipe == F_none_eof) break;
-
-        main->setting.block.used = 0;
-
-        status_pipe = f_file_read_block(input, &main->setting.block);
-
-        if (F_status_is_error(status_pipe)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_file_read_block));
-
-          status_pipe = F_status_set_error(F_pipe);
-
-          break;
-        }
-
-        if (!main->setting.block.used) break;
-
-        range.start = 0;
-        range.stop = main->setting.block.used - 1;
-        status_pipe = F_none;
-      }
-
-      // Start Object.
-      if (!state || state == 0x1) {
-        if (!state) {
-          main->setting.object->used = 0;
-
-          state = 0x1;
-        }
-
-        // Reset the "has Content for Object" flag and associated contents array used length.
-        flag -= flag | 0x4;
-        main->setting.contents->used = 0;
-
-        main->setting.state.status = f_string_dynamic_increase_by(main->setting.block.used, main->setting.object);
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_increase_by));
-
-          break;
-        }
-
-        for (; range.start <= range.stop && range.start < main->setting.block.used; ++range.start) {
-
-          // Do not handle start/end while inside an ignore set.
-          if (!(flag & 0x2)) {
-            if (main->setting.block.string[range.start] == fss_read_pipe_content_start_s.string[0]) {
-              state = 0x2;
-              ++range.start;
-
-              break;
-            }
-
-            if (main->setting.block.string[range.start] == fss_read_pipe_content_end_s.string[0]) {
-              state = 0x3;
-              ++range.start;
-
-              break;
-            }
-          }
-
-          // There currently is no support for "ignore" in Objects, but the Ignore should still be processed.
-          if (main->setting.block.string[range.start] == fss_read_pipe_content_ignore_s.string[0]) {
-
-            // Ignore is enabled.
-            if (flag & 0x2) {
-              flag -= 0x2;
-            }
-            else {
-              flag |= 0x2;
-            }
-
-            continue;
-          }
-
-          main->setting.object->string[main->setting.object->used++] = main->setting.block.string[range.start];
-        } // for
-
-        if (F_status_is_error(main->setting.state.status)) break;
-
-        // If the start of Content was not found, then fetch the next block.
-        if (state == 0x1) continue;
-
-        // If the end of the current block is reached, fetch the next block.
-        if (range.start > range.stop) continue;
-      }
-
-      // Begin Content.
-      if (state == 0x2) {
-
-        // Check to see if the Content supports multiple Content per Object.
-        if (flag & 0x4) {
-          if (!(main->setting.flag & fss_read_main_flag_content_multiple_e)) {
-            main->setting.state.status = F_status_set_error(F_support_not);
-
-            fss_read_print_error_one_content_only(&main->program.error);
-
-            break;
-          }
-
-          main->setting.state.status = f_string_dynamics_increase(main->setting.state.step_small, main->setting.contents);
-
-          if (F_status_is_error(main->setting.state.status)) {
-            fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamics_increase));
-
-            break;
-          }
-        }
-
-        if (range.start <= range.stop) {
-          total = (range.stop - range.start) + 1;
-        }
-        else {
-          total = 0;
-        }
-
-        // When payload is provided, all data at this point is part of the payload until the end of the pipe.
-        if (f_compare_dynamic(f_fss_payload_s, *main->setting.object) == F_equal_to) {
-          if (total > 1) {
-            main->setting.state.status = f_string_dynamic_increase_by(total, &main->setting.contents->array[main->setting.contents->used]);
-
-            if (F_status_is_error(main->setting.state.status)) {
-              fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_increase_by));
-
-              break;
-            }
-
-            memcpy(main->setting.contents->array[main->setting.contents->used].string, main->setting.block.string + range.start, sizeof(f_char_t) * total);
-
-            main->setting.contents->array[main->setting.contents->used].used += total;
-          }
-
-          state = 0x4;
-          flag |= 0x8;
-
-          // Designate to read next block from pipe.
-          range.start = 1;
-          range.stop = 0;
-
-          continue;
-        }
-
-        if (total) {
-          main->setting.state.status = f_string_dynamic_increase_by(total, &main->setting.contents->array[main->setting.contents->used]);
-
-          if (F_status_is_error(main->setting.state.status)) {
-            fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_increase_by));
-
-            break;
-          }
-
-          for (; range.start <= range.stop && range.start < main->setting.block.used; ++range.start) {
-
-            // Do not handle start/end while inside an ignore set.
-            if (!(flag & 0x2)) {
-              if (main->setting.block.string[range.start] == fss_read_pipe_content_start_s.string[0]) {
-                main->setting.state.status = F_status_set_error(F_support_not);
-
-                fss_read_print_error_one_content_only(&main->program.error);
-
-                break;
-              }
-
-              if (main->setting.block.string[range.start] == fss_read_pipe_content_end_s.string[0]) {
-                state = 0x3;
-                ++range.start;
-
-                break;
-              }
-            }
-
-            // There currently is no support for "ignore" in Contents, but the Ignore should still be processed.
-            if (main->setting.block.string[range.start] == fss_read_pipe_content_ignore_s.string[0]) {
-
-              // Ignore is enabled.
-              if (flag & 0x2) {
-                flag -= 0x2;
-              }
-              else {
-                flag |= 0x2;
-              }
-
-              continue;
-            }
-
-            main->setting.contents->array[main->setting.contents->used].string[main->setting.contents->array[main->setting.contents->used].used++] = main->setting.block.string[range.start];
-          } // for
+    if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {
+      if (!(main->setting.flag & fss_read_main_flag_total_e)) {
+        main->setting.state.status = F_status_set_warning(main->setting.state.status);
 
-          if (F_status_is_error(main->setting.state.status)) break;
-
-          ++main->setting.contents->used;
-          flag |= 0x4;
-        }
-        else {
-          state = 0x3;
-        }
-      }
-
-      // End Object or Content set.
-      if (state == 0x3) {
-        fss_read_payload_process_set(void_main);
-        if (F_status_is_error(main->setting.state.status)) break;
-
-        state = 0;
-        flag |= 0x1;
-
-        // Reset all of the used data for next set.
-        main->setting.object->used = 0;
-        main->setting.contents->used = 0;
-
-        continue;
-      }
-
-      // Payload Object.
-      if (state == 0x4) {
-        if (main->setting.block.used && range.start <= range.stop) {
-          length = (range.stop - range.start) + 1;
-
-          main->setting.state.status = f_string_dynamic_increase_by(length + 1, &main->setting.contents->array[main->setting.contents->used]);
-
-          if (F_status_is_error(main->setting.state.status)) {
-            fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_increase_by));
-
-            break;
-          }
-
-          memcpy(main->setting.contents->array[main->setting.contents->used].string + range.start, main->setting.block.string, sizeof(f_char_t) * length);
-
-          main->setting.contents->array[main->setting.contents->used].used += length;
-        }
-
-        // Designate to read next block from pipe.
-        range.start = 1;
-        range.stop = 0;
-
-        // Reset all of the used data for next set.
-        main->setting.object->used = 0;
-        main->setting.contents->used = 0;
+        return;
       }
-    } // for
-
-    // 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) {
-      fss_read_payload_process_set(void_main);
-
-      flag |= 0x1;
     }
 
-    main->setting.block.used = 0;
-    main->setting.buffer.used = 0;
-    main->setting.object->used = 0;
-    main->setting.contents->used = 0;
-    main->setting.objects.used = used_objects;
-    main->setting.contentss.used = used_contents;
-
-    if (F_status_is_error_not(main->setting.state.status)) {
-      if (flag & 0x1) {
-        if (flag & 0x8) {
-          main->setting.state.status = F_payload;
-        }
-        else {
-          main->setting.state.status = F_none;
-        }
-      }
-      else {
-        main->setting.state.status = F_data_not;
-      }
-
-      // Payload.
-      if (main->setting.contentss.used && (flag & 0x8)) {
-        fll_print_dynamic(f_fss_payload_header_close_s, main->program.output.to);
-      }
-    }
+    main->setting.state.status = F_none;
   }
-#endif // _di_fss_read_payload_process_pipe_
+#endif // _di_fss_read_payload_process_load_
 
 #ifndef _di_fss_read_payload_process_set_
   void fss_read_payload_process_set(void * const void_main) {
@@ -362,154 +74,6 @@ extern "C" {
 
     fss_read_main_t * const main = (fss_read_main_t *) void_main;
 
-    if ((!(main->setting.flag & fss_read_main_flag_partial_e) || (main->setting.flag & fss_read_main_flag_partial_e) && (main->setting.flag & fss_read_main_flag_object_e))) {
-      if (main->setting.object && !(main->setting.flag & fss_read_main_flag_partial_e) && main->setting.contents && main->setting.contents->used) {
-        if (main->setting.object->used) {
-          main->setting.range.start = 0;
-          main->setting.range.stop = main->setting.object->used - 1;
-        }
-        else {
-          main->setting.range.start = 1;
-          main->setting.range.stop = 0;
-        }
-
-        fll_fss_payload_write(
-          *main->setting.object,
-          main->setting.contents->array[0],
-          (main->setting.flag & fss_read_main_flag_trim_e),
-          (main->setting.flag & fss_read_main_flag_prepend_e)
-            ? &main->setting.prepend
-            : 0,
-          &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(fll_fss_payload_write));
-
-          return;
-        }
-      }
-      else {
-        if (main->setting.object) {
-          if (main->setting.object->used) {
-            main->setting.range.start = 0;
-            main->setting.range.stop = main->setting.object->used - 1;
-          }
-          else {
-            main->setting.range.start = 1;
-            main->setting.range.stop = 0;
-          }
-
-          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));
-
-              return;
-            }
-          }
-        }
-      }
-    }
-    else {
-      if (main->setting.contents && main->setting.contents->used && main->setting.contents->array[0].used) {
-        main->setting.range.start = 0;
-        main->setting.range.stop = main->setting.contents->array[0].used - 1;
-
-        const f_string_static_t *prepend = 0;
-
-        if (main->setting.flag & fss_read_main_flag_prepend_e) {
-          const f_array_length_t index = main->program.parameters.array[fss_read_parameter_prepend_e].values.array[main->program.parameters.array[fss_read_parameter_prepend_e].location]];
-
-          prepend = &main->program.parameters.arguments.array[index];
-        }
-
-        fl_fss_basic_list_content_write(
-          main->setting.contents->array[0],
-          main->setting.object
-            ? f_fss_complete_full_e
-            : f_fss_complete_none_e,
-          prepend,
-          &main->setting.range,
-          &main->setting.buffer,
-          &main->setting.state
-        );
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_payload_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))) {
-        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));
-
-          return;
-        }
-      }
-    }
-
-    if (!main->setting.object || !(main->setting.contents && main->setting.contents->used)) {
-      main->setting.state.status = f_string_dynamic_append(f_string_eol_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));
-
-        return;
-      }
-    }
-
-    fll_print_dynamic(main->setting.buffer, main->program.output.to);
-
-    main->setting.buffer.used = 0;
     main->setting.state.status = F_none;
   }
 #endif // _di_fss_read_payload_process_set_
@@ -525,6 +89,8 @@ extern "C" {
     if ((main->program.parameters.array[fss_read_parameter_object_e].result & f_console_result_value_e) && values->used) {
       for (f_array_length_t i = 0; i < values->used; ++i) {
 
+        if (fss_read_signal_check(main)) return;
+
         if (f_compare_dynamic(argv[values->array[i]], fss_read_payload_s) == F_equal_to && i + 1 < values->used) {
           main->setting.state.status = F_status_set_error(F_parameter);
 
index b68c29b33a73695c82346b7c69b2de502dec9957..1d717482b567a2c1f1196e9c62a09b099ef5e91a 100644 (file)
@@ -86,7 +86,9 @@ extern "C" {
 #endif // _di_fss_read_payload_process_help_
 
 /**
- * Process the pipe, reading from the pipe and writing to the output.
+ * Process the buffer, loading the FSS data.
+ *
+ * This will print an error message on error.
  *
  * @param main
  *   The program and settings data.
@@ -96,19 +98,19 @@ extern "C" {
  *
  *   This alters main.setting.state.status:
  *     F_none on success.
- *     F_data_not on success but pipe contained no relevant data.
- *     F_payload on success and the payload has been printed.
- *     F_interrupt on (exit) signal received.
  *
- *     F_parameter (with error bit) if main is NULL or setting is NULL.
+ *     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: fss_read_signal_check().
+ *     Errors (with error bit) from: fll_fss_payload_read()
  *
- * @see fss_read_signal_check()
+ * @see fll_fss_payload_read()
+ *
+ * @see fss_read_file_identify()
  */
-#ifndef _di_fss_read_payload_process_pipe_
-  extern void fss_read_payload_process_pipe(void * const main);
-#endif // _di_fss_read_payload_process_pipe_
+#ifndef _di_fss_read_payload_process_load_
+  extern void fss_read_payload_process_load(void * const main);
+#endif // _di_fss_read_payload_process_load_
 
 /**
  * Process a given object and content, printing the FSS if valid or an error if invalid.
@@ -143,11 +145,8 @@ extern "C" {
  * @param setting
  *   The main program settings.
  *
- *   This alters setting.process_help, setting.process_normal, and setting.process_pipe.
- *
  *   This alters setting.state.status:
  *     F_none on success.
- *     F_interrupt on (exit) signal received.
  *
  *     F_parameter (with error bit) if main is NULL or setting is NULL.
  *     F_parameter (with error bit) on parameter error.
@@ -157,6 +156,7 @@ extern "C" {
  *     F_data_not on success but nothing was provided to operate with.
  *
  * @see fss_read_setting_load()
+ * @see fss_read_signal_check()
  */
 #ifndef _di_fss_read_payload_setting_load_
   extern void fss_read_payload_setting_load(const f_console_arguments_t arguments, fss_read_main_t * const main);
index c96756287c6688d8930a6f0732ae80756821b06a..5ee4ae493d685e82411f7519bbf72e864de716dd 100644 (file)
@@ -10,34 +10,36 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.flag |= fss_read_print_flag_out_e;
   data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
   data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
   data.program.error.custom = (void *) &data;
   data.program.debug.custom = (void *) &data;
   data.program.message.custom = (void *) &data;
   data.program.output.custom = (void *) &data;
   data.program.warning.custom = (void *) &data;
 
+  data.setting.flag |= fss_read_main_flag_trim_object_e;
+
   data.setting.state.custom = (void *) &data;
   data.setting.standard = fss_read_payload_standard_s;
 
-  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_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;
+  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_payload_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 ffd9c101edfc8a409c4a2eea55b7a04bad3aa227..2b5cccafca808865f22bd3f7c4ebf541fa405d44 100644 (file)
@@ -41,11 +41,13 @@ extern "C" {
     //
     //The Content of the explicit Object of 'payload' will not contain any Content close pipe control codes when using --pipe.
 
+    /*
     fl_print_format("%r  The FSS-000E (Payload) specification does not support quoted names, therefore the parameters '%[%r%r%]'", print->to, f_string_eol_s, print->set->notable, f_console_symbol_long_normal_s, fss_read_long_single_s, print->set->notable);
     fl_print_format(" and '%[%r%r%]' do nothing.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, fss_read_long_double_s, print->set->notable, f_string_eol_s, f_string_eol_s);
 
     fl_print_format("  This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print->to, print->set->notable, f_console_symbol_long_normal_s, fss_read_long_ignore_s, print->set->notable, f_string_eol_s);
     fl_print_format("  This parameter requires two values.%r", print->to, f_string_eol_s);
+    */
 
     f_file_stream_flush(print->to);
     f_file_stream_unlock(print->to);
index f9e2d5bc9c8bf3eac123012112584223a96113b3..78f5d98e4501d3ee893a9f9cc8a4e779dd601745 100644 (file)
@@ -17,6 +17,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.flag |= fss_write_print_flag_out_e;
   data.program.message.flag |= fss_write_print_flag_message_e | fss_write_print_flag_out_e;
   data.program.warning.flag |= fss_write_print_flag_warning_e | fss_write_print_flag_out_e;
+
   data.program.error.custom = (void *) &data;
   data.program.debug.custom = (void *) &data;
   data.program.message.custom = (void *) &data;
@@ -120,8 +121,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
           main->setting.standard = fss_write_basic_standard_s;
 
-          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.
+          // Remove flags not supported for this standard.
+          main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e;
+          main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e;
 
           main->callback.process_content = &fss_write_basic_process_content;
           main->callback.process_help = &fss_write_basic_process_help;
@@ -137,7 +139,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
           main->setting.standard = fss_write_extended_standard_s;
 
-          main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e; // Not supported by extended.
+          // Remove flags not supported for this standard.
+          main->setting.flag -= 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_extended_process_content;
@@ -154,8 +158,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
           main->setting.standard = fss_write_basic_list_standard_s;
 
-          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.
+          // Remove flags not supported for this standard.
+          main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e;
+          main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e;
 
           main->callback.process_content = &fss_write_basic_list_process_content;
           main->callback.process_help = &fss_write_basic_list_process_help;
@@ -171,8 +176,10 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
           main->setting.standard = fss_write_extended_list_standard_s;
 
+          // Remove flags not supported for this standard.
+          main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e;
+
           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;
@@ -205,8 +212,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
           main->setting.standard = fss_write_payload_standard_s;
 
-          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.
+          // Remove flags not supported for this standard.
+          main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e;
+          main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e;
 
           main->callback.process_content = 0;
           main->callback.process_help = &fss_write_payload_process_help;
index 9e2bd11712321754ba6fa5cc8ea76b78529e8745..06b01cb5d0151a110b98598dfcb34ddfa447b099 100644 (file)
@@ -10,6 +10,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.program.output.flag |= fss_write_print_flag_out_e;
   data.program.message.flag |= fss_write_print_flag_message_e | fss_write_print_flag_out_e;
   data.program.warning.flag |= fss_write_print_flag_warning_e | fss_write_print_flag_out_e;
+
   data.program.error.custom = (void *) &data;
   data.program.debug.custom = (void *) &data;
   data.program.message.custom = (void *) &data;