]> Kevux Git Server - fll/commitdiff
Update: Help printing functions and callbacks.
authorKevin Day <Kevin@kevux.org>
Fri, 14 Feb 2025 04:17:50 +0000 (22:17 -0600)
committerKevin Day <Kevin@kevux.org>
Fri, 14 Feb 2025 04:17:50 +0000 (22:17 -0600)
Have most of the help printing functions that might be used as `fl_print_call_t` be consistent with that prototype structure.

Fix some issues where `data.callback` is still used and should now instead be `data.call`.

14 files changed:
level_3/fss_read/c/main/print/message.c
level_3/fss_read/c/main/print/message.h
level_3/fss_write/c/main/print/message.c
level_3/fss_write/c/main/print/message.h
level_3/iki_read/c/eki/main.c
level_3/iki_read/c/eki/print.c
level_3/iki_read/c/eki/print.h
level_3/iki_read/c/eki/process.c
level_3/iki_read/c/iki/main.c
level_3/iki_read/c/iki/print.c
level_3/iki_read/c/iki/print.h
level_3/iki_read/c/iki/process.c
level_3/iki_write/c/main/print/message.c
level_3/iki_write/c/main/print/message.h

index 3cd1cb97cebb6200c6b879b4ea5ad72c27a2d535..34f3bccd6a8dbbdc604875a5249216d464d1fd7c 100644 (file)
@@ -5,9 +5,9 @@ extern "C" {
 #endif
 
 #ifndef _di_fss_read_print_message_help_
-  void fss_read_print_message_help(fl_print_t * const print) {
+  f_status_t fss_read_print_message_help(fl_print_t * const print) {
 
-    if (!print) return;
+    if (!print) return F_status_set_error(F_output_not);
 
     fll_program_print_help_option_standard(print);
 
@@ -27,6 +27,8 @@ extern "C" {
     fll_program_print_help_option(print, fss_read_short_select_s, fss_read_long_select_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "  Select sub-Content at this index.");
     fll_program_print_help_option(print, fss_read_short_total_s, fss_read_long_total_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "   Print the total number of lines.");
     fll_program_print_help_option(print, fss_read_short_trim_s, fss_read_long_trim_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "    Trim Object names on select or print.");
+
+    return F_okay;
   }
 #endif // _di_fss_read_print_message_help_
 
index beeb4aab833bc30c5a5f250225570aa64c816db8..4e705ee4a326fa4b5b32825833a2196edf664d16 100644 (file)
@@ -27,9 +27,15 @@ extern "C" {
  *   The print.custom is expected to be of type fss_read_main_t.
  *
  *   This does not alter print.custom.setting.state.status.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if a parameter is NULL.
  */
 #ifndef _di_fss_read_print_message_help_
-  extern void fss_read_print_message_help(fl_print_t * const print);
+  extern f_status_t fss_read_print_message_help(fl_print_t * const print);
 #endif // _di_fss_read_print_message_help_
 
 /**
index 2e5c349d49927b9a31333fc0797dcc1eee3588d0..139817f0b171c7727e8c699357237a7136d70c1f 100644 (file)
@@ -5,9 +5,9 @@ extern "C" {
 #endif
 
 #ifndef _di_fss_write_print_message_help_
-  void fss_write_print_message_help(fl_print_t * const print) {
+  f_status_t fss_write_print_message_help(fl_print_t * const print) {
 
-    if (!print) return;
+    if (!print) return F_status_set_error(F_output_not);
 
     fll_program_print_help_option_standard(print);
 
@@ -26,6 +26,8 @@ extern "C" {
     fll_program_print_help_option(print, fss_write_short_prepend_s, fss_write_long_prepend_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "     Prepend the given white space characters to the start of each multi-line Content.");
     fll_program_print_help_option(print, fss_write_short_single_s, fss_write_long_single_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "      Use single quotes.");
     fll_program_print_help_option(print, fss_write_short_trim_s, fss_write_long_trim_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "        Trim Object names.");
+
+    return F_okay;
   }
 #endif // _di_fss_write_print_message_help_
 
index 6e00e71c7d359cb848ad895e064ec6f9afa82db4..0bb70e3c3be69c420ded93ac364e240559f1261d 100644 (file)
@@ -27,9 +27,15 @@ extern "C" {
  *   The print.custom is expected to be of type fss_read_main_t.
  *
  *   This does not alter print.custom.setting.state.status.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if a parameter is NULL.
  */
 #ifndef _di_fss_write_print_message_help_
-  extern void fss_write_print_message_help(fl_print_t * const print);
+  extern f_status_t fss_write_print_message_help(fl_print_t * const print);
 #endif // _di_fss_write_print_message_help_
 
 /**
index 803fd9ccc285be6428e2534c18f3fad18a50b4d0..3c88a8ff94a8533824b6b2e80ad02f52d73d38c4 100644 (file)
@@ -22,13 +22,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.setting.state.custom = (void *) &data;
   data.setting.state.handle = &fll_program_standard_signal_handle;
 
-  data.callback.identify_alteration = &iki_read_eki_identify_alteration;
-  data.callback.print_data = &iki_read_eki_print_data;
-  data.callback.print_help = &iki_read_eki_print_message_help;
-  data.callback.process_buffer_ranges = &iki_read_eki_process_buffer_ranges;
-  data.callback.process_buffer_ranges_whole = &iki_read_eki_process_buffer_ranges_whole;
-  data.callback.process_buffer_total = &iki_read_eki_process_buffer_total;
-  data.callback.delete_data = &iki_read_eki_delete_data;
+  data.call.identify_alteration = &iki_read_eki_identify_alteration;
+  data.call.print_data = &iki_read_eki_print_data;
+  data.call.print_help = &iki_read_eki_print_message_help;
+  data.call.process_buffer_ranges = &iki_read_eki_process_buffer_ranges;
+  data.call.process_buffer_ranges_whole = &iki_read_eki_process_buffer_ranges_whole;
+  data.call.process_buffer_total = &iki_read_eki_process_buffer_total;
+  data.call.delete_data = &iki_read_eki_delete_data;
 
   f_console_parameter_t parameters[] = iki_read_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
index 35bada7a7ad240baeec8e370e6780bd6bcd7b7af..88b7baba8b3bf9542e4372ae23cfbae0a4d70c7b 100644 (file)
@@ -185,9 +185,9 @@ extern "C" {
 #endif // _di_iki_read_eki_print_data_
 
 #ifndef _di_iki_read_eki_print_message_help_
-  void iki_read_eki_print_message_help(fl_print_t * const print) {
+  f_status_t iki_read_eki_print_message_help(fl_print_t * const print) {
 
-    if (!print) return;
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
 
     f_file_stream_lock(print->to);
 
@@ -203,6 +203,8 @@ extern "C" {
 
     f_file_stream_flush(print->to);
     f_file_stream_unlock(print->to);
+
+    return F_okay;
   }
 #endif // _di_iki_read_eki_print_message_help_
 
index 3eeb09b02a9e85d9b8934f588e9b62bca27d056d..3900a285ca4ad25dbe91a09082e422682bfd3ae8 100644 (file)
@@ -52,9 +52,15 @@ extern "C" {
  *   The output structure to print to.
  *
  *   This does not alter print.custom.setting.state.status.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if a parameter is NULL.
  */
 #ifndef _di_iki_read_eki_print_message_help_
-  extern void iki_read_eki_print_message_help(fl_print_t * const print);
+  extern f_status_t iki_read_eki_print_message_help(fl_print_t * const print);
 #endif // _di_iki_read_eki_print_message_help_
 
 #ifdef __cplusplus
index a08eb1c1857d98f0c1ce7aa44cc827bb851acac8..6823e5a33c08f35a070096e7fc93b24a6f22808c 100644 (file)
@@ -284,8 +284,8 @@ extern "C" {
               else {
                 f_file_stream_lock(main->program.output.to);
 
-                if (main->callback.print_data) {
-                  main->callback.print_data(&main->program.output, i);
+                if (main->call.print_data) {
+                  main->call.print_data(&main->program.output, i);
                 }
 
                 f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
@@ -352,8 +352,8 @@ extern "C" {
             else {
               f_file_stream_lock(main->program.output.to);
 
-              if (main->callback.print_data) {
-                main->callback.print_data(&main->program.output, main->setting.at);
+              if (main->call.print_data) {
+                main->call.print_data(&main->program.output, main->setting.at);
               }
 
               f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
@@ -414,8 +414,8 @@ extern "C" {
 
             if (iki_read_signal_check(main)) return;
 
-            if (main->callback.print_data) {
-              main->callback.print_data(&main->program.output, i);
+            if (main->call.print_data) {
+              main->call.print_data(&main->program.output, i);
             }
 
             f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
@@ -481,8 +481,8 @@ extern "C" {
       main->cache.buffer.string[data->delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
     } // for
 
-    if (main->callback.identify_alteration) {
-      main->callback.identify_alteration(main);
+    if (main->call.identify_alteration) {
+      main->call.identify_alteration(main);
     }
   }
 #endif // _di_iki_read_eki_process_buffer_ranges_prepare_
@@ -548,16 +548,16 @@ extern "C" {
         if (k < main->setting.names.used) {
           if (main->setting.flag & iki_read_main_flag_at_d) {
             if (at++ == main->setting.at) {
-              if (main->callback.print_data) {
-                main->callback.print_data(&main->program.output, j);
+              if (main->call.print_data) {
+                main->call.print_data(&main->program.output, j);
               }
             }
             else {
               f_print_dynamic_partial(main->cache.buffer, data->variable.array[j], main->program.output.to);
             }
           }
-          else if (main->callback.print_data) {
-            main->callback.print_data(&main->program.output, j);
+          else if (main->call.print_data) {
+            main->call.print_data(&main->program.output, j);
           }
         }
         else {
@@ -568,8 +568,8 @@ extern "C" {
       }
       else if (main->setting.flag & iki_read_main_flag_at_d) {
         if (at++ == main->setting.at) {
-          if (main->callback.print_data) {
-            main->callback.print_data(&main->program.output, j);
+          if (main->call.print_data) {
+            main->call.print_data(&main->program.output, j);
           }
         }
         else {
@@ -577,8 +577,8 @@ extern "C" {
         }
       }
       else {
-        if (main->callback.print_data) {
-          main->callback.print_data(&main->program.output, j);
+        if (main->call.print_data) {
+          main->call.print_data(&main->program.output, j);
         }
       }
 
index 16bf5649d77a3e7265d3fb73ad102a794e680c7c..531b0355e6b2bd0e157ecc39a703e992f2ae928e 100644 (file)
@@ -23,13 +23,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.setting.state.custom = (void *) &data;
   data.setting.state.handle = &fll_program_standard_signal_handle;
 
-  data.callback.identify_alteration = &iki_read_iki_identify_alteration;
-  data.callback.print_data = &iki_read_iki_print_data;
-  data.callback.print_help = &iki_read_iki_print_message_help;
-  data.callback.process_buffer_ranges = &iki_read_iki_process_buffer_ranges;
-  data.callback.process_buffer_ranges_whole = &iki_read_iki_process_buffer_ranges_whole;
-  data.callback.process_buffer_total = &iki_read_iki_process_buffer_total;
-  data.callback.delete_data = &iki_read_iki_delete_data;
+  data.call.identify_alteration = &iki_read_iki_identify_alteration;
+  data.call.print_data = &iki_read_iki_print_data;
+  data.call.print_help = &iki_read_iki_print_message_help;
+  data.call.process_buffer_ranges = &iki_read_iki_process_buffer_ranges;
+  data.call.process_buffer_ranges_whole = &iki_read_iki_process_buffer_ranges_whole;
+  data.call.process_buffer_total = &iki_read_iki_process_buffer_total;
+  data.call.delete_data = &iki_read_iki_delete_data;
 
   f_console_parameter_t parameters[] = iki_read_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
index a948f0f30ccf2cac91763ab146a1f6e878f86590..ef2ca069dffba8e58c63a373d6e59c5b9b273a17 100644 (file)
@@ -150,9 +150,9 @@ extern "C" {
 #endif // _di_iki_read_iki_print_data_
 
 #ifndef _di_iki_read_iki_print_message_help_
-  void iki_read_iki_print_message_help(fl_print_t * const print) {
+  f_status_t iki_read_iki_print_message_help(fl_print_t * const print) {
 
-    if (!print) return;
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
 
     f_file_stream_lock(print->to);
 
@@ -168,6 +168,8 @@ extern "C" {
 
     f_file_stream_flush(print->to);
     f_file_stream_unlock(print->to);
+
+    return F_okay;
   }
 #endif // _di_iki_read_iki_print_message_help_
 
index 2b325848c0fd32304b84928d49b9e2b6f3e96cbe..ef1cb490a31465fda090ce7face1432c8bfdd2b8 100644 (file)
@@ -52,9 +52,15 @@ extern "C" {
  *   The output structure to print to.
  *
  *   This does not alter print.custom.setting.state.status.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if a parameter is NULL.
  */
 #ifndef _di_iki_read_iki_print_message_help_
-  extern void iki_read_iki_print_message_help(fl_print_t * const print);
+  extern f_status_t iki_read_iki_print_message_help(fl_print_t * const print);
 #endif // _di_iki_read_iki_print_message_help_
 
 #ifdef __cplusplus
index 489ca45552f06db7e40ff37e6ff6729f81cf2688..f61530b6e5712db78f4a1ea370c8080be87ad9c5 100644 (file)
@@ -251,8 +251,8 @@ extern "C" {
             else {
               f_file_stream_lock(main->program.output.to);
 
-              if (main->callback.print_data) {
-                main->callback.print_data(&main->program.output, i);
+              if (main->call.print_data) {
+                main->call.print_data(&main->program.output, i);
               }
 
               f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
@@ -311,8 +311,8 @@ extern "C" {
             else {
               f_file_stream_lock(main->program.output.to);
 
-              if (main->callback.print_data) {
-                main->callback.print_data(&main->program.output, main->setting.at);
+              if (main->call.print_data) {
+                main->call.print_data(&main->program.output, main->setting.at);
               }
 
               f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
@@ -371,8 +371,8 @@ extern "C" {
 
             if (iki_read_signal_check(main)) return;
 
-            if (main->callback.print_data) {
-              main->callback.print_data(&main->program.output, i);
+            if (main->call.print_data) {
+              main->call.print_data(&main->program.output, i);
             }
 
             f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
@@ -438,8 +438,8 @@ extern "C" {
       main->cache.buffer.string[data->delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
     } // for
 
-    if (main->callback.identify_alteration) {
-      main->callback.identify_alteration(main);
+    if (main->call.identify_alteration) {
+      main->call.identify_alteration(main);
     }
   }
 #endif // _di_iki_read_iki_process_buffer_ranges_prepare_
@@ -499,16 +499,16 @@ extern "C" {
         if (k < main->setting.names.used) {
           if (main->setting.flag & iki_read_main_flag_at_d) {
             if (at++ == main->setting.at) {
-              if (main->callback.print_data) {
-                main->callback.print_data(&main->program.output, j);
+              if (main->call.print_data) {
+                main->call.print_data(&main->program.output, j);
               }
             }
             else {
               f_print_dynamic_partial(main->cache.buffer, data->variable.array[j], main->program.output.to);
             }
           }
-          else if (main->callback.print_data) {
-            main->callback.print_data(&main->program.output, j);
+          else if (main->call.print_data) {
+            main->call.print_data(&main->program.output, j);
           }
         }
         else {
@@ -519,8 +519,8 @@ extern "C" {
       }
       else if (main->setting.flag & iki_read_main_flag_at_d) {
         if (at++ == main->setting.at) {
-          if (main->callback.print_data) {
-            main->callback.print_data(&main->program.output, j);
+          if (main->call.print_data) {
+            main->call.print_data(&main->program.output, j);
           }
         }
         else {
@@ -528,8 +528,8 @@ extern "C" {
         }
       }
       else {
-        if (main->callback.print_data) {
-          main->callback.print_data(&main->program.output, j);
+        if (main->call.print_data) {
+          main->call.print_data(&main->program.output, j);
         }
       }
 
index 97a399b9dce18ca05c747111612b4643eb138863..26e2ec9a435de71d8e7b62040c94afde938753d1 100644 (file)
@@ -5,9 +5,9 @@ extern "C" {
 #endif
 
 #ifndef _di_iki_write_print_message_help_
-  void iki_write_print_message_help(fl_print_t * const print) {
+  f_status_t iki_write_print_message_help(fl_print_t * const print) {
 
-    if (!print) return;
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
 
     fll_program_print_help_option(print, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "    Print this help message.");
     fll_program_print_help_option(print, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "    Output using colors that show up better on dark backgrounds.");
@@ -29,6 +29,8 @@ extern "C" {
     fll_program_print_help_option(print, iki_write_short_object_s, iki_write_long_object_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The Object to write.");
     fll_program_print_help_option(print, iki_write_short_single_s, iki_write_long_single_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use single quotes (U+0027).");
     fll_program_print_help_option(print, iki_write_short_wrap_s, iki_write_long_wrap_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "   Wrap the vocabulary name.");
+
+    return F_okay;
   }
 #endif // _di_iki_write_print_message_help_
 
index 044739c310b881c454c707e5139d2ecea33dae42..8a82b7137d24a8891eb0550074debe8e52a00dc5 100644 (file)
@@ -25,9 +25,15 @@ extern "C" {
  *   The print.custom is expected to be of type iki_write_main_t.
  *
  *   This does not alter print.custom.setting.state.status.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if a parameter is NULL.
  */
 #ifndef _di_iki_write_print_message_help_
-  extern void iki_write_print_message_help(fl_print_t * const print);
+  extern f_status_t iki_write_print_message_help(fl_print_t * const print);
 #endif // _di_iki_write_print_message_help_
 
 /**