]> Kevux Git Server - fll/commitdiff
Update: Centralize the error print function names.
authorKevin Day <thekevinday@gmail.com>
Sat, 10 Dec 2022 22:36:27 +0000 (16:36 -0600)
committerKevin Day <thekevinday@gmail.com>
Sat, 10 Dec 2022 22:36:27 +0000 (16:36 -0600)
This reduces repeated strings in the code.
A helper macro is used so that the individual code never needs to be changed if there are any changes to the array and the enumeration.

This reduces the binary file size.

45 files changed:
level_3/fss_write/c/basic/fss_write.c
level_3/fss_write/c/basic/fss_write.h
level_3/fss_write/c/basic_list/fss_write.c
level_3/fss_write/c/basic_list/fss_write.h
level_3/fss_write/c/embedded_list/fss_write.c
level_3/fss_write/c/embedded_list/fss_write.h
level_3/fss_write/c/extended/fss_write.c
level_3/fss_write/c/extended/fss_write.h
level_3/fss_write/c/extended_list/fss_write.c
level_3/fss_write/c/extended_list/fss_write.h
level_3/fss_write/c/main/common-print.c [new file with mode: 0644]
level_3/fss_write/c/main/common-print.h [new file with mode: 0644]
level_3/fss_write/c/main/common.c
level_3/fss_write/c/main/fss_write.c
level_3/fss_write/c/main/fss_write.h
level_3/fss_write/c/payload/fss_write.c
level_3/fss_write/c/payload/fss_write.h
level_3/fss_write/data/build/settings
level_3/iki_read/c/common-print.c [new file with mode: 0644]
level_3/iki_read/c/common-print.h [new file with mode: 0644]
level_3/iki_read/c/common.c
level_3/iki_read/c/iki_read.c
level_3/iki_read/c/iki_read.h
level_3/iki_read/c/private-read.c
level_3/iki_read/data/build/settings
level_3/iki_write/c/common-print.c [new file with mode: 0644]
level_3/iki_write/c/common-print.h [new file with mode: 0644]
level_3/iki_write/c/common.c
level_3/iki_write/c/iki_write.c
level_3/iki_write/c/iki_write.h
level_3/iki_write/c/private-write.c
level_3/iki_write/data/build/settings
level_3/status_code/c/common-print.c [new file with mode: 0644]
level_3/status_code/c/common-print.h [new file with mode: 0644]
level_3/status_code/c/common.c
level_3/status_code/c/status_code.c
level_3/status_code/c/status_code.h
level_3/status_code/data/build/settings
level_3/utf8/c/common-print.c [new file with mode: 0644]
level_3/utf8/c/common-print.h [new file with mode: 0644]
level_3/utf8/c/common.c
level_3/utf8/c/private-utf8.c
level_3/utf8/c/utf8.c
level_3/utf8/c/utf8.h
level_3/utf8/data/build/settings

index 57c01c336ea89187708c0b13c715811ca3170334..992627992ca5245918131b5018e315a9d3b72185 100644 (file)
@@ -31,7 +31,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "fl_fss_basic_content_write");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_basic_content_write));
 
       return;
     }
@@ -78,7 +78,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "fl_fss_basic_object_write");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_basic_object_write));
     }
   }
 #endif // _di_fss_write_basic_process_object_
index 6a05ea8d26aabe585dd0780a4e38a98e80e52f74..ed6d4f458a96aeefb694187788338521af7576ae 100644 (file)
@@ -44,6 +44,7 @@
 
 // FSS Write includes.
 #include <program/fss_write/main/common.h>
+#include <program/fss_write/main/common-print.h>
 #include <program/fss_write/basic/common.h>
 #include <program/fss_write/main/print.h>
 #include <program/fss_write/basic/print.h>
index df635927ce2a2fe0c177e954d39694299036e9f9..544f55fb85fc8292d72b86df37b88d7c21747b4e 100644 (file)
@@ -34,7 +34,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "fl_fss_basic_list_content_write");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_basic_list_content_write));
 
       return;
     }
@@ -78,7 +78,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "fl_fss_basic_list_object_write");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_basic_list_object_write));
     }
   }
 #endif // _di_fss_write_basic_list_process_object_
index d27f6e02a286dff97f822bf53adca795e499f423..c67135b760c13d431c263ce05287b546fc119d84 100644 (file)
@@ -45,6 +45,7 @@
 
 // FSS Write includes.
 #include <program/fss_write/main/common.h>
+#include <program/fss_write/main/common-print.h>
 #include <program/fss_write/basic_list/common.h>
 #include <program/fss_write/main/print.h>
 #include <program/fss_write/basic_list/print.h>
index c3a4756736f35d0fa4b2b60c56440f9d0a15a593..6d6ee7353789489010e0cb4d17ba967d97ce0b35 100644 (file)
@@ -35,7 +35,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "fl_fss_embedded_list_content_write");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_embedded_list_content_write));
 
       return;
     }
@@ -79,7 +79,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "fl_fss_embedded_list_object_write");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_embedded_list_object_write));
     }
   }
 #endif // _di_fss_write_embedded_list_process_object_
index a6f72758babc2d3c79834a8d818c6a4e1d2e7688..5a3841c64b5c2ceb4fee2cac591a0276a9512808 100644 (file)
@@ -44,6 +44,7 @@
 
 // FSS Write includes.
 #include <program/fss_write/main/common.h>
+#include <program/fss_write/main/common-print.h>
 #include <program/fss_write/embedded_list/common.h>
 #include <program/fss_write/main/print.h>
 #include <program/fss_write/embedded_list/print.h>
index 6093ece123eb858182948c25df9aa0c35d137b63..44e65083d8193d838b17ba57ad1cd9bdbff70b59 100644 (file)
@@ -36,7 +36,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "fl_fss_extended_content_write");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_extended_content_write));
 
       return;
     }
@@ -83,7 +83,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "fl_fss_extended_object_write");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_extended_object_write));
     }
   }
 #endif // _di_fss_write_extended_process_object_
index d6dffa08829e790e78bdfcc8755f1c7ddfb3d475..058254e8a01fb08bd298d1158d2a98947dd2c562 100644 (file)
@@ -44,6 +44,7 @@
 
 // FSS Write includes.
 #include <program/fss_write/main/common.h>
+#include <program/fss_write/main/common-print.h>
 #include <program/fss_write/extended/common.h>
 #include <program/fss_write/main/print.h>
 #include <program/fss_write/extended/print.h>
index 0bce5f4fd67f471e02ae313adb5ec4ff7f1f3e58..33423f2347d103cec9ae2221edbd7e3dfd0ef5c7 100644 (file)
@@ -35,7 +35,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "fl_fss_extended_list_content_write");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_extended_list_content_write));
 
       return;
     }
@@ -79,7 +79,7 @@ extern "C" {
     }
 
     if (F_status_is_error(macro_fss_write_setting(setting)->status)) {
-      fss_write_print_error(macro_fss_write_setting(setting), main->error, "fl_fss_extended_list_object_write");
+      fss_write_print_error(macro_fss_write_setting(setting), main->error, macro_fss_write_f(fl_fss_extended_list_object_write));
     }
   }
 #endif // _di_fss_write_extended_list_process_object_
index d7a9d414a5ea3dcc28ffebb30cffdaedb13b85cb..44e4649bd421eadd559b56a7ec68dc64efc8b425 100644 (file)
@@ -44,6 +44,7 @@
 
 // FSS Write includes.
 #include <program/fss_write/main/common.h>
+#include <program/fss_write/main/common-print.h>
 #include <program/fss_write/extended_list/common.h>
 #include <program/fss_write/main/print.h>
 #include <program/fss_write/extended_list/print.h>
diff --git a/level_3/fss_write/c/main/common-print.c b/level_3/fss_write/c/main/common-print.c
new file mode 100644 (file)
index 0000000..89157ba
--- /dev/null
@@ -0,0 +1,45 @@
+#include "fss_write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_f_a_
+  const f_string_t fss_write_f_a[] = {
+    "f_console_parameter_process",
+    "f_file_read_block",
+    "f_file_stream_open",
+    "f_fss_is_space",
+    "f_string_dynamic_append",
+    "f_string_dynamic_append_nulless",
+    "f_string_dynamic_increase_by",
+    "f_string_dynamics_increase",
+    "f_string_dynamics_increase_by",
+    "f_string_dynamics_resize",
+    "f_string_dynamicss_increase",
+    "f_string_dynamicss_increase_by",
+    "f_string_ranges_increase",
+    "f_string_ranges_increase_by",
+    "f_string_rangess_increase",
+    "f_string_rangess_increase_by",
+    "f_string_read_block_increase",
+    "fl_fss_basic_content_write",
+    "fl_fss_basic_list_content_write",
+    "fl_fss_basic_list_object_write",
+    "fl_fss_basic_object_write",
+    "fl_fss_embedded_list_content_write",
+    "fl_fss_embedded_list_object_write",
+    "fl_fss_extended_content_write",
+    "fl_fss_extended_list_content_write",
+    "fl_fss_extended_list_object_write",
+    "fl_fss_extended_object_write",
+    "fl_fss_payload_content_write",
+    "fll_program_parameter_process_context",
+    "fll_program_parameter_process_verbosity",
+    "fll_fss_payload_write",
+  };
+#endif // _di_fss_write_f_a_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/main/common-print.h b/level_3/fss_write/c/main/common-print.h
new file mode 100644 (file)
index 0000000..bf38044
--- /dev/null
@@ -0,0 +1,80 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common data structures.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _fss_write_common_print_h
+#define _fss_write_common_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * A special array of strings intended for representing funciton names.
+ *
+ * These are primarily used for printing errors with the function names.
+ *
+ * The macro macro_fss_write_f() is used to reference the array index by the enum name.
+ *
+ * macro_fss_write_f():
+ *   - name: The name of the function.
+ */
+#ifndef _di_fss_write_f_a_
+  extern const f_string_t fss_write_f_a[];
+
+  #define macro_fss_write_f(name) fss_write_f_a[fss_write_f_##name##_e]
+#endif // _di_fss_write_f_a_
+
+/**
+ * An enum representing specific indexes within the above array.
+ *
+ * This is a convenience enum used to make code slightly more readable.
+ */
+#ifndef _di_fss_write_f_e_
+  enum {
+    fss_write_f_f_console_parameter_process_e,
+    fss_write_f_f_file_read_block_e,
+    fss_write_f_f_file_stream_open_e,
+    fss_write_f_f_fss_is_space_e,
+    fss_write_f_f_string_dynamic_append_e,
+    fss_write_f_f_string_dynamic_append_nulless_e,
+    fss_write_f_f_string_dynamic_increase_by_e,
+    fss_write_f_f_string_dynamics_increase_e,
+    fss_write_f_f_string_dynamics_increase_by_e,
+    fss_write_f_f_string_dynamics_resize_e,
+    fss_write_f_f_string_dynamicss_increase_e,
+    fss_write_f_f_string_dynamicss_increase_by_e,
+    fss_write_f_f_string_ranges_increase_e,
+    fss_write_f_f_string_ranges_increase_by_e,
+    fss_write_f_f_string_rangess_increase_e,
+    fss_write_f_f_string_rangess_increase_by_e,
+    fss_write_f_f_string_read_block_increase_e,
+    fss_write_f_fl_fss_basic_content_write_e,
+    fss_write_f_fl_fss_basic_list_content_write_e,
+    fss_write_f_fl_fss_basic_list_object_write_e,
+    fss_write_f_fl_fss_basic_object_write_e,
+    fss_write_f_fl_fss_embedded_list_content_write_e,
+    fss_write_f_fl_fss_embedded_list_object_write_e,
+    fss_write_f_fl_fss_extended_content_write_e,
+    fss_write_f_fl_fss_extended_list_content_write_e,
+    fss_write_f_fl_fss_extended_list_object_write_e,
+    fss_write_f_fl_fss_extended_object_write_e,
+    fss_write_f_fl_fss_payload_content_write_e,
+    fss_write_f_fll_program_parameter_process_context_e,
+    fss_write_f_fll_program_parameter_process_verbosity_e,
+    fss_write_f_fll_fss_payload_write_e,
+  }; // enum
+#endif // _di_fss_write_f_e_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_common_print_h
index 3811190c97b62c31f4b510a3c67fdd0d83968f2f..b7941fa16b875183991786830e264a48ec66dc99 100644 (file)
@@ -76,7 +76,7 @@ extern "C" {
     setting->status = f_console_parameter_process(arguments, &main->parameters);
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "f_console_parameter_process");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(f_console_parameter_process));
 
       return;
     }
@@ -96,7 +96,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          fss_write_print_error(setting, main->error, "fll_program_parameter_process_context");
+          fss_write_print_error(setting, main->error, macro_fss_write_f(fll_program_parameter_process_context));
 
           return;
         }
@@ -127,7 +127,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          fss_write_print_error(setting, main->error, "fll_program_parameter_process_verbosity");
+          fss_write_print_error(setting, main->error, macro_fss_write_f(fll_program_parameter_process_verbosity));
 
           return;
         }
@@ -179,7 +179,7 @@ extern "C" {
       setting->status = f_file_stream_open(main->parameters.arguments.array[index], f_string_empty_s, &main->output.to);
 
       if (F_status_is_error(setting->status)) {
-        fss_write_print_error_file(setting, main->error, "f_file_stream_open", main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e);
+        fss_write_print_error_file(setting, main->error, macro_fss_write_f(f_file_stream_open), main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e);
 
         return;
       }
@@ -204,7 +204,7 @@ extern "C" {
       setting->status = f_string_dynamics_resize(values->used, &setting->objects);
 
       if (F_status_is_error(setting->status)) {
-        fss_write_print_error(setting, main->error, "f_string_dynamics_resize");
+        fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_resize));
 
         return;
       }
@@ -258,7 +258,7 @@ extern "C" {
       setting->status = f_string_dynamicss_increase_by(values_object->used, &setting->contentss);
 
       if (F_status_is_error(setting->status)) {
-        fss_write_print_error(setting, main->error, "f_string_dynamicss_increase_by");
+        fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamicss_increase_by));
 
         return;
       }
@@ -289,7 +289,7 @@ extern "C" {
         setting->status = f_string_dynamics_increase_by(total, &setting->contentss.array[j]);
 
         if (F_status_is_error(setting->status)) {
-          fss_write_print_error(setting, main->error, "f_string_dynamics_increase_by");
+          fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase_by));
 
           return;
         }
@@ -328,7 +328,7 @@ extern "C" {
       setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->prepend);
 
       if (F_status_is_error(setting->status)) {
-        fss_write_print_error(setting, main->error, "f_string_dynamic_append_nulless");
+        fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append_nulless));
 
         return;
       }
@@ -342,7 +342,7 @@ extern "C" {
           setting->status = f_fss_is_space(state, main->parameters.arguments.array[index], range);
 
           if (F_status_is_error(setting->status)) {
-            fss_write_print_error(setting, main->error, "f_fss_is_space");
+            fss_write_print_error(setting, main->error, macro_fss_write_f(f_fss_is_space));
 
             return;
           }
@@ -397,7 +397,7 @@ extern "C" {
         setting->status = f_string_rangess_increase_by(values_data->used, &setting->ignoress);
 
         if (F_status_is_error(setting->status)) {
-          fss_write_print_error(setting, main->error, "f_string_rangess_increase_by");
+          fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_rangess_increase_by));
 
           return;
         }
@@ -429,7 +429,7 @@ extern "C" {
           setting->status = f_string_ranges_increase_by(total, &setting->ignoress.array[j]);
 
           if (F_status_is_error(setting->status)) {
-            fss_write_print_error(setting, main->error, "f_string_ranges_increase_by");
+            fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_ranges_increase_by));
 
             return;
           }
index a1e0cc08995f1932e5caf6735347dcb146143660..89a82c2473ed0f862fa5454cc8bda1701b2a317e 100644 (file)
@@ -125,7 +125,7 @@ extern "C" {
     setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->objects);
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
 
       return;
     }
@@ -134,7 +134,7 @@ extern "C" {
     setting->status = f_string_dynamicss_increase(setting->state.step_small, &setting->contentss);
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "f_string_dynamicss_increase");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamicss_increase));
 
       return;
     }
@@ -142,7 +142,7 @@ extern "C" {
     setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
 
       return;
     }
@@ -151,7 +151,7 @@ extern "C" {
     setting->status = f_string_rangess_increase(setting->state.step_small, &setting->ignoress);
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "f_string_rangess_increase");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_rangess_increase));
 
       return;
     }
@@ -183,7 +183,7 @@ extern "C" {
         status_pipe = f_file_read_block(input, &setting->block);
 
         if (F_status_is_error(status_pipe)) {
-          fss_write_print_error(setting, main->error, "f_file_read_block");
+          fss_write_print_error(setting, main->error, macro_fss_write_f(f_file_read_block));
 
           status_pipe = F_status_set_error(F_pipe);
 
@@ -211,7 +211,7 @@ extern "C" {
         setting->status = f_string_dynamic_increase_by(setting->block.used, setting->object);
 
         if (F_status_is_error(setting->status)) {
-          fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+          fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
 
           break;
         }
@@ -277,7 +277,7 @@ extern "C" {
           setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
 
           if (F_status_is_error(setting->status)) {
-            fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+            fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
 
             break;
           }
@@ -294,7 +294,7 @@ extern "C" {
           setting->status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]);
 
           if (F_status_is_error(setting->status)) {
-            fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+            fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
 
             break;
           }
@@ -328,7 +328,7 @@ extern "C" {
                 setting->status = f_string_ranges_increase(setting->state.step_small, setting->ignores);
 
                 if (F_status_is_error(setting->status)) {
-                  fss_write_print_error(setting, main->error, "f_string_ranges_increase");
+                  fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_ranges_increase));
 
                   break;
                 }
index 95f34343f6bf91fafae766bd17e2b541be1e50ed..aa88b904e7d262249d71457b92731a1c5856fd57 100644 (file)
@@ -43,6 +43,7 @@
 
 // FSS Write includes.
 #include <program/fss_write/main/common.h>
+#include <program/fss_write/main/common-print.h>
 #include <program/fss_write/main/print.h>
 
 #ifdef __cplusplus
index 08bf899635fdbb20bc9c25f934ebcabf0820b025..ad4a2e184781afc9b61af29d996964ff855a4d9a 100644 (file)
@@ -44,7 +44,7 @@ extern "C" {
     setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->objects);
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
 
       return;
     }
@@ -53,7 +53,7 @@ extern "C" {
     setting->status = f_string_dynamicss_increase(setting->state.step_small, &setting->contentss);
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "f_string_dynamicss_increase");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamicss_increase));
 
       return;
     }
@@ -61,7 +61,7 @@ extern "C" {
     setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
 
       return;
     }
@@ -70,7 +70,7 @@ extern "C" {
     setting->status = f_string_rangess_increase(setting->state.step_small, &setting->ignoress);
 
     if (F_status_is_error(setting->status)) {
-      fss_write_print_error(setting, main->error, "f_string_rangess_increase");
+      fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_rangess_increase));
 
       return;
     }
@@ -102,7 +102,7 @@ extern "C" {
         status_pipe = f_file_read_block(input, &setting->block);
 
         if (F_status_is_error(status_pipe)) {
-          fss_write_print_error(setting, main->error, "f_file_read_block");
+          fss_write_print_error(setting, main->error, macro_fss_write_f(f_file_read_block));
 
           status_pipe = F_status_set_error(F_pipe);
 
@@ -130,7 +130,7 @@ extern "C" {
         setting->status = f_string_dynamic_increase_by(setting->block.used, setting->object);
 
         if (F_status_is_error(setting->status)) {
-          fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+          fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
 
           break;
         }
@@ -196,7 +196,7 @@ extern "C" {
           setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
 
           if (F_status_is_error(setting->status)) {
-            fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+            fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
 
             break;
           }
@@ -215,7 +215,7 @@ extern "C" {
             setting->status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]);
 
             if (F_status_is_error(setting->status)) {
-              fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+              fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
 
               break;
             }
@@ -239,7 +239,7 @@ extern "C" {
           setting->status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]);
 
           if (F_status_is_error(setting->status)) {
-            fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+            fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
 
             break;
           }
@@ -315,7 +315,7 @@ extern "C" {
           setting->status = f_string_dynamic_increase_by(length + 1, &setting->contents->array[setting->contents->used]);
 
           if (F_status_is_error(setting->status)) {
-            fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+            fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
 
             break;
           }
@@ -411,7 +411,7 @@ extern "C" {
         }
 
         if (F_status_is_error(setting->status)) {
-          fss_write_print_error(setting, main->error, "fll_fss_payload_write");
+          fss_write_print_error(setting, main->error, macro_fss_write_f(fll_fss_payload_write));
 
           return;
         }
@@ -451,7 +451,7 @@ extern "C" {
         }
 
         if (F_status_is_error(setting->status)) {
-          fss_write_print_error(setting, main->error, "fl_fss_basic_list_object_write");
+          fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_basic_list_object_write));
 
           return;
         }
@@ -481,7 +481,7 @@ extern "C" {
       );
 
       if (F_status_is_error(setting->status)) {
-        fss_write_print_error(setting, main->error, "fl_fss_payload_content_write");
+        fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_payload_content_write));
 
         return;
       }
@@ -491,7 +491,7 @@ extern "C" {
       setting->status = f_string_dynamic_append(f_string_eol_s, &setting->buffer);
 
       if (F_status_is_error(setting->status)) {
-        fss_write_print_error(setting, main->error, "f_string_dynamic_append");
+        fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
 
         return;
       }
index 7c3170e1a2800ddb13c0ddb3b82911594a81ce7a..7a874556bffe028045b2ef5101c8f55ce0b52aba 100644 (file)
@@ -45,6 +45,7 @@
 
 // FSS Write includes.
 #include <program/fss_write/main/common.h>
+#include <program/fss_write/main/common-print.h>
 #include <program/fss_write/payload/common.h>
 #include <program/fss_write/main/print.h>
 #include <program/fss_write/payload/print.h>
index d283c3d73866c880889c38203c487fc8efaef0fe..302010f96073c510476687964c4d1bf21e7ee848 100644 (file)
@@ -25,7 +25,7 @@ build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_print -lfll_pr
 build_libraries-level -lfll_2 -lfll_1 -lfll_0
 build_libraries-monolithic -lfll
 
-build_sources_library main/fss_write.c main/common.c main/print.c
+build_sources_library main/fss_write.c main/common.c main/common-print.c main/print.c
 build_sources_library basic/fss_write.c basic/common.c basic/print.c
 build_sources_library basic_list/fss_write.c basic_list/common.c basic_list/print.c
 build_sources_library embedded_list/fss_write.c embedded_list/common.c embedded_list/print.c
@@ -33,7 +33,7 @@ build_sources_library extended/fss_write.c extended/common.c extended/print.c
 build_sources_library extended_list/fss_write.c extended_list/common.c extended_list/print.c
 build_sources_library payload/fss_write.c payload/common.c payload/print.c
 
-build_sources_headers main/fss_write.h main/common.h main/print.h main/private-common.h
+build_sources_headers main/fss_write.h main/common.h main/common-print.h main/print.h main/private-common.h
 build_sources_headers basic/fss_write.h basic/common.h basic/print.h basic/private-common.h
 build_sources_headers basic_list/fss_write.h basic_list/common.h basic_list/print.h
 build_sources_headers embedded_list/fss_write.h embedded_list/common.h embedded_list/print.h
diff --git a/level_3/iki_read/c/common-print.c b/level_3/iki_read/c/common-print.c
new file mode 100644 (file)
index 0000000..b94b513
--- /dev/null
@@ -0,0 +1,31 @@
+#include "iki_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_iki_read_f_a_
+  const f_string_t iki_read_f_a[] = {
+    "f_console_parameter_process",
+    "f_file_descriptor",
+    "f_file_read",
+    "f_file_size_by_id",
+    "f_file_stream_open",
+    "f_file_stream_read_until",
+    "f_string_dynamic_append_nulless",
+    "f_string_dynamic_increase_by",
+    "f_string_dynamic_resize",
+    "f_string_dynamics_append",
+    "f_string_dynamics_increase_by",
+    "f_string_dynamics_resize",
+    "f_string_maps_increase_by",
+    "f_string_triples_increase_by",
+    "fl_iki_read",
+    "fll_program_parameter_process_context",
+    "fll_program_parameter_process_verbosity",
+  };
+#endif // _di_iki_read_f_a_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/iki_read/c/common-print.h b/level_3/iki_read/c/common-print.h
new file mode 100644 (file)
index 0000000..a62097e
--- /dev/null
@@ -0,0 +1,66 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common data structures.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_read_common_print_h
+#define _iki_read_common_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * A special array of strings intended for representing funciton names.
+ *
+ * These are primarily used for printing errors with the function names.
+ *
+ * The macro macro_iki_read_f() is used to reference the array index by the enum name.
+ *
+ * macro_iki_read_f():
+ *   - name: The name of the function.
+ */
+#ifndef _di_iki_read_f_a_
+  extern const f_string_t iki_read_f_a[];
+
+  #define macro_iki_read_f(name) iki_read_f_a[iki_read_f_##name##_e]
+#endif // _di_iki_read_f_a_
+
+/**
+ * An enum representing specific indexes within the above array.
+ *
+ * This is a convenience enum used to make code slightly more readable.
+ */
+#ifndef _di_iki_read_f_e_
+  enum {
+    iki_read_f_f_console_parameter_process_e,
+    iki_read_f_f_file_descriptor_e,
+    iki_read_f_f_file_read_e,
+    iki_read_f_f_file_size_by_id_e,
+    iki_read_f_f_file_stream_open_e,
+    iki_read_f_f_file_stream_read_until_e,
+    iki_read_f_f_string_dynamic_append_nulless_e,
+    iki_read_f_f_string_dynamic_increase_by_e,
+    iki_read_f_f_string_dynamic_resize_e,
+    iki_read_f_f_string_dynamics_append_e,
+    iki_read_f_f_string_dynamics_increase_by_e,
+    iki_read_f_f_string_dynamics_resize_e,
+    iki_read_f_f_string_maps_increase_by_e,
+    iki_read_f_f_string_triples_increase_by_e,
+    iki_read_f_fl_iki_read_e,
+    iki_read_f_fll_program_parameter_process_context_e,
+    iki_read_f_fll_program_parameter_process_verbosity_e,
+  }; // enum
+#endif // _di_iki_read_f_e_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_read_common_print_h
index dc52d8f6eb5bca489128875d9268fdf3d66b7288..2903f9e4e690edd547fea407343efa176984fc75 100644 (file)
@@ -85,7 +85,7 @@ extern "C" {
     setting->status = f_console_parameter_process(arguments, &main->parameters);
 
     if (F_status_is_error(setting->status)) {
-      iki_read_print_error(setting, main->error, "f_console_parameter_process");
+      iki_read_print_error(setting, main->error, macro_iki_read_f(f_console_parameter_process));
 
       return;
     }
@@ -105,7 +105,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          iki_read_print_error(setting, main->error, "fll_program_parameter_process_context");
+          iki_read_print_error(setting, main->error, macro_iki_read_f(fll_program_parameter_process_context));
 
           return;
         }
@@ -136,7 +136,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          iki_read_print_error(setting, main->error, "fll_program_parameter_process_verbosity");
+          iki_read_print_error(setting, main->error, macro_iki_read_f(fll_program_parameter_process_verbosity));
 
           return;
         }
@@ -239,7 +239,7 @@ extern "C" {
       setting->status = f_string_dynamics_increase_by(main->parameters.array[iki_read_parameter_name_e].values.used, &setting->names);
 
       if (F_status_is_error(setting->status)) {
-        iki_read_print_error(setting, main->error, "f_string_dynamics_increase_by");
+        iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamics_increase_by));
 
         return;
       }
@@ -270,7 +270,7 @@ extern "C" {
       } // for
 
       if (F_status_is_error(setting->status)) {
-        iki_read_print_error(setting, main->error, "f_string_dynamics_append");
+        iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamics_append));
 
         return;
       }
@@ -303,7 +303,7 @@ extern "C" {
       setting->status = f_string_maps_increase_by(main->parameters.array[iki_read_parameter_replace_e].values.used / 2, &setting->replace);
 
       if (F_status_is_error(setting->status)) {
-        iki_read_print_error(setting, main->error, "f_string_maps_increase_by");
+        iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_maps_increase_by));
 
         return;
       }
@@ -337,7 +337,7 @@ extern "C" {
         }
 
         if (F_status_is_error(setting->status)) {
-          iki_read_print_error(setting, main->error, "f_string_dynamic_resize");
+          iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize));
 
           return;
         }
@@ -388,7 +388,7 @@ extern "C" {
       setting->status = f_string_triples_increase_by(main->parameters.array[iki_read_parameter_wrap_e].values.used / 3, &setting->wrap);
 
       if (F_status_is_error(setting->status)) {
-        iki_read_print_error(setting, main->error, "f_string_triples_increase_by");
+        iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_triples_increase_by));
 
         return;
       }
@@ -426,7 +426,7 @@ extern "C" {
         }
 
         if (F_status_is_error(setting->status)) {
-          iki_read_print_error(setting, main->error, "f_string_dynamic_resize");
+          iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize));
 
           return;
         }
@@ -551,7 +551,7 @@ extern "C" {
       setting->status = f_string_dynamics_resize(main->parameters.remaining.used, &setting->files);
 
       if (F_status_is_error(setting->status)) {
-        iki_read_print_error(setting, main->error, "f_string_dynamics_resize");
+        iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamics_resize));
 
         return;
       }
@@ -565,7 +565,7 @@ extern "C" {
           setting->status = f_string_dynamic_resize(0, &setting->files.array[setting->files.used]);
 
           if (F_status_is_error(setting->status)) {
-            iki_read_print_error(setting, main->error, "f_string_dynamic_resize");
+            iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize));
 
             return;
           }
@@ -611,7 +611,7 @@ extern "C" {
     setting->status = f_string_triples_increase_by(parameter.values.used / 3, triple);
 
     if (F_status_is_error(setting->status)) {
-      iki_read_print_error(setting, main->error, "f_string_triples_increase_by");
+      iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_triples_increase_by));
 
       return F_false;
     }
@@ -651,7 +651,7 @@ extern "C" {
       }
 
       if (F_status_is_error(setting->status)) {
-        iki_read_print_error(setting, main->error, "f_string_dynamic_resize");
+        iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize));
 
         return F_false;
       }
index e3f67e4460fc9e2ecb9a3da2e01152b760856d76..19bfc296352c6651b40d726506872c6ae8408bf6 100644 (file)
@@ -35,7 +35,7 @@ extern "C" {
       setting->status = f_file_read(file, &setting->buffer);
 
       if (F_status_is_error(setting->status)) {
-        iki_read_print_error_file(setting, main->error, "f_file_read", f_string_ascii_minus_s, f_file_operation_process_s, fll_error_file_type_file_e);
+        iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_read), f_string_ascii_minus_s, f_file_operation_process_s, fll_error_file_type_file_e);
       }
       else {
         iki_read_process_buffer(main, setting);
@@ -69,7 +69,7 @@ extern "C" {
         setting->status = f_file_stream_open(setting->files.array[i], f_string_empty_s, &file);
 
         if (F_status_is_error(setting->status)) {
-          iki_read_print_error_file(setting, main->error, "f_file_stream_open", setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
+          iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_stream_open), setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
 
           return;
         }
@@ -77,7 +77,7 @@ extern "C" {
         setting->status = f_file_descriptor(&file);
 
         if (F_status_is_error(setting->status)) {
-          iki_read_print_error_file(setting, main->error, "f_file_descriptor", setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
+          iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_descriptor), setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
 
           return;
         }
@@ -87,7 +87,7 @@ extern "C" {
         setting->status = f_file_size_by_id(file, &size_file);
 
         if (F_status_is_error(setting->status)) {
-          iki_read_print_error_file(setting, main->error, "f_file_size_by_id", setting->files.array[i], f_file_operation_analyze_s, fll_error_file_type_file_e);
+          iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_size_by_id), setting->files.array[i], f_file_operation_analyze_s, fll_error_file_type_file_e);
 
           break;
         }
@@ -114,7 +114,7 @@ extern "C" {
         setting->status = f_string_dynamic_increase_by(size_file + 1, &setting->buffer);
 
         if (F_status_is_error(setting->status)) {
-          iki_read_print_error_file(setting, main->error, "f_string_dynamic_increase_by", setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
+          iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_string_dynamic_increase_by), setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
 
           break;
         }
@@ -136,7 +136,7 @@ extern "C" {
 
         if (F_status_is_error(setting->status)) {
           if (F_status_set_fine(setting->status) != F_interrupt) {
-            iki_read_print_error_file(setting, main->error, "f_file_stream_read_until", setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
+            iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_stream_read_until), setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
           }
 
           break;
index e26f21705ffece8635eae02b6a217f6bcbdcb220..45f60062148f01169f0ddfd2575cffd0327e911a 100644 (file)
@@ -52,6 +52,7 @@
 
 // IKI Read includes.
 #include <program/iki_read/common.h>
+#include <program/iki_read/common-print.h>
 #include <program/iki_read/print.h>
 
 #ifdef __cplusplus
index 89eea4a2adabfac442b28af2a9c86220981cf257..48d20de2d1c7def8f2228838cbcf59bd7214d538 100644 (file)
@@ -169,7 +169,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      iki_read_print_error(setting, main->error, "fl_iki_read");
+      iki_read_print_error(setting, main->error, macro_iki_read_f(fl_iki_read));
 
       return;
     }
@@ -282,7 +282,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      iki_read_print_error(setting, main->error, "fl_iki_read");
+      iki_read_print_error(setting, main->error, macro_iki_read_f(fl_iki_read));
 
       return;
     }
@@ -396,7 +396,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      iki_read_print_error(setting, main->error, "fl_iki_read");
+      iki_read_print_error(setting, main->error, macro_iki_read_f(fl_iki_read));
 
       return;
     }
@@ -438,7 +438,7 @@ extern "C" {
         setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &name);
 
         if (F_status_is_error(setting->status)) {
-          iki_read_print_error(setting, main->error, "f_string_dynamic_append_nulless");
+          iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_append_nulless));
 
           f_string_dynamic_resize(0, &name);
 
index b7341863209e6e1ab58d4846279a0cef60a3ee15..4babf3b2a514f8c0c48c5fe23cd61a383f96b048 100644 (file)
@@ -22,11 +22,11 @@ build_libraries-individual -lfll_error -lfll_print -lfll_program -lfl_conversion
 build_libraries-level -lfll_2 -lfll_1 -lfll_0
 build_libraries-monolithic -lfll
 
-build_sources_library iki_read.c common.c print.c private-common.c private-print.c private-read.c
+build_sources_library iki_read.c common.c common-print.c print.c private-common.c private-print.c private-read.c
 
 build_sources_program main.c
 
-build_sources_headers iki_read.h common.h print.h
+build_sources_headers iki_read.h common.h common-print.h print.h
 
 build_script yes
 build_shared yes
diff --git a/level_3/iki_write/c/common-print.c b/level_3/iki_write/c/common-print.c
new file mode 100644 (file)
index 0000000..1c97f36
--- /dev/null
@@ -0,0 +1,23 @@
+#include "iki_write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_iki_write_f_a_
+  const f_string_t iki_write_f_a[] = {
+    "f_console_parameter_process",
+    "f_file_read",
+    "f_iki_object_is",
+    "f_string_dynamic_partial_append_nulless",
+    "f_string_dynamic_seek_to",
+    "f_string_dynamics_resize",
+    "fll_iki_content_escape",
+    "fll_program_parameter_process_context",
+    "fll_program_parameter_process_verbosity",
+  };
+#endif // _di_iki_write_f_a_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/iki_write/c/common-print.h b/level_3/iki_write/c/common-print.h
new file mode 100644 (file)
index 0000000..f4b329c
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common data structures.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_write_common_print_h
+#define _iki_write_common_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * A special array of strings intended for representing funciton names.
+ *
+ * These are primarily used for printing errors with the function names.
+ *
+ * The macro macro_iki_write_f() is used to reference the array index by the enum name.
+ *
+ * macro_iki_write_f():
+ *   - name: The name of the function.
+ */
+#ifndef _di_iki_write_f_a_
+  extern const f_string_t iki_write_f_a[];
+
+  #define macro_iki_write_f(name) iki_write_f_a[iki_write_f_##name##_e]
+#endif // _di_iki_write_f_a_
+
+/**
+ * An enum representing specific indexes within the above array.
+ *
+ * This is a convenience enum used to make code slightly more readable.
+ */
+#ifndef _di_iki_write_f_e_
+  enum {
+    iki_write_f_f_console_parameter_process_e,
+    iki_write_f_f_file_read_e,
+    iki_write_f_f_iki_object_is_e,
+    iki_write_f_f_string_dynamic_partial_append_nulless_e,
+    iki_write_f_f_string_dynamic_seek_to_e,
+    iki_write_f_f_string_dynamics_resize_e,
+    iki_write_f_fll_iki_content_escape_e,
+    iki_write_f_fll_program_parameter_process_context_e,
+    iki_write_f_fll_program_parameter_process_verbosity_e,
+  }; // enum
+#endif // _di_iki_write_f_e_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_write_common_print_h
index 6166cc43248bde11c2140a53bd4fb7e5416f4bf5..8a9d1f69b2157f10cab14dabc37e0104c1e09efe 100644 (file)
@@ -61,7 +61,7 @@ extern "C" {
     setting->status = f_console_parameter_process(arguments, &main->parameters);
 
     if (F_status_is_error(setting->status)) {
-      iki_write_print_error(setting, main->error, "f_console_parameter_process");
+      iki_write_print_error(setting, main->error, macro_iki_write_f(f_console_parameter_process));
 
       return;
     }
@@ -81,7 +81,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          iki_write_print_error(setting, main->error, "fll_program_parameter_process_context");
+          iki_write_print_error(setting, main->error, macro_iki_write_f(fll_program_parameter_process_context));
 
           return;
         }
@@ -112,7 +112,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          iki_write_print_error(setting, main->error, "fll_program_parameter_process_verbosity");
+          iki_write_print_error(setting, main->error, macro_iki_write_f(fll_program_parameter_process_verbosity));
 
           return;
         }
@@ -181,7 +181,7 @@ extern "C" {
       setting->status = f_string_dynamics_resize(values->used, &setting->objects);
 
       if (F_status_is_error(setting->status)) {
-        iki_write_print_error(setting, main->error, "f_string_dynamics_resize");
+        iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamics_resize));
 
         return;
       }
@@ -216,7 +216,7 @@ extern "C" {
       setting->status = f_string_dynamics_resize(values->used, &setting->contents);
 
       if (F_status_is_error(setting->status)) {
-        iki_write_print_error(setting, main->error, "f_string_dynamics_resize");
+        iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamics_resize));
 
         return;
       }
index 8f09554defd44f918faae5e7a1d77b53ab51490e..1f7123b84c6c935f7e6774a0e1f42142911f8473 100644 (file)
@@ -61,7 +61,7 @@ extern "C" {
           if (F_status_is_error(status)) {
             setting->status = F_status_set_error(F_pipe);
 
-            iki_write_print_error_file(setting, main->error, "f_file_read", f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
+            iki_write_print_error_file(setting, main->error, macro_iki_write_f(f_file_read), f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
 
             return;
           }
@@ -87,7 +87,7 @@ extern "C" {
         }
 
         if (F_status_is_error(setting->status)) {
-          iki_write_print_error(setting, main->error, "f_string_dynamic_seek_to");
+          iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamic_seek_to));
 
           return;
         }
@@ -112,7 +112,7 @@ extern "C" {
             setting->status = f_string_dynamic_partial_append_nulless(setting->buffer, range, &setting->content);
 
             if (F_status_is_error(setting->status)) {
-              iki_write_print_error(setting, main->error, "f_string_dynamic_partial_append_nulless");
+              iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamic_partial_append_nulless));
 
               return;
             }
@@ -131,7 +131,7 @@ extern "C" {
           setting->status = f_string_dynamic_partial_append_nulless(setting->buffer, range, &setting->object);
 
           if (F_status_is_error(setting->status)) {
-            iki_write_print_error(setting, main->error, "f_string_dynamic_partial_append_nulless");
+            iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamic_partial_append_nulless));
 
             return;
           }
index 67027cdedfab949e5d911064f4d5ef3a5214651e..35d96f20348bdf55c629d47cf5f47ecaf52dfce5 100644 (file)
@@ -52,6 +52,7 @@
 
 // IKI Write includes.
 #include <program/iki_write/common.h>
+#include <program/iki_write/common-print.h>
 #include <program/iki_write/print.h>
 
 #ifdef __cplusplus
index 75311313d7a42b9832f268ba03b74570e6367c40..cdaf9e7c8b8acb191914c4cd247fdf81f68a01a1 100644 (file)
@@ -32,7 +32,7 @@ extern "C" {
     }
 
     if (F_status_is_error(setting->status)) {
-      iki_write_print_error(setting, main->error, "f_iki_object_is");
+      iki_write_print_error(setting, main->error, macro_iki_write_f(f_iki_object_is));
 
       return;
     }
@@ -42,7 +42,7 @@ extern "C" {
     setting->status = fll_iki_content_escape(content, setting->quote, &setting->escaped);
 
     if (F_status_is_error(setting->status)) {
-      iki_write_print_error(setting, main->error, "fll_iki_content_escape");
+      iki_write_print_error(setting, main->error, macro_iki_write_f(fll_iki_content_escape));
 
       return;
     }
index 801023a31f0f5db292a9d036752dd39d47adf5b6..9d29ba52d0ce0f0d348f8db9197f1a5127a123c9 100644 (file)
@@ -21,11 +21,11 @@ build_libraries-individual -lfll_error -lfll_iki -lfll_print -lfll_program -lfl_
 build_libraries-level -lfll_2 -lfll_1 -lfll_0
 build_libraries-monolithic -lfll
 
-build_sources_library iki_write.c common.c print.c private-common.c private-write.c
+build_sources_library iki_write.c common.c common-print.c print.c private-common.c private-write.c
 
 build_sources_program main.c
 
-build_sources_headers iki_write.h common.h print.h
+build_sources_headers iki_write.h common.h common-print.h print.h
 
 build_script yes
 build_shared yes
diff --git a/level_3/status_code/c/common-print.c b/level_3/status_code/c/common-print.c
new file mode 100644 (file)
index 0000000..25ec837
--- /dev/null
@@ -0,0 +1,19 @@
+#include "status_code.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_status_code_f_a_
+  const f_string_t status_code_f_a[] = {
+    "f_console_parameter_process",
+    "status_string_from",
+    "status_string_to",
+    "fll_program_parameter_process_context",
+    "fll_program_parameter_process_verbosity",
+  };
+#endif // _di_status_code_f_a_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/status_code/c/common-print.h b/level_3/status_code/c/common-print.h
new file mode 100644 (file)
index 0000000..f9f7c2f
--- /dev/null
@@ -0,0 +1,54 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common data structures.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _status_code_common_print_h
+#define _status_code_common_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * A special array of strings intended for representing funciton names.
+ *
+ * These are primarily used for printing errors with the function names.
+ *
+ * The macro macro_status_code_f() is used to reference the array index by the enum name.
+ *
+ * macro_status_code_f():
+ *   - name: The name of the function.
+ */
+#ifndef _di_status_code_f_a_
+  extern const f_string_t status_code_f_a[];
+
+  #define macro_status_code_f(name) status_code_f_a[status_code_f_##name##_e]
+#endif // _di_status_code_f_a_
+
+/**
+ * An enum representing specific indexes within the above array.
+ *
+ * This is a convenience enum used to make code slightly more readable.
+ */
+#ifndef _di_status_code_f_e_
+  enum {
+    status_code_f_f_console_parameter_process_e,
+    status_code_f_status_string_from_e,
+    status_code_f_status_string_to_e,
+    status_code_f_fll_program_parameter_process_context_e,
+    status_code_f_fll_program_parameter_process_verbosity_e,
+  }; // enum
+#endif // _di_status_code_f_e_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _status_code_common_print_h
index 74e27d75668b96203222d42f0edda2a0728bd333..1ba6c324bebe39d3e5e6ef84a37d2750898bed4d 100644 (file)
@@ -59,7 +59,7 @@ extern "C" {
     setting->status = f_console_parameter_process(arguments, &main->parameters);
 
     if (F_status_is_error(setting->status)) {
-      status_code_print_error(setting, main->error, "f_console_parameter_process");
+      status_code_print_error(setting, main->error, macro_status_code_f(f_console_parameter_process));
 
       return;
     }
@@ -79,7 +79,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          status_code_print_error(setting, main->error, "fll_program_parameter_process_context");
+          status_code_print_error(setting, main->error, macro_status_code_f(fll_program_parameter_process_context));
 
           return;
         }
@@ -110,7 +110,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          status_code_print_error(setting, main->error, "fll_program_parameter_process_verbosity");
+          status_code_print_error(setting, main->error, macro_status_code_f(fll_program_parameter_process_verbosity));
 
           return;
         }
index 26881be8c9a92ea08fd254edaafba82768d6f80b..bedbeb1dca29818b17f9a672eeb47eb95abf4348 100644 (file)
@@ -14,11 +14,11 @@ extern "C" {
     if (!setting->status_string_from || !setting->status_string_to) {
 
       if (!setting->status_string_from) {
-        status_code_print_error_invalid_callback(setting, main->error, "status_string_from");
+        status_code_print_error_invalid_callback(setting, main->error, macro_status_code_f(status_string_from));
       }
 
       if (!setting->status_string_to) {
-        status_code_print_error_invalid_callback(setting, main->error, "status_string_to");
+        status_code_print_error_invalid_callback(setting, main->error, macro_status_code_f(status_string_to));
       }
 
       setting->status = F_status_set_error(F_parameter);
index d4fd0f2ebaa4f78c7830e2df8fc0defd986636ef..7baab5f5c89af927a08ba13c08c5053b457c70e4 100644 (file)
@@ -43,6 +43,7 @@
 
 // Status Code includes.
 #include <program/status_code/common.h>
+#include <program/status_code/common-print.h>
 #include <program/status_code/print.h>
 
 #ifdef __cplusplus
index 366d881d9554d48b7f269263acdb692fa77d5f91..3889dfbf0476691294a26fd79f26f7475af8a170 100644 (file)
@@ -25,11 +25,11 @@ build_libraries-individual -lfll_error -lfll_print -lfll_program -lfll_status_st
 build_libraries-level -lfll_2 -lfll_1 -lfll_0
 build_libraries-monolithic -lfll
 
-build_sources_library status_code.c common.c print.c private-common.c private-status_code.c
+build_sources_library status_code.c common.c common-print.c print.c private-common.c private-status_code.c
 
 build_sources_program main-status_code.c
 
-build_sources_headers status_code.h common.h print.h
+build_sources_headers status_code.h common.h common-print.h print.h
 
 build_script yes
 build_shared yes
diff --git a/level_3/utf8/c/common-print.c b/level_3/utf8/c/common-print.c
new file mode 100644 (file)
index 0000000..5d26921
--- /dev/null
@@ -0,0 +1,22 @@
+#include "utf8.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_utf8_f_a_
+  const f_string_t utf8_f_a[] = {
+    "f_console_parameter_prioritize_right",
+    "f_console_parameter_process",
+    "f_file_stream_open",
+    "f_string_dynamic_append_nulless",
+    "f_string_dynamics_increase_by",
+    "fll_program_parameter_process_context",
+    "fll_program_parameter_process_verbosity",
+    "utf8_detect_codepoint",
+  };
+#endif // _di_utf8_f_a_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/utf8/c/common-print.h b/level_3/utf8/c/common-print.h
new file mode 100644 (file)
index 0000000..e8bfa4c
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common data structures.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _utf8_common_print_h
+#define _utf8_common_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * A special array of strings intended for representing funciton names.
+ *
+ * These are primarily used for printing errors with the function names.
+ *
+ * The macro macro_utf8_f() is used to reference the array index by the enum name.
+ *
+ * macro_utf8_f():
+ *   - name: The name of the function.
+ */
+#ifndef _di_utf8_f_a_
+  extern const f_string_t utf8_f_a[];
+
+  #define macro_utf8_f(name) utf8_f_a[utf8_f_##name##_e]
+#endif // _di_utf8_f_a_
+
+/**
+ * An enum representing specific indexes within the above array.
+ *
+ * This is a convenience enum used to make code slightly more readable.
+ */
+#ifndef _di_utf8_f_e_
+  enum {
+    utf8_f_f_console_parameter_prioritize_right_e,
+    utf8_f_f_console_parameter_process_e,
+    utf8_f_f_file_stream_open_e,
+    utf8_f_f_string_dynamic_append_nulless_e,
+    utf8_f_f_string_dynamics_increase_by_e,
+    utf8_f_fll_program_parameter_process_context_e,
+    utf8_f_fll_program_parameter_process_verbosity_e,
+    utf8_f_utf8_detect_codepoint_e,
+  }; // enum
+#endif // _di_utf8_f_e_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _utf8_common_print_h
index d473d96f42ca48d59d55473d1556743e1ca7a13b..b763aa0c7291d111f35cfb705b9ea2aaffa8b08e 100644 (file)
@@ -98,7 +98,7 @@ extern "C" {
     setting->status = f_console_parameter_process(arguments, &main->parameters);
 
     if (F_status_is_error(setting->status)) {
-      utf8_print_error(setting, main->error, "f_console_parameter_process");
+      utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_process));
 
       return;
     }
@@ -118,7 +118,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          utf8_print_error(setting, main->error, "fll_program_parameter_process_context");
+          utf8_print_error(setting, main->error, macro_utf8_f(fll_program_parameter_process_context));
 
           return;
         }
@@ -149,7 +149,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          utf8_print_error(setting, main->error, "fll_program_parameter_process_verbosity");
+          utf8_print_error(setting, main->error, macro_utf8_f(fll_program_parameter_process_verbosity));
 
           return;
         }
@@ -164,7 +164,7 @@ extern "C" {
         setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
 
         if (F_status_is_error(setting->status)) {
-          utf8_print_error(setting, main->error, "f_console_parameter_prioritize_right");
+          utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_prioritize_right));
 
           return;
         }
@@ -195,7 +195,7 @@ extern "C" {
         setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
 
         if (F_status_is_error(setting->status)) {
-          utf8_print_error(setting, main->error, "f_console_parameter_prioritize_right");
+          utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_prioritize_right));
 
           return;
         }
@@ -293,7 +293,7 @@ extern "C" {
         setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
 
         if (F_status_is_error(setting->status)) {
-          utf8_print_error(setting, main->error, "f_string_dynamics_increase_by");
+          utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by));
 
           return;
         }
@@ -303,7 +303,7 @@ extern "C" {
         setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
 
         if (F_status_is_error(setting->status)) {
-          utf8_print_error(setting, main->error, "f_string_dynamic_append_nulless");
+          utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamic_append_nulless));
 
           return;
         }
@@ -313,7 +313,7 @@ extern "C" {
         setting->status = f_file_stream_open(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
 
         if (F_status_is_error(setting->status)) {
-          utf8_print_error_file(setting, main->error, "f_file_stream_open", main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
+          utf8_print_error_file(setting, main->error, macro_utf8_f(f_file_stream_open), main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
 
           return;
         }
@@ -353,7 +353,7 @@ extern "C" {
       setting->status = f_string_dynamics_increase_by(main->parameters.array[utf8_parameter_from_file_e].values.used, &setting->path_files_from);
 
       if (F_status_is_error(setting->status)) {
-        utf8_print_error(setting, main->error, "f_string_dynamics_increase_by");
+        utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by));
 
         return;
       }
@@ -372,7 +372,7 @@ extern "C" {
 
         if (F_status_is_error(setting->status)) {
           utf8_print_line_first_locked(setting, main->error);
-          fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_append_nulless", F_true);
+          fll_error_print(main->error, F_status_set_fine(setting->status), macro_utf8_f(f_string_dynamic_append_nulless), F_true);
 
           break;
         }
@@ -424,7 +424,7 @@ extern "C" {
       setting->status = f_string_dynamics_resize(main->parameters.remaining.used, &setting->remaining);
 
       if (F_status_is_error(setting->status)) {
-        utf8_print_error(setting, main->error, "f_string_dynamic_append_nulless");
+        utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamic_append_nulless));
 
         return;
       }
index 5b0d6ab426e01c6e32247166cdc99f8cc8d6cc55..fa24f2c160a27a35ac7d0b8dedfa49cc9fab27a6 100644 (file)
@@ -45,7 +45,7 @@ extern "C" {
 
         if (F_status_is_error(status)) {
           utf8_print_line_first_locked(setting, main->error);
-          fll_error_print(main->error, F_status_set_fine(status), "utf8_detect_codepoint", F_true);
+          fll_error_print(main->error, F_status_set_fine(status), macro_utf8_f(utf8_detect_codepoint), F_true);
 
           break;
         }
index 28ce190558a65d6baee6f5d3ab64282c1251cb97..034525d9226bded385232523c3aec99cb2de3353 100644 (file)
@@ -78,7 +78,7 @@ extern "C" {
         setting->status = f_file_stream_open(setting->path_files_from.array[i], f_string_empty_s, &file);
 
         if (F_status_is_error(setting->status)) {
-          utf8_print_error_file(setting, main->error, "f_file_stream_open", setting->path_files_from.array[i], f_file_operation_open_s, fll_error_file_type_file_e);
+          utf8_print_error_file(setting, main->error, macro_utf8_f(f_file_stream_open), setting->path_files_from.array[i], f_file_operation_open_s, fll_error_file_type_file_e);
 
           break;
         }
index efbcbaa19f317a8cfe6edf1cf501a7d6c5bd0e29..668cbcdaee7319fb4b12292b4e75c09bcdf54c7c 100644 (file)
@@ -56,6 +56,7 @@
 
 // UTF-8 includes.
 #include <program/utf8/common.h>
+#include <program/utf8/common-print.h>
 #include <program/utf8/print.h>
 
 #ifdef __cplusplus
index 501819c4847dd7ca8db75dbb875d7ef99a5c8d59..210338f7b7e1163fa246987ca1a8b8f9de348205 100644 (file)
@@ -22,12 +22,12 @@ build_libraries-individual -lfll_error -lfll_print -lfll_program -lfl_conversion
 build_libraries-level -lfll_2 -lfll_1 -lfll_0
 build_libraries-monolithic -lfll
 
-build_sources_library common.c print.c utf8.c
+build_sources_library common.c common-print.c print.c utf8.c
 build_sources_library private-common.c private-utf8.c private-utf8_bytesequence.c private-utf8_codepoint.c
 
 build_sources_program main.c
 
-build_sources_headers common.h print.h utf8.h
+build_sources_headers common.h common-print.h print.h utf8.h
 
 build_script yes
 build_shared yes