From 08258cc67a0c76c95ad6d948d1d8eefb54b9a240 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 29 Jan 2022 18:52:39 -0600 Subject: [PATCH] Progress: Continue mass converting to f_string_static_t. Other fixes, cleanups, and improvements are made when observed. --- level_0/f_account/c/account.h | 4 +- level_0/f_account/tests/c/mock-account.h | 4 +- level_0/f_account/tests/c/test-account.h | 4 +- level_0/f_capability/c/capability.h | 4 +- level_0/f_capability/tests/c/mock-capability.h | 4 +- level_0/f_capability/tests/c/test-capability.h | 4 +- level_0/f_color/c/color-common.h | 6 +- level_0/f_color/c/color.h | 4 +- level_0/f_color/tests/c/mock-color.h | 4 +- level_0/f_color/tests/c/test-color.h | 4 +- level_0/f_console/c/console-common.h | 2 +- level_0/f_console/c/console.c | 2 +- level_0/f_console/c/console.h | 2 +- level_0/f_console/tests/c/test-console.h | 4 +- level_0/f_control_group/c/control_group.h | 4 +- .../f_control_group/tests/c/test-control_group.h | 4 +- level_0/f_conversion/c/conversion.h | 4 +- level_0/f_conversion/tests/c/mock-conversion.h | 4 +- level_0/f_conversion/tests/c/test-conversion.h | 4 +- level_0/f_directory/c/directory.h | 4 +- level_0/f_directory/c/directory_type.h | 2 +- level_0/f_environment/c/environment.h | 4 +- level_0/f_execute/c/execute.h | 4 +- level_0/f_file/c/file-common.c | 3 +- level_0/f_file/c/file-common.h | 3 +- level_0/f_file/c/file.c | 45 +- level_0/f_file/c/file.h | 35 +- level_0/f_fss/c/fss.h | 2 +- level_0/f_iki/c/iki.c | 15 +- level_0/f_iki/c/iki.h | 8 +- level_0/f_iki/c/private-iki.c | 2 +- level_0/f_iki/c/private-iki.h | 2 +- level_0/f_limit/c/limit.h | 4 +- level_0/f_memory/c/memory.h | 4 +- level_0/f_memory/tests/c/test-memory.h | 4 +- level_0/f_path/c/path.h | 4 +- level_0/f_pipe/c/pipe.h | 4 +- level_0/f_print/c/print-common.c | 2 + level_0/f_print/c/print-common.h | 6 + level_0/f_print/c/print.h | 4 +- level_0/f_serialize/c/serialize.h | 4 +- level_0/f_signal/c/signal.h | 4 +- level_0/f_socket/c/socket.h | 4 +- level_0/f_status/c/status.h | 2 +- level_0/f_status_string/c/status_string.h | 2 +- level_0/f_string/c/string.h | 4 +- level_0/f_thread/c/thread.h | 4 +- level_0/f_type/c/type.h | 2 +- level_0/f_type_array/c/type_array.h | 2 +- level_0/f_utf/c/utf.h | 4 +- level_1/fl_console/c/console.h | 2 +- level_1/fl_control_group/c/control_group.h | 4 +- level_1/fl_conversion/c/conversion.h | 4 +- level_1/fl_directory/c/directory.h | 4 +- level_1/fl_directory/c/private-directory.c | 16 +- level_1/fl_environment/c/environment.h | 2 +- level_1/fl_execute/c/execute.h | 4 +- level_1/fl_fss/c/fss.h | 4 +- level_1/fl_fss/c/fss_basic.h | 6 +- level_1/fl_fss/c/fss_basic_list.h | 6 +- level_1/fl_fss/c/fss_embedded_list.c | 12 +- level_1/fl_fss/c/fss_embedded_list.h | 6 +- level_1/fl_fss/c/fss_extended.h | 6 +- level_1/fl_fss/c/fss_extended_list.h | 6 +- level_1/fl_iki/c/iki.h | 4 +- level_1/fl_print/c/print.h | 4 +- level_1/fl_signal/c/signal.h | 4 +- level_1/fl_string/c/string.c | 85 +- level_1/fl_string/c/string.h | 4 +- level_1/fl_utf/c/utf.h | 4 +- level_1/fl_utf_file/c/utf_file.h | 4 +- level_2/fll_control_group/c/control_group.h | 6 +- level_2/fll_error/c/error.h | 4 +- level_2/fll_execute/c/execute.c | 26 +- level_2/fll_execute/c/execute.h | 6 +- level_2/fll_execute/c/private-execute.c | 8 +- level_2/fll_file/c/file.h | 6 +- level_2/fll_file/c/private-file.c | 16 +- level_2/fll_fss/c/fss.c | 113 +-- level_2/fll_fss/c/fss.h | 84 +- level_2/fll_fss/c/fss_basic.h | 4 +- level_2/fll_fss/c/fss_basic_list.h | 4 +- level_2/fll_fss/c/fss_embedded_list.h | 4 +- level_2/fll_fss/c/fss_extended.h | 4 +- level_2/fll_fss/c/fss_extended_list.h | 4 +- level_2/fll_fss/c/fss_payload.c | 8 +- level_2/fll_fss/c/fss_payload.h | 4 +- .../fll_fss_status_string/c/fss_status_string.h | 4 +- level_2/fll_iki/c/iki.c | 28 +- level_2/fll_iki/c/iki.h | 14 +- level_2/fll_iki/c/private-iki.c | 20 +- level_2/fll_iki/c/private-iki.h | 4 +- level_2/fll_path/c/path.h | 4 +- level_2/fll_print/c/print.h | 6 +- level_2/fll_program/c/program.c | 109 ++- level_2/fll_program/c/program.h | 64 +- level_2/fll_program/data/build/dependencies | 1 + level_2/fll_program/data/build/settings | 2 +- level_2/fll_status_string/c/status_string.h | 4 +- level_3/byte_dump/c/byte_dump.c | 135 ++- level_3/byte_dump/c/byte_dump.h | 278 +------ level_3/byte_dump/c/common.c | 85 ++ level_3/byte_dump/c/common.h | 356 ++++++++ level_3/byte_dump/c/main.c | 38 +- level_3/byte_dump/c/private-byte_dump.c | 54 +- level_3/byte_dump/c/private-common.c | 2 +- level_3/byte_dump/data/build/settings | 4 +- level_3/control/c/common.c | 46 + level_3/control/c/common.h | 171 ++++ level_3/control/c/control.c | 73 +- level_3/control/c/control.h | 164 +--- level_3/control/c/main.c | 38 +- level_3/control/c/private-common.c | 26 +- level_3/control/c/private-common.h | 26 +- level_3/control/c/private-control.c | 43 +- level_3/control/c/private-print.c | 28 +- level_3/control/data/build/settings | 4 +- level_3/controller/c/common.c | 74 ++ .../c/{controller/controller.h => common.h} | 161 +--- level_3/controller/c/common/private-cache.c | 6 +- level_3/controller/c/common/private-common.c | 2 +- level_3/controller/c/common/private-common.h | 236 +++--- level_3/controller/c/common/private-control.c | 2 +- level_3/controller/c/common/private-entry.c | 2 +- level_3/controller/c/common/private-lock.c | 2 +- level_3/controller/c/common/private-process.c | 4 +- level_3/controller/c/common/private-rule.c | 7 +- level_3/controller/c/common/private-rule.h | 11 +- level_3/controller/c/common/private-setting.c | 2 +- level_3/controller/c/common/private-task.c | 2 +- level_3/controller/c/common/private-thread.c | 2 +- level_3/controller/c/control/private-control.c | 29 +- .../controller/c/control/private-control_print.c | 2 +- level_3/controller/c/{controller => }/controller.c | 161 ++-- level_3/controller/c/controller.h | 144 ++++ level_3/controller/c/controller/controller.? | 0 .../controller/c/controller/private-controller.c | 52 +- .../controller/c/controller/private-controller.h | 6 +- .../c/controller/private-controller_print.c | 4 +- level_3/controller/c/entry/private-entry.c | 266 +++--- level_3/controller/c/entry/private-entry_print.c | 37 +- level_3/controller/c/entry/private-entry_print.h | 26 +- level_3/controller/c/lock/private-lock.c | 2 +- level_3/controller/c/lock/private-lock_print.c | 4 +- level_3/controller/c/main.c | 48 +- level_3/controller/c/process/private-process.c | 2 +- level_3/controller/c/rule/private-rule.c | 661 +++++++-------- level_3/controller/c/rule/private-rule_print.c | 24 +- level_3/controller/c/rule/private-rule_print.h | 8 +- level_3/controller/c/task/private-task.c | 2 +- level_3/controller/c/task/private-task_print.c | 2 +- level_3/controller/c/thread/private-thread.c | 6 +- .../controller/c/thread/private-thread_control.c | 2 +- level_3/controller/c/thread/private-thread_entry.c | 8 +- .../controller/c/thread/private-thread_process.c | 2 +- level_3/controller/c/thread/private-thread_rule.c | 2 +- .../controller/c/thread/private-thread_signal.c | 2 +- level_3/controller/data/build/settings | 10 +- level_3/fake/c/common.c | 192 +++++ level_3/fake/c/common.h | 582 +++++++++++++ level_3/fake/c/fake.c | 152 +--- level_3/fake/c/fake.h | 443 +--------- level_3/fake/c/main.c | 44 +- level_3/fake/c/private-build-library.c | 13 +- level_3/fake/c/private-build-load.c | 327 +++----- level_3/fake/c/private-build-objects.c | 10 +- level_3/fake/c/private-build.c | 66 +- level_3/fake/c/private-common.c | 465 ++++++----- level_3/fake/c/private-common.h | 924 +++++++++++---------- level_3/fake/c/private-fake-path_generate.c | 87 +- level_3/fake/c/private-fake.c | 107 +-- level_3/fake/c/private-make-load_fakefile.c | 98 +-- level_3/fake/c/private-make-load_parameters.c | 24 +- level_3/fake/c/private-make-operate.c | 222 +---- level_3/fake/c/private-make-operate_process.c | 16 +- level_3/fake/c/private-make-operate_process_type.c | 84 +- level_3/fake/c/private-make-operate_validate.c | 244 ++---- level_3/fake/c/private-make.c | 10 +- level_3/fake/c/private-print.c | 164 ++-- level_3/fake/c/private-print.h | 14 +- level_3/fake/c/private-skeleton.c | 52 +- level_3/fake/data/build/settings | 4 +- level_3/firewall/c/firewall.c | 55 +- level_3/firewall/c/firewall.h | 49 +- level_3/firewall/c/main.c | 38 +- level_3/firewall/c/private-common.c | 2 +- level_3/firewall/c/private-firewall.c | 161 ++-- .../fss_basic_list_read/c/fss_basic_list_read.c | 99 ++- .../fss_basic_list_read/c/fss_basic_list_read.h | 49 +- level_3/fss_basic_list_read/c/main.c | 38 +- level_3/fss_basic_list_read/c/private-common.c | 4 +- level_3/fss_basic_list_read/c/private-read.c | 10 +- .../fss_basic_list_write/c/fss_basic_list_write.c | 131 +-- .../fss_basic_list_write/c/fss_basic_list_write.h | 49 +- level_3/fss_basic_list_write/c/main.c | 38 +- level_3/fss_basic_list_write/c/private-common.c | 2 +- level_3/fss_basic_list_write/c/private-write.c | 26 +- level_3/fss_basic_list_write/c/private-write.h | 2 +- level_3/fss_basic_read/c/fss_basic_read.c | 99 ++- level_3/fss_basic_read/c/fss_basic_read.h | 49 +- level_3/fss_basic_read/c/main.c | 38 +- level_3/fss_basic_read/c/private-common.c | 4 +- level_3/fss_basic_read/c/private-read.c | 10 +- level_3/fss_basic_write/c/fss_basic_write.c | 131 +-- level_3/fss_basic_write/c/fss_basic_write.h | 49 +- level_3/fss_basic_write/c/main.c | 38 +- level_3/fss_basic_write/c/private-common.c | 2 +- level_3/fss_basic_write/c/private-write.c | 28 +- level_3/fss_basic_write/c/private-write.h | 2 +- .../c/fss_embedded_list_read.c | 125 +-- .../c/fss_embedded_list_read.h | 49 +- level_3/fss_embedded_list_read/c/main.c | 38 +- level_3/fss_embedded_list_read/c/private-common.c | 2 +- level_3/fss_embedded_list_read/c/private-read.c | 16 +- .../c/fss_embedded_list_write.c | 129 +-- .../c/fss_embedded_list_write.h | 49 +- level_3/fss_embedded_list_write/c/main.c | 38 +- level_3/fss_embedded_list_write/c/private-common.c | 2 +- level_3/fss_embedded_list_write/c/private-write.c | 38 +- level_3/fss_embedded_list_write/c/private-write.h | 2 +- .../c/fss_extended_list_read.c | 99 ++- .../c/fss_extended_list_read.h | 49 +- level_3/fss_extended_list_read/c/main.c | 38 +- level_3/fss_extended_list_read/c/private-common.c | 4 +- level_3/fss_extended_list_read/c/private-read.c | 10 +- .../c/fss_extended_list_write.c | 131 +-- .../c/fss_extended_list_write.h | 49 +- level_3/fss_extended_list_write/c/main.c | 38 +- level_3/fss_extended_list_write/c/private-common.c | 2 +- level_3/fss_extended_list_write/c/private-write.c | 32 +- level_3/fss_extended_list_write/c/private-write.h | 2 +- level_3/fss_extended_read/c/fss_extended_read.c | 99 ++- level_3/fss_extended_read/c/fss_extended_read.h | 49 +- level_3/fss_extended_read/c/main.c | 38 +- level_3/fss_extended_read/c/private-common.c | 2 +- level_3/fss_extended_read/c/private-read.c | 10 +- level_3/fss_extended_write/c/fss_extended_write.c | 135 +-- level_3/fss_extended_write/c/fss_extended_write.h | 49 +- level_3/fss_extended_write/c/main.c | 38 +- level_3/fss_extended_write/c/private-common.c | 2 +- level_3/fss_extended_write/c/private-write.c | 24 +- level_3/fss_identify/c/fss_identify.c | 77 +- level_3/fss_identify/c/fss_identify.h | 49 +- level_3/fss_identify/c/main.c | 38 +- level_3/fss_identify/c/private-common.c | 2 +- level_3/fss_payload_read/c/fss_payload_read.c | 99 ++- level_3/fss_payload_read/c/fss_payload_read.h | 49 +- level_3/fss_payload_read/c/main.c | 38 +- level_3/fss_payload_read/c/private-common.c | 4 +- level_3/fss_payload_read/c/private-read.c | 20 +- level_3/fss_payload_write/c/fss_payload_write.c | 131 +-- level_3/fss_payload_write/c/fss_payload_write.h | 49 +- level_3/fss_payload_write/c/main.c | 38 +- level_3/fss_payload_write/c/private-common.c | 2 +- level_3/fss_payload_write/c/private-write.c | 28 +- level_3/fss_status_code/c/fss_status_code.c | 61 +- level_3/fss_status_code/c/fss_status_code.h | 47 +- level_3/fss_status_code/c/main.c | 38 +- level_3/fss_status_code/c/private-common.c | 2 +- level_3/iki_read/c/iki_read.c | 125 +-- level_3/iki_read/c/iki_read.h | 49 +- level_3/iki_read/c/main.c | 38 +- level_3/iki_read/c/private-common.c | 2 +- level_3/iki_read/c/private-read.c | 23 +- level_3/iki_write/c/iki_write.c | 111 +-- level_3/iki_write/c/iki_write.h | 47 +- level_3/iki_write/c/main.c | 38 +- level_3/iki_write/c/private-common.c | 2 +- level_3/iki_write/c/private-write.c | 12 +- level_3/iki_write/c/private-write.h | 5 +- level_3/status_code/c/main.c | 38 +- level_3/status_code/c/private-common.c | 2 +- level_3/status_code/c/status_code.c | 61 +- level_3/status_code/c/status_code.h | 49 +- level_3/utf8/c/main.c | 38 +- level_3/utf8/c/private-print.c | 18 +- level_3/utf8/c/private-utf8.c | 6 +- level_3/utf8/c/utf8.c | 59 +- level_3/utf8/c/utf8.h | 49 +- 279 files changed, 6489 insertions(+), 6603 deletions(-) create mode 100644 level_3/byte_dump/c/common.c create mode 100644 level_3/byte_dump/c/common.h create mode 100644 level_3/control/c/common.c create mode 100644 level_3/control/c/common.h create mode 100644 level_3/controller/c/common.c rename level_3/controller/c/{controller/controller.h => common.h} (81%) rename level_3/controller/c/{controller => }/controller.c (61%) create mode 100644 level_3/controller/c/controller.h create mode 100644 level_3/controller/c/controller/controller.? create mode 100644 level_3/fake/c/common.c create mode 100644 level_3/fake/c/common.h diff --git a/level_0/f_account/c/account.h b/level_0/f_account/c/account.h index 576fb36..e91038e 100644 --- a/level_0/f_account/c/account.h +++ b/level_0/f_account/c/account.h @@ -13,13 +13,13 @@ #ifndef _F_account_h #define _F_account_h -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_account/tests/c/mock-account.h b/level_0/f_account/tests/c/mock-account.h index d299173..5096422 100644 --- a/level_0/f_account/tests/c/mock-account.h +++ b/level_0/f_account/tests/c/mock-account.h @@ -10,7 +10,7 @@ #ifndef _MOCK__account_h #define _MOCK__account_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ // cmocka includes. #include -// fll-0 includes. +// FLL-0 includes. #include #ifdef __cplusplus diff --git a/level_0/f_account/tests/c/test-account.h b/level_0/f_account/tests/c/test-account.h index 214002e..369a2a8 100644 --- a/level_0/f_account/tests/c/test-account.h +++ b/level_0/f_account/tests/c/test-account.h @@ -10,7 +10,7 @@ #ifndef _TEST__F_account_h #define _TEST__F_account_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ // cmocka includes. #include -// fll-0 includes. +// FLL-0 includes. #include // mock includes. diff --git a/level_0/f_capability/c/capability.h b/level_0/f_capability/c/capability.h index 21e0a44..8e36cdc 100644 --- a/level_0/f_capability/c/capability.h +++ b/level_0/f_capability/c/capability.h @@ -26,7 +26,7 @@ #ifndef _F_capability_h #define _F_capability_h -// libc includes. +// Libc includes. #include #include @@ -34,7 +34,7 @@ #include #endif // _di_libcap_ -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_capability/tests/c/mock-capability.h b/level_0/f_capability/tests/c/mock-capability.h index 756693e..78e9c85 100644 --- a/level_0/f_capability/tests/c/mock-capability.h +++ b/level_0/f_capability/tests/c/mock-capability.h @@ -10,7 +10,7 @@ #ifndef _MOCK__capability_h #define _MOCK__capability_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ // cmocka includes. #include -// fll-0 includes. +// FLL-0 includes. #include #ifdef __cplusplus diff --git a/level_0/f_capability/tests/c/test-capability.h b/level_0/f_capability/tests/c/test-capability.h index 7362238..1d3b9f3 100644 --- a/level_0/f_capability/tests/c/test-capability.h +++ b/level_0/f_capability/tests/c/test-capability.h @@ -10,7 +10,7 @@ #ifndef _TEST__F_capability_h #define _TEST__F_capability_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ // cmocka includes. #include -// fll-0 includes. +// FLL-0 includes. #include // mock includes. diff --git a/level_0/f_color/c/color-common.h b/level_0/f_color/c/color-common.h index 61cd343..6b71d87 100644 --- a/level_0/f_color/c/color-common.h +++ b/level_0/f_color/c/color-common.h @@ -640,13 +640,13 @@ extern "C" { const f_string_static_t *after; } f_color_set_t; - #define f_color_set_t_initialize { &f_string_empty_s, &f_string_empty_s } + #define f_color_set_t_initialize { 0, 0 } #define macro_f_color_set_t_initialize(before, after) { before, after } #define macro_f_color_set_t_clear(set) \ - set.before = &f_string_empty_s; \ - set.after = &f_string_empty_s; + set.before = 0; \ + set.after = 0; #endif // _di_f_color_set_t_ /** diff --git a/level_0/f_color/c/color.h b/level_0/f_color/c/color.h index baaa27e..cee267c 100644 --- a/level_0/f_color/c/color.h +++ b/level_0/f_color/c/color.h @@ -13,12 +13,12 @@ #ifndef _F_color_h #define _F_color_h -// libc includes. +// Libc includes. #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_color/tests/c/mock-color.h b/level_0/f_color/tests/c/mock-color.h index 969301b..7774290 100644 --- a/level_0/f_color/tests/c/mock-color.h +++ b/level_0/f_color/tests/c/mock-color.h @@ -10,7 +10,7 @@ #ifndef _MOCK__color_h #define _MOCK__color_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ // cmocka includes. #include -// fll-0 includes. +// FLL-0 includes. #include #ifdef __cplusplus diff --git a/level_0/f_color/tests/c/test-color.h b/level_0/f_color/tests/c/test-color.h index 0bd48da..9d4e312 100644 --- a/level_0/f_color/tests/c/test-color.h +++ b/level_0/f_color/tests/c/test-color.h @@ -10,7 +10,7 @@ #ifndef _TEST__F_color_h #define _TEST__F_color_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ // cmocka includes. #include -// fll-0 includes. +// FLL-0 includes. #include // mock includes. diff --git a/level_0/f_console/c/console-common.h b/level_0/f_console/c/console-common.h index 5dfad18..6f94d32 100644 --- a/level_0/f_console/c/console-common.h +++ b/level_0/f_console/c/console-common.h @@ -187,7 +187,7 @@ extern "C" { * However, the libc/POSIX appears to limit this to 2^63 (signed). */ #ifndef _di_f_console_length_size_ - #define f_console_parameter_size F_string_t_size_d + #define F_console_parameter_size_d F_string_t_size_d #endif // _di_f_console_length_size_ /** diff --git a/level_0/f_console/c/console.c b/level_0/f_console/c/console.c index f5af02f..6c47e06 100644 --- a/level_0/f_console/c/console.c +++ b/level_0/f_console/c/console.c @@ -211,7 +211,7 @@ extern "C" { f_console_identify(arguments.argv[location], &result); - argument_length = strnlen(arguments.argv[location], f_console_parameter_size); + argument_length = strnlen(arguments.argv[location], F_console_parameter_size_d); // Process the current parameter. if (result == f_console_short_enable_e || result == f_console_short_disable_e) { diff --git a/level_0/f_console/c/console.h b/level_0/f_console/c/console.h index d669de9..f6de2fa 100644 --- a/level_0/f_console/c/console.h +++ b/level_0/f_console/c/console.h @@ -16,7 +16,7 @@ // libc include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_console/tests/c/test-console.h b/level_0/f_console/tests/c/test-console.h index 068ef47..53e9577 100644 --- a/level_0/f_console/tests/c/test-console.h +++ b/level_0/f_console/tests/c/test-console.h @@ -10,7 +10,7 @@ #ifndef _TEST__F_console_h #define _TEST__F_console_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ // cmocka includes. #include -// fll-0 includes. +// FLL-0 includes. #include // test includes. diff --git a/level_0/f_control_group/c/control_group.h b/level_0/f_control_group/c/control_group.h index 972b4c3..f958bd6 100644 --- a/level_0/f_control_group/c/control_group.h +++ b/level_0/f_control_group/c/control_group.h @@ -16,9 +16,9 @@ #ifndef _F_control_group_h #define _F_control_group_h -// libc includes. +// Libc includes. -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_control_group/tests/c/test-control_group.h b/level_0/f_control_group/tests/c/test-control_group.h index dadb17e..29e0261 100644 --- a/level_0/f_control_group/tests/c/test-control_group.h +++ b/level_0/f_control_group/tests/c/test-control_group.h @@ -10,7 +10,7 @@ #ifndef _TEST__F_control_group_h #define _TEST__F_control_group_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ // cmocka includes. #include -// fll-0 includes. +// FLL-0 includes. #include // test includes. diff --git a/level_0/f_conversion/c/conversion.h b/level_0/f_conversion/c/conversion.h index 738771e..bafef57 100644 --- a/level_0/f_conversion/c/conversion.h +++ b/level_0/f_conversion/c/conversion.h @@ -13,12 +13,12 @@ #ifndef _F_conversion_h #define _F_conversion_h -// libc includes. +// Libc includes. #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_conversion/tests/c/mock-conversion.h b/level_0/f_conversion/tests/c/mock-conversion.h index 62b1fba..67c168d 100644 --- a/level_0/f_conversion/tests/c/mock-conversion.h +++ b/level_0/f_conversion/tests/c/mock-conversion.h @@ -10,7 +10,7 @@ #ifndef _MOCK__conversion_h #define _MOCK__conversion_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ // cmocka includes. #include -// fll-0 includes. +// FLL-0 includes. #include #ifdef __cplusplus diff --git a/level_0/f_conversion/tests/c/test-conversion.h b/level_0/f_conversion/tests/c/test-conversion.h index a9a1d68..1cff4e4 100644 --- a/level_0/f_conversion/tests/c/test-conversion.h +++ b/level_0/f_conversion/tests/c/test-conversion.h @@ -10,7 +10,7 @@ #ifndef _TEST__F_conversion_h #define _TEST__F_conversion_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ // cmocka includes. #include -// fll-0 includes. +// FLL-0 includes. #include // mock includes. diff --git a/level_0/f_directory/c/directory.h b/level_0/f_directory/c/directory.h index 7898960..93fd09c 100644 --- a/level_0/f_directory/c/directory.h +++ b/level_0/f_directory/c/directory.h @@ -10,7 +10,7 @@ #ifndef _F_directory_h #define _F_directory_h -// libc includes. +// Libc includes. #include #include #include @@ -30,7 +30,7 @@ #include #endif // __USE_XOPEN_EXTENDED -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_directory/c/directory_type.h b/level_0/f_directory/c/directory_type.h index 309b809..4e33113 100644 --- a/level_0/f_directory/c/directory_type.h +++ b/level_0/f_directory/c/directory_type.h @@ -10,7 +10,7 @@ #ifndef _F_directory_type_h #define _F_directory_type_h -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_environment/c/environment.h b/level_0/f_environment/c/environment.h index ba26a52..33e08da 100644 --- a/level_0/f_environment/c/environment.h +++ b/level_0/f_environment/c/environment.h @@ -10,11 +10,11 @@ #ifndef _F_environment_h #define _F_environment_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_execute/c/execute.h b/level_0/f_execute/c/execute.h index cfd9ca2..a8f5b70 100644 --- a/level_0/f_execute/c/execute.h +++ b/level_0/f_execute/c/execute.h @@ -13,13 +13,13 @@ // include pre-requirements #define _GNU_SOURCE -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include diff --git a/level_0/f_file/c/file-common.c b/level_0/f_file/c/file-common.c index e19b3b3..6d38df6 100644 --- a/level_0/f_file/c/file-common.c +++ b/level_0/f_file/c/file-common.c @@ -6,9 +6,10 @@ extern "C" { #endif #ifndef _di_f_file_type_ - const f_string_static_t f_file_type_name_blocks_s = macro_f_string_static_t_initialize2(F_file_type_name_block_s, 0, F_file_type_name_block_s_length); + const f_string_static_t f_file_type_name_block_s = macro_f_string_static_t_initialize2(F_file_type_name_block_s, 0, F_file_type_name_block_s_length); const f_string_static_t f_file_type_name_character_s = macro_f_string_static_t_initialize2(F_file_type_name_character_s, 0, F_file_type_name_character_s_length); const f_string_static_t f_file_type_name_directory_s = macro_f_string_static_t_initialize2(F_file_type_name_directory_s, 0, F_file_type_name_directory_s_length); + const f_string_static_t f_file_type_name_fifo_s = macro_f_string_static_t_initialize2(F_file_type_name_fifo_s, 0, F_file_type_name_fifo_s_length); const f_string_static_t f_file_type_name_link_s = macro_f_string_static_t_initialize2(F_file_type_name_link_s, 0, F_file_type_name_link_s_length); const f_string_static_t f_file_type_name_regular_s = macro_f_string_static_t_initialize2(F_file_type_name_regular_s, 0, F_file_type_name_regular_s_length); const f_string_static_t f_file_type_name_socket_s = macro_f_string_static_t_initialize2(F_file_type_name_socket_s, 0, F_file_type_name_socket_s_length); diff --git a/level_0/f_file/c/file-common.h b/level_0/f_file/c/file-common.h index f0b96d9..e5bae4b 100644 --- a/level_0/f_file/c/file-common.h +++ b/level_0/f_file/c/file-common.h @@ -104,9 +104,10 @@ extern "C" { #define F_file_open_mode_read_write_s_length 2 #define F_file_open_mode_truncate_s_length 1 - extern const f_string_static_t f_file_type_name_blocks_s; + extern const f_string_static_t f_file_type_name_block_s; extern const f_string_static_t f_file_type_name_character_s; extern const f_string_static_t f_file_type_name_directory_s; + extern const f_string_static_t f_file_type_name_fifo_s; extern const f_string_static_t f_file_type_name_link_s; extern const f_string_static_t f_file_type_name_regular_s; extern const f_string_static_t f_file_type_name_socket_s; diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index 8a32a9d..df98b84 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -59,7 +59,8 @@ extern "C" { return private_f_file_copy_content(source, destination, size_block == 0 ? F_file_default_read_size_d : size_block); } - else if (macro_f_file_type_is_link(source_stat.st_mode)) { + + if (macro_f_file_type_is_link(source_stat.st_mode)) { status = private_f_file_link(destination, source); if (F_status_set_fine(status) == F_file_found) { if (exclusive) return status; @@ -130,7 +131,8 @@ extern "C" { return private_f_file_copy_content(source, destination, size_block == 0 ? F_file_default_read_size_d : size_block); } - else if (macro_f_file_type_is_directory(source_stat.st_mode)) { + + if (macro_f_file_type_is_directory(source_stat.st_mode)) { status = private_f_file_create_directory(destination, (~F_file_type_mask_d) & mode.directory); if (F_status_is_error(status)) { @@ -144,18 +146,20 @@ extern "C" { return F_none; } - else if (macro_f_file_type_is_link(source_stat.st_mode)) { + + if (macro_f_file_type_is_link(source_stat.st_mode)) { f_string_dynamic_t target = f_string_dynamic_t_initialize; status = private_f_file_link_read(source, source_stat, &target); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(target); + f_string_dynamic_resize(0, &target); + return status; } status = private_f_file_link(target.string, destination); - macro_f_string_dynamic_t_delete_simple(target); + f_string_dynamic_resize(0, &target); if (F_status_is_error(status)) { if (F_status_set_fine(status) != F_file_found || exclusive) { @@ -165,7 +169,8 @@ extern "C" { return F_none; } - else if (macro_f_file_type_is_fifo(source_stat.st_mode)) { + + if (macro_f_file_type_is_fifo(source_stat.st_mode)) { status = private_f_file_create_fifo(destination, (~F_file_type_mask_d) & mode.fifo); if (F_status_is_error(status)) { @@ -179,7 +184,8 @@ extern "C" { return F_none; } - else if (macro_f_file_type_is_socket(source_stat.st_mode)) { + + if (macro_f_file_type_is_socket(source_stat.st_mode)) { status = private_f_file_create_node(destination, macro_f_file_type_get(source_stat.st_mode) | ((~F_file_type_mask_d) & mode.socket), source_stat.st_rdev); if (F_status_is_error(status)) { @@ -193,7 +199,8 @@ extern "C" { return F_none; } - else if (macro_f_file_type_is_block(source_stat.st_mode) || macro_f_file_type_is_character(source_stat.st_mode)) { + + if (macro_f_file_type_is_block(source_stat.st_mode) || macro_f_file_type_is_character(source_stat.st_mode)) { status = private_f_file_create_node(destination, macro_f_file_type_get(source_stat.st_mode) | ((~F_file_type_mask_d) & mode.block), source_stat.st_rdev); if (F_status_is_error(status)) { @@ -2589,6 +2596,28 @@ extern "C" { } #endif // _di_f_file_type_at_ +#ifndef _di_f_file_umask_get_ + f_status_t f_file_umask_get(mode_t *mask) { + + // Bad design in POSIX where there is no get umask without setting it. + *mask = umask(0); + + // Restore umask. + umask(*mask); + + return F_none; + } +#endif // _di_f_file_umask_get_ + +#ifndef _di_f_file_umask_set_ + f_status_t f_file_umask_set(const mode_t mask) { + + umask(mask); + + return F_none; + } +#endif // _di_f_file_umask_set_ + #ifndef _di_f_file_write_ f_status_t f_file_write(const f_file_t file, const f_string_static_t buffer, f_array_length_t *written) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_file/c/file.h b/level_0/f_file/c/file.h index 4fb1a13..ea7731c 100644 --- a/level_0/f_file/c/file.h +++ b/level_0/f_file/c/file.h @@ -15,7 +15,7 @@ #ifndef _F_file_h #define _F_file_h -// libc includes. +// Libc includes. #include #include #include @@ -31,7 +31,7 @@ // non-standard libc includs #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -2441,6 +2441,37 @@ extern "C" { #endif // _di_f_file_type_at_ /** + * Get the umask. + * + * This sets the umask after getting the umask. + * This is necessary because the umask() is poorly designed such that it requires changing the umask to get the current umask. + * + * @param mask + * The umask value. + * (The name "mask" is used avoid a naming conflict with the umask() function.) + * + * @return + * F_none on success. + */ +#ifndef _di_f_file_umask_get_ + extern f_status_t f_file_umask_get(mode_t *mask); +#endif // _di_f_file_umask_get_ + +/** + * Set the umask. + * + * @param mask + * The umask value to assigned. + * (The name "mask" is used avoid a naming conflict with the umask() function.) + * + * @return + * F_none on success. + */ +#ifndef _di_f_file_umask_set_ + extern f_status_t f_file_umask_set(const mode_t mask); +#endif // _di_f_file_umask_set_ + +/** * Write until entire buffer is written. * * @param file diff --git a/level_0/f_fss/c/fss.h b/level_0/f_fss/c/fss.h index 1648a7e..b684a1e 100644 --- a/level_0/f_fss/c/fss.h +++ b/level_0/f_fss/c/fss.h @@ -15,7 +15,7 @@ #ifndef _F_fss_h #define _F_fss_h -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_iki/c/iki.c b/level_0/f_iki/c/iki.c index 8e51fc8..81d00cb 100644 --- a/level_0/f_iki/c/iki.c +++ b/level_0/f_iki/c/iki.c @@ -6,28 +6,29 @@ extern "C" { #endif #ifndef _di_f_iki_content_is_ - f_status_t f_iki_content_is(const f_string_static_t content, const uint8_t quote) { + f_status_t f_iki_content_is(const f_string_static_t content, const f_string_static_t quote) { #ifndef _di_level_0_parameter_checking_ - if (content.used > content.size) return F_status_set_error(F_parameter); - if (quote != f_iki_syntax_quote_single_s.string[0] && quote != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); + if (!quote.used) return F_status_set_error(F_parameter); + if (quote.string[0] != f_iki_syntax_quote_single_s.string[0] && quote.string[0] != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ const f_string_range_t range = macro_f_string_range_t_initialize(content.used); - return private_f_iki_content_partial_is(content, range, quote); + return private_f_iki_content_partial_is(content, range, quote.string[0]); } #endif // _di_f_iki_content_is_ #ifndef _di_f_iki_content_partial_is_ - f_status_t f_iki_content_partial_is(const f_string_static_t content, const f_string_range_t range, const uint8_t quote) { + f_status_t f_iki_content_partial_is(const f_string_static_t content, const f_string_range_t range, const f_string_static_t quote) { #ifndef _di_level_0_parameter_checking_ if (content.used > content.size) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); if (range.start >= content.used) return F_status_set_error(F_parameter); - if (quote != f_iki_syntax_quote_single_s.string[0] && quote != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); + if (!quote.used) return F_status_set_error(F_parameter); + if (quote.string[0] != f_iki_syntax_quote_single_s.string[0] && quote.string[0] != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_iki_content_partial_is(content, range, quote); + return private_f_iki_content_partial_is(content, range, quote.string[0]); } #endif // _di_f_iki_content_partial_is_ diff --git a/level_0/f_iki/c/iki.h b/level_0/f_iki/c/iki.h index 86da6b3..30ee183 100644 --- a/level_0/f_iki/c/iki.h +++ b/level_0/f_iki/c/iki.h @@ -13,11 +13,11 @@ #ifndef _F_iki_h #define _F_iki_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -47,7 +47,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_iki_content_is_ - extern f_status_t f_iki_content_is(const f_string_static_t content, const uint8_t quote); + extern f_status_t f_iki_content_is(const f_string_static_t content, const f_string_static_t quote); #endif // _di_f_iki_content_is_ /** @@ -68,7 +68,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_iki_content_partial_is_ - extern f_status_t f_iki_content_partial_is(const f_string_static_t content, const f_string_range_t range, const uint8_t quote); + extern f_status_t f_iki_content_partial_is(const f_string_static_t content, const f_string_range_t range, const f_string_static_t quote); #endif // _di_f_iki_content_partial_is_ /** diff --git a/level_0/f_iki/c/private-iki.c b/level_0/f_iki/c/private-iki.c index b4e5175..d4e5b44 100644 --- a/level_0/f_iki/c/private-iki.c +++ b/level_0/f_iki/c/private-iki.c @@ -48,7 +48,7 @@ extern "C" { #endif // !defined(_di_f_iki_read_) #if !defined(_di_f_iki_content_is_) || !defined(_di_f_iki_content_partial_is_) - f_status_t private_f_iki_content_partial_is(const f_string_static_t buffer, const f_string_range_t range, const uint8_t quote) { + f_status_t private_f_iki_content_partial_is(const f_string_static_t buffer, const f_string_range_t range, const char quote) { f_array_length_t delimits = 0; diff --git a/level_0/f_iki/c/private-iki.h b/level_0/f_iki/c/private-iki.h index 62bd6ac..346b5c3 100644 --- a/level_0/f_iki/c/private-iki.h +++ b/level_0/f_iki/c/private-iki.h @@ -38,7 +38,7 @@ extern "C" { * @see f_iki_content_partial_is() */ #if !defined(_di_f_iki_content_is_) || !defined(_di_f_iki_content_partial_is_) - extern f_status_t private_f_iki_content_partial_is(const f_string_static_t buffer, const f_string_range_t range, const uint8_t quote) F_attribute_visibility_internal_d; + extern f_status_t private_f_iki_content_partial_is(const f_string_static_t buffer, const f_string_range_t range, const char quote) F_attribute_visibility_internal_d; #endif // !defined(_di_f_iki_content_is_) || !defined(_di_f_iki_content_partial_is_) /** diff --git a/level_0/f_limit/c/limit.h b/level_0/f_limit/c/limit.h index 757abe9..a2c1986 100644 --- a/level_0/f_limit/c/limit.h +++ b/level_0/f_limit/c/limit.h @@ -13,11 +13,11 @@ // include pre-requirements #define _GNU_SOURCE -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_memory/c/memory.h b/level_0/f_memory/c/memory.h index d005e67..6950923 100644 --- a/level_0/f_memory/c/memory.h +++ b/level_0/f_memory/c/memory.h @@ -10,12 +10,12 @@ #ifndef _F_memory_h #define _F_memory_h -// libc includes. +// Libc includes. #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include diff --git a/level_0/f_memory/tests/c/test-memory.h b/level_0/f_memory/tests/c/test-memory.h index f9e27ba..54ff21a 100644 --- a/level_0/f_memory/tests/c/test-memory.h +++ b/level_0/f_memory/tests/c/test-memory.h @@ -10,7 +10,7 @@ #ifndef _TEST__F_memory_h #define _TEST__F_memory_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ // cmocka includes. #include -// fll-0 includes. +// FLL-0 includes. #include // test includes. diff --git a/level_0/f_path/c/path.h b/level_0/f_path/c/path.h index 7b5358e..030457e 100644 --- a/level_0/f_path/c/path.h +++ b/level_0/f_path/c/path.h @@ -10,7 +10,7 @@ #ifndef _F_path_h #define _F_path_h -// libc includes. +// Libc includes. #include #include #include @@ -20,7 +20,7 @@ #define PATH_MAX 4096 #endif /* PATH_MAX */ -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_pipe/c/pipe.h b/level_0/f_pipe/c/pipe.h index cfacf78..21312e2 100644 --- a/level_0/f_pipe/c/pipe.h +++ b/level_0/f_pipe/c/pipe.h @@ -12,11 +12,11 @@ #ifndef _F_pipe_h #define _F_pipe_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include diff --git a/level_0/f_print/c/print-common.c b/level_0/f_print/c/print-common.c index 3cb6445..0d82faf 100644 --- a/level_0/f_print/c/print-common.c +++ b/level_0/f_print/c/print-common.c @@ -26,6 +26,7 @@ extern "C" { const f_string_static_t f_print_sequence_escape_s = macro_f_string_static_t_initialize2(F_print_sequence_escape_s, 0, F_print_sequence_escape_s_length); const f_string_static_t f_print_sequence_form_feed_s = macro_f_string_static_t_initialize2(F_print_sequence_form_feed_s, 0, F_print_sequence_form_feed_s_length); const f_string_static_t f_print_sequence_line_feed_s = macro_f_string_static_t_initialize2(F_print_sequence_line_feed_s, 0, F_print_sequence_line_feed_s_length); + const f_string_static_t f_print_sequence_line_new_s = macro_f_string_static_t_initialize2(F_print_sequence_line_new_s, 0, F_print_sequence_line_new_s_length); const f_string_static_t f_print_sequence_null_s = macro_f_string_static_t_initialize2(F_print_sequence_null_s, 0, F_print_sequence_null_s_length); const f_string_static_t f_print_sequence_separator_file_s = macro_f_string_static_t_initialize2(F_print_sequence_separator_file_s, 0, F_print_sequence_separator_file_s_length); const f_string_static_t f_print_sequence_separator_group_s = macro_f_string_static_t_initialize2(F_print_sequence_separator_group_s, 0, F_print_sequence_separator_group_s_length); @@ -33,6 +34,7 @@ extern "C" { const f_string_static_t f_print_sequence_separator_unit_s = macro_f_string_static_t_initialize2(F_print_sequence_separator_unit_s, 0, F_print_sequence_separator_unit_s_length); const f_string_static_t f_print_sequence_shift_in_s = macro_f_string_static_t_initialize2(F_print_sequence_shift_in_s, 0, F_print_sequence_shift_in_s_length); const f_string_static_t f_print_sequence_shift_out_s = macro_f_string_static_t_initialize2(F_print_sequence_shift_out_s, 0, F_print_sequence_shift_out_s_length); + const f_string_static_t f_print_sequence_space_s = macro_f_string_static_t_initialize2(F_print_sequence_space_s, 0, F_print_sequence_space_s_length); const f_string_static_t f_print_sequence_start_of_header_s = macro_f_string_static_t_initialize2(F_print_sequence_start_of_header_s, 0, F_print_sequence_start_of_header_s_length); const f_string_static_t f_print_sequence_start_of_text_s = macro_f_string_static_t_initialize2(F_print_sequence_start_of_text_s, 0, F_print_sequence_start_of_text_s_length); const f_string_static_t f_print_sequence_substitute_s = macro_f_string_static_t_initialize2(F_print_sequence_substitute_s, 0, F_print_sequence_substitute_s_length); diff --git a/level_0/f_print/c/print-common.h b/level_0/f_print/c/print-common.h index ea60aef..4a90acb 100644 --- a/level_0/f_print/c/print-common.h +++ b/level_0/f_print/c/print-common.h @@ -56,6 +56,7 @@ extern "C" { #define F_print_sequence_escape_s "␛" #define F_print_sequence_form_feed_s "␌" #define F_print_sequence_line_feed_s "␊" + #define F_print_sequence_line_new_s "␤" #define F_print_sequence_null_s "␀" #define F_print_sequence_separator_file_s "␜" #define F_print_sequence_separator_group_s "␝" @@ -63,6 +64,7 @@ extern "C" { #define F_print_sequence_separator_unit_s "␟" #define F_print_sequence_shift_in_s "␏" #define F_print_sequence_shift_out_s "␎" + #define F_print_sequence_space_s "␠" #define F_print_sequence_start_of_header_s "␁" #define F_print_sequence_start_of_text_s "␂" #define F_print_sequence_substitute_s "␚" @@ -91,6 +93,7 @@ extern "C" { #define F_print_sequence_escape_s_length 3 #define F_print_sequence_form_feed_s_length 3 #define F_print_sequence_line_feed_s_length 3 + #define F_print_sequence_line_new_s_length 3 #define F_print_sequence_null_s_length 3 #define F_print_sequence_separator_file_s_length 3 #define F_print_sequence_separator_group_s_length 3 @@ -98,6 +101,7 @@ extern "C" { #define F_print_sequence_separator_unit_s_length 3 #define F_print_sequence_shift_in_s_length 3 #define F_print_sequence_shift_out_s_length 3 + #define F_print_sequence_space_s_length 3 #define F_print_sequence_start_of_header_s_length 3 #define F_print_sequence_start_of_text_s_length 3 #define F_print_sequence_substitute_s_length 3 @@ -126,6 +130,7 @@ extern "C" { extern const f_string_static_t f_print_sequence_equiry_s; extern const f_string_static_t f_print_sequence_form_feed_s; extern const f_string_static_t f_print_sequence_line_feed_s; + extern const f_string_static_t f_print_sequence_line_new_s; extern const f_string_static_t f_print_sequence_null_s; extern const f_string_static_t f_print_sequence_separator_file_s; extern const f_string_static_t f_print_sequence_separator_group_s; @@ -133,6 +138,7 @@ extern "C" { extern const f_string_static_t f_print_sequence_separator_unit_s; extern const f_string_static_t f_print_sequence_shift_in_s; extern const f_string_static_t f_print_sequence_shift_out_s; + extern const f_string_static_t f_print_sequence_space_s; extern const f_string_static_t f_print_sequence_start_of_header_s; extern const f_string_static_t f_print_sequence_start_of_text_s; extern const f_string_static_t f_print_sequence_substitute_s; diff --git a/level_0/f_print/c/print.h b/level_0/f_print/c/print.h index 5a8c438..fa2d11b 100644 --- a/level_0/f_print/c/print.h +++ b/level_0/f_print/c/print.h @@ -12,7 +12,7 @@ #ifndef _F_print_h #define _F_print_h -// libc includes. +// Libc includes. #include #include #include @@ -21,7 +21,7 @@ #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_serialize/c/serialize.h b/level_0/f_serialize/c/serialize.h index 0e4d7ba..419f159 100644 --- a/level_0/f_serialize/c/serialize.h +++ b/level_0/f_serialize/c/serialize.h @@ -12,10 +12,10 @@ #ifndef _F_serialize_h #define _F_serialize_h -// libc includes. +// Libc includes. #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_signal/c/signal.h b/level_0/f_signal/c/signal.h index 24a44c0..5e2d998 100644 --- a/level_0/f_signal/c/signal.h +++ b/level_0/f_signal/c/signal.h @@ -10,14 +10,14 @@ #ifndef _F_signal_h #define _F_signal_h -// libc includes. +// Libc includes. #include #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include diff --git a/level_0/f_socket/c/socket.h b/level_0/f_socket/c/socket.h index c7335dd..85409fd 100644 --- a/level_0/f_socket/c/socket.h +++ b/level_0/f_socket/c/socket.h @@ -10,7 +10,7 @@ #ifndef _F_socket_h #define _F_socket_h -// libc includes. +// Libc includes. #include #include #include @@ -19,7 +19,7 @@ #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index 5c73d5c..12529ae 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -12,7 +12,7 @@ #ifndef _F_status_h #define _F_status_h -// libc includes. +// Libc includes. #include #ifdef __cplusplus diff --git a/level_0/f_status_string/c/status_string.h b/level_0/f_status_string/c/status_string.h index a1bede0..fa45810 100644 --- a/level_0/f_status_string/c/status_string.h +++ b/level_0/f_status_string/c/status_string.h @@ -10,7 +10,7 @@ #ifndef _F_status_string_h #define _F_status_string_h -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_string/c/string.h b/level_0/f_string/c/string.h index df7175d..c71ffc7 100644 --- a/level_0/f_string/c/string.h +++ b/level_0/f_string/c/string.h @@ -13,10 +13,10 @@ #ifndef _F_string_h #define _F_string_h -// libc includes. +// Libc includes. #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_thread/c/thread.h b/level_0/f_thread/c/thread.h index 10859c0..d2ebd44 100644 --- a/level_0/f_thread/c/thread.h +++ b/level_0/f_thread/c/thread.h @@ -13,7 +13,7 @@ // include pre-requirements #define _GNU_SOURCE -// libc includes. +// Libc includes. #include #include #include @@ -22,7 +22,7 @@ #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_0/f_type/c/type.h b/level_0/f_type/c/type.h index 90bd0d8..632a178 100644 --- a/level_0/f_type/c/type.h +++ b/level_0/f_type/c/type.h @@ -15,7 +15,7 @@ #define _GNU_SOURCE #endif // _GNU_SOURCE -// libc includes. +// Libc includes. #include #include #include diff --git a/level_0/f_type_array/c/type_array.h b/level_0/f_type_array/c/type_array.h index 0e6e6f5..0f3a83e 100644 --- a/level_0/f_type_array/c/type_array.h +++ b/level_0/f_type_array/c/type_array.h @@ -13,7 +13,7 @@ #ifndef _F_type_array_h #define _F_type_array_h -// fll-0 includes. +// FLL-0 includes. #include #include diff --git a/level_0/f_utf/c/utf.h b/level_0/f_utf/c/utf.h index cbf9ec3..1148f36 100644 --- a/level_0/f_utf/c/utf.h +++ b/level_0/f_utf/c/utf.h @@ -36,12 +36,12 @@ #ifndef _F_utf_h #define _F_utf_h -// libc includes. +// Libc includes. #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_console/c/console.h b/level_1/fl_console/c/console.h index c343a99..bdae9d5 100644 --- a/level_1/fl_console/c/console.h +++ b/level_1/fl_console/c/console.h @@ -15,7 +15,7 @@ #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_control_group/c/control_group.h b/level_1/fl_control_group/c/control_group.h index ec48a11..e93d0cb 100644 --- a/level_1/fl_control_group/c/control_group.h +++ b/level_1/fl_control_group/c/control_group.h @@ -19,12 +19,12 @@ // include pre-requirements #define _GNU_SOURCE -// libc includes. +// Libc includes. #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_conversion/c/conversion.h b/level_1/fl_conversion/c/conversion.h index 282fdab..3fa0294 100644 --- a/level_1/fl_conversion/c/conversion.h +++ b/level_1/fl_conversion/c/conversion.h @@ -10,11 +10,11 @@ #ifndef _FL_conversion_h #define _FL_conversion_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_directory/c/directory.h b/level_1/fl_directory/c/directory.h index 1717a50..25d77b7 100644 --- a/level_1/fl_directory/c/directory.h +++ b/level_1/fl_directory/c/directory.h @@ -10,7 +10,7 @@ #ifndef _FL_directory_h #define _FL_directory_h -// libc includes. +// Libc includes. #include #include #include @@ -29,7 +29,7 @@ #include #endif // __USE_XOPEN_EXTENDED -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_directory/c/private-directory.c b/level_1/fl_directory/c/private-directory.c index 638b546..ca61a29 100644 --- a/level_1/fl_directory/c/private-directory.c +++ b/level_1/fl_directory/c/private-directory.c @@ -42,7 +42,7 @@ extern "C" { status = private_fl_directory_clone_file(list[i]->array[j], source, destination, role, recurse); } // for - macro_f_string_dynamics_t_delete_simple((*list[i])); + f_string_dynamics_resize(0, list[i]); } // for } @@ -123,11 +123,9 @@ extern "C" { } } // for - macro_f_string_dynamics_t_delete_simple(listing.directory); + f_string_dynamics_resize(0, &listing.directory); - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (recurse.failures && failures_used < recurse.failures->used) { return F_failure; @@ -260,7 +258,7 @@ extern "C" { status = private_fl_directory_copy_file(list[i]->array[j], source, destination, mode, recurse); } // for - macro_f_string_dynamics_t_delete_simple((*list[i])); + f_string_dynamics_resize(0, list[i]); } // for } @@ -327,11 +325,9 @@ extern "C" { } } // for - macro_f_string_dynamics_t_delete_simple(listing.directory); + f_string_dynamics_resize(0, &listing.directory); - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (recurse.failures && failures_used < recurse.failures->used) { return F_failure; diff --git a/level_1/fl_environment/c/environment.h b/level_1/fl_environment/c/environment.h index 1482f56..834de9c 100644 --- a/level_1/fl_environment/c/environment.h +++ b/level_1/fl_environment/c/environment.h @@ -13,7 +13,7 @@ #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_execute/c/execute.h b/level_1/fl_execute/c/execute.h index a8c3be0..ccbbaf9 100644 --- a/level_1/fl_execute/c/execute.h +++ b/level_1/fl_execute/c/execute.h @@ -17,11 +17,11 @@ // include pre-requirements #define _GNU_SOURCE -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_fss/c/fss.h b/level_1/fl_fss/c/fss.h index 967ed70..716db85 100644 --- a/level_1/fl_fss/c/fss.h +++ b/level_1/fl_fss/c/fss.h @@ -8,11 +8,11 @@ #ifndef _FL_fss_h #define _FL_fss_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_fss/c/fss_basic.h b/level_1/fl_fss/c/fss_basic.h index d290998..13a4e28 100644 --- a/level_1/fl_fss/c/fss_basic.h +++ b/level_1/fl_fss/c/fss_basic.h @@ -10,11 +10,11 @@ #ifndef _FL_fss_basic_h #define _FL_fss_basic_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -22,7 +22,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #ifdef __cplusplus diff --git a/level_1/fl_fss/c/fss_basic_list.h b/level_1/fl_fss/c/fss_basic_list.h index 01370b8..56b7399 100644 --- a/level_1/fl_fss/c/fss_basic_list.h +++ b/level_1/fl_fss/c/fss_basic_list.h @@ -10,11 +10,11 @@ #ifndef _FL_fss_basic_list_h #define _FL_fss_basic_list_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include @@ -23,7 +23,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include diff --git a/level_1/fl_fss/c/fss_embedded_list.c b/level_1/fl_fss/c/fss_embedded_list.c index be6986a..6582cb5 100644 --- a/level_1/fl_fss/c/fss_embedded_list.c +++ b/level_1/fl_fss/c/fss_embedded_list.c @@ -329,7 +329,7 @@ extern "C" { macro_f_fss_objects_t_resize(status, objects, state.step_small) if (F_status_is_error(status)) { - macro_f_array_lengths_t_delete_simple(positions_start); + f_type_array_lengths_resize(0, &positions_start); return status; } @@ -339,7 +339,7 @@ extern "C" { macro_f_array_lengths_t_resize(status, slashes, state.step_small) if (F_status_is_error(status)) { - macro_f_array_lengths_t_delete_simple(positions_start); + f_type_array_lengths_resize(0, &positions_start); macro_f_fss_objects_t_delete_simple(objects); return status; @@ -833,9 +833,9 @@ extern "C" { private_macro_fl_fss_nest_return_on_overflow_delimited((buffer), (*range), (*found), positions_start, objects, slashes, F_none_eos, F_none_stop) - macro_f_array_lengths_t_delete_simple(positions_start); + f_type_array_lengths_resize(0, &positions_start); macro_f_fss_objects_t_delete_simple(objects); - macro_f_array_lengths_t_delete_simple(slashes); + f_type_array_lengths_resize(0, &slashes); return F_fss_found_content; } @@ -945,9 +945,9 @@ extern "C" { if (F_status_is_error(status)) break; } // while - macro_f_array_lengths_t_delete_simple(positions_start); + f_type_array_lengths_resize(0, &positions_start); macro_f_fss_objects_t_delete_simple(objects); - macro_f_array_lengths_t_delete_simple(slashes); + f_type_array_lengths_resize(0, &slashes); delimits->used = delimits_used; comments->used = comments_used; diff --git a/level_1/fl_fss/c/fss_embedded_list.h b/level_1/fl_fss/c/fss_embedded_list.h index 9c62823..0b12a13 100644 --- a/level_1/fl_fss/c/fss_embedded_list.h +++ b/level_1/fl_fss/c/fss_embedded_list.h @@ -10,11 +10,11 @@ #ifndef _FL_fss_embedded_list_h #define _FL_fss_embedded_list_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include @@ -23,7 +23,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include diff --git a/level_1/fl_fss/c/fss_extended.h b/level_1/fl_fss/c/fss_extended.h index 7cd3d74..2c0e6c7 100644 --- a/level_1/fl_fss/c/fss_extended.h +++ b/level_1/fl_fss/c/fss_extended.h @@ -10,11 +10,11 @@ #ifndef _FL_fss_extended_h #define _FL_fss_extended_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include @@ -23,7 +23,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #ifdef __cplusplus diff --git a/level_1/fl_fss/c/fss_extended_list.h b/level_1/fl_fss/c/fss_extended_list.h index a1e0b23..cb63b6b 100644 --- a/level_1/fl_fss/c/fss_extended_list.h +++ b/level_1/fl_fss/c/fss_extended_list.h @@ -10,11 +10,11 @@ #ifndef _FL_fss_extended_list_h #define _FL_fss_extended_list_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include @@ -23,7 +23,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include diff --git a/level_1/fl_iki/c/iki.h b/level_1/fl_iki/c/iki.h index c3a6d09..2eb8f6b 100644 --- a/level_1/fl_iki/c/iki.h +++ b/level_1/fl_iki/c/iki.h @@ -13,11 +13,11 @@ #ifndef _FL_iki_h #define _FL_iki_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_print/c/print.h b/level_1/fl_print/c/print.h index 9371df9..520b25f 100644 --- a/level_1/fl_print/c/print.h +++ b/level_1/fl_print/c/print.h @@ -12,10 +12,10 @@ #ifndef _FL_print_h #define _FL_print_h -// libc includes. +// Libc includes. #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_signal/c/signal.h b/level_1/fl_signal/c/signal.h index 9d36c43..65123f5 100644 --- a/level_1/fl_signal/c/signal.h +++ b/level_1/fl_signal/c/signal.h @@ -10,12 +10,12 @@ #ifndef _FL_signal_h #define _FL_signal_h -// libc includes. +// Libc includes. #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index fd8b3be..98f6239 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -7,24 +7,28 @@ extern "C" { #ifndef _di_fl_string_compare_ f_status_t fl_string_compare(const f_string_t string1, const f_string_t string2, const f_array_length_t length1, const f_array_length_t length2) { + return private_fl_string_compare(string1, string2, 0, 0, length1, length2); } #endif // _di_fl_string_compare_ #ifndef _di_fl_string_compare_except_ f_status_t fl_string_compare_except(const f_string_t string1, const f_string_t string2, const f_array_length_t length1, const f_array_length_t length2, const f_array_lengths_t except1, const f_array_lengths_t except2) { + return private_fl_string_compare_except(string1, string2, 0, 0, length1, length2, except1, except2); } #endif // _di_fl_string_compare_except_ #ifndef _di_fl_string_compare_except_trim_ f_status_t fl_string_compare_except_trim(const f_string_t string1, const f_string_t string2, const f_array_length_t length1, const f_array_length_t length2, const f_array_lengths_t except1, const f_array_lengths_t except2) { + return private_fl_string_compare_except_trim(string1, string2, 0, 0, length1, length2, except1, except2); } #endif // _di_fl_string_compare_except_trim_ #ifndef _di_fl_string_compare_trim_ f_status_t fl_string_compare_trim(const f_string_t string1, const f_string_t string2, const f_array_length_t length1, const f_array_length_t length2) { + return private_fl_string_compare_trim(string1, string2, 0, 0, length1, length2); } #endif // _di_fl_string_compare_trim_ @@ -37,42 +41,49 @@ extern "C" { #ifndef _di_fl_string_dynamic_compare_except_ f_status_t fl_string_dynamic_compare_except(const f_string_static_t string1, const f_string_static_t string2, const f_array_lengths_t except1, const f_array_lengths_t except2) { + return private_fl_string_compare_except(string1.string, string2.string, 0, 0, string1.used, string2.used, except1, except2); } #endif // _di_fl_string_dynamic_compare_except_ #ifndef _di_fl_string_dynamic_compare_except_string_ f_status_t fl_string_dynamic_compare_except_string(const f_string_t string1, const f_string_static_t string2, const f_array_length_t length1, const f_array_lengths_t except1, const f_array_lengths_t except2) { + return private_fl_string_compare_except(string1, string2.string, 0, 0, length1, string2.used, except1, except2); } #endif // _di_fl_string_dynamic_compare_except_string_ #ifndef _di_fl_string_dynamic_compare_except_trim_ f_status_t fl_string_dynamic_compare_except_trim(const f_string_static_t string1, const f_string_static_t string2, const f_array_lengths_t except1, const f_array_lengths_t except2) { + return private_fl_string_compare_except_trim(string1.string, string2.string, 0, 0, string1.used, string2.used, except1, except2); } #endif // _di_fl_string_dynamic_compare_except_trim_ #ifndef _di_fl_string_dynamic_compare_except_trim_string_ f_status_t fl_string_dynamic_compare_except_trim_string(const f_string_t string1, const f_string_static_t string2, const f_array_length_t length1, const f_array_lengths_t except1, const f_array_lengths_t except2) { + return private_fl_string_compare_except_trim(string1, string2.string, 0, 0, length1, string2.used, except1, except2); } #endif // _di_fl_string_dynamic_compare_except_trim_string_ #ifndef _di_fl_string_dynamic_compare_string_ f_status_t fl_string_dynamic_compare_string(const f_string_t string1, const f_string_static_t string2, const f_array_length_t length1) { + return private_fl_string_compare(string1, string2.string, 0, 0, length1, string2.used); } #endif // _di_fl_string_dynamic_compare_string_ #ifndef _di_fl_string_dynamic_compare_trim_ f_status_t fl_string_dynamic_compare_trim(const f_string_static_t string1, const f_string_static_t string2) { + return private_fl_string_compare_trim(string1.string, string2.string, 0, 0, string1.used, string2.used); } #endif // _di_fl_string_dynamic_compare_trim_ #ifndef _di_fl_string_dynamic_compare_trim_string_ f_status_t fl_string_dynamic_compare_trim_string(const f_string_t string1, const f_string_static_t string2, const f_array_length_t length1) { + return private_fl_string_compare_trim(string1, string2.string, 0, 0, length1, string2.used); } #endif // _di_fl_string_dynamic_compare_trim_string_ @@ -362,10 +373,7 @@ extern "C" { f_array_length_t end = range.stop; const f_status_t status = private_fl_string_rip_find_range(source.string, &begin, &end); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (status == F_data_not) { return status; @@ -400,10 +408,7 @@ extern "C" { f_array_length_t end = range.stop; const f_status_t status = private_fl_string_rip_find_range(source.string, &begin, &end); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (status == F_data_not) { return status; @@ -473,10 +478,7 @@ extern "C" { f_utf_character_t character = 0; status = f_utf_char_to_character(string + range->start, width_max, &character); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (character == seek_to_this) { return F_none; @@ -516,9 +518,7 @@ extern "C" { while (string[range->start] == placeholder || (status = f_utf_is_graph(string + range->start, width_max)) == F_false) { - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (string[range->start] == f_string_eol_s.string[0]) { return F_none_eol; @@ -549,9 +549,7 @@ extern "C" { width_max = (range->stop - range->start) + 1; } // while - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_none; } @@ -578,9 +576,7 @@ extern "C" { while (string[range->start] == placeholder || (status = f_utf_is_whitespace(string + range->start, width_max)) == F_false) { - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (string[range->start] == f_string_eol_s.string[0]) { return F_none_eol; @@ -611,9 +607,7 @@ extern "C" { width_max = (range->stop - range->start) + 1; } // while - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_none; } @@ -668,10 +662,7 @@ extern "C" { f_utf_character_t character = 0; status = f_utf_char_to_character(string + range->start, width_max, &character); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (character == seek_to_this) { return F_none; @@ -701,7 +692,7 @@ extern "C" { id->used = 0; } - // skip past all leading NULLs. + // Skip past all leading NULLs. for (; range->start <= range->stop; ++range->start) { if (buffer[range->start]) break; } // for @@ -962,10 +953,7 @@ extern "C" { f_array_length_t end = length - 1; const f_status_t status = private_fl_string_rip_find_range(source, &begin, &end); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (status == F_data_not) { return status; @@ -989,10 +977,7 @@ extern "C" { f_array_length_t end = length - 1; const f_status_t status = private_fl_string_rip_find_range(source, &begin, &end); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (status == F_data_not) { return status; @@ -1051,10 +1036,7 @@ extern "C" { f_utf_character_t character = 0; status = f_utf_char_to_character(string + range->start, width_max, &character); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (character == seek_to) { return F_none; @@ -1084,9 +1066,7 @@ extern "C" { while (string[range->start] == placeholder || (status = f_utf_is_graph(string + range->start, width_max)) == F_false) { - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (string[range->start] == f_string_eol_s.string[0]) { return F_none_eol; @@ -1117,9 +1097,7 @@ extern "C" { width_max = (range->stop - range->start) + 1; } // while - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_none; } @@ -1142,9 +1120,7 @@ extern "C" { while (string[range->start] == placeholder || (status = f_utf_is_whitespace(string + range->start, width_max)) == F_false) { - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (string[range->start] == f_string_eol_s.string[0]) { return F_none_eol; @@ -1175,9 +1151,7 @@ extern "C" { width_max = (range->stop - range->start) + 1; } // while - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_none; } @@ -1228,10 +1202,7 @@ extern "C" { f_utf_character_t character = 0; status = f_utf_char_to_character(string + range->start, width_max, &character); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; if (character == seek_to) { return F_none; diff --git a/level_1/fl_string/c/string.h b/level_1/fl_string/c/string.h index 1f641c2..08dce11 100644 --- a/level_1/fl_string/c/string.h +++ b/level_1/fl_string/c/string.h @@ -19,11 +19,11 @@ #ifndef _FL_string_h #define _FL_string_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_utf/c/utf.h b/level_1/fl_utf/c/utf.h index 2a1c166..03a00cf 100644 --- a/level_1/fl_utf/c/utf.h +++ b/level_1/fl_utf/c/utf.h @@ -19,11 +19,11 @@ #ifndef _FL_string_h #define _FL_string_h -// libc includes. +// Libc includes. #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_1/fl_utf_file/c/utf_file.h b/level_1/fl_utf_file/c/utf_file.h index 63cc379..5b9c5a1 100644 --- a/level_1/fl_utf_file/c/utf_file.h +++ b/level_1/fl_utf_file/c/utf_file.h @@ -10,10 +10,10 @@ #ifndef _FL_utf_file_h #define _FL_utf_file_h -// libc includes. +// Libc includes. #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_2/fll_control_group/c/control_group.h b/level_2/fll_control_group/c/control_group.h index 40e62ab..f7ae27e 100644 --- a/level_2/fll_control_group/c/control_group.h +++ b/level_2/fll_control_group/c/control_group.h @@ -10,9 +10,9 @@ #ifndef _FLL_control_h #define _FLL_control_h -// libc includes. +// Libc includes. -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -23,7 +23,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include diff --git a/level_2/fll_error/c/error.h b/level_2/fll_error/c/error.h index ee11ff1..c3426d9 100644 --- a/level_2/fll_error/c/error.h +++ b/level_2/fll_error/c/error.h @@ -13,7 +13,7 @@ // libc include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -24,7 +24,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include // fll-2 error includes diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index acb9328..3e5c713 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -164,7 +164,7 @@ extern "C" { status = f_file_exists(program ? program : arguments.array[0].string); if (status != F_true) { - macro_f_string_dynamics_t_delete_simple(paths); + f_string_dynamics_resize(0, &paths); return F_status_set_error(F_file_found_not); } @@ -187,10 +187,10 @@ extern "C" { status = fl_environment_path_explode_dynamic(path, &paths); } - macro_f_string_dynamic_t_delete_simple(path); + f_string_dynamic_resize(0, &path); if (F_status_is_error(status)) { - macro_f_string_dynamics_t_delete_simple(paths); + f_string_dynamics_resize(0, &paths); return status; } @@ -229,14 +229,14 @@ extern "C" { } if (F_status_is_error(status)) { - macro_f_string_dynamics_t_delete_simple(paths); + f_string_dynamics_resize(0, &paths); return status; } } // for if (!found) { - macro_f_string_dynamics_t_delete_simple(paths); + f_string_dynamics_resize(0, &paths); return F_status_set_error(F_file_found_not); } @@ -247,8 +247,7 @@ extern "C" { memcpy(&program_path, found->string, found->used); - status = macro_f_string_dynamics_t_delete_simple(paths); - if (F_status_is_error(status)) return status; + f_string_dynamics_resize(0, &paths); fixed_arguments[0] = program_path; @@ -347,7 +346,7 @@ extern "C" { status = f_file_exists(program ? program : arguments.array[0].string); if (status != F_true) { - macro_f_string_dynamics_t_delete_simple(paths); + f_string_dynamics_resize(0, &paths); return F_status_set_error(F_file_found_not); } @@ -370,10 +369,10 @@ extern "C" { status = fl_environment_path_explode_dynamic(path, &paths); } - macro_f_string_dynamic_t_delete_simple(path); + f_string_dynamic_resize(0, &path); if (F_status_is_error(status)) { - macro_f_string_dynamics_t_delete_simple(paths); + f_string_dynamics_resize(0, &paths); return status; } @@ -412,14 +411,14 @@ extern "C" { } if (F_status_is_error(status)) { - macro_f_string_dynamics_t_delete_simple(paths); + f_string_dynamics_resize(0, &paths); return status; } } // for if (!found) { - macro_f_string_dynamics_t_delete_simple(paths); + f_string_dynamics_resize(0, &paths); return F_status_set_error(F_file_found_not); } @@ -430,8 +429,7 @@ extern "C" { memcpy(&program_path, found->string, found->used); - status = macro_f_string_dynamics_t_delete_simple(paths); - if (F_status_is_error(status)) return status; + f_string_dynamics_resize(0, &paths); if (parameter && (parameter->option & FL_execute_parameter_option_path_d)) { fixed_arguments[0] = program_path; diff --git a/level_2/fll_execute/c/execute.h b/level_2/fll_execute/c/execute.h index 78c54f6..a191049 100644 --- a/level_2/fll_execute/c/execute.h +++ b/level_2/fll_execute/c/execute.h @@ -16,7 +16,7 @@ // include pre-requirements #define _GNU_SOURCE -// libc includes. +// Libc includes. #include #include #include @@ -26,7 +26,7 @@ #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -45,7 +45,7 @@ #include #endif // _di_pthread_support_ -// fll-1 includes +// FLL-1 includes. #include #include #include diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index 957c2e4..ece9a5d 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -17,7 +17,7 @@ extern "C" { status = f_string_append(source, length, &argument); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(argument); + f_string_dynamic_resize(0, &argument); return status; } @@ -26,7 +26,7 @@ extern "C" { status = f_string_dynamic_terminate(&argument); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(argument); + f_string_dynamic_resize(0, &argument); return status; } @@ -85,7 +85,7 @@ extern "C" { status = f_string_append(value, value_length, &argument); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(argument); + f_string_dynamic_resize(0, &argument); return status; } @@ -94,7 +94,7 @@ extern "C" { status = f_string_dynamic_terminate(&argument); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(argument); + f_string_dynamic_resize(0, &argument); return status; } diff --git a/level_2/fll_file/c/file.h b/level_2/fll_file/c/file.h index 627dbc1..14f217e 100644 --- a/level_2/fll_file/c/file.h +++ b/level_2/fll_file/c/file.h @@ -10,10 +10,10 @@ #ifndef _FLL_file_h #define _FLL_file_h -// libc includes. +// Libc includes. #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -23,7 +23,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #ifdef __cplusplus diff --git a/level_2/fll_file/c/private-file.c b/level_2/fll_file/c/private-file.c index 050902a..98e85bf 100644 --- a/level_2/fll_file/c/private-file.c +++ b/level_2/fll_file/c/private-file.c @@ -61,11 +61,11 @@ extern "C" { status = f_file_mode_set(path_sub, mode); } // for - macro_f_string_dynamics_t_delete_simple((*list[i])); + f_string_dynamics_resize(0, list[i]); } // for } - macro_f_string_dynamics_t_delete_simple(listing.unknown); + f_string_dynamics_resize(0, &listing.unknown); for (f_array_length_t i = 0; F_status_is_fine(status) && i < listing.directory.used; ++i) { @@ -84,6 +84,7 @@ extern "C" { if (status == F_false) { status = F_status_set_error(F_directory); + break; } @@ -93,7 +94,7 @@ extern "C" { } } // for - macro_f_string_dynamics_t_delete_simple(listing.directory); + f_string_dynamics_resize(0, &listing.directory); if (F_status_is_error(status)) { return status; @@ -159,7 +160,7 @@ extern "C" { status = f_file_role_change(path_sub, uid, gid, dereference); } // for - macro_f_string_dynamics_t_delete_simple((*list[i])); + f_string_dynamics_resize(0, list[i]); } // for } @@ -180,6 +181,7 @@ extern "C" { if (status == F_false) { status = F_status_set_error(F_directory); + break; } @@ -189,11 +191,9 @@ extern "C" { } } // for - macro_f_string_dynamics_t_delete_simple(listing.directory); + f_string_dynamics_resize(0, &listing.directory); - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return f_file_role_change(path, uid, gid, dereference); } diff --git a/level_2/fll_fss/c/fss.c b/level_2/fll_fss/c/fss.c index bdc1ce6..4c0642e 100644 --- a/level_2/fll_fss/c/fss.c +++ b/level_2/fll_fss/c/fss.c @@ -186,7 +186,7 @@ extern "C" { #endif // _di_fll_fss_identify_ #ifndef _di_fll_fss_snatch_ - f_status_t fll_fss_snatch(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]) { + f_status_t fll_fss_snatch(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -198,7 +198,6 @@ extern "C" { if (!contents.used) return F_data_not; f_status_t status = F_none; - f_array_length_t length_object = 0; f_array_length_t i = 0; f_array_length_t j = 0; @@ -209,13 +208,11 @@ extern "C" { for (; i < objects.used; ++i) { - length_object = (objects.array[i].stop - objects.array[i].start) + 1; - for (j = 0; j < size; ++j) { if (matched[j]) continue; - status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); + status = fl_string_dynamic_partial_compare_trim_string(names[j].string, buffer, names[j].used, objects.array[i]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; @@ -242,7 +239,7 @@ extern "C" { #endif // _di_fll_fss_snatch_ #ifndef _di_fll_fss_snatch_apart_ - f_status_t fll_fss_snatch_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, f_string_dynamics_t *values[], bool matches[], f_array_lengths_t *indexs[]) { + f_status_t fll_fss_snatch_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, f_string_dynamics_t *values[], bool matches[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -254,7 +251,6 @@ extern "C" { if (!contents.used) return F_data_not; f_status_t status = F_none; - f_array_length_t length_object = 0; f_string_dynamics_t *value = 0; f_fss_content_t *content = 0; @@ -264,11 +260,9 @@ extern "C" { for (; i < objects.used; ++i) { - length_object = (objects.array[i].stop - objects.array[i].start) + 1; - for (j = 0; j < size; ++j) { - status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); + status = fl_string_dynamic_partial_compare_trim_string(names[j].string, buffer, names[j].used, objects.array[i]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; @@ -314,7 +308,7 @@ extern "C" { #endif // _di_fll_fss_snatch_apart_ #ifndef _di_fll_fss_snatch_map_ - f_status_t fll_fss_snatch_map(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]) { + f_status_t fll_fss_snatch_map(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -326,7 +320,6 @@ extern "C" { if (!contents.used) return F_data_not; f_status_t status = F_none; - f_array_length_t length_name = 0; f_string_dynamic_t name = f_string_dynamic_t_initialize; f_array_length_t i = 0; @@ -341,11 +334,9 @@ extern "C" { if (!contents.array[i].used) continue; - length_name = (objects.array[i].stop - objects.array[i].start) + 1; - for (j = 0; j < size; ++j) { - status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_name, lengths[j]); + status = fl_string_dynamic_partial_compare_trim_string(names[j].string, buffer, names[j].used, objects.array[i]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; @@ -353,20 +344,19 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[0], &name); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } matched = F_false; - length_name = (contents.array[i].array[0].stop - contents.array[i].array[0].start) + 1; for (k = 0; k < values[j]->used; ++k) { - status = fl_string_compare_trim(buffer.string + contents.array[i].array[0].start, values[j]->array[k].name.string, length_name, values[j]->array[k].name.used); + status = fl_string_dynamic_partial_compare_trim_string(values[j]->array[k].name.string, buffer, values[j]->array[k].name.used, contents.array[i].array[0]); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } @@ -378,7 +368,8 @@ extern "C" { matches[j] = F_true; } - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); + break; } } // for @@ -392,7 +383,7 @@ extern "C" { if (values[j]->used == values[j]->size) { if (values[j]->used + F_fss_default_allocation_step_d > F_array_length_t_size_d) { if (values[j]->used == F_array_length_t_size_d) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return F_status_set_error(F_array_too_large); } @@ -400,7 +391,7 @@ extern "C" { macro_f_string_maps_t_resize(status, (*values[j]), values[j]->used + 1); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } @@ -414,7 +405,7 @@ extern "C" { macro_f_string_maps_t_resize(status, (*values[j]), values[j]->used + F_fss_default_allocation_step_d); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } @@ -432,7 +423,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[1], &map->value); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } @@ -453,13 +444,14 @@ extern "C" { } // for } // for - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); + return F_none; } #endif // _di_fll_fss_snatch_map_ #ifndef _di_fll_fss_snatch_map_apart_ - f_status_t fll_fss_snatch_map_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, f_string_map_multis_t *values[], bool matches[], f_array_lengths_t *indexs[]) { + f_status_t fll_fss_snatch_map_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, f_string_map_multis_t *values[], bool matches[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -471,7 +463,6 @@ extern "C" { if (!contents.used) return F_data_not; f_status_t status = F_none; - f_array_length_t length_object = 0; f_array_length_t i = 0; f_array_length_t j = 0; @@ -483,11 +474,9 @@ extern "C" { if (!contents.array[i].used) continue; - length_object = (objects.array[i].stop - objects.array[i].start) + 1; - for (j = 0; j < size; ++j) { - status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); + status = fl_string_dynamic_partial_compare_trim_string(names[j].string, buffer, names[j].used, objects.array[i]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; @@ -536,7 +525,7 @@ extern "C" { #endif // _di_fll_fss_snatch_map_apart_ #ifndef _di_fll_fss_snatch_map_mash_ - f_status_t fll_fss_snatch_map_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]) { + f_status_t fll_fss_snatch_map_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -548,7 +537,6 @@ extern "C" { if (!contents.used) return F_data_not; f_status_t status = F_none; - f_array_length_t length_object = 0; f_array_length_t i = 0; f_array_length_t j = 0; @@ -560,11 +548,9 @@ extern "C" { if (!contents.array[i].used) continue; - length_object = (objects.array[i].stop - objects.array[i].start) + 1; - for (j = 0; j < size; ++j) { - status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); + status = fl_string_dynamic_partial_compare_trim_string(names[j].string, buffer, names[j].used, objects.array[i]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; @@ -608,7 +594,7 @@ extern "C" { #endif // _di_fll_fss_snatch_map_mash_ #ifndef _di_fll_fss_snatch_map_mash_apart_ - f_status_t fll_fss_snatch_map_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_map_multis_t *values[], bool matches[], f_array_lengths_t *indexs[]) { + f_status_t fll_fss_snatch_map_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_map_multis_t *values[], bool matches[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -620,7 +606,6 @@ extern "C" { if (!contents.used) return F_data_not; f_status_t status = F_none; - f_array_length_t length_name = 0; f_string_dynamic_t name = f_string_dynamic_t_initialize; f_array_length_t i = 0; @@ -635,11 +620,9 @@ extern "C" { if (!contents.array[i].used) continue; - length_name = (objects.array[i].stop - objects.array[i].start) + 1; - for (j = 0; j < size; ++j) { - status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_name, lengths[j]); + status = fl_string_dynamic_partial_compare_trim_string(names[j].string, buffer, names[j].used, objects.array[i]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; @@ -651,20 +634,19 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[0], &name); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } matched = F_false; - length_name = (contents.array[i].array[0].stop - contents.array[i].array[0].start) + 1; for (k = 0; k < values[j]->used; ++k) { - status = fl_string_compare_trim(buffer.string + contents.array[i].array[0].start, values[j]->array[k].name.string, length_name, values[j]->array[k].name.used); + status = fl_string_dynamic_partial_compare_trim_string(values[j]->array[k].name.string, buffer, values[j]->array[k].name.used, contents.array[i].array[0]); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } @@ -721,14 +703,14 @@ extern "C" { } // for } // for - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return F_none; } #endif // _di_fll_fss_snatch_map_mash_apart_ #ifndef _di_fll_fss_snatch_map_together_ - f_status_t fll_fss_snatch_map_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]) { + f_status_t fll_fss_snatch_map_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -740,7 +722,6 @@ extern "C" { if (!contents.used) return F_data_not; f_status_t status = F_none; - f_array_length_t length_name = 0; f_string_dynamic_t name = f_string_dynamic_t_initialize; f_array_length_t i = 0; @@ -755,11 +736,9 @@ extern "C" { if (!contents.array[i].used) continue; - length_name = (objects.array[i].stop - objects.array[i].start) + 1; - for (j = 0; j < size; ++j) { - status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_name, lengths[j]); + status = fl_string_dynamic_partial_compare_trim_string(names[j].string, buffer, names[j].used, objects.array[i]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; @@ -771,20 +750,19 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[0], &name); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } matched = F_false; - length_name = (contents.array[i].array[0].stop - contents.array[i].array[0].start) + 1; for (k = 0; k < values[j]->used; ++k) { - status = fl_string_compare_trim(buffer.string + contents.array[i].array[0].start, values[j]->array[k].name.string, length_name, values[j]->array[k].name.used); + status = fl_string_dynamic_partial_compare_trim_string(values[j]->array[k].name.string, buffer, values[j]->array[k].name.used, contents.array[i].array[0]); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } @@ -792,7 +770,7 @@ extern "C" { if (status == F_equal_to) { matched = F_true; - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); break; } } // for @@ -831,7 +809,7 @@ extern "C" { status = f_string_dynamic_partial_mash_nulless(glue, buffer, contents.array[i].array[1], &map->value); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } @@ -839,14 +817,14 @@ extern "C" { } // for } // for - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return F_none; } #endif // _di_fll_fss_snatch_map_together_ #ifndef _di_fll_fss_snatch_mash_ - f_status_t fll_fss_snatch_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]) { + f_status_t fll_fss_snatch_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -858,7 +836,6 @@ extern "C" { if (!contents.used) return F_data_not; f_status_t status = F_none; - f_array_length_t length_object = 0; f_array_length_t i = 0; f_array_length_t j = 0; @@ -870,13 +847,11 @@ extern "C" { for (; i < objects.used; ++i) { - length_object = (objects.array[i].stop - objects.array[i].start) + 1; - for (j = 0; j < size; ++j) { if (matched[j]) continue; - status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); + status = fl_string_dynamic_partial_compare_trim_string(names[j].string, buffer, names[j].used, objects.array[i]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; @@ -904,7 +879,7 @@ extern "C" { #endif // _di_fll_fss_snatch_mash_ #ifndef _di_fll_fss_snatch_mash_apart_ - f_status_t fll_fss_snatch_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamics_t *values[], bool matches[], f_array_lengths_t *indexs[]) { + f_status_t fll_fss_snatch_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamics_t *values[], bool matches[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -916,7 +891,6 @@ extern "C" { if (!contents.used) return F_data_not; f_status_t status = F_none; - f_array_length_t length_object = 0; f_array_length_t i = 0; f_array_length_t j = 0; @@ -924,11 +898,9 @@ extern "C" { for (; i < objects.used; ++i) { - length_object = (objects.array[i].stop - objects.array[i].start) + 1; - for (j = 0; j < size; ++j) { - status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); + status = fl_string_dynamic_partial_compare_trim_string(names[j].string, buffer, names[j].used, objects.array[i]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; @@ -965,7 +937,7 @@ extern "C" { #endif // _di_fll_fss_snatch_mash_apart_ #ifndef _di_fll_fss_snatch_together_ - f_status_t fll_fss_snatch_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]) { + f_status_t fll_fss_snatch_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -977,7 +949,6 @@ extern "C" { if (!contents.used) return F_data_not; f_status_t status = F_none; - f_array_length_t length_object = 0; f_array_length_t i = 0; f_array_length_t j = 0; @@ -985,11 +956,9 @@ extern "C" { for (; i < objects.used; ++i) { - length_object = (objects.array[i].stop - objects.array[i].start) + 1; - for (j = 0; j < size; ++j) { - status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); + status = fl_string_dynamic_partial_compare_trim_string(names[j].string, buffer, names[j].used, objects.array[i]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; diff --git a/level_2/fll_fss/c/fss.h b/level_2/fll_fss/c/fss.h index 363d382..69783fb 100644 --- a/level_2/fll_fss/c/fss.h +++ b/level_2/fll_fss/c/fss.h @@ -12,7 +12,7 @@ #ifndef _FLL_fss_h #define _FLL_fss_h -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -20,7 +20,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include @@ -96,10 +96,8 @@ extern "C" { * This content mappings to process. * @param names * An array of strings to "snatch" from the buffer. - * @param lengths - * An array of lengths for each names string. * @param size - * The total size of the names, lengths, and values arrays. + * The total size of the names and values arrays. * @param values * An array of values where "snatched" content is stored. * @param matches @@ -115,14 +113,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: fl_string_compare_trim(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * Errors (with error bit) from: fl_string_dynamic_partial_compare_trim_string(). * * @see f_string_dynamic_partial_append_nulless() * @see fl_string_compare_trim() */ #ifndef _di_fll_fss_snatch_ - extern f_status_t fll_fss_snatch(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]); + extern f_status_t fll_fss_snatch(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]); #endif // _di_fll_fss_snatch_ /** @@ -146,10 +144,8 @@ extern "C" { * This content mappings to process. * @param names * An array of strings to "snatch" from the buffer. - * @param lengths - * An array of lengths for each names string. * @param size - * The total size of the names, lengths, and values arrays. + * The total size of the names and values arrays. * @param values * An array of values where "snatched" content is stored. * @param matches @@ -165,14 +161,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: fl_string_compare_trim(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * Errors (with error bit) from: fl_string_dynamic_partial_compare_trim_string(). * * @see f_string_dynamic_partial_append_nulless() * @see fl_string_compare_trim() */ #ifndef _di_fll_fss_snatch_apart_ - extern f_status_t fll_fss_snatch_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, f_string_dynamics_t *values[], bool matches[], f_array_lengths_t *indexs[]); + extern f_status_t fll_fss_snatch_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, f_string_dynamics_t *values[], bool matches[], f_array_lengths_t *indexs[]); #endif // _di_fll_fss_snatch_apart_ /** @@ -198,10 +194,8 @@ extern "C" { * This content mappings to process. * @param names * An array of strings to "snatch" from the buffer. - * @param lengths - * An array of lengths for each names string. * @param size - * The total size of the names, lengths, and values arrays. + * The total size of the names and values arrays. * @param values * An array of map arrays where "snatched" content is stored. * @param matches @@ -217,14 +211,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: fl_string_compare_trim(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * Errors (with error bit) from: fl_string_dynamic_partial_compare_trim_string(). * * @see f_string_dynamic_partial_append_nulless() * @see fl_string_compare_trim() */ #ifndef _di_fll_fss_snatch_map_ - extern f_status_t fll_fss_snatch_map(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]); + extern f_status_t fll_fss_snatch_map(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]); #endif // _di_fll_fss_snatch_map_ /** @@ -252,10 +246,8 @@ extern "C" { * This content mappings to process. * @param names * An array of strings to "snatch" from the buffer. - * @param lengths - * An array of lengths for each names string. * @param size - * The total size of the names, lengths, and values arrays. + * The total size of the names and values arrays. * @param values * An array of multi map arrays where "snatched" content is stored. * @param matches @@ -271,14 +263,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: fl_string_compare_trim(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * Errors (with error bit) from: fl_string_dynamic_partial_compare_trim_string(). * * @see f_string_dynamic_partial_append_nulless() * @see fl_string_compare_trim() */ #ifndef _di_fll_fss_snatch_map_apart_ - extern f_status_t fll_fss_snatch_map_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, f_string_map_multis_t *values[], bool matches[], f_array_lengths_t *indexs[]); + extern f_status_t fll_fss_snatch_map_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, f_string_map_multis_t *values[], bool matches[], f_array_lengths_t *indexs[]); #endif // _di_fll_fss_snatch_map_apart_ /** @@ -305,10 +297,8 @@ extern "C" { * This content mappings to process. * @param names * An array of strings to "snatch" from the buffer. - * @param lengths - * An array of lengths for each names string. * @param size - * The total size of the names, lengths, and values arrays. + * The total size of the names and values arrays. * @param glue * A string to append between each duplicate name found when "snatching". * @param values @@ -326,11 +316,11 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: fl_string_compare_trim(). * Errors (with error bit) from: f_string_dynamic_partial_mash_nulless(). + * Errors (with error bit) from: fl_string_dynamic_partial_compare_trim_string(). */ #ifndef _di_fll_fss_snatch_map_mash_ - extern f_status_t fll_fss_snatch_map_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]); + extern f_status_t fll_fss_snatch_map_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]); #endif // _di_fll_fss_snatch_map_mash_ /** @@ -358,10 +348,8 @@ extern "C" { * This content mappings to process. * @param names * An array of strings to "snatch" from the buffer. - * @param lengths - * An array of lengths for each names string. * @param size - * The total size of the names, lengths, and values arrays. + * The total size of the names and values arrays. * @param glue * A string to append between each duplicate name found when "snatching". * @param values @@ -379,14 +367,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: fl_string_compare_trim(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * Errors (with error bit) from: fl_string_dynamic_partial_compare_trim_string(). * * @see f_string_dynamic_partial_mash_nulless() * @see fl_string_compare_trim() */ #ifndef _di_fll_fss_snatch_map_mash_apart_ - extern f_status_t fll_fss_snatch_map_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_map_multis_t *values[], bool matches[], f_array_lengths_t *indexs[]); + extern f_status_t fll_fss_snatch_map_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_map_multis_t *values[], bool matches[], f_array_lengths_t *indexs[]); #endif // _di_fll_fss_snatch_map_mash_apart_ /** @@ -413,10 +401,8 @@ extern "C" { * This content mappings to process. * @param names * An array of strings to "snatch" from the buffer. - * @param lengths - * An array of lengths for each names string. * @param size - * The total size of the names, lengths, and values arrays. + * The total size of the names and values arrays. * @param glue * A string to append between each duplicate name found when "snatching". * @param values @@ -434,14 +420,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: fl_string_compare_trim(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * Errors (with error bit) from: fl_string_dynamic_partial_compare_trim_string(). * * @see f_string_dynamic_partial_mash_nulless() * @see fl_string_compare_trim() */ #ifndef _di_fll_fss_snatch_map_together_ - extern f_status_t fll_fss_snatch_map_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]); + extern f_status_t fll_fss_snatch_map_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_maps_t *values[], bool matches[], f_array_lengths_t *indexs[]); #endif // _di_fll_fss_snatch_map_together_ /** @@ -465,10 +451,8 @@ extern "C" { * This content mappings to process. * @param names * An array of strings to "snatch" from the buffer. - * @param lengths - * An array of lengths for each names string. * @param size - * The total size of the names, lengths, and values arrays. + * The total size of the names and values arrays. * @param glue * A string to append between each duplicate name found when "snatching". * @param values @@ -486,11 +470,11 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: fl_string_compare_trim(). * Errors (with error bit) from: f_string_dynamic_partial_mash_nulless(). + * Errors (with error bit) from: fl_string_dynamic_partial_compare_trim_string(). */ #ifndef _di_fll_fss_snatch_mash_ - extern f_status_t fll_fss_snatch_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]); + extern f_status_t fll_fss_snatch_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]); #endif // _di_fll_fss_snatch_mash_ /** @@ -515,10 +499,8 @@ extern "C" { * This content mappings to process. * @param names * An array of strings to "snatch" from the buffer. - * @param lengths - * An array of lengths for each names string. * @param size - * The total size of the names, lengths, and values arrays. + * The total size of the names and values arrays. * @param glue * A string to append between each duplicate name found when "snatching". * @param values @@ -536,14 +518,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: fl_string_compare_trim(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * Errors (with error bit) from: fl_string_dynamic_partial_compare_trim_string(). * * @see f_string_dynamic_partial_mash_nulless() * @see fl_string_compare_trim() */ #ifndef _di_fll_fss_snatch_mash_apart_ - extern f_status_t fll_fss_snatch_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamics_t *values[], bool matches[], f_array_lengths_t *indexs[]); + extern f_status_t fll_fss_snatch_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamics_t *values[], bool matches[], f_array_lengths_t *indexs[]); #endif // _di_fll_fss_snatch_mash_apart_ /** @@ -565,10 +547,8 @@ extern "C" { * This content mappings to process. * @param names * An array of strings to "snatch" from the buffer. - * @param lengths - * An array of lengths for each names string. * @param size - * The total size of the names, lengths, and values arrays. + * The total size of the names and values arrays. * @param glue * A string to append between each duplicate name found when "snatching". * @param values @@ -586,14 +566,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: fl_string_compare_trim(). * Errors (with error bit) from: f_string_dynamic_partial_mash_nulless(). + * Errors (with error bit) from: fl_string_dynamic_partial_compare_trim_string(). * * @see f_string_dynamic_partial_append_nulless() * @see fl_string_compare_trim() */ #ifndef _di_fll_fss_snatch_together_ - extern f_status_t fll_fss_snatch_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_array_length_t lengths[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]); + extern f_status_t fll_fss_snatch_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_array_length_t size, const f_string_static_t glue, f_string_dynamic_t *values[], bool matches[], f_array_length_t *indexs[]); #endif // _di_fll_fss_snatch_together_ #ifdef __cplusplus diff --git a/level_2/fll_fss/c/fss_basic.h b/level_2/fll_fss/c/fss_basic.h index f77977f..89d3276 100644 --- a/level_2/fll_fss/c/fss_basic.h +++ b/level_2/fll_fss/c/fss_basic.h @@ -10,7 +10,7 @@ #ifndef _FLL_fss_basic_h #define _FLL_fss_basic_h -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -18,7 +18,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include diff --git a/level_2/fll_fss/c/fss_basic_list.h b/level_2/fll_fss/c/fss_basic_list.h index 7f591c0..fe3bda0 100644 --- a/level_2/fll_fss/c/fss_basic_list.h +++ b/level_2/fll_fss/c/fss_basic_list.h @@ -10,7 +10,7 @@ #ifndef _FLL_fss_basic_list_h #define _FLL_fss_basic_list_h -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -18,7 +18,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include diff --git a/level_2/fll_fss/c/fss_embedded_list.h b/level_2/fll_fss/c/fss_embedded_list.h index 6ff3b49..554cc61 100644 --- a/level_2/fll_fss/c/fss_embedded_list.h +++ b/level_2/fll_fss/c/fss_embedded_list.h @@ -10,7 +10,7 @@ #ifndef _FLL_fss_embedded_list_h #define _FLL_fss_embedded_list_h -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -18,7 +18,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include diff --git a/level_2/fll_fss/c/fss_extended.h b/level_2/fll_fss/c/fss_extended.h index 742bcd2..2680bc7 100644 --- a/level_2/fll_fss/c/fss_extended.h +++ b/level_2/fll_fss/c/fss_extended.h @@ -10,7 +10,7 @@ #ifndef _FLL_fss_extended_h #define _FLL_fss_extended_h -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -18,7 +18,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include diff --git a/level_2/fll_fss/c/fss_extended_list.h b/level_2/fll_fss/c/fss_extended_list.h index d16c9b6..2fdda41 100644 --- a/level_2/fll_fss/c/fss_extended_list.h +++ b/level_2/fll_fss/c/fss_extended_list.h @@ -10,7 +10,7 @@ #ifndef _FLL_fss_extended_list_h #define _FLL_fss_extended_list_h -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -18,7 +18,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include diff --git a/level_2/fll_fss/c/fss_payload.c b/level_2/fll_fss/c/fss_payload.c index 2d42877..82c0afe 100644 --- a/level_2/fll_fss/c/fss_payload.c +++ b/level_2/fll_fss/c/fss_payload.c @@ -34,7 +34,7 @@ extern "C" { if (range->start >= range->stop || range->start >= buffer.used) { if (status == F_fss_found_object || status == F_fss_found_object_content_not) { - if (fl_string_dynamic_partial_compare_string(F_fss_string_payload_s, buffer, F_fss_string_payload_s_length, objects->array[objects->used]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(f_fss_string_payload_s.string, buffer, f_fss_string_payload_s.used, objects->array[objects->used]) == F_equal_to) { status = F_fss_found_object_content_not; } else { @@ -72,7 +72,7 @@ extern "C" { if (status == F_fss_found_object) { found_data = F_true; - if (fl_string_dynamic_partial_compare_string(F_fss_string_payload_s, buffer, F_fss_string_payload_s_length, objects->array[objects->used]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(f_fss_string_payload_s.string, buffer, f_fss_string_payload_s.used, objects->array[objects->used]) == F_equal_to) { status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, &contents->array[contents->used]); if (F_status_is_error(status)) return status; @@ -107,7 +107,7 @@ extern "C" { status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, &contents->array[contents->used]); if (F_status_is_error(status2)) return status2; - if (fl_string_dynamic_partial_compare_string(F_fss_string_payload_s, buffer, F_fss_string_payload_s_length, objects->array[objects->used]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(f_fss_string_payload_s.string, buffer, f_fss_string_payload_s.used, objects->array[objects->used]) == F_equal_to) { ++objects->used; status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, &contents->array[contents->used]); @@ -194,7 +194,7 @@ extern "C" { } if (status == F_none || status == F_none_stop || status == F_none_eos || status == F_none_eol) { - if (fl_string_dynamic_compare_string(F_fss_string_payload_s, object, F_fss_string_payload_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(f_fss_string_payload_s, object) == F_equal_to) { status = f_string_dynamic_increase_by(content.used, destination); if (F_status_is_error(status)) return status; diff --git a/level_2/fll_fss/c/fss_payload.h b/level_2/fll_fss/c/fss_payload.h index 5b07316..ba99f1b 100644 --- a/level_2/fll_fss/c/fss_payload.h +++ b/level_2/fll_fss/c/fss_payload.h @@ -10,7 +10,7 @@ #ifndef _FLL_fss_payload_h #define _FLL_fss_payload_h -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -18,7 +18,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include diff --git a/level_2/fll_fss_status_string/c/fss_status_string.h b/level_2/fll_fss_status_string/c/fss_status_string.h index 02d1a69..260bad8 100644 --- a/level_2/fll_fss_status_string/c/fss_status_string.h +++ b/level_2/fll_fss_status_string/c/fss_status_string.h @@ -10,7 +10,7 @@ #ifndef _FLL_fss_status_string_h #define _FLL_fss_status_string_h -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -20,7 +20,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #ifdef __cplusplus diff --git a/level_2/fll_iki/c/iki.c b/level_2/fll_iki/c/iki.c index 807eb6b..00ed119 100644 --- a/level_2/fll_iki/c/iki.c +++ b/level_2/fll_iki/c/iki.c @@ -6,58 +6,62 @@ extern "C" { #endif #ifndef _di_fll_iki_content_escape_ - f_status_t fll_iki_content_escape(const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *escaped) { + f_status_t fll_iki_content_escape(const f_string_static_t content, const f_string_static_t quote, f_string_dynamic_t *escaped) { #ifndef _di_level_2_parameter_checking_ if (content.used > content.size) return F_status_set_error(F_parameter); - if (quote != f_iki_syntax_quote_single_s.string[0] && quote != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); + if (!quote.used) return F_status_set_error(F_parameter); + if (quote.string[0] != f_iki_syntax_quote_single_s.string[0] && quote.string[0] != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); if (escaped->used > escaped->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ const f_string_range_t range = macro_f_string_range_t_initialize(content.used); - return private_fll_iki_content_partial_escape(content, range, quote, escaped); + return private_fll_iki_content_partial_escape(content, range, quote.string[0], escaped); } #endif // _di_fll_iki_content_escape_ #ifndef _di_fll_iki_content_partial_escape_ - f_status_t fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *escaped) { + f_status_t fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const f_string_static_t quote, f_string_dynamic_t *escaped) { #ifndef _di_level_2_parameter_checking_ if (content.used > content.size) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); if (range.start >= content.used) return F_status_set_error(F_parameter); - if (quote != f_iki_syntax_quote_single_s.string[0] && quote != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); + if (!quote.used) return F_status_set_error(F_parameter); + if (quote.string[0] != f_iki_syntax_quote_single_s.string[0] && quote.string[0] != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); if (escaped->used > escaped->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - return private_fll_iki_content_partial_escape(content, range, quote, escaped); + return private_fll_iki_content_partial_escape(content, range, quote.string[0], escaped); } #endif // _di_fll_iki_content_partial_escape_ #ifndef _di_fll_iki_content_partial_unescape_ - f_status_t fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped) { + f_status_t fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const f_string_static_t quote, f_string_dynamic_t *unescaped) { #ifndef _di_level_2_parameter_checking_ if (content.used > content.size) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); if (range.start >= content.used) return F_status_set_error(F_parameter); - if (quote != f_iki_syntax_quote_single_s.string[0] && quote != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); + if (!quote.used) return F_status_set_error(F_parameter); + if (quote.string[0] != f_iki_syntax_quote_single_s.string[0] && quote.string[0] != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); if (unescaped->used > unescaped->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - return private_fll_iki_content_partial_unescape(content, range, quote, unescaped); + return private_fll_iki_content_partial_unescape(content, range, quote.string[0], unescaped); } #endif // _di_fll_iki_content_partial_unescape_ #ifndef _di_fll_iki_content_unescape_ - f_status_t fll_iki_content_unescape(const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *unescaped) { + f_status_t fll_iki_content_unescape(const f_string_static_t content, const f_string_static_t quote, f_string_dynamic_t *unescaped) { #ifndef _di_level_2_parameter_checking_ if (content.used > content.size) return F_status_set_error(F_parameter); - if (quote != f_iki_syntax_quote_single_s.string[0] && quote != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); + if (!quote.used) return F_status_set_error(F_parameter); + if (quote.string[0] != f_iki_syntax_quote_single_s.string[0] && quote.string[0] != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter); if (unescaped->used > unescaped->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ const f_string_range_t range = macro_f_string_range_t_initialize(content.used); - return private_fll_iki_content_partial_unescape(content, range, quote, unescaped); + return private_fll_iki_content_partial_unescape(content, range, quote.string[0], unescaped); } #endif // _di_fll_iki_content_unescape_ diff --git a/level_2/fll_iki/c/iki.h b/level_2/fll_iki/c/iki.h index 0b15b6e..7497e90 100644 --- a/level_2/fll_iki/c/iki.h +++ b/level_2/fll_iki/c/iki.h @@ -13,12 +13,12 @@ #ifndef _FLL_iki_h #define _FLL_iki_h -// libc includes. +// Libc includes. #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -26,7 +26,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include @@ -57,7 +57,7 @@ extern "C" { * Errors (with error bit) from: f_string_dynamic_increase_by(). */ #ifndef _di_fll_iki_content_escape_ - extern f_status_t fll_iki_content_escape(const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *escaped); + extern f_status_t fll_iki_content_escape(const f_string_static_t content, const f_string_static_t quote, f_string_dynamic_t *escaped); #endif // _di_fll_iki_content_escape_ /** @@ -85,7 +85,7 @@ extern "C" { * Errors (with error bit) from: f_string_dynamic_increase_by(). */ #ifndef _di_fll_iki_content_partial_escape_ - extern f_status_t fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *escaped); + extern f_status_t fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const f_string_static_t quote, f_string_dynamic_t *escaped); #endif // _di_fll_iki_content_partial_escape_ /** @@ -114,7 +114,7 @@ extern "C" { * Errors (with error bit) from: f_string_dynamic_increase_by(). */ #ifndef _di_fll_iki_content_partial_unescape_ - extern f_status_t fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped); + extern f_status_t fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const f_string_static_t quote, f_string_dynamic_t *unescaped); #endif // _di_fll_iki_content_partial_unescape_ /** @@ -141,7 +141,7 @@ extern "C" { * Errors (with error bit) from: f_string_dynamic_increase_by(). */ #ifndef _di_fll_iki_content_unescape_ - extern f_status_t fll_iki_content_unescape(const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *unescaped); + extern f_status_t fll_iki_content_unescape(const f_string_static_t content, const f_string_static_t quote, f_string_dynamic_t *unescaped); #endif // _di_fll_iki_content_unescape_ #ifdef __cplusplus diff --git a/level_2/fll_iki/c/private-iki.c b/level_2/fll_iki/c/private-iki.c index 637b1af..49befb1 100644 --- a/level_2/fll_iki/c/private-iki.c +++ b/level_2/fll_iki/c/private-iki.c @@ -6,10 +6,11 @@ extern "C" { #endif #if !defined(_di_fll_iki_content_escape_) || !defined(_di_fll_iki_content_partial_escape_) - f_status_t private_fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *escaped) { + f_status_t private_fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const char quote, f_string_dynamic_t *escaped) { + f_status_t status = F_none; - // ensure escaped is at least the same size as content. + // Ensure escaped is at least the same size as content. if (content.used > escaped->size) { macro_f_string_dynamic_t_resize(status, (*escaped), content.used); if (F_status_is_error(status)) return status; @@ -53,7 +54,7 @@ extern "C" { } } // for - // delimits found at the end must be escaped to prevent escaping the end quote. + // Delimits found at the end must be escaped to prevent escaping the end quote. if (delimits) { if (escaped->used + delimits > escaped->size) { status = f_string_dynamic_increase_by(delimits, escaped); @@ -70,10 +71,11 @@ extern "C" { #endif // !defined(_di_fll_iki_content_escape_) || !defined(_di_fll_iki_content_partial_escape_) #if !defined(_di_fll_iki_content_unescape_) || !defined(_di_fll_iki_content_partial_unescape_) - f_status_t private_fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped) { + f_status_t private_fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const char quote, f_string_dynamic_t *unescaped) { + f_status_t status = F_none; - // ensure escaped is at least the same size as content. + // Ensure escaped is at least the same size as content. if (content.used > unescaped->size) { macro_f_string_dynamic_t_resize(status, (*unescaped), content.used); if (F_status_is_error(status)) return status; @@ -89,7 +91,7 @@ extern "C" { if (content.string[i] == quote) { - // reset the used array on failure. + // Reset the used array on failure. unescaped->used = used; return F_status_set_error(F_syntax); @@ -145,13 +147,13 @@ extern "C" { } // for } - // at this point if delimits > 0, then this should be the end of the string. + // At this point if delimits > 0, then this should be the end of the string. if (delimits) { - // delimits at the end must be even to prevent escaping the closing quote. + // Delimits at the end must be even to prevent escaping the closing quote. if (delimits % 2) { - // reset the used array on failure. + // Reset the used array on failure. unescaped->used = used; return F_status_set_error(F_syntax); diff --git a/level_2/fll_iki/c/private-iki.h b/level_2/fll_iki/c/private-iki.h index acdfd87..09b0def 100644 --- a/level_2/fll_iki/c/private-iki.h +++ b/level_2/fll_iki/c/private-iki.h @@ -40,7 +40,7 @@ extern "C" { * Errors (with error bit) from: f_string_dynamic_increase_by(). */ #if !defined(_di_fll_iki_content_escape_) || !defined(_di_fll_iki_content_partial_escape_) - extern f_status_t private_fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *escaped) F_attribute_visibility_internal_d; + extern f_status_t private_fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const char quote, f_string_dynamic_t *escaped) F_attribute_visibility_internal_d; #endif // !defined(_di_fll_iki_content_escape_) || !defined(_di_fll_iki_content_partial_escape_) /** @@ -69,7 +69,7 @@ extern "C" { * Errors (with error bit) from: f_string_dynamic_increase_by(). */ #if !defined(_di_fll_iki_content_unescape_) || !defined(_di_fll_iki_content_partial_unescape_) - extern f_status_t private_fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped) F_attribute_visibility_internal_d; + extern f_status_t private_fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const char quote, f_string_dynamic_t *unescaped) F_attribute_visibility_internal_d; #endif // !defined(_di_fll_iki_content_unescape_) || !defined(_di_fll_iki_content_partial_unescape_) #ifdef __cplusplus diff --git a/level_2/fll_path/c/path.h b/level_2/fll_path/c/path.h index f346891..2c0fd20 100644 --- a/level_2/fll_path/c/path.h +++ b/level_2/fll_path/c/path.h @@ -10,10 +10,10 @@ #ifndef _FLL_path_h #define _FLL_path_h -// libc includes. +// Libc includes. #include -// fll-0 includes. +// FLL-0 includes. #include #include #include diff --git a/level_2/fll_print/c/print.h b/level_2/fll_print/c/print.h index 4061715..0b328ad 100644 --- a/level_2/fll_print/c/print.h +++ b/level_2/fll_print/c/print.h @@ -10,10 +10,10 @@ #ifndef _FLL_print_h #define _FLL_print_h -// libc includes. +// Libc includes. #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -22,7 +22,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #ifdef __cplusplus diff --git a/level_2/fll_program/c/program.c b/level_2/fll_program/c/program.c index a4c08f6..ff1d261 100644 --- a/level_2/fll_program/c/program.c +++ b/level_2/fll_program/c/program.c @@ -5,10 +5,10 @@ extern "C" { #endif #ifndef _di_fll_program_print_help_header_ - f_status_t fll_program_print_help_header(const f_file_t output, const f_color_context_t context, const f_string_t name, const f_string_t version) { + f_status_t fll_program_print_help_header(const f_file_t output, const f_color_context_t context, const f_string_static_t name, const f_string_static_t version) { - fl_print_format("%q %[%S%]%q", output.stream, f_string_eol_s, context.set.title, name, context.set.title, f_string_eol_s); - fl_print_format(" %[Version %s%]%q", output.stream, context.set.notable, version, context.set.notable, f_string_eol_s); + fl_print_format("%q %[%Q%]%q", output.stream, f_string_eol_s, context.set.title, name, context.set.title, f_string_eol_s); + fl_print_format(" %[Version %Q%]%q", output.stream, context.set.notable, version, context.set.notable, f_string_eol_s); fl_print_format("%q %[Available Options:%] ", output.stream, f_string_eol_s, context.set.important, context.set.important); @@ -17,61 +17,52 @@ extern "C" { #endif // _di_fll_program_print_help_header_ #ifndef _di_fll_program_print_help_option_ - f_status_t fll_program_print_help_option(const f_file_t output, const f_color_context_t context, const f_string_t option_short, const f_string_t option_long, const f_string_t symbol_short, const f_string_t symbol_long, const f_string_t description) { + f_status_t fll_program_print_help_option(const f_file_t output, const f_color_context_t context, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const f_string_t description) { - fl_print_format("%q %s%[%S%]", output.stream, f_string_eol_s, symbol_short, context.set.standout, option_short, context.set.standout); - fl_print_format(", %s%[%S%]", output.stream, symbol_long, context.set.standout, option_long, context.set.standout); - fl_print_format(" %S", output.stream, description); + fl_print_format("%q %Q%[%Q%]", output.stream, f_string_eol_s, symbol_short, context.set.standout, option_short, context.set.standout); + fl_print_format(", %Q%[%Q%] %S", output.stream, symbol_long, context.set.standout, option_long, context.set.standout, description); return F_none; } #endif // _di_fll_program_print_help_option_ #ifndef _di_fll_program_print_help_option_long_ - f_status_t fll_program_print_help_option_long(const f_file_t output, const f_color_context_t context, const f_string_t option_long, const f_string_t symbol_long, const f_string_t description) { + f_status_t fll_program_print_help_option_long(const f_file_t output, const f_color_context_t context, const f_string_static_t option_long, const f_string_static_t symbol_long, const f_string_t description) { - fl_print_format("%q %s%[%S%]", output.stream, f_string_eol_s, symbol_long, context.set.standout, option_long, context.set.standout); - fl_print_format(" %S", output.stream, description); + fl_print_format("%q %Q%[%Q%] %S", output.stream, f_string_eol_s, symbol_long, context.set.standout, option_long, context.set.standout, description); return F_none; } #endif // _di_fll_program_print_help_option_long_ #ifndef _di_fll_program_print_help_option_other_ - f_status_t fll_program_print_help_option_other(const f_file_t output, const f_color_context_t context, const f_string_t option_other, const f_string_t description) { + f_status_t fll_program_print_help_option_other(const f_file_t output, const f_color_context_t context, const f_string_static_t option_other, const f_string_t description) { - fl_print_format("%q %[%S%]", output.stream, f_string_eol_s, context.set.standout, option_other, context.set.standout); - fl_print_format(" %S", output.stream, description); + fl_print_format("%q %[%Q%] %S", output.stream, f_string_eol_s, context.set.standout, option_other, context.set.standout, description); return F_none; } #endif // _di_fll_program_print_help_option_other_ #ifndef _di_fll_program_print_help_usage_ - f_status_t fll_program_print_help_usage(const f_file_t output, const f_color_context_t context, const f_string_t name, const f_string_t parameters) { + f_status_t fll_program_print_help_usage(const f_file_t output, const f_color_context_t context, const f_string_static_t name, const f_string_static_t parameters) { - fl_print_format("%q%q %[Usage:%]", output.stream, f_string_eol_s, f_string_eol_s, context.set.important, context.set.important); - - f_print_dynamic(f_string_eol_s, output.stream); - fl_print_format(" %[%S%]", output.stream, context.set.standout, name, context.set.standout); + fl_print_format("%q%q %[Usage:%]%q", output.stream, f_string_eol_s, f_string_eol_s, context.set.important, context.set.important, f_string_eol_s); + fl_print_format(" %[%Q%]", output.stream, context.set.standout, name, context.set.standout); fl_print_format(" %[[%] options %[]%]", output.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable); - - if (parameters[0] != '\0') { - fl_print_format(" %[[%] %S %[]%]", output.stream, context.set.notable, context.set.notable, parameters, context.set.notable, context.set.notable); - } - - f_print_dynamic(f_string_eol_s, output.stream); - f_print_dynamic(f_string_eol_s, output.stream); + fl_print_format(" %[[%] %Q", output.stream, context.set.notable, context.set.notable, parameters); + fl_print_format(" %[]%]%q%q", output.stream, context.set.notable, context.set.notable, f_string_eol_s, f_string_eol_s); return F_none; } #endif // _di_fll_program_print_help_usage_ #ifndef _di_fll_program_print_version_ - f_status_t fll_program_print_version(const f_file_t output, const f_string_t version) { + f_status_t fll_program_print_version(const f_file_t output, const f_string_static_t version) { - fl_print_format("%S%q", output.stream, version, f_string_eol_s); + f_print_dynamic(version, output.stream); + f_print_dynamic(f_string_eol_s, output.stream); return F_none; } @@ -149,7 +140,7 @@ extern "C" { for (f_array_length_t i = 0; i < values.used; ++i) { - length = strnlen(argv[values.array[i]], f_console_parameter_size); + length = strnlen(argv[values.array[i]], F_console_parameter_size_d); if (length > 0) { f_string_dynamic_t ripped = f_string_dynamic_t_initialize; @@ -191,7 +182,7 @@ extern "C" { for (f_array_length_t i = 0; i < values.used; ++i) { - length = strnlen(argv[values.array[i]], f_console_parameter_size); + length = strnlen(argv[values.array[i]], F_console_parameter_size_d); if (length > 0) { status = f_string_mash(glue.string, glue.used, argv[values.array[i]], length, destination); @@ -220,9 +211,9 @@ extern "C" { for (f_array_length_t i = 0; i < values.used; ++i) { - length = strnlen(argv[values.array[i]], f_console_parameter_size); + length = strnlen(argv[values.array[i]], F_console_parameter_size_d); - if (length > 0) { + if (length) { f_string_dynamic_t ripped = f_string_dynamic_t_initialize; status = fl_string_rip(argv[values.array[i]], length, &ripped); @@ -263,13 +254,14 @@ extern "C" { for (f_array_length_t i = 0; i < values.used; ++i) { - length = strnlen(argv[values.array[i]], f_console_parameter_size); + length = strnlen(argv[values.array[i]], F_console_parameter_size_d); if (length > 0) { status = fl_string_rip(argv[values.array[i]], length, &ripped); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(ripped); + f_string_dynamic_resize(0, &ripped); + return status; } @@ -286,7 +278,7 @@ extern "C" { } // for if (ripped.size) { - macro_f_string_dynamic_t_delete_simple(ripped) + f_string_dynamic_resize(0, &ripped); } if (status == F_none && start == destination->used) { @@ -297,6 +289,55 @@ extern "C" { } #endif // _di_fll_program_parameter_additional_rip_mash_ +#ifndef _di_fll_program_standard_setdown_ + f_status_t fll_program_standard_setdown(f_signal_t * const signal) { + + // Flush output pipes before closing. + fflush(F_type_output_d); + fflush(F_type_error_d); + + // Close all open file descriptors. + close(F_type_descriptor_output_d); + close(F_type_descriptor_input_d); + close(F_type_descriptor_error_d); + + const f_status_t status = f_signal_close(signal); + + if (F_status_is_error(status)) return status; + + return F_none; + } +#endif // _di_fll_program_standard_setdown_ + +#ifndef _di_fll_program_standard_setup_ + f_status_t fll_program_standard_setup(f_signal_t * const signal) { + + f_signal_set_empty(&signal->set); + f_signal_set_add(F_signal_abort, &signal->set); + f_signal_set_add(F_signal_broken_pipe, &signal->set); + f_signal_set_add(F_signal_hangup, &signal->set); + f_signal_set_add(F_signal_interrupt, &signal->set); + f_signal_set_add(F_signal_quit, &signal->set); + f_signal_set_add(F_signal_termination, &signal->set); + + f_status_t status = f_signal_mask(SIG_BLOCK, &signal->set, 0); + + if (F_status_is_error_not(status)) { + status = f_signal_open(signal); + + // If there is an error opening a signal descriptor, then do not handle signals. + if (F_status_is_error(status)) { + f_signal_mask(SIG_UNBLOCK, &signal->set, 0); + f_signal_close(signal); + } + } + + if (F_status_is_error(status)) return status; + + return F_none; + } +#endif // _di_fll_program_standard_setup_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_2/fll_program/c/program.h b/level_2/fll_program/c/program.h index fec4193..77a3a2d 100644 --- a/level_2/fll_program/c/program.h +++ b/level_2/fll_program/c/program.h @@ -13,7 +13,7 @@ // libc include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -23,8 +23,9 @@ #include #include #include +#include -// fll-1 includes +// FLL-1 includes. #include #include @@ -53,7 +54,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fll_program_print_help_header_ - extern f_status_t fll_program_print_help_header(const f_file_t output, const f_color_context_t context, const f_string_t name, const f_string_t version); + extern f_status_t fll_program_print_help_header(const f_file_t output, const f_color_context_t context, const f_string_static_t name, const f_string_static_t version); #endif // _di_fll_program_print_help_header_ /** @@ -83,7 +84,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fll_program_print_help_option_ - extern f_status_t fll_program_print_help_option(const f_file_t output, const f_color_context_t context, const f_string_t option_short, const f_string_t option_long, const f_string_t symbol_short, const f_string_t symbol_long, const f_string_t description); + extern f_status_t fll_program_print_help_option(const f_file_t output, const f_color_context_t context, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const f_string_t description); #endif // _di_fll_program_print_help_option_ /** @@ -109,7 +110,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fll_program_print_help_option_long_ - extern f_status_t fll_program_print_help_option_long(const f_file_t output, const f_color_context_t context, const f_string_t option_long, const f_string_t symbol_long, const f_string_t description); + extern f_status_t fll_program_print_help_option_long(const f_file_t output, const f_color_context_t context, const f_string_static_t option_long, const f_string_static_t symbol_long, const f_string_t description); #endif // _di_fll_program_print_help_option_long_ /** @@ -133,7 +134,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fll_program_print_help_option_other_ - extern f_status_t fll_program_print_help_option_other(const f_file_t output, const f_color_context_t context, const f_string_t option_other, const f_string_t description); + extern f_status_t fll_program_print_help_option_other(const f_file_t output, const f_color_context_t context, const f_string_static_t option_other, const f_string_t description); #endif // _di_fll_program_print_help_option_other_ /** @@ -158,7 +159,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fll_program_print_help_usage_ - extern f_status_t fll_program_print_help_usage(const f_file_t output, const f_color_context_t context, const f_string_t name, const f_string_t parameters); + extern f_status_t fll_program_print_help_usage(const f_file_t output, const f_color_context_t context, const f_string_static_t name, const f_string_static_t parameters); #endif // _di_fll_program_print_help_usage_ /** @@ -177,7 +178,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fll_program_print_version_ - extern f_status_t fll_program_print_version(const f_file_t output, const f_string_t version); + extern f_status_t fll_program_print_version(const f_file_t output, const f_string_static_t version); #endif // _di_fll_program_print_version_ /** @@ -242,6 +243,7 @@ extern "C" { * * @param argv * The program argument array to parse. + * The caller must guarantee that the values.used does not exceed the argv length. * @param values * The string locations where the console parameters are found. * @param destination @@ -270,6 +272,7 @@ extern "C" { * A string to append between the source and destination, such as a space: ' '. * @param argv * The program argument array to parse. + * The caller must guarantee that the values.used does not exceed the argv length. * @param values * The string locations where the console parameters are found. * @param destination @@ -298,6 +301,7 @@ extern "C" { * * @param argv * The program argument array to parse. + * The caller must guarantee that the values.used does not exceed the argv length. * @param values * The string locations where the console parameters are found. * @param destination @@ -350,6 +354,50 @@ extern "C" { extern f_status_t fll_program_parameter_additional_rip_mash(const f_string_static_t glue, const f_string_t *argv, const f_array_lengths_t values, f_string_dynamic_t *destination); #endif // _di_fll_program_parameter_additional_rip_mash_ +/** + * This provides a standard program setdown operations used by FLL programs. + * + * This does the following: + * - Flushes standard outputs. + * - Closes standard inputs and outputs. + * - Closes the signal handler. + * + * @param signal + * The signal structure. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_signal_close(). + * + * @see f_signal_close() + */ +#ifndef _di_fll_program_standard_setdown_ + extern f_status_t fll_program_standard_setdown(f_signal_t * const signal); +#endif // _di_fll_program_standard_setdown_ + +/** + * This provides a standard program setup operations used by FLL programs. + * + * This does the following: + * - Handle signals so that program can cleanly exit, deallocating as appropriate. + * + * @param signal + * The signal structure. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_signal_mask(). + * Errors (with error bit) from: f_signal_open(). + * + * @see f_signal_mask() + * @see f_signal_open() + */ +#ifndef _di_fll_program_standard_setup_ + extern f_status_t fll_program_standard_setup(f_signal_t * const signal); +#endif // _di_fll_program_standard_setup_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_2/fll_program/data/build/dependencies b/level_2/fll_program/data/build/dependencies index aacb4b0..9659de3 100644 --- a/level_2/fll_program/data/build/dependencies +++ b/level_2/fll_program/data/build/dependencies @@ -9,5 +9,6 @@ f_color f_console f_file f_print +f_signal fl_string fl_print diff --git a/level_2/fll_program/data/build/settings b/level_2/fll_program/data/build/settings index 9a4d640..4af4155 100644 --- a/level_2/fll_program/data/build/settings +++ b/level_2/fll_program/data/build/settings @@ -21,7 +21,7 @@ build_indexer ar build_indexer_arguments rcs build_language c build_libraries -lc -build_libraries-individual -lfl_print -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_print -lf_string -lf_type_array -lf_utf +build_libraries-individual -lfl_print -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_print -lf_signal -lf_string -lf_type_array -lf_utf build_libraries_shared build_libraries_static build_sources_library program.c diff --git a/level_2/fll_status_string/c/status_string.h b/level_2/fll_status_string/c/status_string.h index dfb942e..bef0af3 100644 --- a/level_2/fll_status_string/c/status_string.h +++ b/level_2/fll_status_string/c/status_string.h @@ -10,7 +10,7 @@ #ifndef _FLL_status_string_h #define _FLL_status_string_h -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -19,7 +19,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #ifdef __cplusplus diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index 56be142..528bef9 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -11,61 +11,62 @@ extern "C" { flockfile(file.stream); - fll_program_print_help_header(file, context, byte_dump_program_name_long_s, byte_dump_version_s); - - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_header(file, context, byte_dump_program_name_long_s, byte_dump_program_version_s); + + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, byte_dump_short_binary_s, byte_dump_long_binary_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Display binary representation."); - fll_program_print_help_option(file, context, byte_dump_short_decimal_s, byte_dump_long_decimal_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Display decimal representation."); - fll_program_print_help_option(file, context, byte_dump_short_duodecimal_s, byte_dump_long_duodecimal_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Display duodecimal representation."); - fll_program_print_help_option(file, context, byte_dump_short_hexidecimal_s, byte_dump_long_hexidecimal_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Display hexadecimal representation."); - fll_program_print_help_option(file, context, byte_dump_short_octal_s, byte_dump_long_octal_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Display octal representation."); - fll_program_print_help_option(file, context, byte_dump_short_unicode_s, byte_dump_long_unicode_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Display using Unicode representation for valid Unicode (like: U+0000)."); + fll_program_print_help_option(file, context, byte_dump_short_binary_s, byte_dump_long_binary_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Display binary representation."); + fll_program_print_help_option(file, context, byte_dump_short_decimal_s, byte_dump_long_decimal_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Display decimal representation."); + fll_program_print_help_option(file, context, byte_dump_short_duodecimal_s, byte_dump_long_duodecimal_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Display duodecimal representation."); + fll_program_print_help_option(file, context, byte_dump_short_hexidecimal_s, byte_dump_long_hexidecimal_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Display hexadecimal representation."); + fll_program_print_help_option(file, context, byte_dump_short_octal_s, byte_dump_long_octal_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Display octal representation."); + fll_program_print_help_option(file, context, byte_dump_short_unicode_s, byte_dump_long_unicode_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Display using Unicode representation for valid Unicode (like: U+0000)."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, byte_dump_short_first_s, byte_dump_long_first_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Start reading at this byte offset."); - fll_program_print_help_option(file, context, byte_dump_short_last_s, byte_dump_long_last_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Stop reading at this (inclusive) byte offset."); + fll_program_print_help_option(file, context, byte_dump_short_first_s, byte_dump_long_first_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Start reading at this byte offset."); + fll_program_print_help_option(file, context, byte_dump_short_last_s, byte_dump_long_last_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Stop reading at this (inclusive) byte offset."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, byte_dump_short_narrow_s, byte_dump_long_narrow_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use narrow display, resulting in 1*width reducing size of the text columns."); - fll_program_print_help_option(file, context, byte_dump_short_placeholder_s, byte_dump_long_placeholder_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Use a placeholder character instead of a space for placeholders."); - fll_program_print_help_option(file, context, byte_dump_short_text_s, byte_dump_long_text_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Include a column of text when displaying the bytes."); - fll_program_print_help_option(file, context, byte_dump_short_wide_s, byte_dump_long_wide_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use wide display, resulting in 2*width allowing for space for wide characters in the text columns."); - fll_program_print_help_option(file, context, byte_dump_short_width_s, byte_dump_long_width_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Set number of columns of Bytes to display."); + fll_program_print_help_option(file, context, byte_dump_short_narrow_s, byte_dump_long_narrow_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use narrow display, resulting in 1*width reducing size of the text columns."); + fll_program_print_help_option(file, context, byte_dump_short_placeholder_s, byte_dump_long_placeholder_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Use a placeholder character instead of a space for placeholders."); + fll_program_print_help_option(file, context, byte_dump_short_text_s, byte_dump_long_text_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Include a column of text when displaying the bytes."); + fll_program_print_help_option(file, context, byte_dump_short_wide_s, byte_dump_long_wide_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use wide display, resulting in 2*width allowing for space for wide characters in the text columns."); + fll_program_print_help_option(file, context, byte_dump_short_width_s, byte_dump_long_width_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Set number of columns of Bytes to display."); f_print_dynamic(f_string_eol_s, file.stream); f_print_dynamic(f_string_eol_s, file.stream); fl_print_format(" %[Special Options:%] ", file.stream, context.set.important, context.set.important); - fll_program_print_help_option_long(file, context, byte_dump_long_normal_s, f_console_symbol_long_enable_s.string, " Display UTF-8 symbols for ASCII control codes."); - fll_program_print_help_option_long(file, context, byte_dump_long_simple_s, f_console_symbol_long_enable_s.string, " Display spaces for ASCII control codes."); - fll_program_print_help_option_long(file, context, byte_dump_long_classic_s, f_console_symbol_long_enable_s.string, "Display periods for ASCII control codes."); + fll_program_print_help_option_long(file, context, byte_dump_long_normal_s, f_console_symbol_long_enable_s, " Display UTF-8 symbols for ASCII control codes."); + fll_program_print_help_option_long(file, context, byte_dump_long_simple_s, f_console_symbol_long_enable_s, " Display spaces for ASCII control codes."); + fll_program_print_help_option_long(file, context, byte_dump_long_classic_s, f_console_symbol_long_enable_s, "Display periods for ASCII control codes."); - fll_program_print_help_usage(file, context, byte_dump_program_name_s, "filename(s)"); + fll_program_print_help_usage(file, context, byte_dump_program_name_s, byte_dump_program_help_parameters_s); - fl_print_format(" When using the %[%q%s%] option, some UTF-8 characters may be replaced by your instance and cause display alignment issues.%q%q", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_text_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When using the %[%q%q%] option, some UTF-8 characters may be replaced by your instance and cause display alignment issues.%q%q", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_text_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" Special UTF-8 characters and non-spacing UTF-8 characters may be replaced with a space (or a placeholder when the %[%q%s%] option is used).%q%q", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_placeholder_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" Special UTF-8 characters and non-spacing UTF-8 characters may be replaced with a space (or a placeholder when the %[%q%q%] option is used).%q%q", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_placeholder_s, context.set.notable, f_string_eol_s, f_string_eol_s); fl_print_format(" UTF-8 \"Combining\" characters might have a space appended to allow a proper display but this may cause copy and paste issues.%q%q", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When %[%q%s%] is used, any UTF-8 sequences will still be printed in full should any part is found within the requested range.%q%q", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When %[%q%q%] is used, any UTF-8 sequences will still be printed in full should any part is found within the requested range.%q%q", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" When using the %[%q%s%] option, invalid Unicode will fallback to being displayed using one of the other modes.%q%q", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_unicode_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When using the %[%q%q%] option, invalid Unicode will fallback to being displayed using one of the other modes.%q%q", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_unicode_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fflush(file.stream); funlockfile(file.stream); return F_none; @@ -199,6 +200,7 @@ extern "C" { fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); byte_dump_main_delete(main); + return F_status_set_error(status); } @@ -251,7 +253,7 @@ extern "C" { } if (main->parameters[byte_dump_parameter_version_e].result == f_console_result_found_e) { - fll_program_print_version(main->output.to, byte_dump_version_s); + fll_program_print_version(main->output.to, byte_dump_program_version_s); byte_dump_main_delete(main); @@ -262,8 +264,8 @@ extern "C" { if (main->parameters[byte_dump_parameter_width_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%[%SThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); - fl_print_format("%[%q%s%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_width_s, main->context.set.notable); + fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_width_s, main->context.set.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); funlockfile(main->error.to.stream); @@ -284,8 +286,8 @@ extern "C" { if (F_status_is_error(status) || number < 1 || number >= 0xfb) { flockfile(main->error.to.stream); - fl_print_format("%[%SThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); - fl_print_format("%[%q%s%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_width_s, main->context.set.notable); + fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_width_s, main->context.set.notable); fl_print_format("%[' value can only be a number (inclusively) between %]", main->error.to.stream, main->context.set.error, main->context.set.error); fl_print_format("%[1%]", main->error.to.stream, main->context.set.notable, main->context.set.notable); fl_print_format(" %[and%] ", main->error.to.stream, main->context.set.error, main->context.set.error); @@ -296,9 +298,7 @@ extern "C" { byte_dump_main_delete(main); - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_status_set_error(F_parameter); } @@ -309,8 +309,8 @@ extern "C" { if (main->parameters[byte_dump_parameter_first_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%[%SThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); - fl_print_format("%[%q%s%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_first_s, main->context.set.notable); + fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_first_s, main->context.set.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); funlockfile(main->error.to.stream); @@ -331,8 +331,8 @@ extern "C" { if (F_status_is_error(status) || number > F_number_t_size_unsigned_d) { flockfile(main->error.to.stream); - fl_print_format("%[%SThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); - fl_print_format("%[%q%s%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_first_s, main->context.set.notable); + fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_first_s, main->context.set.notable); fl_print_format("%[' value can only be a number (inclusively) between %]", main->error.to.stream, main->context.set.error, main->context.set.error); fl_print_format("%[0%]", main->error.to.stream, main->context.set.notable, main->context.set.notable); fl_print_format(" %[and%] ", main->error.to.stream, main->context.set.error, main->context.set.error); @@ -343,9 +343,7 @@ extern "C" { byte_dump_main_delete(main); - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_status_set_error(F_parameter); } @@ -356,8 +354,8 @@ extern "C" { if (main->parameters[byte_dump_parameter_last_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%[%SThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); - fl_print_format("%[%q%s%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, main->context.set.notable); + fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, main->context.set.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); funlockfile(main->error.to.stream); @@ -378,8 +376,8 @@ extern "C" { if (F_status_is_error(status) || number < 0 || number > F_number_t_size_unsigned_d) { flockfile(main->error.to.stream); - fl_print_format("%[%SThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); - fl_print_format("%[%q%s%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, main->context.set.notable); + fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, main->context.set.notable); fl_print_format("%[' value can only be a number (inclusively) between %]", main->error.to.stream, main->context.set.error, main->context.set.error); fl_print_format("%[0%]", main->error.to.stream, main->context.set.notable, main->context.set.notable); fl_print_format(" %[and%] ", main->error.to.stream, main->context.set.error, main->context.set.error); @@ -390,9 +388,7 @@ extern "C" { byte_dump_main_delete(main); - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_status_set_error(F_parameter); } @@ -404,10 +400,10 @@ extern "C" { if (main->first > main->last) { flockfile(main->error.to.stream); - fl_print_format("%[%SThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); - fl_print_format("%[%q%s%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_first_s, main->context.set.notable); + fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_first_s, main->context.set.notable); fl_print_format("%[' value cannot be greater than the parameter '%]", main->error.to.stream, main->context.set.error, main->context.set.error); - fl_print_format("%[%q%s%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, main->context.set.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, main->context.set.notable); fl_print_format("%[' value.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); funlockfile(main->error.to.stream); @@ -429,7 +425,7 @@ extern "C" { flockfile(main->output.to.stream); - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); fl_print_format("%[Piped Byte Dump: (in ", main->output.to.stream, main->context.set.title); if (main->mode == byte_dump_mode_hexidecimal_e) { @@ -511,7 +507,7 @@ extern "C" { flockfile(main->output.to.stream); - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); fl_print_format("%[Byte Dump of: %]%[", main->output.to.stream, main->context.set.title, main->context.set.title, main->context.set.notable); fl_print_format("%S%] %[(in ", main->output.to.stream, arguments->argv[main->remaining.array[counter]], main->context.set.notable, main->context.set.title); @@ -566,7 +562,7 @@ extern "C" { } } else { - fll_print_format("%[%SYou failed to specify one or more filenames.%]%q", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error, f_string_eol_s); + fll_print_format("%[%QYou failed to specify one or more filenames.%]%q", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error, f_string_eol_s); status = F_status_set_error(F_parameter); } @@ -576,25 +572,6 @@ extern "C" { } #endif // _di_byte_dump_main_ -#ifndef _di_byte_dump_main_delete_ - f_status_t byte_dump_main_delete(byte_dump_main_t * const main) { - - for (f_array_length_t i = 0; i < byte_dump_total_parameters_d; ++i) { - - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); - } // for - - macro_f_array_lengths_t_delete_simple(main->remaining); - - macro_f_color_context_t_delete_simple(main->context); - macro_f_color_context_t_clear(main->context) - - return F_none; - } -#endif // _di_byte_dump_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/byte_dump/c/byte_dump.h b/level_3/byte_dump/c/byte_dump.h index 75535bc..7bdcaec 100644 --- a/level_3/byte_dump/c/byte_dump.h +++ b/level_3/byte_dump/c/byte_dump.h @@ -13,14 +13,15 @@ * The solution is to add the invalid character codes to this project so that this project can properly print the invalid UTF-8 marker and therefore properly display the information. */ #ifndef _byte_dump_h +#define _byte_dump_h -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -34,267 +35,25 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include +// Byte Dump includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_byte_dump_program_version_ - #define byte_dump_program_version_major_s F_string_ascii_0_s - #define byte_dump_program_version_minor_s F_string_ascii_5_s - #define byte_dump_program_version_micro_s F_string_ascii_8_s - - #ifndef byte_dump_program_version_nano_prefix_s - #define byte_dump_program_version_nano_prefix_s - #endif - - #ifndef byte_dump_program_version_nano_s - #define byte_dump_program_version_nano_s - #endif - - #define byte_dump_version_s byte_dump_program_version_major_s F_string_ascii_period_s byte_dump_program_version_minor_s F_string_ascii_period_s byte_dump_program_version_micro_s byte_dump_program_version_nano_prefix_s byte_dump_program_version_nano_s -#endif // _di_byte_dump_program_version_ - -#ifndef _di_byte_dump_program_name_ - #define byte_dump_program_name_s "byte_dump" - #define byte_dump_program_name_long_s "Byte Dump" -#endif // _di_byte_dump_program_name_ - -/** - * Set to at least 4 to provide a UTF-8 friendly allocation step. - */ -#ifndef _di_byte_dump_default_allocation_step_ - #define byte_dump_default_allocation_step_d 4 -#endif // _di_byte_dump_default_allocation_step_ - -/** - * Byte Dump defines. - * - * byte_dump_mode_*: - * - hexidecimal: Display using hexidecimal notation (base 16). - * - duodecimal: Display using duodecimal notation (base 12). - * - octal: Display using octal notation (base 8). - * - binary: Display using binary notation (base 2). - * - decimal: Display using decimal notation (base 10). - * - * byte_dump_presentation_*: - * - normal: Normal presentation mode. - * - simple: Simple presentation mode. - * - classic: Classic presentation mode. - */ -#ifndef _di_byte_dump_defines_ - enum { - byte_dump_mode_hexidecimal_e = 1, - byte_dump_mode_duodecimal_e, - byte_dump_mode_octal_e, - byte_dump_mode_binary_e, - byte_dump_mode_decimal_e, - }; - - enum { - byte_dump_presentation_normal_e = 1, - byte_dump_presentation_simple_e, - byte_dump_presentation_classic_e, - }; - - #define byte_dump_option_wide_d 0x1 - - #define byte_dump_signal_check_d 10000 - - #define byte_dump_sequence_acknowledge_s "␆" - #define byte_dump_sequence_acknowledge_negative_s "␕" - #define byte_dump_sequence_backspace_s "␈" - #define byte_dump_sequence_bell_s "␇" - #define byte_dump_sequence_cancel_s "␘" - #define byte_dump_sequence_carriage_return_s "␍" - #define byte_dump_sequence_data_link_escape_s "␐" - #define byte_dump_sequence_delete_s "␡" - #define byte_dump_sequence_device_control_1_s "␑" - #define byte_dump_sequence_device_control_2_s "␒" - #define byte_dump_sequence_device_control_3_s "␓" - #define byte_dump_sequence_device_control_4_s "␔" - #define byte_dump_sequence_end_of_enquiry_s "␅" - #define byte_dump_sequence_end_of_medium_s "␙" - #define byte_dump_sequence_end_of_text_s "␃" - #define byte_dump_sequence_end_of_transmission_s "␄" - #define byte_dump_sequence_end_of_transmission_block_s "␗" - #define byte_dump_sequence_escape_s "␛" - #define byte_dump_sequence_file_separator_s "␜" - #define byte_dump_sequence_form_feed_s "␌" - #define byte_dump_sequence_group_separator_s "␝" - #define byte_dump_sequence_line_feed_s "␊" - #define byte_dump_sequence_new_line_s "␤" - #define byte_dump_sequence_null_s "␀" - #define byte_dump_sequence_record_separator_s "␞" - #define byte_dump_sequence_shift_in_s "␏" - #define byte_dump_sequence_shift_out_s "␎" - #define byte_dump_sequence_space_s "␠" - #define byte_dump_sequence_start_of_header_s "␁" - #define byte_dump_sequence_start_of_text_s "␂" - #define byte_dump_sequence_substitute_s "␚" - #define byte_dump_sequence_synchronous_idle_s "␖" - #define byte_dump_sequence_tab_s "␉" - #define byte_dump_sequence_tab_vertical_s "␋" - #define byte_dump_sequence_unit_separator_s "␟" - - #define byte_dump_character_wall_s "|" - #define byte_dump_character_placeholder_s "␣" // other likely choices: (substitute form 1: '␚', substitute form 2: '␦'). - #define byte_dump_character_incomplete_s "�" - #define byte_dump_character_unused_s "�" - - #define byte_dump_short_binary_s "b" - #define byte_dump_short_decimal_s "d" - #define byte_dump_short_duodecimal_s "D" - #define byte_dump_short_hexidecimal_s "x" - #define byte_dump_short_octal_s "o" - #define byte_dump_short_unicode_s "U" - - #define byte_dump_short_first_s "f" - #define byte_dump_short_last_s "l" - - #define byte_dump_short_narrow_s "N" - #define byte_dump_short_placeholder_s "p" - #define byte_dump_short_text_s "t" - #define byte_dump_short_wide_s "W" - #define byte_dump_short_width_s "w" - - #define byte_dump_long_binary_s "binary" - #define byte_dump_long_decimal_s "decimal" - #define byte_dump_long_duodecimal_s "duodecimal" - #define byte_dump_long_hexidecimal_s "hexidecimal" - #define byte_dump_long_octal_s "octal" - #define byte_dump_long_unicode_s "unicode" - - #define byte_dump_long_first_s "first" // First offset byte size. - #define byte_dump_long_last_s "last" // Last offset byte size. - - #define byte_dump_long_narrow_s "narrow" // Each character in the displyed text will take at least 1 columns. - #define byte_dump_long_placeholder_s "placeholder" // Display (colored) placeholders to signify codes that are UTF-8 fragments. - #define byte_dump_long_text_s "text" // Display text - #define byte_dump_long_wide_s "wide" // Each character in the displyed text will take at least 2 columns. - #define byte_dump_long_width_s "width" // Number of characters to display per row. - - #define byte_dump_long_normal_s "normal" // Use normal presentation, displaying UTF-8 sequence codes for ASCII special codes. - #define byte_dump_long_simple_s "simple" // Use simple presentation, displaying spaces for ASCII special codes instead of UTF-8 sequence codes. - #define byte_dump_long_classic_s "classic" // Use classic presentation, displaying periods for ASCII special codes instead of UTF-8 sequence codes. - - enum { - byte_dump_parameter_help_e, - byte_dump_parameter_light_e, - byte_dump_parameter_dark_e, - byte_dump_parameter_no_color_e, - byte_dump_parameter_verbosity_quiet_e, - byte_dump_parameter_verbosity_normal_e, - byte_dump_parameter_verbosity_verbose_e, - byte_dump_parameter_verbosity_debug_e, - byte_dump_parameter_version_e, - - byte_dump_parameter_binary_e, - byte_dump_parameter_decimal_e, - byte_dump_parameter_duodecimal_e, - byte_dump_parameter_hexidecimal_e, - byte_dump_parameter_octal_e, - byte_dump_parameter_unicode_e, - - byte_dump_parameter_first_e, - byte_dump_parameter_last_e, - - byte_dump_parameter_narrow_e, - byte_dump_parameter_placeholder_e, - byte_dump_parameter_text_e, - byte_dump_parameter_wide_e, - byte_dump_parameter_width_e, - - byte_dump_parameter_normal_e, - byte_dump_parameter_simple_e, - byte_dump_parameter_classic_e, - }; - - #define byte_dump_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_binary_s, byte_dump_long_binary_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_decimal_s, byte_dump_long_decimal_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_duodecimal_s, byte_dump_long_duodecimal_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_hexidecimal_s, byte_dump_long_hexidecimal_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_octal_s, byte_dump_long_octal_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_unicode_s, byte_dump_long_unicode_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_first_s, byte_dump_long_first_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_last_s, byte_dump_long_last_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_narrow_s, byte_dump_long_narrow_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_placeholder_s, byte_dump_long_placeholder_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_text_s, byte_dump_long_text_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_wide_s, byte_dump_long_wide_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(byte_dump_short_width_s, byte_dump_long_width_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(0, byte_dump_long_normal_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(0, byte_dump_long_simple_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(0, byte_dump_long_classic_s, 0, 0, f_console_type_normal_e), \ - } - - #define byte_dump_total_parameters_d 25 -#endif // _di_byte_dump_defines_ - -#ifndef _di_byte_dump_main_t_ - typedef struct { - f_console_parameter_t parameters[byte_dump_total_parameters_d]; - - f_array_lengths_t remaining; - bool process_pipe; - - fl_print_t output; - fl_print_t error; - fl_print_t warning; - - f_signal_t signal; - - uint64_t first; - uint64_t last; - uint8_t width; - uint8_t mode; - uint8_t presentation; - uint8_t options; - - f_color_context_t context; - } byte_dump_main_t; - - #define byte_dump_main_t_initialize \ - { \ - byte_dump_console_parameter_t_initialize, \ - f_array_lengths_t_initialize, \ - F_false, \ - fl_print_t_initialize, \ - macro_fl_print_t_initialize_error(), \ - macro_fl_print_t_initialize_warning(), \ - f_signal_t_initialize, \ - 0, \ - 0, \ - 8, \ - byte_dump_option_wide_d, \ - byte_dump_mode_hexidecimal_e, \ - byte_dump_presentation_normal_e, \ - f_color_context_t_initialize, \ - } -#endif // _di_byte_dump_main_t_ - /** * Print help. * @@ -305,6 +64,8 @@ extern "C" { * * @return * F_none on success. + * + * @see byte_dump_main() */ #ifndef _di_byte_dump_print_help_ extern f_status_t byte_dump_print_help(const f_file_t file, const f_color_context_t context); @@ -342,25 +103,6 @@ extern "C" { extern f_status_t byte_dump_main(byte_dump_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_byte_dump_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing byte_dump_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see byte_dump_main() - */ -#ifndef _di_byte_dump_main_delete_ - extern f_status_t byte_dump_main_delete(byte_dump_main_t * const main); -#endif // _di_byte_dump_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/byte_dump/c/common.c b/level_3/byte_dump/c/common.c new file mode 100644 index 0000000..bfd55cc --- /dev/null +++ b/level_3/byte_dump/c/common.c @@ -0,0 +1,85 @@ +#include "byte_dump.h" +#include "private-common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_byte_dump_program_version_ + const f_string_static_t byte_dump_program_version_s = macro_f_string_static_t_initialize2(BYTE_DUMP_program_version_s, 0, BYTE_DUMP_program_version_s_length); +#endif // _di_byte_dump_program_version_ + +#ifndef _di_byte_dump_program_name_ + const f_string_static_t byte_dump_program_name_s = macro_f_string_static_t_initialize2(BYTE_DUMP_program_name_s, 0, BYTE_DUMP_program_name_s_length); + const f_string_static_t byte_dump_program_name_long_s = macro_f_string_static_t_initialize2(BYTE_DUMP_program_name_long_s, 0, BYTE_DUMP_program_name_long_s_length); +#endif // _di_byte_dump_program_name_ + +#ifndef _di_byte_dump_program_help_parameters_ + const f_string_static_t byte_dump_program_help_parameters_s = macro_f_string_static_t_initialize2(BYTE_DUMP_program_help_parameters_s, 0, BYTE_DUMP_program_help_parameters_s_length); +#endif // _di_byte_dump_program_help_parameters_ + +#ifndef _di_byte_dump_defines_ + const f_string_static_t byte_dump_character_wall_s = macro_f_string_static_t_initialize2(BYTE_DUMP_character_wall_s, 0, BYTE_DUMP_character_wall_s_length); + const f_string_static_t byte_dump_character_placeholder_s = macro_f_string_static_t_initialize2(BYTE_DUMP_character_placeholder_s, 0, BYTE_DUMP_character_placeholder_s_length); + const f_string_static_t byte_dump_character_incomplete_s = macro_f_string_static_t_initialize2(BYTE_DUMP_character_incomplete_s, 0, BYTE_DUMP_character_incomplete_s_length); + const f_string_static_t byte_dump_character_unused_s = macro_f_string_static_t_initialize2(BYTE_DUMP_character_unused_s, 0, BYTE_DUMP_character_unused_s_length); + + const f_string_static_t byte_dump_short_binary_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_binary_s, 0, BYTE_DUMP_short_binary_s_length); + const f_string_static_t byte_dump_short_decimal_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_decimal_s, 0, BYTE_DUMP_short_decimal_s_length); + const f_string_static_t byte_dump_short_duodecimal_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_duodecimal_s, 0, BYTE_DUMP_short_duodecimal_s_length); + const f_string_static_t byte_dump_short_hexidecimal_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_hexidecimal_s, 0, BYTE_DUMP_short_hexidecimal_s_length); + const f_string_static_t byte_dump_short_octal_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_octal_s, 0, BYTE_DUMP_short_octal_s_length); + const f_string_static_t byte_dump_short_unicode_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_unicode_s, 0, BYTE_DUMP_short_unicode_s_length); + + const f_string_static_t byte_dump_short_first_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_first_s, 0, BYTE_DUMP_short_first_s_length); + const f_string_static_t byte_dump_short_last_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_last_s, 0, BYTE_DUMP_short_last_s_length); + + const f_string_static_t byte_dump_short_narrow_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_narrow_s, 0, BYTE_DUMP_short_narrow_s_length); + const f_string_static_t byte_dump_short_placeholder_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_placeholder_s, 0, BYTE_DUMP_short_placeholder_s_length); + const f_string_static_t byte_dump_short_text_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_text_s, 0, BYTE_DUMP_short_text_s_length); + const f_string_static_t byte_dump_short_wide_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_wide_s, 0, BYTE_DUMP_short_wide_s_length); + const f_string_static_t byte_dump_short_width_s = macro_f_string_static_t_initialize2(BYTE_DUMP_short_width_s, 0, BYTE_DUMP_short_width_s_length); + + const f_string_static_t byte_dump_long_binary_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_binary_s, 0, BYTE_DUMP_long_binary_s_length); + const f_string_static_t byte_dump_long_decimal_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_decimal_s, 0, BYTE_DUMP_long_decimal_s_length); + const f_string_static_t byte_dump_long_duodecimal_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_duodecimal_s, 0, BYTE_DUMP_long_duodecimal_s_length); + const f_string_static_t byte_dump_long_hexidecimal_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_hexidecimal_s, 0, BYTE_DUMP_long_hexidecimal_s_length); + const f_string_static_t byte_dump_long_octal_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_octal_s, 0, BYTE_DUMP_long_octal_s_length); + const f_string_static_t byte_dump_long_unicode_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_unicode_s, 0, BYTE_DUMP_long_unicode_s_length); + + const f_string_static_t byte_dump_long_first_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_first_s, 0, BYTE_DUMP_long_first_s_length); + const f_string_static_t byte_dump_long_last_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_last_s, 0, BYTE_DUMP_long_last_s_length); + + const f_string_static_t byte_dump_long_narrow_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_narrow_s, 0, BYTE_DUMP_long_narrow_s_length); + const f_string_static_t byte_dump_long_placeholder_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_placeholder_s, 0, BYTE_DUMP_long_placeholder_s_length); + const f_string_static_t byte_dump_long_text_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_text_s, 0, BYTE_DUMP_long_text_s_length); + const f_string_static_t byte_dump_long_wide_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_wide_s, 0, BYTE_DUMP_long_wide_s_length); + const f_string_static_t byte_dump_long_width_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_width_s, 0, BYTE_DUMP_long_width_s_length); + + const f_string_static_t byte_dump_long_normal_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_normal_s, 0, BYTE_DUMP_long_normal_s_length); + const f_string_static_t byte_dump_long_simple_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_simple_s, 0, BYTE_DUMP_long_simple_s_length); + const f_string_static_t byte_dump_long_classic_s = macro_f_string_static_t_initialize2(BYTE_DUMP_long_classic_s, 0, BYTE_DUMP_long_classic_s_length); +#endif // _di_byte_dump_defines_ + +#ifndef _di_byte_dump_main_delete_ + f_status_t byte_dump_main_delete(byte_dump_main_t * const main) { + + for (f_array_length_t i = 0; i < byte_dump_total_parameters_d; ++i) { + + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); + } // for + + f_type_array_lengths_resize(0, &main->remaining); + + macro_f_color_context_t_delete_simple(main->context); + macro_f_color_context_t_clear(main->context) + + return F_none; + } +#endif // _di_byte_dump_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/byte_dump/c/common.h b/level_3/byte_dump/c/common.h new file mode 100644 index 0000000..7b6224c --- /dev/null +++ b/level_3/byte_dump/c/common.h @@ -0,0 +1,356 @@ +/** + * FLL - Level 3 + * + * Project: Byte Dump + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _byte_dump_common_h +#define _byte_dump_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_byte_dump_program_version_ + #define BYTE_DUMP_program_version_major_s F_string_ascii_0_s + #define BYTE_DUMP_program_version_minor_s F_string_ascii_5_s + #define BYTE_DUMP_program_version_micro_s F_string_ascii_8_s + + #define BYTE_DUMP_program_version_major_s_length F_string_ascii_0_s_length + #define BYTE_DUMP_program_version_minor_s_length F_string_ascii_5_s_length + #define BYTE_DUMP_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(BYTE_DUMP_program_version_nano_prefix_s) && defined(BYTE_DUMP_program_version_nano_prefix_s_length)) + #define BYTE_DUMP_program_version_nano_prefix_s + #define BYTE_DUMP_program_version_nano_prefix_s_length 0 + #endif // !(defined(BYTE_DUMP_program_version_nano_prefix_s) && defined(BYTE_DUMP_program_version_nano_prefix_s_length)) + + #if !(defined(BYTE_DUMP_program_version_nano_s) && defined(BYTE_DUMP_program_version_nano_s_length)) + #define BYTE_DUMP_program_version_nano_s + #define BYTE_DUMP_program_version_nano_s_length 0 + #endif // !(defined(BYTE_DUMP_program_version_nano_s) && defined(BYTE_DUMP_program_version_nano_s_length)) + + #define BYTE_DUMP_program_version_s BYTE_DUMP_program_version_major_s F_string_ascii_period_s BYTE_DUMP_program_version_minor_s F_string_ascii_period_s BYTE_DUMP_program_version_micro_s BYTE_DUMP_program_version_nano_prefix_s BYTE_DUMP_program_version_nano_s + + #define BYTE_DUMP_program_version_s_length BYTE_DUMP_program_version_major_s_length + F_string_ascii_period_s_length + BYTE_DUMP_program_version_minor_s_length + F_string_ascii_period_s_length + BYTE_DUMP_program_version_micro_s_length + BYTE_DUMP_program_version_nano_prefix_s_length + BYTE_DUMP_program_version_nano_s_length + + extern const f_string_static_t byte_dump_program_version_s; +#endif // _di_byte_dump_program_version_ + +#ifndef _di_byte_dump_program_name_ + #define BYTE_DUMP_program_name_s "byte_dump" + #define BYTE_DUMP_program_name_long_s "Byte Dump" + + #define BYTE_DUMP_program_name_s_length 9 + #define BYTE_DUMP_program_name_long_s_length 9 + + extern const f_string_static_t byte_dump_program_name_s; + extern const f_string_static_t byte_dump_program_name_long_s; +#endif // _di_byte_dump_program_name_ + +#ifndef _di_byte_dump_program_help_parameters_ + #define BYTE_DUMP_program_help_parameters_s "filename(s)" + #define BYTE_DUMP_program_help_parameters_s_length 11 + + extern const f_string_static_t byte_dump_program_help_parameters_s; +#endif // _di_byte_dump_program_help_parameters_ + +/** + * Set to at least 4 to provide a UTF-8 friendly allocation step. + */ +#ifndef _di_byte_dump_default_allocation_step_ + #define byte_dump_default_allocation_step_d 4 +#endif // _di_byte_dump_default_allocation_step_ + +/** + * Byte Dump defines. + * + * byte_dump_mode_*: + * - hexidecimal: Display using hexidecimal notation (base 16). + * - duodecimal: Display using duodecimal notation (base 12). + * - octal: Display using octal notation (base 8). + * - binary: Display using binary notation (base 2). + * - decimal: Display using decimal notation (base 10). + * + * byte_dump_presentation_*: + * - normal: Normal presentation mode. + * - simple: Simple presentation mode. + * - classic: Classic presentation mode. + */ +#ifndef _di_byte_dump_defines_ + enum { + byte_dump_mode_hexidecimal_e = 1, + byte_dump_mode_duodecimal_e, + byte_dump_mode_octal_e, + byte_dump_mode_binary_e, + byte_dump_mode_decimal_e, + }; + + enum { + byte_dump_presentation_normal_e = 1, + byte_dump_presentation_simple_e, + byte_dump_presentation_classic_e, + }; + + #define byte_dump_option_wide_d 0x1 + + #define byte_dump_signal_check_d 10000 + + #define BYTE_DUMP_character_wall_s "|" + #define BYTE_DUMP_character_placeholder_s "␣" // other likely choices: (substitute form 1: '␚', substitute form 2: '␦'). + #define BYTE_DUMP_character_incomplete_s "�" + #define BYTE_DUMP_character_unused_s "�" + + #define BYTE_DUMP_short_binary_s "b" + #define BYTE_DUMP_short_decimal_s "d" + #define BYTE_DUMP_short_duodecimal_s "D" + #define BYTE_DUMP_short_hexidecimal_s "x" + #define BYTE_DUMP_short_octal_s "o" + #define BYTE_DUMP_short_unicode_s "U" + + #define BYTE_DUMP_short_first_s "f" + #define BYTE_DUMP_short_last_s "l" + + #define BYTE_DUMP_short_narrow_s "N" + #define BYTE_DUMP_short_placeholder_s "p" + #define BYTE_DUMP_short_text_s "t" + #define BYTE_DUMP_short_wide_s "W" + #define BYTE_DUMP_short_width_s "w" + + #define BYTE_DUMP_long_binary_s "binary" + #define BYTE_DUMP_long_decimal_s "decimal" + #define BYTE_DUMP_long_duodecimal_s "duodecimal" + #define BYTE_DUMP_long_hexidecimal_s "hexidecimal" + #define BYTE_DUMP_long_octal_s "octal" + #define BYTE_DUMP_long_unicode_s "unicode" + + #define BYTE_DUMP_long_first_s "first" // First offset byte size. + #define BYTE_DUMP_long_last_s "last" // Last offset byte size. + + #define BYTE_DUMP_long_narrow_s "narrow" // Each character in the displyed text will take at least 1 columns. + #define BYTE_DUMP_long_placeholder_s "placeholder" // Display (colored) placeholders to signify codes that are UTF-8 fragments. + #define BYTE_DUMP_long_text_s "text" // Display text + #define BYTE_DUMP_long_wide_s "wide" // Each character in the displyed text will take at least 2 columns. + #define BYTE_DUMP_long_width_s "width" // Number of characters to display per row. + + #define BYTE_DUMP_long_normal_s "normal" // Use normal presentation, displaying UTF-8 sequence codes for ASCII special codes. + #define BYTE_DUMP_long_simple_s "simple" // Use simple presentation, displaying spaces for ASCII special codes instead of UTF-8 sequence codes. + #define BYTE_DUMP_long_classic_s "classic" // Use classic presentation, displaying periods for ASCII special codes instead of UTF-8 sequence codes. + + #define BYTE_DUMP_character_wall_s_length 1 + #define BYTE_DUMP_character_placeholder_s_length 3 + #define BYTE_DUMP_character_incomplete_s_length 3 + #define BYTE_DUMP_character_unused_s_length 3 + + #define BYTE_DUMP_short_binary_s_length 1 + #define BYTE_DUMP_short_decimal_s_length 1 + #define BYTE_DUMP_short_duodecimal_s_length 1 + #define BYTE_DUMP_short_hexidecimal_s_length 1 + #define BYTE_DUMP_short_octal_s_length 1 + #define BYTE_DUMP_short_unicode_s_length 1 + + #define BYTE_DUMP_short_first_s_length 1 + #define BYTE_DUMP_short_last_s_length 1 + + #define BYTE_DUMP_short_narrow_s_length 1 + #define BYTE_DUMP_short_placeholder_s_length 1 + #define BYTE_DUMP_short_text_s_length 1 + #define BYTE_DUMP_short_wide_s_length 1 + #define BYTE_DUMP_short_width_s_length 1 + + #define BYTE_DUMP_long_binary_s_length 6 + #define BYTE_DUMP_long_decimal_s_length 7 + #define BYTE_DUMP_long_duodecimal_s_length 10 + #define BYTE_DUMP_long_hexidecimal_s_length 11 + #define BYTE_DUMP_long_octal_s_length 5 + #define BYTE_DUMP_long_unicode_s_length 7 + + #define BYTE_DUMP_long_first_s_length 5 + #define BYTE_DUMP_long_last_s_length 4 + + #define BYTE_DUMP_long_narrow_s_length 6 + #define BYTE_DUMP_long_placeholder_s_length 11 + #define BYTE_DUMP_long_text_s_length 4 + #define BYTE_DUMP_long_wide_s_length 4 + #define BYTE_DUMP_long_width_s_length 5 + + #define BYTE_DUMP_long_normal_s_length 6 + #define BYTE_DUMP_long_simple_s_length 6 + #define BYTE_DUMP_long_classic_s_length 7 + + extern const f_string_static_t byte_dump_character_wall_s; + extern const f_string_static_t byte_dump_character_placeholder_s; + extern const f_string_static_t byte_dump_character_incomplete_s; + extern const f_string_static_t byte_dump_character_unused_s; + + extern const f_string_static_t byte_dump_short_binary_s; + extern const f_string_static_t byte_dump_short_decimal_s; + extern const f_string_static_t byte_dump_short_duodecimal_s; + extern const f_string_static_t byte_dump_short_hexidecimal_s; + extern const f_string_static_t byte_dump_short_octal_s; + extern const f_string_static_t byte_dump_short_unicode_s; + + extern const f_string_static_t byte_dump_short_first_s; + extern const f_string_static_t byte_dump_short_last_s; + + extern const f_string_static_t byte_dump_short_narrow_s; + extern const f_string_static_t byte_dump_short_placeholder_s; + extern const f_string_static_t byte_dump_short_text_s; + extern const f_string_static_t byte_dump_short_wide_s; + extern const f_string_static_t byte_dump_short_width_s; + + extern const f_string_static_t byte_dump_long_binary_s; + extern const f_string_static_t byte_dump_long_decimal_s; + extern const f_string_static_t byte_dump_long_duodecimal_s; + extern const f_string_static_t byte_dump_long_hexidecimal_s; + extern const f_string_static_t byte_dump_long_octal_s; + extern const f_string_static_t byte_dump_long_unicode_s; + + extern const f_string_static_t byte_dump_long_first_s; + extern const f_string_static_t byte_dump_long_last_s; + + extern const f_string_static_t byte_dump_long_narrow_s; + extern const f_string_static_t byte_dump_long_placeholder_s; + extern const f_string_static_t byte_dump_long_text_s; + extern const f_string_static_t byte_dump_long_wide_s; + extern const f_string_static_t byte_dump_long_width_s; + + extern const f_string_static_t byte_dump_long_normal_s; + extern const f_string_static_t byte_dump_long_simple_s; + extern const f_string_static_t byte_dump_long_classic_s; + + enum { + byte_dump_parameter_help_e, + byte_dump_parameter_light_e, + byte_dump_parameter_dark_e, + byte_dump_parameter_no_color_e, + byte_dump_parameter_verbosity_quiet_e, + byte_dump_parameter_verbosity_normal_e, + byte_dump_parameter_verbosity_verbose_e, + byte_dump_parameter_verbosity_debug_e, + byte_dump_parameter_version_e, + + byte_dump_parameter_binary_e, + byte_dump_parameter_decimal_e, + byte_dump_parameter_duodecimal_e, + byte_dump_parameter_hexidecimal_e, + byte_dump_parameter_octal_e, + byte_dump_parameter_unicode_e, + + byte_dump_parameter_first_e, + byte_dump_parameter_last_e, + + byte_dump_parameter_narrow_e, + byte_dump_parameter_placeholder_e, + byte_dump_parameter_text_e, + byte_dump_parameter_wide_e, + byte_dump_parameter_width_e, + + byte_dump_parameter_normal_e, + byte_dump_parameter_simple_e, + byte_dump_parameter_classic_e, + }; + + #define byte_dump_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_binary_s.string, byte_dump_long_binary_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_decimal_s.string, byte_dump_long_decimal_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_duodecimal_s.string, byte_dump_long_duodecimal_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_hexidecimal_s.string, byte_dump_long_hexidecimal_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_octal_s.string, byte_dump_long_octal_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_unicode_s.string, byte_dump_long_unicode_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_first_s.string, byte_dump_long_first_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_last_s.string, byte_dump_long_last_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_narrow_s.string, byte_dump_long_narrow_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_placeholder_s.string, byte_dump_long_placeholder_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_text_s.string, byte_dump_long_text_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_wide_s.string, byte_dump_long_wide_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(byte_dump_short_width_s.string, byte_dump_long_width_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(0, byte_dump_long_normal_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(0, byte_dump_long_simple_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(0, byte_dump_long_classic_s.string, 0, 0, f_console_type_normal_e), \ + } + + #define byte_dump_total_parameters_d 25 +#endif // _di_byte_dump_defines_ + +#ifndef _di_byte_dump_main_t_ + typedef struct { + f_console_parameter_t parameters[byte_dump_total_parameters_d]; + + f_array_lengths_t remaining; + bool process_pipe; + + fl_print_t output; + fl_print_t error; + fl_print_t warning; + + f_signal_t signal; + + uint64_t first; + uint64_t last; + uint8_t width; + uint8_t mode; + uint8_t presentation; + uint8_t options; + + f_color_context_t context; + } byte_dump_main_t; + + #define byte_dump_main_t_initialize \ + { \ + byte_dump_console_parameter_t_initialize, \ + f_array_lengths_t_initialize, \ + F_false, \ + fl_print_t_initialize, \ + macro_fl_print_t_initialize_error(), \ + macro_fl_print_t_initialize_warning(), \ + f_signal_t_initialize, \ + 0, \ + 0, \ + 8, \ + byte_dump_option_wide_d, \ + byte_dump_mode_hexidecimal_e, \ + byte_dump_presentation_normal_e, \ + f_color_context_t_initialize, \ + } +#endif // _di_byte_dump_main_t_ + +/** + * Deallocate main. + * + * Be sure to call this after executing byte_dump_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @see byte_dump_main() + */ +#ifndef _di_byte_dump_main_delete_ + extern f_status_t byte_dump_main_delete(byte_dump_main_t * const main); +#endif // _di_byte_dump_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _byte_dump_common_h diff --git a/level_3/byte_dump/c/main.c b/level_3/byte_dump/c/main.c index 9389a89..5f5985a 100644 --- a/level_3/byte_dump/c/main.c +++ b/level_3/byte_dump/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = byte_dump_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/byte_dump/c/private-byte_dump.c b/level_3/byte_dump/c/private-byte_dump.c index c0e56e8..cf2995f 100644 --- a/level_3/byte_dump/c/private-byte_dump.c +++ b/level_3/byte_dump/c/private-byte_dump.c @@ -263,15 +263,15 @@ extern "C" { byte_dump_print_text(main, characters, invalid, &previous, &offset); } else { - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); } } - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); funlockfile(main->output.to.stream); - // make sure to flush standard out to help prevent standard error from causing poblems. + // Make sure to flush standard out to help prevent standard error from causing problems. fflush(main->output.to.stream); if (found_invalid_utf) { @@ -288,7 +288,7 @@ extern "C" { // @todo determine what the error is and display it. flockfile(main->error.to.stream); - fl_print_format("%[%Sread() failed for '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%Qread() failed for '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%S%]", main->error.to.stream, main->context.set.notable, file_name ? file_name : "-", main->context.set.notable); fl_print_format("%['.%]%q%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s, f_string_eol_s); @@ -399,25 +399,25 @@ extern "C" { if (width_utf < 2) { - // 1 == U+0000 -> U+007F + // 1 == U+0000 -> U+007F. unicode = macro_f_utf_character_t_to_char_1(characters.string[character_current]) & 0x7f; } else if (width_utf == 2) { - // 2 == U+0080 -> U+07FF + // 2 == U+0080 -> U+07FF. unicode = (macro_f_utf_character_t_to_char_1(characters.string[character_current]) & 0x1f) << 6; unicode |= macro_f_utf_character_t_to_char_2(characters.string[character_current]) & 0x3f; } else if (width_utf == 3) { - // 3 == U+0800 -> U+FFFF + // 3 == U+0800 -> U+FFFF. unicode = (macro_f_utf_character_t_to_char_1(characters.string[character_current]) & 0xf) << 12; unicode |= (macro_f_utf_character_t_to_char_2(characters.string[character_current]) & 0x3f) << 6; unicode |= macro_f_utf_character_t_to_char_3(characters.string[character_current]) & 0x3f; } else if (width_utf == 4) { - // 4 == U+10000 -> U+10FFFF + // 4 == U+10000 -> U+10FFFF. unicode = (macro_f_utf_character_t_to_char_1(characters.string[character_current]) & 0x7) << 18; unicode |= (macro_f_utf_character_t_to_char_2(characters.string[character_current]) & 0x3f) << 12; unicode |= (macro_f_utf_character_t_to_char_2(characters.string[character_current]) & 0x3f) << 6; @@ -512,7 +512,7 @@ extern "C" { byte_dump_print_text(main, characters, invalid, previous, offset); } else { - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); } cell->column = 0; @@ -574,7 +574,7 @@ extern "C" { char byte[5] = { 0, 0, 0, 0, 0 }; - fl_print_format(" %[%s%] ", main->output.to.stream, main->context.set.notable, byte_dump_character_wall_s, main->context.set.notable); + fl_print_format(" %[%q%] ", main->output.to.stream, main->context.set.notable, byte_dump_character_wall_s, main->context.set.notable); if (*offset) { if (main->parameters[byte_dump_parameter_classic_e].result == f_console_result_found_e) { @@ -594,7 +594,7 @@ extern "C" { if (main->parameters[byte_dump_parameter_placeholder_e].result == f_console_result_found_e) { for (; *offset && at < main->width; --(*offset), ++at) { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); if (main->options & byte_dump_option_wide_d) { f_print_dynamic(f_string_space_s, main->output.to.stream); @@ -627,13 +627,13 @@ extern "C" { for (; at < previous->bytes && at < main->width; ++at) { if (previous->invalid) { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.error, byte_dump_character_placeholder_s, main->context.set.error); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.error, byte_dump_character_placeholder_s, main->context.set.error); } else if (main->parameters[byte_dump_parameter_classic_e].result == f_console_result_found_e) { f_print_dynamic(f_string_ascii_period_s, main->output.to.stream); } else { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); } if (main->options & byte_dump_option_wide_d) { @@ -668,7 +668,7 @@ extern "C" { width_utf = macro_f_utf_byte_width_is(c); if (invalid[i]) { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.error, byte_dump_character_incomplete_s, main->context.set.error); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.error, byte_dump_character_incomplete_s, main->context.set.error); if (main->options & byte_dump_option_wide_d) { f_print_dynamic(f_string_ascii_space_s, main->output.to.stream); @@ -758,7 +758,7 @@ extern "C" { f_print_dynamic(f_string_ascii_period_s, main->output.to.stream); } else { - fl_print_format("%[%[%s%]%]", main->output.to.stream, main->context.set.notable, main->context.set.warning, byte_dump_sequence_space_s, main->context.set.warning, main->context.set.notable); + fl_print_format("%[%[%q%]%]", main->output.to.stream, main->context.set.notable, main->context.set.warning, f_print_sequence_space_s, main->context.set.warning, main->context.set.notable); } if (main->options & byte_dump_option_wide_d) { @@ -770,7 +770,7 @@ extern "C" { f_print_dynamic(f_string_ascii_period_s, main->output.to.stream); } else if (main->parameters[byte_dump_parameter_placeholder_e].result == f_console_result_found_e) { - fl_print_format("%[%[%s%]%]", main->output.to.stream, main->context.set.notable, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning, main->context.set.notable); + fl_print_format("%[%[%q%]%]", main->output.to.stream, main->context.set.notable, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning, main->context.set.notable); } else { f_print_dynamic(f_string_space_s, main->output.to.stream); @@ -787,10 +787,10 @@ extern "C" { // Print invalid placeholder for invalid UTF-8 widths. if (invalid[i]) { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.error, byte_dump_character_incomplete_s, main->context.set.error); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.error, byte_dump_character_incomplete_s, main->context.set.error); } else { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.warning, byte_dump_character_incomplete_s, main->context.set.warning); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.warning, byte_dump_character_incomplete_s, main->context.set.warning); } } else if (width_utf == 2) { @@ -879,13 +879,13 @@ extern "C" { if (width_utf > 1 && at + 1 < main->width) { if (main->parameters[byte_dump_parameter_placeholder_e].result == f_console_result_found_e) { if (invalid[i]) { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.error, byte_dump_character_placeholder_s, main->context.set.error); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.error, byte_dump_character_placeholder_s, main->context.set.error); } else if (main->parameters[byte_dump_parameter_classic_e].result == f_console_result_found_e) { f_print_dynamic(f_string_ascii_period_s, main->output.to.stream); } else { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); } } else { @@ -901,13 +901,13 @@ extern "C" { if (width_utf > 2 && at + 1 < main->width) { if (main->parameters[byte_dump_parameter_placeholder_e].result == f_console_result_found_e) { if (invalid[i]) { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.error, byte_dump_character_placeholder_s, main->context.set.error); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.error, byte_dump_character_placeholder_s, main->context.set.error); } else if (main->parameters[byte_dump_parameter_classic_e].result == f_console_result_found_e) { f_print_dynamic(f_string_ascii_period_s, main->output.to.stream); } else { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); } } else { @@ -923,13 +923,13 @@ extern "C" { if (width_utf > 3 && at + 1 < main->width) { if (main->parameters[byte_dump_parameter_placeholder_e].result == f_console_result_found_e) { if (invalid[i]) { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.error, byte_dump_character_placeholder_s, main->context.set.error); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.error, byte_dump_character_placeholder_s, main->context.set.error); } else if (main->parameters[byte_dump_parameter_classic_e].result == f_console_result_found_e) { f_print_dynamic(f_string_ascii_period_s, main->output.to.stream); } else { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); } } else { @@ -951,13 +951,13 @@ extern "C" { for (; at < main->width; ++at) { if (invalid[at]) { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.error, byte_dump_character_placeholder_s, main->context.set.error); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.error, byte_dump_character_placeholder_s, main->context.set.error); } else if (main->parameters[byte_dump_parameter_classic_e].result == f_console_result_found_e) { f_print_dynamic(f_string_ascii_period_s, main->output.to.stream); } else { - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.warning, byte_dump_character_placeholder_s, main->context.set.warning); } if (main->options & byte_dump_option_wide_d) { @@ -976,7 +976,7 @@ extern "C" { } // for } - fl_print_format(" %[%s%]%s", main->output.to.stream, main->context.set.notable, byte_dump_character_wall_s, main->context.set.notable, f_string_eol_s); + fl_print_format(" %[%q%]%q", main->output.to.stream, main->context.set.notable, byte_dump_character_wall_s, main->context.set.notable, f_string_eol_s); } #endif // _di_byte_dump_print_text_ diff --git a/level_3/byte_dump/c/private-common.c b/level_3/byte_dump/c/private-common.c index b5de09c..c0c8449 100644 --- a/level_3/byte_dump/c/private-common.c +++ b/level_3/byte_dump/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/byte_dump/data/build/settings b/level_3/byte_dump/data/build/settings index 4c5221f..9c8440d 100644 --- a/level_3/byte_dump/data/build/settings +++ b/level_3/byte_dump/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library byte_dump.c private-common.c private-byte_dump.c +build_sources_library byte_dump.c common.c private-common.c private-byte_dump.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers byte_dump.h +build_sources_headers byte_dump.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/control/c/common.c b/level_3/control/c/common.c new file mode 100644 index 0000000..2f5a1a1 --- /dev/null +++ b/level_3/control/c/common.c @@ -0,0 +1,46 @@ +#include "control.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_control_program_version_ + const f_string_static_t control_program_version_s = macro_f_string_static_t_initialize2(CONTROL_program_version_s, 0, CONTROL_program_version_s_length); +#endif // _di_control_program_version_ + +#ifndef _di_control_program_name_ + const f_string_static_t control_program_name_s = macro_f_string_static_t_initialize2(CONTROL_program_name_s, 0, CONTROL_program_name_s_length); + const f_string_static_t control_program_name_long_s = macro_f_string_static_t_initialize2(CONTROL_program_name_long_s, 0, CONTROL_program_name_long_s_length); +#endif // _di_control_program_name_ + +#ifndef _di_control_defines_ + const f_string_static_t control_short_name_s = macro_f_string_static_t_initialize2(CONTROL_short_name_s, 0, CONTROL_short_name_s_length); + const f_string_static_t control_short_settings_s = macro_f_string_static_t_initialize2(CONTROL_short_settings_s, 0, CONTROL_short_settings_s_length); + const f_string_static_t control_short_socket_s = macro_f_string_static_t_initialize2(CONTROL_short_socket_s, 0, CONTROL_short_socket_s_length); + + const f_string_static_t control_long_name_s = macro_f_string_static_t_initialize2(CONTROL_long_name_s, 0, CONTROL_long_name_s_length); + const f_string_static_t control_long_settings_s = macro_f_string_static_t_initialize2(CONTROL_long_settings_s, 0, CONTROL_long_settings_s_length); + const f_string_static_t control_long_socket_s = macro_f_string_static_t_initialize2(CONTROL_long_socket_s, 0, CONTROL_long_socket_s_length); +#endif // _di_control_defines_ + +#ifndef _di_control_main_delete_ + f_status_t control_main_delete(control_main_t * const main) { + + for (f_array_length_t i = 0; i < control_total_parameters_d; ++i) { + + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); + } // for + + f_type_array_lengths_resize(0, &main->remaining); + + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_control_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/control/c/common.h b/level_3/control/c/common.h new file mode 100644 index 0000000..1c8e8b7 --- /dev/null +++ b/level_3/control/c/common.h @@ -0,0 +1,171 @@ +/** + * FLL - Level 3 + * + * Project: Control + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _control_common_h +#define _control_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_control_program_version_ + #define CONTROL_program_version_major_s F_string_ascii_0_s + #define CONTROL_program_version_minor_s F_string_ascii_5_s + #define CONTROL_program_version_micro_s F_string_ascii_8_s + + #define CONTROL_program_version_major_s_length F_string_ascii_0_s_length + #define CONTROL_program_version_minor_s_length F_string_ascii_5_s_length + #define CONTROL_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(CONTROL_program_version_nano_prefix_s) && defined(CONTROL_program_version_nano_prefix_s_length)) + #define CONTROL_program_version_nano_prefix_s + #define CONTROL_program_version_nano_prefix_s_length 0 + #endif // !(defined(CONTROL_program_version_nano_prefix_s) && defined(CONTROL_program_version_nano_prefix_s_length)) + + #if !(defined(CONTROL_program_version_nano_s) && defined(CONTROL_program_version_nano_s_length)) + #define CONTROL_program_version_nano_s + #define CONTROL_program_version_nano_s_length 0 + #endif // !(defined(CONTROL_program_version_nano_s) && defined(CONTROL_program_version_nano_s_length)) + + #define CONTROL_program_version_s CONTROL_program_version_major_s F_string_ascii_period_s CONTROL_program_version_minor_s F_string_ascii_period_s CONTROL_program_version_micro_s CONTROL_program_version_nano_prefix_s CONTROL_program_version_nano_s + + #define CONTROL_program_version_s_length CONTROL_program_version_major_s_length + F_string_ascii_period_s_length + CONTROL_program_version_minor_s_length + F_string_ascii_period_s_length + CONTROL_program_version_nano_prefix_s_length + CONTROL_program_version_nano_s_length + + extern const f_string_static_t control_program_version_s; +#endif // _di_control_program_version_ + +#ifndef _di_control_program_name_ + #define CONTROL_program_name_s "control" + #define CONTROL_program_name_long_s "Control Program" + + #define CONTROL_program_name_s_length 7 + #define CONTROL_program_name_long_s_length 15 + + extern const f_string_static_t control_program_name_s; + extern const f_string_static_t control_program_name_long_s; +#endif // _di_control_program_name_ + +#ifndef _di_control_defines_ + #define CONTROL_short_name_s "n" + #define CONTROL_short_settings_s "s" + #define CONTROL_short_socket_s "k" + + #define CONTROL_long_name_s "name" + #define CONTROL_long_settings_s "settings" + #define CONTROL_long_socket_s "socket" + + #define CONTROL_short_name_s_length 1 + #define CONTROL_short_settings_s_length 1 + #define CONTROL_short_socket_s_length 1 + + #define CONTROL_long_name_s_length 4 + #define CONTROL_long_settings_s_length 8 + #define CONTROL_long_socket_s_length 6 + + extern const f_string_static_t control_short_name_s; + extern const f_string_static_t control_short_settings_s; + extern const f_string_static_t control_short_socket_s; + + extern const f_string_static_t control_long_name_s; + extern const f_string_static_t control_long_settings_s; + extern const f_string_static_t control_long_socket_s; + + enum { + control_parameter_help_e = 0, + control_parameter_light_e, + control_parameter_dark_e, + control_parameter_no_color_e, + control_parameter_verbosity_quiet_e, + control_parameter_verbosity_normal_e, + control_parameter_verbosity_verbose_e, + control_parameter_verbosity_debug_e, + control_parameter_version_e, + + control_parameter_name_e, + control_parameter_settings_e, + control_parameter_socket_e, + }; + + #define control_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(control_short_name_s.string, control_long_name_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(control_short_settings_s.string, control_long_settings_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(control_short_socket_s.string, control_long_socket_s.string, 0, 1, f_console_type_normal_e), \ + } + + #define control_total_parameters_d 12 +#endif // _di_control_defines_ + +#ifndef _di_control_main_t_ + typedef struct { + f_console_parameter_t parameters[control_total_parameters_d]; + + uint16_t signal_check; + + f_array_lengths_t remaining; + bool process_pipe; + + fl_print_t output; + fl_print_t error; + fl_print_t warning; + + f_signal_t signal; + + f_color_context_t context; + } control_main_t; + + #define control_main_initialize \ + { \ + control_console_parameter_t_initialize, \ + 0, \ + f_array_lengths_t_initialize, \ + F_false, \ + fl_print_t_initialize, \ + macro_fl_print_t_initialize_error(), \ + macro_fl_print_t_initialize_warning(), \ + f_signal_t_initialize, \ + f_color_context_t_initialize, \ + } +#endif // _di_control_main_t_ + +/** + * Deallocate main. + * + * Be sure to call this after executing control_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @see control_main() + */ +#ifndef _di_control_main_delete_ + extern f_status_t control_main_delete(control_main_t * const main); +#endif // _di_control_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _control_common_h diff --git a/level_3/control/c/control.c b/level_3/control/c/control.c index 5885998..0ced776 100644 --- a/level_3/control/c/control.c +++ b/level_3/control/c/control.c @@ -7,52 +7,33 @@ extern "C" { #endif -#ifndef _di_control_program_version_ - const f_string_static_t control_program_version_s = macro_f_string_static_t_initialize2(CONTROL_program_version_s, 0, CONTROL_program_version_s_length); -#endif // _di_control_program_version_ - -#ifndef _di_control_program_name_ - const f_string_static_t control_program_name_s = macro_f_string_static_t_initialize2(CONTROL_program_name_s, 0, CONTROL_program_name_s_length); - const f_string_static_t control_program_name_long_s = macro_f_string_static_t_initialize2(CONTROL_program_name_long_s, 0, CONTROL_program_name_long_s_length); -#endif // _di_control_program_name_ - -#ifndef _di_control_defines_ - const f_string_static_t control_short_name_s = macro_f_string_static_t_initialize2(CONTROL_short_name_s, 0, CONTROL_short_name_s_length); - const f_string_static_t control_short_settings_s = macro_f_string_static_t_initialize2(CONTROL_short_settings_s, 0, CONTROL_short_settings_s_length); - const f_string_static_t control_short_socket_s = macro_f_string_static_t_initialize2(CONTROL_short_socket_s, 0, CONTROL_short_socket_s_length); - - const f_string_static_t control_long_name_s = macro_f_string_static_t_initialize2(CONTROL_long_name_s, 0, CONTROL_long_name_s_length); - const f_string_static_t control_long_settings_s = macro_f_string_static_t_initialize2(CONTROL_long_settings_s, 0, CONTROL_long_settings_s_length); - const f_string_static_t control_long_socket_s = macro_f_string_static_t_initialize2(CONTROL_long_socket_s, 0, CONTROL_long_socket_s_length); -#endif // _di_control_defines_ - #ifndef _di_control_print_help_ f_status_t control_print_help(control_main_t * const main) { flockfile(main->output.to.stream); - fll_program_print_help_header(main->output.to, main->context, control_program_name_long_s.string, control_program_version_s.string); + fll_program_print_help_header(main->output.to, main->context, control_program_name_long_s, control_program_version_s); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not main->output.to in color."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal main->output.to."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not main->output.to in color."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal main->output.to."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, main->output.to.stream); - fll_program_print_help_option(main->output.to, main->context, control_short_name_s.string, control_long_name_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify the name of the controller socket file."); - fll_program_print_help_option(main->output.to, main->context, control_short_settings_s.string, control_long_settings_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Specify a directory path or a full path to the control settings file."); - fll_program_print_help_option(main->output.to, main->context, control_short_socket_s.string, control_long_socket_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a directory path or a full path to the controller socket file."); + fll_program_print_help_option(main->output.to, main->context, control_short_name_s, control_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify the name of the controller socket file."); + fll_program_print_help_option(main->output.to, main->context, control_short_settings_s, control_long_settings_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Specify a directory path or a full path to the control settings file."); + fll_program_print_help_option(main->output.to, main->context, control_short_socket_s, control_long_socket_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a directory path or a full path to the controller socket file."); - fll_program_print_help_usage(main->output.to, main->context, control_program_name_s.string, control_command_s.string); + fll_program_print_help_usage(main->output.to, main->context, control_program_name_s, control_command_s); - fl_print_format(" When the %[%s%q%] parameter represents a directory path then the file name is generated from either the", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s.string, control_long_socket_s, main->context.set.notable); - fl_print_format(" %[%s%q%] parameter or from the control settings file.%q%q", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s.string, control_long_name_s, main->context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When the %[%s%q%] parameter represents a directory path then the file name is generated from either the", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, control_long_socket_s, main->context.set.notable); + fl_print_format(" %[%s%q%] parameter or from the control settings file.%q%q", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, control_long_name_s, main->context.set.notable, f_string_eol_s, f_string_eol_s); fl_print_format(" A rule action allows for either the full rule path, such as '%[boot/root%]'", main->output.to.stream, main->context.set.notable, main->context.set.notable); fl_print_format(" as a single parameter or two parameters with the first representing the rule directory path '%[boot%]'", main->output.to.stream, main->context.set.notable, main->context.set.notable); @@ -159,7 +140,7 @@ extern "C" { } if (main->parameters[control_parameter_version_e].result == f_console_result_found_e) { - fll_program_print_version(main->output.to, control_program_version_s.string); + fll_program_print_version(main->output.to, control_program_version_s); control_main_delete(main); @@ -191,7 +172,7 @@ extern "C" { else if (main->parameters[ids[i]].result == f_console_result_additional_e) { location = main->parameters[ids[i]].values.array[main->parameters[ids[i]].values.used - 1]; - if (!strnlen(arguments->argv[location], f_console_parameter_size)) { + if (!strnlen(arguments->argv[location], F_console_parameter_size_d)) { control_print_error_parameter_value_empty(main, names[i]); status = F_status_set_error(F_parameter); @@ -266,24 +247,6 @@ extern "C" { } #endif // _di_control_main_ -#ifndef _di_control_main_delete_ - f_status_t control_main_delete(control_main_t * const main) { - - for (f_array_length_t i = 0; i < control_total_parameters_d; ++i) { - - f_type_array_lengths_resize(0, &main->parameters[i].locations); - f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); - f_type_array_lengths_resize(0, &main->parameters[i].values); - } // for - - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_control_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/control/c/control.h b/level_3/control/c/control.h index e8854e6..7818e63 100644 --- a/level_3/control/c/control.h +++ b/level_3/control/c/control.h @@ -11,11 +11,12 @@ * This program is used to communicate with the "controller" program that exists as a system init (an alternative to sysvinit, initng, etc..). */ #ifndef _control_h +#define _control_h -// libc includes. +// Libc includes. #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -31,153 +32,25 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include #include +// Control includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_control_program_version_ - #define CONTROL_program_version_major_s F_string_ascii_0_s - #define CONTROL_program_version_minor_s F_string_ascii_5_s - #define CONTROL_program_version_micro_s F_string_ascii_8_s - - #define CONTROL_program_version_major_s_length 1 - #define CONTROL_program_version_minor_s_length 1 - #define CONTROL_program_version_micro_s_length 1 - - #ifndef CONTROL_program_version_nano_prefix_s - #define CONTROL_program_version_nano_prefix_s - - #define CONTROL_program_version_nano_prefix_s_length 0 - #endif - - #ifndef CONTROL_program_version_nano_s - #define CONTROL_program_version_nano_s - - #define CONTROL_program_version_nano_s_length 0 - #endif - - #define CONTROL_program_version_s CONTROL_program_version_major_s F_string_ascii_period_s CONTROL_program_version_minor_s F_string_ascii_period_s CONTROL_program_version_micro_s CONTROL_program_version_nano_prefix_s CONTROL_program_version_nano_s - - #define CONTROL_program_version_s_length CONTROL_program_version_major_s_length + F_string_ascii_period_s_length + CONTROL_program_version_minor_s_length + F_string_ascii_period_s_length + CONTROL_program_version_nano_prefix_s_length + CONTROL_program_version_nano_s_length - - extern const f_string_static_t control_program_version_s; -#endif // _di_control_program_version_ - -#ifndef _di_control_program_name_ - #define CONTROL_program_name_s "control" - #define CONTROL_program_name_long_s "Control Program" - - #define CONTROL_program_name_s_length 7 - #define CONTROL_program_name_long_s_length 15 - - extern const f_string_static_t control_program_name_s; - extern const f_string_static_t control_program_name_long_s; -#endif // _di_control_program_name_ - -#ifndef _di_control_defines_ - #define CONTROL_short_name_s "n" - #define CONTROL_short_settings_s "s" - #define CONTROL_short_socket_s "k" - - #define CONTROL_long_name_s "name" - #define CONTROL_long_settings_s "settings" - #define CONTROL_long_socket_s "socket" - - #define CONTROL_short_name_s_length 1 - #define CONTROL_short_settings_s_length 1 - #define CONTROL_short_socket_s_length 1 - - #define CONTROL_long_name_s_length 4 - #define CONTROL_long_settings_s_length 8 - #define CONTROL_long_socket_s_length 6 - - extern const f_string_static_t control_short_name_s; - extern const f_string_static_t control_short_settings_s; - extern const f_string_static_t control_short_socket_s; - - extern const f_string_static_t control_long_name_s; - extern const f_string_static_t control_long_settings_s; - extern const f_string_static_t control_long_socket_s; - - enum { - control_parameter_help_e = 0, - control_parameter_light_e, - control_parameter_dark_e, - control_parameter_no_color_e, - control_parameter_verbosity_quiet_e, - control_parameter_verbosity_normal_e, - control_parameter_verbosity_verbose_e, - control_parameter_verbosity_debug_e, - control_parameter_version_e, - - control_parameter_name_e, - control_parameter_settings_e, - control_parameter_socket_e, - }; - - #define control_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(control_short_name_s.string, control_long_name_s.string, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(control_short_settings_s.string, control_long_settings_s.string, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(control_short_socket_s.string, control_long_socket_s.string, 0, 1, f_console_type_normal_e), \ - } - - #define control_total_parameters_d 12 -#endif // _di_control_defines_ - -#ifndef _di_control_main_t_ - typedef struct { - f_console_parameter_t parameters[control_total_parameters_d]; - - uint16_t signal_check; - - f_array_lengths_t remaining; - bool process_pipe; - - fl_print_t output; - fl_print_t error; - fl_print_t warning; - - f_signal_t signal; - - f_color_context_t context; - } control_main_t; - - #define control_main_initialize \ - { \ - control_console_parameter_t_initialize, \ - 0, \ - f_array_lengths_t_initialize, \ - F_false, \ - fl_print_t_initialize, \ - macro_fl_print_t_initialize_error(), \ - macro_fl_print_t_initialize_warning(), \ - f_signal_t_initialize, \ - f_color_context_t_initialize, \ - } -#endif // _di_control_main_t_ - /** * Print help. * @@ -186,6 +59,8 @@ extern "C" { * * @return * F_none on success. + * + * @see control_main() */ #ifndef _di_control_print_help_ extern f_status_t control_print_help(control_main_t * const main); @@ -222,25 +97,6 @@ extern "C" { extern f_status_t control_main(control_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_control_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing control_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see control_main() - */ -#ifndef _di_control_main_delete_ - extern f_status_t control_main_delete(control_main_t * const main); -#endif // _di_control_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/control/c/main.c b/level_3/control/c/main.c index 18da0ea..1375ecc 100644 --- a/level_3/control/c/main.c +++ b/level_3/control/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = control_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/control/c/private-common.c b/level_3/control/c/private-common.c index 70ab9c6..48e8f81 100644 --- a/level_3/control/c/private-common.c +++ b/level_3/control/c/private-common.c @@ -23,19 +23,19 @@ extern "C" { const f_string_static_t control_path_socket_prefix_s = macro_f_string_static_t_initialize2(CONTROL_path_socket_prefix_s, 0, CONTROL_path_socket_prefix_s_length); const f_string_static_t control_path_socket_suffix_s = macro_f_string_static_t_initialize2(CONTROL_path_socket_suffix_s, 0, CONTROL_path_socket_suffix_s_length); - const f_string_static_t control_error_s_length = macro_f_string_static_t_initialize2(CONTROL_error_s, 0, CONTROL_error_s_length); - const f_string_static_t control_freeze_s_length = macro_f_string_static_t_initialize2(CONTROL_freeze_s, 0, CONTROL_freeze_s_length); - const f_string_static_t control_kill_s_length = macro_f_string_static_t_initialize2(CONTROL_kill_s, 0, CONTROL_kill_s_length); - const f_string_static_t control_pause_s_length = macro_f_string_static_t_initialize2(CONTROL_pause_s, 0, CONTROL_pause_s_length); - const f_string_static_t control_reboot_s_length = macro_f_string_static_t_initialize2(CONTROL_reboot_s, 0, CONTROL_reboot_s_length); - const f_string_static_t control_reload_s_length = macro_f_string_static_t_initialize2(CONTROL_reload_s, 0, CONTROL_reload_s_length); - const f_string_static_t control_rerun_s_length = macro_f_string_static_t_initialize2(CONTROL_rerun_s, 0, CONTROL_rerun_s_length); - const f_string_static_t control_restart_s_length = macro_f_string_static_t_initialize2(CONTROL_restart_s, 0, CONTROL_restart_s_length); - const f_string_static_t control_resume_s_length = macro_f_string_static_t_initialize2(CONTROL_resume_s, 0, CONTROL_resume_s_length); - const f_string_static_t control_shutdown_s_length = macro_f_string_static_t_initialize2(CONTROL_shutdown_s, 0, CONTROL_shutdown_s_length); - const f_string_static_t control_start_s_length = macro_f_string_static_t_initialize2(CONTROL_start_s, 0, CONTROL_start_s_length); - const f_string_static_t control_stop_s_length = macro_f_string_static_t_initialize2(CONTROL_stop_s, 0, CONTROL_stop_s_length); - const f_string_static_t control_thaw_s_length = macro_f_string_static_t_initialize2(CONTROL_thaw_s, 0, CONTROL_thaw_s_length); + const f_string_static_t control_error_s = macro_f_string_static_t_initialize2(CONTROL_error_s, 0, CONTROL_error_s_length); + const f_string_static_t control_freeze_s = macro_f_string_static_t_initialize2(CONTROL_freeze_s, 0, CONTROL_freeze_s_length); + const f_string_static_t control_kill_s = macro_f_string_static_t_initialize2(CONTROL_kill_s, 0, CONTROL_kill_s_length); + const f_string_static_t control_pause_s = macro_f_string_static_t_initialize2(CONTROL_pause_s, 0, CONTROL_pause_s_length); + const f_string_static_t control_reboot_s = macro_f_string_static_t_initialize2(CONTROL_reboot_s, 0, CONTROL_reboot_s_length); + const f_string_static_t control_reload_s = macro_f_string_static_t_initialize2(CONTROL_reload_s, 0, CONTROL_reload_s_length); + const f_string_static_t control_rerun_s = macro_f_string_static_t_initialize2(CONTROL_rerun_s, 0, CONTROL_rerun_s_length); + const f_string_static_t control_restart_s = macro_f_string_static_t_initialize2(CONTROL_restart_s, 0, CONTROL_restart_s_length); + const f_string_static_t control_resume_s = macro_f_string_static_t_initialize2(CONTROL_resume_s, 0, CONTROL_resume_s_length); + const f_string_static_t control_shutdown_s = macro_f_string_static_t_initialize2(CONTROL_shutdown_s, 0, CONTROL_shutdown_s_length); + const f_string_static_t control_start_s = macro_f_string_static_t_initialize2(CONTROL_start_s, 0, CONTROL_start_s_length); + const f_string_static_t control_stop_s = macro_f_string_static_t_initialize2(CONTROL_stop_s, 0, CONTROL_stop_s_length); + const f_string_static_t control_thaw_s = macro_f_string_static_t_initialize2(CONTROL_thaw_s, 0, CONTROL_thaw_s_length); #endif // _di_control_strings_s_ #ifndef _di_control_data_delete_ diff --git a/level_3/control/c/private-common.h b/level_3/control/c/private-common.h index 197cbe8..52dc250 100644 --- a/level_3/control/c/private-common.h +++ b/level_3/control/c/private-common.h @@ -166,19 +166,19 @@ extern "C" { extern const f_string_static_t control_path_socket_prefix_s; extern const f_string_static_t control_path_socket_suffix_s; - extern const f_string_static_t control_error_s_length; - extern const f_string_static_t control_freeze_s_length; - extern const f_string_static_t control_kill_s_length; - extern const f_string_static_t control_pause_s_length; - extern const f_string_static_t control_reboot_s_length; - extern const f_string_static_t control_reload_s_length; - extern const f_string_static_t control_rerun_s_length; - extern const f_string_static_t control_restart_s_length; - extern const f_string_static_t control_resume_s_length; - extern const f_string_static_t control_shutdown_s_length; - extern const f_string_static_t control_start_s_length; - extern const f_string_static_t control_stop_s_length; - extern const f_string_static_t control_thaw_s_length; + extern const f_string_static_t control_error_s; + extern const f_string_static_t control_freeze_s; + extern const f_string_static_t control_kill_s; + extern const f_string_static_t control_pause_s; + extern const f_string_static_t control_reboot_s; + extern const f_string_static_t control_reload_s; + extern const f_string_static_t control_rerun_s; + extern const f_string_static_t control_restart_s; + extern const f_string_static_t control_resume_s; + extern const f_string_static_t control_shutdown_s; + extern const f_string_static_t control_start_s; + extern const f_string_static_t control_stop_s; + extern const f_string_static_t control_thaw_s; #endif // _di_control_strings_s_ /** diff --git a/level_3/control/c/private-control.c b/level_3/control/c/private-control.c index 084b1af..762479d 100644 --- a/level_3/control/c/private-control.c +++ b/level_3/control/c/private-control.c @@ -10,75 +10,76 @@ extern "C" { #ifndef _di_control_command_identify_ f_status_t control_command_identify(control_main_t * const main, control_data_t * const data, const f_string_t command) { - const f_array_length_t length = strnlen(command, f_console_parameter_size); + const f_string_static_t command_string = macro_f_string_static_t_initialize2(command, 0, strnlen(command, F_console_parameter_size_d)); - if (fl_string_dynamic_compare_string(command, control_freeze_s_length, length) == F_equal_to) { + + if (fl_string_dynamic_compare(command_string, control_freeze_s) == F_equal_to) { data->command = control_command_type_freeze_e; return F_found; } - if (fl_string_dynamic_compare_string(command, control_kill_s_length, length) == F_equal_to) { + if (fl_string_dynamic_compare(command_string, control_kill_s) == F_equal_to) { data->command = control_command_type_kill_e; return F_found; } - if (fl_string_dynamic_compare_string(command, control_pause_s_length, length) == F_equal_to) { + if (fl_string_dynamic_compare(command_string, control_pause_s) == F_equal_to) { data->command = control_command_type_pause_e; return F_found; } - if (fl_string_dynamic_compare_string(command, control_reboot_s_length, length) == F_equal_to) { + if (fl_string_dynamic_compare(command_string, control_reboot_s) == F_equal_to) { data->command = control_command_type_reboot_e; return F_found; } - if (fl_string_dynamic_compare_string(command, control_reload_s_length, length) == F_equal_to) { + if (fl_string_dynamic_compare(command_string, control_reload_s) == F_equal_to) { data->command = control_command_type_reload_e; return F_found; } - if (fl_string_dynamic_compare_string(command, control_rerun_s_length, length) == F_equal_to) { + if (fl_string_dynamic_compare(command_string, control_rerun_s) == F_equal_to) { data->command = control_command_type_rerun_e; return F_found; } - if (fl_string_dynamic_compare_string(command, control_restart_s_length, length) == F_equal_to) { + if (fl_string_dynamic_compare(command_string, control_restart_s) == F_equal_to) { data->command = control_command_type_restart_e; return F_found; } - if (fl_string_dynamic_compare_string(command, control_resume_s_length, length) == F_equal_to) { + if (fl_string_dynamic_compare(command_string, control_resume_s) == F_equal_to) { data->command = control_command_type_resume_e; return F_found; } - if (fl_string_dynamic_compare_string(command, control_shutdown_s_length, length) == F_equal_to) { + if (fl_string_dynamic_compare(command_string, control_shutdown_s) == F_equal_to) { data->command = control_command_type_shutdown_e; return F_found; } - if (fl_string_dynamic_compare_string(command, control_start_s_length, length) == F_equal_to) { + if (fl_string_dynamic_compare(command_string, control_start_s) == F_equal_to) { data->command = control_command_type_start_e; return F_found; } - if (fl_string_dynamic_compare_string(command, control_stop_s_length, length) == F_equal_to) { + if (fl_string_dynamic_compare(command_string, control_stop_s) == F_equal_to) { data->command = control_command_type_stop_e; return F_found; } - if (fl_string_dynamic_compare_string(command, control_thaw_s_length, length) == F_equal_to) { + if (fl_string_dynamic_compare(command_string, control_thaw_s) == F_equal_to) { data->command = control_command_type_thaw_e; return F_found; @@ -113,7 +114,7 @@ extern "C" { return F_status_set_error(F_parameter); } - if (!strnlen(arguments->argv[main->remaining.array[1]], f_console_parameter_size)) { + if (!strnlen(arguments->argv[main->remaining.array[1]], F_console_parameter_size_d)) { if (main->remaining.used == 2) { control_print_error_parameter_command_rule_empty(main, arguments->argv[0]); } @@ -125,7 +126,7 @@ extern "C" { } if (main->remaining.used == 3) { - if (!strnlen(arguments->argv[main->remaining.array[2]], f_console_parameter_size)) { + if (!strnlen(arguments->argv[main->remaining.array[2]], F_console_parameter_size_d)) { control_print_error_parameter_command_rule_basename_empty(main, arguments->argv[0]); return F_status_set_error(F_parameter); @@ -157,7 +158,7 @@ extern "C" { if (main->parameters[control_parameter_socket_e].result == f_console_result_additional_e) { const f_array_length_t location = main->parameters[control_parameter_settings_e].values.array[main->parameters[control_parameter_settings_e].values.used - 1]; - status = f_string_append(arguments->argv[location], strnlen(arguments->argv[location], f_console_parameter_size), &data->cache.buffer_small); + status = f_string_append(arguments->argv[location], strnlen(arguments->argv[location], F_console_parameter_size_d), &data->cache.buffer_small); } else { status = f_string_dynamic_append_nulless(control_path_settings_s, &data->cache.buffer_small); @@ -177,7 +178,7 @@ extern "C" { { f_file_t file = f_file_t_initialize; - status = f_file_stream_open(data->cache.buffer_small.string, f_file_open_mode_read_s, &file); + status = f_file_stream_open(data->cache.buffer_small.string, f_file_open_mode_read_s.string, &file); if (F_status_is_error(status)) { fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, data->cache.buffer_small.string, "open", fll_error_file_type_file_e); @@ -253,7 +254,7 @@ extern "C" { if (main->parameters[control_parameter_socket_e].result == f_console_result_additional_e) { const f_array_length_t location = main->parameters[control_parameter_socket_e].values.array[main->parameters[control_parameter_socket_e].values.used - 1]; - status = f_string_append(arguments->argv[location], strnlen(arguments->argv[location], f_console_parameter_size), &data->cache.buffer_small); + status = f_string_append(arguments->argv[location], strnlen(arguments->argv[location], F_console_parameter_size_d), &data->cache.buffer_small); } else if (parameter_hass[1]) { status = f_string_dynamic_partial_append_nulless(data->cache.buffer_large, objects.array[parameter_ats[1]], &data->cache.buffer_small); @@ -328,7 +329,7 @@ extern "C" { if (append_ids[i] && main->parameters[append_ids[i]].result == f_console_result_additional_e) { const f_array_length_t location = main->parameters[append_ids[i]].values.array[main->parameters[append_ids[i]].values.used - 1]; - status = f_string_append(arguments->argv[location], strnlen(arguments->argv[location], f_console_parameter_size), &data->cache.buffer_small); + status = f_string_append(arguments->argv[location], strnlen(arguments->argv[location], F_console_parameter_size_d), &data->cache.buffer_small); } else if (append_hass[i]) { status = f_string_dynamic_partial_append_nulless(data->cache.buffer_large, objects.array[append_hass[i]], &data->cache.buffer_small); @@ -436,9 +437,7 @@ extern "C" { } } - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_none; } diff --git a/level_3/control/c/private-print.c b/level_3/control/c/private-print.c index 6f6b638..9ce56a1 100644 --- a/level_3/control/c/private-print.c +++ b/level_3/control/c/private-print.c @@ -13,7 +13,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%[%SThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%S%]", main->error.to.stream, main->context.set.notable, command, main->context.set.notable); fl_print_format("%[' is not a known controller command.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -28,7 +28,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%[%SThe command parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%QThe command parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%S%]", main->error.to.stream, main->context.set.notable, command, main->context.set.notable); fl_print_format("%[' a rule base name cannot be an empty string.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -43,7 +43,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%[%SThe command parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%QThe command parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%S%]", main->error.to.stream, main->context.set.notable, command, main->context.set.notable); fl_print_format("%[' a rule directory path cannot be an empty string.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -58,7 +58,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%[%SThe command parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%QThe command parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%S%]", main->error.to.stream, main->context.set.notable, command, main->context.set.notable); fl_print_format("%[' a rule name cannot be an empty string.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -73,7 +73,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%[%SThe command parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%QThe command parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%S%]", main->error.to.stream, main->context.set.notable, command, main->context.set.notable); fl_print_format("%[' requires either a full rule name or a rule directory path along with the rule base name.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -88,7 +88,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%[%SThe command parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%QThe command parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%S%]", main->error.to.stream, main->context.set.notable, command, main->context.set.notable); fl_print_format("%[' has too many arguments.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -101,7 +101,7 @@ extern "C" { if (main->error.verbosity == f_console_verbosity_quiet_e) return; - fll_print_format("%[%SNo commands are provided.%]%q", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error, f_string_eol_s); + fll_print_format("%[%QNo commands are provided.%]%q", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error, f_string_eol_s); } #endif // _di_control_print_error_commands_none_ @@ -112,7 +112,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%[%SThe value for the parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%QThe value for the parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, parameter, main->context.set.notable); fl_print_format("%[' must not be an empty string.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -127,7 +127,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%[%SThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, parameter, main->context.set.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -140,7 +140,7 @@ extern "C" { if (main->error.verbosity == f_console_verbosity_quiet_e) return; - fll_print_format("%[%SPipe input is not supported by this program.%]%q", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error, f_string_eol_s); + fll_print_format("%[%QPipe input is not supported by this program.%]%q", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error, f_string_eol_s); } #endif // _di_control_print_error_pipe_supported_not_ @@ -151,7 +151,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%[%SFailed to connect to the socket file '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%QFailed to connect to the socket file '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, path_socket, main->context.set.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -166,7 +166,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%[%SThe controller socket file '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%QThe controller socket file '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, path_socket, main->context.set.notable); fl_print_format("%[' could not be found and is required.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -181,7 +181,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%[%SThe controller socket file '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); + fl_print_format("%[%QThe controller socket file '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, path_socket, main->context.set.notable); fl_print_format("%[' is not a socket file.%]%q", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -199,7 +199,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/control/data/build/settings b/level_3/control/data/build/settings index b0a31c6..d763bdd 100644 --- a/level_3/control/data/build/settings +++ b/level_3/control/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library control.c private-common.c private-control.c private-print.c +build_sources_library control.c common.c private-common.c private-control.c private-print.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers control.h +build_sources_headers control.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/controller/c/common.c b/level_3/controller/c/common.c new file mode 100644 index 0000000..9aba2e9 --- /dev/null +++ b/level_3/controller/c/common.c @@ -0,0 +1,74 @@ +#include "controller.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_controller_program_version_ + const f_string_static_t controller_program_version_s = macro_f_string_static_t_initialize2(CONTROLLER_program_version_s, 0, CONTROLLER_program_version_s_length); +#endif // _di_controller_program_version_ + +#ifndef _di_controller_program_name_ + const f_string_static_t controller_program_name_s = macro_f_string_static_t_initialize2(CONTROLLER_program_name_s, 0, CONTROLLER_program_name_s_length); + const f_string_static_t controller_program_name_long_s = macro_f_string_static_t_initialize2(CONTROLLER_program_name_long_s, 0, CONTROLLER_program_name_long_s_length); + + const f_string_static_t controller_program_name_init_s = macro_f_string_static_t_initialize2(CONTROLLER_program_name_init_s, 0, CONTROLLER_program_name_init_s_length); + const f_string_static_t controller_program_name_init_long_s = macro_f_string_static_t_initialize2(CONTROLLER_program_name_init_long_s, 0, CONTROLLER_program_name_init_long_s_length); +#endif // _di_controller_program_name_ + +#ifndef _di_controller_defines_ + const f_string_static_t controller_default_program_script_s = macro_f_string_static_t_initialize2(CONTROLLER_default_program_script_s, 0, CONTROLLER_default_program_script_s_length); + const f_string_static_t controller_path_pid_s = macro_f_string_static_t_initialize2(CONTROLLER_path_pid_s, 0, CONTROLLER_path_pid_s_length); + const f_string_static_t controller_path_pid_init_s = macro_f_string_static_t_initialize2(CONTROLLER_path_pid_init_s, 0, CONTROLLER_path_pid_init_s_length); + const f_string_static_t controller_path_pid_prefix_s = macro_f_string_static_t_initialize2(CONTROLLER_path_pid_prefix_s, 0, CONTROLLER_path_pid_prefix_s_length); + const f_string_static_t controller_path_pid_suffix_s = macro_f_string_static_t_initialize2(CONTROLLER_path_pid_suffix_s, 0, CONTROLLER_path_pid_suffix_s_length); + const f_string_static_t controller_path_settings_s = macro_f_string_static_t_initialize2(CONTROLLER_path_settings_s, 0, CONTROLLER_path_settings_s_length); + const f_string_static_t controller_path_settings_init_s = macro_f_string_static_t_initialize2(CONTROLLER_path_settings_init_s, 0, CONTROLLER_path_settings_init_s_length); + const f_string_static_t controller_path_socket_s = macro_f_string_static_t_initialize2(CONTROLLER_path_socket_s, 0, CONTROLLER_path_socket_s_length); + const f_string_static_t controller_path_socket_init_s = macro_f_string_static_t_initialize2(CONTROLLER_path_socket_init_s, 0, CONTROLLER_path_socket_s_length); + const f_string_static_t controller_path_socket_prefix_s = macro_f_string_static_t_initialize2(CONTROLLER_path_socket_prefix_s, 0, CONTROLLER_path_socket_prefix_s_length); + const f_string_static_t controller_path_socket_suffix_s = macro_f_string_static_t_initialize2(CONTROLLER_path_socket_suffix_s, 0, CONTROLLER_path_socket_suffix_s_length); + + const f_string_static_t controller_short_cgroup_s = macro_f_string_static_t_initialize2(CONTROLLER_short_cgroup_s, 0, CONTROLLER_short_cgroup_s_length); + const f_string_static_t controller_short_daemon_s = macro_f_string_static_t_initialize2(CONTROLLER_short_daemon_s, 0, CONTROLLER_short_daemon_s_length); + const f_string_static_t controller_short_init_s = macro_f_string_static_t_initialize2(CONTROLLER_short_init_s, 0, CONTROLLER_short_init_s_length); + const f_string_static_t controller_short_interruptible_s = macro_f_string_static_t_initialize2(CONTROLLER_short_interruptible_s, 0, CONTROLLER_short_interruptible_s_length); + const f_string_static_t controller_short_pid_s = macro_f_string_static_t_initialize2(CONTROLLER_short_pid_s, 0, CONTROLLER_short_pid_s_length); + const f_string_static_t controller_short_settings_s = macro_f_string_static_t_initialize2(CONTROLLER_short_settings_s, 0, CONTROLLER_short_settings_s_length); + const f_string_static_t controller_short_simulate_s = macro_f_string_static_t_initialize2(CONTROLLER_short_simulate_s, 0, CONTROLLER_short_simulate_s_length); + const f_string_static_t controller_short_socket_s = macro_f_string_static_t_initialize2(CONTROLLER_short_socket_s, 0, CONTROLLER_short_socket_s_length); + const f_string_static_t controller_short_uninterruptible_s = macro_f_string_static_t_initialize2(CONTROLLER_short_uninterruptible_s, 0, CONTROLLER_short_uninterruptible_s_length); + const f_string_static_t controller_short_validate_s = macro_f_string_static_t_initialize2(CONTROLLER_short_validate_s, 0, CONTROLLER_short_validate_s_length); + + const f_string_static_t controller_long_cgroup_s = macro_f_string_static_t_initialize2(CONTROLLER_long_cgroup_s, 0, CONTROLLER_long_cgroup_s_length); + const f_string_static_t controller_long_daemon_s = macro_f_string_static_t_initialize2(CONTROLLER_long_daemon_s, 0, CONTROLLER_long_daemon_s_length); + const f_string_static_t controller_long_init_s = macro_f_string_static_t_initialize2(CONTROLLER_long_init_s, 0, CONTROLLER_long_init_s_length); + const f_string_static_t controller_long_interruptible_s = macro_f_string_static_t_initialize2(CONTROLLER_long_interruptible_s, 0, CONTROLLER_long_interruptible_s_length); + const f_string_static_t controller_long_pid_s = macro_f_string_static_t_initialize2(CONTROLLER_long_pid_s, 0, CONTROLLER_long_pid_s_length); + const f_string_static_t controller_long_settings_s = macro_f_string_static_t_initialize2(CONTROLLER_long_settings_s, 0, CONTROLLER_long_settings_s_length); + const f_string_static_t controller_long_simulate_s = macro_f_string_static_t_initialize2(CONTROLLER_long_simulate_s, 0, CONTROLLER_long_simulate_s_length); + const f_string_static_t controller_long_socket_s = macro_f_string_static_t_initialize2(CONTROLLER_long_socket_s, 0, CONTROLLER_long_socket_s_length); + const f_string_static_t controller_long_uninterruptible_s = macro_f_string_static_t_initialize2(CONTROLLER_long_uninterruptible_s, 0, CONTROLLER_long_uninterruptible_s_length); + const f_string_static_t controller_long_validate_s = macro_f_string_static_t_initialize2(CONTROLLER_long_validate_s, 0, CONTROLLER_long_validate_s_length); +#endif // _di_controller_defines_ + +#ifndef _di_controller_main_delete_ + f_status_t controller_main_delete(controller_main_t * const main) { + + for (f_array_length_t i = 0; i < controller_total_parameters_d; ++i) { + + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); + } // for + + f_type_array_lengths_resize(0, &main->remaining); + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_controller_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/controller/c/controller/controller.h b/level_3/controller/c/common.h similarity index 81% rename from level_3/controller/c/controller/controller.h rename to level_3/controller/c/common.h index 2666ea4..58c53b4 100644 --- a/level_3/controller/c/controller/controller.h +++ b/level_3/controller/c/common.h @@ -5,82 +5,12 @@ * API Version: 0.5 * Licenses: lgpl-2.1-or-later * - * This is the Controller program. + * Provides the common data structures. * - * This program utilizes the Featureless Linux Library. - * This program provides system service management, much like sysvcontroller and controllerng. - * This program can be controlled from user-space via the "control" program. - * This program can be used in an initrd and should be capable of pivot root operations. - * - * @todo Implement "exit" files that are the opposite of "entry" files whereas rules specified within are all called via the "stop" action type. - * This would then allow for switching modes. - * The "exit" would be specified in the "entry", by name and would be found under "exits" directory alongside the "entries" directory. - * - * @todo check the return status of unlocks. - * - * @todo the read/write locks (and unlocks) needs to be more robust in that they need to attempt to keep going even on failure or need to wait until resolvable. - * this is done to help ensure that the controller program always continues onward. - * - * @todo just like with the read/write locks, the out of memory cases need to be handled to keep going instead of bailing. - * likely these will need to be sleeps on the premise that eventually memory will clear itself up. + * This is auto-included and should not need to be explicitly included. */ -#ifndef _controller_h - -// include pre-requirements -#define _GNU_SOURCE - -// libc includes -#include -#include -#include -#include -#include -#include -#include - -// fll-0 includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// fll-1 includes -#include -#include -#include -#include -#include -#include - -// fll-2 includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#ifndef _controller_common_h +#define _controller_common_h #ifdef __cplusplus extern "C" { @@ -91,25 +21,23 @@ extern "C" { #define CONTROLLER_program_version_minor_s F_string_ascii_5_s #define CONTROLLER_program_version_micro_s F_string_ascii_8_s - #define CONTROLLER_program_version_major_s_length 1 - #define CONTROLLER_program_version_minor_s_length 1 - #define CONTROLLER_program_version_micro_s_length 1 + #define CONTROLLER_program_version_major_s_length F_string_ascii_0_s_length + #define CONTROLLER_program_version_minor_s_length F_string_ascii_5_s_length + #define CONTROLLER_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef CONTROLLER_program_version_nano_prefix_s + #if !(defined(CONTROLLER_program_version_nano_prefix_s) && defined(CONTROLLER_program_version_nano_prefix_s_length)) #define CONTROLLER_program_version_nano_prefix_s - #define CONTROLLER_program_version_nano_prefix_s_length 0 - #endif + #endif // !(defined(CONTROLLER_program_version_nano_prefix_s) && defined(CONTROLLER_program_version_nano_prefix_s_length)) - #ifndef CONTROLLER_program_version_nano_s + #if !(defined(CONTROLLER_program_version_nano_s) && defined(CONTROLLER_program_version_nano_s_length)) #define CONTROLLER_program_version_nano_s - #define CONTROLLER_program_version_nano_s_length 0 - #endif + #endif // !(defined(CONTROLLER_program_version_nano_s) && defined(CONTROLLER_program_version_nano_s_length)) #define CONTROLLER_program_version_s CONTROLLER_program_version_major_s F_string_ascii_period_s CONTROLLER_program_version_minor_s F_string_ascii_period_s CONTROLLER_program_version_micro_s CONTROLLER_program_version_nano_prefix_s CONTROLLER_program_version_nano_s - #define CONTROLLER_program_version_s_length CONTROLLER_program_version_major_s_length + F_string_ascii_period_s_length + CONTROLLER_program_version_minor_s_length + F_string_ascii_period_s_length + CONTROLLER_program_version_nano_prefix_s_length + CONTROLLER_program_version_nano_s_length + #define CONTROLLER_program_version_s_length CONTROLLER_program_version_major_s_length + F_string_ascii_period_s_length + CONTROLLER_program_version_minor_s_length + F_string_ascii_period_s_length + CONTROLLER_program_version_micro_s_length + CONTROLLER_program_version_nano_prefix_s_length + CONTROLLER_program_version_nano_s_length extern const f_string_static_t controller_program_version_s; #endif // _di_controller_program_version_ @@ -121,8 +49,8 @@ extern "C" { #define CONTROLLER_program_name_init_s "init" #define CONTROLLER_program_name_init_long_s "Init Program" - #define CONTROLLER_program_name_s_length 7 - #define CONTROLLER_program_name_long_s_length 15 + #define CONTROLLER_program_name_s_length 10 + #define CONTROLLER_program_name_long_s_length 18 #define CONTROLLER_program_name_init_s_length 4 #define CONTROLLER_program_name_init_long_s_length 12 @@ -164,22 +92,18 @@ extern "C" { #define CONTROLLER_path_pid_prefix_s_length _override_controller_path_pid_prefix_length_ #elif defined(_controller_as_init_) #define CONTROLLER_path_pid_prefix_s "init-" - #define CONTROLLER_path_pid_prefix_s_length 5 #else #define CONTROLLER_path_pid_prefix_s "" - #define CONTROLLER_path_pid_prefix_s_length 0 #endif // defined(_override_controller_name_pid_prefix_) && defined(_override_controller_name_pid_prefix_length_) // The socket suffix path is a system-specific path part and needs to be more easily contolled at compile time. #if defined(_override_controller_path_pid_suffix_) && defined(_override_controller_path_pid_suffix_length_) #define CONTROLLER_path_pid_suffix_s _override_controller_path_pid_suffix_ - #define CONTROLLER_path_pid_suffix_s_length _override_controller_path_pid_suffix_length_ #else #define CONTROLLER_path_pid_suffix_s ".pid" - #define CONTROLLER_path_pid_suffix_s_length 4 #endif // defined(_override_controller_name_pid_suffix_) && defined(_override_controller_name_pid_suffix_length_) @@ -207,11 +131,9 @@ extern "C" { // The socket path is a system-specific path and needs to be more easily contolled at compile time. #if defined(_override_controller_path_socket_) && defined(_override_controller_path_socket_length_) #define CONTROLLER_path_socket_s _override_controller_path_socket_ - #define CONTROLLER_path_socket_s_length _override_controller_path_socket_length_ #else #define CONTROLLER_path_socket_s "controller/run" - #define CONTROLLER_path_socket_s_length 14 #endif // defined(_override_controller_path_socket_) && defined(_override_controller_path_socket_length_) @@ -222,11 +144,9 @@ extern "C" { #define CONTROLLER_path_socket_init_s_length _override_controller_path_socket_init_length_ #elif defined(_controller_as_init_) #define CONTROLLER_path_socket_init_s "/var/run/init" - #define CONTROLLER_path_socket_init_s_length 13 #else #define CONTROLLER_path_socket_init_s "/var/run/controller" - #define CONTROLLER_path_socket_init_s_length 19 #endif // defined(_override_controller_path_socket_init_) && defined(_override_controller_path_socket_init_length_) @@ -237,32 +157,26 @@ extern "C" { #define CONTROLLER_path_socket_prefix_s_length _override_controller_path_socket_prefix_length_ #elif defined(_controller_as_init_) #define CONTROLLER_path_socket_prefix_s "init-" - #define CONTROLLER_path_socket_prefix_s_length 5 #else #define CONTROLLER_path_socket_prefix_s "" - #define CONTROLLER_path_socket_prefix_s_length 0 #endif // defined(_override_controller_path_socket_prefix_) && defined(_override_controller_path_socket_prefix_length_) // The socket suffix path is a system-specific path part and needs to be more easily contolled at compile time. #if defined(_override_controller_path_socket_suffix_) && defined(_override_controller_path_socket_suffix_length_) #define CONTROLLER_path_socket_suffix_s _override_controller_path_socket_suffix_ - #define CONTROLLER_path_socket_suffix_s_length _override_controller_path_socket_suffix_length_ #else #define CONTROLLER_path_socket_suffix_s ".socket" - #define CONTROLLER_path_socket_suffix_s_length 7 #endif // defined(_override_controller_path_socket_suffix_) && defined(_override_controller_path_socket_suffix_length_) #if defined(_override_controller_default_program_script_) && defined(_override_controller_default_program_script_length_) #define CONTROLLER_default_program_script_s _override_controller_default_program_script_ - #define CONTROLLER_default_program_script_s_length _override_controller_default_program_script_length_ #else #define CONTROLLER_default_program_script_s "bash" - #define CONTROLLER_default_program_script_s_length 4 #endif // defined(_override_controller_default_program_script_) && defined(_override_controller_default_program_script_length_) @@ -443,51 +357,6 @@ extern "C" { #endif // _di_controller_main_t_ /** - * Print help. - * - * @param main - * The main program data. - * - * @return - * F_none on success. - */ -#ifndef _di_controller_print_help_ - extern f_status_t controller_print_help(controller_main_t * const main); -#endif // _di_controller_print_help_ - -/** - * Execute main program. - * - * Be sure to call controller_main_delete() after executing this. - * - * If main.signal is non-zero, then this blocks and handles the following signals: - * - F_signal_abort - * - F_signal_broken_pipe - * - F_signal_hangup - * - F_signal_interrupt - * - F_signal_quit - * - F_signal_termination - * - * @param main - * The main program data. - * @param arguments - * The parameters passed to the process. - * - * @return - * F_none on success. - * F_child if this is a child process returning. - * - * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. - * - * Status codes (with error bit) are returned on any problem. - * - * @see controller_main_delete() - */ -#ifndef _di_controller_main_ - extern f_status_t controller_main(controller_main_t * const main, const f_console_arguments_t *arguments); -#endif // _di_controller_main_ - -/** * Deallocate main. * * Be sure to call this after executing controller_main(). @@ -518,4 +387,4 @@ extern "C" { } // extern "C" #endif -#endif // _controller_h +#endif // _controller_common_h diff --git a/level_3/controller/c/common/private-cache.c b/level_3/controller/c/common/private-cache.c index d57dd4b..9d0d724 100644 --- a/level_3/controller/c/common/private-cache.c +++ b/level_3/controller/c/common/private-cache.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "private-common.h" #ifdef __cplusplus @@ -18,8 +18,8 @@ extern "C" { #ifndef _di_controller_cache_delete_simple_ void controller_cache_delete_simple(controller_cache_t * const cache) { - macro_f_array_lengths_t_delete_simple(cache->ats) - macro_f_array_lengths_t_delete_simple(cache->stack) + f_type_array_lengths_resize(0, &cache->ats); + f_type_array_lengths_resize(0, &cache->stack); macro_f_fss_delimits_t_delete_simple(cache->delimits) f_string_dynamic_resize(0, &cache->buffer_file); diff --git a/level_3/controller/c/common/private-common.c b/level_3/controller/c/common/private-common.c index adb1eb6..81ce642 100644 --- a/level_3/controller/c/common/private-common.c +++ b/level_3/controller/c/common/private-common.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "private-common.h" #ifdef __cplusplus diff --git a/level_3/controller/c/common/private-common.h b/level_3/controller/c/common/private-common.h index 44ec719..cd5a676 100644 --- a/level_3/controller/c/common/private-common.h +++ b/level_3/controller/c/common/private-common.h @@ -150,124 +150,124 @@ extern "C" { #define CONTROLLER_with_s "with" #define CONTROLLER_yes_s "yes" - #define controller_action_s_length 6 - #define controller_actions_s_length 7 - #define controller_affinity_s_length 8 - #define controller_as_s_length 2 - #define controller_asynchronous_s_length 12 - #define controller_bash_s_length 4 - #define controller_batch_s_length 5 - #define controller_capability_s_length 10 - #define controller_cgroup_s_length 6 - #define controller_create_s_length 6 - #define controller_command_s_length 7 - #define controller_consider_s_length 8 - #define controller_control_s_length 7 - #define controller_control_group_s_length 13 - #define controller_control_mode_s_length 12 - #define controller_control_user_s_length 12 - #define controller_core_s_length 4 - #define controller_cpu_s_length 3 - #define controller_data_s_length 4 - #define controller_deadline_s_length 8 - #define controller_default_s_length 7 - #define controller_define_s_length 6 - #define controller_delay_s_length 5 - #define controller_disable_s_length 7 - #define controller_entry_s_length 5 - #define controller_entries_s_length 7 - #define controller_environment_s_length 11 - #define controller_error_s_length 5 - #define controller_existing_s_length 8 - #define controller_execute_s_length 7 - #define controller_exit_s_length 4 - #define controller_exits_s_length 5 - #define controller_fail_s_length 4 - #define controller_failure_s_length 7 - #define controller_failsafe_s_length 8 - #define controller_fifo_s_length 4 - #define controller_freeze_s_length 6 - #define controller_fsize_s_length 5 - #define controller_full_path_s_length 9 - #define controller_group_s_length 5 - #define controller_groups_s_length 6 - #define controller_how_s_length 3 - #define controller_idle_s_length 4 - #define controller_init_s_length 4 - #define controller_item_s_length 4 - #define controller_kill_s_length 4 - #define controller_length_s_length 6 - #define controller_limit_s_length 5 - #define controller_locks_s_length 5 - #define controller_main_s_length 4 - #define controller_max_s_length 3 - #define controller_memlock_s_length 7 - #define controller_method_s_length 6 - #define controller_mode_s_length 4 - #define controller_msgqueue_s_length 8 - #define controller_name_s_length 4 - #define controller_need_s_length 4 - #define controller_new_s_length 3 - #define controller_nice_s_length 4 - #define controller_no_s_length 2 - #define controller_nofile_s_length 6 - #define controller_normal_s_length 6 - #define controller_nproc_s_length 5 - #define controller_on_s_length 2 - #define controller_optional_s_length 8 - #define controller_other_s_length 5 - #define controller_parameter_s_length 9 - #define controller_parameters_s_length 10 - #define controller_path_s_length 4 - #define controller_pause_s_length 5 - #define controller_payload_type_s_length 11 - #define controller_pid_s_length 3 - #define controller_pid_file_s_length 8 - #define controller_processor_s_length 9 - #define controller_program_s_length 7 - #define controller_ready_s_length 5 - #define controller_reload_s_length 6 - #define controller_require_s_length 7 - #define controller_required_s_length 8 - #define controller_rerun_s_length 5 - #define controller_reset_s_length 5 - #define controller_restart_s_length 7 - #define controller_resume_s_length 6 - #define controller_round_robin_s_length 11 - #define controller_rss_s_length 3 - #define controller_rtprio_s_length 6 - #define controller_rttime_s_length 6 - #define controller_rule_s_length 4 - #define controller_rules_s_length 5 - #define controller_same_s_length 4 - #define controller_scheduler_s_length 9 - #define controller_script_s_length 6 - #define controller_service_s_length 7 - #define controller_session_s_length 7 - #define controller_session_new_s_length 11 - #define controller_session_same_s_length 12 - #define controller_setting_s_length 7 - #define controller_show_s_length 4 - #define controller_sigpending_s_length 10 - #define controller_stack_s_length 5 - #define controller_start_s_length 5 - #define controller_status_s_length 6 - #define controller_stop_s_length 4 - #define controller_succeed_s_length 7 - #define controller_success_s_length 7 - #define controller_synchronous_s_length 11 - #define controller_thaw_s_length 4 - #define controller_timeout_s_length 7 - #define controller_type_s_length 4 - #define controller_use_s_length 3 - #define controller_user_s_length 4 - #define controller_utility_s_length 7 - #define controller_value_s_length 5 - #define controller_wait_s_length 4 - #define controller_want_s_length 4 - #define controller_wish_s_length 4 - #define controller_with_s_length 4 - #define controller_yes_s_length 3 + #define CONTROLLER_action_s_length 6 + #define CONTROLLER_actions_s_length 7 + #define CONTROLLER_affinity_s_length 8 + #define CONTROLLER_as_s_length 2 + #define CONTROLLER_asynchronous_s_length 12 + #define CONTROLLER_bash_s_length 4 + #define CONTROLLER_batch_s_length 5 + #define CONTROLLER_capability_s_length 10 + #define CONTROLLER_cgroup_s_length 6 + #define CONTROLLER_create_s_length 6 + #define CONTROLLER_command_s_length 7 + #define CONTROLLER_consider_s_length 8 + #define CONTROLLER_control_s_length 7 + #define CONTROLLER_control_group_s_length 13 + #define CONTROLLER_control_mode_s_length 12 + #define CONTROLLER_control_user_s_length 12 + #define CONTROLLER_core_s_length 4 + #define CONTROLLER_cpu_s_length 3 + #define CONTROLLER_data_s_length 4 + #define CONTROLLER_deadline_s_length 8 + #define CONTROLLER_default_s_length 7 + #define CONTROLLER_define_s_length 6 + #define CONTROLLER_delay_s_length 5 + #define CONTROLLER_disable_s_length 7 + #define CONTROLLER_entry_s_length 5 + #define CONTROLLER_entries_s_length 7 + #define CONTROLLER_environment_s_length 11 + #define CONTROLLER_error_s_length 5 + #define CONTROLLER_existing_s_length 8 + #define CONTROLLER_execute_s_length 7 + #define CONTROLLER_exit_s_length 4 + #define CONTROLLER_exits_s_length 5 + #define CONTROLLER_fail_s_length 4 + #define CONTROLLER_failure_s_length 7 + #define CONTROLLER_failsafe_s_length 8 + #define CONTROLLER_fifo_s_length 4 + #define CONTROLLER_freeze_s_length 6 + #define CONTROLLER_fsize_s_length 5 + #define CONTROLLER_full_path_s_length 9 + #define CONTROLLER_group_s_length 5 + #define CONTROLLER_groups_s_length 6 + #define CONTROLLER_how_s_length 3 + #define CONTROLLER_idle_s_length 4 + #define CONTROLLER_init_s_length 4 + #define CONTROLLER_item_s_length 4 + #define CONTROLLER_kill_s_length 4 + #define CONTROLLER_length_s_length 6 + #define CONTROLLER_limit_s_length 5 + #define CONTROLLER_locks_s_length 5 + #define CONTROLLER_main_s_length 4 + #define CONTROLLER_max_s_length 3 + #define CONTROLLER_memlock_s_length 7 + #define CONTROLLER_method_s_length 6 + #define CONTROLLER_mode_s_length 4 + #define CONTROLLER_msgqueue_s_length 8 + #define CONTROLLER_name_s_length 4 + #define CONTROLLER_need_s_length 4 + #define CONTROLLER_new_s_length 3 + #define CONTROLLER_nice_s_length 4 + #define CONTROLLER_no_s_length 2 + #define CONTROLLER_nofile_s_length 6 + #define CONTROLLER_normal_s_length 6 + #define CONTROLLER_nproc_s_length 5 + #define CONTROLLER_on_s_length 2 + #define CONTROLLER_optional_s_length 8 + #define CONTROLLER_other_s_length 5 + #define CONTROLLER_parameter_s_length 9 + #define CONTROLLER_parameters_s_length 10 + #define CONTROLLER_path_s_length 4 + #define CONTROLLER_pause_s_length 5 + #define CONTROLLER_payload_type_s_length 11 + #define CONTROLLER_pid_s_length 3 + #define CONTROLLER_pid_file_s_length 8 + #define CONTROLLER_processor_s_length 9 + #define CONTROLLER_program_s_length 7 + #define CONTROLLER_ready_s_length 5 + #define CONTROLLER_reload_s_length 6 + #define CONTROLLER_require_s_length 7 + #define CONTROLLER_required_s_length 8 + #define CONTROLLER_rerun_s_length 5 + #define CONTROLLER_reset_s_length 5 + #define CONTROLLER_restart_s_length 7 + #define CONTROLLER_resume_s_length 6 + #define CONTROLLER_round_robin_s_length 11 + #define CONTROLLER_rss_s_length 3 + #define CONTROLLER_rtprio_s_length 6 + #define CONTROLLER_rttime_s_length 6 + #define CONTROLLER_rule_s_length 4 + #define CONTROLLER_rules_s_length 5 + #define CONTROLLER_same_s_length 4 + #define CONTROLLER_scheduler_s_length 9 + #define CONTROLLER_script_s_length 6 + #define CONTROLLER_service_s_length 7 + #define CONTROLLER_session_s_length 7 + #define CONTROLLER_session_new_s_length 11 + #define CONTROLLER_session_same_s_length 12 + #define CONTROLLER_setting_s_length 7 + #define CONTROLLER_show_s_length 4 + #define CONTROLLER_sigpending_s_length 10 + #define CONTROLLER_stack_s_length 5 + #define CONTROLLER_start_s_length 5 + #define CONTROLLER_status_s_length 6 + #define CONTROLLER_stop_s_length 4 + #define CONTROLLER_succeed_s_length 7 + #define CONTROLLER_success_s_length 7 + #define CONTROLLER_synchronous_s_length 11 + #define CONTROLLER_thaw_s_length 4 + #define CONTROLLER_timeout_s_length 7 + #define CONTROLLER_type_s_length 4 + #define CONTROLLER_use_s_length 3 + #define CONTROLLER_user_s_length 4 + #define CONTROLLER_utility_s_length 7 + #define CONTROLLER_value_s_length 5 + #define CONTROLLER_wait_s_length 4 + #define CONTROLLER_want_s_length 4 + #define CONTROLLER_wish_s_length 4 + #define CONTROLLER_with_s_length 4 + #define CONTROLLER_yes_s_length 3 extern const f_string_static_t controller_action_s; extern const f_string_static_t controller_actions_s; diff --git a/level_3/controller/c/common/private-control.c b/level_3/controller/c/common/private-control.c index dd5a69c..9ae947e 100644 --- a/level_3/controller/c/common/private-control.c +++ b/level_3/controller/c/common/private-control.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "private-common.h" #ifdef __cplusplus diff --git a/level_3/controller/c/common/private-entry.c b/level_3/controller/c/common/private-entry.c index dea74a2..db543e7 100644 --- a/level_3/controller/c/common/private-entry.c +++ b/level_3/controller/c/common/private-entry.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "private-common.h" #ifdef __cplusplus diff --git a/level_3/controller/c/common/private-lock.c b/level_3/controller/c/common/private-lock.c index af3260d..050b94a 100644 --- a/level_3/controller/c/common/private-lock.c +++ b/level_3/controller/c/common/private-lock.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "private-common.h" #ifdef __cplusplus diff --git a/level_3/controller/c/common/private-process.c b/level_3/controller/c/common/private-process.c index 0923db2..cb6b07d 100644 --- a/level_3/controller/c/common/private-process.c +++ b/level_3/controller/c/common/private-process.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "private-common.h" #ifdef __cplusplus @@ -67,7 +67,7 @@ extern "C" { f_string_dynamics_resize(0, &process->path_pids); - macro_f_array_lengths_t_delete_simple(process->stack) + f_type_array_lengths_resize(0, &process->stack); } #endif // _di_controller_process_delete_simple_ diff --git a/level_3/controller/c/common/private-rule.c b/level_3/controller/c/common/private-rule.c index baf3dd4..7dfbf4e 100644 --- a/level_3/controller/c/common/private-rule.c +++ b/level_3/controller/c/common/private-rule.c @@ -1,10 +1,15 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "private-common.h" #ifdef __cplusplus extern "C" { #endif +#ifndef _di_controller_rule_action_t_ + const f_string_static_t controller_rule_action_method_string_extended_s = macro_f_string_static_t_initialize2(CONTROLLER_rule_action_method_string_extended_s, 0, CONTROLLER_rule_action_method_string_extended_s_length); + const f_string_static_t controller_rule_action_method_string_extended_list_s = macro_f_string_static_t_initialize2(CONTROLLER_rule_action_method_string_extended_list_s, 0, CONTROLLER_rule_action_method_string_extended_list_s_length); +#endif // _di_controller_rule_action_t_ + #ifndef _di_controller_rule_action_delete_simple_ void controller_rule_action_delete_simple(controller_rule_action_t * const action) { diff --git a/level_3/controller/c/common/private-rule.h b/level_3/controller/c/common/private-rule.h index 78d49aa..6400222 100644 --- a/level_3/controller/c/common/private-rule.h +++ b/level_3/controller/c/common/private-rule.h @@ -102,11 +102,14 @@ extern "C" { * parameters: All parameters associated with the Rule Action. */ #ifndef _di_controller_rule_action_t_ - #define controller_rule_action_method_string_extended_s "FSS-0001 (Extended)" - #define controller_rule_action_method_string_extended_list_s "FSS-0003 (Extended List)" + #define CONTROLLER_rule_action_method_string_extended_s "FSS-0001 (Extended)" + #define CONTROLLER_rule_action_method_string_extended_list_s "FSS-0003 (Extended List)" - #define controller_rule_action_method_string_extended_s_length 19 - #define controller_rule_action_method_string_extended_list_s_length 24 + #define CONTROLLER_rule_action_method_string_extended_s_length 19 + #define CONTROLLER_rule_action_method_string_extended_list_s_length 24 + + extern const f_string_static_t controller_rule_action_method_string_extended_s; + extern const f_string_static_t controller_rule_action_method_string_extended_list_s; enum { controller_rule_action_method_extended_e = 1, diff --git a/level_3/controller/c/common/private-setting.c b/level_3/controller/c/common/private-setting.c index 1662322..76366f8 100644 --- a/level_3/controller/c/common/private-setting.c +++ b/level_3/controller/c/common/private-setting.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "private-common.h" #ifdef __cplusplus diff --git a/level_3/controller/c/common/private-task.c b/level_3/controller/c/common/private-task.c index 98fccd7..c86ae46 100644 --- a/level_3/controller/c/common/private-task.c +++ b/level_3/controller/c/common/private-task.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "private-common.h" #ifdef __cplusplus diff --git a/level_3/controller/c/common/private-thread.c b/level_3/controller/c/common/private-thread.c index 131b426..3b5ff5c 100644 --- a/level_3/controller/c/common/private-thread.c +++ b/level_3/controller/c/common/private-thread.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "private-common.h" #ifdef __cplusplus diff --git a/level_3/controller/c/control/private-control.c b/level_3/controller/c/control/private-control.c index ffc0ddd..8dd7de1 100644 --- a/level_3/controller/c/control/private-control.c +++ b/level_3/controller/c/control/private-control.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "private-control.h" #include "../controller/private-controller_print.h" @@ -232,10 +232,6 @@ extern "C" { f_status_t status2 = F_none; - const f_string_static_t object_header = macro_f_string_static_t_initialize(f_fss_string_header_s, F_fss_string_header_s_length); - const f_string_static_t object_type = macro_f_string_static_t_initialize(controller_type_s, controller_type_s_length); - const f_string_static_t object_status = macro_f_string_static_t_initialize(controller_status_s, controller_status_s_length); - const f_string_static_t object_length = macro_f_string_static_t_initialize(controller_length_s, controller_length_s_length); const f_state_t state = f_state_t_initialize; const f_conversion_data_t data_conversion = macro_f_conversion_data_t_initialize(10, 0, 1); @@ -252,7 +248,7 @@ extern "C" { if (type.used) { contents[0] = type; - status2 = fll_fss_extended_write_string(object_type, content, 0, state, &control->cache_1); + status2 = fll_fss_extended_write_string(controller_type_s, content, 0, state, &control->cache_1); if (F_status_is_error(status2)) return status2; } @@ -260,7 +256,7 @@ extern "C" { if (status.used) { contents[0] = status; - status2 = fll_fss_extended_write_string(object_status, content, 0, state, &control->cache_1); + status2 = fll_fss_extended_write_string(controller_status_s, content, 0, state, &control->cache_1); if (F_status_is_error(status2)) return status2; control->cache_2.used = 0; @@ -272,15 +268,15 @@ extern "C" { contents[0] = control->cache_2; - status2 = fll_fss_extended_write_string(object_length, content, 0, state, &control->cache_1); + status2 = fll_fss_extended_write_string(controller_length_s, content, 0, state, &control->cache_1); if (F_status_is_error(status2)) return status2; // Prepend the identifier comment to the output. - status2 = f_string_append(controller_payload_type_s, controller_payload_type_s_length, &control->output); + status2 = f_string_dynamic_append(controller_payload_type_s, &control->output); if (F_status_is_error(status2)) return status2; // Append entire header block to the output. - status2 = fll_fss_payload_write_string(object_header, control->cache_1, F_false, 0, state, &control->output); + status2 = fll_fss_payload_write_string(f_fss_string_header_s, control->cache_1, F_false, 0, state, &control->output); if (F_status_is_error(status2)) return status2; return F_none; @@ -291,7 +287,6 @@ extern "C" { f_status_t controller_control_respond_error(const controller_global_t *global, controller_control_t * const control, const f_status_t status, const f_string_static_t message) { f_status_t status2 = F_none; - const f_state_t state = f_state_t_initialize; control->output.used = 0; control->cache_3.used = 0; @@ -303,17 +298,13 @@ extern "C" { if (F_status_is_error(status2)) return status2; } - { - const f_string_static_t content_error = macro_f_string_static_t_initialize(controller_error_s, controller_error_s_length); - - status2 = controller_control_respond_build_header(global, control, content_error, control->cache_3, message.used); - if (F_status_is_error(status2)) return status2; - } + status2 = controller_control_respond_build_header(global, control, controller_error_s, control->cache_3, message.used); + if (F_status_is_error(status2)) return status2; { - const f_string_static_t object_payload = macro_f_string_static_t_initialize(f_fss_string_payload_s, F_fss_string_payload_s_length); + const f_state_t state = f_state_t_initialize; - status2 = fll_fss_payload_write_string(object_payload, message, F_false, 0, state, &control->output); + status2 = fll_fss_payload_write_string(f_fss_string_payload_s, message, F_false, 0, state, &control->output); if (F_status_is_error(status2)) return status2; } diff --git a/level_3/controller/c/control/private-control_print.c b/level_3/controller/c/control/private-control_print.c index b27a99f..d0d7d58 100644 --- a/level_3/controller/c/control/private-control_print.c +++ b/level_3/controller/c/control/private-control_print.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "private-control.h" #include "../lock/private-lock_print.h" diff --git a/level_3/controller/c/controller/controller.c b/level_3/controller/c/controller.c similarity index 61% rename from level_3/controller/c/controller/controller.c rename to level_3/controller/c/controller.c index fe892a9..d6ebc9e 100644 --- a/level_3/controller/c/controller/controller.c +++ b/level_3/controller/c/controller.c @@ -1,101 +1,59 @@ #include "controller.h" -#include "../common/private-common.h" -#include "../control/private-control.h" -#include "private-controller.h" -#include "private-controller_print.h" -#include "../entry/private-entry.h" -#include "../lock/private-lock_print.h" -#include "../rule/private-rule.h" -#include "../thread/private-thread.h" +#include "common/private-common.h" +#include "control/private-control.h" +#include "controller/private-controller.h" +#include "controller/private-controller_print.h" +#include "entry/private-entry.h" +#include "lock/private-lock_print.h" +#include "rule/private-rule.h" +#include "thread/private-thread.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_controller_program_version_ - const f_string_static_t controller_program_version_s = macro_f_string_static_t_initialize2(CONTROLLER_program_version_s, 0, CONTROLLER_program_version_s_length); -#endif // _di_controller_program_version_ - -#ifndef _di_controller_program_name_ - const f_string_static_t controller_program_name_s = macro_f_string_static_t_initialize2(CONTROLLER_program_name_s, 0, CONTROLLER_program_name_s_length); - const f_string_static_t controller_program_name_long_s = macro_f_string_static_t_initialize2(CONTROLLER_program_name_long_s, 0, CONTROLLER_program_name_long_s_length); - - const f_string_static_t controller_program_name_init_s = macro_f_string_static_t_initialize2(CONTROLLER_program_name_init_s, 0, CONTROLLER_program_name_init_s_length); - const f_string_static_t controller_program_name_init_long_s = macro_f_string_static_t_initialize2(CONTROLLER_program_name_init_long_s, 0, CONTROLLER_program_name_init_long_s_length); -#endif // _di_controller_program_name_ - -#ifndef _di_controller_defines_ - const f_string_static_t controller_default_program_script_s = macro_f_string_static_t_initialize2(CONTROLLER_default_program_script_s, 0, CONTROLLER_default_program_script_s_length); - const f_string_static_t controller_path_pid_s = macro_f_string_static_t_initialize2(CONTROLLER_path_pid_s, 0, CONTROLLER_path_pid_s_length); - const f_string_static_t controller_path_pid_init_s = macro_f_string_static_t_initialize2(CONTROLLER_path_pid_init_s, 0, CONTROLLER_path_pid_init_s_length); - const f_string_static_t controller_path_pid_prefix_s = macro_f_string_static_t_initialize2(CONTROLLER_path_pid_prefix_s, 0, CONTROLLER_path_pid_prefix_s_length); - const f_string_static_t controller_path_pid_suffix_s = macro_f_string_static_t_initialize2(CONTROLLER_path_pid_suffix_s, 0, CONTROLLER_path_pid_suffix_s_length); - const f_string_static_t controller_path_settings_s = macro_f_string_static_t_initialize2(CONTROLLER_path_settings_s, 0, CONTROLLER_path_settings_s_length); - const f_string_static_t controller_path_settings_init_s = macro_f_string_static_t_initialize2(CONTROLLER_path_settings_init_s, 0, CONTROLLER_path_settings_init_s_length); - const f_string_static_t controller_path_socket_s = macro_f_string_static_t_initialize2(CONTROLLER_path_socket_s, 0, CONTROLLER_path_socket_s_length); - const f_string_static_t controller_path_socket_init_s = macro_f_string_static_t_initialize2(CONTROLLER_path_socket_init_s, 0, CONTROLLER_path_socket_s_length); - const f_string_static_t controller_path_socket_prefix_s = macro_f_string_static_t_initialize2(CONTROLLER_path_socket_prefix_s, 0, CONTROLLER_path_socket_prefix_s_length); - const f_string_static_t controller_path_socket_suffix_s = macro_f_string_static_t_initialize2(CONTROLLER_path_socket_suffix_s, 0, CONTROLLER_path_socket_suffix_s_length); - - const f_string_static_t controller_short_cgroup_s = macro_f_string_static_t_initialize2(CONTROLLER_short_cgroup_s, 0, CONTROLLER_short_cgroup_s_length); - const f_string_static_t controller_short_daemon_s = macro_f_string_static_t_initialize2(CONTROLLER_short_daemon_s, 0, CONTROLLER_short_daemon_s_length); - const f_string_static_t controller_short_init_s = macro_f_string_static_t_initialize2(CONTROLLER_short_init_s, 0, CONTROLLER_short_init_s_length); - const f_string_static_t controller_short_interruptible_s = macro_f_string_static_t_initialize2(CONTROLLER_short_interruptible_s, 0, CONTROLLER_short_interruptible_s_length); - const f_string_static_t controller_short_pid_s = macro_f_string_static_t_initialize2(CONTROLLER_short_pid_s, 0, CONTROLLER_short_pid_s_length); - const f_string_static_t controller_short_settings_s = macro_f_string_static_t_initialize2(CONTROLLER_short_settings_s, 0, CONTROLLER_short_settings_s_length); - const f_string_static_t controller_short_simulate_s = macro_f_string_static_t_initialize2(CONTROLLER_short_simulate_s, 0, CONTROLLER_short_simulate_s_length); - const f_string_static_t controller_short_socket_s = macro_f_string_static_t_initialize2(CONTROLLER_short_socket_s, 0, CONTROLLER_short_socket_s_length); - const f_string_static_t controller_short_uninterruptible_s = macro_f_string_static_t_initialize2(CONTROLLER_short_uninterruptible_s, 0, CONTROLLER_short_uninterruptible_s_length); - const f_string_static_t controller_short_validate_s = macro_f_string_static_t_initialize2(CONTROLLER_short_validate_s, 0, CONTROLLER_short_validate_s_length); - - const f_string_static_t controller_long_cgroup_s = macro_f_string_static_t_initialize2(CONTROLLER_long_cgroup_s, 0, CONTROLLER_long_cgroup_s_length); - const f_string_static_t controller_long_daemon_s = macro_f_string_static_t_initialize2(CONTROLLER_long_daemon_s, 0, CONTROLLER_long_daemon_s_length); - const f_string_static_t controller_long_init_s = macro_f_string_static_t_initialize2(CONTROLLER_long_init_s, 0, CONTROLLER_long_init_s_length); - const f_string_static_t controller_long_interruptible_s = macro_f_string_static_t_initialize2(CONTROLLER_long_interruptible_s, 0, CONTROLLER_long_interruptible_s_length); - const f_string_static_t controller_long_pid_s = macro_f_string_static_t_initialize2(CONTROLLER_long_pid_s, 0, CONTROLLER_long_pid_s_length); - const f_string_static_t controller_long_settings_s = macro_f_string_static_t_initialize2(CONTROLLER_long_settings_s, 0, CONTROLLER_long_settings_s_length); - const f_string_static_t controller_long_simulate_s = macro_f_string_static_t_initialize2(CONTROLLER_long_simulate_s, 0, CONTROLLER_long_simulate_s_length); - const f_string_static_t controller_long_socket_s = macro_f_string_static_t_initialize2(CONTROLLER_long_socket_s, 0, CONTROLLER_long_socket_s_length); - const f_string_static_t controller_long_uninterruptible_s = macro_f_string_static_t_initialize2(CONTROLLER_long_uninterruptible_s, 0, CONTROLLER_long_uninterruptible_s_length); - const f_string_static_t controller_long_validate_s = macro_f_string_static_t_initialize2(CONTROLLER_long_validate_s, 0, CONTROLLER_long_validate_s_length); -#endif // _di_controller_defines_ - #ifndef _di_controller_print_help_ f_status_t controller_print_help(controller_main_t * const main) { controller_lock_print(main->output.to, 0); - fll_program_print_help_header(main->output.to, main->context, main->program_name_long->string, controller_program_version_s.string); + fll_program_print_help_header(main->output.to, main->context, *main->program_name_long, controller_program_version_s); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not main->output.to in color."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity beyond normal main->output.to."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal main->output.to."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal main->output.to."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, inceasing verbosity beyond normal main->output.to."); - fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not main->output.to in color."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity beyond normal main->output.to."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal main->output.to."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal main->output.to."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, inceasing verbosity beyond normal main->output.to."); + fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, main->output.to.stream); - fll_program_print_help_option(main->output.to, main->context, controller_short_cgroup_s.string, controller_long_cgroup_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a custom control group file path, such as '" F_control_group_path_system_prefix_s F_control_group_path_system_default_s "'."); - fll_program_print_help_option(main->output.to, main->context, controller_short_daemon_s.string, controller_long_daemon_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Run in daemon only mode (do not process the entry)."); - fll_program_print_help_option(main->output.to, main->context, controller_short_init_s.string, controller_long_init_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " The program will run as an init replacement."); - fll_program_print_help_option(main->output.to, main->context, controller_short_interruptible_s.string, controller_long_interruptible_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Designate that this program can be interrupted by a signal."); - fll_program_print_help_option(main->output.to, main->context, controller_short_pid_s.string, controller_long_pid_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a custom pid file path, such as '" CONTROLLER_path_pid_s CONTROLLER_default_s CONTROLLER_path_pid_suffix_s "'."); - fll_program_print_help_option(main->output.to, main->context, controller_short_settings_s.string, controller_long_settings_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a custom settings path, such as '" CONTROLLER_path_settings_s "'."); - fll_program_print_help_option(main->output.to, main->context, controller_short_simulate_s.string, controller_long_simulate_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Run as a simulation."); - fll_program_print_help_option(main->output.to, main->context, controller_short_socket_s.string, controller_long_socket_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a custom socket file path, such as '" CONTROLLER_path_socket_s CONTROLLER_default_s CONTROLLER_path_socket_suffix_s "'."); - fll_program_print_help_option(main->output.to, main->context, controller_short_uninterruptible_s.string, controller_long_uninterruptible_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Designate that this program cannot be interrupted by a signal."); - fll_program_print_help_option(main->output.to, main->context, controller_short_validate_s.string, controller_long_validate_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Validate the settings (entry and rules) without running (does not simulate)."); + fll_program_print_help_option(main->output.to, main->context, controller_short_cgroup_s, controller_long_cgroup_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a custom control group file path, such as '" F_control_group_path_system_prefix_s F_control_group_path_system_default_s "'."); + fll_program_print_help_option(main->output.to, main->context, controller_short_daemon_s, controller_long_daemon_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Run in daemon only mode (do not process the entry)."); + fll_program_print_help_option(main->output.to, main->context, controller_short_init_s, controller_long_init_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The program will run as an init replacement."); + fll_program_print_help_option(main->output.to, main->context, controller_short_interruptible_s, controller_long_interruptible_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Designate that this program can be interrupted by a signal."); + fll_program_print_help_option(main->output.to, main->context, controller_short_pid_s, controller_long_pid_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a custom pid file path, such as '" CONTROLLER_path_pid_s CONTROLLER_default_s CONTROLLER_path_pid_suffix_s "'."); + fll_program_print_help_option(main->output.to, main->context, controller_short_settings_s, controller_long_settings_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a custom settings path, such as '" CONTROLLER_path_settings_s "'."); + fll_program_print_help_option(main->output.to, main->context, controller_short_simulate_s, controller_long_simulate_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Run as a simulation."); + fll_program_print_help_option(main->output.to, main->context, controller_short_socket_s, controller_long_socket_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a custom socket file path, such as '" CONTROLLER_path_socket_s CONTROLLER_default_s CONTROLLER_path_socket_suffix_s "'."); + fll_program_print_help_option(main->output.to, main->context, controller_short_uninterruptible_s, controller_long_uninterruptible_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Designate that this program cannot be interrupted by a signal."); + fll_program_print_help_option(main->output.to, main->context, controller_short_validate_s, controller_long_validate_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Validate the settings (entry and rules) without running (does not simulate)."); - fll_program_print_help_usage(main->output.to, main->context, main->program_name->string, "entry"); + fll_program_print_help_usage(main->output.to, main->context, *main->program_name, controller_entry_s); fl_print_format(" When both the %[%q%q%] parameter and the", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_simulate_s, main->context.set.notable); fl_print_format(" %[%q%q%] parameter are specified, then additional information on each would be executed rule is printed but no simulation is performed.%q%q", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_validate_s, main->context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The default interrupt behavior is to operate as if the %[%q%q%] parameter is passed.%q%q", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, main->setting_default.used ? controller_long_uninterruptible_s : controller_long_interruptible_s, main->context.set.notable, f_string_eol_s, f_string_eol_s); + #ifdef _controller_as_init_ + const f_string_static_t interruptable = controller_long_uninterruptible_s; + #else + const f_string_static_t interruptable = controller_long_interruptible_s; + #endif // _controller_as_init_ + + fl_print_format(" The default interrupt behavior is to operate as if the %[%q%q%] parameter is passed.%q%q", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, interruptable, main->context.set.notable, f_string_eol_s, f_string_eol_s); fl_print_format(" Specify an empty string for the %[%q%q%] parameter to disable pid file creation for this program.%q%q", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_pid_s, main->context.set.notable, f_string_eol_s, f_string_eol_s); @@ -201,7 +159,7 @@ extern "C" { if (main->parameters[controller_parameter_version_e].result == f_console_result_found_e) { controller_lock_print(main->output.to, 0); - fll_program_print_version(main->output.to, controller_program_version_s.string); + fll_program_print_version(main->output.to, controller_program_version_s); controller_unlock_print_flush(main->output.to, 0); @@ -221,14 +179,14 @@ extern "C" { memset(&address, 0, setting.control_socket.length); if (main->remaining.used) { - status = f_string_append_nulless(arguments->argv[main->remaining.array[0]], strnlen(arguments->argv[main->remaining.array[0]], f_console_parameter_size), &setting.name_entry); + status = f_string_append_nulless(arguments->argv[main->remaining.array[0]], strnlen(arguments->argv[main->remaining.array[0]], F_console_parameter_size_d), &setting.name_entry); } else { - status = f_string_append_nulless(controller_default_s, controller_default_s_length, &setting.name_entry); + status = f_string_dynamic_append_nulless(controller_default_s, &setting.name_entry); } if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), main->remaining.used ? "f_string_append_nulless" : "f_string_dynamic_append_nulless", F_true); controller_main_delete(main); @@ -257,7 +215,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(main->error.to, 0); - fl_print_format("%q%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_settings_s, main->context.set.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -279,8 +237,8 @@ extern "C" { if (main->parameters[controller_parameter_init_e].result == f_console_result_found_e && !main->as_init) { status = f_string_dynamic_append(controller_path_settings_init_s, &setting.path_setting); } - else if (main->setting_default->used) { - status = f_string_dynamic_append(*main->setting_default, &setting.path_setting); + else if (main->default_path_setting->used) { + status = f_string_dynamic_append(*main->default_path_setting, &setting.path_setting); } else { status = f_string_dynamic_append(controller_path_settings_s, &setting.path_setting); @@ -296,7 +254,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(main->error.to, 0); - fl_print_format("%q%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_pid_s, main->context.set.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -308,7 +266,7 @@ extern "C" { else if (main->parameters[controller_parameter_pid_e].locations.used) { const f_array_length_t location = main->parameters[controller_parameter_pid_e].values.array[main->parameters[controller_parameter_pid_e].values.used - 1]; - if (strnlen(arguments->argv[location], f_console_parameter_size)) { + if (strnlen(arguments->argv[location], F_console_parameter_size_d)) { status = fll_path_canonical(arguments->argv[location], &setting.path_pid); if (F_status_is_error(status)) { @@ -326,7 +284,7 @@ extern "C" { status = f_string_dynamic_append(controller_path_pid_init_s, &setting.path_pid); } else { - status = f_string_dynamic_append(main->default_path_pid, &setting.path_pid); + status = f_string_dynamic_append(*main->default_path_pid, &setting.path_pid); } if (F_status_is_error_not(status)) { @@ -355,7 +313,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(main->error.to, 0); - fl_print_format("%q%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_cgroup_s, main->context.set.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -367,7 +325,7 @@ extern "C" { else if (main->parameters[controller_parameter_cgroup_e].locations.used) { const f_array_length_t location = main->parameters[controller_parameter_cgroup_e].values.array[main->parameters[controller_parameter_cgroup_e].values.used - 1]; - if (strnlen(arguments->argv[location], f_console_parameter_size)) { + if (strnlen(arguments->argv[location], F_console_parameter_size_d)) { status = fll_path_canonical(arguments->argv[location], &setting.path_cgroup); if (F_status_is_error(status)) { @@ -392,7 +350,7 @@ extern "C" { if (main->warning.verbosity == f_console_verbosity_debug_e) { controller_lock_print(main->warning.to, 0); - fl_print_format("%q%[%SThe parameter '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix ? main->warning.prefix : f_string_empty_s, main->warning.context); + fl_print_format("%q%[%QThe parameter '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); fl_print_format("%[%q%q%]", main->warning.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_cgroup_s, main->context.set.notable); fl_print_format("%[' must be a file directory path but instead is an empty string, falling back to the default.%]%q", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); @@ -407,7 +365,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(main->error.to, 0); - fl_print_format("%q%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[' must not be specified with the parameter '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%q%q%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_daemon_s, main->context.set.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -503,7 +461,7 @@ extern "C" { if (F_status_set_fine(status_delete) == F_number_not) { controller_lock_print(main->warning.to, 0); - fl_print_format("%q%[%SThe pid file '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix ? main->warning.prefix : f_string_empty_s, main->warning.context); + fl_print_format("%q%[%QThe pid file '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); fl_print_format("%[%Q%]", main->warning.to.stream, main->warning.notable, setting.path_pid, main->warning.notable); fl_print_format("%[' must not be specified with the parameter '%]", main->warning.to.stream, main->warning.context, main->warning.context); fl_print_format("%[%i%]", main->warning.to.stream, main->warning.notable, main->pid, main->warning.notable); @@ -536,23 +494,6 @@ extern "C" { } #endif // _di_controller_main_ -#ifndef _di_controller_main_delete_ - f_status_t controller_main_delete(controller_main_t * const main) { - - for (f_array_length_t i = 0; i < controller_total_parameters_d; ++i) { - - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); - } // for - - macro_f_array_lengths_t_delete_simple(main->remaining); - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_controller_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/controller/c/controller.h b/level_3/controller/c/controller.h new file mode 100644 index 0000000..a1569cb --- /dev/null +++ b/level_3/controller/c/controller.h @@ -0,0 +1,144 @@ +/** + * FLL - Level 3 + * + * Project: Controller + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * This is the Controller program. + * + * This program utilizes the Featureless Linux Library. + * This program provides system service management, much like sysvcontroller and controllerng. + * This program can be controlled from user-space via the "control" program. + * This program can be used in an initrd and should be capable of pivot root operations. + * + * @todo Implement "exit" files that are the opposite of "entry" files whereas rules specified within are all called via the "stop" action type. + * This would then allow for switching modes. + * The "exit" would be specified in the "entry", by name and would be found under "exits" directory alongside the "entries" directory. + * + * @todo check the return status of unlocks. + * + * @todo the read/write locks (and unlocks) needs to be more robust in that they need to attempt to keep going even on failure or need to wait until resolvable. + * this is done to help ensure that the controller program always continues onward. + * + * @todo just like with the read/write locks, the out of memory cases need to be handled to keep going instead of bailing. + * likely these will need to be sleeps on the premise that eventually memory will clear itself up. + */ +#ifndef _controller_h +#define _controller_h + +// Include pre-requirements. +#define _GNU_SOURCE + +// Libc includes. +#include +#include +#include +#include +#include +#include +#include + +// FLL-0 includes. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// FLL-1 includes. +#include +#include +#include +#include +#include +#include + +// FLL-2 includes. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Controller includes. +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Print help. + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * @see controller_main() + */ +#ifndef _di_controller_print_help_ + extern f_status_t controller_print_help(controller_main_t * const main); +#endif // _di_controller_print_help_ + +/** + * Execute main program. + * + * Be sure to call controller_main_delete() after executing this. + * + * If main.signal is non-zero, then this blocks and handles the following signals: + * - F_signal_abort + * - F_signal_broken_pipe + * - F_signal_hangup + * - F_signal_interrupt + * - F_signal_quit + * - F_signal_termination + * + * @param main + * The main program data. + * @param arguments + * The parameters passed to the process. + * + * @return + * F_none on success. + * F_child if this is a child process returning. + * + * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. + * + * Status codes (with error bit) are returned on any problem. + * + * @see controller_main_delete() + */ +#ifndef _di_controller_main_ + extern f_status_t controller_main(controller_main_t * const main, const f_console_arguments_t *arguments); +#endif // _di_controller_main_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _controller_h diff --git a/level_3/controller/c/controller/controller.? b/level_3/controller/c/controller/controller.? new file mode 100644 index 0000000..e69de29 diff --git a/level_3/controller/c/controller/private-controller.c b/level_3/controller/c/controller/private-controller.c index f07f766..819e2a5 100644 --- a/level_3/controller/c/controller/private-controller.c +++ b/level_3/controller/c/controller/private-controller.c @@ -1,4 +1,4 @@ -#include "controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "private-controller.h" #include "private-controller_print.h" @@ -61,7 +61,7 @@ extern "C" { #endif // _di_controller_string_dynamic_partial_append_terminated_ #ifndef _di_controller_file_load_ - f_status_t controller_file_load(const controller_global_t global, const bool required, const f_string_t path_prefix, const f_string_static_t path_name, const f_string_t path_suffix, const f_array_length_t path_prefix_length, const f_array_length_t path_suffix_length, controller_cache_t * const cache) { + f_status_t controller_file_load(const controller_global_t global, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix, controller_cache_t * const cache) { f_status_t status = F_none; f_file_t file = f_file_t_initialize; @@ -71,28 +71,26 @@ extern "C" { macro_f_time_spec_t_clear(cache->timestamp); - status = f_string_append(path_prefix, path_prefix_length, &cache->action.name_file); + status = f_string_dynamic_append(path_prefix, &cache->action.name_file); if (F_status_is_error_not(status)) { - status = f_string_append(f_path_separator_s, F_path_separator_s_length, &cache->action.name_file); + status = f_string_dynamic_append(f_path_separator_s, &cache->action.name_file); } if (F_status_is_error_not(status)) { - status = f_string_append(path_name.string, path_name.used, &cache->action.name_file); + status = f_string_dynamic_append(path_name, &cache->action.name_file); } if (F_status_is_error_not(status)) { - status = f_string_append(F_path_extension_separator_s, F_path_extension_separator_s_length, &cache->action.name_file); + status = f_string_dynamic_append(f_path_extension_separator_s, &cache->action.name_file); } if (F_status_is_error_not(status)) { - status = f_string_append(path_suffix, path_suffix_length, &cache->action.name_file); + status = f_string_dynamic_append(path_suffix, &cache->action.name_file); } if (F_status_is_error(status)) { - if (global.main->error.verbosity != f_console_verbosity_quiet_e) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_append", F_true); - } + controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); return status; } @@ -100,9 +98,7 @@ extern "C" { status = f_string_dynamic_terminate_after(&cache->action.name_file); if (F_status_is_error(status)) { - if (global.main->error.verbosity != f_console_verbosity_quiet_e) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } + controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); return status; } @@ -185,7 +181,7 @@ extern "C" { status = f_directory_exists(path_directory.string); } - macro_f_string_dynamic_t_delete_simple(path_directory) + f_string_dynamic_resize(0, &path_directory); if (F_status_is_error(status)) return status; @@ -199,7 +195,7 @@ extern "C" { file.flag = F_file_flag_write_only_d; - status = f_file_stream_open(path.string, f_file_open_mode_truncate_s, &file); + status = f_file_stream_open(path.string, f_file_open_mode_truncate_s.string, &file); if (F_status_is_error(status)) return status; fll_print_format("%i%q", file.stream, pid, f_string_eol_s); @@ -223,7 +219,7 @@ extern "C" { f_status_t status = F_none; f_file_t pid_file = f_file_t_initialize; - status = f_file_stream_open(path.string, f_file_open_mode_read_s, &pid_file); + status = f_file_stream_open(path.string, f_file_open_mode_read_s.string, &pid_file); if (F_status_is_error(status)) return status; f_string_dynamic_t pid_buffer = f_string_dynamic_t_initialize; @@ -256,7 +252,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(pid_buffer); + f_string_dynamic_resize(0, &pid_buffer); return status; } @@ -276,7 +272,7 @@ extern "C" { f_file_t pid_file = f_file_t_initialize; - status = f_file_stream_open(path.string, f_file_open_mode_read_s, &pid_file); + status = f_file_stream_open(path.string, f_file_open_mode_read_s.string, &pid_file); if (F_status_is_error(status)) return status; f_string_dynamic_t pid_buffer = f_string_dynamic_t_initialize; @@ -306,7 +302,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(pid_buffer); + f_string_dynamic_resize(0, &pid_buffer); return status; } @@ -338,7 +334,8 @@ extern "C" { return status; } - else if (number > F_type_size_32_unsigned_d) { + + if (number > F_type_size_32_unsigned_d) { return F_status_set_error(F_number_too_large); } @@ -372,7 +369,8 @@ extern "C" { return status; } - else if (number > F_type_size_32_unsigned_d) { + + if (number > F_type_size_32_unsigned_d) { return F_status_set_error(F_number_too_large); } @@ -418,7 +416,7 @@ extern "C" { controller_lock_print(global->main->warning.to, global->thread); if (F_status_set_fine(status) == F_read_only) { - fl_print_format("%q%[%SThe pid file '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); + fl_print_format("%q%[%QThe pid file '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); fl_print_format("%[%Q%]", global->main->warning.to.stream, global->main->warning.notable, global->setting->path_pid, global->main->warning.notable); fl_print_format("%[' could not be written because the destination is read only.%]%q", global->main->warning.to.stream, global->main->warning.context, global->main->warning.context, f_string_eol_s); } @@ -460,7 +458,7 @@ extern "C" { if (global->main->output.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%q%[%SControl socket '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); + fl_print_format("%q%[%QControl socket '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_control, global->main->context.set.notable); fl_print_format("' .%q", global->main->output.to.stream, f_string_eol_s); fl_print_format("%[' cannot be found while read only mode is enabled and so the Control socket is unavailable.%]%q", global->main->output.to.stream, global->main->warning.context, global->main->warning.context, f_string_eol_s); @@ -484,7 +482,7 @@ extern "C" { if (global->main->output.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%q%[%SControl socket '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); + fl_print_format("%q%[%QControl socket '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_control, global->main->context.set.notable); fl_print_format("%[' could not be created, code %]", global->main->output.to.stream, global->main->warning.context, global->main->warning.context); fl_print_format("%[%ui%]", global->main->output.to.stream, global->main->context.set.notable, F_status_set_fine(status), global->main->context.set.notable); @@ -518,7 +516,7 @@ extern "C" { if (global->main->output.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%q%[%SControl socket '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); + fl_print_format("%q%[%QControl socket '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_control, global->main->context.set.notable); fl_print_format("%[' could not be bound, code %]", global->main->output.to.stream, global->main->warning.context, global->main->warning.context); fl_print_format("%[%ui%]", global->main->output.to.stream, global->main->context.set.notable, F_status_set_fine(status), global->main->context.set.notable); @@ -542,7 +540,7 @@ extern "C" { if (global->main->output.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%q%[%SControl socket '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); + fl_print_format("%q%[%QControl socket '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_control, global->main->context.set.notable); fl_print_format("%[' failed to set file roles, code %]", global->main->output.to.stream, global->main->warning.context, global->main->warning.context); fl_print_format("%[%ui%]", global->main->output.to.stream, global->main->context.set.notable, F_status_set_fine(status), global->main->context.set.notable); @@ -566,7 +564,7 @@ extern "C" { if (global->main->output.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%q%[%SControl socket '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); + fl_print_format("%q%[%QControl socket '%]", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context); fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_control, global->main->context.set.notable); fl_print_format("%[' failed to set file mode, code %]", global->main->output.to.stream, global->main->warning.context, global->main->warning.context); fl_print_format("%[%ui%]", global->main->output.to.stream, global->main->context.set.notable, F_status_set_fine(status), global->main->context.set.notable); diff --git a/level_3/controller/c/controller/private-controller.h b/level_3/controller/c/controller/private-controller.h index a79927e..90e2f3c 100644 --- a/level_3/controller/c/controller/private-controller.h +++ b/level_3/controller/c/controller/private-controller.h @@ -111,10 +111,6 @@ extern "C" { * The path name, such as 'default' from '/etc/controller/entries/default.entry'. * @param path_suffix * The path suffix, such as 'entry' from '/etc/controller/entries/default.entry'. - * @param path_prefix_length - * The length of the prefix path. - * @param path_suffix_length - * The length of the suffix path. * @param cache * The following within the cache is updated: * - name_file: The partial path of the file is inserted. @@ -138,7 +134,7 @@ extern "C" { * @see f_string_dynamic_terminate_after() */ #ifndef _di_controller_file_load_ - extern f_status_t controller_file_load(const controller_global_t global, const bool required, const f_string_t path_prefix, const f_string_static_t path_name, const f_string_t path_suffix, const f_array_length_t path_prefix_length, const f_array_length_t path_suffix_length, controller_cache_t * const cache) F_attribute_visibility_internal_d; + extern f_status_t controller_file_load(const controller_global_t global, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix, controller_cache_t * const cache) F_attribute_visibility_internal_d; #endif // _di_controller_file_load_ /** diff --git a/level_3/controller/c/controller/private-controller_print.c b/level_3/controller/c/controller/private-controller_print.c index b33f50f..5ed4bc9 100644 --- a/level_3/controller/c/controller/private-controller_print.c +++ b/level_3/controller/c/controller/private-controller_print.c @@ -1,4 +1,4 @@ -#include "controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "private-controller_print.h" #include "../lock/private-lock_print.h" @@ -55,7 +55,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index 717db9e..36e9961 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../controller/private-controller.h" #include "../controller/private-controller_print.h" @@ -42,78 +42,63 @@ extern "C" { switch (type) { case controller_entry_action_type_consider_e: - buffer.string = controller_consider_s; - buffer.used = controller_consider_s_length; + buffer = controller_consider_s; break; case controller_entry_action_type_execute_e: - buffer.string = controller_execute_s; - buffer.used = controller_execute_s_length; + buffer = controller_execute_s; break; case controller_entry_action_type_failsafe_e: - buffer.string = controller_failsafe_s; - buffer.used = controller_failsafe_s_length; + buffer = controller_failsafe_s; break; case controller_entry_action_type_freeze_e: - buffer.string = controller_freeze_s; - buffer.used = controller_freeze_s_length; + buffer = controller_freeze_s; break; case controller_entry_action_type_item_e: - buffer.string = controller_item_s; - buffer.used = controller_item_s_length; + buffer = controller_item_s; break; case controller_entry_action_type_kill_e: - buffer.string = controller_kill_s; - buffer.used = controller_kill_s_length; + buffer = controller_kill_s; break; case controller_entry_action_type_pause_e: - buffer.string = controller_pause_s; - buffer.used = controller_pause_s_length; + buffer = controller_pause_s; break; case controller_entry_action_type_ready_e: - buffer.string = controller_ready_s; - buffer.used = controller_ready_s_length; + buffer = controller_ready_s; break; case controller_entry_action_type_reload_e: - buffer.string = controller_reload_s; - buffer.used = controller_reload_s_length; + buffer = controller_reload_s; break; case controller_entry_action_type_restart_e: - buffer.string = controller_restart_s; - buffer.used = controller_restart_s_length; + buffer = controller_restart_s; break; case controller_entry_action_type_resume_e: - buffer.string = controller_resume_s; - buffer.used = controller_resume_s_length; + buffer = controller_resume_s; break; case controller_entry_action_type_start_e: - buffer.string = controller_start_s; - buffer.used = controller_start_s_length; + buffer = controller_start_s; break; case controller_entry_action_type_stop_e: - buffer.string = controller_stop_s; - buffer.used = controller_stop_s_length; + buffer = controller_stop_s; break; case controller_entry_action_type_thaw_e: - buffer.string = controller_thaw_s; - buffer.used = controller_thaw_s_length; + buffer = controller_thaw_s; break; case controller_entry_action_type_timeout_e: - buffer.string = controller_timeout_s; - buffer.used = controller_timeout_s_length; + buffer = controller_timeout_s; break; } @@ -251,57 +236,57 @@ extern "C" { break; } - if (fl_string_dynamic_compare_string(controller_consider_s, cache->action.name_action, controller_consider_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(controller_consider_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_consider_e; } - else if (fl_string_dynamic_compare_string(controller_execute_s, cache->action.name_action, controller_execute_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_execute_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_execute_e; } - else if (fl_string_dynamic_compare_string(controller_failsafe_s, cache->action.name_action, controller_failsafe_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_failsafe_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_failsafe_e; } - else if (fl_string_dynamic_compare_string(controller_freeze_s, cache->action.name_action, controller_freeze_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_freeze_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_freeze_e; } - else if (fl_string_dynamic_compare_string(controller_item_s, cache->action.name_action, controller_item_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_item_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_item_e; } - else if (fl_string_dynamic_compare_string(controller_kill_s, cache->action.name_action, controller_kill_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_kill_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_kill_e; } - else if (fl_string_dynamic_compare_string(controller_pause_s, cache->action.name_action, controller_pause_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_pause_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_pause_e; } - else if (fl_string_dynamic_compare_string(controller_ready_s, cache->action.name_action, controller_ready_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_ready_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_ready_e; } - else if (fl_string_dynamic_compare_string(controller_reload_s, cache->action.name_action, controller_reload_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_reload_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_reload_e; } - else if (fl_string_dynamic_compare_string(controller_restart_s, cache->action.name_action, controller_restart_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_restart_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_restart_e; } - else if (fl_string_dynamic_compare_string(controller_resume_s, cache->action.name_action, controller_resume_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_resume_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_resume_e; } - else if (fl_string_dynamic_compare_string(controller_start_s, cache->action.name_action, controller_start_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_start_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_start_e; } - else if (fl_string_dynamic_compare_string(controller_stop_s, cache->action.name_action, controller_stop_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_stop_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_stop_e; } - else if (fl_string_dynamic_compare_string(controller_thaw_s, cache->action.name_action, controller_thaw_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_thaw_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_thaw_e; } - else if (fl_string_dynamic_compare_string(controller_timeout_s, cache->action.name_action, controller_timeout_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_timeout_s, cache->action.name_action) == F_equal_to) { actions->array[actions->used].type = controller_entry_action_type_timeout_e; } else { if (global.main->warning.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global.main->warning.to, global.thread); - fl_print_format("%q%[%SUnknown %s item action '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->warning.context); - fl_print_format("%[%S%]", global.main->warning.to.stream, global.main->warning.notable, cache->action.name_action, global.main->warning.notable); + fl_print_format("%q%[%QUnknown %q item action '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->warning.context); + fl_print_format("%[%Q%]", global.main->warning.to.stream, global.main->warning.notable, cache->action.name_action, global.main->warning.notable); fl_print_format("%['.%]%q", global.main->warning.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s); controller_entry_print_error_cache(is_entry, global.main->warning, cache->action); @@ -346,7 +331,7 @@ extern "C" { flockfile(global.main->error.to.stream); - fl_print_format("%q%[%SThe %s item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); + fl_print_format("%q%[%QThe %q item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, cache->action.name_action, global.main->error.notable); fl_print_format("%[' requires ", global.main->error.to.stream, global.main->error.context); @@ -455,7 +440,7 @@ extern "C" { } if (global.main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%SThe %s item action must not have an empty string for a path (the first parameter).%]%q", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThe %q item action must not have an empty string for a path (the first parameter).%]%q", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context, f_string_eol_s); } } @@ -498,7 +483,7 @@ extern "C" { flockfile(global.main->error.to.stream); - fl_print_format("%q%[%SThe %s item action second parameter '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); + fl_print_format("%q%[%QThe %q item action second parameter '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, action->parameters.array[1], global.main->error.notable); fl_print_format("%[' must be a base path name, such as '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_path, global.main->error.notable); @@ -523,19 +508,19 @@ extern "C" { } if (global.main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%SThe %s item action must not have an empty string for a rule name (the second parameter).%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThe %q item action must not have an empty string for a rule name (the second parameter).%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context, f_string_eol_s); } } for (j = 2; j < action->parameters.used; ++j) { - if (fl_string_dynamic_compare_string(controller_asynchronous_s, action->parameters.array[j], controller_asynchronous_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(controller_asynchronous_s, action->parameters.array[j]) == F_equal_to) { action->code |= controller_entry_rule_code_asynchronous_d; } - else if (fl_string_dynamic_compare_string(controller_require_s, action->parameters.array[j], controller_require_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_require_s, action->parameters.array[j]) == F_equal_to) { action->code |= controller_entry_rule_code_require_d; } - else if (fl_string_dynamic_compare_string(controller_wait_s, action->parameters.array[j], controller_wait_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_wait_s, action->parameters.array[j]) == F_equal_to) { action->code |= controller_entry_rule_code_wait_d; } else { @@ -550,12 +535,12 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(global.main->error.to.stream); - fl_print_format("%q%[%SThe %s item action third parameter (and beyond) must be one of '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_asynchronous_s, global.main->error.notable); + fl_print_format("%q%[%QThe %q item action third parameter (and beyond) must be one of '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_asynchronous_s, global.main->error.notable); fl_print_format("%[', '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_require_s, global.main->error.notable); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_require_s, global.main->error.notable); fl_print_format("%[', or '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_wait_s, global.main->error.notable); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_wait_s, global.main->error.notable); fl_print_format("%[' but instead has '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, action->parameters.array[j], global.main->error.notable); fl_print_format("%['.%]", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -566,7 +551,7 @@ extern "C" { } // for } else if (action->type == controller_entry_action_type_failsafe_e || action->type == controller_entry_action_type_item_e) { - if (fl_string_dynamic_compare_string(controller_main_s, action->parameters.array[0], controller_main_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(controller_main_s, action->parameters.array[0]) == F_equal_to) { action->status = F_status_set_error(F_supported_not); if (F_status_is_error_not(status_action)) { @@ -576,8 +561,8 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(global.main->error.to.stream); - fl_print_format("%q%[%SThe %s item action may not specify the reserved item '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_main_s, global.main->error.notable); + fl_print_format("%q%[%QThe %q item action may not specify the reserved item '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_main_s, global.main->error.notable); fl_print_format("%['.%]", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); funlockfile(global.main->error.to.stream); @@ -586,13 +571,13 @@ extern "C" { } else if (action->type == controller_entry_action_type_timeout_e) { - if (fl_string_dynamic_compare_string(controller_kill_s, action->parameters.array[0], controller_kill_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(controller_kill_s, action->parameters.array[0]) == F_equal_to) { action->code = controller_entry_timeout_code_kill_d; } - else if (fl_string_dynamic_compare_string(controller_start_s, action->parameters.array[0], controller_start_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_start_s, action->parameters.array[0]) == F_equal_to) { action->code = controller_entry_timeout_code_start_d; } - else if (fl_string_dynamic_compare_string(controller_stop_s, action->parameters.array[0], controller_stop_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_stop_s, action->parameters.array[0]) == F_equal_to) { action->code = controller_entry_timeout_code_stop_d; } else { @@ -605,12 +590,12 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(global.main->error.to.stream); - fl_print_format("%q%[%SThe %s item action must have one of '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_kill_s, global.main->error.notable); + fl_print_format("%q%[%QThe %q item action must have one of '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_kill_s, global.main->error.notable); fl_print_format("%[', '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_start_s, global.main->error.notable); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_start_s, global.main->error.notable); fl_print_format("%[', or '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_stop_s, global.main->error.notable); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_stop_s, global.main->error.notable); fl_print_format("%[' but instead has '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, action->parameters.array[0], global.main->error.notable); fl_print_format("%['.%]", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -644,7 +629,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(global.main->error.to.stream); - fl_print_format("%q%[%SThe %s item action parameter '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); + fl_print_format("%q%[%QThe %q item action parameter '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, action->parameters.array[1], global.main->error.notable); fl_print_format("%[' is not a valid supported number.%]", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -655,7 +640,7 @@ extern "C" { } else if (action->type == controller_entry_action_type_ready_e) { if (action->parameters.used) { - if (fl_string_dynamic_compare_string(controller_wait_s, action->parameters.array[0], controller_wait_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(controller_wait_s, action->parameters.array[0]) == F_equal_to) { action->code |= controller_entry_rule_code_wait_d; } else { @@ -664,8 +649,8 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(global.main->error.to.stream); - fl_print_format("%q%[%SThe %s item action may only have '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_wait_s, global.main->error.notable); + fl_print_format("%q%[%QThe %q item action may only have '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_wait_s, global.main->error.notable); fl_print_format("%[' but instead has '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, action->parameters.array[0], global.main->error.notable); fl_print_format("%['.%]", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -766,9 +751,9 @@ extern "C" { if (global.main->warning.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global.main->warning.to, global.thread); - fl_print_format("%q%[%SMultiple '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context); - fl_print_format("%[%s%]", global.main->warning.to.stream, global.main->warning.notable, controller_ready_s, global.main->warning.notable); - fl_print_format("%[' %s item actions detected; only the first will be used.%]%q", global.main->warning.to.stream, global.main->warning.context, is_entry ? controller_entry_s : controller_exit_s, global.main->warning.context, f_string_eol_s); + fl_print_format("%q%[%QMultiple '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context); + fl_print_format("%[%q%]", global.main->warning.to.stream, global.main->warning.notable, controller_ready_s, global.main->warning.notable); + fl_print_format("%[' %q item actions detected; only the first will be used.%]%q", global.main->warning.to.stream, global.main->warning.context, is_entry ? controller_entry_s : controller_exit_s, global.main->warning.context, f_string_eol_s); controller_entry_print_error_cache(is_entry, global.main->warning, cache->action); @@ -783,10 +768,10 @@ extern "C" { error_has = F_false; // "main" is not allowed to be used for an "item" and "setting" is not an executable "item". - if (fl_string_dynamic_compare_string(controller_main_s, actions->array[cache->ats.array[at_j]].parameters.array[0], controller_main_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(controller_main_s, actions->array[cache->ats.array[at_j]].parameters.array[0]) == F_equal_to) { continue; } - else if (fl_string_dynamic_compare_string(controller_setting_s, actions->array[cache->ats.array[at_j]].parameters.array[0], controller_setting_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_setting_s, actions->array[cache->ats.array[at_j]].parameters.array[0]) == F_equal_to) { continue; } @@ -802,7 +787,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SThe %s item named '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, is_entry ? controller_entry_s : controller_exit_s, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QThe %q item named '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, is_entry ? controller_entry_s : controller_exit_s, global.main->error.prefix, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, entry->items.array[i].name, global.main->error.notable); fl_print_format("%[' cannot be executed because recursion is not allowed.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -864,7 +849,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SThe %s item named '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, is_entry ? controller_entry_s : controller_exit_s, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QThe %q item named '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, is_entry ? controller_entry_s : controller_exit_s, global.main->error.prefix, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, actions->array[cache->ats.array[at_j]].parameters.array[0], global.main->error.notable); fl_print_format("%[' does not exist.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -984,7 +969,7 @@ extern "C" { if (global->main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%qProcessing %s%s item '", global->main->output.to.stream, f_string_eol_s, failsafe ? "failsafe " : "", is_entry ? controller_entry_s : controller_exit_s); + fl_print_format("%qProcessing %q%q item '", global->main->output.to.stream, f_string_eol_s, failsafe ? controller_entry_print_failsafe_s : f_string_empty_s, is_entry ? controller_entry_s : controller_exit_s); fl_print_format("%[%Q%]'.%q", global->main->output.to.stream, global->main->context.set.notable, cache->action.name_item, global->main->context.set.notable, f_string_eol_s); controller_unlock_print_flush(global->main->output.to, global->thread); @@ -1021,7 +1006,7 @@ extern "C" { if (global->main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%qThe %s item action '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); + fl_print_format("%qThe %q item action '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.title, cache->action.name_action, global->main->context.set.title); if (entry_action->parameters.used) { @@ -1032,7 +1017,7 @@ extern "C" { fl_print_format("%]", global->main->output.to.stream, global->main->context.set.notable); } - fl_print_format("' is %[%s%] and is in a ", global->main->output.to.stream, global->main->context.set.notable, entry_action->code & controller_entry_rule_code_require_d ? "required" : "optional", global->main->context.set.notable); + fl_print_format("' is %[%q%] and is in a ", global->main->output.to.stream, global->main->context.set.notable, entry_action->code & controller_entry_rule_code_require_d ? "required" : "optional", global->main->context.set.notable); fl_print_format("%[failed%] state, skipping.%q", global->main->output.to.stream, global->main->context.set.notable, global->main->context.set.notable, global->main->context.set.notable, f_string_eol_s); @@ -1052,7 +1037,7 @@ extern "C" { controller_lock_print(output->to, global->thread); - fl_print_format("%q%[%QThe %s item action '%]", output->to.stream, f_string_eol_s, output->context, output->prefix ? output->prefix : f_string_empty_s, is_entry ? controller_entry_s : controller_exit_s, output->context); + fl_print_format("%q%[%QThe %q item action '%]", output->to.stream, f_string_eol_s, output->context, output->prefix, is_entry ? controller_entry_s : controller_exit_s, output->context); fl_print_format("%[%Q%]", output->to.stream, output->notable, cache->action.name_action, output->notable); @@ -1099,8 +1084,8 @@ extern "C" { if (global->main->output.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%qWaiting before processing %s item action '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); - fl_print_format("%[%s%]", global->main->output.to.stream, global->main->context.set.title, controller_ready_s, global->main->context.set.title); + fl_print_format("%qWaiting before processing %q item action '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); + fl_print_format("%[%q%]", global->main->output.to.stream, global->main->context.set.title, controller_ready_s, global->main->context.set.title); fl_print_format("'.%q", global->main->output.to.stream, f_string_eol_s); controller_unlock_print_flush(global->main->output.to, global->thread); @@ -1118,8 +1103,8 @@ extern "C" { if (global->main->output.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%qIgnoring %s item action '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); - fl_print_format("%[%s%]", global->main->output.to.stream, global->main->context.set.title, controller_ready_s, global->main->context.set.title); + fl_print_format("%qIgnoring %q item action '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); + fl_print_format("%[%q%]", global->main->output.to.stream, global->main->context.set.title, controller_ready_s, global->main->context.set.title); fl_print_format("', state already is ready.%q", global->main->output.to.stream, f_string_eol_s); controller_unlock_print_flush(global->main->output.to, global->thread); @@ -1128,7 +1113,7 @@ extern "C" { } else { if (!failsafe && (global->main->error.verbosity == f_console_verbosity_verbose_e || entry->show == controller_entry_show_init_e) && global->main->parameters[controller_parameter_simulate_e].result == f_console_result_none_e) { - fl_print_format("%qState is now '%[%s%]'.%q", global->main->output.to.stream, f_string_eol_s, global->main->context.set.notable, controller_ready_s, global->main->context.set.notable, f_string_eol_s); + fl_print_format("%qState is now '%[%q%]'.%q", global->main->output.to.stream, f_string_eol_s, global->main->context.set.notable, controller_ready_s, global->main->context.set.notable, f_string_eol_s); } status = controller_perform_ready(global, cache, is_entry); @@ -1142,7 +1127,7 @@ extern "C" { if (global->main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->error.to, global->thread); - fl_print_format("%q%[Invalid %s item index '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, is_entry ? controller_entry_s : controller_exit_s, global->main->error.context); + fl_print_format("%q%[Invalid %q item index '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, is_entry ? controller_entry_s : controller_exit_s, global->main->error.context); fl_print_format("%[%un%]", global->main->error.to.stream, global->main->error.notable, entry_action->number, global->main->error.notable); fl_print_format("%[' detected.%]%q", global->main->error.to.stream, global->main->error.context, global->main->error.context, f_string_eol_s); @@ -1189,7 +1174,7 @@ extern "C" { if (global->main->output.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%qProcessing %s item '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); + fl_print_format("%qProcessing %q item '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.title, cache->action.name_item, global->main->context.set.title); fl_print_format("'.%q", global->main->output.to.stream, f_string_eol_s); @@ -1245,18 +1230,18 @@ extern "C" { if (global->main->output.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%q%s %s item rule ", global->main->output.to.stream, f_string_eol_s, entry_action->type == controller_entry_action_type_consider_e ? "Considering" : "Processing", is_entry ? controller_entry_s : controller_exit_s); + fl_print_format("%q%q %q item rule ", global->main->output.to.stream, f_string_eol_s, entry_action->type == controller_entry_action_type_consider_e ? controller_entry_print_considering_s : controller_entry_print_processing_s, is_entry ? controller_entry_s : controller_exit_s); fl_print_format("'%[%Q%]'", global->main->output.to.stream, global->main->context.set.title, alias_rule, global->main->context.set.title); if (entry->show == controller_entry_show_init_e && global->main->parameters[controller_parameter_simulate_e].result == f_console_result_none_e) { - fl_print_format(" [%[%s%]]", global->main->output.to.stream, global->main->context.set.notable, entry_action->code == controller_entry_rule_code_asynchronous_d ? controller_asynchronous_s : controller_synchronous_s, global->main->context.set.notable); + fl_print_format(" [%[%q%]]", global->main->output.to.stream, global->main->context.set.notable, entry_action->code == controller_entry_rule_code_asynchronous_d ? controller_asynchronous_s : controller_synchronous_s, global->main->context.set.notable); if (entry_action->code == controller_entry_rule_code_wait_d) { - fl_print_format(" [%[%s%]]", global->main->output.to.stream, global->main->context.set.notable, controller_wait_s, global->main->context.set.notable); + fl_print_format(" [%[%q%]]", global->main->output.to.stream, global->main->context.set.notable, controller_wait_s, global->main->context.set.notable); } if (entry_action->code == controller_entry_rule_code_require_d) { - fl_print_format(" [%[%s%]]", global->main->output.to.stream, global->main->context.set.notable, controller_required_s, global->main->context.set.notable); + fl_print_format(" [%[%q%]]", global->main->output.to.stream, global->main->context.set.notable, controller_required_s, global->main->context.set.notable); } } @@ -1311,6 +1296,7 @@ extern "C" { if (F_status_is_error(status_lock)) { controller_lock_print_error_critical(global->main->error, F_status_set_fine(status_lock), F_false, global->thread); + break; } @@ -1394,7 +1380,7 @@ extern "C" { if (global->main->output.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%q%s is executing '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); + fl_print_format("%q%Q is executing '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); for (f_array_length_t k = 0; k < entry_action->parameters.used; ++k) { @@ -1431,7 +1417,7 @@ extern "C" { if (global->main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->error.to, global->thread); - fl_print_format("%q%[%SExecution failed, unable to find program or script '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, global->main->error.prefix ? global->main->error.prefix : f_string_empty_s, global->main->error.context); + fl_print_format("%q%[%QExecution failed, unable to find program or script '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, global->main->error.prefix, global->main->error.context); fl_print_format("%[%Q%]", global->main->error.to.stream, global->main->error.notable, entry_action->parameters.array[0], global->main->error.notable); fl_print_format("%['.%]%q", global->main->error.to.stream, global->main->error.context, global->main->error.context, f_string_eol_s); @@ -1450,7 +1436,7 @@ extern "C" { if (global->main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->error.to, global->thread); - fl_print_format("%q%[%SExecution failed with return value of '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, global->main->error.prefix ? global->main->error.prefix : f_string_empty_s, global->main->error.context); + fl_print_format("%q%[%QExecution failed with return value of '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, global->main->error.prefix, global->main->error.context); fl_print_format("%[%i%]", global->main->error.to.stream, global->main->error.notable, result, global->main->error.notable); fl_print_format("$['.%]%q", global->main->error.to.stream, global->main->error.context, global->main->error.context, f_string_eol_s); @@ -1465,22 +1451,20 @@ extern "C" { return F_execute; } else if (entry_action->type == controller_entry_action_type_timeout_e) { - const f_string_t suffix = " MegaTime (milliseconds)"; - if (entry_action->code == controller_entry_timeout_code_kill_d) { entry->timeout_kill = entry_action->number; - controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_timeout_s, controller_kill_s, entry->items.array[global->setting->failsafe_item_id].name, suffix); + controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_timeout_s, controller_kill_s, entry->items.array[global->setting->failsafe_item_id].name, controller_entry_print_suffix_megatime_s); } else if (entry_action->code == controller_entry_timeout_code_start_d) { entry->timeout_start = entry_action->number; - controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_timeout_s, controller_start_s, entry->items.array[global->setting->failsafe_item_id].name, suffix); + controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_timeout_s, controller_start_s, entry->items.array[global->setting->failsafe_item_id].name, controller_entry_print_suffix_megatime_s); } else if (entry_action->code == controller_entry_timeout_code_stop_d) { entry->timeout_stop = entry_action->number; - controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_timeout_s, controller_stop_s, entry->items.array[global->setting->failsafe_item_id].name, suffix); + controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_timeout_s, controller_stop_s, entry->items.array[global->setting->failsafe_item_id].name, controller_entry_print_suffix_megatime_s); } } else if (entry_action->type == controller_entry_action_type_failsafe_e) { @@ -1489,7 +1473,7 @@ extern "C" { if (global->main->warning.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global->main->warning.to, global->thread); - fl_print_format("%q%[%SFailsafe may not be specified when running in failsafe, ignoring.%]%q", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context, f_string_eol_s); + fl_print_format("%q%[%QFailsafe may not be specified when running in failsafe, ignoring.%]%q", global->main->warning.to.stream, f_string_eol_s, global->main->warning.context, global->main->warning.prefix, global->main->warning.context, f_string_eol_s); controller_entry_print_error_cache(is_entry, global->main->warning, cache->action); @@ -1503,7 +1487,7 @@ extern "C" { if (global->main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->error.to, global->thread); - fl_print_format("%q%[%SInvalid %s item index '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, global->main->error.prefix ? global->main->error.prefix : f_string_empty_s, is_entry ? controller_entry_s : controller_exit_s, global->main->error.context); + fl_print_format("%q%[%QInvalid %q item index '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, global->main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global->main->error.context); fl_print_format("%[%un%]", global->main->error.to.stream, global->main->error.notable, entry_action->number, global->main->error.notable); fl_print_format("%[' detected.%]%q", global->main->error.to.stream, global->main->error.context, global->main->error.context, f_string_eol_s); @@ -1518,7 +1502,7 @@ extern "C" { global->setting->failsafe_enabled = F_true; global->setting->failsafe_item_id = entry_action->number; - controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_failsafe_s, 0, entry->items.array[global->setting->failsafe_item_id].name, 0); + controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_failsafe_s, f_string_empty_s, entry->items.array[global->setting->failsafe_item_id].name, f_string_empty_s); } } } @@ -1588,13 +1572,13 @@ extern "C" { if ((global->main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e && global->main->error.verbosity != f_console_verbosity_quiet_e) || global->main->error.verbosity == f_console_verbosity_verbose_e) { controller_lock_print(global->main->output.to, global->thread); - fl_print_format("%qDone processing %s item '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); - fl_print_format("%[%s%]", global->main->output.to.stream, global->main->context.set.title, controller_main_s, global->main->context.set.title); + fl_print_format("%qDone processing %q item '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); + fl_print_format("%[%q%]", global->main->output.to.stream, global->main->context.set.title, controller_main_s, global->main->context.set.title); fl_print_format("'.%q", global->main->output.to.stream, f_string_eol_s); // failsafe should not print the extra newline because the failure exit from controller_main should handle this. if (!failsafe) { - f_print_terminated(f_string_eol_s, global->main->output.to.stream); + f_print_dynamic(f_string_eol_s, global->main->output.to.stream); } controller_unlock_print_flush(global->main->output.to, global->thread); @@ -1657,10 +1641,10 @@ extern "C" { cache->action.name_item.used = 0; if (is_entry) { - status = controller_file_load(global, F_true, controller_entries_s, global.setting->name_entry, controller_entry_s, controller_entries_s_length, controller_entry_s_length, cache); + status = controller_file_load(global, F_true, controller_entries_s, global.setting->name_entry, controller_entry_s, cache); } else { - status = controller_file_load(global, F_false, controller_exits_s, global.setting->name_entry, controller_exit_s, controller_exits_s_length, controller_exit_s_length, cache); + status = controller_file_load(global, F_false, controller_exits_s, global.setting->name_entry, controller_exit_s, cache); if (status == F_file_found_not) { return F_file_found_not; @@ -1690,7 +1674,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fll_print_format("%q%[%SThe %s file is empty.%]%q", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : is_entry ? controller_entry_s : controller_exit_s, global.main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThe %q file is empty.%]%q", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : is_entry ? controller_entry_s : controller_exit_s, global.main->error.context, f_string_eol_s); controller_unlock_print_flush(global.main->error.to, global.thread); } @@ -1770,7 +1754,7 @@ extern "C" { if (global.main->warning.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global.main->warning.to, global.thread); - fl_print_format("%q%[%SIgnoring duplicate %s item '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->warning.context); + fl_print_format("%q%[%QIgnoring duplicate %q item '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->warning.context); fl_print_format("%[%Q%]", global.main->warning.to.stream, global.main->warning.notable, cache->action.name_file, global.main->warning.notable); fl_print_format("%['.%]%q", global.main->warning.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s); @@ -1788,7 +1772,7 @@ extern "C" { range = &cache->content_items.array[i].array[0]; - if (fl_string_dynamic_compare_string(controller_main_s, cache->action.name_item, controller_main_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(controller_main_s, cache->action.name_item) == F_equal_to) { code |= 0x1; at = 0; @@ -1797,7 +1781,7 @@ extern "C" { entry->items.used = 1; } } - else if (fl_string_dynamic_compare_string(controller_setting_s, cache->action.name_item, controller_setting_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_setting_s, cache->action.name_item) == F_equal_to) { status = controller_entry_settings_read(global, is_entry, *range, cache); continue; @@ -1853,8 +1837,8 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SThe required %s item '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_main_s, global.main->error.notable); + fl_print_format("%q%[%QThe required %q item '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_main_s, global.main->error.notable); fl_print_format("%[' was not found.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); controller_unlock_print_flush(global.main->error.to, global.thread); @@ -1915,7 +1899,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SThe required %s item '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); + fl_print_format("%q%[%QThe required %q item '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, action->parameters.array[0], global.main->error.notable); fl_print_format("%[' does not exist.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -2012,7 +1996,7 @@ extern "C" { break; } - if (is_entry && fl_string_dynamic_compare_string(controller_control_s, cache->action.name_action, controller_control_s_length) == F_equal_to) { + if (is_entry && fl_string_dynamic_compare(controller_control_s, cache->action.name_action) == F_equal_to) { if (cache->content_actions.array[i].used != 1) { controller_entry_settings_read_print_setting_requires_exactly(global, is_entry, *cache, 1); @@ -2045,18 +2029,12 @@ extern "C" { break; } - status = f_string_append(f_path_separator_s, 1, &cache->action.generic); - - if (F_status_is_error(status)) { - controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_append", F_true, global.thread); + status = f_string_dynamic_append(f_path_separator_s, &cache->action.generic); - global.setting->path_control.used = 0; - - break; + if (F_status_is_error_not(status)) { + status = f_string_dynamic_append(global.setting->path_control, &cache->action.generic); } - status = f_string_dynamic_append(global.setting->path_control, &cache->action.generic); - if (F_status_is_error(status)) { controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_append", F_true, global.thread); @@ -2097,7 +2075,7 @@ extern "C" { continue; } } - else if (is_entry && fl_string_dynamic_compare_string(controller_control_group_s, cache->action.name_action, controller_control_group_s_length) == F_equal_to) { + else if (is_entry && fl_string_dynamic_compare(controller_control_group_s, cache->action.name_action) == F_equal_to) { gid_t number = 0; status = controller_get_id_group(cache->buffer_file, cache->content_actions.array[i].array[0], cache, &number); @@ -2123,7 +2101,7 @@ extern "C" { global.setting->control_group = number; } - else if (is_entry && fl_string_dynamic_compare_string(controller_control_mode_s, cache->action.name_action, controller_control_mode_s_length) == F_equal_to) { + else if (is_entry && fl_string_dynamic_compare(controller_control_mode_s, cache->action.name_action) == F_equal_to) { mode_t mode = 0; uint8_t replace = 0; f_file_mode_t mode_file = f_file_mode_t_initialize; @@ -2156,7 +2134,7 @@ extern "C" { global.setting->control_mode = mode; } - else if (is_entry && fl_string_dynamic_compare_string(controller_control_user_s, cache->action.name_action, controller_control_user_s_length) == F_equal_to) { + else if (is_entry && fl_string_dynamic_compare(controller_control_user_s, cache->action.name_action) == F_equal_to) { uid_t number = 0; status = controller_get_id_user(cache->buffer_file, cache->content_actions.array[i].array[0], cache, &number); @@ -2182,17 +2160,17 @@ extern "C" { global.setting->control_user = number; } - else if (is_entry && fl_string_dynamic_compare_string(controller_mode_s, cache->action.name_action, controller_mode_s_length) == F_equal_to) { + else if (is_entry && fl_string_dynamic_compare(controller_mode_s, cache->action.name_action) == F_equal_to) { if (cache->content_actions.array[i].used != 1) { controller_entry_settings_read_print_setting_requires_exactly(global, is_entry, *cache, 1); continue; } - if (fl_string_dynamic_partial_compare_string(controller_service_s, cache->buffer_file, controller_service_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_service_s.string, cache->buffer_file, controller_service_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { global.setting->mode = controller_setting_mode_service_e; } - else if (fl_string_dynamic_partial_compare_string(controller_program_s, cache->buffer_file, controller_program_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_program_s.string, cache->buffer_file, controller_program_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { global.setting->mode = controller_setting_mode_program_e; } else { @@ -2201,20 +2179,20 @@ extern "C" { continue; } } - else if (fl_string_dynamic_compare_string(controller_pid_s, cache->action.name_action, controller_pid_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_pid_s, cache->action.name_action) == F_equal_to) { if (cache->content_actions.array[i].used != 1) { controller_entry_settings_read_print_setting_requires_exactly(global, is_entry, *cache, 1); continue; } - if (fl_string_dynamic_partial_compare_string(controller_disable_s, cache->buffer_file, controller_disable_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_disable_s.string, cache->buffer_file, controller_disable_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { entry->pid = controller_entry_pid_disable_e; } - else if (fl_string_dynamic_partial_compare_string(controller_ready_s, cache->buffer_file, controller_ready_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_ready_s.string, cache->buffer_file, controller_ready_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { entry->pid = controller_entry_pid_ready_e; } - else if (fl_string_dynamic_partial_compare_string(controller_require_s, cache->buffer_file, controller_require_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_require_s.string, cache->buffer_file, controller_require_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { entry->pid = controller_entry_pid_require_e; } else { @@ -2223,17 +2201,17 @@ extern "C" { continue; } } - else if (fl_string_dynamic_compare_string(controller_session_s, cache->action.name_action, controller_session_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_session_s, cache->action.name_action) == F_equal_to) { if (cache->content_actions.array[i].used != 1) { controller_entry_settings_read_print_setting_requires_exactly(global, is_entry, *cache, 1); continue; } - if (fl_string_dynamic_partial_compare_string(controller_new_s, cache->buffer_file, controller_new_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_new_s.string, cache->buffer_file, controller_new_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { entry->session = controller_entry_session_new_e; } - else if (fl_string_dynamic_partial_compare_string(controller_same_s, cache->buffer_file, controller_same_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_same_s.string, cache->buffer_file, controller_same_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { entry->session = controller_entry_session_same_e; } else { @@ -2242,17 +2220,17 @@ extern "C" { continue; } } - else if (fl_string_dynamic_compare_string(controller_show_s, cache->action.name_action, controller_show_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_show_s, cache->action.name_action) == F_equal_to) { if (cache->content_actions.array[i].used != 1) { controller_entry_settings_read_print_setting_requires_exactly(global, is_entry, *cache, 1); continue; } - if (fl_string_dynamic_partial_compare_string(controller_normal_s, cache->buffer_file, controller_normal_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_normal_s.string, cache->buffer_file, controller_normal_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { entry->show = controller_entry_show_normal_e; } - else if (fl_string_dynamic_partial_compare_string(controller_init_s, cache->buffer_file, controller_init_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_init_s.string, cache->buffer_file, controller_init_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { entry->show = controller_entry_show_init_e; } else { diff --git a/level_3/controller/c/entry/private-entry_print.c b/level_3/controller/c/entry/private-entry_print.c index 23ec05c..2f4930d 100644 --- a/level_3/controller/c/entry/private-entry_print.c +++ b/level_3/controller/c/entry/private-entry_print.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../entry/private-entry_print.h" #include "../lock/private-lock_print.h" @@ -7,6 +7,13 @@ extern "C" { #endif +#ifndef _di_controller_entry_print_string_s_ + const f_string_static_t controller_entry_print_considering_s = macro_f_string_static_t_initialize2(CONTROLLER_entry_print_considering_s, 0, CONTROLLER_entry_print_considering_s_length); + const f_string_static_t controller_entry_print_failsafe_s = macro_f_string_static_t_initialize2(CONTROLLER_entry_print_failsafe_s, 0, CONTROLLER_entry_print_failsafe_s_length); + const f_string_static_t controller_entry_print_processing_s = macro_f_string_static_t_initialize2(CONTROLLER_entry_print_processing_s, 0, CONTROLLER_entry_print_processing_s_length); + const f_string_static_t controller_entry_print_suffix_megatime_s = macro_f_string_static_t_initialize2(CONTROLLER_entry_print_suffix_megatime_s, 0, CONTROLLER_entry_print_suffix_megatime_s_length); +#endif // _di_controller_entry_print_string_s_ + #ifndef _di_controller_entry_action_parameters_print_ void controller_entry_action_parameters_print(FILE * const stream, const controller_entry_action_t action) { @@ -18,13 +25,13 @@ extern "C" { if (index == action.parameters.used) break; - f_print_terminated(f_string_space_s, stream); + f_print_dynamic(f_string_space_s, stream); } // for } #endif // _di_controller_entry_action_parameters_print_ #ifndef _di_controller_entry_preprocess_print_simulate_setting_value_ - void controller_entry_preprocess_print_simulate_setting_value(const controller_global_t global, const bool is_entry, const f_string_t name, const f_string_t name_sub, const f_string_static_t value, const f_string_t suffix) { + void controller_entry_preprocess_print_simulate_setting_value(const controller_global_t global, const bool is_entry, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_static_t suffix) { if (global.main->error.verbosity != f_console_verbosity_debug_e && !(global.main->error.verbosity == f_console_verbosity_verbose_e && global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e)) { return; @@ -32,12 +39,12 @@ extern "C" { controller_lock_print(global.main->output.to, global.thread); - fl_print_format("%qProcessing %s item action '", global.main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); + fl_print_format("%qProcessing %q item action '", global.main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s); - fl_print_format("%[%S%]' setting ", global.main->output.to.stream, global.main->context.set.title, name, global.main->context.set.title); + fl_print_format("%[%Q%]' setting ", global.main->output.to.stream, global.main->context.set.title, name, global.main->context.set.title); - if (name_sub) { - fl_print_format("'%[%S%]'", global.main->output.to.stream, global.main->context.set.notable, name_sub, global.main->context.set.notable); + if (name_sub.used) { + fl_print_format("'%[%Q%]'", global.main->output.to.stream, global.main->context.set.notable, name_sub, global.main->context.set.notable); } else { fl_print_format("value", global.main->output.to.stream); @@ -45,7 +52,7 @@ extern "C" { fl_print_format(" to '%[%Q%]", global.main->output.to.stream, global.main->context.set.important, value, global.main->context.set.important); - fl_print_format("'%S.%q", global.main->output.to.stream, suffix, f_string_eol_s); + fl_print_format("'%Q.%q", global.main->output.to.stream, suffix, f_string_eol_s); controller_unlock_print_flush(global.main->output.to, global.thread); } @@ -73,7 +80,7 @@ extern "C" { #ifndef _di_controller_entry_print_error_cache_ void controller_entry_print_error_cache(const bool is_entry, const fl_print_t output, const controller_cache_action_t cache) { - fl_print_format("%q%[%SWhile processing ", output.to.stream, f_string_eol_s, output.context, output.prefix); + fl_print_format("%q%[%QWhile processing ", output.to.stream, f_string_eol_s, output.context, output.prefix); if (cache.name_action.used) { fl_print_format("action '%]", output.to.stream, output.context); @@ -84,7 +91,7 @@ extern "C" { } if (cache.name_item.used) { - fl_print_format("%s item '%]", output.to.stream, is_entry ? controller_entry_s : controller_exit_s, output.context); + fl_print_format("%q item '%]", output.to.stream, is_entry ? controller_entry_s : controller_exit_s, output.context); fl_print_format("%[%Q%]", output.to.stream, output.notable, cache.name_item, output.notable); fl_print_format("%[' on line%] ", output.to.stream, output.context, output.context); fl_print_format("%[%un%]", output.to.stream, output.notable, cache.line_item, output.notable); @@ -92,7 +99,7 @@ extern "C" { } if (cache.name_file.used) { - fl_print_format("%s file '%]", output.to.stream, is_entry ? controller_entry_s : controller_exit_s, output.context); + fl_print_format("%q file '%]", output.to.stream, is_entry ? controller_entry_s : controller_exit_s, output.context); fl_print_format("%[%Q%]%['", output.to.stream, output.notable, cache.name_file, output.notable, output.context); } @@ -143,7 +150,7 @@ extern "C" { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SThe %s item setting '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); + fl_print_format("%q%[%QThe %s item setting '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, cache.action.name_action, global.main->error.notable); fl_print_format("%[' requires exactly %]", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[%un%]", global.main->error.to.stream, global.main->error.notable, total, global.main->error.notable); @@ -162,7 +169,7 @@ extern "C" { controller_lock_print(global.main->warning.to, global.thread); - fl_print_format("%q%[%SUnknown %s item setting '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->warning.context); + fl_print_format("%q%[%QUnknown %q item setting '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->warning.context); fl_print_format("%[%Q%]", global.main->warning.to.stream, global.main->warning.notable, cache.action.name_action, global.main->warning.notable); fl_print_format("%['.%]%q", global.main->warning.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s); @@ -179,9 +186,9 @@ extern "C" { controller_lock_print(global.main->warning.to, global.thread); - fl_print_format("%q%[%SThe %s item setting '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->warning.context); + fl_print_format("%q%[%QThe %Q item setting '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->warning.context); fl_print_format("%[%Q%]", global.main->warning.to.stream, global.main->warning.notable, cache.action.name_action, global.main->warning.notable); - fl_print_format("%[' has an unknown value '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->warning.context); + fl_print_format("%[' has an unknown value '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.context); fl_print_format("%[%Q%]", global.main->warning.to.stream, global.main->warning.notable, cache.content_actions.array[index].array[0], global.main->warning.notable); fl_print_format("%['.%]%q", global.main->warning.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s); diff --git a/level_3/controller/c/entry/private-entry_print.h b/level_3/controller/c/entry/private-entry_print.h index 180a9a2..d96678a 100644 --- a/level_3/controller/c/entry/private-entry_print.h +++ b/level_3/controller/c/entry/private-entry_print.h @@ -13,6 +13,26 @@ extern "C" { #endif /** + * Special strings used for printing. + */ +#ifndef _di_controller_entry_print_string_s_ + #define CONTROLLER_entry_print_considering_s "Considering" + #define CONTROLLER_entry_print_failsafe_s "failsafe" + #define CONTROLLER_entry_print_processing_s "Processing" + #define CONTROLLER_entry_print_suffix_megatime_s " MegaTime (milliseconds)" + + #define CONTROLLER_entry_print_considering_s_length 11 + #define CONTROLLER_entry_print_failsafe_s_length 8 + #define CONTROLLER_entry_print_processing_s_length 10 + #define CONTROLLER_entry_print_suffix_megatime_s_length 24 + + extern const f_string_static_t controller_entry_print_considering_s; + extern const f_string_static_t controller_entry_print_failsafe_s; + extern const f_string_static_t controller_entry_print_processing_s; + extern const f_string_static_t controller_entry_print_suffix_megatime_s; +#endif // _di_controller_entry_print_string_s_ + +/** * Print all parameters for some action, separated by a space. * * @param stream @@ -35,15 +55,15 @@ extern "C" { * @param name * The Object name of the setting being populated. * @param name_sub - * (optional) A sub-name associated with the setting being populated. - * Set to NULL to disable. + * A sub-name associated with the setting being populated. + * Set to a string with used set to 0 to not use. * @param value * The value being set. * @param suffix * An additional message to append at the end (before the final period). */ #ifndef _di_controller_entry_preprocess_print_simulate_setting_value_ - extern void controller_entry_preprocess_print_simulate_setting_value(const controller_global_t global, const bool is_entry, const f_string_t name, const f_string_t name_sub, const f_string_static_t value, const f_string_t suffix) F_attribute_visibility_internal_d; + extern void controller_entry_preprocess_print_simulate_setting_value(const controller_global_t global, const bool is_entry, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_static_t suffix) F_attribute_visibility_internal_d; #endif // _di_controller_entry_preprocess_print_simulate_setting_value_ /** diff --git a/level_3/controller/c/lock/private-lock.c b/level_3/controller/c/lock/private-lock.c index 6717c3e..ecc0e52 100644 --- a/level_3/controller/c/lock/private-lock.c +++ b/level_3/controller/c/lock/private-lock.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../controller/private-controller.h" #include "../lock/private-lock.h" diff --git a/level_3/controller/c/lock/private-lock_print.c b/level_3/controller/c/lock/private-lock_print.c index 17de5f5..639ef8c 100644 --- a/level_3/controller/c/lock/private-lock_print.c +++ b/level_3/controller/c/lock/private-lock_print.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../lock/private-lock_print.h" @@ -15,7 +15,7 @@ extern "C" { if (print.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(print.to, thread); - fl_print_format("%q%[%QThe pid file '%]", print.to.stream, f_string_eol_s, print.context, print.prefix ? print.prefix : f_string_empty_s, print.context); + fl_print_format("%q%[%QThe pid file '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context); fl_print_format("%['Critical failure while attempting to establish '%]", print.to.stream, print.context, print.context); fl_print_format("%[%s lock%]", print.to.stream, print.notable, read ? "read" : "write", print.notable); diff --git a/level_3/controller/c/main.c b/level_3/controller/c/main.c index 3bc632c..f91fbfb 100644 --- a/level_3/controller/c/main.c +++ b/level_3/controller/c/main.c @@ -1,4 +1,4 @@ -#include "controller/controller.h" +#include "controller.h" int main(const int argc, const f_string_t *argv) { @@ -11,36 +11,11 @@ int main(const int argc, const f_string_t *argv) { data.pid = getpid(); - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); + fll_program_standard_setup(&data.signal); - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); + f_file_umask_get(&data.umask); - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } - - // @fixme bad design in POSIX where there is no get umask without setting it. - data.umask = umask(0); - - // Restore umask. - umask(data.umask); - - // when run as "init" by default, provide the default system-level init path. + // When run as "init" by default, provide the default system-level init path. // This change must only exist within this main file so that the change only exists within the program rather than the library. #ifdef _controller_as_init_ data.program_name = &controller_program_name_init_s; @@ -59,25 +34,14 @@ int main(const int argc, const f_string_t *argv) { const f_status_t status = controller_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); - - f_signal_close(&data.signal); + fll_program_standard_setdown(&data.signal); // When the child process exits, it must return the code to the parent so the parent knows how to handle the exit. if (status == F_child) { exit(data.child); } - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/controller/c/process/private-process.c b/level_3/controller/c/process/private-process.c index 304f834..20419e1 100644 --- a/level_3/controller/c/process/private-process.c +++ b/level_3/controller/c/process/private-process.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../controller/private-controller.h" #include "../lock/private-lock.h" diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index b9972cb..6decd60 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../controller/private-controller.h" #include "../controller/private-controller_print.h" @@ -22,18 +22,14 @@ extern "C" { switch (type) { case controller_rule_action_method_extended_e: - buffer.string = controller_rule_action_method_string_extended_s; - buffer.used = controller_rule_action_method_string_extended_s_length; + buffer = controller_rule_action_method_string_extended_s; break; case controller_rule_action_method_extended_list_e: - buffer.string = controller_rule_action_method_string_extended_list_s; - buffer.used = controller_rule_action_method_string_extended_list_s_length; + buffer = controller_rule_action_method_string_extended_list_s; break; } - buffer.size = buffer.used; - return buffer; } #endif // _di_controller_rule_action_method_name_ @@ -185,73 +181,59 @@ extern "C" { switch (type) { case controller_rule_action_type_freeze_e: - buffer.string = controller_freeze_s; - buffer.used = controller_freeze_s_length; + buffer = controller_freeze_s; break; case controller_rule_action_type_group_e: - buffer.string = controller_group_s; - buffer.used = controller_group_s_length; + buffer = controller_group_s; break; case controller_rule_action_type_kill_e: - buffer.string = controller_kill_s; - buffer.used = controller_kill_s_length; + buffer = controller_kill_s; break; case controller_rule_action_type_pause_e: - buffer.string = controller_pause_s; - buffer.used = controller_pause_s_length; + buffer = controller_pause_s; break; case controller_rule_action_type_pid_file_e: - buffer.string = controller_pid_file_s; - buffer.used = controller_pid_file_s_length; + buffer = controller_pid_file_s; break; case controller_rule_action_type_rerun_e: - buffer.string = controller_rerun_s; - buffer.used = controller_rerun_s_length; + buffer = controller_rerun_s; break; case controller_rule_action_type_reload_e: - buffer.string = controller_reload_s; - buffer.used = controller_reload_s_length; + buffer = controller_reload_s; break; case controller_rule_action_type_restart_e: - buffer.string = controller_restart_s; - buffer.used = controller_restart_s_length; + buffer = controller_restart_s; break; case controller_rule_action_type_resume_e: - buffer.string = controller_resume_s; - buffer.used = controller_resume_s_length; + buffer = controller_resume_s; break; case controller_rule_action_type_start_e: - buffer.string = controller_start_s; - buffer.used = controller_start_s_length; + buffer = controller_start_s; break; case controller_rule_action_type_stop_e: - buffer.string = controller_stop_s; - buffer.used = controller_stop_s_length; + buffer = controller_stop_s; break; case controller_rule_action_type_thaw_e: - buffer.string = controller_thaw_s; - buffer.used = controller_thaw_s_length; + buffer = controller_thaw_s; break; case controller_rule_action_type_user_e: - buffer.string = controller_user_s; - buffer.used = controller_user_s_length; + buffer = controller_user_s; break; case controller_rule_action_type_with_e: - buffer.string = controller_with_s; - buffer.used = controller_with_s_length; + buffer = controller_with_s; break; } @@ -268,48 +250,39 @@ extern "C" { switch (type) { case controller_rule_action_type_execute_freeze_e: - buffer.string = controller_freeze_s; - buffer.used = controller_freeze_s_length; + buffer = controller_freeze_s; break; case controller_rule_action_type_execute_kill_e: - buffer.string = controller_kill_s; - buffer.used = controller_kill_s_length; + buffer = controller_kill_s; break; case controller_rule_action_type_execute_pause_e: - buffer.string = controller_pause_s; - buffer.used = controller_pause_s_length; + buffer = controller_pause_s; break; case controller_rule_action_type_execute_reload_e: - buffer.string = controller_reload_s; - buffer.used = controller_reload_s_length; + buffer = controller_reload_s; break; case controller_rule_action_type_execute_restart_e: - buffer.string = controller_restart_s; - buffer.used = controller_restart_s_length; + buffer = controller_restart_s; break; case controller_rule_action_type_execute_resume_e: - buffer.string = controller_resume_s; - buffer.used = controller_resume_s_length; + buffer = controller_resume_s; break; case controller_rule_action_type_execute_start_e: - buffer.string = controller_start_s; - buffer.used = controller_start_s_length; + buffer = controller_start_s; break; case controller_rule_action_type_execute_stop_e: - buffer.string = controller_stop_s; - buffer.used = controller_stop_s_length; + buffer = controller_stop_s; break; case controller_rule_action_type_execute_thaw_e: - buffer.string = controller_thaw_s; - buffer.used = controller_thaw_s_length; + buffer = controller_thaw_s; break; } @@ -496,31 +469,31 @@ extern "C" { uint8_t type_rerun = 0; if (cache->content_action.used) { - if (fl_string_dynamic_partial_compare_string(controller_freeze_s, cache->buffer_item, controller_freeze_s_length, cache->content_action.array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_freeze_s.string, cache->buffer_item, controller_freeze_s.used, cache->content_action.array[0]) == F_equal_to) { type_rerun = controller_rule_action_type_execute_freeze_e; } - if (fl_string_dynamic_partial_compare_string(controller_kill_s, cache->buffer_item, controller_kill_s_length, cache->content_action.array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_kill_s.string, cache->buffer_item, controller_kill_s.used, cache->content_action.array[0]) == F_equal_to) { type_rerun = controller_rule_action_type_execute_kill_e; } - else if (fl_string_dynamic_partial_compare_string(controller_pause_s, cache->buffer_item, controller_pause_s_length, cache->content_action.array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_pause_s.string, cache->buffer_item, controller_pause_s.used, cache->content_action.array[0]) == F_equal_to) { type_rerun = controller_rule_action_type_execute_pause_e; } - else if (fl_string_dynamic_partial_compare_string(controller_reload_s, cache->buffer_item, controller_reload_s_length, cache->content_action.array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_reload_s.string, cache->buffer_item, controller_reload_s.used, cache->content_action.array[0]) == F_equal_to) { type_rerun = controller_rule_action_type_execute_reload_e; } - else if (fl_string_dynamic_partial_compare_string(controller_restart_s, cache->buffer_item, controller_restart_s_length, cache->content_action.array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_restart_s.string, cache->buffer_item, controller_restart_s.used, cache->content_action.array[0]) == F_equal_to) { type_rerun = controller_rule_action_type_execute_restart_e; } - else if (fl_string_dynamic_partial_compare_string(controller_resume_s, cache->buffer_item, controller_resume_s_length, cache->content_action.array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_resume_s.string, cache->buffer_item, controller_resume_s.used, cache->content_action.array[0]) == F_equal_to) { type_rerun = controller_rule_action_type_execute_resume_e; } - else if (fl_string_dynamic_partial_compare_string(controller_start_s, cache->buffer_item, controller_start_s_length, cache->content_action.array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_start_s.string, cache->buffer_item, controller_start_s.used, cache->content_action.array[0]) == F_equal_to) { type_rerun = controller_rule_action_type_execute_start_e; } - else if (fl_string_dynamic_partial_compare_string(controller_stop_s, cache->buffer_item, controller_stop_s_length, cache->content_action.array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_stop_s.string, cache->buffer_item, controller_stop_s.used, cache->content_action.array[0]) == F_equal_to) { type_rerun = controller_rule_action_type_execute_stop_e; } - else if (fl_string_dynamic_partial_compare_string(controller_thaw_s, cache->buffer_item, controller_thaw_s_length, cache->content_action.array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_thaw_s.string, cache->buffer_item, controller_thaw_s.used, cache->content_action.array[0]) == F_equal_to) { type_rerun = controller_rule_action_type_execute_thaw_e; } } @@ -529,20 +502,20 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SRule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_rerun_s, global.main->error.notable); + fl_print_format("%q%[%QRule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_rerun_s, global.main->error.notable); fl_print_format("%[' has '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[%/Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_item, cache->content_action.array[0], global.main->error.notable); fl_print_format("%[' as the first value, only the following are allowed: '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_freeze_s, global.main->error.notable, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_kill_s, global.main->error.notable, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_pause_s, global.main->error.notable, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_reload_s, global.main->error.notable, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_restart_s, global.main->error.notable, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_resume_s, global.main->error.notable, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_start_s, global.main->error.notable, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]%[', or '%]", global.main->error.to.stream, global.main->error.notable, controller_stop_s, global.main->error.notable, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_thaw_s, global.main->error.notable, global.main->error.context); + fl_print_format("%[%q%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_freeze_s, global.main->error.notable, global.main->error.context, global.main->error.context); + fl_print_format("%[%q%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_kill_s, global.main->error.notable, global.main->error.context, global.main->error.context); + fl_print_format("%[%q%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_pause_s, global.main->error.notable, global.main->error.context, global.main->error.context); + fl_print_format("%[%q%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_reload_s, global.main->error.notable, global.main->error.context, global.main->error.context); + fl_print_format("%[%q%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_restart_s, global.main->error.notable, global.main->error.context, global.main->error.context); + fl_print_format("%[%q%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_resume_s, global.main->error.notable, global.main->error.context, global.main->error.context); + fl_print_format("%[%q%]%[', '%]", global.main->error.to.stream, global.main->error.notable, controller_start_s, global.main->error.notable, global.main->error.context, global.main->error.context); + fl_print_format("%[%q%]%[', or '%]", global.main->error.to.stream, global.main->error.notable, controller_stop_s, global.main->error.notable, global.main->error.context, global.main->error.context); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_thaw_s, global.main->error.notable, global.main->error.context); fl_print_format("%['.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); controller_rule_print_error_cache(global.main->error, cache->action, F_true); @@ -556,11 +529,11 @@ extern "C" { controller_rule_rerun_item_t *rerun_item = 0; if (cache->content_action.used > 1) { - if (fl_string_dynamic_partial_compare_string(controller_failure_s, cache->buffer_item, controller_failure_s_length, cache->content_action.array[1]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_failure_s.string, cache->buffer_item, controller_failure_s.used, cache->content_action.array[1]) == F_equal_to) { rerun_item = &item->reruns[type_rerun].failure; item->reruns[type_rerun].is |= controller_rule_rerun_is_failure_d; } - else if (fl_string_dynamic_partial_compare_string(controller_success_s, cache->buffer_item, controller_success_s_length, cache->content_action.array[1]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_success_s.string, cache->buffer_item, controller_success_s.used, cache->content_action.array[1]) == F_equal_to) { rerun_item = &item->reruns[type_rerun].success; item->reruns[type_rerun].is |= controller_rule_rerun_is_success_d; } @@ -569,13 +542,13 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SRule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_rerun_s, global.main->error.notable); + fl_print_format("%q%[%QRule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_rerun_s, global.main->error.notable); fl_print_format("%[' has '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[%/Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_item, cache->content_action.array[1], global.main->error.notable); fl_print_format("%[' as the second value, only the following are allowed: '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]%[' or '%]", global.main->error.to.stream, global.main->error.notable, controller_stop_s, global.main->error.notable, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_thaw_s, global.main->error.notable, global.main->error.context); + fl_print_format("%[%q%]%[' or '%]", global.main->error.to.stream, global.main->error.notable, controller_stop_s, global.main->error.notable, global.main->error.context, global.main->error.context); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_thaw_s, global.main->error.notable, global.main->error.context); fl_print_format("%['.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); controller_rule_print_error_cache(global.main->error, cache->action, F_true); @@ -588,21 +561,21 @@ extern "C" { for (f_array_length_t i = 2; i < cache->content_action.used; ++i) { - if (fl_string_dynamic_partial_compare_string(controller_delay_s, cache->buffer_item, controller_delay_s_length, cache->content_action.array[i]) == F_equal_to) { - status = controller_rule_action_read_rerun_number(global, controller_delay_s, cache, &i, &rerun_item->delay); + if (fl_string_dynamic_partial_compare_string(controller_delay_s.string, cache->buffer_item, controller_delay_s.used, cache->content_action.array[i]) == F_equal_to) { + status = controller_rule_action_read_rerun_number(global, controller_delay_s.string, cache, &i, &rerun_item->delay); } - else if (fl_string_dynamic_partial_compare_string(controller_max_s, cache->buffer_item, controller_max_s_length, cache->content_action.array[i]) == F_equal_to) { - status = controller_rule_action_read_rerun_number(global, controller_max_s, cache, &i, &rerun_item->max); + else if (fl_string_dynamic_partial_compare_string(controller_max_s.string, cache->buffer_item, controller_max_s.used, cache->content_action.array[i]) == F_equal_to) { + status = controller_rule_action_read_rerun_number(global, controller_max_s.string, cache, &i, &rerun_item->max); } - else if (fl_string_dynamic_partial_compare_string(controller_reset_s, cache->buffer_item, controller_reset_s_length, cache->content_action.array[i]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_reset_s.string, cache->buffer_item, controller_reset_s.used, cache->content_action.array[i]) == F_equal_to) { item->reruns[type_rerun].is |= rerun_item == &item->reruns[type_rerun].failure ? controller_rule_rerun_is_failure_reset_d : controller_rule_rerun_is_success_reset_d; } else { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SRule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_rerun_s, global.main->error.notable); + fl_print_format("%q%[%QRule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_rerun_s, global.main->error.notable); fl_print_format("%[' has an unknown value '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[%/Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_item, cache->content_action.array[i], global.main->error.notable); fl_print_format("%['.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -620,10 +593,10 @@ extern "C" { for (f_array_length_t i = 0; i < cache->content_action.used; ++i) { - if (fl_string_dynamic_partial_compare_string(controller_full_path_s, cache->buffer_item, controller_full_path_s_length, cache->content_action.array[i]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_full_path_s.string, cache->buffer_item, controller_full_path_s.used, cache->content_action.array[i]) == F_equal_to) { item->with |= controller_with_full_path_d; } - else if (fl_string_dynamic_partial_compare_string(controller_session_new_s, cache->buffer_item, controller_session_new_s_length, cache->content_action.array[i]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_session_new_s.string, cache->buffer_item, controller_session_new_s.used, cache->content_action.array[i]) == F_equal_to) { item->with |= controller_with_session_new_d; // "session_new" and "session_same" are mutually exclusive. @@ -631,7 +604,7 @@ extern "C" { item->with -= controller_with_session_same_d; } } - else if (fl_string_dynamic_partial_compare_string(controller_session_same_s, cache->buffer_item, controller_session_same_s_length, cache->content_action.array[i]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_session_same_s.string, cache->buffer_item, controller_session_same_s.used, cache->content_action.array[i]) == F_equal_to) { item->with |= controller_with_session_same_d; // "session_new" and "session_same" are mutually exclusive. @@ -643,9 +616,9 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SUnknown value '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QUnknown value '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%/Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_item, cache->content_action.array[i], global.main->error.notable); - fl_print_format("%[' for rule item action '%]%[%s%]", global.main->error.to.stream, global.main->error.context, global.main->error.context, global.main->error.notable, controller_with_s, global.main->error.notable); + fl_print_format("%[' for rule item action '%]%[%q%]", global.main->error.to.stream, global.main->error.context, global.main->error.context, global.main->error.notable, controller_with_s, global.main->error.notable); fl_print_format("%['.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); controller_rule_print_error_cache(global.main->error, cache->action, F_true); @@ -674,7 +647,7 @@ extern "C" { for (f_array_length_t i = 0; i < cache->content_action.used; ++i) { - status = f_string_dynamic_partial_mash_nulless(f_string_space_s, F_string_space_s_length, cache->buffer_item, cache->content_action.array[i], &actions->array[actions->used].parameters.array[0]); + status = f_string_dynamic_partial_mash_nulless(f_string_space_s, cache->buffer_item, cache->content_action.array[i], &actions->array[actions->used].parameters.array[0]); if (F_status_is_error(status)) break; } // for @@ -727,7 +700,7 @@ extern "C" { if (global.main->warning.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global.main->warning.to, global.thread); - fl_print_format("%q%[%SAction is empty, nothing to do.%]%q", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context, f_string_eol_s); + fl_print_format("%q%[%QAction is empty, nothing to do.%]%q", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context, f_string_eol_s); controller_rule_print_error_cache(global.main->warning, cache->action, F_true); @@ -770,8 +743,8 @@ extern "C" { else { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SRule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_rerun_s, global.main->error.notable); + fl_print_format("%q%[%QRule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_rerun_s, global.main->error.notable); fl_print_format("%[' requires a positive whole number or 0 for the '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[%S%]", global.main->error.to.stream, global.main->error.notable, name, global.main->error.notable); fl_print_format("%[' value", global.main->error.to.stream, global.main->error.context, global.main->error.context); @@ -1127,7 +1100,7 @@ extern "C" { if (process->rule.items.array[i].type == controller_rule_item_type_command_e) { for (;;) { - status = controller_rule_execute_foreground(process->rule.items.array[i].type, f_string_static_empty_s, process->rule.items.array[i].actions.array[j].parameters, options, &execute_set, process); + status = controller_rule_execute_foreground(process->rule.items.array[i].type, f_string_empty_s, process->rule.items.array[i].actions.array[j].parameters, options, &execute_set, process); if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) break; if (F_status_is_error(status) && F_status_set_fine(status) != F_failure) break; @@ -1191,7 +1164,7 @@ extern "C" { if (process->rule.items.array[i].pid_file.used) { for (;;) { - status = controller_rule_execute_pid_with(process->rule.items.array[i].pid_file, process->rule.items.array[i].type, f_string_static_empty_s, process->rule.items.array[i].actions.array[j].parameters, options, process->rule.items.array[i].with, &execute_set, process); + status = controller_rule_execute_pid_with(process->rule.items.array[i].pid_file, process->rule.items.array[i].type, f_string_empty_s, process->rule.items.array[i].actions.array[j].parameters, options, process->rule.items.array[i].with, &execute_set, process); if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) break; if (F_status_is_error(status) && F_status_set_fine(status) != F_failure) break; @@ -1265,7 +1238,7 @@ extern "C" { if (global.main->warning.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global.main->warning.to, global.thread); - fl_print_format("%q%[%SAction type is unknown, ignoring.%]%q", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context, f_string_eol_s); + fl_print_format("%q%[%QAction type is unknown, ignoring.%]%q", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context, f_string_eol_s); controller_rule_print_error_cache(global.main->warning, process->cache.action, F_true); @@ -1290,10 +1263,7 @@ extern "C" { // Lock failed, attempt to re-establish lock before returning. if (F_status_set_fine(status) == F_lock) { status = controller_lock_read(process, global.thread, &process->lock); - - if (F_status_is_error(status)) { - return F_status_set_error(F_lock); - } + if (F_status_is_error(status)) return F_status_set_error(F_lock); success = F_false; } @@ -1374,7 +1344,7 @@ extern "C" { for (f_array_length_t i = program.used ? 0 : 1; i < arguments.used; ++i) { if (program.used && i || !program.used && i > 1) { - f_print_terminated(f_string_space_s, main->output.to.stream); + f_print_dynamic(f_string_space_s, main->output.to.stream); } f_print_dynamic_safely(arguments.array[i], main->output.to.stream); @@ -1396,9 +1366,8 @@ extern "C" { } if (F_status_set_fine(status) != F_interrupt) { - const f_string_static_t simulated_program = macro_f_string_static_t_initialize(f_string_empty_s, 0); const f_string_statics_t simulated_arguments = f_string_statics_t_initialize; - fl_execute_parameter_t simulated_parameter = macro_fl_execute_parameter_t_initialize(execute_set->parameter.option, execute_set->parameter.wait, process->rule.has & controller_rule_has_environment_d ? execute_set->parameter.environment : 0, execute_set->parameter.signals, &simulated_program); + fl_execute_parameter_t simulated_parameter = macro_fl_execute_parameter_t_initialize(execute_set->parameter.option, execute_set->parameter.wait, process->rule.has & controller_rule_has_environment_d ? execute_set->parameter.environment : 0, execute_set->parameter.signals, &f_string_empty_s); status = fll_execute_program(controller_default_program_script_s.string, simulated_arguments, &simulated_parameter, &execute_set->as, (void *) &result); } @@ -1630,7 +1599,7 @@ extern "C" { for (f_array_length_t i = program.used ? 0 : 1; i < arguments.used; ++i) { if (program.used && i || !program.used && i > 1) { - f_print_terminated(f_string_space_s, main->error.to.stream); + f_print_dynamic(f_string_space_s, main->error.to.stream); } f_print_dynamic_safely(arguments.array[i], main->error.to.stream); @@ -1652,9 +1621,8 @@ extern "C" { } if (F_status_set_fine(status) != F_interrupt) { - const f_string_static_t simulated_program = macro_f_string_static_t_initialize(f_string_empty_s, 0); const f_string_statics_t simulated_arguments = f_string_statics_t_initialize; - fl_execute_parameter_t simulated_parameter = macro_fl_execute_parameter_t_initialize(execute_set->parameter.option, execute_set->parameter.wait, process->rule.has & controller_rule_has_environment_d ? execute_set->parameter.environment : 0, execute_set->parameter.signals, &simulated_program); + fl_execute_parameter_t simulated_parameter = macro_fl_execute_parameter_t_initialize(execute_set->parameter.option, execute_set->parameter.wait, process->rule.has & controller_rule_has_environment_d ? execute_set->parameter.environment : 0, execute_set->parameter.signals, &f_string_empty_s); status = fll_execute_program(controller_default_program_script_s.string, simulated_arguments, &simulated_parameter, &execute_set->as, (void *) &result); } @@ -1813,7 +1781,7 @@ extern "C" { f_print_terminated("' '", main->output.to.stream); fl_print_format("%[%q%]", main->output.to.stream, main->context.set.notable, controller_rule_action_type_execute_name(action), main->context.set.notable); f_print_terminated("' with a ", main->output.to.stream); - fl_print_format("%[%s%]", main->output.to.stream, main->context.set.notable, controller_delay_s, main->context.set.notable); + fl_print_format("%[%q%]", main->output.to.stream, main->context.set.notable, controller_delay_s, main->context.set.notable); f_print_terminated(" of ", main->output.to.stream); fl_print_format("%[%ul%] MegaTime", main->output.to.stream, main->context.set.notable, rerun_item->delay, main->context.set.notable); @@ -1821,12 +1789,12 @@ extern "C" { f_print_terminated(" for ", main->output.to.stream); fl_print_format("%[%ul%]", main->output.to.stream, main->context.set.notable, rerun_item->count, main->context.set.notable); f_print_terminated(" of ", main->output.to.stream); - fl_print_format("%[%s%] ", main->output.to.stream, main->context.set.notable, controller_max_s, main->context.set.notable); + fl_print_format("%[%q%] ", main->output.to.stream, main->context.set.notable, controller_max_s, main->context.set.notable); fl_print_format("%[%ul%]", main->output.to.stream, main->context.set.notable, rerun_item->max, main->context.set.notable); fl_print_format(".%q", main->output.to.stream, f_string_eol_s); } else { - fl_print_format(" with no %[%s%].%q", main->output.to.stream, main->context.set.notable, controller_max_s, main->context.set.notable, f_string_eol_s); + fl_print_format(" with no %[%q%].%q", main->output.to.stream, main->context.set.notable, controller_max_s, main->context.set.notable, f_string_eol_s); } controller_unlock_print_flush(main->output.to, thread); @@ -1878,10 +1846,10 @@ extern "C" { return status; } - status = f_string_append(f_path_separator_s, F_path_separator_s_length, alias); + status = f_string_dynamic_append(f_path_separator_s, alias); if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_append", F_true); + controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); return status; } @@ -1992,53 +1960,53 @@ extern "C" { break; } - if (fl_string_dynamic_compare_string(controller_freeze_s, cache->action.name_action, controller_freeze_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(controller_freeze_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_freeze_e; } - else if (fl_string_dynamic_compare_string(controller_group_s, cache->action.name_action, controller_group_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_group_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_group_e; } - else if (fl_string_dynamic_compare_string(controller_kill_s, cache->action.name_action, controller_kill_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_kill_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_kill_e; } - else if (fl_string_dynamic_compare_string(controller_pause_s, cache->action.name_action, controller_pause_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_pause_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_pause_e; } - else if (fl_string_dynamic_compare_string(controller_pid_file_s, cache->action.name_action, controller_pid_file_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_pid_file_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_pid_file_e; } - else if (fl_string_dynamic_compare_string(controller_reload_s, cache->action.name_action, controller_reload_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_reload_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_reload_e; } - else if (fl_string_dynamic_compare_string(controller_rerun_s, cache->action.name_action, controller_rerun_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_rerun_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_rerun_e; } - else if (fl_string_dynamic_compare_string(controller_restart_s, cache->action.name_action, controller_restart_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_restart_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_restart_e; } - else if (fl_string_dynamic_compare_string(controller_resume_s, cache->action.name_action, controller_resume_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_resume_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_resume_e; } - else if (fl_string_dynamic_compare_string(controller_start_s, cache->action.name_action, controller_start_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_start_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_start_e; } - else if (fl_string_dynamic_compare_string(controller_stop_s, cache->action.name_action, controller_stop_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_stop_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_stop_e; } - else if (fl_string_dynamic_compare_string(controller_thaw_s, cache->action.name_action, controller_thaw_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_thaw_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_thaw_e; } - else if (fl_string_dynamic_compare_string(controller_user_s, cache->action.name_action, controller_user_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_user_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_user_e; } - else if (fl_string_dynamic_compare_string(controller_with_s, cache->action.name_action, controller_with_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_with_s, cache->action.name_action) == F_equal_to) { type = controller_rule_action_type_with_e; } else { if (global.main->warning.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global.main->warning.to, global.thread); - fl_print_format("%q%[%SUnknown rule item action '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context); + fl_print_format("%q%[%QUnknown rule item action '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context); fl_print_format("%[%Q%]", global.main->warning.to.stream, global.main->warning.notable, cache->action.name_action, global.main->warning.notable); fl_print_format("%['.%]%q", global.main->warning.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s); @@ -2056,7 +2024,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SFSS Extended List is not allowed for the rule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QFSS Extended List is not allowed for the rule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, cache->action.name_action, global.main->error.notable); fl_print_format("%['.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -2096,28 +2064,23 @@ extern "C" { switch (type) { case controller_rule_item_type_command_e: - buffer.string = controller_command_s; - buffer.used = controller_command_s_length; + buffer = controller_command_s; break; case controller_rule_item_type_script_e: - buffer.string = controller_script_s; - buffer.used = controller_script_s_length; + buffer = controller_script_s; break; case controller_rule_item_type_service_e: - buffer.string = controller_service_s; - buffer.used = controller_service_s_length; + buffer = controller_service_s; break; case controller_rule_item_type_setting_e: - buffer.string = controller_setting_s; - buffer.used = controller_setting_s_length; + buffer = controller_setting_s; break; case controller_rule_item_type_utility_e: - buffer.string = controller_utility_s; - buffer.used = controller_utility_s_length; + buffer = controller_utility_s; break; } @@ -2155,83 +2118,67 @@ extern "C" { switch (type) { case controller_resource_limit_type_as_e: - buffer.string = controller_as_s; - buffer.used = controller_as_s_length; + buffer = controller_as_s; break; case controller_resource_limit_type_core_e: - buffer.string = controller_core_s; - buffer.used = controller_core_s_length; + buffer = controller_core_s; break; case controller_resource_limit_type_cpu_e: - buffer.string = controller_cpu_s; - buffer.used = controller_cpu_s_length; + buffer = controller_cpu_s; break; case controller_resource_limit_type_data_e: - buffer.string = controller_data_s; - buffer.used = controller_data_s_length; + buffer = controller_data_s; break; case controller_resource_limit_type_fsize_e: - buffer.string = controller_fsize_s; - buffer.used = controller_fsize_s_length; + buffer = controller_fsize_s; break; case controller_resource_limit_type_locks_e: - buffer.string = controller_locks_s; - buffer.used = controller_locks_s_length; + buffer = controller_locks_s; break; case controller_resource_limit_type_memlock_e: - buffer.string = controller_memlock_s; - buffer.used = controller_memlock_s_length; + buffer = controller_memlock_s; break; case controller_resource_limit_type_msgqueue_e: - buffer.string = controller_msgqueue_s; - buffer.used = controller_msgqueue_s_length; + buffer = controller_msgqueue_s; break; case controller_resource_limit_type_nice_e: - buffer.string = controller_nice_s; - buffer.used = controller_nice_s_length; + buffer = controller_nice_s; break; case controller_resource_limit_type_nofile_e: - buffer.string = controller_nofile_s; - buffer.used = controller_nofile_s_length; + buffer = controller_nofile_s; break; case controller_resource_limit_type_nproc_e: - buffer.string = controller_nproc_s; - buffer.used = controller_nproc_s_length; + buffer = controller_nproc_s; break; case controller_resource_limit_type_rss_e: - buffer.string = controller_rss_s; - buffer.used = controller_rss_s_length; + buffer = controller_rss_s; break; case controller_resource_limit_type_rtprio_e: - buffer.string = controller_rtprio_s; - buffer.used = controller_rtprio_s_length; + buffer = controller_rtprio_s; break; case controller_resource_limit_type_rttime_e: - buffer.string = controller_rttime_s; - buffer.used = controller_rttime_s_length; + buffer = controller_rttime_s; break; case controller_resource_limit_type_sigpending_e: - buffer.string = controller_sigpending_s; - buffer.used = controller_sigpending_s_length; + buffer = controller_sigpending_s; break; case controller_resource_limit_type_stack_e: - buffer.string = controller_stack_s; - buffer.used = controller_stack_s_length; + buffer = controller_stack_s; break; } @@ -2260,7 +2207,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SUnsupported action type '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QUnsupported action type '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_rule_action_type_name(process->action), global.main->error.notable); fl_print_format("%[' while attempting to execute rule.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -2279,14 +2226,14 @@ extern "C" { process->cache.action.name_item.used = 0; process->cache.action.name_file.used = 0; - status = f_string_append(controller_rules_s, controller_rules_s_length, &process->cache.action.name_file); + status = f_string_dynamic_append(controller_rules_s, &process->cache.action.name_file); if (F_status_is_error_not(status)) { - status = f_string_append(f_path_separator_s, F_path_separator_s_length, &process->cache.action.name_file); + status = f_string_dynamic_append(f_path_separator_s, &process->cache.action.name_file); } if (F_status_is_error(status)) { - controller_rule_print_error(global.thread, global.main->error, process->cache.action, F_status_set_fine(status), "f_string_append", F_true, F_true); + controller_rule_print_error(global.thread, global.main->error, process->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true); return status; } @@ -2299,14 +2246,14 @@ extern "C" { return status; } - status = f_string_append(F_path_extension_separator_s, F_path_extension_separator_s_length, &process->cache.action.name_file); + status = f_string_dynamic_append(f_path_extension_separator_s, &process->cache.action.name_file); if (F_status_is_error_not(status)) { - status = f_string_append(controller_rule_s, controller_rule_s_length, &process->cache.action.name_file); + status = f_string_dynamic_append(controller_rule_s, &process->cache.action.name_file); } if (F_status_is_error(status)) { - controller_rule_print_error(global.thread, global.main->error, process->cache.action, F_status_set_fine(status), "f_string_append", F_true, F_true); + controller_rule_print_error(global.thread, global.main->error, process->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true); return status; } @@ -2361,7 +2308,7 @@ extern "C" { } // i==0 is need, i==1 is want, i==2 is wish. - // loop through all dependencies: wait for depedency, execute dependency, fail due to missing required dependency, or skip unrequired missing dependencies. + // Loop through all dependencies: wait for depedency, execute dependency, fail due to missing required dependency, or skip unrequired missing dependencies. for (i = 0; i < 3 && controller_thread_is_enabled_process(process, global.thread); ++i) { for (j = 0; j < dynamics[i]->used && controller_thread_is_enabled_process(process, global.thread); ++j) { @@ -2677,6 +2624,7 @@ extern "C" { if (process->rule.items.array[i].actions.array[j].type == process->action) { missing = F_false; + break; } } // for @@ -2687,25 +2635,25 @@ extern "C" { controller_lock_print(global.main->error.to, global.thread); if (process->rule.items.used) { - fl_print_format("%q%[%SThe rule '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QThe rule '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, process->rule.name, global.main->error.notable); fl_print_format("%[' has no '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_rule_action_type_name(process->action), global.main->error.notable); fl_print_format("%[' action to execute.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); } else { - fl_print_format("%q%[%SThe rule '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QThe rule '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, process->rule.name, global.main->error.notable); fl_print_format("%[ has no known '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); - fl_print_format("%[%s %s%]", global.main->error.to.stream, global.main->error.notable, controller_rule_s, controller_type_s, global.main->error.notable); + fl_print_format("%[%q %q%]", global.main->error.to.stream, global.main->error.notable, controller_rule_s, controller_type_s, global.main->error.notable); fl_print_format("%[' (such as '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_command_s, global.main->error.notable); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_command_s, global.main->error.notable); fl_print_format("%[', '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_service_s, global.main->error.notable); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_service_s, global.main->error.notable); fl_print_format("%[', '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_script_s, global.main->error.notable); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_script_s, global.main->error.notable); fl_print_format("%[', or '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context); - fl_print_format("%[%s%]", global.main->error.to.stream, global.main->error.notable, controller_utility_s, global.main->error.notable); + fl_print_format("%[%q%]", global.main->error.to.stream, global.main->error.notable, controller_utility_s, global.main->error.notable); fl_print_format("%[') to execute.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); } @@ -2742,10 +2690,7 @@ extern "C" { if (F_status_set_fine(status) != F_interrupt) { status = controller_lock_read_process(process, global.thread, &process->lock); - - if (F_status_is_error_not(status)) { - return status_lock; - } + if (F_status_is_error_not(status)) return status_lock; } return F_status_set_error(F_lock); @@ -2766,10 +2711,7 @@ extern "C" { f_thread_unlock(&process->lock); status = controller_lock_read_process(process, global.thread, &process->lock); - - if (F_status_is_error_not(status)) { - return status_lock; - } + if (F_status_is_error_not(status)) return status_lock; return F_status_set_error(F_lock); } @@ -3149,7 +3091,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SThe rule '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QThe rule '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, process->rule.alias, global.main->error.notable); fl_print_format("%[' is already on the execution dependency stack, this recursion is prohibited.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -3419,7 +3361,7 @@ extern "C" { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); } else { - status = controller_file_load(global, F_true, controller_rules_s, rule->alias, controller_rule_s, controller_rules_s_length, controller_rule_s_length, cache); + status = controller_file_load(global, F_true, controller_rules_s, rule->alias, controller_rule_s, cache); } } @@ -3502,26 +3444,26 @@ extern "C" { break; } - if (fl_string_dynamic_compare_string(controller_setting_s, cache->action.name_item, controller_setting_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(controller_setting_s, cache->action.name_item) == F_equal_to) { rule->items.array[rule->items.used].type = 0; } - else if (fl_string_dynamic_compare_string(controller_command_s, cache->action.name_item, controller_command_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_command_s, cache->action.name_item) == F_equal_to) { rule->items.array[rule->items.used].type = controller_rule_item_type_command_e; } - else if (fl_string_dynamic_compare_string(controller_script_s, cache->action.name_item, controller_script_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_script_s, cache->action.name_item) == F_equal_to) { rule->items.array[rule->items.used].type = controller_rule_item_type_script_e; } - else if (fl_string_dynamic_compare_string(controller_service_s, cache->action.name_item, controller_service_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_service_s, cache->action.name_item) == F_equal_to) { rule->items.array[rule->items.used].type = controller_rule_item_type_service_e; } - else if (fl_string_dynamic_compare_string(controller_utility_s, cache->action.name_item, controller_utility_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_utility_s, cache->action.name_item) == F_equal_to) { rule->items.array[rule->items.used].type = controller_rule_item_type_utility_e; } else { if (global.main->warning.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global.main->warning.to, global.thread); - fl_print_format("%q%[%SUnknown rule item '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context); + fl_print_format("%q%[%QUnknown rule item '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context); fl_print_format("%[%Q%]", global.main->warning.to.stream, global.main->warning.notable, cache->action.name_item, global.main->warning.notable); fl_print_format("%['.%]%q", global.main->warning.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s); @@ -3659,6 +3601,7 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -3679,53 +3622,53 @@ extern "C" { empty_disallow = F_true; - if (fl_string_dynamic_compare_string(controller_affinity_s, cache->action.name_item, controller_affinity_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(controller_affinity_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_affinity_e; } - else if (fl_string_dynamic_compare_string(controller_capability_s, cache->action.name_item, controller_capability_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_capability_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_capability_e; } - else if (fl_string_dynamic_compare_string(controller_cgroup_s, cache->action.name_item, controller_cgroup_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_cgroup_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_cgroup_e; } - else if (fl_string_dynamic_compare_string(controller_define_s, cache->action.name_item, controller_define_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_define_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_define_e; } - else if (fl_string_dynamic_compare_string(controller_environment_s, cache->action.name_item, controller_environment_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_environment_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_environment_e; empty_disallow = F_false; } - else if (fl_string_dynamic_compare_string(controller_group_s, cache->action.name_item, controller_group_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_group_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_group_e; } - else if (fl_string_dynamic_compare_string(controller_limit_s, cache->action.name_item, controller_limit_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_limit_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_limit_e; } - else if (fl_string_dynamic_compare_string(controller_name_s, cache->action.name_item, controller_name_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_name_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_name_e; } - else if (fl_string_dynamic_compare_string(controller_nice_s, cache->action.name_item, controller_nice_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_nice_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_nice_e; } - else if (fl_string_dynamic_compare_string(controller_on_s, cache->action.name_item, controller_on_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_on_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_on_e; } - else if (fl_string_dynamic_compare_string(controller_parameter_s, cache->action.name_item, controller_parameter_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_parameter_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_parameter_e; } - else if (fl_string_dynamic_compare_string(controller_path_s, cache->action.name_item, controller_path_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_path_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_path_e; } - else if (fl_string_dynamic_compare_string(controller_scheduler_s, cache->action.name_item, controller_scheduler_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_scheduler_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_scheduler_e; } - else if (fl_string_dynamic_compare_string(controller_script_s, cache->action.name_item, controller_script_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_script_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_script_e; } - else if (fl_string_dynamic_compare_string(controller_timeout_s, cache->action.name_item, controller_timeout_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_timeout_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_timeout_e; } - else if (fl_string_dynamic_compare_string(controller_user_s, cache->action.name_item, controller_user_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(controller_user_s, cache->action.name_item) == F_equal_to) { type = controller_rule_setting_type_user_e; } else { @@ -3739,7 +3682,7 @@ extern "C" { controller_lock_print(global.main->warning.to, global.thread); - fl_print_format("%q%[%SUnknown rule setting '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context); + fl_print_format("%q%[%QUnknown rule setting '%]", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context); fl_print_format("%[%Q%]", global.main->warning.to.stream, global.main->warning.notable, cache->action.name_item, global.main->warning.notable); fl_print_format("%['.%]%q", global.main->warning.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s); @@ -3780,6 +3723,7 @@ extern "C" { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -3802,7 +3746,7 @@ extern "C" { controller_lock_print(global.main->warning.to, global.thread); - fl_print_format("%q%[%SEmpty rule setting.%]%q", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context, f_string_eol_s); + fl_print_format("%q%[%QEmpty rule setting.%]%q", global.main->warning.to.stream, f_string_eol_s, global.main->warning.context, global.main->warning.prefix, global.main->warning.context, f_string_eol_s); controller_rule_print_error_cache(global.main->warning, cache->action, F_false); @@ -3852,6 +3796,7 @@ extern "C" { if (F_status_is_error(status)) { controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "macro_f_int32s_t_resize", F_true, F_false); + break; } @@ -3932,6 +3877,7 @@ extern "C" { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -4013,7 +3959,7 @@ extern "C" { continue; } - controller_rule_setting_read_print_value(global, type == controller_rule_setting_type_define_e ? controller_define_s : controller_parameter_s, 0, setting_maps->array[setting_maps->used].name, 0); + controller_rule_setting_read_print_value(global, type == controller_rule_setting_type_define_e ? controller_define_s : controller_parameter_s, f_string_empty_s, setting_maps->array[setting_maps->used].name, 0); ++setting_maps->used; @@ -4031,10 +3977,10 @@ extern "C" { continue; } - if (fl_string_dynamic_partial_compare_string(controller_existing_s, cache->buffer_item, controller_existing_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_existing_s.string, cache->buffer_item, controller_existing_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { rule->cgroup.as_new = F_false; } - else if (fl_string_dynamic_partial_compare_string(controller_new_s, cache->buffer_item, controller_new_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_new_s.string, cache->buffer_item, controller_new_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { rule->cgroup.as_new = F_true; } else { @@ -4063,6 +4009,7 @@ extern "C" { if (F_status_is_error(status)) { controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase", F_true, F_false); + break; } @@ -4120,52 +4067,52 @@ extern "C" { continue; } - if (fl_string_dynamic_partial_compare_string(controller_as_s, cache->buffer_item, controller_as_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_as_s.string, cache->buffer_item, controller_as_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_as_e; } - else if (fl_string_dynamic_partial_compare_string(controller_core_s, cache->buffer_item, controller_core_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_core_s.string, cache->buffer_item, controller_core_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_core_e; } - else if (fl_string_dynamic_partial_compare_string(controller_cpu_s, cache->buffer_item, controller_cpu_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_cpu_s.string, cache->buffer_item, controller_cpu_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_cpu_e; } - else if (fl_string_dynamic_partial_compare_string(controller_data_s, cache->buffer_item, controller_data_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_data_s.string, cache->buffer_item, controller_data_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_data_e; } - else if (fl_string_dynamic_partial_compare_string(controller_fsize_s, cache->buffer_item, controller_fsize_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_fsize_s.string, cache->buffer_item, controller_fsize_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_fsize_e; } - else if (fl_string_dynamic_partial_compare_string(controller_locks_s, cache->buffer_item, controller_locks_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_locks_s.string, cache->buffer_item, controller_locks_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_locks_e; } - else if (fl_string_dynamic_partial_compare_string(controller_memlock_s, cache->buffer_item, controller_memlock_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_memlock_s.string, cache->buffer_item, controller_memlock_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_memlock_e; } - else if (fl_string_dynamic_partial_compare_string(controller_msgqueue_s, cache->buffer_item, controller_msgqueue_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_msgqueue_s.string, cache->buffer_item, controller_msgqueue_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_msgqueue_e; } - else if (fl_string_dynamic_partial_compare_string(controller_nice_s, cache->buffer_item, controller_nice_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_nice_s.string, cache->buffer_item, controller_nice_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_nice_e; } - else if (fl_string_dynamic_partial_compare_string(controller_nofile_s, cache->buffer_item, controller_nofile_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_nofile_s.string, cache->buffer_item, controller_nofile_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_nofile_e; } - else if (fl_string_dynamic_partial_compare_string(controller_nproc_s, cache->buffer_item, controller_nproc_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_nproc_s.string, cache->buffer_item, controller_nproc_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_nproc_e; } - else if (fl_string_dynamic_partial_compare_string(controller_rss_s, cache->buffer_item, controller_rss_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_rss_s.string, cache->buffer_item, controller_rss_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_rss_e; } - else if (fl_string_dynamic_partial_compare_string(controller_rtprio_s, cache->buffer_item, controller_rtprio_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_rtprio_s.string, cache->buffer_item, controller_rtprio_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_rtprio_e; } - else if (fl_string_dynamic_partial_compare_string(controller_rttime_s, cache->buffer_item, controller_rttime_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_rttime_s.string, cache->buffer_item, controller_rttime_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_rttime_e; } - else if (fl_string_dynamic_partial_compare_string(controller_sigpending_s, cache->buffer_item, controller_sigpending_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_sigpending_s.string, cache->buffer_item, controller_sigpending_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_sigpending_e; } - else if (fl_string_dynamic_partial_compare_string(controller_stack_s, cache->buffer_item, controller_stack_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_stack_s.string, cache->buffer_item, controller_stack_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { type = controller_resource_limit_type_stack_e; } else { @@ -4179,7 +4126,7 @@ extern "C" { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SUnknown resource limit type '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QUnknown resource limit type '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, cache->action.name_action, global.main->error.notable); fl_print_format("%['.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -4232,6 +4179,7 @@ extern "C" { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -4345,6 +4293,7 @@ extern "C" { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -4379,7 +4328,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SRule setting has an invalid name '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QRule setting has an invalid name '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, *setting_value, global.main->error.notable); fl_print_format("%[', there must be at least 1 graph character.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -4409,7 +4358,7 @@ extern "C" { continue; } - controller_rule_setting_read_print_value(global, type == controller_rule_setting_type_name_e ? controller_name_s : controller_script_s, 0, *setting_value, 0); + controller_rule_setting_read_print_value(global, type == controller_rule_setting_type_name_e ? controller_name_s : controller_script_s, f_string_empty_s, *setting_value, 0); } else if (type == controller_rule_setting_type_path_e) { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], setting_value); @@ -4428,6 +4377,7 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -4448,7 +4398,7 @@ extern "C" { continue; } - controller_rule_setting_read_print_value(global, controller_path_s, 0, *setting_value, 0); + controller_rule_setting_read_print_value(global, controller_path_s, f_string_empty_s, *setting_value, 0); } continue; @@ -4466,27 +4416,27 @@ extern "C" { continue; } - if (fl_string_dynamic_partial_compare_string(controller_batch_s, cache->buffer_item, controller_batch_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_batch_s.string, cache->buffer_item, controller_batch_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { rule->scheduler.policy = SCHED_BATCH; rule->scheduler.priority = 0; } - else if (fl_string_dynamic_partial_compare_string(controller_deadline_s, cache->buffer_item, controller_deadline_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_deadline_s.string, cache->buffer_item, controller_deadline_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { rule->scheduler.policy = SCHED_DEADLINE; rule->scheduler.priority = 49; } - else if (fl_string_dynamic_partial_compare_string(controller_fifo_s, cache->buffer_item, controller_fifo_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_fifo_s.string, cache->buffer_item, controller_fifo_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { rule->scheduler.policy = SCHED_FIFO; rule->scheduler.priority = 49; } - else if (fl_string_dynamic_partial_compare_string(controller_idle_s, cache->buffer_item, controller_idle_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_idle_s.string, cache->buffer_item, controller_idle_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { rule->scheduler.policy = SCHED_IDLE; rule->scheduler.priority = 0; } - else if (fl_string_dynamic_partial_compare_string(controller_other_s, cache->buffer_item, controller_other_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_other_s.string, cache->buffer_item, controller_other_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { rule->scheduler.policy = SCHED_OTHER; rule->scheduler.priority = 0; } - else if (fl_string_dynamic_partial_compare_string(controller_round_robin_s, cache->buffer_item, controller_round_robin_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_round_robin_s.string, cache->buffer_item, controller_round_robin_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { rule->scheduler.policy = SCHED_RR; rule->scheduler.priority = 49; } @@ -4530,7 +4480,7 @@ extern "C" { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SRule setting has an invalid number '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QRule setting has an invalid number '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%/Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_item, cache->content_actions.array[i].array[1], global.main->error.notable); if (zero_only) { @@ -4589,13 +4539,13 @@ extern "C" { uint8_t timeout_code = 0; - if (fl_string_dynamic_partial_compare_string(controller_kill_s, cache->buffer_item, controller_kill_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_kill_s.string, cache->buffer_item, controller_kill_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { timeout_code = controller_rule_timeout_code_kill_d; } - else if (fl_string_dynamic_partial_compare_string(controller_start_s, cache->buffer_item, controller_start_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_start_s.string, cache->buffer_item, controller_start_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { timeout_code = controller_rule_timeout_code_start_d; } - else if (fl_string_dynamic_partial_compare_string(controller_stop_s, cache->buffer_item, controller_stop_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_stop_s.string, cache->buffer_item, controller_stop_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { timeout_code = controller_rule_timeout_code_stop_d; } else { @@ -4609,9 +4559,9 @@ extern "C" { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SRule setting's first value has '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QRule setting's first value has '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%/Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_item, cache->content_actions.array[i].array[0], global.main->error.notable); - fl_print_format("%[' but only supports %s, %s, and %s.%]%q", global.main->error.to.stream, global.main->error.context, controller_kill_s, controller_start_s, controller_stop_s, global.main->error.context, f_string_eol_s); + fl_print_format("%[' but only supports %q, %q, and %q.%]%q", global.main->error.to.stream, global.main->error.context, controller_kill_s, controller_start_s, controller_stop_s, global.main->error.context, f_string_eol_s); controller_rule_print_error_cache(global.main->error, cache->action, F_false); @@ -4674,7 +4624,7 @@ extern "C" { } if (global.main->error.verbosity == f_console_verbosity_debug_e || (global.main->error.verbosity == f_console_verbosity_verbose_e && global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e)) { - f_string_t name_sub = controller_stop_s; + f_string_static_t name_sub = controller_stop_s; if (timeout_code == controller_rule_timeout_code_kill_d) { name_sub = controller_kill_s; @@ -4734,6 +4684,7 @@ extern "C" { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -4762,6 +4713,7 @@ extern "C" { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -4790,6 +4742,7 @@ extern "C" { controller_unlock_print_flush(global.main->error.to, global.thread); status_return = status; + break; } @@ -4802,7 +4755,7 @@ extern "C" { continue; } - controller_rule_setting_read_print_value(global, controller_capability_s, 0, cache->action.generic, 0); + controller_rule_setting_read_print_value(global, controller_capability_s, f_string_empty_s, cache->action.generic, 0); } else if (type == controller_rule_setting_type_nice_e) { f_number_signed_t number = 0; @@ -4832,7 +4785,7 @@ extern "C" { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SRule setting has an invalid number '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QRule setting has an invalid number '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%/Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_item, cache->content_actions.array[i].array[0], global.main->error.notable); fl_print_format("%[', only the whole numbers inclusively between%] ", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[-20%]", global.main->error.to.stream, global.main->error.notable, global.main->error.notable); @@ -4889,6 +4842,7 @@ extern "C" { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -4898,7 +4852,7 @@ extern "C" { } if (F_status_is_error_not(status)) { - controller_rule_setting_read_print_value(global, controller_nice_s, 0, cache->action.generic, 0); + controller_rule_setting_read_print_value(global, controller_nice_s, f_string_empty_s, cache->action.generic, 0); } } } @@ -4950,7 +4904,7 @@ extern "C" { status = f_string_dynamic_terminate_after(&cache->action.generic); } - controller_rule_setting_read_print_value(global, controller_user_s, 0, cache->action.generic, 0); + controller_rule_setting_read_print_value(global, controller_user_s, f_string_empty_s, cache->action.generic, 0); } } } @@ -4982,6 +4936,7 @@ extern "C" { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -5059,6 +5014,7 @@ extern "C" { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -5097,6 +5053,7 @@ extern "C" { if (F_status_set_fine(status) == F_memory_not) { status_return = status; + break; } @@ -5129,7 +5086,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SRule setting has an invalid environment variable name '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QRule setting has an invalid environment variable name '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, setting_values->array[setting_values->used], global.main->error.notable); fl_print_format("%['.%]%q", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s); @@ -5171,7 +5128,7 @@ extern "C" { if (global.main->error.verbosity == f_console_verbosity_debug_e || (global.main->error.verbosity == f_console_verbosity_verbose_e && global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e)) { controller_lock_print(global.main->output.to, global.thread); - fl_print_format("%qProcessing rule item action '%[%s%]' setting value to an empty set.%q", global.main->output.to.stream, f_string_eol_s, global.main->context.set.title, controller_environment_s, global.main->context.set.title, f_string_eol_s); + fl_print_format("%qProcessing rule item action '%[%q%]' setting value to an empty set.%q", global.main->output.to.stream, f_string_eol_s, global.main->context.set.title, controller_environment_s, global.main->context.set.title, f_string_eol_s); controller_unlock_print_flush(global.main->output.to, global.thread); } @@ -5191,31 +5148,31 @@ extern "C" { continue; } - if (fl_string_dynamic_partial_compare_string(controller_freeze_s, cache->buffer_item, controller_freeze_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_freeze_s.string, cache->buffer_item, controller_freeze_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { action = controller_rule_action_type_freeze_e; } - else if (fl_string_dynamic_partial_compare_string(controller_kill_s, cache->buffer_item, controller_kill_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_kill_s.string, cache->buffer_item, controller_kill_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { action = controller_rule_action_type_kill_e; } - else if (fl_string_dynamic_partial_compare_string(controller_pause_s, cache->buffer_item, controller_pause_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_pause_s.string, cache->buffer_item, controller_pause_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { action = controller_rule_action_type_pause_e; } - else if (fl_string_dynamic_partial_compare_string(controller_reload_s, cache->buffer_item, controller_reload_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_reload_s.string, cache->buffer_item, controller_reload_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { action = controller_rule_action_type_reload_e; } - else if (fl_string_dynamic_partial_compare_string(controller_restart_s, cache->buffer_item, controller_restart_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_restart_s.string, cache->buffer_item, controller_restart_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { action = controller_rule_action_type_restart_e; } - else if (fl_string_dynamic_partial_compare_string(controller_resume_s, cache->buffer_item, controller_resume_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_resume_s.string, cache->buffer_item, controller_resume_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { action = controller_rule_action_type_resume_e; } - else if (fl_string_dynamic_partial_compare_string(controller_start_s, cache->buffer_item, controller_start_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_start_s.string, cache->buffer_item, controller_start_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { action = controller_rule_action_type_start_e; } - else if (fl_string_dynamic_partial_compare_string(controller_stop_s, cache->buffer_item, controller_stop_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_stop_s.string, cache->buffer_item, controller_stop_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { action = controller_rule_action_type_stop_e; } - else if (fl_string_dynamic_partial_compare_string(controller_thaw_s, cache->buffer_item, controller_thaw_s_length, cache->content_actions.array[i].array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_thaw_s.string, cache->buffer_item, controller_thaw_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) { action = controller_rule_action_type_thaw_e; } else { @@ -5231,10 +5188,10 @@ extern "C" { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SRule setting's second value has '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QRule setting's second value has '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%/Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_item, cache->content_actions.array[i].array[1], global.main->error.notable); - fl_print_format("%[' but only supports %s, %s, %s, %s, %s", global.main->error.to.stream, global.main->error.context, controller_freeze_s, controller_kill_s, controller_pause_s, controller_reload_s, controller_restart_s); - fl_print_format("%s, %s, %s, and %s.%]%q", global.main->error.to.stream, controller_resume_s, controller_start_s, controller_stop_s, controller_thaw_s, global.main->error.context, f_string_eol_s); + fl_print_format("%[' but only supports %q, %q, %q, %q, %q", global.main->error.to.stream, global.main->error.context, controller_freeze_s, controller_kill_s, controller_pause_s, controller_reload_s, controller_restart_s); + fl_print_format("%q, %q, %q, and %q.%]%q", global.main->error.to.stream, controller_resume_s, controller_start_s, controller_stop_s, controller_thaw_s, global.main->error.context, f_string_eol_s); controller_rule_print_error_cache(global.main->error, cache->action, F_false); @@ -5260,13 +5217,13 @@ extern "C" { controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "controller_rule_ons_increase", F_true, F_false); } else { - if (fl_string_dynamic_partial_compare_string(controller_need_s, cache->buffer_item, controller_need_s_length, cache->content_actions.array[i].array[1]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(controller_need_s.string, cache->buffer_item, controller_need_s.used, cache->content_actions.array[i].array[1]) == F_equal_to) { setting_values = &rule->ons.array[j].need; } - else if (fl_string_dynamic_partial_compare_string(controller_want_s, cache->buffer_item, controller_want_s_length, cache->content_actions.array[i].array[1]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_want_s.string, cache->buffer_item, controller_want_s.used, cache->content_actions.array[i].array[1]) == F_equal_to) { setting_values = &rule->ons.array[j].want; } - else if (fl_string_dynamic_partial_compare_string(controller_wish_s, cache->buffer_item, controller_wish_s_length, cache->content_actions.array[i].array[1]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(controller_wish_s.string, cache->buffer_item, controller_wish_s.used, cache->content_actions.array[i].array[1]) == F_equal_to) { setting_values = &rule->ons.array[j].wish; } else { @@ -5280,9 +5237,9 @@ extern "C" { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SRule setting's second value has '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QRule setting's second value has '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%/Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_item, cache->content_actions.array[i].array[1], global.main->error.notable); - fl_print_format("%[' but only supports %s, %s, and %s.%]%q", global.main->error.to.stream, global.main->error.context, controller_need_s, controller_want_s, controller_wish_s, global.main->error.context, f_string_eol_s); + fl_print_format("%[' but only supports %q, %q, and %q.%]%q", global.main->error.to.stream, global.main->error.context, controller_need_s, controller_want_s, controller_wish_s, global.main->error.context, f_string_eol_s); controller_rule_print_error_cache(global.main->error, cache->action, F_false); @@ -5375,7 +5332,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - fl_print_format("%q%[%SThe rule item action third parameter '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); + fl_print_format("%q%[%QThe rule item action third parameter '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context); fl_print_format("%[%/Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_item, cache->content_actions.array[i].array[2], global.main->error.notable); fl_print_format("%[' must be a base path name, such as %un '.%]", global.main->error.to.stream, global.main->error.context, cache->buffer_path.used, global.main->error.context); fl_print_format("%[%Q%]", global.main->error.to.stream, cache->buffer_path, global.main->error.notable); @@ -5442,7 +5399,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(main->error.to, global.thread); - fl_print_format("%q%[%SUnsupported action type '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_format("%q%[%QUnsupported action type '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%q%]", main->error.to.stream, main->error.notable, controller_rule_action_type_name(action), main->error.notable); fl_print_format("%[' while attempting to validate rule execution.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -5479,19 +5436,19 @@ extern "C" { fl_print_format("%qRule '", main->output.to.stream, f_string_eol_s); fl_print_format("%[%Q%]' has no '", main->output.to.stream, main->context.set.title, rule.name, main->context.set.title); fl_print_format("%[%q%]' action to execute and would '", main->output.to.stream, main->context.set.title, controller_rule_action_type_name(action), main->context.set.title); - fl_print_format("%[%s%]' because it is '", main->output.to.stream, main->context.set.important, options & controller_process_option_require_d ? controller_fail_s : controller_succeed_s, main->context.set.important); - fl_print_format("%[%s%]'.%q", main->output.to.stream, main->context.set.important, options & controller_process_option_require_d ? controller_required_s : controller_optional_s, main->context.set.important, f_string_eol_s); + fl_print_format("%[%q%]' because it is '", main->output.to.stream, main->context.set.important, options & controller_process_option_require_d ? controller_fail_s : controller_succeed_s, main->context.set.important); + fl_print_format("%[%q%]'.%q", main->output.to.stream, main->context.set.important, options & controller_process_option_require_d ? controller_required_s : controller_optional_s, main->context.set.important, f_string_eol_s); } else { fl_print_format("%qRule '", main->output.to.stream, f_string_eol_s); fl_print_format("%[%Q%]' has no known '", main->output.to.stream, main->context.set.title, rule.name, main->context.set.title); - fl_print_format("%[%s %s%]' (such as ", main->output.to.stream, main->context.set.title, controller_rule_s, controller_type_s, main->context.set.title); - fl_print_format("'%[%s%]', ", main->output.to.stream, main->context.set.title, controller_command_s, main->context.set.title); - fl_print_format("'%[%s%]', ", main->output.to.stream, main->context.set.title, controller_service_s, main->context.set.title); - fl_print_format("'%[%s%]', or ", main->output.to.stream, main->context.set.title, controller_script_s, main->context.set.title); - fl_print_format("'%[%s%]'", main->output.to.stream, main->context.set.title, controller_utility_s, main->context.set.title); - fl_print_format(") and would '%[%s%]' because it is '", main->output.to.stream, main->context.set.important, options & controller_process_option_require_d ? controller_fail_s : controller_succeed_s, main->context.set.important); - fl_print_format("%[%s%]'.%q", main->output.to.stream, main->context.set.important, options & controller_process_option_require_d ? controller_required_s : controller_optional_s, main->context.set.important, f_string_eol_s); + fl_print_format("%[%q %q%]' (such as ", main->output.to.stream, main->context.set.title, controller_rule_s, controller_type_s, main->context.set.title); + fl_print_format("'%[%q%]', ", main->output.to.stream, main->context.set.title, controller_command_s, main->context.set.title); + fl_print_format("'%[%q%]', ", main->output.to.stream, main->context.set.title, controller_service_s, main->context.set.title); + fl_print_format("'%[%q%]', or ", main->output.to.stream, main->context.set.title, controller_script_s, main->context.set.title); + fl_print_format("'%[%q%]'", main->output.to.stream, main->context.set.title, controller_utility_s, main->context.set.title); + fl_print_format(") and would '%[%q%]' because it is '", main->output.to.stream, main->context.set.important, options & controller_process_option_require_d ? controller_fail_s : controller_succeed_s, main->context.set.important); + fl_print_format("%[%q%]'.%q", main->output.to.stream, main->context.set.important, options & controller_process_option_require_d ? controller_required_s : controller_optional_s, main->context.set.important, f_string_eol_s); } controller_unlock_print_flush(main->output.to, global.thread); @@ -5503,10 +5460,10 @@ extern "C" { fl_print_format("%qRule %[%Q%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.title, rule.alias, main->context.set.title, f_string_eol_s); // name. - fl_print_format(" %[%s%] %Q%q", main->output.to.stream, main->context.set.important, controller_name_s, main->context.set.important, rule.name, f_string_eol_s); + fl_print_format(" %[%q%] %Q%q", main->output.to.stream, main->context.set.important, controller_name_s, main->context.set.important, rule.name, f_string_eol_s); // capability. - fl_print_format(" %[%s%] ", main->output.to.stream, main->context.set.important, controller_capability_s, main->context.set.important); + fl_print_format(" %[%q%] ", main->output.to.stream, main->context.set.important, controller_capability_s, main->context.set.important); if (f_capability_supported()) { if (rule.capability) { @@ -5517,17 +5474,17 @@ extern "C" { } } - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); } else { fl_print_format("%[(unsupported)%]%q", main->output.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); } // control group. - fl_print_format(" %[%s%]", main->output.to.stream, main->context.set.important, controller_cgroup_s, main->context.set.important); + fl_print_format(" %[%q%]", main->output.to.stream, main->context.set.important, controller_cgroup_s, main->context.set.important); if (rule.has & controller_rule_has_cgroup_d) { - fl_print_format(" %s", main->output.to.stream, rule.cgroup.as_new ? controller_new_s : controller_existing_s); + fl_print_format(" %q", main->output.to.stream, rule.cgroup.as_new ? controller_new_s : controller_existing_s); for (i = 0; i < rule.cgroup.groups.used; ++i) { @@ -5537,25 +5494,25 @@ extern "C" { } // for } - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); - // how. - fl_print_format(" %[%s%] %s%q", main->output.to.stream, main->context.set.important, controller_how_s, main->context.set.important, options & controller_process_option_asynchronous_d ? controller_asynchronous_s : controller_synchronous_s, f_string_eol_s); + // How. + fl_print_format(" %[%q%] %q%q", main->output.to.stream, main->context.set.important, controller_how_s, main->context.set.important, options & controller_process_option_asynchronous_d ? controller_asynchronous_s : controller_synchronous_s, f_string_eol_s); - // nice. - fl_print_format(" %[%s%]", main->output.to.stream, main->context.set.important, controller_nice_s, main->context.set.important); + // Nice. + fl_print_format(" %[%q%]", main->output.to.stream, main->context.set.important, controller_nice_s, main->context.set.important); if (rule.has & controller_rule_has_nice_d) { fl_print_format(" %i", main->output.to.stream, rule.nice); } - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); - // scheduler. - fl_print_format(" %[%s%]", main->output.to.stream, main->context.set.important, controller_scheduler_s, main->context.set.important); + // Scheduler. + fl_print_format(" %[%q%]", main->output.to.stream, main->context.set.important, controller_scheduler_s, main->context.set.important); if (rule.has & controller_rule_has_scheduler_d) { - f_string_t policy = ""; + f_string_static_t policy = f_string_static_t_initialize; if (rule.scheduler.policy == SCHED_BATCH) { policy = controller_batch_s; @@ -5576,35 +5533,35 @@ extern "C" { policy = controller_round_robin_s; } - fl_print_format(" %s %i", main->output.to.stream, policy, rule.scheduler.priority); + fl_print_format(" %q %i", main->output.to.stream, policy, rule.scheduler.priority); } - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); // script. - fl_print_format(" %[%s%] %Q%q", main->output.to.stream, main->context.set.important, controller_script_s, main->context.set.important, rule.script, f_string_eol_s); + fl_print_format(" %[%q%] %Q%q", main->output.to.stream, main->context.set.important, controller_script_s, main->context.set.important, rule.script, f_string_eol_s); // user. - fl_print_format(" %[%s%]", main->output.to.stream, main->context.set.important, controller_user_s, main->context.set.important); + fl_print_format(" %[%q%]", main->output.to.stream, main->context.set.important, controller_user_s, main->context.set.important); if (rule.has & controller_rule_has_user_d) { fl_print_format(" %i", main->output.to.stream, rule.user); } - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); // wait. - fl_print_format(" %[%s%] %s%q", main->output.to.stream, main->context.set.important, controller_wait_s, main->context.set.important, options & controller_process_option_wait_d ? controller_yes_s : controller_no_s, f_string_eol_s); + fl_print_format(" %[%q%] %q%q", main->output.to.stream, main->context.set.important, controller_wait_s, main->context.set.important, options & controller_process_option_wait_d ? controller_yes_s : controller_no_s, f_string_eol_s); // affinity. - fl_print_format(" %[%s%] {%q", main->output.to.stream, main->context.set.important, controller_affinity_s, main->context.set.important, f_string_eol_s); + fl_print_format(" %[%q%] {%q", main->output.to.stream, main->context.set.important, controller_affinity_s, main->context.set.important, f_string_eol_s); for (i = 0; i < rule.affinity.used; ++i) { fl_print_format(" %i%q", main->output.to.stream, rule.affinity.array[i], f_string_eol_s); } // for // define. - fl_print_format(" }%q %[%s%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_define_s, main->context.set.important, f_string_eol_s); + fl_print_format(" }%q %[%q%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_define_s, main->context.set.important, f_string_eol_s); for (i = 0; i < rule.define.used; ++i) { @@ -5614,7 +5571,7 @@ extern "C" { } // for // environment. - fl_print_format(" }%q %[%s%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_environment_s, main->context.set.important, f_string_eol_s); + fl_print_format(" }%q %[%q%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_environment_s, main->context.set.important, f_string_eol_s); for (i = 0; i < rule.environment.used; ++i) { @@ -5623,7 +5580,7 @@ extern "C" { } } // for - fl_print_format(" }%q %[%s%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_parameter_s, main->context.set.important, f_string_eol_s); + fl_print_format(" }%q %[%q%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_parameter_s, main->context.set.important, f_string_eol_s); // parameter. for (i = 0; i < rule.parameter.used; ++i) { @@ -5634,7 +5591,7 @@ extern "C" { } // for // group. - fl_print_format(" }%q %[%s%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_group_s, main->context.set.important, f_string_eol_s); + fl_print_format(" }%q %[%q%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_group_s, main->context.set.important, f_string_eol_s); if (rule.has & controller_rule_has_group_d) { fl_print_format(" %i%q", main->output.to.stream, rule.group, f_string_eol_s); @@ -5645,21 +5602,21 @@ extern "C" { } // limit. - fl_print_format(" }%q %[%s%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_limit_s, main->context.set.important, f_string_eol_s); + fl_print_format(" }%q %[%q%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_limit_s, main->context.set.important, f_string_eol_s); for (i = 0; i < rule.limits.used; ++i) { fl_print_format(" %Q %[=%] %un %un%q", main->output.to.stream, controller_rule_setting_limit_type_name(rule.limits.array[i].type), main->context.set.important, main->context.set.important, rule.limits.array[i].value.rlim_cur, rule.limits.array[i].value.rlim_max, f_string_eol_s); } // for // on. - fl_print_format(" }%q %[%s%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_on_s, main->context.set.important, f_string_eol_s); + fl_print_format(" }%q %[%q%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_on_s, main->context.set.important, f_string_eol_s); for (i = 0; i < rule.ons.used; ++i) { - fl_print_format(" %[%s%] {%q", main->output.to.stream, main->context.set.important, controller_action_s, main->context.set.important, f_string_eol_s); + fl_print_format(" %[%q%] {%q", main->output.to.stream, main->context.set.important, controller_action_s, main->context.set.important, f_string_eol_s); { - f_string_t action = ""; + f_string_static_t action = f_string_static_t_initialize; if (rule.ons.array[i].action == controller_rule_action_type_freeze_e) { action = controller_freeze_s; @@ -5689,10 +5646,10 @@ extern "C" { action = controller_thaw_s; } - fl_print_format(" %[%s%] %s%q", main->output.to.stream, main->context.set.important, controller_type_s, main->context.set.important, action, f_string_eol_s); + fl_print_format(" %[%q%] %q%q", main->output.to.stream, main->context.set.important, controller_type_s, main->context.set.important, action, f_string_eol_s); } - fl_print_format(" %[%s%] {%q", main->output.to.stream, main->context.set.important, controller_need_s, main->context.set.important, f_string_eol_s); + fl_print_format(" %[%q%] {%q", main->output.to.stream, main->context.set.important, controller_need_s, main->context.set.important, f_string_eol_s); for (j = 0; j < rule.ons.array[i].need.used; ++j) { @@ -5701,7 +5658,7 @@ extern "C" { } } // for - fl_print_format(" }%q %[%s%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_want_s, main->context.set.important, f_string_eol_s); + fl_print_format(" }%q %[%q%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_want_s, main->context.set.important, f_string_eol_s); for (j = 0; j < rule.ons.array[i].want.used; ++j) { @@ -5710,7 +5667,7 @@ extern "C" { } } // for - fl_print_format(" }%q %[%s%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_wish_s, main->context.set.important, f_string_eol_s); + fl_print_format(" }%q %[%q%] {%q", main->output.to.stream, f_string_eol_s, main->context.set.important, controller_wish_s, main->context.set.important, f_string_eol_s); for (j = 0; j < rule.ons.array[i].wish.used; ++j) { @@ -5738,41 +5695,41 @@ extern "C" { item = &rule.items.array[i]; - fl_print_format(" %[%s%] {%q", main->output.to.stream, main->context.set.important, controller_item_s, main->context.set.important, f_string_eol_s); + fl_print_format(" %[%q%] {%q", main->output.to.stream, main->context.set.important, controller_item_s, main->context.set.important, f_string_eol_s); // type. - fl_print_format(" %[%s%] %Q%q", main->output.to.stream, main->context.set.important, controller_type_s, main->context.set.important, controller_rule_item_type_name(item->type), f_string_eol_s); + fl_print_format(" %[%q%] %Q%q", main->output.to.stream, main->context.set.important, controller_type_s, main->context.set.important, controller_rule_item_type_name(item->type), f_string_eol_s); // pid_file. - fl_print_format(" %[%s%]", main->output.to.stream, main->context.set.important, controller_pid_file_s, main->context.set.important); + fl_print_format(" %[%q%]", main->output.to.stream, main->context.set.important, controller_pid_file_s, main->context.set.important); if (item->pid_file.used) { fl_print_format(" %Q", main->output.to.stream, item->pid_file); } - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); // with. - fl_print_format(" %[%s%]", main->output.to.stream, main->context.set.important, controller_with_s, main->context.set.important); + fl_print_format(" %[%q%]", main->output.to.stream, main->context.set.important, controller_with_s, main->context.set.important); if (item->with & controller_with_full_path_d) { - fl_print_format(" %s", main->output.to.stream, controller_full_path_s); + fl_print_format(" %q", main->output.to.stream, controller_full_path_s); } if (item->with & controller_with_session_new_d) { - fl_print_format(" %s", main->output.to.stream, controller_session_new_s); + fl_print_format(" %q", main->output.to.stream, controller_session_new_s); } if (item->with & controller_with_session_same_d) { - fl_print_format(" %s", main->output.to.stream, controller_session_same_s); + fl_print_format(" %q", main->output.to.stream, controller_session_same_s); } - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); // actions. for (j = 0; j < item->actions.used; ++j) { action = &item->actions.array[j]; - fl_print_format(" %[%s%] {%q", main->output.to.stream, main->context.set.important, controller_action_s, main->context.set.important, f_string_eol_s); - fl_print_format(" %[%s%] %q%q", main->output.to.stream, main->context.set.important, controller_type_s, main->context.set.important, controller_rule_action_type_name(action->type), f_string_eol_s); + fl_print_format(" %[%q%] {%q", main->output.to.stream, main->context.set.important, controller_action_s, main->context.set.important, f_string_eol_s); + fl_print_format(" %[%q%] %q%q", main->output.to.stream, main->context.set.important, controller_type_s, main->context.set.important, controller_rule_action_type_name(action->type), f_string_eol_s); if (item->type == controller_rule_item_type_script_e || item->type == controller_rule_item_type_utility_e) { - fl_print_format(" %[%s%] {%q", main->output.to.stream, main->context.set.important, controller_parameter_s, main->context.set.important, f_string_eol_s); + fl_print_format(" %[%q%] {%q", main->output.to.stream, main->context.set.important, controller_parameter_s, main->context.set.important, f_string_eol_s); parameter = &action->parameters.array[0]; @@ -5783,7 +5740,7 @@ extern "C" { if (parameter->string[k] == f_fss_eol_s.string[0]) { if (k + 1 < parameter->used) { - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); f_print_terminated(" ", main->output.to.stream); } } @@ -5793,14 +5750,14 @@ extern "C" { } } // for - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); } fl_print_format(" }%q", main->output.to.stream, f_string_eol_s); } else { for (k = 0; k < action->parameters.used; ++k) { - fl_print_format(" %[%s%] %Q%q", main->output.to.stream, main->context.set.important, controller_parameter_s, main->context.set.important, action->parameters.array[k], f_string_eol_s); + fl_print_format(" %[%q%] %Q%q", main->output.to.stream, main->context.set.important, controller_parameter_s, main->context.set.important, action->parameters.array[k], f_string_eol_s); } // for } @@ -5808,7 +5765,7 @@ extern "C" { } // for // rerun. - fl_print_format(" %[%s%] {%q", main->output.to.stream, main->context.set.important, controller_rerun_s, main->context.set.important, f_string_eol_s); + fl_print_format(" %[%q%] {%q", main->output.to.stream, main->context.set.important, controller_rerun_s, main->context.set.important, f_string_eol_s); for (j = 0; j < controller_rule_action_type_execute__enum_size_e; ++j) { for (k = 0; k < 2; ++k) { @@ -5826,53 +5783,53 @@ extern "C" { fl_print_format(" %[", main->output.to.stream, main->context.set.important); switch (j) { case controller_rule_action_type_execute_freeze_e: - f_print_terminated(controller_freeze_s, main->output.to.stream); + f_print_dynamic(controller_freeze_s, main->output.to.stream); break; case controller_rule_action_type_execute_kill_e: - f_print_terminated(controller_kill_s, main->output.to.stream); + f_print_dynamic(controller_kill_s, main->output.to.stream); break; case controller_rule_action_type_execute_pause_e: - f_print_terminated(controller_pause_s, main->output.to.stream); + f_print_dynamic(controller_pause_s, main->output.to.stream); break; case controller_rule_action_type_execute_reload_e: - f_print_terminated(controller_reload_s, main->output.to.stream); + f_print_dynamic(controller_reload_s, main->output.to.stream); break; case controller_rule_action_type_execute_restart_e: - f_print_terminated(controller_restart_s, main->output.to.stream); + f_print_dynamic(controller_restart_s, main->output.to.stream); break; case controller_rule_action_type_execute_resume_e: - f_print_terminated(controller_resume_s, main->output.to.stream); + f_print_dynamic(controller_resume_s, main->output.to.stream); break; case controller_rule_action_type_execute_start_e: - f_print_terminated(controller_start_s, main->output.to.stream); + f_print_dynamic(controller_start_s, main->output.to.stream); break; case controller_rule_action_type_execute_stop_e: - f_print_terminated(controller_stop_s, main->output.to.stream); + f_print_dynamic(controller_stop_s, main->output.to.stream); break; case controller_rule_action_type_execute_thaw_e: - f_print_terminated(controller_thaw_s, main->output.to.stream); + f_print_dynamic(controller_thaw_s, main->output.to.stream); break; default: break; } - fl_print_format("%] %s", main->output.to.stream, main->context.set.important, k ? controller_success_s : controller_failure_s); - fl_print_format(" %s %ul %s %ul", main->output.to.stream, controller_delay_s, rerun_item->delay, controller_max_s, rerun_item->max); + fl_print_format("%] %q", main->output.to.stream, main->context.set.important, k ? controller_success_s : controller_failure_s); + fl_print_format(" %q %ul %q %ul", main->output.to.stream, controller_delay_s, rerun_item->delay, controller_max_s, rerun_item->max); if (!k && (item->reruns[j].is & controller_rule_rerun_is_failure_reset_d) || k && (item->reruns[j].is & controller_rule_rerun_is_success_reset_d)) { - fl_print_format(" %s", main->output.to.stream, controller_reset_s); + fl_print_format(" %q", main->output.to.stream, controller_reset_s); } - f_print_terminated(f_string_eol_s, main->output.to.stream); + f_print_dynamic(f_string_eol_s, main->output.to.stream); } // for } // for fl_print_format(" }%q", main->output.to.stream, f_string_eol_s); diff --git a/level_3/controller/c/rule/private-rule_print.c b/level_3/controller/c/rule/private-rule_print.c index 5a79020..46db4de 100644 --- a/level_3/controller/c/rule/private-rule_print.c +++ b/level_3/controller/c/rule/private-rule_print.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../rule/private-rule_print.h" #include "../lock/private-lock_print.h" @@ -34,7 +34,7 @@ extern "C" { fl_print_format("%q%[%QWhile processing ", print.to.stream, f_string_eol_s, print.context, print.prefix); if (cache.name_action.used) { - fl_print_format("%s '%]", print.to.stream, item ? controller_action_s : controller_value_s, print.context); + fl_print_format("%q '%]", print.to.stream, item ? controller_action_s : controller_value_s, print.context); fl_print_format("%[%Q%]", print.to.stream, print.notable, cache.name_action, print.notable); fl_print_format("%[' on line%] ", print.to.stream, print.context, print.context); fl_print_format("%[%un%]", print.to.stream, print.notable, cache.line_action, print.notable); @@ -42,7 +42,7 @@ extern "C" { } if (cache.name_item.used) { - fl_print_format("rule %s '%]", print.to.stream, item ? controller_item_s : controller_setting_s, print.context); + fl_print_format("rule %q '%]", print.to.stream, item ? controller_item_s : controller_setting_s, print.context); fl_print_format("%[%Q%]", print.to.stream, print.notable, cache.name_item, print.notable); fl_print_format("%[' on line%] ", print.to.stream, print.context, print.context); fl_print_format("%[%un%]", print.to.stream, print.notable, cache.line_item, print.notable); @@ -89,16 +89,16 @@ extern "C" { fl_print_format("%[' failed due to a failure to setup the '%]%[", print->to.stream, print->context, print->context, print->notable); if (status == F_control_group) { - f_print_terminated(controller_cgroup_s, print->to.stream); + f_print_dynamic(controller_cgroup_s, print->to.stream); } else if (status == F_limit) { - f_print_terminated(controller_limit_s, print->to.stream); + f_print_dynamic(controller_limit_s, print->to.stream); } else if (status == F_processor) { - f_print_terminated(controller_processor_s, print->to.stream); + f_print_dynamic(controller_processor_s, print->to.stream); } else if (status == F_schedule) { - f_print_terminated(controller_scheduler_s, print->to.stream); + f_print_dynamic(controller_scheduler_s, print->to.stream); } fl_print_format("%]%['.%]%q", print->to.stream, print->notable, print->context, print->context, f_string_eol_s); @@ -301,7 +301,7 @@ extern "C" { #endif // _di_controller_rule_setting_read_print_error_with_range_ #ifndef _di_controller_rule_setting_read_print_value_ - void controller_rule_setting_read_print_value(const controller_global_t global, const f_string_t name, const f_string_t name_sub, const f_string_static_t value, const f_string_t suffix) { + void controller_rule_setting_read_print_value(const controller_global_t global, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_t suffix) { if (global.main->error.verbosity != f_console_verbosity_debug_e && !(global.main->error.verbosity == f_console_verbosity_verbose_e && global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e)) { return; @@ -309,9 +309,9 @@ extern "C" { controller_lock_print(global.main->output.to, global.thread); - fl_print_format("%qProcessing rule item action '%[%S%]' setting ", global.main->output.to.stream, f_string_eol_s, global.main->context.set.title, name, global.main->context.set.title); + fl_print_format("%qProcessing rule item action '%[%Q%]' setting ", global.main->output.to.stream, f_string_eol_s, global.main->context.set.title, name, global.main->context.set.title); - if (name_sub) { + if (name_sub.used) { fl_print_format("'%[%S%]'", global.main->output.to.stream, global.main->context.set.notable, name_sub, global.main->context.set.notable); } else { @@ -326,7 +326,7 @@ extern "C" { #endif // _di_controller_rule_setting_read_print_value_ #ifndef _di_controller_rule_setting_read_print_values_ - void controller_rule_setting_read_print_values(const controller_global_t global, const f_string_t name, const f_array_length_t index, controller_cache_t * const cache) { + void controller_rule_setting_read_print_values(const controller_global_t global, const f_string_static_t name, const f_array_length_t index, controller_cache_t * const cache) { if (global.main->error.verbosity != f_console_verbosity_debug_e && !(global.main->error.verbosity == f_console_verbosity_verbose_e && global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e)) { return; @@ -334,7 +334,7 @@ extern "C" { controller_lock_print(global.main->output.to, global.thread); - fl_print_format("%qProcessing rule item action '%[%S%]' setting value to", global.main->output.to.stream, f_string_eol_s, global.main->context.set.title, name, global.main->context.set.title); + fl_print_format("%qProcessing rule item action '%[%Q%]' setting value to", global.main->output.to.stream, f_string_eol_s, global.main->context.set.title, name, global.main->context.set.title); for (f_array_length_t j = 0; j < cache->content_actions.array[index].used; ++j) { diff --git a/level_3/controller/c/rule/private-rule_print.h b/level_3/controller/c/rule/private-rule_print.h index ae7080e..237d6bd 100644 --- a/level_3/controller/c/rule/private-rule_print.h +++ b/level_3/controller/c/rule/private-rule_print.h @@ -212,15 +212,15 @@ extern "C" { * @param name * The Object name of the setting being populated. * @param name_sub - * (optional) A sub-name associated with the setting being populated. - * Set to NULL to disable. + * A sub-name associated with the setting being populated. + * Set to a string with used set to 0 to not use. * @param value * The value being set. * @param suffix * An additional message to append at the end (before the final period). */ #ifndef _di_controller_rule_setting_read_print_value_ - extern void controller_rule_setting_read_print_value(const controller_global_t global, const f_string_t name, const f_string_t name_sub, const f_string_static_t value, const f_string_t suffix) F_attribute_visibility_internal_d; + extern void controller_rule_setting_read_print_value(const controller_global_t global, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_t suffix) F_attribute_visibility_internal_d; #endif // _di_controller_rule_setting_read_print_value_ /** @@ -238,7 +238,7 @@ extern "C" { * A structure for containing and caching relevant data. */ #ifndef _di_controller_rule_setting_read_print_values_ - extern void controller_rule_setting_read_print_values(const controller_global_t global, const f_string_t name, const f_array_length_t index, controller_cache_t * const cache) F_attribute_visibility_internal_d; + extern void controller_rule_setting_read_print_values(const controller_global_t global, const f_string_static_t name, const f_array_length_t index, controller_cache_t * const cache) F_attribute_visibility_internal_d; #endif // _di_controller_rule_setting_read_print_values_ #ifdef __cplusplus diff --git a/level_3/controller/c/task/private-task.c b/level_3/controller/c/task/private-task.c index 68f0575..2436e3d 100644 --- a/level_3/controller/c/task/private-task.c +++ b/level_3/controller/c/task/private-task.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../task/private-task.h" diff --git a/level_3/controller/c/task/private-task_print.c b/level_3/controller/c/task/private-task_print.c index b17f5e4..de1fd02 100644 --- a/level_3/controller/c/task/private-task_print.c +++ b/level_3/controller/c/task/private-task_print.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../task/private-task.h" #include "../task/private-task_print.h" diff --git a/level_3/controller/c/thread/private-thread.c b/level_3/controller/c/thread/private-thread.c index 98ff51f..c1913d9 100644 --- a/level_3/controller/c/thread/private-thread.c +++ b/level_3/controller/c/thread/private-thread.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../controller/private-controller.h" #include "../controller/private-controller_print.h" @@ -222,8 +222,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(main->error.to, &thread); - fl_print_format("%q%[%SThe pid file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, setting->path_pid.string, main->error.notable); + fl_print_format("%q%[%QThe pid file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, setting->path_pid, main->error.notable); fl_print_format("%[' must not already exist.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); controller_unlock_print_flush(main->error.to, &thread); diff --git a/level_3/controller/c/thread/private-thread_control.c b/level_3/controller/c/thread/private-thread_control.c index 952c762..fd3b5dd 100644 --- a/level_3/controller/c/thread/private-thread_control.c +++ b/level_3/controller/c/thread/private-thread_control.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../control/private-control.h" #include "../controller/private-controller_print.h" diff --git a/level_3/controller/c/thread/private-thread_entry.c b/level_3/controller/c/thread/private-thread_entry.c index 63a5517..b0f4e68 100644 --- a/level_3/controller/c/thread/private-thread_entry.c +++ b/level_3/controller/c/thread/private-thread_entry.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../entry/private-entry.h" #include "../lock/private-lock_print.h" @@ -42,7 +42,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(main->error.to, entry->global->thread); - fl_print_format("%q%[%SThe pid file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_format("%q%[%QThe pid file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, entry->setting->path_pid, main->error.notable); fl_print_format("%[' must not already exist.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -81,7 +81,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(main->error.to, entry->global->thread); - fl_print_format("%q%[%SFailed while processing requested failsafe item '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_format("%q%[%QFailed while processing requested failsafe item '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, entry->global->setting->entry.items.array[entry->global->setting->failsafe_enabled].name, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -196,7 +196,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(main->error.to, entry->global->thread); - fl_print_format("%q%[%SFailed while processing requested failsafe item '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_format("%q%[%QFailed while processing requested failsafe item '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, entry->global->setting->entry.items.array[entry->global->setting->failsafe_enabled].name, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); diff --git a/level_3/controller/c/thread/private-thread_process.c b/level_3/controller/c/thread/private-thread_process.c index 4bbe3d4..2f95c6f 100644 --- a/level_3/controller/c/thread/private-thread_process.c +++ b/level_3/controller/c/thread/private-thread_process.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../controller/private-controller.h" #include "../controller/private-controller_print.h" diff --git a/level_3/controller/c/thread/private-thread_rule.c b/level_3/controller/c/thread/private-thread_rule.c index b2cef6d..6f444c1 100644 --- a/level_3/controller/c/thread/private-thread_rule.c +++ b/level_3/controller/c/thread/private-thread_rule.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "private-thread.h" #include "private-thread_rule.h" diff --git a/level_3/controller/c/thread/private-thread_signal.c b/level_3/controller/c/thread/private-thread_signal.c index 1ea524e..7684780 100644 --- a/level_3/controller/c/thread/private-thread_signal.c +++ b/level_3/controller/c/thread/private-thread_signal.c @@ -1,4 +1,4 @@ -#include "../controller/controller.h" +#include "../controller.h" #include "../common/private-common.h" #include "../controller/private-controller.h" #include "private-thread.h" diff --git a/level_3/controller/data/build/settings b/level_3/controller/data/build/settings index 72c01b0..86a5fc0 100644 --- a/level_3/controller/data/build/settings +++ b/level_3/controller/data/build/settings @@ -21,33 +21,29 @@ build_indexer ar build_indexer_arguments rcs build_language c build_libraries -lc -lcap - build_libraries-individual -lfll_control_group -lfll_error -lfll_execute -lfll_fss -lfll_path -lfll_print -lfll_program build_libraries-individual -lfl_console -lfl_control_group -lfl_conversion -lfl_directory -lfl_environment -lfl_fss -lfl_iki -lfl_print -lfl_string build_libraries-individual -lf_account -lf_capability -lf_color -lf_console -lf_control_group -lf_conversion -lf_directory -lf_environment -lf_execute -lf_file -lf_fss -lf_iki -lf_limit -lf_memory -lf_path -lf_pipe -lf_print -lf_signal -lf_socket -lf_status_string -lf_string -lf_thread -lf_type_array -lf_utf - build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static +build_sources_library controller.c common.c build_sources_library common/private-common.c common/private-cache.c common/private-control.c common/private-entry.c common/private-lock.c common/private-process.c common/private-rule.c common/private-setting.c common/private-task.c common/private-thread.c build_sources_library control/private-control.c control/private-control_print.c -build_sources_library controller/controller.c controller/private-controller.c controller/private-controller_print.c +build_sources_library controller/private-controller.c controller/private-controller_print.c build_sources_library entry/private-entry.c entry/private-entry_print.c build_sources_library rule/private-rule.c rule/private-rule_print.c build_sources_library process/private-process.c build_sources_library task/private-task.c task/private-task_print.c build_sources_library lock/private-lock.c lock/private-lock_print.c build_sources_library thread/private-thread.c thread/private-thread_control.c thread/private-thread_entry.c thread/private-thread_process.c thread/private-thread_rule.c thread/private-thread_signal.c -build_sources_library -build_sources_library -build_sources_library build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers controller.h +build_sources_headers controller.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fake/c/common.c b/level_3/fake/c/common.c new file mode 100644 index 0000000..e1e1047 --- /dev/null +++ b/level_3/fake/c/common.c @@ -0,0 +1,192 @@ +#include "fake.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fake_program_version_ + const f_string_static_t fake_program_version_s = macro_f_string_static_t_initialize2(FAKE_program_version_s, 0, FAKE_program_version_s_length); +#endif // _di_fake_program_version_ + +#ifndef _di_fake_program_name_ + const f_string_static_t fake_program_name_s = macro_f_string_static_t_initialize2(FAKE_program_name_s, 0, FAKE_program_name_s_length); + const f_string_static_t fake_program_name_long_s = macro_f_string_static_t_initialize2(FAKE_program_name_long_s, 0, FAKE_program_name_long_s_length); +#endif // _di_fake_program_name_ + +#ifndef _di_fake_program_help_parameters_ + const f_string_static_t fake_program_help_parameters_s = macro_f_string_static_t_initialize2(FAKE_program_help_parameters_s, 0, FAKE_program_help_parameters_s_length); +#endif // _di_fake_program_help_parameters_ + +/** + * The build operation utilizes pre-defined path structures. + * These structures are hard-coded by their individual pieces to be constructed later on. + */ +#ifndef _di_fake_path_ + const f_string_static_t fake_path_part_bash_s = macro_f_string_static_t_initialize2(FAKE_path_part_bash_s, 0, FAKE_path_part_bash_s_length); + const f_string_static_t fake_path_part_build_s = macro_f_string_static_t_initialize2(FAKE_path_part_build_s, 0, FAKE_path_part_build_s_length); + const f_string_static_t fake_path_part_c_s = macro_f_string_static_t_initialize2(FAKE_path_part_c_s, 0, FAKE_path_part_c_s_length); + const f_string_static_t fake_path_part_cpp_s = macro_f_string_static_t_initialize2(FAKE_path_part_cpp_s, 0, FAKE_path_part_cpp_s_length); + const f_string_static_t fake_path_part_data_s = macro_f_string_static_t_initialize2(FAKE_path_part_data_s, 0, FAKE_path_part_data_s_length); + const f_string_static_t fake_path_part_documents_s = macro_f_string_static_t_initialize2(FAKE_path_part_documents_s, 0, FAKE_path_part_documents_s_length); + const f_string_static_t fake_path_part_includes_s = macro_f_string_static_t_initialize2(FAKE_path_part_includes_s, 0, FAKE_path_part_includes_s_length); + const f_string_static_t fake_path_part_libraries_s = macro_f_string_static_t_initialize2(FAKE_path_part_libraries_s, 0, FAKE_path_part_libraries_s_length); + const f_string_static_t fake_path_part_licenses_s = macro_f_string_static_t_initialize2(FAKE_path_part_licenses_s, 0, FAKE_path_part_licenses_s_length); + const f_string_static_t fake_path_part_objects_s = macro_f_string_static_t_initialize2(FAKE_path_part_objects_s, 0, FAKE_path_part_objects_s_length); + const f_string_static_t fake_path_part_process_s = macro_f_string_static_t_initialize2(FAKE_path_part_process_s, 0, FAKE_path_part_process_s_length); + const f_string_static_t fake_path_part_programs_s = macro_f_string_static_t_initialize2(FAKE_path_part_programs_s, 0, FAKE_path_part_programs_s_length); + const f_string_static_t fake_path_part_script_s = macro_f_string_static_t_initialize2(FAKE_path_part_script_s, 0, FAKE_path_part_script_s_length); + const f_string_static_t fake_path_part_settings_s = macro_f_string_static_t_initialize2(FAKE_path_part_settings_s, 0, FAKE_path_part_settings_s_length); + const f_string_static_t fake_path_part_shared_s = macro_f_string_static_t_initialize2(FAKE_path_part_shared_s, 0, FAKE_path_part_shared_s_length); + const f_string_static_t fake_path_part_stage_s = macro_f_string_static_t_initialize2(FAKE_path_part_stage_s, 0, FAKE_path_part_stage_s_length); + const f_string_static_t fake_path_part_static_s = macro_f_string_static_t_initialize2(FAKE_path_part_static_s, 0, FAKE_path_part_static_s_length); +#endif // _di_fake_path_ + +#ifndef _di_fake_file_ + const f_string_static_t fake_file_defines_s = macro_f_string_static_t_initialize2(FAKE_file_defines_s, 0, FAKE_file_defines_s_length); + const f_string_static_t fake_file_dependencies_s = macro_f_string_static_t_initialize2(FAKE_file_dependencies_s, 0, FAKE_file_dependencies_s_length); + const f_string_static_t fake_file_process_pre_s = macro_f_string_static_t_initialize2(FAKE_file_process_pre_s, 0, FAKE_file_process_pre_s_length); + const f_string_static_t fake_file_process_post_s = macro_f_string_static_t_initialize2(FAKE_file_process_post_s, 0, FAKE_file_process_post_s_length); + const f_string_static_t fake_file_readme_s = macro_f_string_static_t_initialize2(FAKE_file_readme_s, 0, FAKE_file_readme_s_length); +#endif // _di_fake_file_ + +/** + * Provide default settings. + */ +#ifndef _di_fake_defaults_ + const f_string_static_t fake_default_path_build_s = macro_f_string_static_t_initialize2(FAKE_default_path_build_s, 0, FAKE_default_path_build_s_length); + const f_string_static_t fake_default_path_data_s = macro_f_string_static_t_initialize2(FAKE_default_path_data_s, 0, FAKE_default_path_data_s_length); + const f_string_static_t fake_default_path_sources_s = macro_f_string_static_t_initialize2(FAKE_default_path_sources_s, 0, FAKE_default_path_sources_s_length); + const f_string_static_t fake_default_path_work_s = macro_f_string_static_t_initialize2(FAKE_default_path_work_s, 0, FAKE_default_path_work_s_length); + + const f_string_static_t fake_default_define_s = macro_f_string_static_t_initialize2(FAKE_default_define_s, 0, FAKE_default_define_s_length); + const f_string_static_t fake_default_fakefile_s = macro_f_string_static_t_initialize2(FAKE_default_fakefile_s, 0, FAKE_default_fakefile_s_length); + const f_string_static_t fake_default_mode_s = macro_f_string_static_t_initialize2(FAKE_default_mode_s, 0, FAKE_default_mode_s_length); + const f_string_static_t fake_default_process_s = macro_f_string_static_t_initialize2(FAKE_default_process_s, 0, FAKE_default_process_s_length); + const f_string_static_t fake_default_settings_s = macro_f_string_static_t_initialize2(FAKE_default_settings_s, 0, FAKE_default_settings_s_length); +#endif // _di_fake_defaults_ + +#ifndef _di_fake_build_language_ + const f_string_static_t fake_build_language_bash_s = macro_f_string_static_t_initialize2(FAKE_build_language_bash_s, 0, FAKE_build_language_bash_s_length); + const f_string_static_t fake_build_language_c_s = macro_f_string_static_t_initialize2(FAKE_build_language_c_s, 0, FAKE_build_language_c_s_length); + const f_string_static_t fake_build_language_cpp_s = macro_f_string_static_t_initialize2(FAKE_build_language_cpp_s, 0, FAKE_build_language_cpp_s_length); +#endif // _di_fake_build_language_ + +#ifndef _di_fake_build_version_ + const f_string_static_t fake_build_version_major_s = macro_f_string_static_t_initialize2(FAKE_build_version_major_s, 0, FAKE_build_version_major_s_length); + const f_string_static_t fake_build_version_minor_s = macro_f_string_static_t_initialize2(FAKE_build_version_minor_s, 0, FAKE_build_version_minor_s_length); + const f_string_static_t fake_build_version_micro_s = macro_f_string_static_t_initialize2(FAKE_build_version_micro_s, 0, FAKE_build_version_micro_s_length); + const f_string_static_t fake_build_version_nano_s = macro_f_string_static_t_initialize2(FAKE_build_version_nano_s, 0, FAKE_build_version_nano_s_length); +#endif // _di_fake_build_version_ + +#ifndef _di_fake_defines_ + const f_string_static_t fake_short_define_s = macro_f_string_static_t_initialize2(FAKE_short_define_s, 0, FAKE_short_define_s_length); + const f_string_static_t fake_short_fakefile_s = macro_f_string_static_t_initialize2(FAKE_short_fakefile_s, 0, FAKE_short_fakefile_s_length); + const f_string_static_t fake_short_mode_s = macro_f_string_static_t_initialize2(FAKE_short_mode_s, 0, FAKE_short_mode_s_length); + const f_string_static_t fake_short_process_s = macro_f_string_static_t_initialize2(FAKE_short_process_s, 0, FAKE_short_process_s_length); + const f_string_static_t fake_short_settings_s = macro_f_string_static_t_initialize2(FAKE_short_settings_s, 0, FAKE_short_settings_s_length); + + const f_string_static_t fake_short_path_build_s = macro_f_string_static_t_initialize2(FAKE_short_path_build_s, 0, FAKE_short_path_build_s_length); + const f_string_static_t fake_short_path_data_s = macro_f_string_static_t_initialize2(FAKE_short_path_data_s, 0, FAKE_short_path_data_s_length); + const f_string_static_t fake_short_path_sources_s = macro_f_string_static_t_initialize2(FAKE_short_path_sources_s, 0, FAKE_short_path_sources_s_length); + const f_string_static_t fake_short_path_work_s = macro_f_string_static_t_initialize2(FAKE_short_path_work_s, 0, FAKE_short_path_work_s_length); + + const f_string_static_t fake_long_define_s = macro_f_string_static_t_initialize2(FAKE_long_define_s, 0, FAKE_long_define_s_length); + const f_string_static_t fake_long_fakefile_s = macro_f_string_static_t_initialize2(FAKE_long_fakefile_s, 0, FAKE_long_fakefile_s_length); + const f_string_static_t fake_long_mode_s = macro_f_string_static_t_initialize2(FAKE_long_mode_s, 0, FAKE_long_mode_s_length); + const f_string_static_t fake_long_process_s = macro_f_string_static_t_initialize2(FAKE_long_process_s, 0, FAKE_long_process_s_length); + const f_string_static_t fake_long_settings_s = macro_f_string_static_t_initialize2(FAKE_long_settings_s, 0, FAKE_long_settings_s_length); + + const f_string_static_t fake_long_path_build_s = macro_f_string_static_t_initialize2(FAKE_long_path_build_s, 0, FAKE_long_path_build_s_length); + const f_string_static_t fake_long_path_data_s = macro_f_string_static_t_initialize2(FAKE_long_path_data_s, 0, FAKE_long_path_data_s_length); + const f_string_static_t fake_long_path_sources_s = macro_f_string_static_t_initialize2(FAKE_long_path_sources_s, 0, FAKE_long_path_sources_s_length); + const f_string_static_t fake_long_path_work_s = macro_f_string_static_t_initialize2(FAKE_long_path_work_s, 0, FAKE_long_path_work_s_length); + + const f_string_static_t fake_long_documents_disabled_s = macro_f_string_static_t_initialize2(FAKE_long_documents_disabled_s, 0, FAKE_long_documents_disabled_s_length); + const f_string_static_t fake_long_documents_enabled_s = macro_f_string_static_t_initialize2(FAKE_long_documents_enabled_s, 0, FAKE_long_documents_enabled_s_length); + const f_string_static_t fake_long_shared_disabled_s = macro_f_string_static_t_initialize2(FAKE_long_shared_disabled_s, 0, FAKE_long_shared_disabled_s_length); + const f_string_static_t fake_long_shared_enabled_s = macro_f_string_static_t_initialize2(FAKE_long_shared_enabled_s, 0, FAKE_long_shared_enabled_s_length); + const f_string_static_t fake_long_static_disabled_s = macro_f_string_static_t_initialize2(FAKE_long_static_disabled_s, 0, FAKE_long_static_disabled_s_length); + const f_string_static_t fake_long_static_enabled_s = macro_f_string_static_t_initialize2(FAKE_long_static_enabled_s, 0, FAKE_long_static_enabled_s_length); + + const f_string_static_t fake_other_operation_build_s = macro_f_string_static_t_initialize2(FAKE_other_operation_build_s, 0, FAKE_other_operation_build_s_length); + const f_string_static_t fake_other_operation_clean_s = macro_f_string_static_t_initialize2(FAKE_other_operation_clean_s, 0, FAKE_other_operation_clean_s_length); + const f_string_static_t fake_other_operation_make_s = macro_f_string_static_t_initialize2(FAKE_other_operation_make_s, 0, FAKE_other_operation_make_s_length); + const f_string_static_t fake_other_operation_skeleton_s = macro_f_string_static_t_initialize2(FAKE_other_operation_skeleton_s, 0, FAKE_other_operation_skeleton_s_length); +#endif // _di_fake_defines_ + +#ifndef _di_fake_main_delete_ + f_status_t fake_main_delete(fake_main_t * const main) { + + for (f_array_length_t i = 0; i < fake_total_parameters_d; ++i) { + + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); + } // for + + f_type_array_lengths_resize(0, &main->remaining); + + f_string_dynamics_resize(0, &main->define); + f_string_dynamic_resize(0, &main->fakefile); + f_string_dynamics_resize(0, &main->mode); + f_string_dynamic_resize(0, &main->process); + f_string_dynamic_resize(0, &main->settings); + + f_string_dynamic_resize(0, &main->path_build); + f_string_dynamic_resize(0, &main->path_build_documents); + f_string_dynamic_resize(0, &main->path_build_includes); + f_string_dynamic_resize(0, &main->path_build_libraries); + f_string_dynamic_resize(0, &main->path_build_libraries_script); + f_string_dynamic_resize(0, &main->path_build_libraries_shared); + f_string_dynamic_resize(0, &main->path_build_libraries_static); + f_string_dynamic_resize(0, &main->path_build_objects); + f_string_dynamic_resize(0, &main->path_build_programs); + f_string_dynamic_resize(0, &main->path_build_programs_script); + f_string_dynamic_resize(0, &main->path_build_programs_shared); + f_string_dynamic_resize(0, &main->path_build_programs_static); + f_string_dynamic_resize(0, &main->path_build_settings); + f_string_dynamic_resize(0, &main->path_build_stage); + f_string_dynamic_resize(0, &main->path_work); + + f_string_dynamic_resize(0, &main->path_data); + f_string_dynamic_resize(0, &main->path_data_build); + + f_string_dynamic_resize(0, &main->path_data_settings); + + f_string_dynamic_resize(0, &main->path_documents); + + f_string_dynamic_resize(0, &main->path_licenses); + + f_string_dynamic_resize(0, &main->path_sources); + f_string_dynamic_resize(0, &main->path_sources_bash); + f_string_dynamic_resize(0, &main->path_sources_c); + f_string_dynamic_resize(0, &main->path_sources_cpp); + f_string_dynamic_resize(0, &main->path_sources_script); + + f_string_dynamic_resize(0, &main->path_work); + f_string_dynamic_resize(0, &main->path_work_includes); + f_string_dynamic_resize(0, &main->path_work_libraries); + f_string_dynamic_resize(0, &main->path_work_libraries_script); + f_string_dynamic_resize(0, &main->path_work_libraries_shared); + f_string_dynamic_resize(0, &main->path_work_libraries_static); + f_string_dynamic_resize(0, &main->path_work_programs); + f_string_dynamic_resize(0, &main->path_work_programs_script); + f_string_dynamic_resize(0, &main->path_work_programs_shared); + f_string_dynamic_resize(0, &main->path_work_programs_static); + + f_string_dynamic_resize(0, &main->file_data_build_defines); + f_string_dynamic_resize(0, &main->file_data_build_dependencies); + f_string_dynamic_resize(0, &main->file_data_build_fakefile); + f_string_dynamic_resize(0, &main->file_data_build_settings); + + f_string_dynamic_resize(0, &main->file_documents_readme); + + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_fake_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fake/c/common.h b/level_3/fake/c/common.h new file mode 100644 index 0000000..be25427 --- /dev/null +++ b/level_3/fake/c/common.h @@ -0,0 +1,582 @@ +/** + * FLL - Level 3 + * + * Project: Featureless Make + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fake_common_h +#define _fake_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fake_program_version_ + #define FAKE_program_version_major_s F_string_ascii_0_s + #define FAKE_program_version_minor_s F_string_ascii_5_s + #define FAKE_program_version_micro_s F_string_ascii_8_s + + #define FAKE_program_version_major_s_length F_string_ascii_0_s_length + #define FAKE_program_version_minor_s_length F_string_ascii_5_s_length + #define FAKE_program_version_micro_s_length F_string_ascii_8_s_length + + #ifndef FAKE_program_version_nano_prefix_s + #define FAKE_program_version_nano_prefix_s + #define FAKE_program_version_nano_prefix_s_length 0 + #endif + + #ifndef FAKE_program_version_nano_s + #define FAKE_program_version_nano_s + #define FAKE_program_version_nano_s_length 0 + #endif + + #define FAKE_program_version_s FAKE_program_version_major_s F_string_ascii_period_s FAKE_program_version_minor_s F_string_ascii_period_s FAKE_program_version_micro_s FAKE_program_version_nano_prefix_s FAKE_program_version_nano_s + + #define FAKE_program_version_s_length FAKE_program_version_major_s_length + F_string_ascii_period_s_length + FAKE_program_version_minor_s_length + F_string_ascii_period_s_length + FAKE_program_version_micro_s_length + FAKE_program_version_nano_prefix_s_length + FAKE_program_version_nano_s_length + + const f_string_static_t fake_program_version_s; +#endif // _di_fake_program_version_ + +#ifndef _di_fake_program_name_ + #define FAKE_program_name_s "fake" + #define FAKE_program_name_long_s "Featureless Make" + + #define FAKE_program_name_s_length 4 + #define FAKE_program_name_long_s_length 16 + + const f_string_static_t fake_program_name_s; + const f_string_static_t fake_program_name_long_s; +#endif // _di_fake_program_name_ + +#ifndef _di_fake_program_help_parameters_ + #define FAKE_program_help_parameters_s "operation" + #define FAKE_program_help_parameters_s_length 9 + + extern const f_string_static_t fake_program_help_parameters_s; +#endif // _di_fake_program_help_parameters_ + +/*** + * Default allocations. + * + * Set to at least 4 to provide a UTF-8 friendly allocation step. + */ +#ifndef _di_fake_default_allocation_step_ + #define fake_default_allocation_small_d 4 + #define fake_default_allocation_large_d 64 +#endif // _di_fake_default_allocation_step_ + +/** + * The build operation utilizes pre-defined path structures. + * These structures are hard-coded by their individual pieces to be constructed later on. + */ +#ifndef _di_fake_path_ + #define FAKE_path_part_bash_s "bash" F_path_separator_s + #define FAKE_path_part_build_s "build" F_path_separator_s + #define FAKE_path_part_c_s "c" F_path_separator_s + #define FAKE_path_part_cpp_s "c++" F_path_separator_s + #define FAKE_path_part_data_s "data" F_path_separator_s + #define FAKE_path_part_documents_s "documents" F_path_separator_s + #define FAKE_path_part_includes_s "includes" F_path_separator_s + #define FAKE_path_part_libraries_s "libraries" F_path_separator_s + #define FAKE_path_part_licenses_s "licenses" F_path_separator_s + #define FAKE_path_part_objects_s "objects" F_path_separator_s + #define FAKE_path_part_process_s "process" F_path_separator_s + #define FAKE_path_part_programs_s "programs" F_path_separator_s + #define FAKE_path_part_script_s "script" F_path_separator_s + #define FAKE_path_part_settings_s "settings" F_path_separator_s + #define FAKE_path_part_shared_s "shared" F_path_separator_s + #define FAKE_path_part_stage_s "stage" F_path_separator_s + #define FAKE_path_part_static_s "static" F_path_separator_s + + #define FAKE_path_part_bash_s_length 5 + F_path_separator_s_length + #define FAKE_path_part_build_s_length 6 + F_path_separator_s_length + #define FAKE_path_part_c_s_length 2 + F_path_separator_s_length + #define FAKE_path_part_cpp_s_length 4 + F_path_separator_s_length + #define FAKE_path_part_data_s_length 5 + F_path_separator_s_length + #define FAKE_path_part_documents_s_length 10 + F_path_separator_s_length + #define FAKE_path_part_includes_s_length 9 + F_path_separator_s_length + #define FAKE_path_part_libraries_s_length 10 + F_path_separator_s_length + #define FAKE_path_part_licenses_s_length 9 + F_path_separator_s_length + #define FAKE_path_part_objects_s_length 8 + F_path_separator_s_length + #define FAKE_path_part_process_s_length 8 + F_path_separator_s_length + #define FAKE_path_part_programs_s_length 9 + F_path_separator_s_length + #define FAKE_path_part_script_s_length 7 + F_path_separator_s_length + #define FAKE_path_part_settings_s_length 9 + F_path_separator_s_length + #define FAKE_path_part_shared_s_length 7 + F_path_separator_s_length + #define FAKE_path_part_stage_s_length 6 + F_path_separator_s_length + #define FAKE_path_part_static_s_length 7 + F_path_separator_s_length + + extern const f_string_static_t fake_path_part_bash_s; + extern const f_string_static_t fake_path_part_build_s; + extern const f_string_static_t fake_path_part_c_s; + extern const f_string_static_t fake_path_part_cpp_s; + extern const f_string_static_t fake_path_part_data_s; + extern const f_string_static_t fake_path_part_documents_s; + extern const f_string_static_t fake_path_part_includes_s; + extern const f_string_static_t fake_path_part_libraries_s; + extern const f_string_static_t fake_path_part_licenses_s; + extern const f_string_static_t fake_path_part_objects_s; + extern const f_string_static_t fake_path_part_process_s; + extern const f_string_static_t fake_path_part_programs_s; + extern const f_string_static_t fake_path_part_script_s; + extern const f_string_static_t fake_path_part_settings_s; + extern const f_string_static_t fake_path_part_shared_s; + extern const f_string_static_t fake_path_part_stage_s; + extern const f_string_static_t fake_path_part_static_s; +#endif // _di_fake_path_ + +#ifndef _di_fake_file_ + #define FAKE_file_defines_s "defines" + #define FAKE_file_dependencies_s "dependencies" + #define FAKE_file_process_pre_s "process_pre.sh" + #define FAKE_file_process_post_s "process_post.sh" + #define FAKE_file_readme_s "readme" + + #define FAKE_file_defines_s_length 7 + #define FAKE_file_dependencies_s_length 12 + #define FAKE_file_process_pre_s_length 14 + #define FAKE_file_process_post_s_length 15 + #define FAKE_file_readme_s_length 6 + + extern const f_string_static_t fake_file_defines_s; + extern const f_string_static_t fake_file_dependencies_s; + extern const f_string_static_t fake_file_process_pre_s; + extern const f_string_static_t fake_file_process_post_s; + extern const f_string_static_t fake_file_readme_s; +#endif // _di_fake_file_ + +/** + * Provide default settings. + */ +#ifndef _di_fake_defaults_ + #define FAKE_default_path_build_s "build" F_path_separator_s + #define FAKE_default_path_data_s "data" F_path_separator_s + #define FAKE_default_path_sources_s "sources" F_path_separator_s + #define FAKE_default_path_work_s "" + + #define FAKE_default_define_s "" + #define FAKE_default_fakefile_s "fakefile" + #define FAKE_default_mode_s "" + #define FAKE_default_process_s "" + #define FAKE_default_settings_s "settings" + + #define FAKE_default_path_build_s_length 5 + F_path_separator_s_length + #define FAKE_default_path_data_s_length 4 + F_path_separator_s_length + #define FAKE_default_path_sources_s_length 7 + F_path_separator_s_length + #define FAKE_default_path_work_s_length 0 + + #define FAKE_default_define_s_length 0 + #define FAKE_default_fakefile_s_length 8 + #define FAKE_default_mode_s_length 0 + #define FAKE_default_process_s_length 0 + #define FAKE_default_settings_s_length 8 + + extern const f_string_static_t fake_default_path_build_s; + extern const f_string_static_t fake_default_path_data_s; + extern const f_string_static_t fake_default_path_sources_s; + extern const f_string_static_t fake_default_path_work_s; + + extern const f_string_static_t fake_default_define_s; + extern const f_string_static_t fake_default_fakefile_s; + extern const f_string_static_t fake_default_mode_s; + extern const f_string_static_t fake_default_process_s; + extern const f_string_static_t fake_default_settings_s; +#endif // _di_fake_defaults_ + +#ifndef _di_fake_build_language_ + enum { + fake_build_language_type_bash_e = 1, + fake_build_language_type_c_e, + fake_build_language_type_cpp_e, + }; + + #define FAKE_build_language_bash_s "bash" + #define FAKE_build_language_c_s "c" + #define FAKE_build_language_cpp_s "c++" + + #define FAKE_build_language_bash_s_length 4 + #define FAKE_build_language_c_s_length 1 + #define FAKE_build_language_cpp_s_length 3 + + extern const f_string_static_t fake_build_language_bash_s; + extern const f_string_static_t fake_build_language_c_s; + extern const f_string_static_t fake_build_language_cpp_s; +#endif // _di_fake_build_language_ + +#ifndef _di_fake_build_version_ + enum { + fake_build_version_type_major_e = 1, + fake_build_version_type_minor_e, + fake_build_version_type_micro_e, + fake_build_version_type_nano_e, + }; + + #define FAKE_build_version_major_s "major" + #define FAKE_build_version_minor_s "minor" + #define FAKE_build_version_micro_s "micro" + #define FAKE_build_version_nano_s "nano" + + #define FAKE_build_version_major_s_length 5 + #define FAKE_build_version_minor_s_length 5 + #define FAKE_build_version_micro_s_length 5 + #define FAKE_build_version_nano_s_length 4 + + extern const f_string_static_t fake_build_version_major_s; + extern const f_string_static_t fake_build_version_minor_s; + extern const f_string_static_t fake_build_version_micro_s; + extern const f_string_static_t fake_build_version_nano_s; +#endif // _di_fake_build_version_ + +#ifndef _di_fake_defines_ + enum { + fake_operation_build_e = 1, + fake_operation_clean_e, + fake_operation_make_e, + fake_operation_skeleton_e, + }; + + #define fake_signal_check_d 10000 + #define fake_signal_check_tiny_d 4 + #define fake_signal_check_short_d 16 + + #define fake_operations_total_d 4 + #define fake_operations_initialize { 0, 0, 0, 0 } + + #define FAKE_short_define_s "d" + #define FAKE_short_fakefile_s "f" + #define FAKE_short_mode_s "m" + #define FAKE_short_process_s "p" + #define FAKE_short_settings_s "s" + + #define FAKE_short_path_build_s "b" + #define FAKE_short_path_data_s "D" + #define FAKE_short_path_sources_s "S" + #define FAKE_short_path_work_s "w" + + #define FAKE_long_define_s "define" + #define FAKE_long_fakefile_s "fakefile" + #define FAKE_long_mode_s "mode" + #define FAKE_long_process_s "process" + #define FAKE_long_settings_s "settings" + + #define FAKE_long_path_build_s "build" + #define FAKE_long_path_data_s "data" + #define FAKE_long_path_sources_s "sources" + #define FAKE_long_path_work_s "work" + + // These special parameters are provided in such a way that they mimic the traditional ./configure script. + #define FAKE_long_documents_disabled_s "disable-doc" + #define FAKE_long_documents_enabled_s "enable-doc" + #define FAKE_long_shared_disabled_s "disable-shared" + #define FAKE_long_shared_enabled_s "enable-shared" + #define FAKE_long_static_disabled_s "disable-static" + #define FAKE_long_static_enabled_s "enable-static" + + #define FAKE_other_operation_build_s "build" + #define FAKE_other_operation_clean_s "clean" + #define FAKE_other_operation_make_s "make" + #define FAKE_other_operation_skeleton_s "skeleton" + + #define FAKE_short_define_s_length 1 + #define FAKE_short_fakefile_s_length 1 + #define FAKE_short_mode_s_length 1 + #define FAKE_short_process_s_length 1 + #define FAKE_short_settings_s_length 1 + + #define FAKE_short_path_build_s_length 1 + #define FAKE_short_path_data_s_length 1 + #define FAKE_short_path_sources_s_length 1 + #define FAKE_short_path_work_s_length 1 + + #define FAKE_long_define_s_length 6 + #define FAKE_long_fakefile_s_length 8 + #define FAKE_long_mode_s_length 4 + #define FAKE_long_process_s_length 7 + #define FAKE_long_settings_s_length 8 + + #define FAKE_long_path_build_s_length 5 + #define FAKE_long_path_data_s_length 4 + #define FAKE_long_path_sources_s_length 7 + #define FAKE_long_path_work_s_length 4 + + #define FAKE_long_documents_disabled_s_length 11 + #define FAKE_long_documents_enabled_s_length 10 + #define FAKE_long_shared_disabled_s_length 14 + #define FAKE_long_shared_enabled_s_length 13 + #define FAKE_long_static_disabled_s_length 14 + #define FAKE_long_static_enabled_s_length 13 + + #define FAKE_other_operation_build_s_length 5 + #define FAKE_other_operation_clean_s_length 5 + #define FAKE_other_operation_make_s_length 4 + #define FAKE_other_operation_skeleton_s_length 8 + + extern const f_string_static_t fake_short_define_s; + extern const f_string_static_t fake_short_fakefile_s; + extern const f_string_static_t fake_short_mode_s; + extern const f_string_static_t fake_short_process_s; + extern const f_string_static_t fake_short_settings_s; + + extern const f_string_static_t fake_short_path_build_s; + extern const f_string_static_t fake_short_path_data_s; + extern const f_string_static_t fake_short_path_sources_s; + extern const f_string_static_t fake_short_path_work_s; + + extern const f_string_static_t fake_long_define_s; + extern const f_string_static_t fake_long_fakefile_s; + extern const f_string_static_t fake_long_mode_s; + extern const f_string_static_t fake_long_process_s; + extern const f_string_static_t fake_long_settings_s; + + extern const f_string_static_t fake_long_path_build_s; + extern const f_string_static_t fake_long_path_data_s; + extern const f_string_static_t fake_long_path_sources_s; + extern const f_string_static_t fake_long_path_work_s; + + extern const f_string_static_t fake_long_documents_disabled_s; + extern const f_string_static_t fake_long_documents_enabled_s; + extern const f_string_static_t fake_long_shared_disabled_s; + extern const f_string_static_t fake_long_shared_enabled_s; + extern const f_string_static_t fake_long_static_disabled_s; + extern const f_string_static_t fake_long_static_enabled_s; + + extern const f_string_static_t fake_other_operation_build_s; + extern const f_string_static_t fake_other_operation_clean_s; + extern const f_string_static_t fake_other_operation_make_s; + extern const f_string_static_t fake_other_operation_skeleton_s; + + enum { + fake_parameter_help_e, + fake_parameter_light_e, + fake_parameter_dark_e, + fake_parameter_no_color_e, + fake_parameter_verbosity_quiet_e, + fake_parameter_verbosity_normal_e, + fake_parameter_verbosity_verbose_e, + fake_parameter_verbosity_debug_e, + fake_parameter_version_e, + + fake_parameter_define_e, + fake_parameter_fakefile_e, + fake_parameter_mode_e, + fake_parameter_process_e, + fake_parameter_settings_e, + + fake_parameter_path_build_e, + fake_parameter_path_data_e, + fake_parameter_path_sources_e, + fake_parameter_path_work_e, + + fake_parameter_documents_disabled_e, + fake_parameter_documents_enabled_e, + fake_parameter_shared_disabled_e, + fake_parameter_shared_enabled_e, + fake_parameter_static_disabled_e, + fake_parameter_static_enabled_e, + + fake_parameter_operation_build_e, + fake_parameter_operation_clean_e, + fake_parameter_operation_make_e, + fake_parameter_operation_skeleton_e, + }; + + #define fake_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(fake_short_define_s.string, fake_long_define_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fake_short_fakefile_s.string, fake_long_fakefile_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fake_short_mode_s.string, fake_long_mode_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fake_short_process_s.string, fake_long_process_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fake_short_settings_s.string, fake_long_settings_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fake_short_path_build_s.string, fake_long_path_build_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fake_short_path_data_s.string, fake_long_path_data_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fake_short_path_sources_s.string, fake_long_path_sources_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fake_short_path_work_s.string, fake_long_path_work_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(0, fake_long_documents_disabled_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(0, fake_long_documents_enabled_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(0, fake_long_shared_disabled_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(0, fake_long_shared_enabled_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(0, fake_long_static_disabled_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(0, fake_long_static_enabled_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_build_s.string, 0, f_console_type_other_e), \ + macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_clean_s.string, 0, f_console_type_other_e), \ + macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_make_s.string, 0, f_console_type_other_e), \ + macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_skeleton_s.string, 0, f_console_type_other_e), \ + } + + #define fake_total_parameters_d 28 +#endif // _di_fake_defines_ + +#ifndef _di_fake_main_t_ + typedef struct { + f_console_parameter_t parameters[fake_total_parameters_d]; + + f_array_lengths_t remaining; + bool process_pipe; + + fl_print_t output; + fl_print_t error; + fl_print_t warning; + + f_signal_t signal; + + uint8_t operation; + uint16_t signal_check; + + mode_t umask; + int child; + + f_string_dynamics_t define; + f_string_dynamic_t fakefile; + f_string_dynamics_t mode; + f_string_dynamic_t process; + f_string_dynamic_t settings; + + f_string_dynamic_t path_build; + f_string_dynamic_t path_build_documents; + f_string_dynamic_t path_build_includes; + f_string_dynamic_t path_build_libraries; + f_string_dynamic_t path_build_libraries_script; + f_string_dynamic_t path_build_libraries_shared; + f_string_dynamic_t path_build_libraries_static; + f_string_dynamic_t path_build_objects; + f_string_dynamic_t path_build_programs; + f_string_dynamic_t path_build_programs_script; + f_string_dynamic_t path_build_programs_shared; + f_string_dynamic_t path_build_programs_static; + f_string_dynamic_t path_build_settings; + f_string_dynamic_t path_build_stage; + + f_string_dynamic_t path_data; + f_string_dynamic_t path_data_build; + f_string_dynamic_t path_data_settings; + + f_string_dynamic_t path_documents; + + f_string_dynamic_t path_licenses; + + f_string_dynamic_t path_sources; + f_string_dynamic_t path_sources_bash; + f_string_dynamic_t path_sources_c; + f_string_dynamic_t path_sources_cpp; + f_string_dynamic_t path_sources_script; + + f_string_dynamic_t path_work; + f_string_dynamic_t path_work_includes; + f_string_dynamic_t path_work_libraries; + f_string_dynamic_t path_work_libraries_script; + f_string_dynamic_t path_work_libraries_shared; + f_string_dynamic_t path_work_libraries_static; + f_string_dynamic_t path_work_programs; + f_string_dynamic_t path_work_programs_script; + f_string_dynamic_t path_work_programs_shared; + f_string_dynamic_t path_work_programs_static; + + f_string_dynamic_t file_data_build_defines; + f_string_dynamic_t file_data_build_dependencies; + f_string_dynamic_t file_data_build_fakefile; + f_string_dynamic_t file_data_build_settings; + + f_string_dynamic_t file_documents_readme; + + f_color_context_t context; + } fake_main_t; + + #define fake_main_t_initialize \ + { \ + fake_console_parameter_t_initialize, \ + f_array_lengths_t_initialize, \ + F_false, \ + fl_print_t_initialize, \ + macro_fl_print_t_initialize_error(), \ + macro_fl_print_t_initialize_warning(), \ + f_signal_t_initialize, \ + 0, \ + 0, \ + 0, \ + 0, \ + f_string_dynamics_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamics_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_color_context_t_initialize, \ + } +#endif // _di_fake_main_t_ + +/** + * Deallocate main. + * + * Be sure to call this after executing fake_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @see fake_main() + */ +#ifndef _di_fake_main_delete_ + extern f_status_t fake_main_delete(fake_main_t * const main); +#endif // _di_fake_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fake_common_h diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index 7c9e893..3a14fab 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -20,39 +20,39 @@ extern "C" { fll_program_print_help_header(file, context, fake_program_name_long_s, fake_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fake_short_define_s, fake_long_define_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Append an additional define after defines from settings file."); - fll_program_print_help_option(file, context, fake_short_fakefile_s, fake_long_fakefile_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Use this fakefile."); - fll_program_print_help_option(file, context, fake_short_mode_s, fake_long_mode_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use this mode when processing the build settings."); - fll_program_print_help_option(file, context, fake_short_process_s, fake_long_process_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Process name for storing build states."); - fll_program_print_help_option(file, context, fake_short_settings_s, fake_long_settings_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Use this settings file."); + fll_program_print_help_option(file, context, fake_short_define_s, fake_long_define_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Append an additional define after defines from settings file."); + fll_program_print_help_option(file, context, fake_short_fakefile_s, fake_long_fakefile_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Use this fakefile."); + fll_program_print_help_option(file, context, fake_short_mode_s, fake_long_mode_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use this mode when processing the build settings."); + fll_program_print_help_option(file, context, fake_short_process_s, fake_long_process_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Process name for storing build states."); + fll_program_print_help_option(file, context, fake_short_settings_s, fake_long_settings_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Use this settings file."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fake_short_path_build_s, fake_long_path_build_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a custom build directory."); - fll_program_print_help_option(file, context, fake_short_path_data_s, fake_long_path_data_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a custom path to the data files."); - fll_program_print_help_option(file, context, fake_short_path_sources_s, fake_long_path_sources_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Specify a custom path to the source files."); - fll_program_print_help_option(file, context, fake_short_path_work_s, fake_long_path_work_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use includes/libraries/programs from this directory instead of system."); + fll_program_print_help_option(file, context, fake_short_path_build_s, fake_long_path_build_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a custom build directory."); + fll_program_print_help_option(file, context, fake_short_path_data_s, fake_long_path_data_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a custom path to the data files."); + fll_program_print_help_option(file, context, fake_short_path_sources_s, fake_long_path_sources_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Specify a custom path to the source files."); + fll_program_print_help_option(file, context, fake_short_path_work_s, fake_long_path_work_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use includes/libraries/programs from this directory instead of system."); fl_print_format("%q%q %[Special Options:%] ", file.stream, f_string_eol_s, f_string_eol_s, context.set.important, context.set.important); - fll_program_print_help_option_long(file, context, fake_long_documents_disabled_s, f_console_symbol_long_enable_s.string, " Forcibly do not build documents files."); - fll_program_print_help_option_long(file, context, fake_long_documents_enabled_s, f_console_symbol_long_enable_s.string, " Forcibly do build documents files."); - fll_program_print_help_option_long(file, context, fake_long_shared_disabled_s, f_console_symbol_long_enable_s.string, "Forcibly do not build shared files."); - fll_program_print_help_option_long(file, context, fake_long_shared_enabled_s, f_console_symbol_long_enable_s.string, " Forcibly do build shared files."); - fll_program_print_help_option_long(file, context, fake_long_static_disabled_s, f_console_symbol_long_enable_s.string, "Forcibly do not build static files."); - fll_program_print_help_option_long(file, context, fake_long_static_enabled_s, f_console_symbol_long_enable_s.string, " Forcibly do build static files."); + fll_program_print_help_option_long(file, context, fake_long_documents_disabled_s, f_console_symbol_long_enable_s, " Forcibly do not build documents files."); + fll_program_print_help_option_long(file, context, fake_long_documents_enabled_s, f_console_symbol_long_enable_s, " Forcibly do build documents files."); + fll_program_print_help_option_long(file, context, fake_long_shared_disabled_s, f_console_symbol_long_enable_s, "Forcibly do not build shared files."); + fll_program_print_help_option_long(file, context, fake_long_shared_enabled_s, f_console_symbol_long_enable_s, " Forcibly do build shared files."); + fll_program_print_help_option_long(file, context, fake_long_static_disabled_s, f_console_symbol_long_enable_s, "Forcibly do not build static files."); + fll_program_print_help_option_long(file, context, fake_long_static_enabled_s, f_console_symbol_long_enable_s, " Forcibly do build static files."); fl_print_format("%q%q %[Operations:%] ", file.stream, f_string_eol_s, f_string_eol_s, context.set.important, context.set.important); @@ -61,20 +61,20 @@ extern "C" { fll_program_print_help_option_other(file, context, fake_other_operation_make_s, " Build or compile the code based on fakefile."); fll_program_print_help_option_other(file, context, fake_other_operation_skeleton_s, "Build a skeleton directory structure."); - fll_program_print_help_usage(file, context, fake_program_name_s, "operation"); + fll_program_print_help_usage(file, context, fake_program_name_s, fake_program_help_parameters_s); - fl_print_format(" When performing the %[%s%] operation, the", file.stream, context.set.notable, fake_other_operation_build_s, context.set.notable); - fl_print_format(" %[%q%s%] parameter specifies a name (limited to alpha-numeric, underscore, and dash) to be used in addition to the global.%q", file.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_mode_s, context.set.notable, f_string_eol_s); + fl_print_format(" When performing the %[%q%] operation, the", file.stream, context.set.notable, fake_other_operation_build_s, context.set.notable); + fl_print_format(" %[%q%q%] parameter specifies a name (limited to alpha-numeric, underscore, and dash) to be used in addition to the global.%q", file.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_mode_s, context.set.notable, f_string_eol_s); - fl_print_format(" For example, when a %[%s%]", file.stream, context.set.notable, fake_make_parameter_variable_mode_s, context.set.notable); + fl_print_format(" For example, when a %[%q%]", file.stream, context.set.notable, fake_make_parameter_variable_mode_s, context.set.notable); fl_print_format(" of 'fll_monolithic' is specified, build libraries from both 'build_libraries' and 'build_libraries-fll_monolithic' are used (but not 'build_libraries-fll_level').%q%q", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When specifying the %[%s%] or the %[%s%]", file.stream, context.set.notable, fake_make_parameter_variable_fakefile_s, context.set.notable, context.set.notable, fake_make_parameter_variable_settings_s, context.set.notable); + fl_print_format(" When specifying the %[%q%] or the %[%q%]", file.stream, context.set.notable, fake_make_parameter_variable_fakefile_s, context.set.notable, context.set.notable, fake_make_parameter_variable_settings_s, context.set.notable); fl_print_format(" parameters, the filenames are relative to the data build directory, unless a path is used.%q", file.stream, f_string_eol_s); - fl_print_format(" For example, with '%[%q%s my_fakefile%]' the fakefile at", file.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_fakefile_s, context.set.notable); - fl_print_format(" '%[./%s%smy_fakefile%]' would be used, however with", file.stream, context.set.notable, fake_default_path_data_s, fake_default_path_build_s, context.set.notable); - fl_print_format(" '%[%q%s ./my_fakefile%]' the fakefile at", file.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_fakefile_s, context.set.notable); + fl_print_format(" For example, with '%[%q%q my_fakefile%]' the fakefile at", file.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_fakefile_s, context.set.notable); + fl_print_format(" '%[./%q%qmy_fakefile%]' would be used, however with", file.stream, context.set.notable, fake_default_path_data_s, fake_default_path_build_s, context.set.notable); + fl_print_format(" '%[%q%q ./my_fakefile%]' the fakefile at", file.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_fakefile_s, context.set.notable); fl_print_format(" '%[./my_fakefile%]' would be used.%q%q", file.stream, context.set.notable, context.set.notable, f_string_eol_s, f_string_eol_s); funlockfile(file.stream); @@ -173,7 +173,7 @@ extern "C" { operations_length += main->parameters[fake_parameter_operation_skeleton_e].locations.used; uint8_t operations[operations_length]; - f_string_t operations_name = 0; + f_string_static_t operations_name = f_string_static_t_initialize; { f_array_length_t locations[operations_length]; @@ -340,16 +340,19 @@ extern "C" { if (status == F_child) { break; } - else if (F_status_set_fine(status) == F_interrupt || !(i % fake_signal_check_short_d) && fake_signal_received(main)) { + + if (F_status_set_fine(status) == F_interrupt || !(i % fake_signal_check_short_d) && fake_signal_received(main)) { status = F_status_set_error(F_interrupt); + break; } - else if (F_status_is_error(status)) { + + if (F_status_is_error(status)) { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe operation '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%]", main->error.to.stream, main->error.notable, operations_name, main->error.notable); + fl_print_format("%q%[%QThe operation '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%]", main->error.to.stream, main->error.notable, operations_name, main->error.notable); fl_print_format("%[' failed.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -374,7 +377,7 @@ extern "C" { } else { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%SYou failed to specify an operation.%]%q%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s, f_string_eol_s); + fll_print_format("%q%[%QYou failed to specify an operation.%]%q%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s, f_string_eol_s); } status = F_status_set_error(F_parameter); @@ -386,79 +389,6 @@ extern "C" { } #endif // _di_fake_main_ -#ifndef _di_fake_main_delete_ - f_status_t fake_main_delete(fake_main_t * const main) { - - for (f_array_length_t i = 0; i < fake_total_parameters_d; ++i) { - - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); - } // for - - macro_f_array_lengths_t_delete_simple(main->remaining); - - macro_f_string_dynamics_t_delete_simple(main->define); - macro_f_string_dynamic_t_delete_simple(main->fakefile); - macro_f_string_dynamics_t_delete_simple(main->mode); - macro_f_string_dynamic_t_delete_simple(main->process); - macro_f_string_dynamic_t_delete_simple(main->settings); - - macro_f_string_dynamic_t_delete_simple(main->path_build); - macro_f_string_dynamic_t_delete_simple(main->path_build_documents); - macro_f_string_dynamic_t_delete_simple(main->path_build_includes); - macro_f_string_dynamic_t_delete_simple(main->path_build_libraries); - macro_f_string_dynamic_t_delete_simple(main->path_build_libraries_script); - macro_f_string_dynamic_t_delete_simple(main->path_build_libraries_shared); - macro_f_string_dynamic_t_delete_simple(main->path_build_libraries_static); - macro_f_string_dynamic_t_delete_simple(main->path_build_objects); - macro_f_string_dynamic_t_delete_simple(main->path_build_programs); - macro_f_string_dynamic_t_delete_simple(main->path_build_programs_script); - macro_f_string_dynamic_t_delete_simple(main->path_build_programs_shared); - macro_f_string_dynamic_t_delete_simple(main->path_build_programs_static); - macro_f_string_dynamic_t_delete_simple(main->path_build_settings); - macro_f_string_dynamic_t_delete_simple(main->path_build_stage); - macro_f_string_dynamic_t_delete_simple(main->path_work); - - macro_f_string_dynamic_t_delete_simple(main->path_data); - macro_f_string_dynamic_t_delete_simple(main->path_data_build); - - macro_f_string_dynamic_t_delete_simple(main->path_data_settings); - - macro_f_string_dynamic_t_delete_simple(main->path_documents); - - macro_f_string_dynamic_t_delete_simple(main->path_licenses); - - macro_f_string_dynamic_t_delete_simple(main->path_sources); - macro_f_string_dynamic_t_delete_simple(main->path_sources_bash); - macro_f_string_dynamic_t_delete_simple(main->path_sources_c); - macro_f_string_dynamic_t_delete_simple(main->path_sources_cpp); - macro_f_string_dynamic_t_delete_simple(main->path_sources_script); - - macro_f_string_dynamic_t_delete_simple(main->path_work); - macro_f_string_dynamic_t_delete_simple(main->path_work_includes); - macro_f_string_dynamic_t_delete_simple(main->path_work_libraries); - macro_f_string_dynamic_t_delete_simple(main->path_work_libraries_script); - macro_f_string_dynamic_t_delete_simple(main->path_work_libraries_shared); - macro_f_string_dynamic_t_delete_simple(main->path_work_libraries_static); - macro_f_string_dynamic_t_delete_simple(main->path_work_programs); - macro_f_string_dynamic_t_delete_simple(main->path_work_programs_script); - macro_f_string_dynamic_t_delete_simple(main->path_work_programs_shared); - macro_f_string_dynamic_t_delete_simple(main->path_work_programs_static); - - macro_f_string_dynamic_t_delete_simple(main->file_data_build_defines); - macro_f_string_dynamic_t_delete_simple(main->file_data_build_dependencies); - macro_f_string_dynamic_t_delete_simple(main->file_data_build_fakefile); - macro_f_string_dynamic_t_delete_simple(main->file_data_build_settings); - - macro_f_string_dynamic_t_delete_simple(main->file_documents_readme); - - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_fake_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fake/c/fake.h b/level_3/fake/c/fake.h index 949fb11..8ffd116 100644 --- a/level_3/fake/c/fake.h +++ b/level_3/fake/c/fake.h @@ -41,15 +41,16 @@ * The "stage/" directory will contain build-time data. */ #ifndef _fake_h +#define _fake_h -// libc includes. +// Libc includes. #include #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -68,7 +69,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include @@ -77,7 +78,7 @@ #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -88,441 +89,13 @@ #include #include +// Featureless Make includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fake_program_version_ - #define fake_program_version_major_s F_string_ascii_0_s - #define fake_program_version_minor_s F_string_ascii_5_s - #define fake_program_version_micro_s F_string_ascii_8_s - - #ifndef fake_program_version_nano_prefix_s - #define fake_program_version_nano_prefix_s - #endif - - #ifndef fake_program_version_nano_s - #define fake_program_version_nano_s - #endif - - #define fake_program_version_s fake_program_version_major_s F_string_ascii_period_s fake_program_version_minor_s F_string_ascii_period_s fake_program_version_micro_s fake_program_version_nano_prefix_s fake_program_version_nano_s -#endif // _di_fake_program_version_ - -#ifndef _di_fake_program_name_ - #define fake_program_name_s "fake" - #define fake_program_name_long_s "Featureless Make" -#endif // _di_fake_program_name_ - -#ifndef _di_fake_default_allocation_step_ - // Set to at least 4 to provide a UTF-8 friendly allocation step. - #define fake_default_allocation_small_d 4 - #define fake_default_allocation_large_d 64 -#endif // _di_fake_default_allocation_step_ - -/** - * The build operation utilizes pre-defined path structures. - * These structures are hard-coded by their individual pieces to be constructed later on. - */ -#ifndef _di_fake_path_ - #define fake_path_part_bash_s "bash" F_path_separator_s - #define fake_path_part_build_s "build" F_path_separator_s - #define fake_path_part_c_s "c" F_path_separator_s - #define fake_path_part_cpp_s "c++" F_path_separator_s - #define fake_path_part_data_s "data" F_path_separator_s - #define fake_path_part_documents_s "documents" F_path_separator_s - #define fake_path_part_includes_s "includes" F_path_separator_s - #define fake_path_part_libraries_s "libraries" F_path_separator_s - #define fake_path_part_licenses_s "licenses" F_path_separator_s - #define fake_path_part_objects_s "objects" F_path_separator_s - #define fake_path_part_process_s "process" F_path_separator_s - #define fake_path_part_programs_s "programs" F_path_separator_s - #define fake_path_part_script_s "script" F_path_separator_s - #define fake_path_part_settings_s "settings" F_path_separator_s - #define fake_path_part_shared_s "shared" F_path_separator_s - #define fake_path_part_stage_s "stage" F_path_separator_s - #define fake_path_part_static_s "static" F_path_separator_s - - #define fake_path_part_bash_s_length 5 - #define fake_path_part_build_s_length 6 - #define fake_path_part_c_s_length 2 - #define fake_path_part_cpp_s_length 4 - #define fake_path_part_data_s_length 5 - #define fake_path_part_documents_s_length 10 - #define fake_path_part_includes_s_length 9 - #define fake_path_part_libraries_s_length 10 - #define fake_path_part_licenses_s_length 9 - #define fake_path_part_objects_s_length 8 - #define fake_path_part_process_s_length 8 - #define fake_path_part_programs_s_length 9 - #define fake_path_part_script_s_length 7 - #define fake_path_part_settings_s_length 9 - #define fake_path_part_shared_s_length 7 - #define fake_path_part_stage_s_length 6 - #define fake_path_part_static_s_length 7 -#endif // _di_fake_path_ - -#ifndef _di_fake_file_ - #define fake_file_defines_s "defines" - #define fake_file_dependencies_s "dependencies" - #define fake_file_readme_s "readme" - - #define fake_file_defines_s_length 7 - #define fake_file_dependencies_s_length 12 - #define fake_file_readme_s_length 6 -#endif // _di_fake_file_ - -/** - * Provide default settings. - */ -#ifndef _di_fake_defaults_ - #define fake_default_path_build_s "build" F_path_separator_s - #define fake_default_path_data_s "data" F_path_separator_s - #define fake_default_path_sources_s "sources" F_path_separator_s - #define fake_default_path_work_s "" - - #define fake_default_path_build_s_length 6 - #define fake_default_path_data_s_length 5 - #define fake_default_path_sources_s_length 8 - #define fake_default_path_work_s_length 0 - - #define fake_default_define_s "" - #define fake_default_fakefile_s "fakefile" - #define fake_default_mode_s "" - #define fake_default_process_s "" - #define fake_default_settings_s "settings" - - #define fake_default_define_s_length 0 - #define fake_default_fakefile_s_length 8 - #define fake_default_mode_s_length 0 - #define fake_default_process_s_length 0 - #define fake_default_settings_s_length 8 -#endif // _di_fake_defaults_ - -#ifndef _di_fake_build_language_ - enum { - fake_build_language_type_bash_e = 1, - fake_build_language_type_c_e, - fake_build_language_type_cpp_e, - }; - - #define fake_build_language_bash_s "bash" - #define fake_build_language_c_s "c" - #define fake_build_language_cpp_s "c++" - - #define fake_build_language_bash_s_length 4 - #define fake_build_language_c_s_length 1 - #define fake_build_language_cpp_s_length 3 -#endif // _di_fake_build_language_ - -#ifndef _di_fake_build_version_ - enum { - fake_build_version_type_major_e = 1, - fake_build_version_type_minor_e, - fake_build_version_type_micro_e, - fake_build_version_type_nano_e, - }; - - #define fake_build_version_major_s "major" - #define fake_build_version_minor_s "minor" - #define fake_build_version_micro_s "micro" - #define fake_build_version_nano_s "nano" - - #define fake_build_version_major_s_length 5 - #define fake_build_version_minor_s_length 5 - #define fake_build_version_micro_s_length 5 - #define fake_build_version_nano_s_length 4 -#endif // _di_fake_build_version_ - -#ifndef _di_fake_defines_ - enum { - fake_operation_build_e = 1, - fake_operation_clean_e, - fake_operation_make_e, - fake_operation_skeleton_e, - }; - - #define fake_signal_check_d 10000 - #define fake_signal_check_tiny_d 4 - #define fake_signal_check_short_d 16 - - #define fake_operations_total_d 4 - #define fake_operations_initialize { 0, 0, 0, 0 } - - #define fake_short_define_s "d" - #define fake_short_fakefile_s "f" - #define fake_short_mode_s "m" - #define fake_short_process_s "p" - #define fake_short_settings_s "s" - - #define fake_short_define_s_length 1 - #define fake_short_fakefile_s_length 1 - #define fake_short_mode_s_length 1 - #define fake_short_process_s_length 1 - #define fake_short_settings_s_length 1 - - #define fake_short_path_build_s "b" - #define fake_short_path_data_s "D" - #define fake_short_path_sources_s "S" - #define fake_short_path_work_s "w" - - #define fake_short_path_build_s_length 1 - #define fake_short_path_data_s_length 1 - #define fake_short_path_sources_s_length 1 - #define fake_short_path_work_s_length 1 - - #define fake_long_define_s "define" - #define fake_long_fakefile_s "fakefile" - #define fake_long_mode_s "mode" - #define fake_long_process_s "process" - #define fake_long_settings_s "settings" - - #define fake_long_define_s_length 6 - #define fake_long_fakefile_s_length 8 - #define fake_long_mode_s_length 4 - #define fake_long_process_s_length 7 - #define fake_long_settings_s_length 8 - - #define fake_long_path_build_s "build" - #define fake_long_path_data_s "data" - #define fake_long_path_sources_s "sources" - #define fake_long_path_work_s "work" - - #define fake_long_path_build_s_length 5 - #define fake_long_path_data_s_length 4 - #define fake_long_path_sources_s_length 7 - #define fake_long_path_work_s_length 4 - - // these special parameters are provided in such a way that they mimic the traditional ./configure script. - #define fake_long_documents_disabled_s "disable-doc" - #define fake_long_documents_enabled_s "enable-doc" - #define fake_long_shared_disabled_s "disable-shared" - #define fake_long_shared_enabled_s "enable-shared" - #define fake_long_static_disabled_s "disable-static" - #define fake_long_static_enabled_s "enable-static" - - #define fake_long_documents_disabled_s_length 11 - #define fake_long_documents_enabled_s_length 10 - #define fake_long_shared_disabled_s_length 14 - #define fake_long_shared_enabled_s_length 13 - #define fake_long_static_disabled_s_length 14 - #define fake_long_static_enabled_s_length 13 - - #define fake_other_operation_build_s "build" - #define fake_other_operation_clean_s "clean" - #define fake_other_operation_make_s "make" - #define fake_other_operation_skeleton_s "skeleton" - - #define fake_other_operation_build_s_length 5 - #define fake_other_operation_clean_s_length 5 - #define fake_other_operation_make_s_length 4 - #define fake_other_operation_skeleton_s_length 8 - - enum { - fake_parameter_help_e, - fake_parameter_light_e, - fake_parameter_dark_e, - fake_parameter_no_color_e, - fake_parameter_verbosity_quiet_e, - fake_parameter_verbosity_normal_e, - fake_parameter_verbosity_verbose_e, - fake_parameter_verbosity_debug_e, - fake_parameter_version_e, - - fake_parameter_define_e, - fake_parameter_fakefile_e, - fake_parameter_mode_e, - fake_parameter_process_e, - fake_parameter_settings_e, - - fake_parameter_path_build_e, - fake_parameter_path_data_e, - fake_parameter_path_sources_e, - fake_parameter_path_work_e, - - fake_parameter_documents_disabled_e, - fake_parameter_documents_enabled_e, - fake_parameter_shared_disabled_e, - fake_parameter_shared_enabled_e, - fake_parameter_static_disabled_e, - fake_parameter_static_enabled_e, - - fake_parameter_operation_build_e, - fake_parameter_operation_clean_e, - fake_parameter_operation_make_e, - fake_parameter_operation_skeleton_e, - }; - - #define fake_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(fake_short_define_s, fake_long_define_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fake_short_fakefile_s, fake_long_fakefile_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fake_short_mode_s, fake_long_mode_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fake_short_process_s, fake_long_process_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fake_short_settings_s, fake_long_settings_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fake_short_path_build_s, fake_long_path_build_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fake_short_path_data_s, fake_long_path_data_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fake_short_path_sources_s, fake_long_path_sources_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fake_short_path_work_s, fake_long_path_work_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(0, fake_long_documents_disabled_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(0, fake_long_documents_enabled_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(0, fake_long_shared_disabled_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(0, fake_long_shared_enabled_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(0, fake_long_static_disabled_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(0, fake_long_static_enabled_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_build_s, 0, f_console_type_other_e), \ - macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_clean_s, 0, f_console_type_other_e), \ - macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_make_s, 0, f_console_type_other_e), \ - macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_skeleton_s, 0, f_console_type_other_e), \ - } - - #define fake_total_parameters_d 28 -#endif // _di_fake_defines_ - -#ifndef _di_fake_main_t_ - typedef struct { - f_console_parameter_t parameters[fake_total_parameters_d]; - - f_array_lengths_t remaining; - bool process_pipe; - - fl_print_t output; - fl_print_t error; - fl_print_t warning; - - f_signal_t signal; - - uint8_t operation; - uint16_t signal_check; - - mode_t umask; - int child; - - f_string_dynamics_t define; - f_string_dynamic_t fakefile; - f_string_dynamics_t mode; - f_string_dynamic_t process; - f_string_dynamic_t settings; - - f_string_dynamic_t path_build; - f_string_dynamic_t path_build_documents; - f_string_dynamic_t path_build_includes; - f_string_dynamic_t path_build_libraries; - f_string_dynamic_t path_build_libraries_script; - f_string_dynamic_t path_build_libraries_shared; - f_string_dynamic_t path_build_libraries_static; - f_string_dynamic_t path_build_objects; - f_string_dynamic_t path_build_programs; - f_string_dynamic_t path_build_programs_script; - f_string_dynamic_t path_build_programs_shared; - f_string_dynamic_t path_build_programs_static; - f_string_dynamic_t path_build_settings; - f_string_dynamic_t path_build_stage; - - f_string_dynamic_t path_data; - f_string_dynamic_t path_data_build; - f_string_dynamic_t path_data_settings; - - f_string_dynamic_t path_documents; - - f_string_dynamic_t path_licenses; - - f_string_dynamic_t path_sources; - f_string_dynamic_t path_sources_bash; - f_string_dynamic_t path_sources_c; - f_string_dynamic_t path_sources_cpp; - f_string_dynamic_t path_sources_script; - - f_string_dynamic_t path_work; - f_string_dynamic_t path_work_includes; - f_string_dynamic_t path_work_libraries; - f_string_dynamic_t path_work_libraries_script; - f_string_dynamic_t path_work_libraries_shared; - f_string_dynamic_t path_work_libraries_static; - f_string_dynamic_t path_work_programs; - f_string_dynamic_t path_work_programs_script; - f_string_dynamic_t path_work_programs_shared; - f_string_dynamic_t path_work_programs_static; - - f_string_dynamic_t file_data_build_defines; - f_string_dynamic_t file_data_build_dependencies; - f_string_dynamic_t file_data_build_fakefile; - f_string_dynamic_t file_data_build_settings; - - f_string_dynamic_t file_documents_readme; - - f_color_context_t context; - } fake_main_t; - - #define fake_main_t_initialize \ - { \ - fake_console_parameter_t_initialize, \ - f_array_lengths_t_initialize, \ - F_false, \ - fl_print_t_initialize, \ - macro_fl_print_t_initialize_error(), \ - macro_fl_print_t_initialize_warning(), \ - f_signal_t_initialize, \ - 0, \ - 0, \ - 0, \ - 0, \ - f_string_dynamics_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamics_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_color_context_t_initialize, \ - } -#endif // _di_fake_main_t_ - /** * Print help. * diff --git a/level_3/fake/c/main.c b/level_3/fake/c/main.c index 6ae5366..1d5665d 100644 --- a/level_3/fake/c/main.c +++ b/level_3/fake/c/main.c @@ -19,55 +19,19 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; fake_main_t data = fake_main_t_initialize; - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); + fll_program_standard_setup(&data.signal); - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } - - // @fixme bad design in POSIX where there is no get umask without setting it. - data.umask = umask(0); - - // restore umask. - umask(data.umask); + f_file_umask_get(&data.umask); const f_status_t status = fake_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); - - f_signal_close(&data.signal); + fll_program_standard_setdown(&data.signal); if (status == F_child) { exit(data.child); } - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fake/c/private-build-library.c b/level_3/fake/c/private-build-library.c index 9c1e968..a7af0a4 100644 --- a/level_3/fake/c/private-build-library.c +++ b/level_3/fake/c/private-build-library.c @@ -80,7 +80,8 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); + return 0; } } @@ -346,7 +347,7 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); return 0; } @@ -355,7 +356,7 @@ extern "C" { { const int result = fake_execute(main, data_build.environment, data_build.setting.build_compiler, arguments, status); - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); if (F_status_is_error(*status)) return 0; if (*status == F_child) return result; @@ -625,9 +626,9 @@ extern "C" { result = fake_execute(main, data_build.environment, data_build.setting.build_indexer, arguments, status); } - macro_f_string_dynamic_t_delete_simple(file_name); - macro_f_string_dynamic_t_delete_simple(source_path); - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamic_resize(0, &file_name); + f_string_dynamic_resize(0, &source_path); + f_string_dynamics_resize(0, &arguments); if (F_status_is_error_not(*status) && *status != F_child) { fake_build_touch(main, file_stage, status); diff --git a/level_3/fake/c/private-build-load.c b/level_3/fake/c/private-build-load.c index 56f975e..f03d44b 100644 --- a/level_3/fake/c/private-build-load.c +++ b/level_3/fake/c/private-build-load.c @@ -50,10 +50,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe values for the setting '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%]", main->error.to.stream, main->error.notable, fake_build_setting_name_environment_s, main->error.notable); + fl_print_format("%q%[%QThe values for the setting '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%]", main->error.to.stream, main->error.notable, fake_build_setting_name_environment_s, main->error.notable); fl_print_format("%[' of setting file '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%s%]", main->error.to.stream, main->error.notable, fake_build_setting_name_environment_s, main->error.notable); + fl_print_format("%[%q%]", main->error.to.stream, main->error.notable, fake_build_setting_name_environment_s, main->error.notable); fl_print_format("%[' is too large.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); flockfile(main->error.to.stream); @@ -131,7 +131,8 @@ extern "C" { macro_f_fss_delimits_t_delete_simple(delimits); } - macro_f_string_dynamic_t_delete_simple(buffer); + f_string_dynamic_resize(0, &buffer); + macro_f_fss_objects_t_delete_simple(objects); macro_f_fss_contents_t_delete_simple(contents); } @@ -144,7 +145,7 @@ extern "C" { &setting->project_name, }; - f_string_t names[] = { + f_string_static_t names[] = { fake_build_setting_name_project_name_s, }; @@ -153,8 +154,8 @@ extern "C" { if (!settings[i]->used) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe setting '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, names[i], main->error.notable); + fl_print_format("%q%[%QThe setting '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, names[i], main->error.notable); fl_print_format("%[' is required but is not specified in the settings file '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, setting_file.used ? path_file : main->file_data_build_settings.string, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -223,7 +224,7 @@ extern "C" { f_string_dynamics_t version_nano_prefix = f_string_dynamics_t_initialize; f_string_dynamics_t version_target = f_string_dynamics_t_initialize; - const f_string_t settings_name[] = { + const f_string_static_t settings_name[] = { fake_build_setting_name_build_compiler_s, fake_build_setting_name_build_indexer_s, fake_build_setting_name_build_indexer_arguments_s, @@ -295,78 +296,6 @@ extern "C" { fake_build_setting_name_version_target_s, }; - const f_array_length_t settings_length[] = { - fake_build_setting_name_build_compiler_s_length, - fake_build_setting_name_build_indexer_s_length, - fake_build_setting_name_build_indexer_arguments_s_length, - fake_build_setting_name_build_language_s_length, - fake_build_setting_name_build_libraries_s_length, - fake_build_setting_name_build_libraries_shared_s_length, - fake_build_setting_name_build_libraries_static_s_length, - fake_build_setting_name_build_script_s_length, - fake_build_setting_name_build_shared_s_length, - fake_build_setting_name_build_sources_headers_s_length, - fake_build_setting_name_build_sources_headers_shared_s_length, - fake_build_setting_name_build_sources_headers_static_s_length, - fake_build_setting_name_build_sources_library_s_length, - fake_build_setting_name_build_sources_library_shared_s_length, - fake_build_setting_name_build_sources_library_static_s_length, - fake_build_setting_name_build_sources_program_s_length, - fake_build_setting_name_build_sources_program_shared_s_length, - fake_build_setting_name_build_sources_program_static_s_length, - fake_build_setting_name_build_sources_script_s_length, - fake_build_setting_name_build_sources_settings_s_length, - fake_build_setting_name_build_static_s_length, - fake_build_setting_name_defines_s_length, - fake_build_setting_name_defines_library_s_length, - fake_build_setting_name_defines_library_shared_s_length, - fake_build_setting_name_defines_library_static_s_length, - fake_build_setting_name_defines_program_s_length, - fake_build_setting_name_defines_program_shared_s_length, - fake_build_setting_name_defines_program_static_s_length, - fake_build_setting_name_defines_shared_s_length, - fake_build_setting_name_defines_static_s_length, - fake_build_setting_name_environment_length_s, - fake_build_setting_name_flags_s_length, - fake_build_setting_name_flags_library_s_length, - fake_build_setting_name_flags_library_shared_s_length, - fake_build_setting_name_flags_library_static_s_length, - fake_build_setting_name_flags_program_s_length, - fake_build_setting_name_flags_program_shared_s_length, - fake_build_setting_name_flags_program_static_s_length, - fake_build_setting_name_flags_shared_s_length, - fake_build_setting_name_flags_static_s_length, - fake_build_setting_name_modes_s_length, - fake_build_setting_name_modes_default_s_length, - fake_build_setting_name_path_headers_s_length, - fake_build_setting_name_path_headers_preserve_s_length, - fake_build_setting_name_path_language_s_length, - fake_build_setting_name_path_library_script_s_length, - fake_build_setting_name_path_library_shared_s_length, - fake_build_setting_name_path_library_static_s_length, - fake_build_setting_name_path_program_script_s_length, - fake_build_setting_name_path_program_shared_s_length, - fake_build_setting_name_path_program_static_s_length, - fake_build_setting_name_path_sources_s_length, - fake_build_setting_name_path_standard_s_length, - fake_build_setting_name_process_post_s_length, - fake_build_setting_name_process_pre_s_length, - fake_build_setting_name_project_name_s_length, - fake_build_setting_name_search_exclusive_s_length, - fake_build_setting_name_search_shared_s_length, - fake_build_setting_name_search_static_s_length, - fake_build_setting_name_version_file_s_length, - fake_build_setting_name_version_major_s_length, - fake_build_setting_name_version_major_prefix_s_length, - fake_build_setting_name_version_micro_s_length, - fake_build_setting_name_version_micro_prefix_s_length, - fake_build_setting_name_version_minor_s_length, - fake_build_setting_name_version_minor_prefix_s_length, - fake_build_setting_name_version_nano_s_length, - fake_build_setting_name_version_nano_prefix_s_length, - fake_build_setting_name_version_target_s_length, - }; - f_string_dynamics_t *settings_value[] = { &build_compiler, &build_indexer, @@ -513,7 +442,7 @@ extern "C" { f_string_t function = "fll_fss_snatch_apart"; - *status = fll_fss_snatch_apart(buffer, objects, contents, settings_name, settings_length, fake_build_setting_total_d, settings_value, settings_matches, 0); + *status = fll_fss_snatch_apart(buffer, objects, contents, settings_name, fake_build_setting_total_d, settings_value, settings_matches, 0); if (*status == F_none) { const int total_build_libraries = setting->build_libraries.used; @@ -550,7 +479,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe specified mode '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe specified mode '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, modes->array[i], main->error.notable); fl_print_format("%[' is not a valid mode, according to '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, path_file, main->error.notable); @@ -597,7 +526,7 @@ extern "C" { } for (j = 0; j < fake_build_setting_total_d; ++j) { - macro_f_string_dynamic_t_delete_simple(settings_mode_name_dynamic[j]); + f_string_dynamic_resize(0, &settings_mode_name_dynamic[j]); } // for if (F_status_is_error(*status)) break; @@ -635,7 +564,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { funlockfile(main->error.to.stream); - fl_print_format("%q%[%SA setting in the file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QA setting in the file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, path_file, main->error.notable); fl_print_format("%[' is too long.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -647,7 +576,7 @@ extern "C" { } } else { - const f_string_t settings_single_name[] = { + const f_string_static_t settings_single_name[] = { fake_build_setting_name_build_compiler_s, fake_build_setting_name_build_indexer_s, fake_build_setting_name_build_language_s, @@ -939,8 +868,8 @@ extern "C" { if (main->warning.verbosity == f_console_verbosity_verbose_e) { flockfile(main->warning.to.stream); - fl_print_format("%q%[%SThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, settings_single_name[i], main->warning.notable); + fl_print_format("%q%[%QThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, settings_single_name[i], main->warning.notable); fl_print_format("%[' in the file '%]", main->warning.to.stream, main->warning.context, main->warning.context); fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); fl_print_format("%[' may only have a single property, only using the first: '%]", main->warning.to.stream, main->warning.context, main->warning.context); @@ -964,16 +893,16 @@ extern "C" { if (main->warning.verbosity == f_console_verbosity_verbose_e) { flockfile(main->warning.to.stream); - fl_print_format("%q%[%SThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, settings_single_name[i], main->warning.notable); + fl_print_format("%q%[%QThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, settings_single_name[i], main->warning.notable); fl_print_format("%[' in the file '%]", main->warning.to.stream, main->warning.context, main->warning.context); fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); fl_print_format("%[' may be either '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_common_setting_bool_yes_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_common_setting_bool_yes_s, main->warning.notable); fl_print_format("%[' or '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_common_setting_bool_no_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_common_setting_bool_no_s, main->warning.notable); fl_print_format("%[', defaulting to '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_common_setting_bool_yes_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_common_setting_bool_yes_s, main->warning.notable); fl_print_format("%['.%]%q", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); @@ -996,18 +925,18 @@ extern "C" { if (main->warning.verbosity == f_console_verbosity_verbose_e) { flockfile(main->warning.to.stream); - fl_print_format("%q%[%SThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, settings_single_name[i], main->warning.notable); + fl_print_format("%q%[%QThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, settings_single_name[i], main->warning.notable); fl_print_format("%[' in the file '%]", main->warning.to.stream, main->warning.context, main->warning.context); fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); fl_print_format("%[' may only be one of '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_build_language_bash_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_language_bash_s, main->warning.notable); fl_print_format("%[', '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_build_language_c_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_language_c_s, main->warning.notable); fl_print_format("%[', or '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_build_language_cpp_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_language_cpp_s, main->warning.notable); fl_print_format("%[', defaulting to '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_build_language_c_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_language_c_s, main->warning.notable); fl_print_format("%['.%]%q", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); @@ -1033,20 +962,20 @@ extern "C" { if (main->warning.verbosity == f_console_verbosity_verbose_e) { flockfile(main->warning.to.stream); - fl_print_format("%q%[%SThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, settings_single_name[i], main->warning.notable); + fl_print_format("%q%[%QThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, settings_single_name[i], main->warning.notable); fl_print_format("%[' in the file '%]", main->warning.to.stream, main->warning.context, main->warning.context); fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); fl_print_format("%[' may only be one of '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_build_version_major_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_version_major_s, main->warning.notable); fl_print_format("%[', '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_build_version_minor_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_version_minor_s, main->warning.notable); fl_print_format("%[', '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_build_version_micro_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_version_micro_s, main->warning.notable); fl_print_format("%[', or '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_build_version_nano_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_version_nano_s, main->warning.notable); fl_print_format("%[', defaulting to '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, settings_single_version_default_name[i], main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, settings_single_version_default_name[i], main->warning.notable); fl_print_format("%['.%]%q", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); @@ -1092,12 +1021,12 @@ extern "C" { if (main->warning.verbosity == f_console_verbosity_verbose_e) { flockfile(main->warning.to.stream); - fl_print_format("%q%[%SThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, fake_build_setting_name_version_file_s, main->warning.notable); + fl_print_format("%q%[%QThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_setting_name_version_file_s, main->warning.notable); fl_print_format("%[' in the file '%]", main->warning.to.stream, main->warning.context, main->warning.context); fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); fl_print_format("%[' is required, defaulting to '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_build_version_micro_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_version_micro_s, main->warning.notable); fl_print_format("%['.%]%q", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); @@ -1110,12 +1039,12 @@ extern "C" { if (main->warning.verbosity == f_console_verbosity_verbose_e) { flockfile(main->warning.to.stream); - fl_print_format("%q%[%SThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, fake_build_setting_name_version_target_s, main->warning.notable); + fl_print_format("%q%[%QThe setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_setting_name_version_target_s, main->warning.notable); fl_print_format("%[' in the file '%]", main->warning.to.stream, main->warning.context, main->warning.context); fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); fl_print_format("%[' is required, defaulting to '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%s%]", main->warning.to.stream, main->warning.notable, fake_build_version_major_s, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, fake_build_version_major_s, main->warning.notable); fl_print_format("%['.%]%q", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); @@ -1147,21 +1076,21 @@ extern "C" { settings_matches[67], // version_nano_prefix }; - const char *name_target[] = { + const f_string_static_t name_target[] = { fake_build_version_major_s, fake_build_version_minor_s, fake_build_version_micro_s, fake_build_version_nano_s, }; - const char *name_object[] = { + const f_string_static_t name_object[] = { fake_build_setting_name_version_major_s, fake_build_setting_name_version_minor_s, fake_build_setting_name_version_micro_s, fake_build_setting_name_version_nano_s, }; - const char *setting_name[] = { + const f_string_static_t setting_name[] = { fake_build_setting_name_version_file_s, fake_build_setting_name_version_target_s, }; @@ -1180,10 +1109,11 @@ extern "C" { if (!has_prefix_object[i]) { prefix[i]->used = 0; - *status = f_string_append(fake_build_setting_default_version_prefix_s, fake_build_setting_default_version_prefix_s_length, prefix[i]); + *status = f_string_dynamic_append(fake_build_setting_default_version_prefix_s, prefix[i]); if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); + break; } } @@ -1197,18 +1127,19 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SWhen the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, setting_name[j], main->error.notable); + fl_print_format("%q%[%QWhen the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, setting_name[j], main->error.notable); fl_print_format("%[' is set to '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, name_target[setting_target[j] - 1], main->error.notable); + fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, name_target[setting_target[j] - 1], main->error.notable); fl_print_format("%[' then the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, name_object[i], main->error.notable); + fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, name_object[i], main->error.notable); fl_print_format("%[' Object must have Content.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); } *status = F_status_set_error(F_failure); + break; } } // for @@ -1219,39 +1150,39 @@ extern "C" { } } - macro_f_string_dynamics_t_delete_simple(build_compiler); - macro_f_string_dynamics_t_delete_simple(build_indexer); - macro_f_string_dynamics_t_delete_simple(build_language); - macro_f_string_dynamics_t_delete_simple(build_script); - macro_f_string_dynamics_t_delete_simple(build_shared); - macro_f_string_dynamics_t_delete_simple(build_static); - macro_f_string_dynamics_t_delete_simple(path_headers); - macro_f_string_dynamics_t_delete_simple(path_headers_preserve); - macro_f_string_dynamics_t_delete_simple(path_language); - macro_f_string_dynamics_t_delete_simple(path_library_script); - macro_f_string_dynamics_t_delete_simple(path_library_shared); - macro_f_string_dynamics_t_delete_simple(path_library_static); - macro_f_string_dynamics_t_delete_simple(path_program_script); - macro_f_string_dynamics_t_delete_simple(path_program_shared); - macro_f_string_dynamics_t_delete_simple(path_program_static); - macro_f_string_dynamics_t_delete_simple(path_sources); - macro_f_string_dynamics_t_delete_simple(path_standard); - macro_f_string_dynamics_t_delete_simple(process_post); - macro_f_string_dynamics_t_delete_simple(process_pre); - macro_f_string_dynamics_t_delete_simple(project_name); - macro_f_string_dynamics_t_delete_simple(search_exclusive); - macro_f_string_dynamics_t_delete_simple(search_shared); - macro_f_string_dynamics_t_delete_simple(search_static); - macro_f_string_dynamics_t_delete_simple(version_file); - macro_f_string_dynamics_t_delete_simple(version_major); - macro_f_string_dynamics_t_delete_simple(version_major_prefix); - macro_f_string_dynamics_t_delete_simple(version_micro); - macro_f_string_dynamics_t_delete_simple(version_micro_prefix); - macro_f_string_dynamics_t_delete_simple(version_minor); - macro_f_string_dynamics_t_delete_simple(version_minor_prefix); - macro_f_string_dynamics_t_delete_simple(version_nano); - macro_f_string_dynamics_t_delete_simple(version_nano_prefix); - macro_f_string_dynamics_t_delete_simple(version_target); + f_string_dynamics_resize(0, &build_compiler); + f_string_dynamics_resize(0, &build_indexer); + f_string_dynamics_resize(0, &build_language); + f_string_dynamics_resize(0, &build_script); + f_string_dynamics_resize(0, &build_shared); + f_string_dynamics_resize(0, &build_static); + f_string_dynamics_resize(0, &path_headers); + f_string_dynamics_resize(0, &path_headers_preserve); + f_string_dynamics_resize(0, &path_language); + f_string_dynamics_resize(0, &path_library_script); + f_string_dynamics_resize(0, &path_library_shared); + f_string_dynamics_resize(0, &path_library_static); + f_string_dynamics_resize(0, &path_program_script); + f_string_dynamics_resize(0, &path_program_shared); + f_string_dynamics_resize(0, &path_program_static); + f_string_dynamics_resize(0, &path_sources); + f_string_dynamics_resize(0, &path_standard); + f_string_dynamics_resize(0, &process_post); + f_string_dynamics_resize(0, &process_pre); + f_string_dynamics_resize(0, &project_name); + f_string_dynamics_resize(0, &search_exclusive); + f_string_dynamics_resize(0, &search_shared); + f_string_dynamics_resize(0, &search_static); + f_string_dynamics_resize(0, &version_file); + f_string_dynamics_resize(0, &version_major); + f_string_dynamics_resize(0, &version_major_prefix); + f_string_dynamics_resize(0, &version_micro); + f_string_dynamics_resize(0, &version_micro_prefix); + f_string_dynamics_resize(0, &version_minor); + f_string_dynamics_resize(0, &version_minor_prefix); + f_string_dynamics_resize(0, &version_nano); + f_string_dynamics_resize(0, &version_nano_prefix); + f_string_dynamics_resize(0, &version_target); } #endif // _di_fake_build_load_setting_process_ @@ -1267,18 +1198,12 @@ extern "C" { } { - const f_string_t sources[] = { + const f_string_static_t sources[] = { fake_build_setting_default_version_s, fake_build_setting_default_version_s, fake_build_setting_default_version_s, }; - const f_array_length_t lengths[] = { - fake_build_setting_default_version_s_length, - fake_build_setting_default_version_s_length, - fake_build_setting_default_version_s_length, - }; - f_string_dynamic_t * const destinations[] = { &setting->version_major, &setting->version_minor, @@ -1289,10 +1214,10 @@ extern "C" { if (destinations[i]->used) continue; - *status = f_string_append_assure(sources[i], lengths[i], destinations[i]); + *status = f_string_dynamic_append_assure(sources[i], destinations[i]); if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_append_assure", F_true); + fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_assure", F_true); break; } @@ -1322,12 +1247,12 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe parameters '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_shared_disabled_s, main->error.notable); + fl_print_format("%q%[%QThe parameters '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_shared_disabled_s, main->error.notable); fl_print_format("%[' and '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_shared_enabled_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_shared_enabled_s, main->error.notable); fl_print_format("%[' contradict, defaulting to '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, setting->build_shared ? fake_long_shared_enabled_s : fake_long_shared_disabled_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, setting->build_shared ? fake_long_shared_enabled_s : fake_long_shared_disabled_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -1357,12 +1282,12 @@ extern "C" { if (main->error.verbosity == f_console_verbosity_verbose_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe parameters '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_static_disabled_s, main->error.notable); + fl_print_format("%q%[%QThe parameters '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_static_disabled_s, main->error.notable); fl_print_format("%[' and '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_static_enabled_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_static_enabled_s, main->error.notable); fl_print_format("%[' contradict, defaulting to '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, setting->build_static ? fake_long_static_enabled_s : fake_long_static_disabled_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, setting->build_static ? fake_long_static_enabled_s : fake_long_static_disabled_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -1383,12 +1308,12 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe build settings '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%]", main->error.to.stream, main->error.notable, fake_build_setting_name_build_shared_s, main->error.notable); + fl_print_format("%q%[%QThe build settings '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%]", main->error.to.stream, main->error.notable, fake_build_setting_name_build_shared_s, main->error.notable); fl_print_format("%[' and '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%s%]", main->error.to.stream, main->error.notable, fake_build_setting_name_build_static_s, main->error.notable); + fl_print_format("%[%q%]", main->error.to.stream, main->error.notable, fake_build_setting_name_build_static_s, main->error.notable); fl_print_format("%[' cannot both be false when using the language '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%s%]", main->error.to.stream, main->error.notable, setting->build_language == fake_build_language_type_c_e ? fake_build_language_c_s : fake_build_language_cpp_s, main->error.notable); + fl_print_format("%[%q%]", main->error.to.stream, main->error.notable, setting->build_language == fake_build_language_type_c_e ? fake_build_language_c_s : fake_build_language_cpp_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -1427,22 +1352,6 @@ extern "C" { fake_build_stage_sources_settings_s, }; - const f_array_length_t lengths[] = { - fake_build_stage_libraries_script_s_length, - fake_build_stage_libraries_shared_s_length, - fake_build_stage_libraries_static_s_length, - fake_build_stage_objects_static_s_length, - fake_build_stage_process_post_s_length, - fake_build_stage_process_pre_s_length, - fake_build_stage_programs_script_s_length, - fake_build_stage_programs_shared_s_length, - fake_build_stage_programs_static_s_length, - fake_build_stage_skeleton_s_length, - fake_build_stage_sources_headers_s_length, - fake_build_stage_sources_script_s_length, - fake_build_stage_sources_settings_s_length, - }; - f_string_dynamic_t * const values[] = { &stage->file_libraries_script, &stage->file_libraries_shared, @@ -1487,51 +1396,39 @@ extern "C" { } if (main->process.used) { - *status = f_string_append(main->process.string, main->process.used, values[i]); + *status = f_string_dynamic_append_nulless(main->process, values[i]); if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); break; } - *status = f_string_append(fake_build_stage_separate_s, fake_build_stage_separate_s_length, values[i]); + *status = f_string_dynamic_append(fake_build_stage_separate_s, values[i]); if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); break; } } - *status = f_string_append_nulless(names[i], lengths[i], values[i]); + *status = f_string_dynamic_append(names[i], values[i]); - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); - - break; + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append(fake_build_stage_separate_s, values[i]); } - *status = f_string_append(fake_build_stage_separate_s, fake_build_stage_separate_s_length, values[i]); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_append", F_true); - - break; + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append(settings_file_base, values[i]); } - *status = f_string_dynamic_append(settings_file_base, values[i]); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); - - break; + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append(fake_build_stage_built_s, values[i]); } - *status = f_string_append(fake_build_stage_built_s, fake_build_stage_built_s_length, values[i]); - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); break; } @@ -1545,7 +1442,7 @@ extern "C" { } } // for - macro_f_string_dynamic_t_delete_simple(settings_file_base); + f_string_dynamic_resize(0, &settings_file_base); } #endif // _di_fake_build_load_stage_ diff --git a/level_3/fake/c/private-build-objects.c b/level_3/fake/c/private-build-objects.c index 04dc8d6..8921cea 100644 --- a/level_3/fake/c/private-build-objects.c +++ b/level_3/fake/c/private-build-objects.c @@ -111,7 +111,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, destination_path, main->error.notable); fl_print_format("%[' exists but is not a directory.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -129,7 +129,7 @@ extern "C" { if (F_status_set_fine(*status) == F_file_found_not) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, destination_path, main->error.notable); fl_print_format("%[' could not be created, a parent directory does not exist.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -215,9 +215,9 @@ extern "C" { if (F_status_is_error(*status) || *status == F_child) break; } // for - macro_f_string_dynamic_t_delete_simple(file_name); - macro_f_string_dynamic_t_delete_simple(destination_path); - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamic_resize(0, &file_name); + f_string_dynamic_resize(0, &destination_path); + f_string_dynamics_resize(0, &arguments); if (F_status_is_error_not(*status) && *status != F_child) { fake_build_touch(main, file_stage, status); diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 7674159..66661a8 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -41,21 +41,16 @@ extern "C" { memcpy(build_includes, fake_build_parameter_library_include_s, fake_build_parameter_library_include_s_length); memcpy(build_includes + fake_build_parameter_library_include_s_length, main->path_build_includes.string, main->path_build_includes.used); - const f_string_t values[] = { - build_libraries, - build_includes, - }; - - const f_array_length_t lengths[] = { - build_libraries_length, - build_includes_length, + const f_string_static_t values[] = { + macro_f_string_static_t_initialize2(build_libraries, 0, build_includes_length), + macro_f_string_static_t_initialize2(build_includes, 0, build_includes_length), }; for (uint8_t i = 0; i < 2; ++i) { if (!lengths[i]) continue; - *status = fll_execute_arguments_add(values[i], lengths[i], arguments); + *status = fll_execute_arguments_add(values[i].string, values[i].used, arguments); if (F_status_is_error(*status)) break; } // for @@ -312,7 +307,8 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), " macro_f_string_dynamic_t_resize", F_true); - macro_f_string_dynamic_t_delete_simple(path_source); + f_string_dynamic_resize(0, &path_source); + return; } @@ -486,9 +482,10 @@ extern "C" { } // for macro_f_directory_statuss_t_delete_simple(failures); - macro_f_string_dynamic_t_delete_simple(path_source); - macro_f_string_dynamic_t_delete_simple(destination_file); - macro_f_string_dynamic_t_delete_simple(destination_directory); + + f_string_dynamic_resize(0, &path_source); + f_string_dynamic_resize(0, &destination_file); + f_string_dynamic_resize(0, &destination_directory); if (F_status_is_error_not(*status)) { fake_build_touch(main, file_stage, status); @@ -543,7 +540,8 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); + return 0; } @@ -563,8 +561,9 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_mash", F_true); - macro_f_string_dynamic_t_delete_simple(defines); - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamic_resize(0, &defines); + f_string_dynamics_resize(0, &arguments); + return 0; } @@ -573,20 +572,21 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - macro_f_string_dynamic_t_delete_simple(defines); - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamic_resize(0, &defines); + f_string_dynamics_resize(0, &arguments); + return 0; } } const f_string_t parameters_prefix[] = { - f_console_symbol_short_enable_s.string, - f_console_symbol_short_enable_s.string, - f_console_symbol_short_enable_s.string, - f_console_symbol_short_enable_s.string, - f_console_symbol_short_enable_s.string, - f_console_symbol_short_enable_s.string, - f_console_symbol_short_enable_s.string, + f_console_symbol_short_enable_s, + f_console_symbol_short_enable_s, + f_console_symbol_short_enable_s, + f_console_symbol_short_enable_s, + f_console_symbol_short_enable_s, + f_console_symbol_short_enable_s, + f_console_symbol_short_enable_s, }; const f_array_length_t parameters_prefix_length[] = { @@ -641,12 +641,13 @@ extern "C" { *status = fll_execute_arguments_add_parameter_set(parameters_prefix, parameters_prefix_length, parameters_name, parameters_name_length, parameters_value, parameters_value_length, 7, &arguments); - macro_f_string_dynamic_t_delete_simple(defines); + f_string_dynamic_resize(0, &defines); if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "fll_execute_arguments_add_parameter_set", F_true); - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); + return 0; } } @@ -673,8 +674,9 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), function, F_true); - macro_f_string_dynamic_t_delete_simple(path); - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamic_resize(0, &path); + f_string_dynamics_resize(0, &arguments); + return 0; } } @@ -690,7 +692,7 @@ extern "C" { *status = fll_execute_program(path.string, arguments, ¶meter, 0, (void *) &return_code); - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); if (fake_signal_received(main)) { *status = F_status_set_error(F_interrupt); @@ -701,7 +703,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SFailed to execute script: '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QFailed to execute script: '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, path, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -717,7 +719,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(path); + f_string_dynamic_resize(0, &path); return return_code; } diff --git a/level_3/fake/c/private-common.c b/level_3/fake/c/private-common.c index 76063e3..e8edacf 100644 --- a/level_3/fake/c/private-common.c +++ b/level_3/fake/c/private-common.c @@ -7,268 +7,279 @@ extern "C" { #endif #ifndef _di_fake_build_setting_t_ - const f_string_t fake_build_setting_name_build_compiler_s = FAKE_build_setting_name_build_compiler_s; - const f_string_t fake_build_setting_name_build_language_s = FAKE_build_setting_name_build_language_s; - const f_string_t fake_build_setting_name_build_libraries_s = FAKE_build_setting_name_build_libraries_s; - const f_string_t fake_build_setting_name_build_libraries_shared_s = FAKE_build_setting_name_build_libraries_shared_s; - const f_string_t fake_build_setting_name_build_libraries_static_s = FAKE_build_setting_name_build_libraries_static_s; - const f_string_t fake_build_setting_name_build_indexer_s = FAKE_build_setting_name_build_indexer_s; - const f_string_t fake_build_setting_name_build_indexer_arguments_s = FAKE_build_setting_name_build_indexer_arguments_s; - const f_string_t fake_build_setting_name_build_script_s = FAKE_build_setting_name_build_script_s; - const f_string_t fake_build_setting_name_build_shared_s = FAKE_build_setting_name_build_shared_s; - const f_string_t fake_build_setting_name_build_sources_headers_s = FAKE_build_setting_name_build_sources_headers_s; - const f_string_t fake_build_setting_name_build_sources_headers_shared_s = FAKE_build_setting_name_build_sources_headers_shared_s; - const f_string_t fake_build_setting_name_build_sources_headers_static_s = FAKE_build_setting_name_build_sources_headers_static_s; - const f_string_t fake_build_setting_name_build_sources_library_s = FAKE_build_setting_name_build_sources_library_s; - const f_string_t fake_build_setting_name_build_sources_library_shared_s = FAKE_build_setting_name_build_sources_library_shared_s; - const f_string_t fake_build_setting_name_build_sources_library_static_s = FAKE_build_setting_name_build_sources_library_static_s; - const f_string_t fake_build_setting_name_build_sources_program_s = FAKE_build_setting_name_build_sources_program_s; - const f_string_t fake_build_setting_name_build_sources_program_shared_s = FAKE_build_setting_name_build_sources_program_shared_s; - const f_string_t fake_build_setting_name_build_sources_program_static_s = FAKE_build_setting_name_build_sources_program_static_s; - const f_string_t fake_build_setting_name_build_sources_script_s = FAKE_build_setting_name_build_sources_script_s; - const f_string_t fake_build_setting_name_build_sources_settings_s = FAKE_build_setting_name_build_sources_settings_s; - const f_string_t fake_build_setting_name_build_static_s = FAKE_build_setting_name_build_static_s; - const f_string_t fake_build_setting_name_defines_s = FAKE_build_setting_name_defines_s; - const f_string_t fake_build_setting_name_defines_library_s = FAKE_build_setting_name_defines_library_s; - const f_string_t fake_build_setting_name_defines_library_shared_s = FAKE_build_setting_name_defines_library_shared_s; - const f_string_t fake_build_setting_name_defines_library_static_s = FAKE_build_setting_name_defines_library_static_s; - const f_string_t fake_build_setting_name_defines_program_s = FAKE_build_setting_name_defines_program_s; - const f_string_t fake_build_setting_name_defines_program_shared_s = FAKE_build_setting_name_defines_program_shared_s; - const f_string_t fake_build_setting_name_defines_program_static_s = FAKE_build_setting_name_defines_program_static_s; - const f_string_t fake_build_setting_name_defines_shared_s = FAKE_build_setting_name_defines_shared_s; - const f_string_t fake_build_setting_name_defines_static_s = FAKE_build_setting_name_defines_static_s; - const f_string_t fake_build_setting_name_environment_s = FAKE_build_setting_name_environment_s; - const f_string_t fake_build_setting_name_flags_s = FAKE_build_setting_name_flags_s; - const f_string_t fake_build_setting_name_flags_library_s = FAKE_build_setting_name_flags_library_s; - const f_string_t fake_build_setting_name_flags_library_shared_s = FAKE_build_setting_name_flags_library_shared_s; - const f_string_t fake_build_setting_name_flags_library_static_s = FAKE_build_setting_name_flags_library_static_s; - const f_string_t fake_build_setting_name_flags_program_s = FAKE_build_setting_name_flags_program_s; - const f_string_t fake_build_setting_name_flags_program_shared_s = FAKE_build_setting_name_flags_program_shared_s; - const f_string_t fake_build_setting_name_flags_program_static_s = FAKE_build_setting_name_flags_program_static_s; - const f_string_t fake_build_setting_name_flags_shared_s = FAKE_build_setting_name_flags_shared_s; - const f_string_t fake_build_setting_name_flags_static_s = FAKE_build_setting_name_flags_static_s; - const f_string_t fake_build_setting_name_modes_s = FAKE_build_setting_name_modes_s; - const f_string_t fake_build_setting_name_modes_default_s = FAKE_build_setting_name_modes_default_s; - const f_string_t fake_build_setting_name_path_headers_s = FAKE_build_setting_name_path_headers_s; - const f_string_t fake_build_setting_name_path_headers_preserve_s = FAKE_build_setting_name_path_headers_preserve_s; - const f_string_t fake_build_setting_name_path_language_s = FAKE_build_setting_name_path_language_s; - const f_string_t fake_build_setting_name_path_library_script_s = FAKE_build_setting_name_path_library_script_s; - const f_string_t fake_build_setting_name_path_library_shared_s = FAKE_build_setting_name_path_library_shared_s; - const f_string_t fake_build_setting_name_path_library_static_s = FAKE_build_setting_name_path_library_static_s; - const f_string_t fake_build_setting_name_path_program_script_s = FAKE_build_setting_name_path_program_script_s; - const f_string_t fake_build_setting_name_path_program_shared_s = FAKE_build_setting_name_path_program_shared_s; - const f_string_t fake_build_setting_name_path_program_static_s = FAKE_build_setting_name_path_program_static_s; - const f_string_t fake_build_setting_name_path_sources_s = FAKE_build_setting_name_path_sources_s; - const f_string_t fake_build_setting_name_path_standard_s = FAKE_build_setting_name_path_standard_s; - const f_string_t fake_build_setting_name_process_post_s = FAKE_build_setting_name_process_post_s; - const f_string_t fake_build_setting_name_process_pre_s = FAKE_build_setting_name_process_pre_s; - const f_string_t fake_build_setting_name_project_name_s = FAKE_build_setting_name_project_name_s; - const f_string_t fake_build_setting_name_search_exclusive_s = FAKE_build_setting_name_search_exclusive_s; - const f_string_t fake_build_setting_name_search_shared_s = FAKE_build_setting_name_search_shared_s; - const f_string_t fake_build_setting_name_search_static_s = FAKE_build_setting_name_search_static_s; - const f_string_t fake_build_setting_name_version_file_s = FAKE_build_setting_name_version_file_s; - const f_string_t fake_build_setting_name_version_major_s = FAKE_build_setting_name_version_major_s; - const f_string_t fake_build_setting_name_version_major_prefix_s = FAKE_build_setting_name_version_major_prefix_s; - const f_string_t fake_build_setting_name_version_micro_s = FAKE_build_setting_name_version_micro_s; - const f_string_t fake_build_setting_name_version_micro_prefix_s = FAKE_build_setting_name_version_micro_prefix_s; - const f_string_t fake_build_setting_name_version_minor_s = FAKE_build_setting_name_version_minor_s; - const f_string_t fake_build_setting_name_version_minor_prefix_s = FAKE_build_setting_name_version_minor_prefix_s; - const f_string_t fake_build_setting_name_version_nano_s = FAKE_build_setting_name_version_nano_s; - const f_string_t fake_build_setting_name_version_nano_prefix_s = FAKE_build_setting_name_version_nano_prefix_s; - const f_string_t fake_build_setting_name_version_target_s = FAKE_build_setting_name_version_target_s; + const f_string_static_t fake_build_setting_name_build_compiler_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_compiler_s, 0, FAKE_build_setting_name_build_compiler_s_length); + const f_string_static_t fake_build_setting_name_build_language_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_language_s, 0, FAKE_build_setting_name_build_language_s_length); + const f_string_static_t fake_build_setting_name_build_libraries_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_libraries_s, 0, FAKE_build_setting_name_build_libraries_s_length); + const f_string_static_t fake_build_setting_name_build_libraries_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_libraries_shared_s, 0, FAKE_build_setting_name_build_libraries_shared_s_length); + const f_string_static_t fake_build_setting_name_build_libraries_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_libraries_static_s, 0, FAKE_build_setting_name_build_libraries_static_s_length); + const f_string_static_t fake_build_setting_name_build_indexer_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_indexer_s, 0, FAKE_build_setting_name_build_indexer_s_length); + const f_string_static_t fake_build_setting_name_build_indexer_arguments_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_indexer_arguments_s, 0, FAKE_build_setting_name_build_indexer_arguments_s_length); + const f_string_static_t fake_build_setting_name_build_script_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_script_s, 0, FAKE_build_setting_name_build_script_s_length); + const f_string_static_t fake_build_setting_name_build_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_shared_s, 0, FAKE_build_setting_name_build_shared_s_length); + const f_string_static_t fake_build_setting_name_build_sources_headers_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_sources_headers_s, 0, FAKE_build_setting_name_build_sources_headers_s_length); + const f_string_static_t fake_build_setting_name_build_sources_headers_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_sources_headers_shared_s, 0, FAKE_build_setting_name_build_sources_headers_shared_s_length); + const f_string_static_t fake_build_setting_name_build_sources_headers_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_sources_headers_static_s, 0, FAKE_build_setting_name_build_sources_headers_static_s_length); + const f_string_static_t fake_build_setting_name_build_sources_library_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_sources_library_s, 0, FAKE_build_setting_name_build_sources_library_s_length); + const f_string_static_t fake_build_setting_name_build_sources_library_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_sources_library_shared_s, 0, FAKE_build_setting_name_build_sources_library_shared_s_length); + const f_string_static_t fake_build_setting_name_build_sources_library_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_sources_library_static_s, 0, FAKE_build_setting_name_build_sources_library_static_s_length); + const f_string_static_t fake_build_setting_name_build_sources_program_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_sources_program_s, 0, FAKE_build_setting_name_build_sources_program_s_length); + const f_string_static_t fake_build_setting_name_build_sources_program_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_sources_program_shared_s, 0, FAKE_build_setting_name_build_sources_program_shared_s_length); + const f_string_static_t fake_build_setting_name_build_sources_program_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_sources_program_static_s, 0, FAKE_build_setting_name_build_sources_program_static_s_length); + const f_string_static_t fake_build_setting_name_build_sources_script_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_sources_script_s, 0, FAKE_build_setting_name_build_sources_script_s_length); + const f_string_static_t fake_build_setting_name_build_sources_settings_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_sources_settings_s, 0, FAKE_build_setting_name_build_sources_settings_s_length); + const f_string_static_t fake_build_setting_name_build_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_build_static_s, 0, FAKE_build_setting_name_build_static_s_length); + const f_string_static_t fake_build_setting_name_defines_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_defines_s, 0, FAKE_build_setting_name_defines_s_length); + const f_string_static_t fake_build_setting_name_defines_library_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_defines_library_s, 0, FAKE_build_setting_name_defines_library_s_length); + const f_string_static_t fake_build_setting_name_defines_library_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_defines_library_shared_s, 0, FAKE_build_setting_name_defines_library_shared_s_length); + const f_string_static_t fake_build_setting_name_defines_library_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_defines_library_static_s, 0, FAKE_build_setting_name_defines_library_static_s_length); + const f_string_static_t fake_build_setting_name_defines_program_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_defines_program_s, 0, FAKE_build_setting_name_defines_program_s_length); + const f_string_static_t fake_build_setting_name_defines_program_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_defines_program_shared_s, 0, FAKE_build_setting_name_defines_program_shared_s_length); + const f_string_static_t fake_build_setting_name_defines_program_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_defines_program_static_s, 0, FAKE_build_setting_name_defines_program_static_s_length); + const f_string_static_t fake_build_setting_name_defines_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_defines_shared_s, 0, FAKE_build_setting_name_defines_shared_s_length); + const f_string_static_t fake_build_setting_name_defines_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_defines_static_s, 0, FAKE_build_setting_name_defines_static_s_length); + const f_string_static_t fake_build_setting_name_environment_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_environment_s, 0, FAKE_build_setting_name_environment_s_length); + const f_string_static_t fake_build_setting_name_flags_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_flags_s, 0, FAKE_build_setting_name_flags_s_length); + const f_string_static_t fake_build_setting_name_flags_library_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_flags_library_s, 0, FAKE_build_setting_name_flags_library_s_length); + const f_string_static_t fake_build_setting_name_flags_library_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_flags_library_shared_s, 0, FAKE_build_setting_name_flags_library_shared_s_length); + const f_string_static_t fake_build_setting_name_flags_library_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_flags_library_static_s, 0, FAKE_build_setting_name_flags_library_static_s_length); + const f_string_static_t fake_build_setting_name_flags_program_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_flags_program_s, 0, FAKE_build_setting_name_flags_program_s_length); + const f_string_static_t fake_build_setting_name_flags_program_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_flags_program_shared_s, 0, FAKE_build_setting_name_flags_program_shared_s_length); + const f_string_static_t fake_build_setting_name_flags_program_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_flags_program_static_s, 0, FAKE_build_setting_name_flags_program_static_s_length); + const f_string_static_t fake_build_setting_name_flags_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_flags_shared_s, 0, FAKE_build_setting_name_flags_shared_s_length); + const f_string_static_t fake_build_setting_name_flags_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_flags_static_s, 0, FAKE_build_setting_name_flags_static_s_length); + const f_string_static_t fake_build_setting_name_modes_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_modes_s, 0, FAKE_build_setting_name_modes_s_length); + const f_string_static_t fake_build_setting_name_modes_default_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_modes_default_s, 0, FAKE_build_setting_name_modes_default_s_length); + const f_string_static_t fake_build_setting_name_path_headers_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_path_headers_s, 0, FAKE_build_setting_name_path_headers_s_length); + const f_string_static_t fake_build_setting_name_path_headers_preserve_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_path_headers_preserve_s, 0, FAKE_build_setting_name_path_headers_preserve_s_length); + const f_string_static_t fake_build_setting_name_path_language_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_path_language_s, 0, FAKE_build_setting_name_path_language_s_length); + const f_string_static_t fake_build_setting_name_path_library_script_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_path_library_script_s, 0, FAKE_build_setting_name_path_library_script_s_length); + const f_string_static_t fake_build_setting_name_path_library_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_path_library_shared_s, 0, FAKE_build_setting_name_path_library_shared_s_length); + const f_string_static_t fake_build_setting_name_path_library_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_path_library_static_s, 0, FAKE_build_setting_name_path_library_static_s_length); + const f_string_static_t fake_build_setting_name_path_program_script_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_path_program_script_s, 0, FAKE_build_setting_name_path_program_script_s_length); + const f_string_static_t fake_build_setting_name_path_program_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_path_program_shared_s, 0, FAKE_build_setting_name_path_program_shared_s_length); + const f_string_static_t fake_build_setting_name_path_program_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_path_program_static_s, 0, FAKE_build_setting_name_path_program_static_s_length); + const f_string_static_t fake_build_setting_name_path_sources_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_path_sources_s, 0, FAKE_build_setting_name_path_sources_s_length); + const f_string_static_t fake_build_setting_name_path_standard_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_path_standard_s, 0, FAKE_build_setting_name_path_standard_s_length); + const f_string_static_t fake_build_setting_name_process_post_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_process_post_s, 0, FAKE_build_setting_name_process_post_s_length); + const f_string_static_t fake_build_setting_name_process_pre_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_process_pre_s, 0, FAKE_build_setting_name_process_pre_s_length); + const f_string_static_t fake_build_setting_name_project_name_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_project_name_s, 0, FAKE_build_setting_name_project_name_s_length); + const f_string_static_t fake_build_setting_name_search_exclusive_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_search_exclusive_s, 0, FAKE_build_setting_name_search_exclusive_s_length); + const f_string_static_t fake_build_setting_name_search_shared_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_search_shared_s, 0, FAKE_build_setting_name_search_shared_s_length); + const f_string_static_t fake_build_setting_name_search_static_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_search_static_s, 0, FAKE_build_setting_name_search_static_s_length); + const f_string_static_t fake_build_setting_name_version_file_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_version_file_s, 0, FAKE_build_setting_name_version_file_s_length); + const f_string_static_t fake_build_setting_name_version_major_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_version_major_s, 0, FAKE_build_setting_name_version_major_s_length); + const f_string_static_t fake_build_setting_name_version_major_prefix_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_version_major_prefix_s, 0, FAKE_build_setting_name_version_major_prefix_s_length); + const f_string_static_t fake_build_setting_name_version_micro_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_version_micro_s, 0, FAKE_build_setting_name_version_micro_s_length); + const f_string_static_t fake_build_setting_name_version_micro_prefix_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_version_micro_prefix_s, 0, FAKE_build_setting_name_version_micro_prefix_s_length); + const f_string_static_t fake_build_setting_name_version_minor_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_version_minor_s, 0, FAKE_build_setting_name_version_minor_s_length); + const f_string_static_t fake_build_setting_name_version_minor_prefix_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_version_minor_prefix_s, 0, FAKE_build_setting_name_version_minor_prefix_s_length); + const f_string_static_t fake_build_setting_name_version_nano_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_version_nano_s, 0, FAKE_build_setting_name_version_nano_s_length); + const f_string_static_t fake_build_setting_name_version_nano_prefix_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_version_nano_prefix_s, 0, FAKE_build_setting_name_version_nano_prefix_s_length); + const f_string_static_t fake_build_setting_name_version_target_s = macro_f_string_static_t_initialize2(FAKE_build_setting_name_version_target_s, 0, FAKE_build_setting_name_version_target_s_length); - const f_string_t fake_build_setting_default_version_s = FAKE_build_setting_default_version_s; - const f_string_t fake_build_setting_default_version_prefix_s = FAKE_build_setting_default_version_prefix_s; + const f_string_static_t fake_build_setting_default_version_s = macro_f_string_static_t_initialize2(FAKE_build_setting_default_version_s, 0, FAKE_build_setting_default_version_s_length); + const f_string_static_t fake_build_setting_default_version_prefix_s = macro_f_string_static_t_initialize2(FAKE_build_setting_default_version_prefix_s, 0, FAKE_build_setting_default_version_prefix_s_length); #endif // _di_fake_build_setting_t_ #ifndef _di_fake_build_stage_t_ - const f_string_t fake_build_stage_built_s = FAKE_build_stage_built_s; - const f_string_t fake_build_stage_libraries_script_s = FAKE_build_stage_libraries_script_s; - const f_string_t fake_build_stage_libraries_shared_s = FAKE_build_stage_libraries_shared_s; - const f_string_t fake_build_stage_libraries_static_s = FAKE_build_stage_libraries_static_s; - const f_string_t fake_build_stage_objects_static_s = FAKE_build_stage_objects_static_s; - const f_string_t fake_build_stage_process_post_s = FAKE_build_stage_process_post_s; - const f_string_t fake_build_stage_process_pre_s = FAKE_build_stage_process_pre_s; - const f_string_t fake_build_stage_programs_script_s = FAKE_build_stage_programs_script_s; - const f_string_t fake_build_stage_programs_shared_s = FAKE_build_stage_programs_shared_s; - const f_string_t fake_build_stage_programs_static_s = FAKE_build_stage_programs_static_s; - const f_string_t fake_build_stage_separate_s = FAKE_build_stage_separate_s; - const f_string_t fake_build_stage_skeleton_s = FAKE_build_stage_skeleton_s; - const f_string_t fake_build_stage_sources_headers_s = FAKE_build_stage_sources_headers_s; - const f_string_t fake_build_stage_sources_script_s = FAKE_build_stage_sources_script_s; - const f_string_t fake_build_stage_sources_settings_s = FAKE_build_stage_sources_settings_s; + const f_string_static_t fake_build_stage_built_s = macro_f_string_static_t_initialize2(FAKE_build_stage_built_s, 0, FAKE_build_stage_built_s_length); + const f_string_static_t fake_build_stage_libraries_script_s = macro_f_string_static_t_initialize2(FAKE_build_stage_libraries_script_s, 0, FAKE_build_stage_libraries_script_s_length); + const f_string_static_t fake_build_stage_libraries_shared_s = macro_f_string_static_t_initialize2(FAKE_build_stage_libraries_shared_s, 0, FAKE_build_stage_libraries_shared_s_length); + const f_string_static_t fake_build_stage_libraries_static_s = macro_f_string_static_t_initialize2(FAKE_build_stage_libraries_static_s, 0, FAKE_build_stage_libraries_static_s_length); + const f_string_static_t fake_build_stage_objects_static_s = macro_f_string_static_t_initialize2(FAKE_build_stage_objects_static_s, 0, FAKE_build_stage_objects_static_s_length); + const f_string_static_t fake_build_stage_process_post_s = macro_f_string_static_t_initialize2(FAKE_build_stage_process_post_s, 0, FAKE_build_stage_process_post_s_length); + const f_string_static_t fake_build_stage_process_pre_s = macro_f_string_static_t_initialize2(FAKE_build_stage_process_pre_s, 0, FAKE_build_stage_process_pre_s_length); + const f_string_static_t fake_build_stage_programs_script_s = macro_f_string_static_t_initialize2(FAKE_build_stage_programs_script_s, 0, FAKE_build_stage_programs_script_s_length); + const f_string_static_t fake_build_stage_programs_shared_s = macro_f_string_static_t_initialize2(FAKE_build_stage_programs_shared_s, 0, FAKE_build_stage_programs_shared_s_length); + const f_string_static_t fake_build_stage_programs_static_s = macro_f_string_static_t_initialize2(FAKE_build_stage_programs_static_s, 0, FAKE_build_stage_programs_static_s_length); + const f_string_static_t fake_build_stage_separate_s = macro_f_string_static_t_initialize2(FAKE_build_stage_separate_s, 0, FAKE_build_stage_separate_s_length); + const f_string_static_t fake_build_stage_skeleton_s = macro_f_string_static_t_initialize2(FAKE_build_stage_skeleton_s, 0, FAKE_build_stage_skeleton_s_length); + const f_string_static_t fake_build_stage_sources_headers_s = macro_f_string_static_t_initialize2(FAKE_build_stage_sources_headers_s, 0, FAKE_build_stage_sources_headers_s_length); + const f_string_static_t fake_build_stage_sources_script_s = macro_f_string_static_t_initialize2(FAKE_build_stage_sources_script_s, 0, FAKE_build_stage_sources_script_s_length); + const f_string_static_t fake_build_stage_sources_settings_s = macro_f_string_static_t_initialize2(FAKE_build_stage_sources_settings_s, 0, FAKE_build_stage_sources_settings_s_length); #endif // _di_fake_build_stage_t_ #ifndef _di_fake_build_parameter_ - const f_string_t fake_build_parameter_library_include_s = FAKE_build_parameter_library_include_s; - const f_string_t fake_build_parameter_library_link_file_s = FAKE_build_parameter_library_link_file_s; - const f_string_t fake_build_parameter_library_link_path_s = FAKE_build_parameter_library_link_path_s; - const f_string_t fake_build_parameter_library_name_prefix_s = FAKE_build_parameter_library_name_prefix_s; - const f_string_t fake_build_parameter_library_name_suffix_shared_s = FAKE_build_parameter_library_name_suffix_shared_s; - const f_string_t fake_build_parameter_library_name_suffix_static_s = FAKE_build_parameter_library_name_suffix_static_s; - const f_string_t fake_build_parameter_library_output_s = FAKE_build_parameter_library_output_s; - const f_string_t fake_build_parameter_library_shared_s = FAKE_build_parameter_library_shared_s; - const f_string_t fake_build_parameter_library_static_s = FAKE_build_parameter_library_static_s; - const f_string_t fake_build_parameter_library_shared_prefix_s = FAKE_build_parameter_library_shared_prefix_s; + const f_string_static_t fake_build_parameter_library_include_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_library_include_s, 0, FAKE_build_parameter_library_include_s_length); + const f_string_static_t fake_build_parameter_library_link_file_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_library_link_file_s, 0, FAKE_build_parameter_library_link_file_s_length); + const f_string_static_t fake_build_parameter_library_link_path_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_library_link_path_s, 0, FAKE_build_parameter_library_link_path_s_length); + const f_string_static_t fake_build_parameter_library_name_prefix_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_library_name_prefix_s, 0, FAKE_build_parameter_library_name_prefix_s_length); + const f_string_static_t fake_build_parameter_library_name_suffix_shared_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_library_name_suffix_shared_s, 0, FAKE_build_parameter_library_name_suffix_shared_s_length); + const f_string_static_t fake_build_parameter_library_name_suffix_static_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_library_name_suffix_static_s, 0, FAKE_build_parameter_library_name_suffix_static_s_length); + const f_string_static_t fake_build_parameter_library_output_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_library_output_s, 0, FAKE_build_parameter_library_output_s_length); + const f_string_static_t fake_build_parameter_library_shared_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_library_shared_s, 0, FAKE_build_parameter_library_shared_s_length); + const f_string_static_t fake_build_parameter_library_static_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_library_static_s, 0, FAKE_build_parameter_library_static_s_length); + const f_string_static_t fake_build_parameter_library_shared_prefix_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_library_shared_prefix_s, 0, FAKE_build_parameter_library_shared_prefix_s_length); - const f_string_t fake_build_parameter_object_compile_s = FAKE_build_parameter_object_compile_s; - const f_string_t fake_build_parameter_object_name_suffix_s = FAKE_build_parameter_object_name_suffix_s; - const f_string_t fake_build_parameter_object_output_s = FAKE_build_parameter_object_output_s; - const f_string_t fake_build_parameter_object_static_s = FAKE_build_parameter_object_static_s; + const f_string_static_t fake_build_parameter_object_compile_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_object_compile_s, 0, FAKE_build_parameter_object_compile_s_length); + const f_string_static_t fake_build_parameter_object_name_suffix_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_object_name_suffix_s, 0, FAKE_build_parameter_object_name_suffix_s_length); + const f_string_static_t fake_build_parameter_object_output_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_object_output_s, 0, FAKE_build_parameter_object_output_s_length); + const f_string_static_t fake_build_parameter_object_static_s = macro_f_string_static_t_initialize2(FAKE_build_parameter_object_static_s, 0, FAKE_build_parameter_object_static_s_length); #endif // _di_fake_build_parameter_ #ifndef _di_fake_common_ - const f_string_t fake_common_setting_bool_yes_s = FAKE_common_setting_bool_yes_s; - const f_string_t fake_common_setting_bool_no_s = FAKE_common_setting_bool_no_s; + const f_string_static_t fake_common_setting_bool_yes_s = macro_f_string_static_t_initialize2(FAKE_common_setting_bool_yes_s, 0, FAKE_common_setting_bool_yes_s_length); + const f_string_static_t fake_common_setting_bool_no_s = macro_f_string_static_t_initialize2(FAKE_common_setting_bool_no_s, 0, FAKE_common_setting_bool_no_s_length); + const f_string_static_t fake_common_setting_list_s = macro_f_string_static_t_initialize2(FAKE_common_setting_list_s, 0, FAKE_common_setting_list_s_length); #endif // _di_fake_common_ #ifndef _di_fake_make_section_ - const f_string_t fake_make_section_main_s = FAKE_make_section_main_s; - const f_string_t fake_make_section_settings_s = FAKE_make_section_settings_s; + const f_string_static_t fake_make_section_main_s = macro_f_string_static_t_initialize2(FAKE_make_section_main_s, 0, FAKE_make_section_main_s_length); + const f_string_static_t fake_make_section_settings_s = macro_f_string_static_t_initialize2(FAKE_make_section_settings_s, 0, FAKE_make_section_settings_s_length); #endif // _di_fake_make_section_ #ifndef _di_fake_make_setting_t_ - const f_string_t fake_make_setting_compiler_s = FAKE_make_setting_compiler_s; - const f_string_t fake_make_setting_define_s = FAKE_make_setting_define_s; - const f_string_t fake_make_setting_environment_s = FAKE_make_setting_environment_s; - const f_string_t fake_make_setting_fail_s = FAKE_make_setting_fail_s; - const f_string_t fake_make_setting_indexer_s = FAKE_make_setting_indexer_s; - const f_string_t fake_make_setting_indexer_arguments_s = FAKE_make_setting_indexer_arguments_s; - const f_string_t fake_make_setting_load_build_s = FAKE_make_setting_load_build_s; - const f_string_t fake_make_setting_parameter_s = FAKE_make_setting_parameter_s; - const f_string_t fake_make_setting_return_s = FAKE_make_setting_return_s; + const f_string_static_t fake_make_setting_compiler_s = macro_f_string_static_t_initialize2(FAKE_make_setting_compiler_s, 0, FAKE_make_setting_compiler_s_length); + const f_string_static_t fake_make_setting_define_s = macro_f_string_static_t_initialize2(FAKE_make_setting_define_s, 0, FAKE_make_setting_define_s_length); + const f_string_static_t fake_make_setting_environment_s = macro_f_string_static_t_initialize2(FAKE_make_setting_environment_s, 0, FAKE_make_setting_environment_s_length); + const f_string_static_t fake_make_setting_fail_s = macro_f_string_static_t_initialize2(FAKE_make_setting_fail_s, 0, FAKE_make_setting_fail_s_length); + const f_string_static_t fake_make_setting_indexer_s = macro_f_string_static_t_initialize2(FAKE_make_setting_indexer_s, 0, FAKE_make_setting_indexer_s_length); + const f_string_static_t fake_make_setting_indexer_arguments_s = macro_f_string_static_t_initialize2(FAKE_make_setting_indexer_arguments_s, 0, FAKE_make_setting_indexer_arguments_s_length); + const f_string_static_t fake_make_setting_load_build_s = macro_f_string_static_t_initialize2(FAKE_make_setting_load_build_s, 0, FAKE_make_setting_load_build_s_length); + const f_string_static_t fake_make_setting_parameter_s = macro_f_string_static_t_initialize2(FAKE_make_setting_parameter_s, 0, FAKE_make_setting_parameter_s_length); + const f_string_static_t fake_make_setting_return_s = macro_f_string_static_t_initialize2(FAKE_make_setting_return_s, 0, FAKE_make_setting_return_s_length); #endif // _di_fake_make_setting_t_ #ifndef _di_fake_make_operation_ - const f_string_t fake_make_operation_and_s = FAKE_make_operation_and_s; - const f_string_t fake_make_operation_break_s = FAKE_make_operation_break_s; - const f_string_t fake_make_operation_build_s = FAKE_make_operation_build_s; - const f_string_t fake_make_operation_clean_s = FAKE_make_operation_clean_s; - const f_string_t fake_make_operation_clone_s = FAKE_make_operation_clone_s; - const f_string_t fake_make_operation_compile_s = FAKE_make_operation_compile_s; - const f_string_t fake_make_operation_copy_s = FAKE_make_operation_copy_s; - const f_string_t fake_make_operation_define_s = FAKE_make_operation_define_s; - const f_string_t fake_make_operation_delete_s = FAKE_make_operation_delete_s; - const f_string_t fake_make_operation_deletes_s = FAKE_make_operation_deletes_s; - const f_string_t fake_make_operation_else_s = FAKE_make_operation_else_s; - const f_string_t fake_make_operation_exit_s = FAKE_make_operation_exit_s; - const f_string_t fake_make_operation_fail_s = FAKE_make_operation_fail_s; - const f_string_t fake_make_operation_group_s = FAKE_make_operation_group_s; - const f_string_t fake_make_operation_groups_s = FAKE_make_operation_groups_s; - const f_string_t fake_make_operation_if_s = FAKE_make_operation_if_s; - const f_string_t fake_make_operation_index_s = FAKE_make_operation_index_s; - const f_string_t fake_make_operation_link_s = FAKE_make_operation_link_s; - const f_string_t fake_make_operation_mode_s = FAKE_make_operation_mode_s; - const f_string_t fake_make_operation_modes_s = FAKE_make_operation_modes_s; - const f_string_t fake_make_operation_move_s = FAKE_make_operation_move_s; - const f_string_t fake_make_operation_operate_s = FAKE_make_operation_operate_s; - const f_string_t fake_make_operation_or_s = FAKE_make_operation_or_s; - const f_string_t fake_make_operation_owner_s = FAKE_make_operation_owner_s; - const f_string_t fake_make_operation_owners_s = FAKE_make_operation_owners_s; - const f_string_t fake_make_operation_parameter_s = FAKE_make_operation_parameter_s; - const f_string_t fake_make_operation_pop_s = FAKE_make_operation_pop_s; - const f_string_t fake_make_operation_print_s = FAKE_make_operation_print_s; - const f_string_t fake_make_operation_run_s = FAKE_make_operation_run_s; - const f_string_t fake_make_operation_shell_s = FAKE_make_operation_shell_s; - const f_string_t fake_make_operation_skeleton_s = FAKE_make_operation_skeleton_s; - const f_string_t fake_make_operation_to_s = FAKE_make_operation_to_s; - const f_string_t fake_make_operation_top_s = FAKE_make_operation_top_s; - const f_string_t fake_make_operation_touch_s = FAKE_make_operation_touch_s; + const f_string_static_t fake_make_operation_and_s = macro_f_string_static_t_initialize2(FAKE_make_operation_and_s, 0, FAKE_make_operation_and_s_length); + const f_string_static_t fake_make_operation_break_s = macro_f_string_static_t_initialize2(FAKE_make_operation_break_s, 0, FAKE_make_operation_break_s_length); + const f_string_static_t fake_make_operation_build_s = macro_f_string_static_t_initialize2(FAKE_make_operation_build_s, 0, FAKE_make_operation_build_s_length); + const f_string_static_t fake_make_operation_clean_s = macro_f_string_static_t_initialize2(FAKE_make_operation_clean_s, 0, FAKE_make_operation_clean_s_length); + const f_string_static_t fake_make_operation_clone_s = macro_f_string_static_t_initialize2(FAKE_make_operation_clone_s, 0, FAKE_make_operation_clone_s_length); + const f_string_static_t fake_make_operation_compile_s = macro_f_string_static_t_initialize2(FAKE_make_operation_compile_s, 0, FAKE_make_operation_compile_s_length); + const f_string_static_t fake_make_operation_copy_s = macro_f_string_static_t_initialize2(FAKE_make_operation_copy_s, 0, FAKE_make_operation_copy_s_length); + const f_string_static_t fake_make_operation_define_s = macro_f_string_static_t_initialize2(FAKE_make_operation_define_s, 0, FAKE_make_operation_define_s_length); + const f_string_static_t fake_make_operation_delete_s = macro_f_string_static_t_initialize2(FAKE_make_operation_delete_s, 0, FAKE_make_operation_delete_s_length); + const f_string_static_t fake_make_operation_deletes_s = macro_f_string_static_t_initialize2(FAKE_make_operation_deletes_s, 0, FAKE_make_operation_deletes_s_length); + const f_string_static_t fake_make_operation_else_s = macro_f_string_static_t_initialize2(FAKE_make_operation_else_s, 0, FAKE_make_operation_else_s_length); + const f_string_static_t fake_make_operation_exit_s = macro_f_string_static_t_initialize2(FAKE_make_operation_exit_s, 0, FAKE_make_operation_exit_s_length); + const f_string_static_t fake_make_operation_fail_s = macro_f_string_static_t_initialize2(FAKE_make_operation_fail_s, 0, FAKE_make_operation_fail_s_length); + const f_string_static_t fake_make_operation_group_s = macro_f_string_static_t_initialize2(FAKE_make_operation_group_s, 0, FAKE_make_operation_group_s_length); + const f_string_static_t fake_make_operation_groups_s = macro_f_string_static_t_initialize2(FAKE_make_operation_groups_s, 0, FAKE_make_operation_groups_s_length); + const f_string_static_t fake_make_operation_if_s = macro_f_string_static_t_initialize2(FAKE_make_operation_if_s, 0, FAKE_make_operation_if_s_length); + const f_string_static_t fake_make_operation_index_s = macro_f_string_static_t_initialize2(FAKE_make_operation_index_s, 0, FAKE_make_operation_index_s_length); + const f_string_static_t fake_make_operation_link_s = macro_f_string_static_t_initialize2(FAKE_make_operation_link_s, 0, FAKE_make_operation_link_s_length); + const f_string_static_t fake_make_operation_mode_s = macro_f_string_static_t_initialize2(FAKE_make_operation_mode_s, 0, FAKE_make_operation_mode_s_length); + const f_string_static_t fake_make_operation_modes_s = macro_f_string_static_t_initialize2(FAKE_make_operation_modes_s, 0, FAKE_make_operation_modes_s_length); + const f_string_static_t fake_make_operation_move_s = macro_f_string_static_t_initialize2(FAKE_make_operation_move_s, 0, FAKE_make_operation_move_s_length); + const f_string_static_t fake_make_operation_operate_s = macro_f_string_static_t_initialize2(FAKE_make_operation_operate_s, 0, FAKE_make_operation_operate_s_length); + const f_string_static_t fake_make_operation_or_s = macro_f_string_static_t_initialize2(FAKE_make_operation_or_s, 0, FAKE_make_operation_or_s_length); + const f_string_static_t fake_make_operation_owner_s = macro_f_string_static_t_initialize2(FAKE_make_operation_owner_s, 0, FAKE_make_operation_owner_s_length); + const f_string_static_t fake_make_operation_owners_s = macro_f_string_static_t_initialize2(FAKE_make_operation_owners_s, 0, FAKE_make_operation_owners_s_length); + const f_string_static_t fake_make_operation_parameter_s = macro_f_string_static_t_initialize2(FAKE_make_operation_parameter_s, 0, FAKE_make_operation_parameter_s_length); + const f_string_static_t fake_make_operation_pop_s = macro_f_string_static_t_initialize2(FAKE_make_operation_pop_s, 0, FAKE_make_operation_pop_s_length); + const f_string_static_t fake_make_operation_print_s = macro_f_string_static_t_initialize2(FAKE_make_operation_print_s, 0, FAKE_make_operation_print_s_length); + const f_string_static_t fake_make_operation_run_s = macro_f_string_static_t_initialize2(FAKE_make_operation_run_s, 0, FAKE_make_operation_run_s_length); + const f_string_static_t fake_make_operation_shell_s = macro_f_string_static_t_initialize2(FAKE_make_operation_shell_s, 0, FAKE_make_operation_shell_s_length); + const f_string_static_t fake_make_operation_skeleton_s = macro_f_string_static_t_initialize2(FAKE_make_operation_skeleton_s, 0, FAKE_make_operation_skeleton_s_length); + const f_string_static_t fake_make_operation_to_s = macro_f_string_static_t_initialize2(FAKE_make_operation_to_s, 0, FAKE_make_operation_to_s_length); + const f_string_static_t fake_make_operation_top_s = macro_f_string_static_t_initialize2(FAKE_make_operation_top_s, 0, FAKE_make_operation_top_s_length); + const f_string_static_t fake_make_operation_touch_s = macro_f_string_static_t_initialize2(FAKE_make_operation_touch_s, 0, FAKE_make_operation_touch_s_length); - const f_string_t fake_make_operation_argument_environment_s = FAKE_make_operation_argument_environment_s; - const f_string_t fake_make_operation_argument_failure_s = FAKE_make_operation_argument_failure_s; - const f_string_t fake_make_operation_argument_file_s = FAKE_make_operation_argument_file_s; - const f_string_t fake_make_operation_argument_directory_s = FAKE_make_operation_argument_directory_s; - const f_string_t fake_make_operation_argument_error_s = FAKE_make_operation_argument_error_s; - const f_string_t fake_make_operation_argument_exit_s = FAKE_make_operation_argument_exit_s; - const f_string_t fake_make_operation_argument_has_s = FAKE_make_operation_argument_has_s; - const f_string_t fake_make_operation_argument_ignore_s = FAKE_make_operation_argument_ignore_s; - const f_string_t fake_make_operation_argument_is_s = FAKE_make_operation_argument_is_s; - const f_string_t fake_make_operation_argument_parameter_s = FAKE_make_operation_argument_parameter_s; - const f_string_t fake_make_operation_argument_point_s = FAKE_make_operation_argument_point_s; - const f_string_t fake_make_operation_argument_recursive_s = FAKE_make_operation_argument_recursive_s; - const f_string_t fake_make_operation_argument_success_s = FAKE_make_operation_argument_success_s; - const f_string_t fake_make_operation_argument_target_s = FAKE_make_operation_argument_target_s; - const f_string_t fake_make_operation_argument_warn_s = FAKE_make_operation_argument_warn_s; + const f_string_static_t fake_make_operation_argument_environment_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_environment_s, 0, FAKE_make_operation_argument_environment_s_length); + const f_string_static_t fake_make_operation_argument_failure_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_failure_s, 0, FAKE_make_operation_argument_failure_s_length); + const f_string_static_t fake_make_operation_argument_file_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_file_s, 0, FAKE_make_operation_argument_file_s_length); + const f_string_static_t fake_make_operation_argument_directory_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_directory_s, 0, FAKE_make_operation_argument_directory_s_length); + const f_string_static_t fake_make_operation_argument_error_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_error_s, 0, FAKE_make_operation_argument_error_s_length); + const f_string_static_t fake_make_operation_argument_exit_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_exit_s, 0, FAKE_make_operation_argument_exit_s_length); + const f_string_static_t fake_make_operation_argument_has_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_has_s, 0, FAKE_make_operation_argument_has_s_length); + const f_string_static_t fake_make_operation_argument_ignore_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_ignore_s, 0, FAKE_make_operation_argument_ignore_s_length); + const f_string_static_t fake_make_operation_argument_is_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_is_s, 0, FAKE_make_operation_argument_is_s_length); + const f_string_static_t fake_make_operation_argument_parameter_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_parameter_s, 0, FAKE_make_operation_argument_parameter_s_length); + const f_string_static_t fake_make_operation_argument_point_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_point_s, 0, FAKE_make_operation_argument_point_s_length); + const f_string_static_t fake_make_operation_argument_recursive_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_recursive_s, 0, FAKE_make_operation_argument_recursive_s_length); + const f_string_static_t fake_make_operation_argument_success_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_success_s, 0, FAKE_make_operation_argument_success_s_length); + const f_string_static_t fake_make_operation_argument_target_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_target_s, 0, FAKE_make_operation_argument_target_s_length); + const f_string_static_t fake_make_operation_argument_warn_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_warn_s, 0, FAKE_make_operation_argument_warn_s_length); - const f_string_t fake_make_operation_argument_if_defined_s = FAKE_make_operation_argument_if_defined_s; - const f_string_t fake_make_operation_argument_if_equal_s = FAKE_make_operation_argument_if_equal_s; - const f_string_t fake_make_operation_argument_if_equal_not_s = FAKE_make_operation_argument_if_equal_not_s; - const f_string_t fake_make_operation_argument_if_exists_s = FAKE_make_operation_argument_if_exists_s; - const f_string_t fake_make_operation_argument_if_failure_s = FAKE_make_operation_argument_if_failure_s; - const f_string_t fake_make_operation_argument_if_greater_s = FAKE_make_operation_argument_if_greater_s; - const f_string_t fake_make_operation_argument_if_greater_equal_s = FAKE_make_operation_argument_if_greater_equal_s; - const f_string_t fake_make_operation_argument_if_group_s = FAKE_make_operation_argument_if_group_s; - const f_string_t fake_make_operation_argument_if_is_s = FAKE_make_operation_argument_if_is_s; - const f_string_t fake_make_operation_argument_if_is_for_s = FAKE_make_operation_argument_if_is_for_s; - const f_string_t fake_make_operation_argument_if_less_s = FAKE_make_operation_argument_if_less_s; - const f_string_t fake_make_operation_argument_if_less_equal_s = FAKE_make_operation_argument_if_less_equal_s; - const f_string_t fake_make_operation_argument_if_mode_s = FAKE_make_operation_argument_if_mode_s; - const f_string_t fake_make_operation_argument_if_not_s = FAKE_make_operation_argument_if_not_s; - const f_string_t fake_make_operation_argument_if_owner_s = FAKE_make_operation_argument_if_owner_s; - const f_string_t fake_make_operation_argument_if_success_s = FAKE_make_operation_argument_if_success_s; + const f_string_static_t fake_make_operation_argument_if_defined_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_defined_s, 0, FAKE_make_operation_argument_if_defined_s_length); + const f_string_static_t fake_make_operation_argument_if_equal_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_equal_s, 0, FAKE_make_operation_argument_if_equal_s_length); + const f_string_static_t fake_make_operation_argument_if_equal_not_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_equal_not_s, 0, FAKE_make_operation_argument_if_equal_not_s_length); + const f_string_static_t fake_make_operation_argument_if_exists_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_exists_s, 0, FAKE_make_operation_argument_if_exists_s_length); + const f_string_static_t fake_make_operation_argument_if_failure_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_failure_s, 0, FAKE_make_operation_argument_if_failure_s_length); + const f_string_static_t fake_make_operation_argument_if_greater_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_greater_s, 0, FAKE_make_operation_argument_if_greater_s_length); + const f_string_static_t fake_make_operation_argument_if_greater_equal_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_greater_equal_s, 0, FAKE_make_operation_argument_if_greater_equal_s_length); + const f_string_static_t fake_make_operation_argument_if_group_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_group_s, 0, FAKE_make_operation_argument_if_group_s_length); + const f_string_static_t fake_make_operation_argument_if_is_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_is_s, 0, FAKE_make_operation_argument_if_is_s_length); + const f_string_static_t fake_make_operation_argument_if_is_for_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_is_for_s, 0, FAKE_make_operation_argument_if_is_for_s_length); + const f_string_static_t fake_make_operation_argument_if_less_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_less_s, 0, FAKE_make_operation_argument_if_less_s_length); + const f_string_static_t fake_make_operation_argument_if_less_equal_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_less_equal_s, 0, FAKE_make_operation_argument_if_less_equal_s_length); + const f_string_static_t fake_make_operation_argument_if_mode_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_mode_s, 0, FAKE_make_operation_argument_if_mode_s_length); + const f_string_static_t fake_make_operation_argument_if_not_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_not_s, 0, FAKE_make_operation_argument_if_not_s_length); + const f_string_static_t fake_make_operation_argument_if_owner_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_owner_s, 0, FAKE_make_operation_argument_if_owner_s_length); + const f_string_static_t fake_make_operation_argument_if_success_s = macro_f_string_static_t_initialize2(FAKE_make_operation_argument_if_success_s, 0, FAKE_make_operation_argument_if_success_s_length); #endif // _di_fake_make_operation_ #ifndef _di_fake_make_parameter_t_ - const f_string_t fake_make_parameter_variable_build_s = FAKE_make_parameter_variable_build_s; - const f_string_t fake_make_parameter_variable_color_s = FAKE_make_parameter_variable_color_s; - const f_string_t fake_make_parameter_variable_data_s = FAKE_make_parameter_variable_data_s; - const f_string_t fake_make_parameter_variable_define_s = FAKE_make_parameter_variable_define_s; - const f_string_t fake_make_parameter_variable_fakefile_s = FAKE_make_parameter_variable_fakefile_s; - const f_string_t fake_make_parameter_variable_mode_s = FAKE_make_parameter_variable_mode_s; - const f_string_t fake_make_parameter_variable_process_s = FAKE_make_parameter_variable_process_s; - const f_string_t fake_make_parameter_variable_return_s = FAKE_make_parameter_variable_return_s; - const f_string_t fake_make_parameter_variable_settings_s = FAKE_make_parameter_variable_settings_s; - const f_string_t fake_make_parameter_variable_sources_s = FAKE_make_parameter_variable_sources_s; - const f_string_t fake_make_parameter_variable_verbosity_s = FAKE_make_parameter_variable_verbosity_s; - const f_string_t fake_make_parameter_variable_work_s = FAKE_make_parameter_variable_work_s; + const f_string_static_t fake_make_parameter_iki_option_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_iki_option_s, 0, FAKE_make_parameter_iki_option_s_length); + const f_string_static_t fake_make_parameter_iki_value_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_iki_value_s, 0, FAKE_make_parameter_iki_value_s_length); - const f_string_t fake_make_parameter_variable_option_build_s = FAKE_make_parameter_variable_build_s fake_make_parameter_iki_option_s; - const f_string_t fake_make_parameter_variable_option_color_s = FAKE_make_parameter_variable_color_s fake_make_parameter_iki_option_s; - const f_string_t fake_make_parameter_variable_option_data_s = FAKE_make_parameter_variable_data_s fake_make_parameter_iki_option_s; - const f_string_t fake_make_parameter_variable_option_define_s = FAKE_make_parameter_variable_define_s fake_make_parameter_iki_option_s; - const f_string_t fake_make_parameter_variable_option_fakefile_s = FAKE_make_parameter_variable_fakefile_s fake_make_parameter_iki_option_s; - const f_string_t fake_make_parameter_variable_option_mode_s = FAKE_make_parameter_variable_mode_s fake_make_parameter_iki_option_s; - const f_string_t fake_make_parameter_variable_option_process_s = FAKE_make_parameter_variable_process_s fake_make_parameter_iki_option_s; - const f_string_t fake_make_parameter_variable_option_return_s = FAKE_make_parameter_variable_return_s fake_make_parameter_iki_option_s; - const f_string_t fake_make_parameter_variable_option_settings_s = FAKE_make_parameter_variable_settings_s fake_make_parameter_iki_option_s; - const f_string_t fake_make_parameter_variable_option_sources_s = FAKE_make_parameter_variable_sources_s fake_make_parameter_iki_option_s; - const f_string_t fake_make_parameter_variable_option_verbosity_s = FAKE_make_parameter_variable_verbosity_s fake_make_parameter_iki_option_s; - const f_string_t fake_make_parameter_variable_option_work_s = FAKE_make_parameter_variable_work_s fake_make_parameter_iki_option_s; + const f_string_static_t fake_make_parameter_variable_build_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_build_s, 0, FAKE_make_parameter_variable_build_s_length); + const f_string_static_t fake_make_parameter_variable_color_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_color_s, 0, FAKE_make_parameter_variable_color_s_length); + const f_string_static_t fake_make_parameter_variable_data_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_data_s, 0, FAKE_make_parameter_variable_data_s_length); + const f_string_static_t fake_make_parameter_variable_define_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_define_s, 0, FAKE_make_parameter_variable_define_s_length); + const f_string_static_t fake_make_parameter_variable_fakefile_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_fakefile_s, 0, FAKE_make_parameter_variable_fakefile_s_length); + const f_string_static_t fake_make_parameter_variable_mode_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_mode_s, 0, FAKE_make_parameter_variable_mode_s_length); + const f_string_static_t fake_make_parameter_variable_process_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_process_s, 0, FAKE_make_parameter_variable_process_s_length); + const f_string_static_t fake_make_parameter_variable_return_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_return_s, 0, FAKE_make_parameter_variable_return_s_length); + const f_string_static_t fake_make_parameter_variable_settings_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_settings_s, 0, FAKE_make_parameter_variable_settings_s_length); + const f_string_static_t fake_make_parameter_variable_sources_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_sources_s, 0, FAKE_make_parameter_variable_sources_s_length); + const f_string_static_t fake_make_parameter_variable_verbosity_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_verbosity_s, 0, FAKE_make_parameter_variable_verbosity_s_length); + const f_string_static_t fake_make_parameter_variable_work_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_work_s, 0, FAKE_make_parameter_variable_work_s_length); - const f_string_t fake_make_parameter_variable_value_build_s = FAKE_make_parameter_variable_build_s fake_make_parameter_iki_value_s; - const f_string_t fake_make_parameter_variable_value_color_s = FAKE_make_parameter_variable_color_s fake_make_parameter_iki_value_s; - const f_string_t fake_make_parameter_variable_value_data_s = FAKE_make_parameter_variable_data_s fake_make_parameter_iki_value_s; - const f_string_t fake_make_parameter_variable_value_define_s = FAKE_make_parameter_variable_define_s fake_make_parameter_iki_value_s; - const f_string_t fake_make_parameter_variable_value_fakefile_s = FAKE_make_parameter_variable_fakefile_s fake_make_parameter_iki_value_s; - const f_string_t fake_make_parameter_variable_value_mode_s = FAKE_make_parameter_variable_mode_s fake_make_parameter_iki_value_s; - const f_string_t fake_make_parameter_variable_value_process_s = FAKE_make_parameter_variable_process_s fake_make_parameter_iki_value_s; - const f_string_t fake_make_parameter_variable_value_return_s = FAKE_make_parameter_variable_return_s fake_make_parameter_iki_value_s; - const f_string_t fake_make_parameter_variable_value_settings_s = FAKE_make_parameter_variable_settings_s fake_make_parameter_iki_value_s; - const f_string_t fake_make_parameter_variable_value_sources_s = FAKE_make_parameter_variable_sources_s fake_make_parameter_iki_value_s; - const f_string_t fake_make_parameter_variable_value_verbosity_s = FAKE_make_parameter_variable_verbosity_s fake_make_parameter_iki_value_s; - const f_string_t fake_make_parameter_variable_value_work_s = FAKE_make_parameter_variable_work_s fake_make_parameter_iki_value_s; + const f_string_static_t fake_make_parameter_variable_option_build_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_build_s, 0, FAKE_make_parameter_variable_build_s_length); + const f_string_static_t fake_make_parameter_variable_option_color_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_option_color_s, 0, FAKE_make_parameter_variable_option_color_s_length); + const f_string_static_t fake_make_parameter_variable_option_data_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_option_data_s, 0, FAKE_make_parameter_variable_option_data_s_length); + const f_string_static_t fake_make_parameter_variable_option_define_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_option_define_s, 0, FAKE_make_parameter_variable_option_define_s_length); + const f_string_static_t fake_make_parameter_variable_option_fakefile_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_option_fakefile_s, 0, FAKE_make_parameter_variable_option_fakefile_s_length); + const f_string_static_t fake_make_parameter_variable_option_mode_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_option_mode_s, 0, FAKE_make_parameter_variable_option_mode_s_length); + const f_string_static_t fake_make_parameter_variable_option_process_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_option_process_s, 0, FAKE_make_parameter_variable_option_process_s_length); + const f_string_static_t fake_make_parameter_variable_option_return_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_option_return_s, 0, FAKE_make_parameter_variable_option_return_s_length); + const f_string_static_t fake_make_parameter_variable_option_settings_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_option_settings_s, 0, FAKE_make_parameter_variable_option_settings_s_length); + const f_string_static_t fake_make_parameter_variable_option_sources_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_option_sources_s, 0, FAKE_make_parameter_variable_option_sources_s_length); + const f_string_static_t fake_make_parameter_variable_option_verbosity_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_option_verbosity_s, 0, FAKE_make_parameter_variable_option_verbosity_s_length); + const f_string_static_t fake_make_parameter_variable_option_work_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_option_work_s, 0, FAKE_make_parameter_variable_option_work_s_length); + + const f_string_static_t fake_make_parameter_variable_value_build_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_build_s, 0, FAKE_make_parameter_variable_value_build_s_length); + const f_string_static_t fake_make_parameter_variable_value_color_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_color_s, 0, FAKE_make_parameter_variable_value_color_s_length); + const f_string_static_t fake_make_parameter_variable_value_data_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_data_s, 0, FAKE_make_parameter_variable_value_data_s_length); + const f_string_static_t fake_make_parameter_variable_value_define_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_define_s, 0, FAKE_make_parameter_variable_value_define_s_length); + const f_string_static_t fake_make_parameter_variable_value_fakefile_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_fakefile_s, 0, FAKE_make_parameter_variable_value_fakefile_s_length); + const f_string_static_t fake_make_parameter_variable_value_mode_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_mode_s, 0, FAKE_make_parameter_variable_value_mode_s_length); + const f_string_static_t fake_make_parameter_variable_value_process_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_process_s, 0, FAKE_make_parameter_variable_value_process_s_length); + const f_string_static_t fake_make_parameter_variable_value_return_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_return_s, 0, FAKE_make_parameter_variable_value_return_s_length); + const f_string_static_t fake_make_parameter_variable_value_settings_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_settings_s, 0, FAKE_make_parameter_variable_value_settings_s_length); + const f_string_static_t fake_make_parameter_variable_value_sources_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_sources_s, 0, FAKE_make_parameter_variable_value_sources_s_length); + const f_string_static_t fake_make_parameter_variable_value_verbosity_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_verbosity_s, 0, FAKE_make_parameter_variable_value_verbosity_s_length); + const f_string_static_t fake_make_parameter_variable_value_work_s = macro_f_string_static_t_initialize2(FAKE_make_parameter_variable_value_work_s, 0, FAKE_make_parameter_variable_value_work_s_length); #endif // _di_fake_make_parameter_t_ #ifndef _di_fake_skeleton_content_ - const f_string_t fake_make_skeleton_content_defines_s = FAKE_make_skeleton_content_defines_s; - const f_string_t fake_make_skeleton_content_dependencies_s = FAKE_make_skeleton_content_dependencies_s; - const f_string_t fake_make_skeleton_content_fakefile_s = FAKE_make_skeleton_content_fakefile_s; - const f_string_t fake_make_skeleton_content_settings_s = FAKE_make_skeleton_content_settings_s; + const f_string_static_t fake_make_skeleton_content_defines_s = macro_f_string_static_t_initialize2(FAKE_make_skeleton_content_defines_s, 0, FAKE_make_skeleton_content_defines_s_length); + const f_string_static_t fake_make_skeleton_content_dependencies_s = macro_f_string_static_t_initialize2(FAKE_make_skeleton_content_dependencies_s, 0, FAKE_make_skeleton_content_dependencies_s_length); + const f_string_static_t fake_make_skeleton_content_fakefile_s = macro_f_string_static_t_initialize2(FAKE_make_skeleton_content_fakefile_s, 0, FAKE_make_skeleton_content_fakefile_s_length); + const f_string_static_t fake_make_skeleton_content_process_post_s = macro_f_string_static_t_initialize2(FAKE_make_skeleton_content_process_post_s, 0, FAKE_make_skeleton_content_process_post_s_length); + const f_string_static_t fake_make_skeleton_content_process_pre_s = macro_f_string_static_t_initialize2(FAKE_make_skeleton_content_process_pre_s, 0, FAKE_make_skeleton_content_process_pre_s_length); + const f_string_static_t fake_make_skeleton_content_settings_s = macro_f_string_static_t_initialize2(FAKE_make_skeleton_content_settings_s, 0, FAKE_make_skeleton_content_settings_s_length); #endif // _di_fake_skeleton_content_ #ifndef _di_fake_make_context_ - const f_string_t fake_make_context_reset_s = FAKE_make_context_reset_s; - const f_string_t fake_make_context_warning_s = FAKE_make_context_warning_s; - const f_string_t fake_make_context_error_s = FAKE_make_context_error_s; - const f_string_t fake_make_context_title_s = FAKE_make_context_title_s; - const f_string_t fake_make_context_notable_s = FAKE_make_context_notable_s; - const f_string_t fake_make_context_important_s = FAKE_make_context_important_s; - const f_string_t fake_make_context_standout_s = FAKE_make_context_standout_s; - const f_string_t fake_make_context_success_s = FAKE_make_context_success_s; - const f_string_t fake_make_context_normal_s = FAKE_make_context_normal_s; + const f_string_static_t fake_make_context_reset_s = macro_f_string_static_t_initialize2(FAKE_make_context_reset_s, 0, FAKE_make_context_reset_s_length); + const f_string_static_t fake_make_context_warning_s = macro_f_string_static_t_initialize2(FAKE_make_context_warning_s, 0, FAKE_make_context_warning_s_length); + const f_string_static_t fake_make_context_error_s = macro_f_string_static_t_initialize2(FAKE_make_context_error_s, 0, FAKE_make_context_error_s_length); + const f_string_static_t fake_make_context_title_s = macro_f_string_static_t_initialize2(FAKE_make_context_title_s, 0, FAKE_make_context_title_s_length); + const f_string_static_t fake_make_context_notable_s = macro_f_string_static_t_initialize2(FAKE_make_context_notable_s, 0, FAKE_make_context_notable_s_length); + const f_string_static_t fake_make_context_important_s = macro_f_string_static_t_initialize2(FAKE_make_context_important_s, 0, FAKE_make_context_important_s_length); + const f_string_static_t fake_make_context_standout_s = macro_f_string_static_t_initialize2(FAKE_make_context_standout_s, 0, FAKE_make_context_standout_s_length); + const f_string_static_t fake_make_context_success_s = macro_f_string_static_t_initialize2(FAKE_make_context_success_s, 0, FAKE_make_context_success_s_length); + const f_string_static_t fake_make_context_normal_s = macro_f_string_static_t_initialize2(FAKE_make_context_normal_s, 0, FAKE_make_context_normal_s_length); #endif // _di_fake_make_context_ +#ifndef _di_fake_file_data_build_strings_ + const f_string_static_t fake_file_data_build_process_post_s = macro_f_string_static_t_initialize2(FAKE_file_data_build_process_post_s, 0, FAKE_file_data_build_process_post_s_length); + const f_string_static_t fake_file_data_build_process_pre_s = macro_f_string_static_t_initialize2(FAKE_file_data_build_process_pre_s, 0, FAKE_file_data_build_process_pre_s_length); +#endif // _di_fake_file_data_build_strings_ + #ifndef _di_fake_signal_received_ f_status_t fake_signal_received(fake_main_t * const main) { diff --git a/level_3/fake/c/private-common.h b/level_3/fake/c/private-common.h index 354925a..00d6015 100644 --- a/level_3/fake/c/private-common.h +++ b/level_3/fake/c/private-common.h @@ -293,156 +293,156 @@ extern "C" { #define FAKE_build_setting_name_version_nano_prefix_s "version_nano_prefix" #define FAKE_build_setting_name_version_target_s "version_target" - #define fake_build_setting_name_build_compiler_s_length 14 - #define fake_build_setting_name_build_language_s_length 14 - #define fake_build_setting_name_build_libraries_s_length 15 - #define fake_build_setting_name_build_libraries_shared_s_length 22 - #define fake_build_setting_name_build_libraries_static_s_length 22 - #define fake_build_setting_name_build_indexer_s_length 13 - #define fake_build_setting_name_build_indexer_arguments_s_length 23 - #define fake_build_setting_name_build_script_s_length 12 - #define fake_build_setting_name_build_shared_s_length 12 - #define fake_build_setting_name_build_sources_headers_s_length 21 - #define fake_build_setting_name_build_sources_headers_shared_s_length 28 - #define fake_build_setting_name_build_sources_headers_static_s_length 28 - #define fake_build_setting_name_build_sources_library_s_length 21 - #define fake_build_setting_name_build_sources_library_shared_s_length 28 - #define fake_build_setting_name_build_sources_library_static_s_length 28 - #define fake_build_setting_name_build_sources_program_s_length 21 - #define fake_build_setting_name_build_sources_program_shared_s_length 28 - #define fake_build_setting_name_build_sources_program_static_s_length 28 - #define fake_build_setting_name_build_sources_script_s_length 20 - #define fake_build_setting_name_build_sources_settings_s_length 22 - #define fake_build_setting_name_build_static_s_length 12 - #define fake_build_setting_name_environment_length_s 11 - #define fake_build_setting_name_defines_s_length 7 - #define fake_build_setting_name_defines_library_s_length 15 - #define fake_build_setting_name_defines_library_shared_s_length 22 - #define fake_build_setting_name_defines_library_static_s_length 22 - #define fake_build_setting_name_defines_program_s_length 15 - #define fake_build_setting_name_defines_program_shared_s_length 22 - #define fake_build_setting_name_defines_program_static_s_length 22 - #define fake_build_setting_name_defines_shared_s_length 14 - #define fake_build_setting_name_defines_static_s_length 14 - #define fake_build_setting_name_flags_s_length 5 - #define fake_build_setting_name_flags_library_s_length 13 - #define fake_build_setting_name_flags_library_shared_s_length 20 - #define fake_build_setting_name_flags_library_static_s_length 20 - #define fake_build_setting_name_flags_program_s_length 13 - #define fake_build_setting_name_flags_program_shared_s_length 20 - #define fake_build_setting_name_flags_program_static_s_length 20 - #define fake_build_setting_name_flags_shared_s_length 12 - #define fake_build_setting_name_flags_static_s_length 12 - #define fake_build_setting_name_modes_s_length 5 - #define fake_build_setting_name_modes_default_s_length 13 - #define fake_build_setting_name_path_headers_s_length 12 - #define fake_build_setting_name_path_headers_preserve_s_length 21 - #define fake_build_setting_name_path_language_s_length 13 - #define fake_build_setting_name_path_library_script_s_length 19 - #define fake_build_setting_name_path_library_shared_s_length 19 - #define fake_build_setting_name_path_library_static_s_length 19 - #define fake_build_setting_name_path_program_script_s_length 19 - #define fake_build_setting_name_path_program_shared_s_length 19 - #define fake_build_setting_name_path_program_static_s_length 19 - #define fake_build_setting_name_path_sources_s_length 12 - #define fake_build_setting_name_path_standard_s_length 13 - #define fake_build_setting_name_process_post_s_length 12 - #define fake_build_setting_name_process_pre_s_length 11 - #define fake_build_setting_name_project_name_s_length 12 - #define fake_build_setting_name_search_exclusive_s_length 16 - #define fake_build_setting_name_search_shared_s_length 13 - #define fake_build_setting_name_search_static_s_length 13 - #define fake_build_setting_name_version_file_s_length 12 - #define fake_build_setting_name_version_major_s_length 13 - #define fake_build_setting_name_version_major_prefix_s_length 20 - #define fake_build_setting_name_version_micro_s_length 13 - #define fake_build_setting_name_version_micro_prefix_s_length 20 - #define fake_build_setting_name_version_minor_s_length 13 - #define fake_build_setting_name_version_minor_prefix_s_length 20 - #define fake_build_setting_name_version_nano_s_length 12 - #define fake_build_setting_name_version_nano_prefix_s_length 19 - #define fake_build_setting_name_version_target_s_length 14 - - extern const f_string_t fake_build_setting_name_build_compiler_s; - extern const f_string_t fake_build_setting_name_build_language_s; - extern const f_string_t fake_build_setting_name_build_libraries_s; - extern const f_string_t fake_build_setting_name_build_libraries_shared_s; - extern const f_string_t fake_build_setting_name_build_libraries_static_s; - extern const f_string_t fake_build_setting_name_build_indexer_s; - extern const f_string_t fake_build_setting_name_build_indexer_arguments_s; - extern const f_string_t fake_build_setting_name_build_script_s; - extern const f_string_t fake_build_setting_name_build_shared_s; - extern const f_string_t fake_build_setting_name_build_sources_headers_s; - extern const f_string_t fake_build_setting_name_build_sources_headers_shared_s; - extern const f_string_t fake_build_setting_name_build_sources_headers_static_s; - extern const f_string_t fake_build_setting_name_build_sources_library_s; - extern const f_string_t fake_build_setting_name_build_sources_library_shared_s; - extern const f_string_t fake_build_setting_name_build_sources_library_static_s; - extern const f_string_t fake_build_setting_name_build_sources_program_s; - extern const f_string_t fake_build_setting_name_build_sources_program_shared_s; - extern const f_string_t fake_build_setting_name_build_sources_program_static_s; - extern const f_string_t fake_build_setting_name_build_sources_script_s; - extern const f_string_t fake_build_setting_name_build_sources_settings_s; - extern const f_string_t fake_build_setting_name_build_static_s; - extern const f_string_t fake_build_setting_name_defines_s; - extern const f_string_t fake_build_setting_name_defines_library_s; - extern const f_string_t fake_build_setting_name_defines_library_shared_s; - extern const f_string_t fake_build_setting_name_defines_library_static_s; - extern const f_string_t fake_build_setting_name_defines_program_s; - extern const f_string_t fake_build_setting_name_defines_program_shared_s; - extern const f_string_t fake_build_setting_name_defines_program_static_s; - extern const f_string_t fake_build_setting_name_defines_shared_s; - extern const f_string_t fake_build_setting_name_defines_static_s; - extern const f_string_t fake_build_setting_name_environment_s; - extern const f_string_t fake_build_setting_name_flags_s; - extern const f_string_t fake_build_setting_name_flags_library_s; - extern const f_string_t fake_build_setting_name_flags_library_shared_s; - extern const f_string_t fake_build_setting_name_flags_library_static_s; - extern const f_string_t fake_build_setting_name_flags_program_s; - extern const f_string_t fake_build_setting_name_flags_program_shared_s; - extern const f_string_t fake_build_setting_name_flags_program_static_s; - extern const f_string_t fake_build_setting_name_flags_shared_s; - extern const f_string_t fake_build_setting_name_flags_static_s; - extern const f_string_t fake_build_setting_name_modes_s; - extern const f_string_t fake_build_setting_name_modes_default_s; - extern const f_string_t fake_build_setting_name_path_headers_s; - extern const f_string_t fake_build_setting_name_path_headers_preserve_s; - extern const f_string_t fake_build_setting_name_path_language_s; - extern const f_string_t fake_build_setting_name_path_library_script_s; - extern const f_string_t fake_build_setting_name_path_library_shared_s; - extern const f_string_t fake_build_setting_name_path_library_static_s; - extern const f_string_t fake_build_setting_name_path_program_script_s; - extern const f_string_t fake_build_setting_name_path_program_shared_s; - extern const f_string_t fake_build_setting_name_path_program_static_s; - extern const f_string_t fake_build_setting_name_path_sources_s; - extern const f_string_t fake_build_setting_name_path_standard_s; - extern const f_string_t fake_build_setting_name_process_post_s; - extern const f_string_t fake_build_setting_name_process_pre_s; - extern const f_string_t fake_build_setting_name_project_name_s; - extern const f_string_t fake_build_setting_name_search_exclusive_s; - extern const f_string_t fake_build_setting_name_search_shared_s; - extern const f_string_t fake_build_setting_name_search_static_s; - extern const f_string_t fake_build_setting_name_version_file_s; - extern const f_string_t fake_build_setting_name_version_major_s; - extern const f_string_t fake_build_setting_name_version_major_prefix_s; - extern const f_string_t fake_build_setting_name_version_micro_s; - extern const f_string_t fake_build_setting_name_version_micro_prefix_s; - extern const f_string_t fake_build_setting_name_version_minor_s; - extern const f_string_t fake_build_setting_name_version_minor_prefix_s; - extern const f_string_t fake_build_setting_name_version_nano_s; - extern const f_string_t fake_build_setting_name_version_nano_prefix_s; - extern const f_string_t fake_build_setting_name_version_target_s; + #define FAKE_build_setting_name_build_compiler_s_length 14 + #define FAKE_build_setting_name_build_language_s_length 14 + #define FAKE_build_setting_name_build_libraries_s_length 15 + #define FAKE_build_setting_name_build_libraries_shared_s_length 22 + #define FAKE_build_setting_name_build_libraries_static_s_length 22 + #define FAKE_build_setting_name_build_indexer_s_length 13 + #define FAKE_build_setting_name_build_indexer_arguments_s_length 23 + #define FAKE_build_setting_name_build_script_s_length 12 + #define FAKE_build_setting_name_build_shared_s_length 12 + #define FAKE_build_setting_name_build_sources_headers_s_length 21 + #define FAKE_build_setting_name_build_sources_headers_shared_s_length 28 + #define FAKE_build_setting_name_build_sources_headers_static_s_length 28 + #define FAKE_build_setting_name_build_sources_library_s_length 21 + #define FAKE_build_setting_name_build_sources_library_shared_s_length 28 + #define FAKE_build_setting_name_build_sources_library_static_s_length 28 + #define FAKE_build_setting_name_build_sources_program_s_length 21 + #define FAKE_build_setting_name_build_sources_program_shared_s_length 28 + #define FAKE_build_setting_name_build_sources_program_static_s_length 28 + #define FAKE_build_setting_name_build_sources_script_s_length 20 + #define FAKE_build_setting_name_build_sources_settings_s_length 22 + #define FAKE_build_setting_name_build_static_s_length 12 + #define FAKE_build_setting_name_environment_length_s 11 + #define FAKE_build_setting_name_defines_s_length 7 + #define FAKE_build_setting_name_defines_library_s_length 15 + #define FAKE_build_setting_name_defines_library_shared_s_length 22 + #define FAKE_build_setting_name_defines_library_static_s_length 22 + #define FAKE_build_setting_name_defines_program_s_length 15 + #define FAKE_build_setting_name_defines_program_shared_s_length 22 + #define FAKE_build_setting_name_defines_program_static_s_length 22 + #define FAKE_build_setting_name_defines_shared_s_length 14 + #define FAKE_build_setting_name_defines_static_s_length 14 + #define FAKE_build_setting_name_flags_s_length 5 + #define FAKE_build_setting_name_flags_library_s_length 13 + #define FAKE_build_setting_name_flags_library_shared_s_length 20 + #define FAKE_build_setting_name_flags_library_static_s_length 20 + #define FAKE_build_setting_name_flags_program_s_length 13 + #define FAKE_build_setting_name_flags_program_shared_s_length 20 + #define FAKE_build_setting_name_flags_program_static_s_length 20 + #define FAKE_build_setting_name_flags_shared_s_length 12 + #define FAKE_build_setting_name_flags_static_s_length 12 + #define FAKE_build_setting_name_modes_s_length 5 + #define FAKE_build_setting_name_modes_default_s_length 13 + #define FAKE_build_setting_name_path_headers_s_length 12 + #define FAKE_build_setting_name_path_headers_preserve_s_length 21 + #define FAKE_build_setting_name_path_language_s_length 13 + #define FAKE_build_setting_name_path_library_script_s_length 19 + #define FAKE_build_setting_name_path_library_shared_s_length 19 + #define FAKE_build_setting_name_path_library_static_s_length 19 + #define FAKE_build_setting_name_path_program_script_s_length 19 + #define FAKE_build_setting_name_path_program_shared_s_length 19 + #define FAKE_build_setting_name_path_program_static_s_length 19 + #define FAKE_build_setting_name_path_sources_s_length 12 + #define FAKE_build_setting_name_path_standard_s_length 13 + #define FAKE_build_setting_name_process_post_s_length 12 + #define FAKE_build_setting_name_process_pre_s_length 11 + #define FAKE_build_setting_name_project_name_s_length 12 + #define FAKE_build_setting_name_search_exclusive_s_length 16 + #define FAKE_build_setting_name_search_shared_s_length 13 + #define FAKE_build_setting_name_search_static_s_length 13 + #define FAKE_build_setting_name_version_file_s_length 12 + #define FAKE_build_setting_name_version_major_s_length 13 + #define FAKE_build_setting_name_version_major_prefix_s_length 20 + #define FAKE_build_setting_name_version_micro_s_length 13 + #define FAKE_build_setting_name_version_micro_prefix_s_length 20 + #define FAKE_build_setting_name_version_minor_s_length 13 + #define FAKE_build_setting_name_version_minor_prefix_s_length 20 + #define FAKE_build_setting_name_version_nano_s_length 12 + #define FAKE_build_setting_name_version_nano_prefix_s_length 19 + #define FAKE_build_setting_name_version_target_s_length 14 + + extern const f_string_static_t fake_build_setting_name_build_compiler_s; + extern const f_string_static_t fake_build_setting_name_build_language_s; + extern const f_string_static_t fake_build_setting_name_build_libraries_s; + extern const f_string_static_t fake_build_setting_name_build_libraries_shared_s; + extern const f_string_static_t fake_build_setting_name_build_libraries_static_s; + extern const f_string_static_t fake_build_setting_name_build_indexer_s; + extern const f_string_static_t fake_build_setting_name_build_indexer_arguments_s; + extern const f_string_static_t fake_build_setting_name_build_script_s; + extern const f_string_static_t fake_build_setting_name_build_shared_s; + extern const f_string_static_t fake_build_setting_name_build_sources_headers_s; + extern const f_string_static_t fake_build_setting_name_build_sources_headers_shared_s; + extern const f_string_static_t fake_build_setting_name_build_sources_headers_static_s; + extern const f_string_static_t fake_build_setting_name_build_sources_library_s; + extern const f_string_static_t fake_build_setting_name_build_sources_library_shared_s; + extern const f_string_static_t fake_build_setting_name_build_sources_library_static_s; + extern const f_string_static_t fake_build_setting_name_build_sources_program_s; + extern const f_string_static_t fake_build_setting_name_build_sources_program_shared_s; + extern const f_string_static_t fake_build_setting_name_build_sources_program_static_s; + extern const f_string_static_t fake_build_setting_name_build_sources_script_s; + extern const f_string_static_t fake_build_setting_name_build_sources_settings_s; + extern const f_string_static_t fake_build_setting_name_build_static_s; + extern const f_string_static_t fake_build_setting_name_defines_s; + extern const f_string_static_t fake_build_setting_name_defines_library_s; + extern const f_string_static_t fake_build_setting_name_defines_library_shared_s; + extern const f_string_static_t fake_build_setting_name_defines_library_static_s; + extern const f_string_static_t fake_build_setting_name_defines_program_s; + extern const f_string_static_t fake_build_setting_name_defines_program_shared_s; + extern const f_string_static_t fake_build_setting_name_defines_program_static_s; + extern const f_string_static_t fake_build_setting_name_defines_shared_s; + extern const f_string_static_t fake_build_setting_name_defines_static_s; + extern const f_string_static_t fake_build_setting_name_environment_s; + extern const f_string_static_t fake_build_setting_name_flags_s; + extern const f_string_static_t fake_build_setting_name_flags_library_s; + extern const f_string_static_t fake_build_setting_name_flags_library_shared_s; + extern const f_string_static_t fake_build_setting_name_flags_library_static_s; + extern const f_string_static_t fake_build_setting_name_flags_program_s; + extern const f_string_static_t fake_build_setting_name_flags_program_shared_s; + extern const f_string_static_t fake_build_setting_name_flags_program_static_s; + extern const f_string_static_t fake_build_setting_name_flags_shared_s; + extern const f_string_static_t fake_build_setting_name_flags_static_s; + extern const f_string_static_t fake_build_setting_name_modes_s; + extern const f_string_static_t fake_build_setting_name_modes_default_s; + extern const f_string_static_t fake_build_setting_name_path_headers_s; + extern const f_string_static_t fake_build_setting_name_path_headers_preserve_s; + extern const f_string_static_t fake_build_setting_name_path_language_s; + extern const f_string_static_t fake_build_setting_name_path_library_script_s; + extern const f_string_static_t fake_build_setting_name_path_library_shared_s; + extern const f_string_static_t fake_build_setting_name_path_library_static_s; + extern const f_string_static_t fake_build_setting_name_path_program_script_s; + extern const f_string_static_t fake_build_setting_name_path_program_shared_s; + extern const f_string_static_t fake_build_setting_name_path_program_static_s; + extern const f_string_static_t fake_build_setting_name_path_sources_s; + extern const f_string_static_t fake_build_setting_name_path_standard_s; + extern const f_string_static_t fake_build_setting_name_process_post_s; + extern const f_string_static_t fake_build_setting_name_process_pre_s; + extern const f_string_static_t fake_build_setting_name_project_name_s; + extern const f_string_static_t fake_build_setting_name_search_exclusive_s; + extern const f_string_static_t fake_build_setting_name_search_shared_s; + extern const f_string_static_t fake_build_setting_name_search_static_s; + extern const f_string_static_t fake_build_setting_name_version_file_s; + extern const f_string_static_t fake_build_setting_name_version_major_s; + extern const f_string_static_t fake_build_setting_name_version_major_prefix_s; + extern const f_string_static_t fake_build_setting_name_version_micro_s; + extern const f_string_static_t fake_build_setting_name_version_micro_prefix_s; + extern const f_string_static_t fake_build_setting_name_version_minor_s; + extern const f_string_static_t fake_build_setting_name_version_minor_prefix_s; + extern const f_string_static_t fake_build_setting_name_version_nano_s; + extern const f_string_static_t fake_build_setting_name_version_nano_prefix_s; + extern const f_string_static_t fake_build_setting_name_version_target_s; #define fake_build_setting_total_d 69 #define FAKE_build_setting_default_version_s "0" #define FAKE_build_setting_default_version_prefix_s "." - #define fake_build_setting_default_version_s_length 1 - #define fake_build_setting_default_version_prefix_s_length 1 + #define FAKE_build_setting_default_version_s_length 1 + #define FAKE_build_setting_default_version_prefix_s_length 1 - extern const f_string_t fake_build_setting_default_version_s; - extern const f_string_t fake_build_setting_default_version_prefix_s; + extern const f_string_static_t fake_build_setting_default_version_s; + extern const f_string_static_t fake_build_setting_default_version_prefix_s; #endif // _di_fake_build_setting_t_ #ifndef _di_fake_build_stage_t_ @@ -511,37 +511,37 @@ extern "C" { #define FAKE_build_stage_sources_script_s "sources_script" #define FAKE_build_stage_sources_settings_s "sources_settings" - #define fake_build_stage_built_s_length 6 - #define fake_build_stage_libraries_script_s_length 16 - #define fake_build_stage_libraries_shared_s_length 16 - #define fake_build_stage_libraries_static_s_length 16 - #define fake_build_stage_objects_static_s_length 14 - #define fake_build_stage_process_post_s_length 12 - #define fake_build_stage_process_pre_s_length 11 - #define fake_build_stage_programs_script_s_length 15 - #define fake_build_stage_programs_shared_s_length 15 - #define fake_build_stage_programs_static_s_length 15 - #define fake_build_stage_separate_s_length 1 - #define fake_build_stage_skeleton_s_length 8 - #define fake_build_stage_sources_headers_s_length 15 - #define fake_build_stage_sources_script_s_length 14 - #define fake_build_stage_sources_settings_s_length 16 - - extern const f_string_t fake_build_stage_built_s; - extern const f_string_t fake_build_stage_libraries_script_s; - extern const f_string_t fake_build_stage_libraries_shared_s; - extern const f_string_t fake_build_stage_libraries_static_s; - extern const f_string_t fake_build_stage_objects_static_s; - extern const f_string_t fake_build_stage_process_post_s; - extern const f_string_t fake_build_stage_process_pre_s; - extern const f_string_t fake_build_stage_programs_script_s; - extern const f_string_t fake_build_stage_programs_shared_s; - extern const f_string_t fake_build_stage_programs_static_s; - extern const f_string_t fake_build_stage_separate_s; - extern const f_string_t fake_build_stage_skeleton_s; - extern const f_string_t fake_build_stage_sources_headers_s; - extern const f_string_t fake_build_stage_sources_script_s; - extern const f_string_t fake_build_stage_sources_settings_s; + #define FAKE_build_stage_built_s_length 6 + #define FAKE_build_stage_libraries_script_s_length 16 + #define FAKE_build_stage_libraries_shared_s_length 16 + #define FAKE_build_stage_libraries_static_s_length 16 + #define FAKE_build_stage_objects_static_s_length 14 + #define FAKE_build_stage_process_post_s_length 12 + #define FAKE_build_stage_process_pre_s_length 11 + #define FAKE_build_stage_programs_script_s_length 15 + #define FAKE_build_stage_programs_shared_s_length 15 + #define FAKE_build_stage_programs_static_s_length 15 + #define FAKE_build_stage_separate_s_length 1 + #define FAKE_build_stage_skeleton_s_length 8 + #define FAKE_build_stage_sources_headers_s_length 15 + #define FAKE_build_stage_sources_script_s_length 14 + #define FAKE_build_stage_sources_settings_s_length 16 + + extern const f_string_static_t fake_build_stage_built_s; + extern const f_string_static_t fake_build_stage_libraries_script_s; + extern const f_string_static_t fake_build_stage_libraries_shared_s; + extern const f_string_static_t fake_build_stage_libraries_static_s; + extern const f_string_static_t fake_build_stage_objects_static_s; + extern const f_string_static_t fake_build_stage_process_post_s; + extern const f_string_static_t fake_build_stage_process_pre_s; + extern const f_string_static_t fake_build_stage_programs_script_s; + extern const f_string_static_t fake_build_stage_programs_shared_s; + extern const f_string_static_t fake_build_stage_programs_static_s; + extern const f_string_static_t fake_build_stage_separate_s; + extern const f_string_static_t fake_build_stage_skeleton_s; + extern const f_string_static_t fake_build_stage_sources_headers_s; + extern const f_string_static_t fake_build_stage_sources_script_s; + extern const f_string_static_t fake_build_stage_sources_settings_s; #endif // _di_fake_build_stage_t_ #ifndef _di_fake_build_data_t_ @@ -572,42 +572,42 @@ extern "C" { #define FAKE_build_parameter_library_static_s "-static" #define FAKE_build_parameter_library_shared_prefix_s "-Wl,-soname," - #define fake_build_parameter_library_include_s_length 2 - #define fake_build_parameter_library_link_file_s_length 2 - #define fake_build_parameter_library_link_path_s_length 2 - #define fake_build_parameter_library_name_prefix_s_length 3 - #define fake_build_parameter_library_name_suffix_shared_s_length 3 - #define fake_build_parameter_library_name_suffix_static_s_length 2 - #define fake_build_parameter_library_output_s_length 2 - #define fake_build_parameter_library_shared_s_length 7 - #define fake_build_parameter_library_static_s_length 7 - #define fake_build_parameter_library_shared_prefix_s_length 12 - - extern const f_string_t fake_build_parameter_library_include_s; - extern const f_string_t fake_build_parameter_library_link_file_s; - extern const f_string_t fake_build_parameter_library_link_path_s; - extern const f_string_t fake_build_parameter_library_name_prefix_s; - extern const f_string_t fake_build_parameter_library_name_suffix_shared_s; - extern const f_string_t fake_build_parameter_library_name_suffix_static_s; - extern const f_string_t fake_build_parameter_library_output_s; - extern const f_string_t fake_build_parameter_library_shared_s; - extern const f_string_t fake_build_parameter_library_static_s; - extern const f_string_t fake_build_parameter_library_shared_prefix_s; + #define FAKE_build_parameter_library_include_s_length 2 + #define FAKE_build_parameter_library_link_file_s_length 2 + #define FAKE_build_parameter_library_link_path_s_length 2 + #define FAKE_build_parameter_library_name_prefix_s_length 3 + #define FAKE_build_parameter_library_name_suffix_shared_s_length 3 + #define FAKE_build_parameter_library_name_suffix_static_s_length 2 + #define FAKE_build_parameter_library_output_s_length 2 + #define FAKE_build_parameter_library_shared_s_length 7 + #define FAKE_build_parameter_library_static_s_length 7 + #define FAKE_build_parameter_library_shared_prefix_s_length 12 + + extern const f_string_static_t fake_build_parameter_library_include_s; + extern const f_string_static_t fake_build_parameter_library_link_file_s; + extern const f_string_static_t fake_build_parameter_library_link_path_s; + extern const f_string_static_t fake_build_parameter_library_name_prefix_s; + extern const f_string_static_t fake_build_parameter_library_name_suffix_shared_s; + extern const f_string_static_t fake_build_parameter_library_name_suffix_static_s; + extern const f_string_static_t fake_build_parameter_library_output_s; + extern const f_string_static_t fake_build_parameter_library_shared_s; + extern const f_string_static_t fake_build_parameter_library_static_s; + extern const f_string_static_t fake_build_parameter_library_shared_prefix_s; #define FAKE_build_parameter_object_compile_s "-c" #define FAKE_build_parameter_object_name_suffix_s ".o" #define FAKE_build_parameter_object_output_s "-o" #define FAKE_build_parameter_object_static_s "-static" - #define fake_build_parameter_object_compile_s_length 2 - #define fake_build_parameter_object_name_suffix_s_length 2 - #define fake_build_parameter_object_output_s_length 2 - #define fake_build_parameter_object_static_s_length 7 + #define FAKE_build_parameter_object_compile_s_length 2 + #define FAKE_build_parameter_object_name_suffix_s_length 2 + #define FAKE_build_parameter_object_output_s_length 2 + #define FAKE_build_parameter_object_static_s_length 7 - extern const f_string_t fake_build_parameter_object_compile_s; - extern const f_string_t fake_build_parameter_object_name_suffix_s; - extern const f_string_t fake_build_parameter_object_output_s; - extern const f_string_t fake_build_parameter_object_static_s; + extern const f_string_static_t fake_build_parameter_object_compile_s; + extern const f_string_static_t fake_build_parameter_object_name_suffix_s; + extern const f_string_static_t fake_build_parameter_object_output_s; + extern const f_string_static_t fake_build_parameter_object_static_s; #endif // _di_fake_build_parameter_ /** @@ -620,6 +620,9 @@ extern "C" { * fake_common_setting_bool_*: * - yes: A representation of yes or true. * - no: A representation of no or false. + * + * fake_common_setting_*: + * - list: A generic name referring to a setting as a list. */ #ifndef _di_fake_common_ #define fake_common_allocation_large_d 256 @@ -628,11 +631,16 @@ extern "C" { #define FAKE_common_setting_bool_yes_s "yes" #define FAKE_common_setting_bool_no_s "no" - #define fake_common_setting_bool_yes_s_length 3 - #define fake_common_setting_bool_no_s_length 2 + #define FAKE_common_setting_list_s "list" + + #define FAKE_common_setting_bool_yes_s_length 3 + #define FAKE_common_setting_bool_no_s_length 2 - extern const f_string_t fake_common_setting_bool_yes_s; - extern const f_string_t fake_common_setting_bool_no_s; + #define FAKE_common_setting_list_s_length 4 + + extern const f_string_static_t fake_common_setting_bool_yes_s; + extern const f_string_static_t fake_common_setting_bool_no_s; + extern const f_string_static_t fake_common_setting_list_s; #define fake_common_initial_buffer_max_d 131072 // 128k max default initial buffer size. #endif // _di_fake_common_ @@ -648,11 +656,11 @@ extern "C" { #define FAKE_make_section_main_s "main" #define FAKE_make_section_settings_s "settings" - #define fake_make_section_main_s_length 4 - #define fake_make_section_settings_s_length 8 + #define FAKE_make_section_main_s_length 4 + #define FAKE_make_section_settings_s_length 8 - extern const f_string_t fake_make_section_main_s; - extern const f_string_t fake_make_section_settings_s; + extern const f_string_static_t fake_make_section_main_s; + extern const f_string_static_t fake_make_section_settings_s; #define fake_make_section_stack_max_d 8192 // maximum stack call depth. #endif // _di_fake_make_section_ @@ -685,25 +693,25 @@ extern "C" { #define FAKE_make_setting_parameter_s "parameter" #define FAKE_make_setting_return_s "return" - #define fake_make_setting_compiler_s_length 8 - #define fake_make_setting_define_s_length 6 - #define fake_make_setting_environment_s_length 11 - #define fake_make_setting_fail_s_length 4 - #define fake_make_setting_indexer_s_length 7 - #define fake_make_setting_indexer_arguments_s_length 17 - #define fake_make_setting_load_build_s_length 10 - #define fake_make_setting_parameter_s_length 9 - #define fake_make_setting_return_s_length 6 - - extern const f_string_t fake_make_setting_compiler_s; - extern const f_string_t fake_make_setting_define_s; - extern const f_string_t fake_make_setting_environment_s; - extern const f_string_t fake_make_setting_fail_s; - extern const f_string_t fake_make_setting_indexer_s; - extern const f_string_t fake_make_setting_indexer_arguments_s; - extern const f_string_t fake_make_setting_load_build_s; - extern const f_string_t fake_make_setting_parameter_s; - extern const f_string_t fake_make_setting_return_s; + #define FAKE_make_setting_compiler_s_length 8 + #define FAKE_make_setting_define_s_length 6 + #define FAKE_make_setting_environment_s_length 11 + #define FAKE_make_setting_fail_s_length 4 + #define FAKE_make_setting_indexer_s_length 7 + #define FAKE_make_setting_indexer_arguments_s_length 17 + #define FAKE_make_setting_load_build_s_length 10 + #define FAKE_make_setting_parameter_s_length 9 + #define FAKE_make_setting_return_s_length 6 + + extern const f_string_static_t fake_make_setting_compiler_s; + extern const f_string_static_t fake_make_setting_define_s; + extern const f_string_static_t fake_make_setting_environment_s; + extern const f_string_static_t fake_make_setting_fail_s; + extern const f_string_static_t fake_make_setting_indexer_s; + extern const f_string_static_t fake_make_setting_indexer_arguments_s; + extern const f_string_static_t fake_make_setting_load_build_s; + extern const f_string_static_t fake_make_setting_parameter_s; + extern const f_string_static_t fake_make_setting_return_s; #endif // _di_fake_make_setting_t_ #ifndef _di_fake_make_operation_ @@ -742,75 +750,75 @@ extern "C" { #define FAKE_make_operation_top_s "top" #define FAKE_make_operation_touch_s "touch" - #define fake_make_operation_and_s_length 3 - #define fake_make_operation_break_s_length 5 - #define fake_make_operation_build_s_length 5 - #define fake_make_operation_clean_s_length 5 - #define fake_make_operation_clone_s_length 5 - #define fake_make_operation_compile_s_length 7 - #define fake_make_operation_copy_s_length 4 - #define fake_make_operation_define_s_length 6 - #define fake_make_operation_delete_s_length 6 - #define fake_make_operation_deletes_s_length 7 - #define fake_make_operation_else_s_length 4 - #define fake_make_operation_exit_s_length 4 - #define fake_make_operation_fail_s_length 4 - #define fake_make_operation_group_s_length 5 - #define fake_make_operation_groups_s_length 6 - #define fake_make_operation_if_s_length 2 - #define fake_make_operation_index_s_length 5 - #define fake_make_operation_link_s_length 4 - #define fake_make_operation_mode_s_length 4 - #define fake_make_operation_modes_s_length 5 - #define fake_make_operation_move_s_length 4 - #define fake_make_operation_operate_s_length 7 - #define fake_make_operation_or_s_length 2 - #define fake_make_operation_owner_s_length 5 - #define fake_make_operation_owners_s_length 6 - #define fake_make_operation_parameter_s_length 9 - #define fake_make_operation_pop_s_length 3 - #define fake_make_operation_print_s_length 5 - #define fake_make_operation_run_s_length 3 - #define fake_make_operation_shell_s_length 5 - #define fake_make_operation_skeleton_s_length 8 - #define fake_make_operation_to_s_length 2 - #define fake_make_operation_top_s_length 3 - #define fake_make_operation_touch_s_length 5 - - extern const f_string_t fake_make_operation_and_s; - extern const f_string_t fake_make_operation_break_s; - extern const f_string_t fake_make_operation_build_s; - extern const f_string_t fake_make_operation_clean_s; - extern const f_string_t fake_make_operation_clone_s; - extern const f_string_t fake_make_operation_compile_s; - extern const f_string_t fake_make_operation_copy_s; - extern const f_string_t fake_make_operation_define_s; - extern const f_string_t fake_make_operation_delete_s; - extern const f_string_t fake_make_operation_deletes_s; - extern const f_string_t fake_make_operation_else_s; - extern const f_string_t fake_make_operation_exit_s; - extern const f_string_t fake_make_operation_fail_s; - extern const f_string_t fake_make_operation_group_s; - extern const f_string_t fake_make_operation_groups_s; - extern const f_string_t fake_make_operation_if_s; - extern const f_string_t fake_make_operation_index_s; - extern const f_string_t fake_make_operation_link_s; - extern const f_string_t fake_make_operation_mode_s; - extern const f_string_t fake_make_operation_modes_s; - extern const f_string_t fake_make_operation_move_s; - extern const f_string_t fake_make_operation_operate_s; - extern const f_string_t fake_make_operation_or_s; - extern const f_string_t fake_make_operation_owner_s; - extern const f_string_t fake_make_operation_owners_s; - extern const f_string_t fake_make_operation_parameter_s; - extern const f_string_t fake_make_operation_pop_s; - extern const f_string_t fake_make_operation_print_s; - extern const f_string_t fake_make_operation_run_s; - extern const f_string_t fake_make_operation_shell_s; - extern const f_string_t fake_make_operation_skeleton_s; - extern const f_string_t fake_make_operation_to_s; - extern const f_string_t fake_make_operation_top_s; - extern const f_string_t fake_make_operation_touch_s; + #define FAKE_make_operation_and_s_length 3 + #define FAKE_make_operation_break_s_length 5 + #define FAKE_make_operation_build_s_length 5 + #define FAKE_make_operation_clean_s_length 5 + #define FAKE_make_operation_clone_s_length 5 + #define FAKE_make_operation_compile_s_length 7 + #define FAKE_make_operation_copy_s_length 4 + #define FAKE_make_operation_define_s_length 6 + #define FAKE_make_operation_delete_s_length 6 + #define FAKE_make_operation_deletes_s_length 7 + #define FAKE_make_operation_else_s_length 4 + #define FAKE_make_operation_exit_s_length 4 + #define FAKE_make_operation_fail_s_length 4 + #define FAKE_make_operation_group_s_length 5 + #define FAKE_make_operation_groups_s_length 6 + #define FAKE_make_operation_if_s_length 2 + #define FAKE_make_operation_index_s_length 5 + #define FAKE_make_operation_link_s_length 4 + #define FAKE_make_operation_mode_s_length 4 + #define FAKE_make_operation_modes_s_length 5 + #define FAKE_make_operation_move_s_length 4 + #define FAKE_make_operation_operate_s_length 7 + #define FAKE_make_operation_or_s_length 2 + #define FAKE_make_operation_owner_s_length 5 + #define FAKE_make_operation_owners_s_length 6 + #define FAKE_make_operation_parameter_s_length 9 + #define FAKE_make_operation_pop_s_length 3 + #define FAKE_make_operation_print_s_length 5 + #define FAKE_make_operation_run_s_length 3 + #define FAKE_make_operation_shell_s_length 5 + #define FAKE_make_operation_skeleton_s_length 8 + #define FAKE_make_operation_to_s_length 2 + #define FAKE_make_operation_top_s_length 3 + #define FAKE_make_operation_touch_s_length 5 + + extern const f_string_static_t fake_make_operation_and_s; + extern const f_string_static_t fake_make_operation_break_s; + extern const f_string_static_t fake_make_operation_build_s; + extern const f_string_static_t fake_make_operation_clean_s; + extern const f_string_static_t fake_make_operation_clone_s; + extern const f_string_static_t fake_make_operation_compile_s; + extern const f_string_static_t fake_make_operation_copy_s; + extern const f_string_static_t fake_make_operation_define_s; + extern const f_string_static_t fake_make_operation_delete_s; + extern const f_string_static_t fake_make_operation_deletes_s; + extern const f_string_static_t fake_make_operation_else_s; + extern const f_string_static_t fake_make_operation_exit_s; + extern const f_string_static_t fake_make_operation_fail_s; + extern const f_string_static_t fake_make_operation_group_s; + extern const f_string_static_t fake_make_operation_groups_s; + extern const f_string_static_t fake_make_operation_if_s; + extern const f_string_static_t fake_make_operation_index_s; + extern const f_string_static_t fake_make_operation_link_s; + extern const f_string_static_t fake_make_operation_mode_s; + extern const f_string_static_t fake_make_operation_modes_s; + extern const f_string_static_t fake_make_operation_move_s; + extern const f_string_static_t fake_make_operation_operate_s; + extern const f_string_static_t fake_make_operation_or_s; + extern const f_string_static_t fake_make_operation_owner_s; + extern const f_string_static_t fake_make_operation_owners_s; + extern const f_string_static_t fake_make_operation_parameter_s; + extern const f_string_static_t fake_make_operation_pop_s; + extern const f_string_static_t fake_make_operation_print_s; + extern const f_string_static_t fake_make_operation_run_s; + extern const f_string_static_t fake_make_operation_shell_s; + extern const f_string_static_t fake_make_operation_skeleton_s; + extern const f_string_static_t fake_make_operation_to_s; + extern const f_string_static_t fake_make_operation_top_s; + extern const f_string_static_t fake_make_operation_touch_s; enum { fake_make_operation_type_and_e = 1, @@ -867,37 +875,37 @@ extern "C" { #define FAKE_make_operation_argument_target_s "target" #define FAKE_make_operation_argument_warn_s "warn" - #define fake_make_operation_argument_environment_s_length 11 - #define fake_make_operation_argument_failure_s_length 7 - #define fake_make_operation_argument_file_s_length 4 - #define fake_make_operation_argument_directory_s_length 9 - #define fake_make_operation_argument_error_s_length 5 - #define fake_make_operation_argument_exit_s_length 4 - #define fake_make_operation_argument_has_s_length 3 - #define fake_make_operation_argument_ignore_s_length 6 - #define fake_make_operation_argument_is_s_length 2 - #define fake_make_operation_argument_parameter_s_length 9 - #define fake_make_operation_argument_point_s_length 5 - #define fake_make_operation_argument_recursive_s_length 9 - #define fake_make_operation_argument_success_s_length 7 - #define fake_make_operation_argument_target_s_length 6 - #define fake_make_operation_argument_warn_s_length 4 - - extern const f_string_t fake_make_operation_argument_environment_s; - extern const f_string_t fake_make_operation_argument_failure_s; - extern const f_string_t fake_make_operation_argument_file_s; - extern const f_string_t fake_make_operation_argument_directory_s; - extern const f_string_t fake_make_operation_argument_error_s; - extern const f_string_t fake_make_operation_argument_exit_s; - extern const f_string_t fake_make_operation_argument_has_s; - extern const f_string_t fake_make_operation_argument_ignore_s; - extern const f_string_t fake_make_operation_argument_is_s; - extern const f_string_t fake_make_operation_argument_parameter_s; - extern const f_string_t fake_make_operation_argument_point_s; - extern const f_string_t fake_make_operation_argument_recursive_s; - extern const f_string_t fake_make_operation_argument_success_s; - extern const f_string_t fake_make_operation_argument_target_s; - extern const f_string_t fake_make_operation_argument_warn_s; + #define FAKE_make_operation_argument_environment_s_length 11 + #define FAKE_make_operation_argument_failure_s_length 7 + #define FAKE_make_operation_argument_file_s_length 4 + #define FAKE_make_operation_argument_directory_s_length 9 + #define FAKE_make_operation_argument_error_s_length 5 + #define FAKE_make_operation_argument_exit_s_length 4 + #define FAKE_make_operation_argument_has_s_length 3 + #define FAKE_make_operation_argument_ignore_s_length 6 + #define FAKE_make_operation_argument_is_s_length 2 + #define FAKE_make_operation_argument_parameter_s_length 9 + #define FAKE_make_operation_argument_point_s_length 5 + #define FAKE_make_operation_argument_recursive_s_length 9 + #define FAKE_make_operation_argument_success_s_length 7 + #define FAKE_make_operation_argument_target_s_length 6 + #define FAKE_make_operation_argument_warn_s_length 4 + + extern const f_string_static_t fake_make_operation_argument_environment_s; + extern const f_string_static_t fake_make_operation_argument_failure_s; + extern const f_string_static_t fake_make_operation_argument_file_s; + extern const f_string_static_t fake_make_operation_argument_directory_s; + extern const f_string_static_t fake_make_operation_argument_error_s; + extern const f_string_static_t fake_make_operation_argument_exit_s; + extern const f_string_static_t fake_make_operation_argument_has_s; + extern const f_string_static_t fake_make_operation_argument_ignore_s; + extern const f_string_static_t fake_make_operation_argument_is_s; + extern const f_string_static_t fake_make_operation_argument_parameter_s; + extern const f_string_static_t fake_make_operation_argument_point_s; + extern const f_string_static_t fake_make_operation_argument_recursive_s; + extern const f_string_static_t fake_make_operation_argument_success_s; + extern const f_string_static_t fake_make_operation_argument_target_s; + extern const f_string_static_t fake_make_operation_argument_warn_s; #define FAKE_make_operation_argument_if_defined_s "defined" #define FAKE_make_operation_argument_if_equal_s "==" @@ -916,39 +924,39 @@ extern "C" { #define FAKE_make_operation_argument_if_owner_s "owner" #define FAKE_make_operation_argument_if_success_s "success" - #define fake_make_operation_argument_if_defined_s_length 7 - #define fake_make_operation_argument_if_equal_s_length 2 - #define fake_make_operation_argument_if_equal_not_s_length 2 - #define fake_make_operation_argument_if_exists_s_length 6 - #define fake_make_operation_argument_if_failure_s_length 7 - #define fake_make_operation_argument_if_greater_s_length 1 - #define fake_make_operation_argument_if_greater_equal_s_length 2 - #define fake_make_operation_argument_if_group_s_length 5 - #define fake_make_operation_argument_if_is_s_length 2 - #define fake_make_operation_argument_if_is_for_s_length 3 - #define fake_make_operation_argument_if_less_s_length 1 - #define fake_make_operation_argument_if_less_equal_s_length 2 - #define fake_make_operation_argument_if_mode_s_length 4 - #define fake_make_operation_argument_if_not_s_length 3 - #define fake_make_operation_argument_if_owner_s_length 5 - #define fake_make_operation_argument_if_success_s_length 7 - - extern const f_string_t fake_make_operation_argument_if_defined_s; - extern const f_string_t fake_make_operation_argument_if_equal_s; - extern const f_string_t fake_make_operation_argument_if_equal_not_s; - extern const f_string_t fake_make_operation_argument_if_exists_s; - extern const f_string_t fake_make_operation_argument_if_failure_s; - extern const f_string_t fake_make_operation_argument_if_greater_s; - extern const f_string_t fake_make_operation_argument_if_greater_equal_s; - extern const f_string_t fake_make_operation_argument_if_group_s; - extern const f_string_t fake_make_operation_argument_if_is_s; - extern const f_string_t fake_make_operation_argument_if_is_for_s; - extern const f_string_t fake_make_operation_argument_if_less_s; - extern const f_string_t fake_make_operation_argument_if_less_equal_s; - extern const f_string_t fake_make_operation_argument_if_mode_s; - extern const f_string_t fake_make_operation_argument_if_not_s; - extern const f_string_t fake_make_operation_argument_if_owner_s; - extern const f_string_t fake_make_operation_argument_if_success_s; + #define FAKE_make_operation_argument_if_defined_s_length 7 + #define FAKE_make_operation_argument_if_equal_s_length 2 + #define FAKE_make_operation_argument_if_equal_not_s_length 2 + #define FAKE_make_operation_argument_if_exists_s_length 6 + #define FAKE_make_operation_argument_if_failure_s_length 7 + #define FAKE_make_operation_argument_if_greater_s_length 1 + #define FAKE_make_operation_argument_if_greater_equal_s_length 2 + #define FAKE_make_operation_argument_if_group_s_length 5 + #define FAKE_make_operation_argument_if_is_s_length 2 + #define FAKE_make_operation_argument_if_is_for_s_length 3 + #define FAKE_make_operation_argument_if_less_s_length 1 + #define FAKE_make_operation_argument_if_less_equal_s_length 2 + #define FAKE_make_operation_argument_if_mode_s_length 4 + #define FAKE_make_operation_argument_if_not_s_length 3 + #define FAKE_make_operation_argument_if_owner_s_length 5 + #define FAKE_make_operation_argument_if_success_s_length 7 + + extern const f_string_static_t fake_make_operation_argument_if_defined_s; + extern const f_string_static_t fake_make_operation_argument_if_equal_s; + extern const f_string_static_t fake_make_operation_argument_if_equal_not_s; + extern const f_string_static_t fake_make_operation_argument_if_exists_s; + extern const f_string_static_t fake_make_operation_argument_if_failure_s; + extern const f_string_static_t fake_make_operation_argument_if_greater_s; + extern const f_string_static_t fake_make_operation_argument_if_greater_equal_s; + extern const f_string_static_t fake_make_operation_argument_if_group_s; + extern const f_string_static_t fake_make_operation_argument_if_is_s; + extern const f_string_static_t fake_make_operation_argument_if_is_for_s; + extern const f_string_static_t fake_make_operation_argument_if_less_s; + extern const f_string_static_t fake_make_operation_argument_if_less_equal_s; + extern const f_string_static_t fake_make_operation_argument_if_mode_s; + extern const f_string_static_t fake_make_operation_argument_if_not_s; + extern const f_string_static_t fake_make_operation_argument_if_owner_s; + extern const f_string_static_t fake_make_operation_argument_if_success_s; enum { fake_make_operation_if_type_else_e = 1, @@ -986,6 +994,9 @@ extern "C" { #endif // _di_fake_make_operation_ #ifndef _di_fake_make_parameter_t_ + #define FAKE_make_parameter_iki_option_s ":option" + #define FAKE_make_parameter_iki_value_s ":value" + #define FAKE_make_parameter_variable_build_s "build" #define FAKE_make_parameter_variable_color_s "color" #define FAKE_make_parameter_variable_data_s "data" @@ -999,63 +1010,63 @@ extern "C" { #define FAKE_make_parameter_variable_verbosity_s "verbosity" #define FAKE_make_parameter_variable_work_s "work" - #define fake_make_parameter_iki_option_s ":option" - #define fake_make_parameter_iki_value_s ":value" - - #define fake_make_parameter_variable_build_s_length 5 - #define fake_make_parameter_variable_color_s_length 5 - #define fake_make_parameter_variable_data_s_length 4 - #define fake_make_parameter_variable_define_s_length 6 - #define fake_make_parameter_variable_fakefile_s_length 8 - #define fake_make_parameter_variable_mode_s_length 4 - #define fake_make_parameter_variable_process_s_length 7 - #define fake_make_parameter_variable_return_s_length 6 - #define fake_make_parameter_variable_settings_s_length 8 - #define fake_make_parameter_variable_sources_s_length 7 - #define fake_make_parameter_variable_verbosity_s_length 9 - #define fake_make_parameter_variable_work_s_length 4 - - #define fake_make_parameter_iki_option_s_length 7 - #define fake_make_parameter_iki_value_s_length 6 - - extern const f_string_t fake_make_parameter_variable_build_s; - extern const f_string_t fake_make_parameter_variable_color_s; - extern const f_string_t fake_make_parameter_variable_data_s; - extern const f_string_t fake_make_parameter_variable_define_s; - extern const f_string_t fake_make_parameter_variable_fakefile_s; - extern const f_string_t fake_make_parameter_variable_mode_s; - extern const f_string_t fake_make_parameter_variable_process_s; - extern const f_string_t fake_make_parameter_variable_return_s; - extern const f_string_t fake_make_parameter_variable_settings_s; - extern const f_string_t fake_make_parameter_variable_sources_s; - extern const f_string_t fake_make_parameter_variable_verbosity_s; - extern const f_string_t fake_make_parameter_variable_work_s; - - extern const f_string_t fake_make_parameter_variable_option_build_s; - extern const f_string_t fake_make_parameter_variable_option_color_s; - extern const f_string_t fake_make_parameter_variable_option_data_s; - extern const f_string_t fake_make_parameter_variable_option_define_s; - extern const f_string_t fake_make_parameter_variable_option_fakefile_s; - extern const f_string_t fake_make_parameter_variable_option_mode_s; - extern const f_string_t fake_make_parameter_variable_option_process_s; - extern const f_string_t fake_make_parameter_variable_option_return_s; - extern const f_string_t fake_make_parameter_variable_option_settings_s; - extern const f_string_t fake_make_parameter_variable_option_sources_s; - extern const f_string_t fake_make_parameter_variable_option_verbosity_s; - extern const f_string_t fake_make_parameter_variable_option_work_s; - - extern const f_string_t fake_make_parameter_variable_value_build_s; - extern const f_string_t fake_make_parameter_variable_value_color_s; - extern const f_string_t fake_make_parameter_variable_value_data_s; - extern const f_string_t fake_make_parameter_variable_value_define_s; - extern const f_string_t fake_make_parameter_variable_value_fakefile_s; - extern const f_string_t fake_make_parameter_variable_value_mode_s; - extern const f_string_t fake_make_parameter_variable_value_process_s; - extern const f_string_t fake_make_parameter_variable_value_return_s; - extern const f_string_t fake_make_parameter_variable_value_settings_s; - extern const f_string_t fake_make_parameter_variable_value_sources_s; - extern const f_string_t fake_make_parameter_variable_value_verbosity_s; - extern const f_string_t fake_make_parameter_variable_value_work_s; + #define FAKE_make_parameter_iki_option_s_length 7 + #define FAKE_make_parameter_iki_value_s_length 6 + + #define FAKE_make_parameter_variable_build_s_length 5 + #define FAKE_make_parameter_variable_color_s_length 5 + #define FAKE_make_parameter_variable_data_s_length 4 + #define FAKE_make_parameter_variable_define_s_length 6 + #define FAKE_make_parameter_variable_fakefile_s_length 8 + #define FAKE_make_parameter_variable_mode_s_length 4 + #define FAKE_make_parameter_variable_process_s_length 7 + #define FAKE_make_parameter_variable_return_s_length 6 + #define FAKE_make_parameter_variable_settings_s_length 8 + #define FAKE_make_parameter_variable_sources_s_length 7 + #define FAKE_make_parameter_variable_verbosity_s_length 9 + #define FAKE_make_parameter_variable_work_s_length 4 + + extern const f_string_static_t fake_make_parameter_iki_option_s; + extern const f_string_static_t fake_make_parameter_iki_value_s; + + extern const f_string_static_t fake_make_parameter_variable_build_s; + extern const f_string_static_t fake_make_parameter_variable_color_s; + extern const f_string_static_t fake_make_parameter_variable_data_s; + extern const f_string_static_t fake_make_parameter_variable_define_s; + extern const f_string_static_t fake_make_parameter_variable_fakefile_s; + extern const f_string_static_t fake_make_parameter_variable_mode_s; + extern const f_string_static_t fake_make_parameter_variable_process_s; + extern const f_string_static_t fake_make_parameter_variable_return_s; + extern const f_string_static_t fake_make_parameter_variable_settings_s; + extern const f_string_static_t fake_make_parameter_variable_sources_s; + extern const f_string_static_t fake_make_parameter_variable_verbosity_s; + extern const f_string_static_t fake_make_parameter_variable_work_s; + + extern const f_string_static_t fake_make_parameter_variable_option_build_s; + extern const f_string_static_t fake_make_parameter_variable_option_color_s; + extern const f_string_static_t fake_make_parameter_variable_option_data_s; + extern const f_string_static_t fake_make_parameter_variable_option_define_s; + extern const f_string_static_t fake_make_parameter_variable_option_fakefile_s; + extern const f_string_static_t fake_make_parameter_variable_option_mode_s; + extern const f_string_static_t fake_make_parameter_variable_option_process_s; + extern const f_string_static_t fake_make_parameter_variable_option_return_s; + extern const f_string_static_t fake_make_parameter_variable_option_settings_s; + extern const f_string_static_t fake_make_parameter_variable_option_sources_s; + extern const f_string_static_t fake_make_parameter_variable_option_verbosity_s; + extern const f_string_static_t fake_make_parameter_variable_option_work_s; + + extern const f_string_static_t fake_make_parameter_variable_value_build_s; + extern const f_string_static_t fake_make_parameter_variable_value_color_s; + extern const f_string_static_t fake_make_parameter_variable_value_data_s; + extern const f_string_static_t fake_make_parameter_variable_value_define_s; + extern const f_string_static_t fake_make_parameter_variable_value_fakefile_s; + extern const f_string_static_t fake_make_parameter_variable_value_mode_s; + extern const f_string_static_t fake_make_parameter_variable_value_process_s; + extern const f_string_static_t fake_make_parameter_variable_value_return_s; + extern const f_string_static_t fake_make_parameter_variable_value_settings_s; + extern const f_string_static_t fake_make_parameter_variable_value_sources_s; + extern const f_string_static_t fake_make_parameter_variable_value_verbosity_s; + extern const f_string_static_t fake_make_parameter_variable_value_work_s; typedef struct { f_string_dynamics_t build; @@ -1242,17 +1253,23 @@ extern "C" { #define FAKE_make_skeleton_content_defines_s "# fss-0000\n\n" #define FAKE_make_skeleton_content_dependencies_s "# fss-0000\n\n" #define FAKE_make_skeleton_content_fakefile_s "# fss-0005 iki-0002\n\nsettings:\n fail exit\n\nmain:\n\n" + #define FAKE_make_skeleton_content_process_post_s "#!/bin/bash\n\n" + #define FAKE_make_skeleton_content_process_pre_s "#!/bin/bash\n\n" #define FAKE_make_skeleton_content_settings_s "# fss-0001\n\n" - #define fake_make_skeleton_content_defines_s_length 12 - #define fake_make_skeleton_content_dependencies_s_length 12 - #define fake_make_skeleton_content_fakefile_s_length 51 - #define fake_make_skeleton_content_settings_s_length 12 - - extern const f_string_t fake_make_skeleton_content_defines_s; - extern const f_string_t fake_make_skeleton_content_dependencies_s; - extern const f_string_t fake_make_skeleton_content_fakefile_s; - extern const f_string_t fake_make_skeleton_content_settings_s; + #define FAKE_make_skeleton_content_defines_s_length 12 + #define FAKE_make_skeleton_content_dependencies_s_length 12 + #define FAKE_make_skeleton_content_fakefile_s_length 51 + #define FAKE_make_skeleton_content_process_post_s_length 13 + #define FAKE_make_skeleton_content_process_pre_s_length 13 + #define FAKE_make_skeleton_content_settings_s_length 12 + + extern const f_string_static_t fake_make_skeleton_content_defines_s; + extern const f_string_static_t fake_make_skeleton_content_dependencies_s; + extern const f_string_static_t fake_make_skeleton_content_fakefile_s; + extern const f_string_static_t fake_make_skeleton_content_process_post_s; + extern const f_string_static_t fake_make_skeleton_content_process_pre_s; + extern const f_string_static_t fake_make_skeleton_content_settings_s; #endif // _di_fake_skeleton_content_ #ifndef _di_fake_make_context_ @@ -1266,27 +1283,38 @@ extern "C" { #define FAKE_make_context_success_s "success" #define FAKE_make_context_normal_s "normal" - #define fake_make_context_reset_s_length 5 - #define fake_make_context_warning_s_length 7 - #define fake_make_context_error_s_length 5 - #define fake_make_context_title_s_length 5 - #define fake_make_context_notable_s_length 7 - #define fake_make_context_important_s_length 9 - #define fake_make_context_standout_s_length 8 - #define fake_make_context_success_s_length 7 - #define fake_make_context_normal_s_length 5 - - extern const f_string_t fake_make_context_reset_s; - extern const f_string_t fake_make_context_warning_s; - extern const f_string_t fake_make_context_error_s; - extern const f_string_t fake_make_context_title_s; - extern const f_string_t fake_make_context_notable_s; - extern const f_string_t fake_make_context_important_s; - extern const f_string_t fake_make_context_standout_s; - extern const f_string_t fake_make_context_success_s; - extern const f_string_t fake_make_context_normal_s; + #define FAKE_make_context_reset_s_length 5 + #define FAKE_make_context_warning_s_length 7 + #define FAKE_make_context_error_s_length 5 + #define FAKE_make_context_title_s_length 5 + #define FAKE_make_context_notable_s_length 7 + #define FAKE_make_context_important_s_length 9 + #define FAKE_make_context_standout_s_length 8 + #define FAKE_make_context_success_s_length 7 + #define FAKE_make_context_normal_s_length 5 + + extern const f_string_static_t fake_make_context_reset_s; + extern const f_string_static_t fake_make_context_warning_s; + extern const f_string_static_t fake_make_context_error_s; + extern const f_string_static_t fake_make_context_title_s; + extern const f_string_static_t fake_make_context_notable_s; + extern const f_string_static_t fake_make_context_important_s; + extern const f_string_static_t fake_make_context_standout_s; + extern const f_string_static_t fake_make_context_success_s; + extern const f_string_static_t fake_make_context_normal_s; #endif // _di_fake_make_context_ +#ifndef _di_fake_file_data_build_strings_ + #define FAKE_file_data_build_process_post_s "process_post.sh" + #define FAKE_file_data_build_process_pre_s "process_pre.sh" + + #define FAKE_file_data_build_process_post_s_length 15 + #define FAKE_file_data_build_process_pre_s_length 14 + + extern const f_string_static_t fake_file_data_build_process_post_s; + extern const f_string_static_t fake_file_data_build_process_pre_s; +#endif // _di_fake_file_data_build_strings_ + /** * Check to see if a process signal is received. * diff --git a/level_3/fake/c/private-fake-path_generate.c b/level_3/fake/c/private-fake-path_generate.c index 3978581..10400f7 100644 --- a/level_3/fake/c/private-fake-path_generate.c +++ b/level_3/fake/c/private-fake-path_generate.c @@ -23,7 +23,7 @@ extern "C" { &main->path_sources, }; - const uint8_t parameters_length[] = { + const uint8_t parameters_size[] = { 7, 2, 4, @@ -59,7 +59,7 @@ extern "C" { for (i = 0; i < 3; ++i) { - status = fake_path_generate_string_dynamic(main, *parameters_source[i], parameters_value[i], parameters_length[i]); + status = fake_path_generate_string_dynamic(main, *parameters_source[i], parameters_value[i], parameters_size[i]); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); @@ -70,7 +70,7 @@ extern "C" { } { - const f_string_t parameters_source[] = { + const f_string_static_t parameters_source[] = { fake_path_part_documents_s, fake_path_part_includes_s, fake_path_part_libraries_s, @@ -88,24 +88,6 @@ extern "C" { fake_path_part_script_s, }; - const f_array_length_t parameters_length[] = { - fake_path_part_documents_s_length, - fake_path_part_includes_s_length, - fake_path_part_libraries_s_length, - fake_path_part_objects_s_length, - fake_path_part_programs_s_length, - fake_path_part_settings_s_length, - fake_path_part_stage_s_length, - fake_path_part_build_s_length, - fake_path_part_settings_s_length, - fake_path_part_documents_s_length, - fake_path_part_licenses_s_length, - fake_path_part_bash_s_length, - fake_path_part_c_s_length, - fake_path_part_cpp_s_length, - fake_path_part_script_s_length, - }; - f_string_dynamic_t * const parameters_value[] = { &main->path_build_documents, &main->path_build_includes, @@ -126,10 +108,10 @@ extern "C" { for (i = 0; i < 15; ++i) { - status = f_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); + status = f_string_dynamic_append_nulless(parameters_source[i], parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); return status; } @@ -144,7 +126,7 @@ extern "C" { &main->path_documents, }; - const uint8_t parameters_length[] = { + const uint8_t parameters_size[] = { 3, 3, 4, @@ -183,7 +165,7 @@ extern "C" { for (i = 0; i < 4; ++i) { - status = fake_path_generate_string_dynamic(main, *parameters_source[i], parameters_value[i], parameters_length[i]); + status = fake_path_generate_string_dynamic(main, *parameters_source[i], parameters_value[i], parameters_size[i]); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); @@ -203,7 +185,7 @@ extern "C" { } { - const f_string_t parameters_source[] = { + const f_string_static_t parameters_source[] = { fake_path_part_script_s, fake_path_part_shared_s, fake_path_part_static_s, @@ -212,25 +194,11 @@ extern "C" { fake_path_part_static_s, fake_file_defines_s, fake_file_dependencies_s, - main->fakefile.string, - main->settings.string, + main->fakefile, + main->settings, fake_file_readme_s, }; - const f_array_length_t parameters_length[] = { - fake_path_part_script_s_length, - fake_path_part_shared_s_length, - fake_path_part_static_s_length, - fake_path_part_script_s_length, - fake_path_part_shared_s_length, - fake_path_part_static_s_length, - fake_file_defines_s_length, - fake_file_dependencies_s_length, - main->fakefile.used, - main->settings.used, - fake_file_readme_s_length, - }; - f_string_dynamic_t * const parameters_value[] = { &main->path_build_libraries_script, &main->path_build_libraries_shared, @@ -247,10 +215,10 @@ extern "C" { for (i = 0; i < 11; ++i) { - status = f_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); + status = f_string_dynamic_append_nulless(parameters_source[i], parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); return status; } @@ -278,18 +246,12 @@ extern "C" { } { - const f_string_t parameters_source[] = { + const f_string_static_t parameters_source[] = { fake_path_part_includes_s, fake_path_part_libraries_s, fake_path_part_programs_s, }; - const f_array_length_t parameters_length[] = { - fake_path_part_includes_s_length, - fake_path_part_libraries_s_length, - fake_path_part_programs_s_length, - }; - f_string_dynamic_t * const parameters_value[] = { &main->path_work_includes, &main->path_work_libraries, @@ -298,10 +260,10 @@ extern "C" { for (i = 0; i < 3; ++i) { - status = f_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); + status = f_string_dynamic_append_nulless(parameters_source[i], parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); return status; } @@ -314,7 +276,7 @@ extern "C" { &main->path_work_programs, }; - const uint8_t parameters_length[] = { + const uint8_t parameters_size[] = { 3, 3, }; @@ -338,7 +300,7 @@ extern "C" { for (i = 0; i < 2; ++i) { - status = fake_path_generate_string_dynamic(main, *parameters_source[i], parameters_value[i], parameters_length[i]); + status = fake_path_generate_string_dynamic(main, *parameters_source[i], parameters_value[i], parameters_size[i]); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); @@ -349,7 +311,7 @@ extern "C" { } { - const f_string_t parameters_source[] = { + const f_string_static_t parameters_source[] = { fake_path_part_script_s, fake_path_part_shared_s, fake_path_part_static_s, @@ -358,15 +320,6 @@ extern "C" { fake_path_part_static_s, }; - const f_array_length_t parameters_length[] = { - fake_path_part_script_s_length, - fake_path_part_shared_s_length, - fake_path_part_static_s_length, - fake_path_part_script_s_length, - fake_path_part_shared_s_length, - fake_path_part_static_s_length, - }; - f_string_dynamic_t * const parameters_value[] = { &main->path_work_libraries_script, &main->path_work_libraries_shared, @@ -378,10 +331,10 @@ extern "C" { for (i = 0; i < 6; ++i) { - status = f_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); + status = f_string_dynamic_append_nulless(parameters_source[i], parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); return status; } diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index 3331ee0..492be6e 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -72,7 +72,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SFailed to find program '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QFailed to find program '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, program, main->error.notable); fl_print_format("%[' for executing.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -118,7 +118,7 @@ extern "C" { if (F_status_is_error(status)) { fll_error_file_print(main->error, F_status_set_fine(status), name_function, F_true, path_file, "allocate buffer size for", fll_error_file_type_file_e); - macro_f_string_dynamic_t_delete_simple((*buffer)); + f_string_dynamic_resize(0, buffer); return status; } @@ -144,7 +144,7 @@ extern "C" { if (F_status_is_error(status)) { fll_error_file_print(main->error, F_status_set_fine(status), name_function, F_true, path_file, "read", fll_error_file_type_file_e); - macro_f_string_dynamic_t_delete_simple((*buffer)); + f_string_dynamic_resize(0, buffer); } return status; @@ -165,24 +165,18 @@ extern "C" { fake_parameter_settings_e, }; - const f_string_t parameters_name[] = { + const f_string_static_t parameters_name[] = { fake_long_fakefile_s, fake_long_process_s, fake_long_settings_s, }; - const f_string_t parameter_defaults[] = { + const f_string_static_t parameter_defaults[] = { fake_default_fakefile_s, fake_default_process_s, fake_default_settings_s, }; - const f_array_length_t parameter_default_lengths[] = { - fake_default_fakefile_s_length, - fake_default_process_s_length, - fake_default_settings_s_length, - }; - f_string_dynamic_t * const parameters_value[] = { &main->fakefile, &main->process, @@ -210,7 +204,7 @@ extern "C" { } f_array_length_t location = main->parameters[parameters_id[i]].values.array[0]; - f_array_length_t length = strnlen(arguments->argv[location], f_console_parameter_size); + f_array_length_t length = strnlen(arguments->argv[location], F_console_parameter_size_d); if (length > 0) { if (parameters_validate_word[i]) { @@ -227,8 +221,8 @@ extern "C" { if (fll_error_print(main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SFailed to process the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_process_s, main->error.notable); + fl_print_format("%q%[%QFailed to process the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_process_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -241,8 +235,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_process_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_process_s, main->error.notable); fl_print_format("%[' parameters value '%]", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, arguments->argv[location], main->error.notable); fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -262,8 +256,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%S%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameters_name[i], main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%Q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameters_name[i], main->error.notable); fl_print_format("%[' is too long.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -284,25 +278,24 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%S%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameters_name[i], main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameters_name[i], main->error.notable); fl_print_format("%[' must not be empty and must not contain only whitespace.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); } } } - else if (parameter_default_lengths[i] > 0) { - macro_f_string_dynamic_t_resize(status, (*parameters_value[i]), parameter_default_lengths[i]); + else if (parameter_defaults[i].used) { + parameters_value[i]->used = 0; + + status = f_string_dynamic_append(parameter_defaults[i], parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "macro_f_string_dynamic_t_resize", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); return status; } - - memcpy(parameters_value[i]->string, parameter_defaults[i], parameter_default_lengths[i]); - parameters_value[i]->used = parameter_default_lengths[i]; } } // for } @@ -321,27 +314,20 @@ extern "C" { fake_parameter_path_work_e, }; - const f_string_t parameters_name[] = { + const f_string_static_t parameters_name[] = { fake_long_path_build_s, fake_long_path_data_s, fake_long_path_sources_s, fake_long_path_work_s, }; - const f_string_t parameter_defaults[] = { + const f_string_static_t parameter_defaults[] = { fake_default_path_build_s, fake_default_path_data_s, fake_default_path_sources_s, fake_default_path_work_s, }; - const f_array_length_t parameter_default_lengths[] = { - fake_default_path_build_s_length, - fake_default_path_data_s_length, - fake_default_path_sources_s_length, - fake_default_path_work_s_length, - }; - f_string_dynamic_t * const parameters_value[] = { &main->path_build, &main->path_data, @@ -369,8 +355,8 @@ extern "C" { if (fll_error_print(main->error, F_status_set_fine(status), "fl_console_parameter_to_string_dynamic_directory", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SFailed to process parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%S%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameters_name[i], main->error.notable); + fl_print_format("%q%[%QFailed to process parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameters_name[i], main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -379,15 +365,17 @@ extern "C" { return status; } } - else if (parameter_default_lengths[i] > 0) { - macro_f_string_dynamic_t_resize(status, (*parameters_value[i]), parameter_default_lengths[i]); + else if (parameter_defaults[i].used) { + parameters_value[i]->used = 0; + + status = f_string_dynamic_append(parameter_defaults[i], parameters_value[i]); if (F_status_is_error(status)) { - if (fll_error_print(main->error, F_status_set_fine(status), " macro_f_string_dynamic_t_resize", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet_e) { + if (fll_error_print(main->error, F_status_set_fine(status), " f_string_dynamic_append", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SFailed to load default for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%S%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameters_name[i], main->error.notable); + fl_print_format("%q%[%QFailed to load default for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameters_name[i], main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -395,9 +383,6 @@ extern "C" { return status; } - - memcpy(parameters_value[i]->string, parameter_defaults[i], parameter_default_lengths[i]); - parameters_value[i]->used = parameter_default_lengths[i]; } } // for } @@ -409,8 +394,8 @@ extern "C" { if (fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SFailed to process the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_define_s, main->error.notable); + fl_print_format("%q%[%QFailed to process the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_define_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -432,7 +417,7 @@ extern "C" { flockfile(main->error.to.stream); fl_print_format("%q%[%SFailed to process the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_mode_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_mode_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -457,8 +442,8 @@ extern "C" { if (fll_error_print(main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SFailed to process the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_mode_s, main->error.notable); + fl_print_format("%q%[%QFailed to process the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_mode_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -471,8 +456,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_mode_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_mode_s, main->error.notable); fl_print_format("%[' parameters value '%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_mode_s, main->error.notable); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, main->mode.array[i], main->error.notable); fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -551,24 +536,12 @@ extern "C" { return F_status_set_error(F_interrupt); } - const f_string_t parameters_name[] = { + const f_string_static_t parameters_name[] = { fake_long_path_build_s, fake_long_path_data_s, fake_long_path_work_s, }; - const f_string_t parameter_defaults[] = { - fake_default_path_build_s, - fake_default_path_data_s, - fake_default_path_work_s, - }; - - const f_array_length_t parameter_default_lengths[] = { - fake_default_path_build_s_length, - fake_default_path_data_s_length, - fake_default_path_work_s_length, - }; - const f_string_dynamic_t *parameters_value[] = { &main->path_build, &main->path_data, @@ -604,8 +577,8 @@ extern "C" { else if (parameters_required[i]) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SNo valid path for the (required) directory parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameters_name[i], main->error.notable); + fl_print_format("%q%[%QNo valid path for the (required) directory parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameters_name[i], main->error.notable); fl_print_format("%[' was found.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); diff --git a/level_3/fake/c/private-make-load_fakefile.c b/level_3/fake/c/private-make-load_fakefile.c index 9bc158c..3adef5a 100644 --- a/level_3/fake/c/private-make-load_fakefile.c +++ b/level_3/fake/c/private-make-load_fakefile.c @@ -34,7 +34,7 @@ extern "C" { if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { flockfile(data_make->main->warning.to.stream); - fl_print_format("%q%[%SThe fakefile '%]", data_make->main->warning.to.stream, f_string_eol_s, data_make->main->warning.context, data_make->main->warning.prefix, data_make->main->warning.context); + fl_print_format("%q%[%QThe fakefile '%]", data_make->main->warning.to.stream, f_string_eol_s, data_make->main->warning.context, data_make->main->warning.prefix, data_make->main->warning.context); fl_print_format("%[%Q%]", data_make->main->warning.to.stream, data_make->main->warning.notable, data_make->main->file_data_build_fakefile, data_make->main->warning.notable); fl_print_format("%[' is empty.%]%q", data_make->main->warning.to.stream, data_make->main->warning.context, data_make->main->warning.context, f_string_eol_s); @@ -88,12 +88,6 @@ extern "C" { f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, &fake_signal_state_interrupt_fss, 0, (void *) data_make->main, 0); - const f_string_static_t name_settings = macro_f_string_static_t_initialize(fake_make_section_settings_s, fake_make_section_settings_s_length); - const f_string_static_t name_main = macro_f_string_static_t_initialize(fake_make_section_main_s, fake_make_section_main_s_length); - - const f_string_range_t name_settings_range = macro_f_string_range_t_initialize(fake_make_section_settings_s_length); - const f_string_range_t name_main_range = macro_f_string_range_t_initialize(fake_make_section_main_s_length); - if (list_objects.used > data_make->fakefile.size) { macro_f_fss_nameds_t_resize((*status), data_make->fakefile, list_objects.used); } @@ -120,9 +114,9 @@ extern "C" { break; } - if (fl_string_dynamic_partial_compare(name_settings, data_make->buffer, name_settings_range, list_objects.array[i]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(fake_make_section_settings_s.string, data_make->buffer, fake_make_section_settings_s.used, list_objects.array[i]) == F_equal_to) { if (!missing_settings) { - fake_print_warning_settings_object_multiple(data_make->main, data_make->main->file_data_build_fakefile.string, "list", name_settings.string); + fake_print_warning_settings_object_multiple(data_make->main, data_make->main->file_data_build_fakefile, fake_common_setting_list_s, fake_make_section_settings_s); continue; } @@ -150,9 +144,9 @@ extern "C" { continue; } - else if (fl_string_dynamic_partial_compare(name_main, data_make->buffer, name_main_range, list_objects.array[i]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(fake_make_section_main_s.string, data_make->buffer, fake_make_section_main_s.used, list_objects.array[i]) == F_equal_to) { if (!missing_main) { - fake_print_warning_settings_object_multiple(data_make->main, data_make->main->file_data_build_fakefile.string, "list", name_main.string); + fake_print_warning_settings_object_multiple(data_make->main, data_make->main->file_data_build_fakefile, fake_common_setting_list_s, fake_make_section_main_s); continue; } @@ -201,10 +195,10 @@ extern "C" { if (data_make->main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(data_make->main->error.to.stream); - fl_print_format("%q%[%SThe fakefile '%]", data_make->main->error.to.stream, f_string_eol_s, data_make->main->error.context, data_make->main->error.prefix, data_make->main->error.context); + fl_print_format("%q%[%QThe fakefile '%]", data_make->main->error.to.stream, f_string_eol_s, data_make->main->error.context, data_make->main->error.prefix, data_make->main->error.context); fl_print_format("%[%Q%]", data_make->main->error.to.stream, data_make->main->error.notable, data_make->main->file_data_build_fakefile, data_make->main->error.notable); fl_print_format("%[' is missing the required '%]", data_make->main->error.to.stream, data_make->main->error.context, data_make->main->error.context); - fl_print_format("%[%s%]", data_make->main->error.to.stream, data_make->main->error.notable, fake_make_section_main_s, data_make->main->error.notable); + fl_print_format("%[%q%]", data_make->main->error.to.stream, data_make->main->error.notable, fake_make_section_main_s, data_make->main->error.notable); fl_print_format("%[' object.%]%q", data_make->main->error.to.stream, data_make->main->error.context, data_make->main->error.context, f_string_eol_s); funlockfile(data_make->main->error.to.stream); @@ -226,8 +220,8 @@ extern "C" { if (F_status_is_error_not(*status)) { data_make->setting_make.parameter.used = 1; - function_name = "f_string_append"; - *status = f_string_append(fake_make_setting_return_s, fake_make_setting_return_s_length, &data_make->setting_make.parameter.array[0].name); + function_name = "f_string_dynamic_append"; + *status = f_string_dynamic_append(fake_make_setting_return_s, &data_make->setting_make.parameter.array[0].name); } if (F_status_is_error_not(*status)) { @@ -267,23 +261,23 @@ extern "C" { for (f_array_length_t i = 0; i < settings.objects.used; ++i) { - if (fl_string_dynamic_partial_compare_string(fake_make_setting_load_build_s, data_make->buffer, fake_make_setting_load_build_s_length, settings.objects.array[i]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(fake_make_setting_load_build_s.string, data_make->buffer, fake_make_setting_load_build_s.used, settings.objects.array[i]) == F_equal_to) { fake_make_load_fakefile_setting_build(data_make, &settings.objects.array[i], &settings.contents.array[i], &unmatched_build); } - else if (fl_string_dynamic_partial_compare_string(fake_make_setting_compiler_s, data_make->buffer, fake_make_setting_compiler_s_length, settings.objects.array[i]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(fake_make_setting_compiler_s.string, data_make->buffer, fake_make_setting_compiler_s.used, settings.objects.array[i]) == F_equal_to) { fake_make_load_fakefile_setting_compiler(data_make, &settings.objects.array[i], &settings.contents.array[i], &range_compiler); } - else if (fl_string_dynamic_partial_compare_string(fake_make_setting_environment_s, data_make->buffer, fake_make_setting_environment_s_length, settings.objects.array[i]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(fake_make_setting_environment_s.string, data_make->buffer, fake_make_setting_environment_s.used, settings.objects.array[i]) == F_equal_to) { *status = fake_make_load_fakefile_setting_environment(data_make, &settings.contents.array[i]); if (F_status_is_error(*status)) break; } - else if (fl_string_dynamic_partial_compare_string(fake_make_setting_fail_s, data_make->buffer, fake_make_setting_fail_s_length, settings.objects.array[i]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(fake_make_setting_fail_s.string, data_make->buffer, fake_make_setting_fail_s.used, settings.objects.array[i]) == F_equal_to) { fake_make_load_fakefile_setting_fail(data_make, &settings.objects.array[i], &settings.contents.array[i], &unmatched_fail); } - else if (fl_string_dynamic_partial_compare_string(fake_make_setting_indexer_s, data_make->buffer, fake_make_setting_indexer_s_length, settings.objects.array[i]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(fake_make_setting_indexer_s.string, data_make->buffer, fake_make_setting_indexer_s.used, settings.objects.array[i]) == F_equal_to) { fake_make_load_fakefile_setting_indexer(data_make, &settings.objects.array[i], &settings.contents.array[i], &range_indexer); } - else if (fl_string_dynamic_partial_compare_string(fake_make_setting_parameter_s, data_make->buffer, fake_make_setting_parameter_s_length, settings.objects.array[i]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(fake_make_setting_parameter_s.string, data_make->buffer, fake_make_setting_parameter_s.used, settings.objects.array[i]) == F_equal_to) { *status = fake_make_load_fakefile_setting_parameter(data_make, &settings.objects.array[i], &settings.contents.array[i]); if (F_status_is_error(*status)) break; } @@ -347,29 +341,29 @@ extern "C" { if (*unmatched_build) { if (content->used) { - if (fl_string_dynamic_partial_compare_string(fake_common_setting_bool_yes_s, data_make->buffer, fake_common_setting_bool_yes_s_length, content->array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(fake_common_setting_bool_yes_s.string, data_make->buffer, fake_common_setting_bool_yes_s.used, content->array[0]) == F_equal_to) { data_make->setting_make.load_build = F_true; } - else if (fl_string_dynamic_partial_compare_string(fake_common_setting_bool_no_s, data_make->buffer, fake_common_setting_bool_no_s_length, content->array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(fake_common_setting_bool_no_s.string, data_make->buffer, fake_common_setting_bool_no_s.used, content->array[0]) == F_equal_to) { data_make->setting_make.load_build = F_false; } else { - fake_print_warning_settings_content_invalid(data_make->main, data_make->main->file_data_build_fakefile.string, data_make->buffer, *object, content->array[0], fake_make_section_settings_s); + fake_print_warning_settings_content_invalid(data_make->main, data_make->main->file_data_build_fakefile, data_make->buffer, *object, content->array[0], fake_make_section_settings_s); } *unmatched_build = F_false; if (content->used > 1) { - fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile.string, fake_make_setting_load_build_s); + fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile, fake_make_setting_load_build_s); } return; } - fake_print_warning_settings_content_empty(data_make->main, data_make->main->file_data_build_fakefile.string, data_make->buffer, *object, fake_make_section_settings_s); + fake_print_warning_settings_content_empty(data_make->main, data_make->main->file_data_build_fakefile, data_make->buffer, *object, fake_make_section_settings_s); } else { - fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile.string, fake_make_setting_load_build_s); + fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile, fake_make_setting_load_build_s); } } #endif // _di_fake_make_load_fakefile_setting_build_ @@ -378,7 +372,7 @@ extern "C" { void fake_make_load_fakefile_setting_compiler(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_compiler) { if (*range_compiler) { - fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile.string, fake_make_setting_compiler_s); + fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile, fake_make_setting_compiler_s); return; } @@ -387,11 +381,11 @@ extern "C" { *range_compiler = &content->array[0]; if (content->used > 1) { - fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile.string, fake_make_setting_compiler_s); + fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile, fake_make_setting_compiler_s); } } else { - fake_print_warning_settings_content_empty(data_make->main, data_make->main->file_data_build_fakefile.string, data_make->buffer, *object, fake_make_section_settings_s); + fake_print_warning_settings_content_empty(data_make->main, data_make->main->file_data_build_fakefile, data_make->buffer, *object, fake_make_section_settings_s); } } #endif // _di_fake_make_load_fakefile_setting_compiler_ @@ -406,22 +400,18 @@ extern "C" { fake_build_load_setting_process(main, F_false, main->file_data_build_fakefile.string, data_make->buffer, settings->objects, settings->contents, &data_make->setting_build, &status); if (F_status_is_error_not(status) && settings->objects.used) { - const f_string_t settings_name[] = { + const f_string_static_t settings_name[] = { fake_make_setting_define_s, fake_make_setting_parameter_s, }; - const f_array_length_t settings_length[] = { - fake_make_setting_define_s_length, - fake_make_setting_parameter_s_length, - }; f_string_map_multis_t *settings_value[] = { &define, &data_make->setting_make.parameter, }; - status = fll_fss_snatch_map_apart(data_make->buffer, settings->objects, settings->contents, settings_name, settings_length, 2, settings_value, 0, 0); + status = fll_fss_snatch_map_apart(data_make->buffer, settings->objects, settings->contents, settings_name, 2, settings_value, 0, 0); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_fss_snatch_map_apart", F_true); @@ -479,7 +469,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SInvalid characters in the define setting name '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QInvalid characters in the define setting name '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, define.array[i].name, main->error.notable); fl_print_format("%[', only alpha-numeric ASCII characters and underscore (without a leading digit) are allowed.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -492,10 +482,10 @@ extern "C" { } } // for - macro_f_string_dynamic_t_delete_simple(combined); + f_string_dynamic_resize(0, &combined); } - macro_f_string_map_multis_t_delete_simple(define); + f_string_map_multis_resize(0, &define); if (F_status_is_error(status)) return status; @@ -563,7 +553,7 @@ extern "C" { else if (data_make->main->warning.verbosity == f_console_verbosity_verbose_e) { flockfile(data_make->main->warning.to.stream); - fl_print_format("%q%[%SThe environment name '%]", data_make->main->warning.to.stream, f_string_eol_s, data_make->main->warning.context, data_make->main->warning.prefix, data_make->main->warning.context); + fl_print_format("%q%[%QThe environment name '%]", data_make->main->warning.to.stream, f_string_eol_s, data_make->main->warning.context, data_make->main->warning.prefix, data_make->main->warning.context); fl_print_format("%[%Q%]", data_make->main->warning.to.stream, data_make->main->warning.notable, name_define, data_make->main->warning.notable); fl_print_format("%[' is already added.%]%q", data_make->main->warning.to.stream, data_make->main->warning.context, data_make->main->warning.context, f_string_eol_s); @@ -573,7 +563,7 @@ extern "C" { else if (data_make->main->warning.verbosity == f_console_verbosity_verbose_e) { flockfile(data_make->main->warning.to.stream); - fl_print_format("%q%[%SThe environment name '%]", data_make->main->warning.to.stream, f_string_eol_s, data_make->main->warning.context, data_make->main->warning.prefix, data_make->main->warning.context); + fl_print_format("%q%[%QThe environment name '%]", data_make->main->warning.to.stream, f_string_eol_s, data_make->main->warning.context, data_make->main->warning.prefix, data_make->main->warning.context); fl_print_format("%[%Q%]", data_make->main->warning.to.stream, data_make->main->warning.notable, name_define, data_make->main->warning.notable); fl_print_format("%[' is invalid, ignoring.%]%q", data_make->main->warning.to.stream, data_make->main->warning.context, data_make->main->warning.context, f_string_eol_s); @@ -583,7 +573,7 @@ extern "C" { name_define.used = 0; } // for - macro_f_string_dynamic_t_delete_simple(name_define); + f_string_dynamic_resize(0, &name_define); if (F_status_is_error(status)) return status; @@ -596,21 +586,21 @@ extern "C" { if (*unmatched_fail) { if (content->used) { - if (fl_string_dynamic_partial_compare_string(fake_make_operation_argument_exit_s, data_make->buffer, fake_make_operation_argument_exit_s_length, content->array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(fake_make_operation_argument_exit_s.string, data_make->buffer, fake_make_operation_argument_exit_s.used, content->array[0]) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_type_exit_e; } - else if (fl_string_dynamic_partial_compare_string(fake_make_operation_argument_warn_s, data_make->buffer, fake_make_operation_argument_warn_s_length, content->array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(fake_make_operation_argument_warn_s.string, data_make->buffer, fake_make_operation_argument_warn_s.used, content->array[0]) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_type_warn_e; } - else if (fl_string_dynamic_partial_compare_string(fake_make_operation_argument_ignore_s, data_make->buffer, fake_make_operation_argument_ignore_s_length, content->array[0]) == F_equal_to) { + else if (fl_string_dynamic_partial_compare_string(fake_make_operation_argument_ignore_s.string, data_make->buffer, fake_make_operation_argument_ignore_s.used, content->array[0]) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_type_ignore_e; } else { - fake_print_warning_settings_content_invalid(data_make->main, data_make->main->file_data_build_fakefile.string, data_make->buffer, *object, content->array[0], fake_make_section_settings_s); + fake_print_warning_settings_content_invalid(data_make->main, data_make->main->file_data_build_fakefile, data_make->buffer, *object, content->array[0], fake_make_section_settings_s); } if (content->used > 1) { - fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile.string, fake_make_setting_fail_s); + fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile, fake_make_setting_fail_s); } *unmatched_fail = F_false; @@ -618,10 +608,10 @@ extern "C" { return; } - fake_print_warning_settings_content_empty(data_make->main, data_make->main->file_data_build_fakefile.string, data_make->buffer, *object, fake_make_section_settings_s); + fake_print_warning_settings_content_empty(data_make->main, data_make->main->file_data_build_fakefile, data_make->buffer, *object, fake_make_section_settings_s); } else { - fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile.string, fake_make_setting_fail_s); + fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile, fake_make_setting_fail_s); } } #endif // _di_fake_make_load_fakefile_setting_fail_ @@ -630,7 +620,7 @@ extern "C" { void fake_make_load_fakefile_setting_indexer(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_indexer) { if (*range_indexer) { - fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile.string, fake_make_setting_indexer_s); + fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile, fake_make_setting_indexer_s); return; } @@ -639,11 +629,11 @@ extern "C" { *range_indexer = &content->array[0]; if (content->used > 1) { - fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile.string, fake_make_setting_indexer_s); + fake_print_warning_settings_content_multiple(data_make->main, data_make->main->file_data_build_fakefile, fake_make_setting_indexer_s); } } else { - fake_print_warning_settings_content_empty(data_make->main, data_make->main->file_data_build_fakefile.string, data_make->buffer, *object, fake_make_section_settings_s); + fake_print_warning_settings_content_empty(data_make->main, data_make->main->file_data_build_fakefile, data_make->buffer, *object, fake_make_section_settings_s); } } #endif // _di_fake_make_load_fakefile_setting_indexer_ @@ -654,7 +644,7 @@ extern "C" { if (content->used) { f_status_t status = F_none; - if (fl_string_dynamic_partial_compare_string(fake_make_setting_return_s, data_make->buffer, fake_make_setting_return_s_length, content->array[0]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(fake_make_setting_return_s.string, data_make->buffer, fake_make_setting_return_s.used, content->array[0]) == F_equal_to) { if (content->used > 1) { // Each "return" define replaces the previous "return" define. @@ -692,7 +682,7 @@ extern "C" { } } else { - fake_print_warning_settings_content_empty(data_make->main, data_make->main->file_data_build_fakefile.string, data_make->buffer, *object, fake_make_section_settings_s); + fake_print_warning_settings_content_empty(data_make->main, data_make->main->file_data_build_fakefile, data_make->buffer, *object, fake_make_section_settings_s); } return F_none; diff --git a/level_3/fake/c/private-make-load_parameters.c b/level_3/fake/c/private-make-load_parameters.c index 2caf0d8..c8d1f33 100644 --- a/level_3/fake/c/private-make-load_parameters.c +++ b/level_3/fake/c/private-make-load_parameters.c @@ -146,7 +146,7 @@ extern "C" { } { - const f_string_t parameter[] = { + const f_string_static_t parameter[] = { fake_short_define_s, fake_short_mode_s, }; @@ -217,17 +217,13 @@ extern "C" { } if (F_status_is_error_not(*status)) { - *status = f_string_append(parameter[i], 1, &destination[i]->array[destination[i]->used]); + *status = f_string_dynamic_append(parameter[i], &destination[i]->array[destination[i]->used]); } - if (F_status_is_error(*status)) { - fll_error_print(data_make->main->error, F_status_set_fine(*status), "f_string_append", F_true); - - return; + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append(destination[i]->array[destination[i]->used], &destination_option[i]->array[destination_option[i]->used]); } - *status = f_string_dynamic_append(destination[i]->array[destination[i]->used], &destination_option[i]->array[destination_option[i]->used]); - if (F_status_is_error(*status)) { fll_error_print(data_make->main->error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); @@ -264,7 +260,7 @@ extern "C" { } { - const f_string_t parameter[] = { + const f_string_static_t parameter[] = { fake_short_fakefile_s, fake_short_path_build_s, fake_short_path_data_s, @@ -360,17 +356,13 @@ extern "C" { } if (F_status_is_error_not(*status)) { - *status = f_string_append(parameter[i], 1, &destination[i]->array[destination[i]->used]); + *status = f_string_dynamic_append(parameter[i], &destination[i]->array[destination[i]->used]); } - if (F_status_is_error(*status)) { - fll_error_print(data_make->main->error, F_status_set_fine(*status), "f_string_append", F_true); - - return; + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append(destination[i]->array[destination[i]->used], &destination_option[i]->array[destination_option[i]->used]); } - *status = f_string_dynamic_append(destination[i]->array[destination[i]->used], &destination_option[i]->array[destination_option[i]->used]); - if (F_status_is_error(*status)) { fll_error_print(data_make->main->error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); diff --git a/level_3/fake/c/private-make-operate.c b/level_3/fake/c/private-make-operate.c index 53aa306..10b3408 100644 --- a/level_3/fake/c/private-make-operate.c +++ b/level_3/fake/c/private-make-operate.c @@ -118,7 +118,7 @@ extern "C" { if (F_status_is_error(status_path) && main->warning.verbosity == f_console_verbosity_verbose_e) { flockfile(main->warning.to.stream); - fl_print_format("%q%[%SFailed change back to orignal path '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%q%[%QFailed change back to orignal path '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); fl_print_format("%[%Q%]", main->warning.to.stream, main->warning.notable, data_make.path.stack.array[0], main->warning.notable); fl_print_format("%[', status code =%] ", main->warning.to.stream, main->warning.context, main->warning.context); fl_print_format("%[%ui%]", main->warning.to.stream, main->warning.notable, F_status_set_fine(status_path), main->warning.notable); @@ -130,7 +130,7 @@ extern "C" { f_file_stream_close(F_true, &data_make.path.top); - macro_f_array_lengths_t_delete_simple(section_stack) + f_type_array_lengths_resize(0, §ion_stack); macro_fake_make_data_t_delete_simple(data_make) return status; @@ -182,7 +182,7 @@ extern "C" { f_array_length_t used_content = 0; - const f_string_t reserved_name[] = { + const f_string_static_t reserved_name[] = { fake_make_parameter_variable_build_s, fake_make_parameter_variable_color_s, fake_make_parameter_variable_data_s, @@ -218,42 +218,6 @@ extern "C" { fake_make_parameter_variable_value_work_s, }; - const f_array_length_t reserved_length[] = { - fake_make_parameter_variable_build_s_length, - fake_make_parameter_variable_color_s_length, - fake_make_parameter_variable_data_s_length, - fake_make_parameter_variable_define_s_length, - fake_make_parameter_variable_fakefile_s_length, - fake_make_parameter_variable_mode_s_length, - fake_make_parameter_variable_process_s_length, - fake_make_parameter_variable_settings_s_length, - fake_make_parameter_variable_sources_s_length, - fake_make_parameter_variable_verbosity_s_length, - fake_make_parameter_variable_work_s_length, - fake_make_parameter_variable_build_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_color_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_data_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_define_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_fakefile_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_mode_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_process_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_settings_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_sources_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_verbosity_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_work_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_build_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_color_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_data_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_define_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_fakefile_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_mode_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_process_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_settings_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_sources_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_verbosity_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_work_s_length + fake_make_parameter_iki_value_s_length, - }; - f_string_dynamics_t * const reserved_value[] = { &data_make->parameter.build, &data_make->parameter.color, @@ -362,7 +326,7 @@ extern "C" { unmatched = F_true; // Check against reserved parameter names and if matches use them instead. - if (fl_string_dynamic_partial_compare_string(fake_make_parameter_variable_return_s, data_make->buffer, fake_make_parameter_variable_return_s_length, iki_content.array[j]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(fake_make_parameter_variable_return_s.string, data_make->buffer, fake_make_parameter_variable_return_s.used, iki_content.array[j]) == F_equal_to) { if (data_make->setting_make.parameter.array[0].value.array[0].used) { *status = f_string_dynamic_append_nulless(data_make->setting_make.parameter.array[0].value.array[0], &arguments->array[arguments->used]); @@ -387,7 +351,7 @@ extern "C" { else { for (k = 0; k < 33; ++k) { - if (fl_string_dynamic_partial_compare_string(reserved_name[k], data_make->buffer, reserved_length[k], iki_content.array[j]) != F_equal_to) { + if (fl_string_dynamic_partial_compare_string(reserved_name[k].string, data_make->buffer, reserved_name[k].used, iki_content.array[j]) != F_equal_to) { continue; } @@ -613,18 +577,12 @@ extern "C" { bool unmatched = F_true; { - const f_string_t uint8_name[] = { + const f_string_static_t uint8_name[] = { fake_build_setting_name_build_language_s, fake_build_setting_name_version_file_s, fake_build_setting_name_version_target_s, }; - const f_array_length_t uint8_length[] = { - fake_build_setting_name_build_language_s_length, - fake_build_setting_name_version_file_s_length, - fake_build_setting_name_version_target_s_length, - }; - const uint8_t uint8_value[] = { data_make->setting_build.build_language, data_make->setting_build.version_file, @@ -633,19 +591,20 @@ extern "C" { for (uint8_t i = 0; i < 3; ++i) { - status = fl_string_dynamic_partial_compare_string(uint8_name[i], data_make->buffer, uint8_length[i], range_name); + status = fl_string_dynamic_partial_compare_string(uint8_name[i].string, data_make->buffer, uint8_name[i].used, range_name); if (status == F_equal_to) { unmatched = F_false; status = f_conversion_number_unsigned_to_string(uint8_value[i], f_conversion_data_base_10_s, &value); + break; } } // for } if (unmatched) { - const f_string_t bool_name[] = { + const f_string_static_t bool_name[] = { fake_build_setting_name_build_script_s, fake_build_setting_name_build_shared_s, fake_build_setting_name_build_static_s, @@ -655,16 +614,6 @@ extern "C" { fake_build_setting_name_search_static_s, }; - const f_array_length_t bool_length[] = { - fake_build_setting_name_build_script_s_length, - fake_build_setting_name_build_shared_s_length, - fake_build_setting_name_build_static_s_length, - fake_build_setting_name_path_standard_s_length, - fake_build_setting_name_search_exclusive_s_length, - fake_build_setting_name_search_shared_s_length, - fake_build_setting_name_search_static_s_length, - }; - const bool bool_value[] = { data_make->setting_build.build_script, data_make->setting_build.build_shared, @@ -677,16 +626,16 @@ extern "C" { for (uint8_t i = 0; i < 7; ++i) { - status = fl_string_dynamic_partial_compare_string(bool_name[i], data_make->buffer, bool_length[i], range_name); + status = fl_string_dynamic_partial_compare_string(bool_name[i].string, data_make->buffer, bool_name[i].used, range_name); if (status == F_equal_to) { unmatched = F_false; if (bool_value[i]) { - status = f_string_append(fake_common_setting_bool_yes_s, fake_common_setting_bool_yes_s_length, &value); + status = f_string_dynamic_append(fake_common_setting_bool_yes_s, &value); } else { - status = f_string_append(fake_common_setting_bool_no_s, fake_common_setting_bool_no_s_length, &value); + status = f_string_dynamic_append(fake_common_setting_bool_no_s, &value); } break; @@ -695,7 +644,7 @@ extern "C" { } if (unmatched) { - const f_string_t dynamic_name[] = { + const f_string_static_t dynamic_name[] = { fake_build_setting_name_build_compiler_s, fake_build_setting_name_build_indexer_s, fake_build_setting_name_path_headers_s, @@ -715,26 +664,6 @@ extern "C" { fake_build_setting_name_version_minor_s, }; - const f_array_length_t dynamic_length[] = { - fake_build_setting_name_build_compiler_s_length, - fake_build_setting_name_build_indexer_s_length, - fake_build_setting_name_path_headers_s_length, - fake_build_setting_name_path_language_s_length, - fake_build_setting_name_path_library_script_s_length, - fake_build_setting_name_path_library_shared_s_length, - fake_build_setting_name_path_library_static_s_length, - fake_build_setting_name_path_program_script_s_length, - fake_build_setting_name_path_program_shared_s_length, - fake_build_setting_name_path_program_static_s_length, - fake_build_setting_name_path_sources_s_length, - fake_build_setting_name_process_post_s_length, - fake_build_setting_name_process_pre_s_length, - fake_build_setting_name_project_name_s_length, - fake_build_setting_name_version_major_s_length, - fake_build_setting_name_version_micro_s_length, - fake_build_setting_name_version_minor_s_length, - }; - const f_string_dynamic_t dynamic_value[] = { data_make->setting_build.build_compiler, data_make->setting_build.build_indexer, @@ -757,19 +686,20 @@ extern "C" { for (uint8_t i = 0; i < 17; ++i) { - status = fl_string_dynamic_partial_compare_string(dynamic_name[i], data_make->buffer, dynamic_length[i], range_name); + status = fl_string_dynamic_partial_compare_string(dynamic_name[i].string, data_make->buffer, dynamic_name[i].used, range_name); if (status == F_equal_to) { unmatched = F_false; status = f_string_dynamic_append(dynamic_value[i], &value); + break; } } // for } if (unmatched) { - const f_string_t dynamics_name[] = { + const f_string_static_t dynamics_name[] = { fake_build_setting_name_build_libraries_s, fake_build_setting_name_build_libraries_shared_s, fake_build_setting_name_build_libraries_static_s, @@ -807,44 +737,6 @@ extern "C" { fake_build_setting_name_modes_default_s, }; - const f_array_length_t dynamics_length[] = { - fake_build_setting_name_build_libraries_s_length, - fake_build_setting_name_build_libraries_shared_s_length, - fake_build_setting_name_build_libraries_static_s_length, - fake_build_setting_name_build_sources_headers_s_length, - fake_build_setting_name_build_sources_headers_shared_s_length, - fake_build_setting_name_build_sources_headers_static_s_length, - fake_build_setting_name_build_sources_library_s_length, - fake_build_setting_name_build_sources_library_shared_s_length, - fake_build_setting_name_build_sources_library_static_s_length, - fake_build_setting_name_build_sources_program_s_length, - fake_build_setting_name_build_sources_program_shared_s_length, - fake_build_setting_name_build_sources_program_static_s_length, - fake_build_setting_name_build_sources_settings_s_length, - fake_build_setting_name_build_sources_script_s_length, - fake_build_setting_name_defines_s_length, - fake_build_setting_name_defines_library_s_length, - fake_build_setting_name_defines_library_shared_s_length, - fake_build_setting_name_defines_library_static_s_length, - fake_build_setting_name_defines_program_s_length, - fake_build_setting_name_defines_program_shared_s_length, - fake_build_setting_name_defines_program_static_s_length, - fake_build_setting_name_defines_shared_s_length, - fake_build_setting_name_defines_static_s_length, - fake_build_setting_name_environment_length_s, - fake_build_setting_name_flags_s_length, - fake_build_setting_name_flags_library_s_length, - fake_build_setting_name_flags_library_shared_s_length, - fake_build_setting_name_flags_library_static_s_length, - fake_build_setting_name_flags_program_s_length, - fake_build_setting_name_flags_program_shared_s_length, - fake_build_setting_name_flags_program_static_s_length, - fake_build_setting_name_flags_shared_s_length, - fake_build_setting_name_flags_static_s_length, - fake_build_setting_name_modes_s_length, - fake_build_setting_name_modes_default_s_length, - }; - const f_string_dynamics_t dynamics_value[] = { data_make->setting_build.build_libraries, data_make->setting_build.build_libraries_shared, @@ -885,7 +777,7 @@ extern "C" { for (uint8_t i = 0; i < 35; ++i) { - status = fl_string_dynamic_partial_compare_string(dynamics_name[i], data_make->buffer, dynamics_length[i], range_name); + status = fl_string_dynamic_partial_compare_string(dynamics_name[i].string, data_make->buffer, dynamics_name[i].used, range_name); if (status == F_equal_to) { unmatched = F_false; @@ -902,13 +794,13 @@ extern "C" { } if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(value); + f_string_dynamic_resize(0, &value); return status; } if (unmatched) { - macro_f_string_dynamic_t_delete_simple(value); + f_string_dynamic_resize(0, &value); return F_false; } @@ -932,7 +824,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(value); + f_string_dynamic_resize(0, &value); if (F_status_is_error(status)) return status; @@ -946,7 +838,7 @@ extern "C" { f_status_t status = F_none; const f_string_static_t *context = 0; - const f_string_t context_name[] = { + const f_string_static_t context_name[] = { fake_make_context_reset_s, fake_make_context_warning_s, fake_make_context_error_s, @@ -958,18 +850,6 @@ extern "C" { fake_make_context_normal_s, }; - const f_array_length_t context_length[] = { - fake_make_context_reset_s_length, - fake_make_context_warning_s_length, - fake_make_context_error_s_length, - fake_make_context_title_s_length, - fake_make_context_notable_s_length, - fake_make_context_important_s_length, - fake_make_context_standout_s_length, - fake_make_context_success_s_length, - fake_make_context_normal_s_length, - }; - const f_color_set_t context_value[] = { data_make->main->context.set.reset, data_make->main->context.set.warning, @@ -984,7 +864,7 @@ extern "C" { for (f_array_length_t i = 0; i < 9; ++i) { - if (fl_string_dynamic_partial_compare_string(context_name[i], data_make->buffer, context_length[i], range_name) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(context_name[i].string, data_make->buffer, context_name[i].used, range_name) == F_equal_to) { context = context_value[i].before; break; @@ -1034,16 +914,17 @@ extern "C" { status = f_environment_get(name.string, &value); - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); } if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(value); + f_string_dynamic_resize(0, &value); return status; } - else if (status == F_exist_not) { - macro_f_string_dynamic_t_delete_simple(value); + + if (status == F_exist_not) { + f_string_dynamic_resize(0, &value); return F_false; } @@ -1067,7 +948,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(value); + f_string_dynamic_resize(0, &value); if (F_status_is_error(status)) return status; @@ -1117,7 +998,7 @@ extern "C" { return 0; } - const f_string_t operations_name[] = { + const f_string_static_t operations_name[] = { fake_make_operation_and_s, fake_make_operation_break_s, fake_make_operation_build_s, @@ -1154,43 +1035,6 @@ extern "C" { fake_make_operation_touch_s, }; - const f_array_length_t operations_length[] = { - fake_make_operation_and_s_length, - fake_make_operation_break_s_length, - fake_make_operation_build_s_length, - fake_make_operation_clean_s_length, - fake_make_operation_clone_s_length, - fake_make_operation_compile_s_length, - fake_make_operation_copy_s_length, - fake_make_operation_define_s_length, - fake_make_operation_delete_s_length, - fake_make_operation_deletes_s_length, - fake_make_operation_else_s_length, - fake_make_operation_exit_s_length, - fake_make_operation_fail_s_length, - fake_make_operation_group_s_length, - fake_make_operation_groups_s_length, - fake_make_operation_if_s_length, - fake_make_operation_index_s_length, - fake_make_operation_link_s_length, - fake_make_operation_mode_s_length, - fake_make_operation_modes_s_length, - fake_make_operation_move_s_length, - fake_make_operation_operate_s_length, - fake_make_operation_or_s_length, - fake_make_operation_owner_s_length, - fake_make_operation_owners_s_length, - fake_make_operation_parameter_s_length, - fake_make_operation_pop_s_length, - fake_make_operation_print_s_length, - fake_make_operation_run_s_length, - fake_make_operation_shell_s_length, - fake_make_operation_skeleton_s_length, - fake_make_operation_to_s_length, - fake_make_operation_top_s_length, - fake_make_operation_touch_s_length, - }; - const uint8_t operations_type[] = { fake_make_operation_type_and_e, fake_make_operation_type_break_e, @@ -1258,7 +1102,7 @@ extern "C" { for (j = 0; j < fake_make_operation_total_d; ++j) { - if (fl_string_dynamic_partial_compare_string(operations_name[j], data_make->buffer, operations_length[j], section->objects.array[i]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(operations_name[j].string, data_make->buffer, operations_name[j].used, section->objects.array[i]) == F_equal_to) { state_process.operation = operations_type[j]; break; @@ -1496,13 +1340,13 @@ extern "C" { if (data_make->main->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SIncomplete '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QIncomplete '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); if (state_process.block == fake_state_process_block_else_e) { - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_else_s, data_make->error.notable); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_else_s, data_make->error.notable); } else { - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); } fl_print_format("%[' at end of section.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); diff --git a/level_3/fake/c/private-make-operate_process.c b/level_3/fake/c/private-make-operate_process.c index 43c6325..9c79cc4 100644 --- a/level_3/fake/c/private-make-operate_process.c +++ b/level_3/fake/c/private-make-operate_process.c @@ -75,10 +75,10 @@ extern "C" { } if (state_process->operation == fake_make_operation_type_break_e) { - if (!arguments.used || fl_string_dynamic_compare_string(fake_make_operation_argument_success_s, arguments.array[0], fake_make_operation_argument_success_s_length) == F_equal_to) { + if (!arguments.used || fl_string_dynamic_compare(fake_make_operation_argument_success_s, arguments.array[0]) == F_equal_to) { *status = F_signal_abort; } - else if (fl_string_dynamic_compare_string(fake_make_operation_argument_failure_s, arguments.array[0], fake_make_operation_argument_failure_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(fake_make_operation_argument_failure_s, arguments.array[0]) == F_equal_to) { *status = F_status_set_error(F_signal_abort); } else { @@ -89,7 +89,7 @@ extern "C" { flockfile(data_make->main->output.to.stream); fl_print_format("%qBreaking as '", data_make->main->output.to.stream, f_string_eol_s); - fl_print_format("%[%S%]", data_make->main->output.to.stream, data_make->main->context.set.notable, arguments.used ? arguments.array[0].string : fake_make_operation_argument_success_s, data_make->main->context.set.notable); + fl_print_format("%[%Q%]", data_make->main->output.to.stream, data_make->main->context.set.notable, arguments.used ? arguments.array[0] : fake_make_operation_argument_success_s, data_make->main->context.set.notable); fl_print_format("'.%q", data_make->main->output.to.stream, f_string_eol_s); funlockfile(data_make->main->output.to.stream); @@ -190,10 +190,10 @@ extern "C" { } if (state_process->operation == fake_make_operation_type_exit_e) { - if (!arguments.used || fl_string_dynamic_compare_string(fake_make_operation_argument_success_s, arguments.array[0], fake_make_operation_argument_success_s_length) == F_equal_to) { + if (!arguments.used || fl_string_dynamic_compare(fake_make_operation_argument_success_s, arguments.array[0]) == F_equal_to) { *status = F_signal_quit; } - else if (fl_string_dynamic_compare_string(fake_make_operation_argument_failure_s, arguments.array[0], fake_make_operation_argument_failure_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(fake_make_operation_argument_failure_s, arguments.array[0]) == F_equal_to) { *status = F_status_set_error(F_signal_quit); // Forcing exit forces fail mode. @@ -211,7 +211,7 @@ extern "C" { } if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { - fll_print_format("%qExiting as '%[%S%]'.%q", data_make->main->output.to.stream, f_string_eol_s, data_make->main->context.set.notable, arguments.used ? arguments.array[0].string : fake_make_operation_argument_success_s, data_make->main->context.set.notable, f_string_eol_s); + fll_print_format("%qExiting as '%[%Q%]'.%q", data_make->main->output.to.stream, f_string_eol_s, data_make->main->context.set.notable, arguments.used ? arguments.array[0] : fake_make_operation_argument_success_s, data_make->main->context.set.notable, f_string_eol_s); } return 0; @@ -574,7 +574,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SFailed to find program '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QFailed to find program '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, program, data_make->error.notable); fl_print_format("%[' for executing.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -650,7 +650,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SFailed with return code %]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QFailed with return code %]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%i%]", data_make->error.to.stream, data_make->error.notable, return_code, data_make->error.notable); fl_print_format("%[.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); diff --git a/level_3/fake/c/private-make-operate_process_type.c b/level_3/fake/c/private-make-operate_process_type.c index 5864314..02fb628 100644 --- a/level_3/fake/c/private-make-operate_process_type.c +++ b/level_3/fake/c/private-make-operate_process_type.c @@ -108,7 +108,7 @@ extern "C" { else if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { flockfile(data_make->main->output.to.stream); - fl_print_format("%q%s '%[%Q%]' to '", data_make->main->output.to.stream, f_string_eol_s, clone ? "Cloned" : "Copied", data_make->main->context.set.notable, arguments.array[i], data_make->main->context.set.notable); + fl_print_format("%q%q '%[%Q%]' to '", data_make->main->output.to.stream, f_string_eol_s, clone ? "Cloned" : "Copied", data_make->main->context.set.notable, arguments.array[i], data_make->main->context.set.notable); fl_print_format("%[%S%]'.%q", data_make->main->output.to.stream, f_string_eol_s, data_make->main->context.set.notable, destination, data_make->main->context.set.notable, f_string_eol_s); funlockfile(data_make->main->output.to.stream); @@ -146,7 +146,7 @@ extern "C" { if (data_make->main->warning.verbosity == f_console_verbosity_verbose_e) { flockfile(data_make->main->warning.to.stream); - fl_print_format("%q%[%SThe file '%]", data_make->main->warning.to.stream, data_make->main->warning.prefix, f_string_eol_s); + fl_print_format("%q%[%QThe file '%]", data_make->main->warning.to.stream, data_make->main->warning.prefix, f_string_eol_s); fl_print_format("%[%Q%]", data_make->main->warning.to.stream, data_make->main->warning.notable, arguments.array[i], data_make->main->warning.notable); fl_print_format("%[' cannot be found.%]%q", data_make->main->warning.to.stream, f_string_eol_s); @@ -216,7 +216,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_fail_ void fake_make_operate_process_type_fail(fake_make_data_t * const data_make, const f_string_dynamics_t arguments) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_exit_s, arguments.array[0], fake_make_operation_argument_exit_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(fake_make_operation_argument_exit_s, arguments.array[0]) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_type_exit_e; data_make->error.prefix = fl_print_error_s; data_make->error.suffix = f_string_empty_s; @@ -226,7 +226,7 @@ extern "C" { data_make->error.to.id = F_type_descriptor_error_d; data_make->error.set = &data_make->main->context.set; } - else if (fl_string_dynamic_compare_string(fake_make_operation_argument_warn_s, arguments.array[0], fake_make_operation_argument_warn_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(fake_make_operation_argument_warn_s, arguments.array[0]) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_type_warn_e; data_make->error.prefix = fl_print_warning_s; data_make->error.suffix = f_string_empty_s; @@ -248,13 +248,13 @@ extern "C" { f_print_terminated("Set failure state to '", data_make->main->output.to.stream); if (data_make->setting_make.fail == fake_make_operation_fail_type_exit_e) { - fl_print_format("%[%s%]", data_make->main->output.to.stream, data_make->main->context.set.notable, fake_make_operation_argument_exit_s, data_make->main->context.set.notable); + fl_print_format("%[%q%]", data_make->main->output.to.stream, data_make->main->context.set.notable, fake_make_operation_argument_exit_s, data_make->main->context.set.notable); } else if (data_make->setting_make.fail == fake_make_operation_fail_type_warn_e) { - fl_print_format("%[%s%]", data_make->main->output.to.stream, data_make->main->context.set.notable, fake_make_operation_argument_warn_s, data_make->main->context.set.notable); + fl_print_format("%[%q%]", data_make->main->output.to.stream, data_make->main->context.set.notable, fake_make_operation_argument_warn_s, data_make->main->context.set.notable); } else { - fl_print_format("%[%s%]", data_make->main->output.to.stream, data_make->main->context.set.notable, fake_make_operation_argument_ignore_s, data_make->main->context.set.notable); + fl_print_format("%[%q%]", data_make->main->output.to.stream, data_make->main->context.set.notable, fake_make_operation_argument_ignore_s, data_make->main->context.set.notable); } fl_print_format("'.%q", data_make->main->output.to.stream, f_string_eol_s); @@ -302,7 +302,7 @@ extern "C" { else if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { flockfile(data_make->main->output.to.stream); - fl_print_format("%s group of '%[%s%]", data_make->main->output.to.stream, all ? "Recursively changed" : "Changed", data_make->main->context.set.notable, arguments.array[i], data_make->main->context.set.notable); + fl_print_format("%q group of '%[%q%]", data_make->main->output.to.stream, all ? "Recursively changed" : "Changed", data_make->main->context.set.notable, arguments.array[i], data_make->main->context.set.notable); fl_print_format("' to %[%ul%].%q", data_make->main->output.to.stream, data_make->main->context.set.notable, id, data_make->main->context.set.notable, f_string_eol_s); funlockfile(data_make->main->output.to.stream); @@ -318,7 +318,7 @@ extern "C" { const f_string_static_t argument = if_not ? arguments.array[2] : arguments.array[1]; - const f_string_t reserved_name[] = { + const f_string_static_t reserved_name[] = { fake_make_parameter_variable_build_s, fake_make_parameter_variable_color_s, fake_make_parameter_variable_data_s, @@ -354,42 +354,6 @@ extern "C" { fake_make_parameter_variable_value_work_s, }; - const f_array_length_t reserved_length[] = { - fake_make_parameter_variable_build_s_length, - fake_make_parameter_variable_color_s_length, - fake_make_parameter_variable_data_s_length, - fake_make_parameter_variable_define_s_length, - fake_make_parameter_variable_fakefile_s_length, - fake_make_parameter_variable_mode_s_length, - fake_make_parameter_variable_process_s_length, - fake_make_parameter_variable_settings_s_length, - fake_make_parameter_variable_sources_s_length, - fake_make_parameter_variable_verbosity_s_length, - fake_make_parameter_variable_work_s_length, - fake_make_parameter_variable_build_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_color_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_data_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_define_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_fakefile_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_mode_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_process_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_settings_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_sources_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_verbosity_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_work_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_build_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_color_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_data_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_define_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_fakefile_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_mode_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_process_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_settings_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_sources_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_verbosity_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_work_s_length + fake_make_parameter_iki_value_s_length, - }; - const bool reserved_defined[] = { data_make->main->path_build.used, F_true, @@ -426,7 +390,7 @@ extern "C" { data_make->parameter_value.work.used, }; - if (fl_string_dynamic_compare_string(fake_make_operation_argument_environment_s, argument, fake_make_operation_argument_environment_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(fake_make_operation_argument_environment_s, argument) == F_equal_to) { state_process->condition_result = fake_condition_result_true_e; if (if_not) { @@ -466,7 +430,7 @@ extern "C" { for (j = 0; j < 33; ++j) { - if (fl_string_dynamic_compare_string(reserved_name[j], arguments.array[i], reserved_length[j]) == F_equal_to) { + if (fl_string_dynamic_compare(reserved_name[j], arguments.array[i]) == F_equal_to) { result = reserved_defined[j] ? 2 : 1; break; @@ -567,31 +531,31 @@ extern "C" { for (; i < arguments.used; ++i) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_if_is_for_s, arguments.array[i], fake_make_operation_argument_if_is_for_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(fake_make_operation_argument_if_is_for_s, arguments.array[i]) == F_equal_to) { ++i; break; } - if (fl_string_dynamic_compare_string(F_file_type_name_block_s, arguments.array[i], F_file_type_name_block_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(f_file_type_name_block_s, arguments.array[i]) == F_equal_to) { type |= 0x1; } - else if (fl_string_dynamic_compare_string(F_file_type_name_character_s, arguments.array[i], F_file_type_name_character_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_character_s, arguments.array[i]) == F_equal_to) { type |= 0x2; } - else if (fl_string_dynamic_compare_string(F_file_type_name_directory_s, arguments.array[i], F_file_type_name_directory_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_directory_s, arguments.array[i]) == F_equal_to) { type |= 0x4; } - else if (fl_string_dynamic_compare_string(F_file_type_name_fifo_s, arguments.array[i], F_file_type_name_fifo_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_fifo_s, arguments.array[i]) == F_equal_to) { type |= 0x8; } - else if (fl_string_dynamic_compare_string(F_file_type_name_link_s, arguments.array[i], F_file_type_name_link_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_link_s, arguments.array[i]) == F_equal_to) { type |= 0x10; } - else if (fl_string_dynamic_compare_string(F_file_type_name_regular_s, arguments.array[i], F_file_type_name_regular_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_regular_s, arguments.array[i]) == F_equal_to) { type |= 0x20; } - else if (fl_string_dynamic_compare_string(F_file_type_name_socket_s, arguments.array[i], F_file_type_name_socket_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_socket_s, arguments.array[i]) == F_equal_to) { type |= 0x40; } } // for @@ -792,12 +756,12 @@ extern "C" { flockfile(data_make->error.to.stream); if ((i == 1 && number_left > F_number_t_size_unsigned_d) || (i > 1 && number_right > F_number_t_size_unsigned_d)) { - fl_print_format("%q%[%SThe number '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QThe number '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[i], data_make->error.notable); fl_print_format("%[' may only be between the ranges -%un to %un.%]%q", data_make->error.to.stream, data_make->error.context, F_number_t_size_unsigned_d, F_number_t_size_unsigned_d, data_make->error.context, f_string_eol_s); } else { - fl_print_format("%q%[%SInvalid or unsupported number provided '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QInvalid or unsupported number provided '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[i], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, F_number_t_size_unsigned_d, F_number_t_size_unsigned_d, data_make->error.context, f_string_eol_s); } @@ -867,7 +831,7 @@ extern "C" { mode_t mode_match = 0; bool is = F_false; - if (fl_string_dynamic_compare_string(fake_make_operation_argument_is_s, arguments.array[if_not ? 2 : 1], fake_make_operation_argument_is_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(fake_make_operation_argument_is_s, arguments.array[if_not ? 2 : 1]) == F_equal_to) { is = F_true; } @@ -1402,7 +1366,7 @@ extern "C" { for (f_array_length_t i = 1; i < arguments.used; ++i) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_file_s, arguments.array[0], fake_make_operation_argument_file_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(fake_make_operation_argument_file_s, arguments.array[0]) == F_equal_to) { status = f_file_touch(arguments.array[i].string, mode.regular, F_false); if (F_status_is_error(status)) { @@ -1416,7 +1380,7 @@ extern "C" { break; } } - else if (fl_string_dynamic_compare_string(fake_make_operation_argument_directory_s, arguments.array[0], fake_make_operation_argument_directory_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(fake_make_operation_argument_directory_s, arguments.array[0]) == F_equal_to) { status = f_directory_touch(arguments.array[i].string, mode.directory); if (F_status_is_error(status)) { diff --git a/level_3/fake/c/private-make-operate_validate.c b/level_3/fake/c/private-make-operate_validate.c index 22bf69e..b094001 100644 --- a/level_3/fake/c/private-make-operate_validate.c +++ b/level_3/fake/c/private-make-operate_validate.c @@ -29,8 +29,8 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SNo indexer has been specified, cannot perform '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_index_s, data_make->error.notable); + fl_print_format("%q%[%QNo indexer has been specified, cannot perform '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_index_s, data_make->error.notable); fl_print_format("%[' section operation.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); funlockfile(data_make->error.to.stream); @@ -50,13 +50,13 @@ extern "C" { *status = F_status_set_error(F_failure); } else if (arguments.used) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_success_s, arguments.array[0], fake_make_operation_argument_success_s_length) == F_equal_to_not) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_failure_s, arguments.array[0], fake_make_operation_argument_failure_s_length) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_success_s, arguments.array[0]) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_failure_s, arguments.array[0]) == F_equal_to_not) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SUnsupported break type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QUnsupported break type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[0], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -92,7 +92,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%S%]", data_make->error.to.stream, data_make->error.notable, path_file, data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -109,8 +109,8 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SThe file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, path_file, data_make->error.notable); + fl_print_format("%q%[%QThe file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%S%]", data_make->error.to.stream, data_make->error.notable, path_file, data_make->error.notable); fl_print_format("%[' must be a regular file.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); funlockfile(data_make->error.to.stream); @@ -121,7 +121,7 @@ extern "C" { } else { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { - fll_print_format("%q%[%SFilename argument must not be an empty string.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); + fll_print_format("%q%[QFilename argument must not be an empty string.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); } *status = F_status_set_error(F_failure); @@ -141,7 +141,7 @@ extern "C" { if (data_make->path.stack.used == 1) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { - fll_print_format("%q%[%SMust not attempt to pop project root off of path stack.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); + fll_print_format("%q%[%QMust not attempt to pop project root off of path stack.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); } *status = F_status_set_error(F_failure); @@ -172,7 +172,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[i], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -192,7 +192,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[arguments.used - 1], data_make->error.notable); fl_print_format("%[' must be a valid directory.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -218,7 +218,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[1], data_make->error.notable); fl_print_format("%[' must be a valid directory.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -249,8 +249,8 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SNo compiler has been specified, cannot perform '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_compile_s, data_make->error.notable); + fl_print_format("%q%[%QNo compiler has been specified, cannot perform '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_compile_s, data_make->error.notable); fl_print_format("%[' section operation.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); funlockfile(data_make->error.to.stream); @@ -283,7 +283,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[i], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -303,7 +303,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[arguments.used - 1], data_make->error.notable); fl_print_format("%[' must be a valid directory.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -329,7 +329,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[1], data_make->error.notable); fl_print_format("%[' must be a valid directory.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -356,7 +356,7 @@ extern "C" { if (*status == F_none) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { - fll_print_format("%q%[%SDefine name must not be an empty string.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); + fll_print_format("%q%[%QDefine name must not be an empty string.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); } *status = F_status_set_error(F_failure); @@ -365,7 +365,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SInvalid characters in the define setting name '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QInvalid characters in the define setting name '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[0], data_make->error.notable); fl_print_format("%[', only alpha-numeric ASCII characters and underscore (without a leading digit) is allowed.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -413,8 +413,8 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SMust not be used immediately after another '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_else_s, data_make->error.notable); + fl_print_format("%q%[%QMust not be used immediately after another '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_else_s, data_make->error.notable); fl_print_format("%[' section operation.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); funlockfile(data_make->error.to.stream); @@ -429,12 +429,12 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SMust not be used immediately after an '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); + fl_print_format("%q%[%QMust not be used immediately after an '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); fl_print_format("%[', '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); fl_print_format("%[', or '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); fl_print_format("%[' section operation.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); funlockfile(data_make->error.to.stream); @@ -447,12 +447,12 @@ extern "C" { if (!state_process->block) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { - fl_print_format("%q%[%SHas no preceding '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); + fl_print_format("%q%[%QHas no preceding '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); fl_print_format("%[', '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); fl_print_format("%[', or '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); fl_print_format("%[' section operation.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); } @@ -477,12 +477,12 @@ extern "C" { *status = F_status_set_error(F_failure); } else if (arguments.used) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_success_s, arguments.array[0], fake_make_operation_argument_success_s_length) == F_equal_to_not) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_failure_s, arguments.array[0], fake_make_operation_argument_failure_s_length) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_success_s, arguments.array[0]) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_failure_s, arguments.array[0]) == F_equal_to_not) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SUnsupported exit type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QUnsupported exit type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[0], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -499,13 +499,13 @@ extern "C" { if (state_process->operation == fake_make_operation_type_fail_e) { if (arguments.used) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_exit_s, arguments.array[0], fake_make_operation_argument_exit_s_length) == F_equal_to_not) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_warn_s, arguments.array[0], fake_make_operation_argument_warn_s_length) == F_equal_to_not) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_ignore_s, arguments.array[0], fake_make_operation_argument_ignore_s_length) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_exit_s, arguments.array[0]) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_warn_s, arguments.array[0]) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_ignore_s, arguments.array[0]) == F_equal_to_not) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SUnsupported fail type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QUnsupported fail type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[0], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -538,7 +538,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[i], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -572,12 +572,12 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SMust not be used immediately after another '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); + fl_print_format("%q%[%QMust not be used immediately after another '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); fl_print_format("%[', '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); fl_print_format("%[', or '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); fl_print_format("%[' section operation.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); funlockfile(data_make->error.to.stream); @@ -593,12 +593,12 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SMay only be used immediately after another '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); + fl_print_format("%q%[%QMay only be used immediately after another '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); fl_print_format("%[', '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); fl_print_format("%[', or '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); fl_print_format("%[' section operation.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); funlockfile(data_make->error.to.stream); @@ -611,7 +611,7 @@ extern "C" { } if (arguments.used) { - const f_string_t if_type_strings[] = { + const f_string_static_t if_type_strings[] = { fake_make_operation_argument_if_defined_s, fake_make_operation_argument_if_equal_s, fake_make_operation_argument_if_equal_not_s, @@ -635,30 +635,6 @@ extern "C" { fake_make_operation_argument_if_success_s, }; - const f_array_length_t if_type_lengths[] = { - fake_make_operation_argument_if_defined_s_length, - fake_make_operation_argument_if_equal_s_length, - fake_make_operation_argument_if_equal_not_s_length, - fake_make_operation_argument_if_exists_s_length, - fake_make_operation_argument_if_failure_s_length, - fake_make_operation_argument_if_greater_s_length, - fake_make_operation_argument_if_greater_equal_s_length, - fake_make_operation_argument_if_group_s_length, - fake_make_operation_argument_if_is_s_length, - fake_make_operation_argument_if_less_s_length, - fake_make_operation_argument_if_less_equal_s_length, - fake_make_operation_argument_if_mode_s_length, - fake_make_operation_argument_if_not_s_length, - fake_make_operation_argument_if_defined_s_length, // if not defined, represented by just "defined". - fake_make_operation_argument_if_exists_s_length, // if not exists, represented by just "exists". - fake_make_operation_argument_if_group_s_length, // if not group, represented by just "group". - fake_make_operation_argument_if_is_s_length, // if not is, represented by just "is". - fake_make_operation_argument_if_mode_s_length, // if not mode, represented by just "mode". - fake_make_operation_argument_if_owner_s_length, // if not owner, represented by just "owner". - fake_make_operation_argument_if_owner_s_length, - fake_make_operation_argument_if_success_s_length, - }; - const uint8_t if_type_codes[] = { fake_make_operation_if_type_if_defined_e, fake_make_operation_if_type_if_equal_e, @@ -707,7 +683,7 @@ extern "C" { 1, // If success. }; - const f_string_t if_not_type_strings[] = { + const f_string_static_t if_not_type_strings[] = { fake_make_operation_argument_if_defined_s, fake_make_operation_argument_if_exists_s, fake_make_operation_argument_if_group_s, @@ -716,15 +692,6 @@ extern "C" { fake_make_operation_argument_if_owner_s, }; - const f_array_length_t if_not_type_lengths[] = { - fake_make_operation_argument_if_defined_s_length, - fake_make_operation_argument_if_exists_s_length, - fake_make_operation_argument_if_group_s_length, - fake_make_operation_argument_if_is_s_length, - fake_make_operation_argument_if_mode_s_length, - fake_make_operation_argument_if_owner_s_length, - }; - const uint8_t if_not_type_codes[] = { fake_make_operation_if_type_if_not_defined_e, fake_make_operation_if_type_if_not_exists_e, @@ -745,7 +712,7 @@ extern "C" { f_array_length_t i = 0; f_array_length_t j = 0; - f_string_t if_and_or; + f_string_static_t if_and_or; if (state_process->operation == fake_make_operation_type_and_e) { if_and_or = fake_make_operation_and_s; @@ -762,7 +729,7 @@ extern "C" { // Skip the "if not XXX" types as they are determined later on. if (i > 12 && i < 19) continue; - if (fl_string_dynamic_compare_string(if_type_strings[i], arguments.array[0], if_type_lengths[i]) == F_equal_to) { + if (fl_string_dynamic_compare(if_type_strings[i], arguments.array[0]) == F_equal_to) { state_process->condition = if_type_codes[i]; break; @@ -773,8 +740,8 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SUnsupported '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, if_and_or, data_make->error.notable); + fl_print_format("%q%[%QUnsupported '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, if_and_or, data_make->error.notable); fl_print_format("%[' type '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[0], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -799,7 +766,7 @@ extern "C" { for (; j < 6; ++j) { - if (fl_string_dynamic_compare_string(if_not_type_strings[j], arguments.array[1], if_not_type_lengths[j]) == F_equal_to) { + if (fl_string_dynamic_compare(if_not_type_strings[j], arguments.array[1]) == F_equal_to) { state_process->condition = if_not_type_codes[j]; break; @@ -810,8 +777,8 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SUnsupported '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, if_and_or, data_make->error.notable); + fl_print_format("%q%[%QUnsupported '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%q%]", data_make->error.to.stream, data_make->error.notable, if_and_or, data_make->error.notable); fl_print_format("%[' not type '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[1], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -842,12 +809,12 @@ extern "C" { } if (state_process->condition == fake_make_operation_if_type_if_defined_e || state_process->condition == fake_make_operation_if_type_if_not_defined_e) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_environment_s, j == 6 ? arguments.array[1] : arguments.array[2], fake_make_operation_argument_environment_s_length) == F_equal_to_not) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_parameter_s, j == 6 ? arguments.array[1] : arguments.array[2], fake_make_operation_argument_parameter_s_length) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_environment_s, j == 6 ? arguments.array[1] : arguments.array[2]) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_parameter_s, j == 6 ? arguments.array[1] : arguments.array[2]) == F_equal_to_not) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SUnsupported define type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QUnsupported define type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, j == 6 ? arguments.array[1] : arguments.array[2], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -875,12 +842,12 @@ extern "C" { else if (state_process->condition == fake_make_operation_if_type_if_group_e || state_process->condition == fake_make_operation_if_type_if_is_e || state_process->condition == fake_make_operation_if_type_if_mode_e || state_process->condition > fake_make_operation_if_type_if_not_exists_e && state_process->condition < fake_make_operation_if_type_if_success_e) { if (state_process->condition == fake_make_operation_if_type_if_mode_e || state_process->condition == fake_make_operation_if_type_if_not_mode_e) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_is_s, arguments.array[1], fake_make_operation_argument_is_s_length) == F_equal_to_not) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_has_s, arguments.array[1], fake_make_operation_argument_has_s_length) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_is_s, arguments.array[1]) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_has_s, arguments.array[1]) == F_equal_to_not) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SUnsupported %smode type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, j == 6 ? "" : "not ", data_make->error.context); + fl_print_format("%q%[%QUnsupported %smode type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, j == 6 ? "" : "not ", data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[1], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -919,38 +886,38 @@ extern "C" { for (i = j == 6 ? 1 : 2; i < arguments.used; ++i) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_if_is_for_s, arguments.array[i], fake_make_operation_argument_if_is_for_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(fake_make_operation_argument_if_is_for_s, arguments.array[i]) == F_equal_to) { ++i; break; } - if (fl_string_dynamic_compare_string(F_file_type_name_block_s, arguments.array[i], F_file_type_name_block_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(f_file_type_name_block_s, arguments.array[i]) == F_equal_to) { type_file |= 0x1; } - else if (fl_string_dynamic_compare_string(F_file_type_name_character_s, arguments.array[i], F_file_type_name_character_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_character_s, arguments.array[i]) == F_equal_to) { type_file |= 0x2; } - else if (fl_string_dynamic_compare_string(F_file_type_name_directory_s, arguments.array[i], F_file_type_name_directory_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_directory_s, arguments.array[i]) == F_equal_to) { type_file |= 0x4; } - else if (fl_string_dynamic_compare_string(F_file_type_name_fifo_s, arguments.array[i], F_file_type_name_fifo_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_fifo_s, arguments.array[i]) == F_equal_to) { type_file |= 0x8; } - else if (fl_string_dynamic_compare_string(F_file_type_name_link_s, arguments.array[i], F_file_type_name_link_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_link_s, arguments.array[i]) == F_equal_to) { type_file |= 0x10; } - else if (fl_string_dynamic_compare_string(F_file_type_name_regular_s, arguments.array[i], F_file_type_name_regular_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_regular_s, arguments.array[i]) == F_equal_to) { type_file |= 0x20; } - else if (fl_string_dynamic_compare_string(F_file_type_name_socket_s, arguments.array[i], F_file_type_name_socket_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(f_file_type_name_socket_s, arguments.array[i]) == F_equal_to) { type_file |= 0x40; } else { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SUnsupported file type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QUnsupported file type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[i], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -1060,12 +1027,12 @@ extern "C" { flockfile(data_make->error.to.stream); if (number > F_number_t_size_unsigned_d) { - fl_print_format("%q%[%SThe number '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QThe number '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[i], data_make->error.notable); fl_print_format("%[' may only be between the ranges -%un to %un.%]%q", data_make->error.to.stream, data_make->error.context, F_number_t_size_unsigned_d, F_number_t_size_unsigned_d, data_make->error.context, f_string_eol_s); } else { - fl_print_format("%q%[%SInvalid or unsupported number provided '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QInvalid or unsupported number provided '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[i], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); } @@ -1144,7 +1111,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[i], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -1164,7 +1131,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[arguments.used - 1], data_make->error.notable); fl_print_format("%[' must be a valid directory.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -1190,7 +1157,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[arguments.used - 1], data_make->error.notable); fl_print_format("%[' must be a valid directory.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -1230,7 +1197,7 @@ extern "C" { if (id_section == data_make->fakefile.used) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SNo operation section named '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QNo operation section named '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[0], data_make->error.notable); fl_print_format("%[' was found.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -1243,7 +1210,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SThe section operation '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QThe section operation '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, data_make->fakefile.array[id_section].name, data_make->error.notable); fl_print_format("%[' is already in the operation stack, recursion is not allowed.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -1267,7 +1234,7 @@ extern "C" { if (state_process->operation == fake_make_operation_type_parameter_e) { if (arguments.used) { - const f_string_t reserved_name[] = { + const f_string_static_t reserved_name[] = { fake_make_parameter_variable_build_s, fake_make_parameter_variable_color_s, fake_make_parameter_variable_data_s, @@ -1303,46 +1270,10 @@ extern "C" { fake_make_parameter_variable_value_work_s, }; - const f_array_length_t reserved_length[] = { - fake_make_parameter_variable_build_s_length, - fake_make_parameter_variable_color_s_length, - fake_make_parameter_variable_data_s_length, - fake_make_parameter_variable_define_s_length, - fake_make_parameter_variable_fakefile_s_length, - fake_make_parameter_variable_mode_s_length, - fake_make_parameter_variable_process_s_length, - fake_make_parameter_variable_settings_s_length, - fake_make_parameter_variable_sources_s_length, - fake_make_parameter_variable_verbosity_s_length, - fake_make_parameter_variable_work_s_length, - fake_make_parameter_variable_build_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_color_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_data_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_define_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_fakefile_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_mode_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_process_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_settings_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_sources_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_verbosity_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_work_s_length + fake_make_parameter_iki_option_s_length, - fake_make_parameter_variable_build_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_color_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_data_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_define_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_fakefile_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_mode_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_process_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_settings_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_sources_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_verbosity_s_length + fake_make_parameter_iki_value_s_length, - fake_make_parameter_variable_work_s_length + fake_make_parameter_iki_value_s_length, - }; - for (f_array_length_t i = 0; i < 33; ++i) { - if (fl_string_dynamic_compare_string(reserved_name[i], arguments.array[0], reserved_length[i]) == F_equal_to) { - fll_print_format("%q%[%SCannot assign a value to the parameter name '%s' because it is a reserved parameter name.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); + if (fl_string_dynamic_compare(reserved_name[i], arguments.array[0]) == F_equal_to) { + fll_print_format("%q%[%QCannot assign a value to the parameter name '%q' because it is a reserved parameter name.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, reserved_name[i], data_make->error.context, f_string_eol_s); *status = F_status_set_error(F_failure); @@ -1373,7 +1304,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[0], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -1393,7 +1324,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SThe file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QThe file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[0], data_make->error.notable); fl_print_format("%[' must be a directory file.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -1405,7 +1336,7 @@ extern "C" { } else { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { - fll_print_format("%q%[%SFilename argument must not be an empty string.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); + fll_print_format("%q%[%QFilename argument must not be an empty string.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); } } } @@ -1420,13 +1351,13 @@ extern "C" { if (state_process->operation == fake_make_operation_type_touch_e) { if (arguments.used > 1) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_file_s, arguments.array[0], fake_make_operation_argument_file_s_length) == F_equal_to_not) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_directory_s, arguments.array[0], fake_make_operation_argument_directory_s_length) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_file_s, arguments.array[0]) == F_equal_to_not) { + if (fl_string_dynamic_compare(fake_make_operation_argument_directory_s, arguments.array[0]) == F_equal_to_not) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%q%[%SUnsupported file type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%q%[%QUnsupported file type '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[0], data_make->error.notable); fl_print_format("%['.%]%q", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -1455,12 +1386,9 @@ extern "C" { *status = F_status_set_error(F_failure); } - - return; } // Note: there is nothing to validate for fake_make_operation_type_print_e. - return; } #endif // _di_fake_make_operate_validate_ diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index 7178c52..3eadb13 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -71,7 +71,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe group name '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe group name '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, buffer, main->error.notable); fl_print_format("%[' was not found.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -91,7 +91,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe number '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe number '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%un%]", main->error.to.stream, main->error.notable, number, main->error.notable); fl_print_format("%[' is too large.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -120,7 +120,7 @@ extern "C" { if (F_status_set_fine(status) == F_syntax) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe mode '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe mode '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, buffer, main->error.notable); fl_print_format("%[' is invalid.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -162,7 +162,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe user '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe user '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, buffer, main->error.notable); fl_print_format("%[' was not found.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -182,7 +182,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe number '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe number '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%un%]", main->error.to.stream, main->error.notable, number, main->error.notable); fl_print_format("%[' is too large.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); diff --git a/level_3/fake/c/private-print.c b/level_3/fake/c/private-print.c index 0975689..72223b3 100644 --- a/level_3/fake/c/private-print.c +++ b/level_3/fake/c/private-print.c @@ -11,16 +11,23 @@ extern "C" { #endif #ifndef _di_fake_print_error_build_operation_file_ - bool fake_print_error_build_operation_file(fake_main_t * const main, const f_status_t status, const f_string_t function, const f_string_t operation, const f_string_t how, const f_string_t source, const f_string_t destination, const bool fallback) { + bool fake_print_error_build_operation_file(fake_main_t * const main, const f_status_t status, const f_string_t function, const f_string_static_t operation, const f_string_t how, const f_string_t source, const f_string_t destination, const bool fallback) { if (status == F_file_found_not) { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SFailed to find '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, f_file_exists(source) == F_true ? destination : source, main->error.notable); - fl_print_format("%[while trying to %S '%]", main->error.to.stream, main->error.context, operation, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%q%[%QFailed to find '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, f_file_exists(source) == F_true ? destination : source, main->error.notable); + } + + fl_print_format("%[while trying to %Q '%]", main->error.to.stream, main->error.context, operation, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' %S '%]", main->error.to.stream, main->error.context, how, main->error.context); @@ -39,10 +46,13 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SInvalid parameter when calling '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QInvalid parameter when calling '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, function, main->error.notable); - fl_print_format("%[() to %s '%]", main->error.to.stream, main->error.context, operation, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%[() to %Q '%]", main->error.to.stream, main->error.context, operation, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' %S '%]", main->error.to.stream, main->error.context, how, main->error.context); @@ -61,8 +71,11 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SInvalid name for '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%q%[%QInvalid name for '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' or '%]", main->error.to.stream, main->error.context, main->error.context); @@ -81,8 +94,11 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SUnable to allocate memory, while trying to %S '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%q%[%QUnable to allocate memory, while trying to %Q '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' %S '%]", main->error.to.stream, main->error.context, how, main->error.context); @@ -101,8 +117,11 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SOverflow while trying to %S '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%q%[%QOverflow while trying to %Q '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' %S '%]", main->error.to.stream, main->error.context, how, main->error.context); @@ -121,8 +140,11 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SInvalid directory while trying to %S '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%q%[%QInvalid directory while trying to %Q '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' %S '%]", main->error.to.stream, main->error.context, how, main->error.context); @@ -141,8 +163,11 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SAccess denied while trying to %S '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%q%[%QAccess denied while trying to %Q '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' %S '%]", main->error.to.stream, main->error.context, how, main->error.context); @@ -161,8 +186,11 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SLoop while trying to %S '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%q%[%QLoop while trying to %Q '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' %S '%]", main->error.to.stream, main->error.context, how, main->error.context); @@ -181,8 +209,11 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SProhibited by system while trying to %S '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%q%[%QProhibited by system while trying to %Q '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' %S '%]", main->error.to.stream, main->error.context, how, main->error.context); @@ -201,8 +232,11 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SFailed to %S '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%q%[%QFailed to %Q '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' %S '%]", main->error.to.stream, main->error.context, how, main->error.context); @@ -221,8 +255,11 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SFailed to %S '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%q%[%QFailed to %Q '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' %S '%]", main->error.to.stream, main->error.context, how, main->error.context); @@ -240,10 +277,13 @@ extern "C" { if (fll_error_print(main->error, status, function, F_false) == F_known_not && fallback && main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[UNKNOWN %s(%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, operation, main->error.context); + fl_print_format("%q%[UNKNOWN %Q(%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%ui%]", main->error.to.stream, main->error.notable, status, main->error.notable); - fl_print_format("%[) occurred while trying to %S '%]", main->error.to.stream, main->error.context, operation, main->error.context); - fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + fl_print_format("%[) occurred while trying to %Q '%]", main->error.to.stream, main->error.context, operation, main->error.context); + + if (source) { + fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, source, main->error.notable); + } if (destination) { fl_print_format("%[' %S '%]", main->error.to.stream, main->error.context, how, main->error.context); @@ -266,7 +306,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SOccurred on invalid UTF-8 character at stop position (at '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QOccurred on invalid UTF-8 character at stop position (at '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%un%]", main->error.to.stream, main->error.notable, range.start, main->error.notable); fl_print_format("%[ of setting file '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, path_file, main->error.notable); @@ -282,7 +322,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SOccurred on invalid UTF-8 character at %s (at '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, status == F_complete_not_utf_eos ? "end of string" : "stop point of string", main->error.context); + fl_print_format("%q%[%QOccurred on invalid UTF-8 character at %s (at '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, status == F_complete_not_utf_eos ? "end of string" : "stop point of string", main->error.context); fl_print_format("%[%un%]", main->error.to.stream, main->error.notable, range.start, main->error.notable); fl_print_format("%[ of setting file '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, path_file, main->error.notable); @@ -298,7 +338,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SOccurred on invalid UTF-8 character at stop point of string (at '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QOccurred on invalid UTF-8 character at stop point of string (at '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%un%]", main->error.to.stream, main->error.notable, range.start, main->error.notable); fl_print_format("%[ of setting file '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, path_file, main->error.notable); @@ -313,7 +353,7 @@ extern "C" { if (fll_error_print(main->error, status, function, F_false) == F_known_not && fallback && main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[UNKNOWN %s(%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[UNKNOWN %Q(%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%ui%]", main->error.to.stream, main->error.notable, status, main->error.notable); fl_print_format("%[) in function '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, function, main->error.notable); @@ -327,14 +367,14 @@ extern "C" { #endif // _di_fake_print_error_fss #ifndef _di_fake_print_error_parameter_missing_value_ - void fake_print_error_parameter_missing_value(fake_main_t * const main, const f_string_t parameter) { + void fake_print_error_parameter_missing_value(fake_main_t * const main, const f_string_static_t parameter) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%S%S%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -342,14 +382,14 @@ extern "C" { #endif // _di_fake_print_error_parameter_missing_value_ #ifndef _di_fake_print_error_parameter_too_many_ - void fake_print_error_parameter_too_many(fake_main_t * const main, const f_string_t parameter) { + void fake_print_error_parameter_too_many(fake_main_t * const main, const f_string_static_t parameter) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%S%S%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter, main->error.notable); fl_print_format("%[' was specified too many times.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -362,7 +402,7 @@ extern "C" { if (data_make->error.verbosity == f_console_verbosity_quiet_e) return; if (!data_make->error.to.stream) return; - fll_print_format("%q%[%SRequires more arguments.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); + fll_print_format("%q%[%QRequires more arguments.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); } #endif // _di_fake_print_error_requires_more_arguments_ @@ -372,7 +412,7 @@ extern "C" { if (data_make->error.verbosity == f_console_verbosity_quiet_e) return; if (!data_make->error.to.stream) return; - fll_print_format("%q%[%SHas too many arguments.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); + fll_print_format("%q%[%QHas too many arguments.%]%q", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s); } #endif // _di_fake_print_error_too_many_arguments_ @@ -387,7 +427,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe section operation '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe section operation '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%/Q%]", main->error.to.stream, main->error.notable, buffer, operation_name, main->error.notable); fl_print_format("%[' from section '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%/Q%]", main->error.to.stream, main->error.notable, buffer, section_name, main->error.notable); @@ -407,7 +447,7 @@ extern "C" { flockfile(main->error.to.stream); if (F_status_set_fine(status) == F_false) { - fl_print_format("%q%[%SThe path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, path, main->error.notable); fl_print_format("%[' is outside the project root.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); } @@ -427,7 +467,7 @@ extern "C" { if (status == F_array_too_large) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SMaximum stack size reached while processing path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QMaximum stack size reached while processing path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, path, main->error.notable); fl_print_format("%['", main->error.to.stream, main->error.context); @@ -457,7 +497,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe section operation '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe section operation '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%/Q%]", main->error.to.stream, main->error.notable, buffer, operation_name, main->error.notable); fl_print_format("%[' from section '%]", main->error.to.stream, main->error.context, buffer, main->error.context); fl_print_format("%[%/Q%]", main->error.to.stream, main->error.notable, buffer, section_name, main->error.notable); @@ -504,7 +544,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); @@ -513,16 +553,16 @@ extern "C" { #endif // _di_fake_print_signal_received_ #ifndef _di_fake_print_warning_settings_content_empty_ - void fake_print_warning_settings_content_empty(fake_main_t * const main, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_t settings_name) { + void fake_print_warning_settings_content_empty(fake_main_t * const main, const f_string_static_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_static_t settings_name) { if (main->warning.verbosity == f_console_verbosity_quiet_e) return; flockfile(main->warning.to.stream); - fl_print_format("%q%[%SThe fakefile '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); + fl_print_format("%q%[%QThe fakefile '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%[%Q%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); fl_print_format("%[' has empty content for the '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, settings_name, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, settings_name, main->warning.notable); fl_print_format("%[' object '%]", main->warning.to.stream, main->warning.context, main->warning.context); fl_print_format("%[%/Q%]", main->warning.to.stream, main->warning.notable, buffer, range_object, main->warning.notable); fl_print_format("%['.%]%q", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); @@ -532,18 +572,18 @@ extern "C" { #endif // _di_fake_print_warning_settings_content_empty_ #ifndef _di_fake_print_warning_settings_content_invalid_ - void fake_print_warning_settings_content_invalid(fake_main_t * const main, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_range_t range_content, const f_string_t settings_name) { + void fake_print_warning_settings_content_invalid(fake_main_t * const main, const f_string_static_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_range_t range_content, const f_string_static_t settings_name) { if (main->warning.verbosity == f_console_verbosity_quiet_e) return; flockfile(main->warning.to.stream); - fl_print_format("%q%[%SThe fakefile '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); + fl_print_format("%q%[%QThe fakefile '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%[%Q%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); fl_print_format("%[' has invalid content '%]", main->warning.to.stream, main->warning.context, main->warning.context); fl_print_format("%[%/Q%]", main->warning.to.stream, main->warning.notable, buffer, range_content, main->warning.notable); fl_print_format("%[' for the '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, settings_name, main->warning.notable); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, settings_name, main->warning.notable); fl_print_format("%[' object '%]", main->warning.to.stream, main->warning.context, main->warning.context); fl_print_format("%[%/Q%]", main->warning.to.stream, main->warning.notable, buffer, range_object, main->warning.notable); fl_print_format("%['.%]%q", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); @@ -553,16 +593,16 @@ extern "C" { #endif // _di_fake_print_warning_settings_content_invalid_ #ifndef _di_fake_print_warning_settings_content_multiple_ - void fake_print_warning_settings_content_multiple(fake_main_t * const main, const f_string_t path_file, const f_string_t name_object) { + void fake_print_warning_settings_content_multiple(fake_main_t * const main, const f_string_static_t path_file, const f_string_static_t name_object) { if (main->warning.verbosity == f_console_verbosity_quiet_e) return; flockfile(main->warning.to.stream); - fl_print_format("%q%[%SThe fakefile '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, name_object, main->warning.notable); + fl_print_format("%q%[%QThe fakefile '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, name_object, main->warning.notable); fl_print_format("%[' in the file '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); + fl_print_format("%[%Q%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); fl_print_format("%[' may only have a single property, only using the first.%]%q", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); @@ -570,16 +610,16 @@ extern "C" { #endif // _di_fake_print_warning_settings_content_multiple_ #ifndef _di_fake_print_warning_settings_object_multiple_ - void fake_print_warning_settings_object_multiple(fake_main_t * const main, const f_string_t path_file, const f_string_t label, const f_string_t name_object) { + void fake_print_warning_settings_object_multiple(fake_main_t * const main, const f_string_static_t path_file, const f_string_static_t label, const f_string_static_t name_object) { if (main->warning.verbosity == f_console_verbosity_quiet_e) return; flockfile(main->warning.to.stream); - fl_print_format("%q%[%SThe object '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, name_object, main->warning.notable); + fl_print_format("%q%[%QThe object '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%[%q%]", main->warning.to.stream, main->warning.notable, name_object, main->warning.notable); fl_print_format("%[' in the file '%]", main->warning.to.stream, main->warning.context, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); + fl_print_format("%[%Q%]", main->warning.to.stream, main->warning.notable, path_file, main->warning.notable); fl_print_format("%[' may only be specified once, only using the first.%]%q", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); diff --git a/level_3/fake/c/private-print.h b/level_3/fake/c/private-print.h index 81c96b4..4543084 100644 --- a/level_3/fake/c/private-print.h +++ b/level_3/fake/c/private-print.h @@ -46,7 +46,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fake_print_error_operation_file_ - extern bool fake_print_error_build_operation_file(fake_main_t * const main, const f_status_t status, const f_string_t function, const f_string_t operation, const f_string_t source, const f_string_t destination, const f_string_t how, const bool fallback) F_attribute_visibility_internal_d; + extern bool fake_print_error_build_operation_file(fake_main_t * const main, const f_status_t status, const f_string_t function, const f_string_static_t operation, const f_string_t source, const f_string_t destination, const f_string_t how, const bool fallback) F_attribute_visibility_internal_d; #endif // _di_fake_print_error_operation_file_ /** @@ -92,7 +92,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fake_print_error_parameter_missing_value_ - extern void fake_print_error_parameter_missing_value(fake_main_t * const main, const f_string_t parameter) F_attribute_visibility_internal_d; + extern void fake_print_error_parameter_missing_value(fake_main_t * const main, const f_string_static_t parameter) F_attribute_visibility_internal_d; #endif // _di_fake_print_error_parameter_missing_value_ /** @@ -109,7 +109,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fake_print_error_parameter_too_many_ - extern void fake_print_error_parameter_too_many(fake_main_t * const main, const f_string_t parameter) F_attribute_visibility_internal_d; + extern void fake_print_error_parameter_too_many(fake_main_t * const main, const f_string_static_t parameter) F_attribute_visibility_internal_d; #endif // _di_fake_print_error_parameter_too_many_ /** @@ -293,7 +293,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fake_print_warning_settings_content_empty_ - extern void fake_print_warning_settings_content_empty(fake_main_t * const main, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_t settings_name) F_attribute_visibility_internal_d; + extern void fake_print_warning_settings_content_empty(fake_main_t * const main, const f_string_static_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_static_t settings_name) F_attribute_visibility_internal_d; #endif // _di_fake_print_warning_settings_content_empty_ /** @@ -318,7 +318,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fake_print_warning_settings_content_invalid_ - extern void fake_print_warning_settings_content_invalid(fake_main_t * const main, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_range_t range_content, const f_string_t settings_name) F_attribute_visibility_internal_d; + extern void fake_print_warning_settings_content_invalid(fake_main_t * const main, const f_string_static_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_range_t range_content, const f_string_static_t settings_name) F_attribute_visibility_internal_d; #endif // _di_fake_print_warning_settings_content_invalid_ /** @@ -339,7 +339,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fake_print_warning_settings_content_multiple_ - extern void fake_print_warning_settings_content_multiple(fake_main_t * const main, const f_string_t path_file, const f_string_t name_object) F_attribute_visibility_internal_d; + extern void fake_print_warning_settings_content_multiple(fake_main_t * const main, const f_string_static_t path_file, const f_string_static_t name_object) F_attribute_visibility_internal_d; #endif // _di_fake_print_warning_settings_content_multiple_ /** @@ -362,7 +362,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fake_print_warning_settings_object_multiple_ - extern void fake_print_warning_settings_object_multiple(fake_main_t * const main, const f_string_t path_file, const f_string_t label, const f_string_t name_object) F_attribute_visibility_internal_d; + extern void fake_print_warning_settings_object_multiple(fake_main_t * const main, const f_string_static_t path_file, const f_string_static_t label, const f_string_static_t name_object) F_attribute_visibility_internal_d; #endif // _di_fake_print_warning_settings_object_multiple_ #ifdef __cplusplus diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index 636b730..bcf53a8 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -57,66 +57,36 @@ extern "C" { f_string_dynamic_t file_data_build_process_post = f_string_dynamic_t_initialize; f_string_dynamic_t file_data_build_process_pre = f_string_dynamic_t_initialize; - f_string_dynamic_t content = f_string_dynamic_t_initialize; if (F_status_is_error_not(status)) { - content.string = fake_make_skeleton_content_defines_s; - content.used = fake_make_skeleton_content_defines_s_length; - content.size = content.used; - - status = fake_skeleton_operate_file_create(main, main->file_data_build_defines, F_false, content); - - content.used = 0; + status = fake_skeleton_operate_file_create(main, main->file_data_build_defines, F_false, fake_make_skeleton_content_defines_s); } if (F_status_is_error_not(status)) { - content.string = fake_make_skeleton_content_dependencies_s; - content.used = fake_make_skeleton_content_dependencies_s_length; - content.size = content.used; - - status = fake_skeleton_operate_file_create(main, main->file_data_build_dependencies, F_false, content); - - content.used = 0; + status = fake_skeleton_operate_file_create(main, main->file_data_build_dependencies, F_false, fake_make_skeleton_content_dependencies_s); } if (F_status_is_error_not(status)) { - status = fake_skeleton_operate_file_create(main, file_data_build_process_post, F_true, content); + status = fake_skeleton_operate_file_create(main, fake_file_data_build_process_post_s, F_true, fake_make_skeleton_content_process_post_s); } if (F_status_is_error_not(status)) { - status = fake_skeleton_operate_file_create(main, file_data_build_process_pre, F_true, content); + status = fake_skeleton_operate_file_create(main, fake_file_data_build_process_pre_s, F_true, fake_make_skeleton_content_process_pre_s); } if (F_status_is_error_not(status)) { - content.string = fake_make_skeleton_content_settings_s; - content.used = fake_make_skeleton_content_settings_s_length; - content.size = content.used; - - status = fake_skeleton_operate_file_create(main, main->file_data_build_settings, F_false, content); - - content.used = 0; + status = fake_skeleton_operate_file_create(main, main->file_data_build_settings, F_false, fake_make_skeleton_content_settings_s); } if (F_status_is_error_not(status)) { - status = fake_skeleton_operate_file_create(main, main->file_documents_readme, F_false, content); + status = fake_skeleton_operate_file_create(main, main->file_documents_readme, F_false, f_string_empty_s); } if (F_status_is_error_not(status)) { - content.string = fake_make_skeleton_content_fakefile_s; - content.used = fake_make_skeleton_content_fakefile_s_length; - content.size = content.used; - - status = fake_skeleton_operate_file_create(main, main->file_data_build_fakefile, F_false, content); - - content.used = 0; + status = fake_skeleton_operate_file_create(main, main->file_data_build_fakefile, F_false, fake_make_skeleton_content_fakefile_s); } - if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(file_data_build_process_post); - macro_f_string_dynamic_t_delete_simple(file_data_build_process_pre); - - return status; - } + if (F_status_is_error(status)) return status; return F_none; } @@ -143,7 +113,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, path, main->error.notable); fl_print_format("%[' exists but is not a directory.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -159,7 +129,7 @@ extern "C" { if (F_status_set_fine(status) == F_file_found_not) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe path '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, path, main->error.notable); fl_print_format("%[' could not be created, a parent directory does not exist.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -236,7 +206,7 @@ extern "C" { if (F_status_set_fine(status) == F_file_found_not) { flockfile(main->error.to.stream); - fl_print_format("%q%[%SThe file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, path, main->error.notable); fl_print_format("%[' could not be created, a parent directory does not exist.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); diff --git a/level_3/fake/data/build/settings b/level_3/fake/data/build/settings index a7c87b3..075f01a 100644 --- a/level_3/fake/data/build/settings +++ b/level_3/fake/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fake.c private-build.c private-build-library.c private-build-load.c private-build-objects.c private-build-program.c private-build-skeleton.c private-clean.c private-common.c private-make.c private-fake.c private-fake-path_generate.c private-make-load_fakefile.c private-make-load_parameters.c private-make-operate.c private-make-operate_process.c private-make-operate_process_type.c private-make-operate_validate.c private-print.c private-skeleton.c +build_sources_library fake.c common.c private-build.c private-build-library.c private-build-load.c private-build-objects.c private-build-program.c private-build-skeleton.c private-clean.c private-common.c private-make.c private-fake.c private-fake-path_generate.c private-make-load_fakefile.c private-make-load_parameters.c private-make-operate.c private-make-operate_process.c private-make-operate_process_type.c private-make-operate_validate.c private-print.c private-skeleton.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fake.h +build_sources_headers fake.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index a50c2ae..bafc08a 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -12,6 +12,15 @@ extern "C" { #endif +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize2(FIREWALL_program_version_s, 0, FIREWALL_program_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize2(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize2(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_program_name_ + #ifndef _di_firewall_print_help_ f_status_t firewall_print_help(const f_file_t file, const f_color_context_t context) { @@ -19,15 +28,15 @@ extern "C" { fll_program_print_help_header(file, context, firewall_program_name_long_s, firewall_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); fl_print_format("%q%q %[Available Commands:%] ", file.stream, f_string_eol_s, f_string_eol_s, context.set.important, context.set.important); fl_print_format("%q %[%s%] Turn on the firewall.", file.stream, f_string_eol_s, context.set.standout, firewall_command_start_s, context.set.standout); @@ -226,7 +235,7 @@ extern "C" { if (strncmp("ports", arguments->argv[main->remaining.array[counter]], 6) != 0) { flockfile(main->warning.to.stream); - fl_print_format("%q%[%S'%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); + fl_print_format("%q%[%Q'%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, arguments->argv[main->remaining.array[counter]], main->warning.notable); fl_print_format("%[' is not a valid show option.%]%q", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); @@ -375,7 +384,7 @@ extern "C" { parameters.array[5].used = 0; parameters.array[6].used = 0; - macro_f_string_dynamics_t_delete_simple( parameters); + f_string_dynamics_resize(0, & parameters); firewall_delete_local_data(&local); firewall_main_delete(main); @@ -393,10 +402,10 @@ extern "C" { firewall_print_error_on_allocation_failure(main->error); } else if (status == F_data_not) { - fll_print_format("%q%[%sCould not find any network devices.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QCould not find any network devices.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } else if (status == F_failure) { - fll_print_format("%q%[%sFailed to read the device directory '%s'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, network_devices_s, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QFailed to read the device directory '%s'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, network_devices_s, main->error.context, f_string_eol_s); } } @@ -486,7 +495,7 @@ extern "C" { } else { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sFailed to perform lock request because the lock instructions are missing from: %s.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, network_path_s firewall_file_other_s, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QFailed to perform lock request because the lock instructions are missing from: %s.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, network_path_s firewall_file_other_s, main->error.context, f_string_eol_s); } firewall_delete_local_data(&local); @@ -531,7 +540,7 @@ extern "C" { } else { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sFailed to perform stop request because the lock instructions are missing from: %s.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, network_path_s firewall_file_other_s, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QFailed to perform stop request because the lock instructions are missing from: %s.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, network_path_s firewall_file_other_s, main->error.context, f_string_eol_s); } firewall_delete_local_data(&local); @@ -632,7 +641,7 @@ extern "C" { status = firewall_buffer_rules(main, file_path.string, F_true, &local); - macro_f_string_dynamic_t_delete_simple(file_path); + f_string_dynamic_resize(0, &file_path); } if (F_status_is_error(status)) { @@ -738,7 +747,7 @@ extern "C" { } else { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sYou did not pass a command.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QYou did not pass a command.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } status = F_status_set_error(F_parameter); @@ -763,14 +772,14 @@ extern "C" { for (f_array_length_t i = 0; i < firewall_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_string_dynamics_t_delete_simple(main->chains); - macro_f_array_lengths_t_delete_simple(main->remaining); - macro_f_string_dynamics_t_delete_simple(main->devices); + f_string_dynamics_resize(0, &main->chains); + f_type_array_lengths_resize(0, &main->remaining); + f_string_dynamics_resize(0, &main->devices); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/firewall/c/firewall.h b/level_3/firewall/c/firewall.h index 682323e..8f9c5ca 100644 --- a/level_3/firewall/c/firewall.h +++ b/level_3/firewall/c/firewall.h @@ -10,14 +10,15 @@ * This program processes firewall commands and passes them to iptables from netfiler.org. */ #ifndef _firewall_h +#define _firewall_h -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -33,12 +34,12 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -52,24 +53,40 @@ extern "C" { #endif #ifndef _di_firewall_program_version_ - #define firewall_program_version_major_s F_string_ascii_0_s - #define firewall_program_version_minor_s F_string_ascii_5_s - #define firewall_program_version_micro_s F_string_ascii_8_s + #define FIREWALL_program_version_major_s F_string_ascii_0_s + #define FIREWALL_program_version_minor_s F_string_ascii_5_s + #define FIREWALL_program_version_micro_s F_string_ascii_8_s - #ifndef firewall_program_version_nano_prefix_s - #define firewall_program_version_nano_prefix_s - #endif + #define FIREWALL_program_version_major_s_length F_string_ascii_0_s_length + #define FIREWALL_program_version_minor_s_length F_string_ascii_5_s_length + #define FIREWALL_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef firewall_program_version_nano_s - #define firewall_program_version_nano_s - #endif + #if !(defined(FIREWALL_program_version_nano_prefix_s) && defined(FIREWALL_program_version_nano_prefix_s_length)) + #define FIREWALL_program_version_nano_prefix_s + #define FIREWALL_program_version_nano_prefix_s_length 0 + #endif // !(defined(FIREWALL_program_version_nano_prefix_s) && defined(FIREWALL_program_version_nano_prefix_s_length)) - #define firewall_version_s firewall_program_version_major_s F_string_ascii_period_s firewall_program_version_minor_s F_string_ascii_period_s firewall_program_version_micro_s firewall_program_version_nano_prefix_s firewall_program_version_nano_s + #if !(defined(FIREWALL_program_version_nano_s) && defined(FIREWALL_program_version_nano_s_length)) + #define FIREWALL_program_version_nano_s + #define FIREWALL_program_version_nano_s_length 0 + #endif // !(defined(FIREWALL_program_version_nano_s) && defined(FIREWALL_program_version_nano_s_length)) + + #define FIREWALL_version_s FIREWALL_program_version_major_s F_string_ascii_period_s FIREWALL_program_version_minor_s F_string_ascii_period_s FIREWALL_program_version_micro_s FIREWALL_program_version_nano_prefix_s FIREWALL_program_version_nano_s + + #define FIREWALL_version_s_length FIREWALL_program_version_major_s_length + F_string_ascii_period_s_length + FIREWALL_program_version_minor_s_length + F_string_ascii_period_s_length + FIREWALL_program_version_micro_s_length + FIREWALL_program_version_nano_prefix_s_length + FIREWALL_program_version_nano_s_length + + extern const f_string_static_t firewall_program_version_s; #endif // _di_firewall_program_version_ #ifndef _di_firewall_program_name_ - #define firewall_program_name_s "firewall" - #define firewall_program_name_long_s "Kevux Firewall Manager" + #define FIREWALL_program_name_s "firewall" + #define FIREWALL_program_name_long_s "Kevux Firewall Manager" + + #define FIREWALL_program_name_s_length 8 + #define FIREWALL_program_name_long_s_length 22 + + extern const f_string_static_t firewall_program_name_s; + extern const f_string_static_t firewall_program_name_long_s; #endif // _di_firewall_program_name_ #ifndef _di_firewall_paths_ diff --git a/level_3/firewall/c/main.c b/level_3/firewall/c/main.c index 2d0568f..464a128 100644 --- a/level_3/firewall/c/main.c +++ b/level_3/firewall/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = firewall_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/firewall/c/private-common.c b/level_3/firewall/c/private-common.c index 0dc0bb6..f28536d 100644 --- a/level_3/firewall/c/private-common.c +++ b/level_3/firewall/c/private-common.c @@ -85,7 +85,7 @@ void firewall_print_error_on_unhandled_for_file(const fl_print_t output, const f flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index b0b2928..a2cee60 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -46,7 +46,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal macro_f_string_dynamic_t_resize(status, device, main->devices.array[local.device].used); if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(device); + f_string_dynamic_resize(0, &device); return status; } @@ -65,11 +65,11 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (!((++signal_check) % firewall_signal_check_d)) { if (firewall_signal_received(main)) { - macro_f_string_dynamic_t_delete_simple(ip_list); - macro_f_string_dynamic_t_delete_simple(argument); - macro_f_string_dynamics_t_delete_simple(arguments); - macro_f_string_dynamic_t_delete_simple(device); - macro_f_string_dynamic_t_delete_simple(protocol); + f_string_dynamic_resize(0, &ip_list); + f_string_dynamic_resize(0, &argument); + f_string_dynamics_resize(0, &arguments); + f_string_dynamic_resize(0, &device); + f_string_dynamic_resize(0, &protocol); return F_status_set_error(F_interrupt); } @@ -83,14 +83,14 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal is_ip_list = F_false; ip_list_direction = F_false; - macro_f_string_dynamic_t_delete_simple(ip_list); + f_string_dynamic_resize(0, &ip_list); // process chain rule if (length >= firewall_chain_length_s && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_chain_s, length, firewall_chain_length_s) == F_equal_to) { if (chain == firewall_chain_custom_id_e) { // custom chains can only apply to themselves, so silently ignore chain commands specified within a custom chain. - fll_print_format("%q%[%sAt line %ul, the chain option is meaningless inside of a custom chain.%]%q", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, f_string_eol_s); + fll_print_format("%q%[%QAt line %ul, the chain option is meaningless inside of a custom chain.%]%q", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, f_string_eol_s); continue; } @@ -154,8 +154,10 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal invalid = F_true; } else if (length >= firewall_device_all_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_device_all_s, length, firewall_device_all_s_length) == F_equal_to) { - macro_f_string_dynamic_t_delete_simple(device); + f_string_dynamic_resize(0, &device); + device_all = F_true; + continue; } else if (length >= firewall_device_this_s_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_device_this_s, length, firewall_device_this_s_length) == F_equal_to) { @@ -171,18 +173,18 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal device.used = main->devices.array[local.device].used; } else { - macro_f_string_dynamic_t_delete_simple(device); + f_string_dynamic_resize(0, &device); } device_all = F_false; + continue; } if (!invalid) { if (length > 0) { if (length > device.size) { - macro_f_string_dynamic_t_resize(status, device, length); - + status = f_string_dynamic_resize(length, &device); if (F_status_is_error(status)) break; } @@ -190,10 +192,11 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal device.used = length; } else { - macro_f_string_dynamic_t_delete_simple(device); + f_string_dynamic_resize(0, &device); } device_all = F_false; + continue; } } @@ -248,8 +251,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal use_protocol = F_false; } else if (length > 0) { - macro_f_string_dynamic_t_delete_simple(protocol); - macro_f_string_dynamic_t_resize(status, protocol, length); + status = f_string_dynamic_resize(length, &potocol); if (F_status_is_error(status)) break; @@ -302,14 +304,14 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (length) { flockfile(main->warning.to.stream); - fl_print_format("%q%[%sAt line %ul, the object '%]%[", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, main->warning.notable); + fl_print_format("%q%[%QAt line %ul, the object '%]%[", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, main->warning.notable); f_print(local.buffer.string + local.rule_objects.array[i].start, length, main->warning.to.stream); fl_print_format("%]%[' is invalid.%]%q", main->warning.to.stream, main->warning.notable, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); } else { - fll_print_format("%q%[%sAt line %ul, the object is missing.%]%q", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, f_string_eol_s); + fll_print_format("%q%[%QAt line %ul, the object is missing.%]%q", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, f_string_eol_s); } continue; @@ -321,7 +323,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (length) { flockfile(main->warning.to.stream); - fl_print_format("%q%[%sAt line %ul, the object '%]%[", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, main->warning.notable); + fl_print_format("%q%[%QAt line %ul, the object '%]%[", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, main->warning.notable); f_print(local.buffer.string + local.rule_objects.array[i].start, length, main->warning.to.stream); fl_print_format("%]%[' has invalid content '%]%[", main->warning.to.stream, main->warning.notable, main->warning.context, main->warning.context, main->warning.notable); f_print(local.buffer.string + local.rule_contents.array[i].array[0].start, macro_firewall_structure_size(local.rule_contents.array[i], 0), main->warning.to.stream); @@ -330,7 +332,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal funlockfile(main->warning.to.stream); } else { - fll_print_format("%q%[%sAt line %ul, the object has no content.%]%q", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, f_string_eol_s); + fll_print_format("%q%[%QAt line %ul, the object has no content.%]%q", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, f_string_eol_s); } continue; @@ -355,7 +357,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } } - macro_f_string_dynamic_t_delete_simple(argument); + f_string_dynamic_resize(0, &argument); if (F_status_is_error(status)) break; @@ -389,7 +391,8 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (argument.used > 0) { macro_firewall_append_argument_to_arguments(status, arguments, argument) if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(argument); + f_string_dynamic_resize(0, &argument); + break; } @@ -575,7 +578,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal flockfile(main->warning.to.stream); - fl_print_format("%q%[%sAt line %ul, the object '%]%[", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, main->warning.notable); + fl_print_format("%q%[%QAt line %ul, the object '%]%[", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, main->warning.notable); f_print(local.buffer.string + local.rule_objects.array[i].start, length, main->warning.to.stream); fl_print_format("%]%[' has no content.%]%q", main->warning.to.stream, main->warning.notable, main->warning.context, main->warning.context, f_string_eol_s); @@ -617,19 +620,19 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal // the file does not have to exist if (main->error.verbosity != f_console_verbosity_verbose_e || main->error.verbosity == f_console_verbosity_debug_e) { - fll_print_format("%q%[%sCannot find the file '%Q'.%]%q", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, file_path, main->warning.context, f_string_eol_s); + fll_print_format("%q%[%QCannot find the file '%Q'.%]%q", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, file_path, main->warning.context, f_string_eol_s); } status = F_none; } else if (status == F_file_open) { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sUnable to open the file '%Q'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QUnable to open the file '%Q'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); } } else if (status == F_file_descriptor) { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sFile descriptor error while trying to open the file '%Q'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QFile descriptor error while trying to open the file '%Q'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); } } else if (status == F_memory_not) { @@ -658,16 +661,16 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal firewall_print_error_on_invalid_parameter(main->error, "f_file_read"); } else if (status == F_number_overflow) { - fll_print_format("%q%[%sInteger overflow while trying to buffer the file '%Q'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QInteger overflow while trying to buffer the file '%Q'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); } else if (status == F_file_closed) { - fll_print_format("%q%[%sThe file '%Q' is no longer open.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThe file '%Q' is no longer open.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); } else if (status == F_file_seek) { - fll_print_format("%q%[%sA seek error occurred while accessing the file '%Q'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QA seek error occurred while accessing the file '%Q'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); } else if (status == F_file_read) { - fll_print_format("%q%[%sA read error occurred while accessing the file '%Q'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QA read error occurred while accessing the file '%Q'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, file_path, main->error.context, f_string_eol_s); } else if (status == F_memory_not) { firewall_print_error_on_allocation_failure(main->error); @@ -746,14 +749,15 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (F_status_is_error(status)) { firewall_print_error_on_allocation_failure(main->error); - macro_f_string_dynamic_t_delete_simple(ip_list_action); + f_string_dynamic_resize(0, &ip_list_action); } else { f_string_dynamic_t ip_argument = f_string_dynamic_t_initialize; macro_firewall_append_argument_to_arguments(status, arguments, ip_list_action) if (F_status_is_error(status)) { - macro_f_string_dynamic_t_delete_simple(ip_argument); + f_string_dynamic_resize(0, &ip_argument); + break; } @@ -780,13 +784,13 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = fll_execute_program((f_string_t) current_tool, arguments, 0, 0, (void *) &return_code); - // immediately exit child process, @todo this may require additional memory deallocation and relating changes. + // Immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { - macro_f_string_dynamic_t_delete_simple(ip_list); - macro_f_string_dynamic_t_delete_simple(argument); - macro_f_string_dynamics_t_delete_simple(arguments); - macro_f_string_dynamic_t_delete_simple(device); - macro_f_string_dynamic_t_delete_simple(protocol); + f_string_dynamic_resize(0, &ip_list); + f_string_dynamic_resize(0, &argument); + f_string_dynamics_resize(0, &arguments); + f_string_dynamic_resize(0, &device); + f_string_dynamic_resize(0, &protocol); exit(return_code); } @@ -802,20 +806,20 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal firewall_print_error_on_unhandled(main->error, "fll_execute_program", status); } - // remove ip_argument from arguments string. - macro_f_string_dynamic_t_delete_simple(arguments.array[arguments.used--]); + // Remove ip_argument from arguments string. + f_string_dynamic_resize(0, &arguments.array[arguments.used--]); break; } - // remove ip_argument from arguments string. - macro_f_string_dynamic_t_delete_simple(arguments.array[arguments.used--]); + // Remove ip_argument from arguments string. + f_string_dynamic_resize(0, &arguments.array[arguments.used--]); } // for - macro_f_string_dynamic_t_delete_simple(ip_argument); + f_string_dynamic_resize(0, &ip_argument); - // remove ip_list_action from arguments string. - macro_f_string_dynamic_t_delete_simple(arguments.array[arguments.used--]); + // Remove ip_list_action from arguments string. + f_string_dynamic_resize(0, &arguments.array[arguments.used--]); } } @@ -823,8 +827,8 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } } - macro_f_string_dynamic_t_delete_simple(local_buffer); - macro_f_string_dynamic_t_delete_simple(file_path); + f_string_dynamic_resize(0, &local_buffer); + f_string_dynamic_resize(0, &file_path); macro_f_fss_objects_t_delete_simple(basic_objects); macro_f_fss_contents_t_delete_simple(basic_contents); @@ -837,11 +841,11 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { - macro_f_string_dynamic_t_delete_simple(ip_list); - macro_f_string_dynamic_t_delete_simple(argument); - macro_f_string_dynamics_t_delete_simple(arguments); - macro_f_string_dynamic_t_delete_simple(device); - macro_f_string_dynamic_t_delete_simple(protocol); + f_string_dynamic_resize(0, &ip_list); + f_string_dynamic_resize(0, &argument); + f_string_dynamics_resize(0, &arguments); + f_string_dynamic_resize(0, &device); + f_string_dynamic_resize(0, &protocol); exit(return_code); } @@ -864,11 +868,11 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } // for } // for - macro_f_string_dynamic_t_delete_simple(ip_list); - macro_f_string_dynamic_t_delete_simple(argument); - macro_f_string_dynamics_t_delete_simple(arguments); - macro_f_string_dynamic_t_delete_simple(device); - macro_f_string_dynamic_t_delete_simple(protocol); + f_string_dynamic_resize(0, &ip_list); + f_string_dynamic_resize(0, &argument); + f_string_dynamics_resize(0, &arguments); + f_string_dynamic_resize(0, &device); + f_string_dynamic_resize(0, &protocol); return status; } @@ -891,7 +895,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ f_string_dynamic_t fixed_string = f_string_dynamic_t_initialize; - macro_f_array_lengths_t_delete_simple(local->chain_ids); + f_type_array_lengths_resize(0, &local->chain_ids); macro_f_array_lengths_t_resize(status, local->chain_ids, local->chain_objects.used); if (F_status_is_error(status)) { @@ -904,7 +908,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ status = f_string_dynamic_resize(firewall_chain_create_command_s_length + 1, &arguments.array[0]); if (F_status_is_error(status)) { - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); return status; } @@ -918,7 +922,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ if (F_status_is_error(status)) { arguments.used = 1; - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); return status; } @@ -936,7 +940,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ if (!((++signal_check) % firewall_signal_check_d)) { if (firewall_signal_received(main)) { - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); return F_status_set_error(F_interrupt); } @@ -1008,7 +1012,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ macro_f_string_dynamics_t_resize(status, main->chains, main->chains.used + firewall_default_allocation_step_d); if (F_status_is_error(status)) { - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); return status; } @@ -1022,7 +1026,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ macro_f_string_dynamic_t_resize(status, arguments.array[1], length + 1); if (F_status_is_error(status)) { - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); return status; } @@ -1031,7 +1035,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ macro_f_string_dynamic_t_resize(status, main->chains.array[main->chains.used], length + 1); if (F_status_is_error(status)) { - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); return status; } @@ -1080,7 +1084,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); exit(return_code); } @@ -1089,7 +1093,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ status = firewall_signal_received(main); if (status) { - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); return F_status_set_error(F_interrupt); } @@ -1101,7 +1105,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); exit(return_code); } @@ -1120,7 +1124,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ firewall_print_error_on_unhandled(main->error, "fll_execute_program", status); } - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); return status; } } @@ -1131,7 +1135,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ ++i; } // while - macro_f_string_dynamics_t_delete_simple(arguments); + f_string_dynamics_resize(0, &arguments); return status; } @@ -1324,13 +1328,13 @@ f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_t firewall_print_error_on_invalid_parameter(main->error, "f_file_open"); } else if (status == F_file_found_not) { - fll_print_format("%q%[%sUnable to find the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QUnable to find the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_file_open) { - fll_print_format("%q%[%sUnable to open the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QUnable to open the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_file_descriptor) { - fll_print_format("%q%[%sFile descriptor error while trying to open the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QFile descriptor error while trying to open the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else { firewall_print_error_on_unhandled(main->error, "f_file_open", status); @@ -1353,16 +1357,16 @@ f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_t firewall_print_error_on_invalid_parameter(main->error, "f_file_read"); } else if (status == F_number_overflow) { - fll_print_format("%q%[%sInteger overflow while trying to buffer the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QInteger overflow while trying to buffer the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_file_closed) { - fll_print_format("%q%[%sThe file '%S' is no longer open.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThe file '%S' is no longer open.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_file_seek) { - fll_print_format("%q%[%sA seek error occurred while accessing the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QA seek error occurred while accessing the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_file_read) { - fll_print_format("%q%[%sA read error occurred while accessing the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QA read error occurred while accessing the file '%S'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_memory_not) { firewall_print_error_on_allocation_failure(main->error); @@ -1393,7 +1397,7 @@ f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_t firewall_print_error_on_invalid_parameter_for_file(main->error, "fll_fss_basic_list_read", filename); } else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) { - fll_print_format("%q%[%sNo relevant main was found within the file '%s'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QNo relevant main was found within the file '%s'.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_memory_not) { firewall_print_error_on_allocation_failure(main->error); @@ -1462,6 +1466,7 @@ f_status_t firewall_process_rules(firewall_main_t * const main, f_string_range_t macro_f_fss_objects_t_delete_simple(local->rule_objects); macro_f_fss_contents_t_delete_simple(local->rule_contents); + return status; } @@ -1475,8 +1480,8 @@ f_status_t firewall_delete_local_data(firewall_local_data_t * const local) { local->device = 0; local->chain = 0; - macro_f_string_dynamic_t_delete_simple(local->buffer); - macro_f_array_lengths_t_delete_simple(local->chain_ids); + f_string_dynamic_resize(0, &local->buffer); + f_type_array_lengths_resize(0, &local->chain_ids); macro_f_fss_objects_t_delete_simple(local->chain_objects); macro_f_fss_contents_t_delete_simple(local->chain_contents); macro_f_fss_objects_t_delete_simple(local->rule_objects); diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index f12ebe3..399eaf6 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -7,6 +7,15 @@ extern "C" { #endif +#ifndef _di_fss_basic_list_program_version_ + const f_string_static_t fss_basic_list_program_version_s = macro_f_string_static_t_initialize2(FSS_BASIC_LIST_program_version_s, 0, FSS_BASIC_LIST_program_version_s_length); +#endif // _di_fss_basic_list_program_version_ + +#ifndef _di_fss_basic_list_program_name_ + const f_string_static_t fss_basic_list_program_name_s = macro_f_string_static_t_initialize2(FSS_BASIC_LIST_program_name_s, 0, FSS_BASIC_LIST_program_name_s_length); + const f_string_static_t fss_basic_list_program_name_long_s = macro_f_string_static_t_initialize2(FSS_BASIC_LIST_program_name_long_s, 0, FSS_BASIC_LIST_program_name_long_s_length); +#endif // _di_fss_basic_list_program_name_ + #ifndef _di_fss_basic_list_read_print_help_ f_status_t fss_basic_list_read_print_help(const f_file_t file, const f_color_context_t context) { @@ -14,32 +23,32 @@ extern "C" { fll_program_print_help_header(file, context, fss_basic_list_program_name_long_s, fss_basic_list_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_basic_list_read_short_at_s, fss_basic_list_read_long_at_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric index."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_content_s, fss_basic_list_read_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Content (default)."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_columns_s, fss_basic_list_read_long_columns_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of columns."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_delimit_s, fss_basic_list_read_long_delimit_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Designate how to handle applying delimits."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_depth_s, fss_basic_list_read_long_depth_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric depth."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_empty_s, fss_basic_list_read_long_empty_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Include empty Content when processing."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_line_s, fss_basic_list_read_long_line_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print only the Content at the given line."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_name_s, fss_basic_list_read_long_name_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object with this name."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_object_s, fss_basic_list_read_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Object."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_pipe_s, fss_basic_list_read_long_pipe_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print using the special pipe format."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_raw_s, fss_basic_list_read_long_raw_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print with the original quotes and escapes."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_select_s, fss_basic_list_read_long_select_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select sub-Content at this index."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of lines."); - fll_program_print_help_option(file, context, fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names on select or print."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_at_s, fss_basic_list_read_long_at_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_content_s, fss_basic_list_read_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default)."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_columns_s, fss_basic_list_read_long_columns_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of columns."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_delimit_s, fss_basic_list_read_long_delimit_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Designate how to handle applying delimits."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_depth_s, fss_basic_list_read_long_depth_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric depth."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_empty_s, fss_basic_list_read_long_empty_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Include empty Content when processing."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_line_s, fss_basic_list_read_long_line_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the Content at the given line."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_name_s, fss_basic_list_read_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_object_s, fss_basic_list_read_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_pipe_s, fss_basic_list_read_long_pipe_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_raw_s, fss_basic_list_read_long_raw_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_select_s, fss_basic_list_read_long_select_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print."); fll_program_print_help_usage(file, context, fss_basic_list_program_name_s, "filename(s)"); @@ -235,7 +244,7 @@ extern "C" { fss_basic_list_read_parameter_delimit_e, }; - const f_string_t parameter_name[] = { + const f_string_static_t parameter_name[] = { fss_basic_list_read_long_at_s, fss_basic_list_read_long_depth_s, fss_basic_list_read_long_line_s, @@ -262,8 +271,8 @@ extern "C" { if (main->parameters[parameter_code[i]].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); fl_print_format("%[' requires a %s.%]%q", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -305,10 +314,10 @@ extern "C" { if (main->parameters[parameter_code[i]].result == parameter_match[i]) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_columns_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_columns_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -324,10 +333,10 @@ extern "C" { if (main->parameters[fss_basic_list_read_parameter_total_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -337,10 +346,10 @@ extern "C" { else if (main->parameters[fss_basic_list_read_parameter_line_e].result == f_console_result_additional_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_line_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_line_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -370,13 +379,13 @@ extern "C" { } location = main->parameters[fss_basic_list_read_parameter_delimit_e].values.array[i]; - length = strnlen(arguments->argv[location], f_console_parameter_size); + length = strnlen(arguments->argv[location], F_console_parameter_size_d); if (!length) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, main->error.notable); fl_print_format("%[' must not be empty.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -509,8 +518,8 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_basic_list_read_parameter_select_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, main->error.notable); fl_print_format("%[' parameter requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -639,7 +648,7 @@ extern "C" { fss_basic_list_read_data_delete_simple(&data); } else { - fll_print_format("%q%[%sYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); status = F_status_set_error(F_parameter); } @@ -663,12 +672,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_basic_list_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); return F_none; diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.h b/level_3/fss_basic_list_read/c/fss_basic_list_read.h index 8963960..4656a0b 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.h +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.h @@ -12,15 +12,16 @@ * This processes in accordance to the FSS-0002 Basic List specification. */ #ifndef _fss_basic_list_read_h +#define _fss_basic_list_read_h -// libc includes. +// Libc includes. #include #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -34,13 +35,13 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -52,24 +53,40 @@ extern "C" { #endif #ifndef _di_fss_basic_list_read_program_version_ - #define fss_basic_list_program_version_major_s F_string_ascii_0_s - #define fss_basic_list_program_version_minor_s F_string_ascii_5_s - #define fss_basic_list_program_version_micro_s F_string_ascii_8_s + #define FSS_BASIC_LIST_READ_program_version_major_s F_string_ascii_0_s + #define FSS_BASIC_LIST_READ_program_version_minor_s F_string_ascii_5_s + #define FSS_BASIC_LIST_READ_program_version_micro_s F_string_ascii_8_s - #ifndef fss_basic_list_program_version_nano_prefix_s - #define fss_basic_list_program_version_nano_prefix_s - #endif + #define FSS_BASIC_LIST_READ_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_BASIC_LIST_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_BASIC_LIST_READ_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_basic_list_program_version_nano_s - #define fss_basic_list_program_version_nano_s - #endif + #if !(defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s_length)) + #define FSS_BASIC_LIST_READ_program_version_nano_prefix_s + #define FSS_BASIC_LIST_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s_length)) - #define fss_basic_list_program_version_s fss_basic_list_program_version_major_s F_string_ascii_period_s fss_basic_list_program_version_minor_s F_string_ascii_period_s fss_basic_list_program_version_micro_s fss_basic_list_program_version_nano_prefix_s fss_basic_list_program_version_nano_s + #if !(defined(FSS_BASIC_LIST_READ_program_version_nano_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_s_length)) + #define FSS_BASIC_LIST_READ_program_version_nano_s + #define FSS_BASIC_LIST_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_BASIC_LIST_READ_program_version_nano_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_s_length)) + + #define FSS_BASIC_LIST_READ_program_version_s FSS_BASIC_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_BASIC_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_BASIC_LIST_READ_program_version_micro_s fss_basic_list_program_version_nano_prefix_s FSS_BASIC_LIST_READ_program_version_nano_s + + #define FSS_BASIC_LIST_READ_program_version_s_length FSS_BASIC_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_READ_program_version_micro_s_length + fss_basic_list_program_version_nano_prefix_s_length + FSS_BASIC_LIST_READ_program_version_nano_s_length + + extern const f_string_static_t fss_basic_list_program_version_s; #endif // _di_fss_basic_list_read_program_version_ #ifndef _di_fss_basic_list_read_program_name_ - #define fss_basic_list_program_name_s "fss_basic_list_read" - #define fss_basic_list_program_name_long_s "FSS Basic List Read" + #define FSS_BASIC_LIST_READ_program_name_s "fss_basic_list_read" + #define FSS_BASIC_LIST_READ_program_name_long_s "FSS Basic List Read" + + #define FSS_BASIC_LIST_READ_program_name_s_length 19 + #define FSS_BASIC_LIST_READ_program_name_long_s_length 19 + + extern const f_string_static_t fss_basic_list_program_name_s; + extern const f_string_static_t fss_basic_list_program_name_long_s; #endif // _di_fss_basic_list_read_program_name_ #ifndef _di_fss_basic_list_read_defines_ diff --git a/level_3/fss_basic_list_read/c/main.c b/level_3/fss_basic_list_read/c/main.c index 80d3a03..a09d464 100644 --- a/level_3/fss_basic_list_read/c/main.c +++ b/level_3/fss_basic_list_read/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_basic_list_read_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_basic_list_read/c/private-common.c b/level_3/fss_basic_list_read/c/private-common.c index 739b0ea..ccc6eb4 100644 --- a/level_3/fss_basic_list_read/c/private-common.c +++ b/level_3/fss_basic_list_read/c/private-common.c @@ -14,7 +14,7 @@ extern "C" { fss_basic_list_read_depths_resize(0, &data->depths); - macro_f_string_dynamic_t_delete_simple(data->buffer); + f_string_dynamic_resize(0, &data->buffer); macro_f_fss_contents_t_delete_simple(data->contents); macro_f_fss_objects_t_delete_simple(data->objects); macro_f_fss_delimits_t_delete_simple(data->delimits_object); @@ -67,7 +67,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_basic_list_read/c/private-read.c b/level_3/fss_basic_list_read/c/private-read.c index 376c2f4..65f4cf3 100644 --- a/level_3/fss_basic_list_read/c/private-read.c +++ b/level_3/fss_basic_list_read/c/private-read.c @@ -189,10 +189,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable); fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -204,8 +204,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, main->error.notable); fl_print_format("%[' may not have the value '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable); fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.context, main->error.context); @@ -285,7 +285,7 @@ extern "C" { if (main->parameters[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[parameter].values.array[main->parameters[parameter].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], f_console_parameter_size)); + const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], F_console_parameter_size_d)); const f_status_t status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, number); diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index 81436a7..ea9df2c 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -6,6 +6,15 @@ extern "C" { #endif +#ifndef _di_fss_basic_list_write_program_version_ + const f_string_static_t fss_basic_list_write_program_version_s = macro_f_string_static_t_initialize2(FSS_BASIC_LIST_WRITE_program_version_s, 0, FSS_BASIC_LIST_WRITE_program_version_s_length); +#endif // _di_fss_basic_list_write_program_version_ + +#ifndef _di_fss_basic_list_write_program_name_ + const f_string_static_t fss_basic_list_write_program_name_s = macro_f_string_static_t_initialize2(FSS_BASIC_LIST_WRITE_program_name_s, 0, FSS_BASIC_LIST_WRITE_program_name_s_length); + const f_string_static_t fss_basic_list_write_program_name_long_s = macro_f_string_static_t_initialize2(FSS_BASIC_LIST_WRITE_program_name_long_s, 0, FSS_BASIC_LIST_WRITE_program_name_long_s_length); +#endif // _di_fss_basic_list_write_program_name_ + #ifndef _di_fss_basic_list_write_print_help_ f_status_t fss_basic_list_write_print_help(const f_file_t file, const f_color_context_t context) { @@ -13,27 +22,27 @@ extern "C" { fll_program_print_help_header(file, context, fss_basic_list_write_program_name_long_s, fss_basic_list_write_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_basic_list_write_short_file_s, fss_basic_list_write_long_file_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a file to send data to."); - fll_program_print_help_option(file, context, fss_basic_list_write_short_content_s, fss_basic_list_write_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "The Content to file."); - fll_program_print_help_option(file, context, fss_basic_list_write_short_double_s, fss_basic_list_write_long_double_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use double quotes (default)."); - fll_program_print_help_option(file, context, fss_basic_list_write_short_ignore_s, fss_basic_list_write_long_ignore_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Ignore a given range within a Content."); - fll_program_print_help_option(file, context, fss_basic_list_write_short_object_s, fss_basic_list_write_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " The Object to file."); - fll_program_print_help_option(file, context, fss_basic_list_write_short_partial_s, fss_basic_list_write_long_partial_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Do not file end of Object/Content character."); - fll_program_print_help_option(file, context, fss_basic_list_write_short_prepend_s, fss_basic_list_write_long_prepend_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Prepend the given whitespace characters to the start of each multi-line Content."); - fll_program_print_help_option(file, context, fss_basic_list_write_short_single_s, fss_basic_list_write_long_single_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use single quotes."); - fll_program_print_help_option(file, context, fss_basic_list_write_short_trim_s, fss_basic_list_write_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_file_s, fss_basic_list_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_content_s, fss_basic_list_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The Content to file."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_double_s, fss_basic_list_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default)."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_ignore_s, fss_basic_list_write_long_ignore_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Ignore a given range within a Content."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_object_s, fss_basic_list_write_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The Object to file."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_partial_s, fss_basic_list_write_long_partial_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Do not file end of Object/Content character."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_prepend_s, fss_basic_list_write_long_prepend_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Prepend the given whitespace characters to the start of each multi-line Content."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_single_s, fss_basic_list_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_trim_s, fss_basic_list_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names."); fll_program_print_help_usage(file, context, fss_basic_list_write_program_name_s, f_string_empty_s); @@ -166,8 +175,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_file_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_file_s, main->error.notable); fl_print_format("%[' may only be specified once.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -188,7 +197,7 @@ extern "C" { } } else if (main->parameters[fss_basic_list_write_parameter_file_e].result == f_console_result_found_e) { - fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_basic_list_write_long_file_s); + fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_list_write_long_file_s); status = F_status_set_error(F_parameter); } } @@ -197,11 +206,11 @@ extern "C" { if (main->parameters[fss_basic_list_write_parameter_object_e].locations.used || main->parameters[fss_basic_list_write_parameter_content_e].locations.used) { if (main->parameters[fss_basic_list_write_parameter_object_e].locations.used) { if (main->parameters[fss_basic_list_write_parameter_object_e].locations.used != main->parameters[fss_basic_list_write_parameter_object_e].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_basic_list_write_long_object_s); + fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s); status = F_status_set_error(F_parameter); } else if (main->parameters[fss_basic_list_write_parameter_content_e].locations.used != main->parameters[fss_basic_list_write_parameter_content_e].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_basic_list_write_long_content_s); + fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s); status = F_status_set_error(F_parameter); } else if (main->parameters[fss_basic_list_write_parameter_object_e].locations.used != main->parameters[fss_basic_list_write_parameter_content_e].locations.used && main->parameters[fss_basic_list_write_parameter_partial_e].result == f_console_result_none_e) { @@ -213,12 +222,12 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter only allows either the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s, main->error.notable); fl_print_format("%[' parameter or the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s, main->error.notable); fl_print_format("%[' parameter, but not both.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -245,10 +254,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s, main->error.notable); fl_print_format("%[' parameter must be specified before a '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -264,7 +273,7 @@ extern "C" { } else if (main->parameters[fss_basic_list_write_parameter_content_e].locations.used) { if (main->parameters[fss_basic_list_write_parameter_content_e].locations.used != main->parameters[fss_basic_list_write_parameter_content_e].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_basic_list_write_long_content_s); + fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s); status = F_status_set_error(F_parameter); } else if (!main->parameters[fss_basic_list_write_parameter_partial_e].locations.used) { @@ -277,10 +286,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -294,8 +303,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter cannot be used when processing a pipe.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -311,8 +320,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend_s, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -322,7 +331,7 @@ extern "C" { } else if (main->parameters[fss_basic_list_write_parameter_prepend_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[fss_basic_list_write_parameter_prepend_e].values.array[main->parameters[fss_basic_list_write_parameter_prepend_e].values.used - 1]; - const f_array_length_t length = strnlen(arguments->argv[index], f_console_parameter_size); + const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d); if (length) { f_string_range_t range = macro_f_string_range_t_initialize(length); @@ -340,8 +349,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend_s, main->error.notable); fl_print_format("%[' must only contain whitespace.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -357,8 +366,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend_s, main->error.notable); fl_print_format("%[' must not be an empty string.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -374,8 +383,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore_s, main->error.notable); fl_print_format("%[' was specified, but no values were given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -390,8 +399,8 @@ extern "C" { if (total_locations * 2 > total_arguments) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore_s, main->error.notable); fl_print_format("%[' requires two values.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -430,7 +439,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -451,7 +460,7 @@ extern "C" { } object.string = arguments->argv[main->parameters[fss_basic_list_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; status = fss_basic_list_write_process(main, output, quote, &object, 0, &buffer); @@ -468,7 +477,7 @@ extern "C" { } content.string = arguments->argv[main->parameters[fss_basic_list_write_parameter_content_e].values.array[i]]; - content.used = strnlen(content.string, f_console_parameter_size); + content.used = strnlen(content.string, F_console_parameter_size_d); content.size = content.used; status = fss_basic_list_write_process(main, output, quote, 0, &content, &buffer); @@ -486,11 +495,11 @@ extern "C" { } object.string = arguments->argv[main->parameters[fss_basic_list_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; content.string = arguments->argv[main->parameters[fss_basic_list_write_parameter_content_e].values.array[i]]; - content.used = strnlen(content.string, f_console_parameter_size); + content.used = strnlen(content.string, F_console_parameter_size_d); content.size = content.used; status = fss_basic_list_write_process(main, output, quote, &object, &content, &buffer); @@ -502,7 +511,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -515,7 +524,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(escaped); + f_string_dynamic_resize(0, &escaped); // Object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free(). object.string = 0; @@ -540,9 +549,9 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(buffer); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &buffer); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); fss_basic_list_write_main_delete(main); return status; @@ -554,12 +563,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_basic_list_write_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.h b/level_3/fss_basic_list_write/c/fss_basic_list_write.h index 5d9a12f..2dca490 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.h +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.h @@ -8,14 +8,15 @@ * This program provides fss basic list write functionality. */ #ifndef _fss_basic_list_write_h +#define _fss_basic_list_write_h -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -28,13 +29,13 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -44,24 +45,40 @@ extern "C" { #endif #ifndef _di_fss_basic_list_write_program_version_ - #define fss_basic_list_write_program_version_major_s F_string_ascii_0_s - #define fss_basic_list_write_program_version_minor_s F_string_ascii_5_s - #define fss_basic_list_write_program_version_micro_s F_string_ascii_8_s + #define FSS_BASIC_LIST_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_BASIC_LIST_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_BASIC_LIST_WRITE_program_version_micro_s F_string_ascii_8_s - #ifndef fss_basic_list_write_program_version_nano_prefix_s - #define fss_basic_list_write_program_version_nano_prefix_s - #endif + #define FSS_BASIC_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_BASIC_LIST_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_BASIC_LIST_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_basic_list_write_program_version_nano_s - #define fss_basic_list_write_program_version_nano_s - #endif + #if !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length)) + #define FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s + #define FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length)) - #define fss_basic_list_write_program_version_s fss_basic_list_write_program_version_major_s F_string_ascii_period_s fss_basic_list_write_program_version_minor_s F_string_ascii_period_s fss_basic_list_write_program_version_micro_s fss_basic_list_write_program_version_nano_prefix_s fss_basic_list_write_program_version_nano_s + #if !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_s_length)) + #define FSS_BASIC_LIST_WRITE_program_version_nano_s + #define FSS_BASIC_LIST_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_s_length)) + + #define FSS_BASIC_LIST_WRITE_program_version_s FSS_BASIC_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_BASIC_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_BASIC_LIST_WRITE_program_version_micro_s FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s FSS_BASIC_LIST_WRITE_program_version_nano_s + + #define FSS_BASIC_LIST_WRITE_program_version_s_length FSS_BASIC_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_WRITE_program_version_micro_s_length + FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length + FSS_BASIC_LIST_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_basic_list_write_program_version_s; #endif // _di_fss_basic_list_write_program_version_ #ifndef _di_fss_basic_list_write_program_name_ - #define fss_basic_list_write_program_name_s "fss_basic_list_write" - #define fss_basic_list_write_program_name_long_s "FSS Basic List Write" + #define FSS_BASIC_LIST_WRITE_program_name_s "fss_basic_list_write" + #define FSS_BASIC_LIST_WRITE_program_name_long_s "FSS Basic List Write" + + #define FSS_BASIC_LIST_WRITE_program_name_s_length 20 + #define FSS_BASIC_LIST_WRITE_program_name_long_s_length 20 + + extern const f_string_static_t fss_basic_list_write_program_name_s; + extern const f_string_static_t fss_basic_list_write_program_name_long_s; #endif // _di_fss_basic_list_write_program_name_ #ifndef _di_fss_basic_list_write_defines_ diff --git a/level_3/fss_basic_list_write/c/main.c b/level_3/fss_basic_list_write/c/main.c index 28f7cf6..f847a28 100644 --- a/level_3/fss_basic_list_write/c/main.c +++ b/level_3/fss_basic_list_write/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_basic_list_write_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_basic_list_write/c/private-common.c b/level_3/fss_basic_list_write/c/private-common.c index 82f8ad1..e6c0e41 100644 --- a/level_3/fss_basic_list_write/c/private-common.c +++ b/level_3/fss_basic_list_write/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_basic_list_write/c/private-write.c b/level_3/fss_basic_list_write/c/private-write.c index f1b12f9..85cad31 100644 --- a/level_3/fss_basic_list_write/c/private-write.c +++ b/level_3/fss_basic_list_write/c/private-write.c @@ -15,12 +15,12 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s, main->error.notable); + fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s, main->error.notable); + fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -36,7 +36,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable); fl_print_format("%[' in objects.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -45,7 +45,7 @@ extern "C" { #endif // _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ #ifndef _di_fss_basic_list_write_error_parameter_value_missing_print_ - void fss_basic_list_write_error_parameter_value_missing_print(fss_basic_list_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) { + void fss_basic_list_write_error_parameter_value_missing_print(fss_basic_list_write_main_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -53,8 +53,8 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%S%S%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -301,9 +301,9 @@ extern "C" { status = fss_basic_list_write_process(main, output, quote, &object, &content, buffer); } - macro_f_string_dynamic_t_delete_simple(block); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &block); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); return status; } diff --git a/level_3/fss_basic_list_write/c/private-write.h b/level_3/fss_basic_list_write/c/private-write.h index f4c351b..d329d56 100644 --- a/level_3/fss_basic_list_write/c/private-write.h +++ b/level_3/fss_basic_list_write/c/private-write.h @@ -43,7 +43,7 @@ extern "C" { * The parameter name, such as "help" in "--help". */ #ifndef _di_fss_basic_list_write_error_parameter_value_missing_print_ - void fss_basic_list_write_error_parameter_value_missing_print(fss_basic_list_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) F_attribute_visibility_internal_d; + void fss_basic_list_write_error_parameter_value_missing_print(fss_basic_list_write_main_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_write_error_parameter_value_missing_print_ /** diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index b9469f2..6adfc15 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -7,6 +7,15 @@ extern "C" { #endif +#ifndef _di_fss_basic_read_program_version_ + const f_string_static_t fss_basic_read_program_version_s = macro_f_string_static_t_initialize2(FSS_BASIC_READ_program_version_s, 0, FSS_BASIC_READ_program_version_s_length); +#endif // _di_fss_basic_read_program_version_ + +#ifndef _di_fss_basic_read_program_name_ + const f_string_static_t fss_basic_read_program_name_s = macro_f_string_static_t_initialize2(FSS_BASIC_READ_program_name_s, 0, FSS_BASIC_READ_program_name_s_length); + const f_string_static_t fss_basic_read_program_name_long_s = macro_f_string_static_t_initialize2(FSS_BASIC_READ_program_name_long_s, 0, FSS_BASIC_READ_program_name_long_s_length); +#endif // _di_fss_basic_read_program_name_ + #ifndef _di_fss_basic_read_print_help_ f_status_t fss_basic_read_print_help(const f_file_t file, const f_color_context_t context) { @@ -14,32 +23,32 @@ extern "C" { fll_program_print_help_header(file, context, fss_basic_read_program_name_long_s, fss_basic_read_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_basic_read_short_at_s, fss_basic_read_long_at_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric index."); - fll_program_print_help_option(file, context, fss_basic_read_short_content_s, fss_basic_read_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Content (default)."); - fll_program_print_help_option(file, context, fss_basic_read_short_columns_s, fss_basic_read_long_columns_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of columns."); - fll_program_print_help_option(file, context, fss_basic_read_short_delimit_s, fss_basic_read_long_delimit_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Designate how to handle applying delimits."); - fll_program_print_help_option(file, context, fss_basic_read_short_depth_s, fss_basic_read_long_depth_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric depth."); - fll_program_print_help_option(file, context, fss_basic_read_short_empty_s, fss_basic_read_long_empty_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Include empty Content when processing."); - fll_program_print_help_option(file, context, fss_basic_read_short_line_s, fss_basic_read_long_line_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print only the Content at the given line."); - fll_program_print_help_option(file, context, fss_basic_read_short_name_s, fss_basic_read_long_name_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object with this name."); - fll_program_print_help_option(file, context, fss_basic_read_short_object_s, fss_basic_read_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Object."); - fll_program_print_help_option(file, context, fss_basic_read_short_pipe_s, fss_basic_read_long_pipe_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print using the special pipe format."); - fll_program_print_help_option(file, context, fss_basic_read_short_raw_s, fss_basic_read_long_raw_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print with the original quotes and escapes."); - fll_program_print_help_option(file, context, fss_basic_read_short_select_s, fss_basic_read_long_select_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select sub-Content at this index."); - fll_program_print_help_option(file, context, fss_basic_read_short_total_s, fss_basic_read_long_total_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of lines."); - fll_program_print_help_option(file, context, fss_basic_read_short_trim_s, fss_basic_read_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names on select or print."); + fll_program_print_help_option(file, context, fss_basic_read_short_at_s, fss_basic_read_long_at_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index."); + fll_program_print_help_option(file, context, fss_basic_read_short_content_s, fss_basic_read_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default)."); + fll_program_print_help_option(file, context, fss_basic_read_short_columns_s, fss_basic_read_long_columns_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of columns."); + fll_program_print_help_option(file, context, fss_basic_read_short_delimit_s, fss_basic_read_long_delimit_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Designate how to handle applying delimits."); + fll_program_print_help_option(file, context, fss_basic_read_short_depth_s, fss_basic_read_long_depth_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric depth."); + fll_program_print_help_option(file, context, fss_basic_read_short_empty_s, fss_basic_read_long_empty_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Include empty Content when processing."); + fll_program_print_help_option(file, context, fss_basic_read_short_line_s, fss_basic_read_long_line_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the Content at the given line."); + fll_program_print_help_option(file, context, fss_basic_read_short_name_s, fss_basic_read_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name."); + fll_program_print_help_option(file, context, fss_basic_read_short_object_s, fss_basic_read_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object."); + fll_program_print_help_option(file, context, fss_basic_read_short_pipe_s, fss_basic_read_long_pipe_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format."); + fll_program_print_help_option(file, context, fss_basic_read_short_raw_s, fss_basic_read_long_raw_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes."); + fll_program_print_help_option(file, context, fss_basic_read_short_select_s, fss_basic_read_long_select_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index."); + fll_program_print_help_option(file, context, fss_basic_read_short_total_s, fss_basic_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines."); + fll_program_print_help_option(file, context, fss_basic_read_short_trim_s, fss_basic_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print."); fll_program_print_help_usage(file, context, fss_basic_read_program_name_s, "filename(s)"); @@ -262,9 +271,9 @@ extern "C" { if (main->parameters[parameter_code[i]].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); - fl_print_format("%[' requires a %s.%]%q", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); + fl_print_format("%[' requires a %q.%]%q", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -305,10 +314,10 @@ extern "C" { if (main->parameters[parameter_code[i]].result == parameter_match[i]) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_columns_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_columns_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -324,10 +333,10 @@ extern "C" { if (main->parameters[fss_basic_read_parameter_total_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_pipe_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_pipe_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -337,10 +346,10 @@ extern "C" { else if (main->parameters[fss_basic_read_parameter_line_e].result == f_console_result_additional_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_pipe_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_pipe_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_line_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_line_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -365,13 +374,13 @@ extern "C" { } location = main->parameters[fss_basic_read_parameter_delimit_e].values.array[i]; - length = strnlen(arguments->argv[location], f_console_parameter_size); + length = strnlen(arguments->argv[location], F_console_parameter_size_d); if (!length) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit_s, main->error.notable); fl_print_format("%[' must not be empty.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -504,8 +513,8 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_basic_read_parameter_select_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, main->error.notable); fl_print_format("%[' parameter requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -629,7 +638,7 @@ extern "C" { fss_basic_read_data_delete_simple(&data); } else { - fll_print_format("%q%[%sYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); status = F_status_set_error(F_parameter); } @@ -653,12 +662,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_basic_read_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); return F_none; diff --git a/level_3/fss_basic_read/c/fss_basic_read.h b/level_3/fss_basic_read/c/fss_basic_read.h index 25afb88..7221c37 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.h +++ b/level_3/fss_basic_read/c/fss_basic_read.h @@ -12,15 +12,16 @@ * This processes in accordance to the FSS-0000 Basic specification. */ #ifndef _fss_basic_read_h +#define _fss_basic_read_h -// libc includes. +// Libc includes. #include #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -34,13 +35,13 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -52,24 +53,40 @@ extern "C" { #endif #ifndef _di_fss_basic_read_program_version_ - #define fss_basic_read_program_version_major_s F_string_ascii_0_s - #define fss_basic_read_program_version_minor_s F_string_ascii_5_s - #define fss_basic_read_program_version_micro_s F_string_ascii_8_s + #define FSS_BASIC_READ_program_version_major_s F_string_ascii_0_s + #define FSS_BASIC_READ_program_version_minor_s F_string_ascii_5_s + #define FSS_BASIC_READ_program_version_micro_s F_string_ascii_8_s - #ifndef fss_basic_read_program_version_nano_prefix_s - #define fss_basic_read_program_version_nano_prefix_s - #endif + #define FSS_BASIC_READ_program_version_major_s F_string_ascii_0_s_length + #define FSS_BASIC_READ_program_version_minor_s F_string_ascii_5_s_length + #define FSS_BASIC_READ_program_version_micro_s F_string_ascii_8_s_length - #ifndef fss_basic_read_program_version_nano_s - #define fss_basic_read_program_version_nano_s - #endif + #if !(defined(FSS_BASIC_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_READ_program_version_nano_prefix_s_length)) + #define FSS_BASIC_READ_program_version_nano_prefix_s + #define FSS_BASIC_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_BASIC_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_READ_program_version_nano_prefix_s_length)) - #define fss_basic_read_program_version_s fss_basic_read_program_version_major_s F_string_ascii_period_s fss_basic_read_program_version_minor_s F_string_ascii_period_s fss_basic_read_program_version_micro_s fss_basic_read_program_version_nano_prefix_s fss_basic_read_program_version_nano_s + #if !(defined(FSS_BASIC_READ_program_version_nano_s) && defined(FSS_BASIC_READ_program_version_nano_s_length)) + #define FSS_BASIC_READ_program_version_nano_s + #define FSS_BASIC_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_BASIC_READ_program_version_nano_s) && defined(FSS_BASIC_READ_program_version_nano_s_length)) + + #define FSS_BASIC_READ_program_version_s FSS_BASIC_READ_program_version_major_s F_string_ascii_period_s FSS_BASIC_READ_program_version_minor_s F_string_ascii_period_s FSS_BASIC_READ_program_version_micro_s FSS_BASIC_READ_program_version_nano_prefix_s FSS_BASIC_READ_program_version_nano_s + + #define FSS_BASIC_READ_program_version_s_length FSS_BASIC_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_READ_program_version_micro_s_length + FSS_BASIC_READ_program_version_nano_prefix_s_length + FSS_BASIC_READ_program_version_nano_s_length + + extern const f_string_static_t fss_basic_read_program_version_s; #endif // _di_fss_basic_read_program_version_ #ifndef _di_fss_basic_read_program_name_ - #define fss_basic_read_program_name_s "fss_basic_read" - #define fss_basic_read_program_name_long_s "FSS Basic Read" + #define FSS_BASIC_READ_program_name_s "fss_basic_read" + #define FSS_BASIC_READ_program_name_long_s "FSS Basic Read" + + #define FSS_BASIC_READ_program_name_s_length 14 + #define FSS_BASIC_READ_program_name_long_s_length 14 + + extern const f_string_static_t fss_basic_read_program_name_s; + extern const f_string_static_t fss_basic_read_program_name_long_s; #endif // _di_fss_basic_read_program_name_ #ifndef _di_fss_basic_read_defines_ diff --git a/level_3/fss_basic_read/c/main.c b/level_3/fss_basic_read/c/main.c index 56d401d..38a29b1 100644 --- a/level_3/fss_basic_read/c/main.c +++ b/level_3/fss_basic_read/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_basic_read_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_basic_read/c/private-common.c b/level_3/fss_basic_read/c/private-common.c index 7ba14e9..ee87a79 100644 --- a/level_3/fss_basic_read/c/private-common.c +++ b/level_3/fss_basic_read/c/private-common.c @@ -14,7 +14,7 @@ extern "C" { fss_basic_read_depths_resize(0, &data->depths); - macro_f_string_dynamic_t_delete_simple(data->buffer); + f_string_dynamic_resize(0, &data->buffer); macro_f_fss_contents_t_delete_simple(data->contents); macro_f_fss_objects_t_delete_simple(data->objects); macro_f_fss_delimits_t_delete_simple(data->delimits); @@ -66,7 +66,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_basic_read/c/private-read.c b/level_3/fss_basic_read/c/private-read.c index 7ced122..3079758 100644 --- a/level_3/fss_basic_read/c/private-read.c +++ b/level_3/fss_basic_read/c/private-read.c @@ -157,10 +157,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable); fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -173,8 +173,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, main->error.notable); fl_print_format("%[' may not have the value '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable); fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.context, main->error.context); @@ -250,7 +250,7 @@ extern "C" { if (main->parameters[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[parameter].values.array[main->parameters[parameter].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], f_console_parameter_size)); + const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], F_console_parameter_size_d)); const f_status_t status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, number); diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index a58a4f8..e5e8109 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -6,6 +6,15 @@ extern "C" { #endif +#ifndef _di_byte_dump_program_version_ + const f_string_static_t fss_basic_write_program_version_s = macro_f_string_static_t_initialize2(FSS_BASIC_WRITE_program_version_s, 0, FSS_BASIC_WRITE_program_version_s_length); +#endif // _di_byte_dump_program_version_ + +#ifndef _di_byte_dump_program_name_ + const f_string_static_t fss_basic_write_program_name_s = macro_f_string_static_t_initialize2(FSS_BASIC_WRITE_program_name_s, 0, FSS_BASIC_WRITE_program_name_s_length); + const f_string_static_t fss_basic_write_program_name_long_s = macro_f_string_static_t_initialize2(FSS_BASIC_WRITE_program_name_long_s, 0, FSS_BASIC_WRITE_program_name_long_s_length); +#endif // _di_byte_dump_program_name_ + #ifndef _di_fss_basic_write_print_help_ f_status_t fss_basic_write_print_help(const f_file_t file, const f_color_context_t context) { @@ -13,27 +22,27 @@ extern "C" { fll_program_print_help_header(file, context, fss_basic_write_program_name_long_s, fss_basic_write_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_basic_write_short_file_s, fss_basic_write_long_file_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a file to send data to."); - fll_program_print_help_option(file, context, fss_basic_write_short_content_s, fss_basic_write_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "The Content to file."); - fll_program_print_help_option(file, context, fss_basic_write_short_double_s, fss_basic_write_long_double_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use double quotes (default)."); - fll_program_print_help_option(file, context, fss_basic_write_short_ignore_s, fss_basic_write_long_ignore_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Ignore a given range within a Content."); - fll_program_print_help_option(file, context, fss_basic_write_short_object_s, fss_basic_write_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " The Object to file."); - fll_program_print_help_option(file, context, fss_basic_write_short_partial_s, fss_basic_write_long_partial_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Do not file end of Object/Content character."); - fll_program_print_help_option(file, context, fss_basic_write_short_prepend_s, fss_basic_write_long_prepend_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Prepend the given whitespace characters to the start of each multi-line Content."); - fll_program_print_help_option(file, context, fss_basic_write_short_single_s, fss_basic_write_long_single_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use single quotes."); - fll_program_print_help_option(file, context, fss_basic_write_short_trim_s, fss_basic_write_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names."); + fll_program_print_help_option(file, context, fss_basic_write_short_file_s, fss_basic_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to."); + fll_program_print_help_option(file, context, fss_basic_write_short_content_s, fss_basic_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The Content to file."); + fll_program_print_help_option(file, context, fss_basic_write_short_double_s, fss_basic_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default)."); + fll_program_print_help_option(file, context, fss_basic_write_short_ignore_s, fss_basic_write_long_ignore_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Ignore a given range within a Content."); + fll_program_print_help_option(file, context, fss_basic_write_short_object_s, fss_basic_write_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The Object to file."); + fll_program_print_help_option(file, context, fss_basic_write_short_partial_s, fss_basic_write_long_partial_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Do not file end of Object/Content character."); + fll_program_print_help_option(file, context, fss_basic_write_short_prepend_s, fss_basic_write_long_prepend_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Prepend the given whitespace characters to the start of each multi-line Content."); + fll_program_print_help_option(file, context, fss_basic_write_short_single_s, fss_basic_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes."); + fll_program_print_help_option(file, context, fss_basic_write_short_trim_s, fss_basic_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names."); fll_program_print_help_usage(file, context, fss_basic_write_program_name_s, f_string_empty_s); @@ -164,8 +173,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_file_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_file_s, main->error.notable); fl_print_format("%[' may only be specified once.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -186,7 +195,7 @@ extern "C" { } } else if (main->parameters[fss_basic_write_parameter_file_e].result == f_console_result_found_e) { - fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_basic_write_long_file_s); + fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_write_long_file_s); status = F_status_set_error(F_parameter); } } @@ -195,11 +204,11 @@ extern "C" { if (main->parameters[fss_basic_write_parameter_object_e].locations.used || main->parameters[fss_basic_write_parameter_content_e].locations.used) { if (main->parameters[fss_basic_write_parameter_object_e].locations.used) { if (main->parameters[fss_basic_write_parameter_object_e].locations.used != main->parameters[fss_basic_write_parameter_object_e].values.used) { - fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_basic_write_long_object_s); + fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_write_long_object_s); status = F_status_set_error(F_parameter); } else if (main->parameters[fss_basic_write_parameter_content_e].locations.used != main->parameters[fss_basic_write_parameter_content_e].values.used) { - fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_basic_write_long_content_s); + fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_write_long_content_s); status = F_status_set_error(F_parameter); } else if (main->parameters[fss_basic_write_parameter_object_e].locations.used != main->parameters[fss_basic_write_parameter_content_e].locations.used && main->parameters[fss_basic_write_parameter_partial_e].result == f_console_result_none_e) { @@ -211,12 +220,12 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter only allows either the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_object_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_object_s, main->error.notable); fl_print_format("%[' parameter or the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_content_s, main->error.notable); fl_print_format("%[' parameter, but not both.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -243,10 +252,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_object_s, main->error.notable); fl_print_format("%[' parameter must be specified before a '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -262,7 +271,7 @@ extern "C" { } else if (main->parameters[fss_basic_write_parameter_content_e].locations.used) { if (main->parameters[fss_basic_write_parameter_content_e].locations.used != main->parameters[fss_basic_write_parameter_content_e].values.used) { - fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_basic_write_long_content_s); + fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_write_long_content_s); status = F_status_set_error(F_parameter); } else if (!main->parameters[fss_basic_write_parameter_partial_e].locations.used) { @@ -275,10 +284,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_object_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -292,8 +301,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter cannot be used when processing a pipe.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -309,8 +318,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_prepend_s, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -320,7 +329,7 @@ extern "C" { } else if (main->parameters[fss_basic_write_parameter_prepend_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[fss_basic_write_parameter_prepend_e].values.array[main->parameters[fss_basic_write_parameter_prepend_e].values.used - 1]; - const f_array_length_t length = strnlen(arguments->argv[index], f_console_parameter_size); + const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d); // Even though this standard does not utilize this parameter, provide the validation for consistency. if (length) { @@ -336,8 +345,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_prepend_s, main->error.notable); fl_print_format("%[' must only contain whitespace.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -353,8 +362,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_prepend_s, main->error.notable); fl_print_format("%[' must not be an empty string.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -370,8 +379,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_ignore_s, main->error.notable); fl_print_format("%[' was specified, but no values were given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -386,8 +395,8 @@ extern "C" { if (total_locations * 2 > total_arguments) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_ignore_s, main->error.notable); fl_print_format("%[' requires two values.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -426,7 +435,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -448,7 +457,7 @@ extern "C" { } object.string = arguments->argv[main->parameters[fss_basic_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; status = fss_basic_write_process(main, output, quote, &object, 0, &buffer); @@ -467,7 +476,7 @@ extern "C" { } content.string = arguments->argv[main->parameters[fss_basic_write_parameter_content_e].values.array[i]]; - content.used = strnlen(content.string, f_console_parameter_size); + content.used = strnlen(content.string, F_console_parameter_size_d); content.size = content.used; status = fss_basic_write_process(main, output, quote, 0, &content, &buffer); @@ -484,11 +493,11 @@ extern "C" { } object.string = arguments->argv[main->parameters[fss_basic_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; content.string = arguments->argv[main->parameters[fss_basic_write_parameter_content_e].values.array[i]]; - content.used = strnlen(content.string, f_console_parameter_size); + content.used = strnlen(content.string, F_console_parameter_size_d); content.size = content.used; status = fss_basic_write_process(main, output, quote, &object, &content, &buffer); @@ -500,7 +509,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -513,7 +522,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(escaped); + f_string_dynamic_resize(0, &escaped); // Object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free(). object.string = 0; @@ -538,9 +547,9 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(buffer); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &buffer); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); fss_basic_write_main_delete(main); return status; @@ -552,12 +561,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_basic_write_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/fss_basic_write/c/fss_basic_write.h b/level_3/fss_basic_write/c/fss_basic_write.h index a17d328..1d9341e 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.h +++ b/level_3/fss_basic_write/c/fss_basic_write.h @@ -8,14 +8,15 @@ * This program provides fss basic write functionality. */ #ifndef _fss_basic_write_h +#define _fss_basic_write_h -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -28,13 +29,13 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -45,24 +46,40 @@ extern "C" { #endif #ifndef _di_fss_basic_write_program_version_ - #define fss_basic_write_program_version_major_s F_string_ascii_0_s - #define fss_basic_write_program_version_minor_s F_string_ascii_5_s - #define fss_basic_write_program_version_micro_s F_string_ascii_8_s + #define FSS_BASIC_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_BASIC_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_BASIC_WRITE_program_version_micro_s F_string_ascii_8_s - #ifndef fss_basic_write_program_version_nano_prefix_s - #define fss_basic_write_program_version_nano_prefix_s - #endif + #define FSS_BASIC_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_BASIC_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_BASIC_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_basic_write_program_version_nano_s - #define fss_basic_write_program_version_nano_s - #endif + #if !(defined(FSS_BASIC_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_WRITE_program_version_nano_prefix_s_length)) + #define FSS_BASIC_WRITE_program_version_nano_prefix_s + #define FSS_BASIC_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_BASIC_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_WRITE_program_version_nano_prefix_s_length)) - #define fss_basic_write_program_version_s fss_basic_write_program_version_major_s F_string_ascii_period_s fss_basic_write_program_version_minor_s F_string_ascii_period_s fss_basic_write_program_version_micro_s fss_basic_write_program_version_nano_prefix_s fss_basic_write_program_version_nano_s + #if !(defined(FSS_BASIC_WRITE_program_version_nano_s) && defined(FSS_BASIC_WRITE_program_version_nano_s_length)) + #define FSS_BASIC_WRITE_program_version_nano_s + #define FSS_BASIC_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_BASIC_WRITE_program_version_nano_s) && defined(FSS_BASIC_WRITE_program_version_nano_s_length)) + + #define FSS_BASIC_WRITE_program_version_s FSS_BASIC_WRITE_program_version_major_s F_string_ascii_period_s FSS_BASIC_WRITE_program_version_minor_s F_string_ascii_period_s FSS_BASIC_WRITE_program_version_micro_s FSS_BASIC_WRITE_program_version_nano_prefix_s FSS_BASIC_WRITE_program_version_nano_s + + #define FSS_BASIC_WRITE_program_version_s_length FSS_BASIC_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_WRITE_program_version_micro_s_length + FSS_BASIC_WRITE_program_version_nano_prefix_s_length + FSS_BASIC_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_basic_write_program_version_s; #endif // _di_fss_basic_write_program_version_ #ifndef _di_fss_basic_write_program_name_ - #define fss_basic_write_program_name_s "fss_basic_write" - #define fss_basic_write_program_name_long_s "FSS Basic Write" + #define FSS_BASIC_WRITE_program_name_s "fss_basic_write" + #define FSS_BASIC_WRITE_program_name_long_s "FSS Basic Write" + + #define FSS_BASIC_WRITE_program_name_s_length 15 + #define FSS_BASIC_WRITE_program_name_long_s_length 15 + + extern const f_string_static_t fss_basic_write_program_name_s; + extern const f_string_static_t fss_basic_write_program_name_long_s; #endif // _di_fss_basic_write_program_name_ #ifndef _di_fss_basic_write_defines_ diff --git a/level_3/fss_basic_write/c/main.c b/level_3/fss_basic_write/c/main.c index 1e8da75..e1bc3b6 100644 --- a/level_3/fss_basic_write/c/main.c +++ b/level_3/fss_basic_write/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_basic_write_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_basic_write/c/private-common.c b/level_3/fss_basic_write/c/private-common.c index 33c5829..92f508b 100644 --- a/level_3/fss_basic_write/c/private-common.c +++ b/level_3/fss_basic_write/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_basic_write/c/private-write.c b/level_3/fss_basic_write/c/private-write.c index 582ba1e..533da2e 100644 --- a/level_3/fss_basic_write/c/private-write.c +++ b/level_3/fss_basic_write/c/private-write.c @@ -15,12 +15,12 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_object_s, main->error.notable); + fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_content_s, main->error.notable); + fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -28,7 +28,7 @@ extern "C" { #endif // _di_fss_basic_write_error_parameter_same_times_print_ #ifndef _di_fss_basic_write_error_parameter_value_missing_print_ - void fss_basic_write_error_parameter_value_missing_print(fss_basic_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) { + void fss_basic_write_error_parameter_value_missing_print(fss_basic_write_main_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -36,8 +36,8 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%S%S%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -53,7 +53,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable); fl_print_format("%[' in objects.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -269,7 +269,7 @@ extern "C" { if (block.string[range.start] == fss_basic_write_pipe_content_start_s) { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sThis standard only supports one content per object.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThis standard only supports one content per object.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } status = F_status_set_error(F_supported_not); @@ -320,9 +320,9 @@ extern "C" { status = fss_basic_write_process(main, output, quote, &object, &content, buffer); } - macro_f_string_dynamic_t_delete_simple(block); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &block); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); return status; } diff --git a/level_3/fss_basic_write/c/private-write.h b/level_3/fss_basic_write/c/private-write.h index 8c456c6..fab8ad2 100644 --- a/level_3/fss_basic_write/c/private-write.h +++ b/level_3/fss_basic_write/c/private-write.h @@ -33,7 +33,7 @@ extern "C" { * The parameter name, such as "help" in "--help". */ #ifndef _di_fss_basic_write_error_parameter_value_missing_print_ - void fss_basic_write_error_parameter_value_missing_print(fss_basic_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) F_attribute_visibility_internal_d; + void fss_basic_write_error_parameter_value_missing_print(fss_basic_write_main_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; #endif // _di_fss_basic_write_error_parameter_value_missing_print_ /** diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c index d586353..08ff4a6 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c @@ -7,6 +7,15 @@ extern "C" { #endif +#ifndef _di_fss_embedded_list_read_program_version_ + const f_string_static_t fss_embedded_list_read_program_version_s = macro_f_string_static_t_initialize2(FSS_EMBEDDED_LIST_READ_program_version_s, 0, FSS_EMBEDDED_LIST_READ_program_version_s_length); +#endif // _di_fss_embedded_list_read_program_version_ + +#ifndef _di_fss_embedded_list_read_program_name_ + const f_string_static_t fss_embedded_list_read_program_name_s = macro_f_string_static_t_initialize2(FSS_EMBEDDED_LIST_READ_program_name_s, 0, FSS_EMBEDDED_LIST_READ_program_name_s_length); + const f_string_static_t fss_embedded_list_read_program_name_long_s = macro_f_string_static_t_initialize2(FSS_EMBEDDED_LIST_READ_program_name_long_s, 0, FSS_EMBEDDED_LIST_READ_program_name_long_s_length); +#endif // _di_fss_embedded_list_read_program_name_ + #ifndef _di_fss_embedded_list_read_print_help_ f_status_t fss_embedded_list_read_print_help(const f_file_t file, const f_color_context_t context) { @@ -14,32 +23,32 @@ extern "C" { fll_program_print_help_header(file, context, fss_embedded_list_read_program_name_long_s, fss_embedded_list_read_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_at_s, fss_embedded_list_read_long_at_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric index."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_content_s, fss_embedded_list_read_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Content (default)."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_columns_s, fss_embedded_list_read_long_columns_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of columns."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_delimit_s, fss_embedded_list_read_long_delimit_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Designate how to handle applying delimits."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_depth_s, fss_embedded_list_read_long_depth_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric depth."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_empty_s, fss_embedded_list_read_long_empty_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Include empty Content when processing."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_line_s, fss_embedded_list_read_long_line_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print only the Content at the given line."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_name_s, fss_embedded_list_read_long_name_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object with this name."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_object_s, fss_embedded_list_read_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Object."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_pipe_s, fss_embedded_list_read_long_pipe_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print using the special pipe format."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_raw_s, fss_embedded_list_read_long_raw_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print with the original quotes and escapes."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_select_s, fss_embedded_list_read_long_select_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select sub-Content at this index."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_total_s, fss_embedded_list_read_long_total_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of lines."); - fll_program_print_help_option(file, context, fss_embedded_list_read_short_trim_s, fss_embedded_list_read_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names on select or print."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_at_s, fss_embedded_list_read_long_at_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_content_s, fss_embedded_list_read_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default)."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_columns_s, fss_embedded_list_read_long_columns_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of columns."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_delimit_s, fss_embedded_list_read_long_delimit_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Designate how to handle applying delimits."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_depth_s, fss_embedded_list_read_long_depth_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric depth."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_empty_s, fss_embedded_list_read_long_empty_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Include empty Content when processing."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_line_s, fss_embedded_list_read_long_line_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the Content at the given line."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_name_s, fss_embedded_list_read_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_object_s, fss_embedded_list_read_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_pipe_s, fss_embedded_list_read_long_pipe_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_raw_s, fss_embedded_list_read_long_raw_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_select_s, fss_embedded_list_read_long_select_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_total_s, fss_embedded_list_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines."); + fll_program_print_help_option(file, context, fss_embedded_list_read_short_trim_s, fss_embedded_list_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print."); fll_program_print_help_usage(file, context, fss_embedded_list_read_program_name_s, "filename(s)"); @@ -217,10 +226,10 @@ extern "C" { if (main->parameters[fss_embedded_list_read_parameter_columns_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -233,8 +242,8 @@ extern "C" { if (main->parameters[fss_embedded_list_read_parameter_at_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at_s, main->error.notable); fl_print_format("%[' requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -245,8 +254,8 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_depth_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, main->error.notable); fl_print_format("%[' requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -257,8 +266,8 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_line_e].result == f_console_result_additional_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_line_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_line_s, main->error.notable); fl_print_format("%[' requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -269,8 +278,8 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_name_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name_s, main->error.notable); fl_print_format("%[' requires a string.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -281,8 +290,8 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_select_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, main->error.notable); fl_print_format("%[' requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -294,10 +303,10 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_line_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_line_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -310,10 +319,10 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_pipe_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_pipe_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -326,8 +335,8 @@ extern "C" { if (main->parameters[fss_embedded_list_read_parameter_delimit_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, main->error.notable); fl_print_format("%[' requires a value.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -336,13 +345,13 @@ extern "C" { } else if (main->parameters[fss_embedded_list_read_parameter_delimit_e].result == f_console_result_additional_e) { const f_array_length_t location = main->parameters[fss_embedded_list_read_parameter_delimit_e].values.array[0]; - f_array_length_t length = strnlen(arguments->argv[location], f_console_parameter_size); + f_array_length_t length = strnlen(arguments->argv[location], F_console_parameter_size_d); if (length == 0) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, main->error.notable); fl_print_format("%[' must not be empty.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -406,8 +415,8 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_select_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, main->error.notable); fl_print_format("%[' parameter requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -435,7 +444,7 @@ extern "C" { // Clear buffers before continuing. macro_f_fss_nest_t_delete_simple(main->nest); - macro_f_string_dynamic_t_delete_simple(main->buffer); + f_string_dynamic_resize(0, &main->buffer); } if (F_status_is_error_not(status) && main->remaining.used > 0) { @@ -500,12 +509,12 @@ extern "C" { // Clear buffers before repeating the loop. macro_f_fss_nest_t_delete_simple(main->nest); - macro_f_string_dynamic_t_delete_simple(main->buffer); + f_string_dynamic_resize(0, &main->buffer); } // for if (F_status_is_error(status)) { macro_f_fss_nest_t_delete_simple(main->nest); - macro_f_string_dynamic_t_delete_simple(main->buffer); + f_string_dynamic_resize(0, &main->buffer); } } @@ -515,7 +524,7 @@ extern "C" { macro_f_fss_comments_t_delete_simple(comments); } else { - fll_print_format("%q%[%sYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); status = F_status_set_error(F_parameter); } @@ -538,15 +547,15 @@ extern "C" { for (f_array_length_t i = 0; i < fss_embedded_list_read_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for macro_f_fss_nest_t_delete_simple(main->nest); - macro_f_string_dynamic_t_delete_simple(main->buffer); - macro_f_array_lengths_t_delete_simple(main->remaining); + f_string_dynamic_resize(0, &main->buffer); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h index 1c37af0..75738e2 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h @@ -12,15 +12,16 @@ * This processes in accordance to the FSS-0008 Embedded List specification. */ #ifndef _fss_embedded_list_read_h +#define _fss_embedded_list_read_h -// libc includes. +// Libc includes. #include #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -34,13 +35,13 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -52,24 +53,40 @@ extern "C" { #endif #ifndef _di_fss_embedded_list_read_program_version_ - #define fss_embedded_list_read_program_version_major_s F_string_ascii_0_s - #define fss_embedded_list_read_program_version_minor_s F_string_ascii_5_s - #define fss_embedded_list_read_program_version_micro_s F_string_ascii_8_s + #define FSS_EMBEDDED_LIST_READ_program_version_major_s F_string_ascii_0_s + #define FSS_EMBEDDED_LIST_READ_program_version_minor_s F_string_ascii_5_s + #define FSS_EMBEDDED_LIST_READ_program_version_micro_s F_string_ascii_8_s - #ifndef fss_embedded_list_read_program_version_nano_prefix_s - #define fss_embedded_list_read_program_version_nano_prefix_s - #endif + #define FSS_EMBEDDED_LIST_READ_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EMBEDDED_LIST_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EMBEDDED_LIST_READ_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_embedded_list_read_program_version_nano_s - #define fss_embedded_list_read_program_version_nano_s - #endif + #if !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length)) + #define FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s + #define FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length)) - #define fss_embedded_list_read_program_version_s fss_embedded_list_read_program_version_major_s F_string_ascii_period_s fss_embedded_list_read_program_version_minor_s F_string_ascii_period_s fss_embedded_list_read_program_version_micro_s fss_embedded_list_read_program_version_nano_prefix_s fss_embedded_list_read_program_version_nano_s + #if !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s_length)) + #define FSS_EMBEDDED_LIST_READ_program_version_nano_s + #define FSS_EMBEDDED_LIST_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s_length)) + + #define FSS_EMBEDDED_LIST_READ_program_version_s FSS_EMBEDDED_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_EMBEDDED_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_EMBEDDED_LIST_READ_program_version_micro_s FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s FSS_EMBEDDED_LIST_READ_program_version_nano_s + + #define FSS_EMBEDDED_LIST_READ_program_version_s_length FSS_EMBEDDED_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_READ_program_version_micro_s_length + FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length + FSS_EMBEDDED_LIST_READ_program_version_nano_s_length + + extern const f_string_static_t fss_embedded_list_read_program_version_s; #endif // _di_fss_embedded_list_read_program_version_ #ifndef _di_fss_embedded_list_read_program_name_ - #define fss_embedded_list_read_program_name_s "fss_embedded_list_read" - #define fss_embedded_list_read_program_name_long_s "FSS Embedded List Read" + #define FSS_EMBEDDED_LIST_READ_program_name_s "fss_embedded_list_read" + #define FSS_EMBEDDED_LIST_READ_program_name_long_s "FSS Embedded List Read" + + #define FSS_EMBEDDED_LIST_READ_program_name_s_length 22 + #define FSS_EMBEDDED_LIST_READ_program_name_long_s_length 22 + + extern const f_string_static_t fss_embedded_list_read_program_name_s; + extern const f_string_static_t fss_embedded_list_read_program_name_long_s; #endif // _di_fss_embedded_list_read_program_name_ #ifndef _di_fss_embedded_list_read_defines_ diff --git a/level_3/fss_embedded_list_read/c/main.c b/level_3/fss_embedded_list_read/c/main.c index 37877e9..a54f01a 100644 --- a/level_3/fss_embedded_list_read/c/main.c +++ b/level_3/fss_embedded_list_read/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_embedded_list_read_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_embedded_list_read/c/private-common.c b/level_3/fss_embedded_list_read/c/private-common.c index e9ae811..c067b9f 100644 --- a/level_3/fss_embedded_list_read/c/private-common.c +++ b/level_3/fss_embedded_list_read/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_embedded_list_read/c/private-read.c b/level_3/fss_embedded_list_read/c/private-read.c index c5adf99..8728436 100644 --- a/level_3/fss_embedded_list_read/c/private-read.c +++ b/level_3/fss_embedded_list_read/c/private-read.c @@ -172,7 +172,7 @@ extern "C" { depths->array[depths->used].value_name.used = 0; if (main->parameters[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e) { - status = fl_string_rip(arguments->argv[values_order[i]], strnlen(arguments->argv[values_order[i]], f_console_parameter_size), &depths->array[depths->used].value_name); + status = fl_string_rip(arguments->argv[values_order[i]], strnlen(arguments->argv[values_order[i]], F_console_parameter_size_d), &depths->array[depths->used].value_name); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fl_string_rip", F_true); @@ -181,7 +181,7 @@ extern "C" { } } else { - status = f_string_append(arguments->argv[values_order[i]], strnlen(arguments->argv[values_order[i]], f_console_parameter_size), &depths->array[depths->used].value_name); + status = f_string_append(arguments->argv[values_order[i]], strnlen(arguments->argv[values_order[i]], F_console_parameter_size_d), &depths->array[depths->used].value_name); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true); @@ -202,10 +202,10 @@ extern "C" { if (depths->array[i].depth == depths->array[j].depth) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, depths->array[i].depth, main->error.notable); fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.notable, main->error.notable); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -215,8 +215,8 @@ extern "C" { else if (depths->array[i].depth > depths->array[j].depth) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, main->error.notable); fl_print_format("%[' may not have the value '%]", main->error.to.stream, main->error.notable, main->error.notable); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, depths->array[i].depth, main->error.notable); fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.notable, main->error.notable); @@ -255,7 +255,7 @@ extern "C" { } else if (status == F_data_not_stop || status == F_data_not_eos) { macro_f_fss_nest_t_delete_simple(main->nest); - macro_f_string_dynamic_t_delete_simple(main->buffer); + f_string_dynamic_resize(0, &main->buffer); if (main->parameters[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) { fll_print_format("0%q", main->output.to.stream, f_string_eol_s); @@ -268,7 +268,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_fss_nest_t_delete_simple(main->nest); - macro_f_string_dynamic_t_delete_simple(main->buffer); + f_string_dynamic_resize(0, &main->buffer); return status; } diff --git a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c index bbe48bb..bcf9f6a 100644 --- a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c +++ b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c @@ -6,6 +6,15 @@ extern "C" { #endif +#ifndef _di_fss_embedded_list_write_program_version_ + const f_string_static_t fss_embedded_list_write_program_version_s = macro_f_string_static_t_initialize2(FSS_EMBEDDED_LIST_WRITE_program_version_s, 0, FSS_EMBEDDED_LIST_WRITE_program_version_s_length); +#endif // _di_fss_embedded_list_write_program_version_ + +#ifndef _di_fss_embedded_list_write_program_name_ + const f_string_static_t fss_embedded_list_write_program_name_s = macro_f_string_static_t_initialize2(FSS_EMBEDDED_LIST_WRITE_program_name_s, 0, FSS_EMBEDDED_LIST_WRITE_program_name_s_length); + const f_string_static_t fss_embedded_list_write_program_name_long_s = macro_f_string_static_t_initialize2(FSS_EMBEDDED_LIST_WRITE_program_name_long_s, 0, FSS_EMBEDDED_LIST_WRITE_program_name_long_s_length); +#endif // _di_fss_embedded_list_write_program_name_ + #ifndef _di_fss_embedded_list_write_print_help_ f_status_t fss_embedded_list_write_print_help(const f_file_t file, const f_color_context_t context) { @@ -13,27 +22,27 @@ extern "C" { fll_program_print_help_header(file, context, fss_embedded_list_write_program_name_long_s, fss_embedded_list_write_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_embedded_list_write_short_file_s, fss_embedded_list_write_long_file_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a file to send data to."); - fll_program_print_help_option(file, context, fss_embedded_list_write_short_content_s, fss_embedded_list_write_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "The Content to file."); - fll_program_print_help_option(file, context, fss_embedded_list_write_short_double_s, fss_embedded_list_write_long_double_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use double quotes (default)."); - fll_program_print_help_option(file, context, fss_embedded_list_write_short_ignore_s, fss_embedded_list_write_long_ignore_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Ignore a given range within a Content."); - fll_program_print_help_option(file, context, fss_embedded_list_write_short_object_s, fss_embedded_list_write_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " The Object to file."); - fll_program_print_help_option(file, context, fss_embedded_list_write_short_partial_s, fss_embedded_list_write_long_partial_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Do not file end of Object/Content character."); - fll_program_print_help_option(file, context, fss_embedded_list_write_short_prepend_s, fss_embedded_list_write_long_prepend_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Prepend the given whitespace characters to the start of each multi-line Content."); - fll_program_print_help_option(file, context, fss_embedded_list_write_short_single_s, fss_embedded_list_write_long_single_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use single quotes."); - fll_program_print_help_option(file, context, fss_embedded_list_write_short_trim_s, fss_embedded_list_write_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names."); + fll_program_print_help_option(file, context, fss_embedded_list_write_short_file_s, fss_embedded_list_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to."); + fll_program_print_help_option(file, context, fss_embedded_list_write_short_content_s, fss_embedded_list_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The Content to file."); + fll_program_print_help_option(file, context, fss_embedded_list_write_short_double_s, fss_embedded_list_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default)."); + fll_program_print_help_option(file, context, fss_embedded_list_write_short_ignore_s, fss_embedded_list_write_long_ignore_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Ignore a given range within a Content."); + fll_program_print_help_option(file, context, fss_embedded_list_write_short_object_s, fss_embedded_list_write_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The Object to file."); + fll_program_print_help_option(file, context, fss_embedded_list_write_short_partial_s, fss_embedded_list_write_long_partial_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Do not file end of Object/Content character."); + fll_program_print_help_option(file, context, fss_embedded_list_write_short_prepend_s, fss_embedded_list_write_long_prepend_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Prepend the given whitespace characters to the start of each multi-line Content."); + fll_program_print_help_option(file, context, fss_embedded_list_write_short_single_s, fss_embedded_list_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes."); + fll_program_print_help_option(file, context, fss_embedded_list_write_short_trim_s, fss_embedded_list_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names."); fll_program_print_help_usage(file, context, fss_embedded_list_write_program_name_s, f_string_empty_s); @@ -167,8 +176,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_file_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_file_s, main->error.notable); fl_print_format("%[' may only be specified once.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -198,11 +207,11 @@ extern "C" { if (main->parameters[fss_embedded_list_write_parameter_object_e].locations.used || main->parameters[fss_embedded_list_write_parameter_content_e].locations.used) { if (main->parameters[fss_embedded_list_write_parameter_object_e].locations.used) { if (main->parameters[fss_embedded_list_write_parameter_object_e].locations.used != main->parameters[fss_embedded_list_write_parameter_object_e].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_embedded_list_write_long_object_s); + fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s); status = F_status_set_error(F_parameter); } else if (main->parameters[fss_embedded_list_write_parameter_content_e].locations.used != main->parameters[fss_embedded_list_write_parameter_content_e].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_embedded_list_write_long_content_s); + fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s); status = F_status_set_error(F_parameter); } else if (main->parameters[fss_embedded_list_write_parameter_object_e].locations.used != main->parameters[fss_embedded_list_write_parameter_content_e].locations.used && main->parameters[fss_embedded_list_write_parameter_partial_e].result == f_console_result_none_e) { @@ -214,12 +223,12 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter only allows either the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s, main->error.notable); fl_print_format("%[' parameter or the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, main->error.notable); fl_print_format("%[' parameter, but not both.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -246,10 +255,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s, main->error.notable); fl_print_format("%[' parameter must be specified before a '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -265,7 +274,7 @@ extern "C" { } else if (main->parameters[fss_embedded_list_write_parameter_content_e].locations.used) { if (main->parameters[fss_embedded_list_write_parameter_content_e].locations.used != main->parameters[fss_embedded_list_write_parameter_content_e].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_embedded_list_write_long_content_s); + fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s); status = F_status_set_error(F_parameter); } else if (!main->parameters[fss_embedded_list_write_parameter_partial_e].locations.used) { @@ -278,10 +287,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -295,8 +304,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter cannot be used when processing a pipe.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -312,8 +321,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend_s, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -323,7 +332,7 @@ extern "C" { } else if (main->parameters[fss_embedded_list_write_parameter_prepend_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[fss_embedded_list_write_parameter_prepend_e].values.array[main->parameters[fss_embedded_list_write_parameter_prepend_e].values.used - 1]; - const f_array_length_t length = strnlen(arguments->argv[index], f_console_parameter_size); + const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d); if (length) { f_string_range_t range = macro_f_string_range_t_initialize(length); @@ -341,8 +350,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend_s, main->error.notable); fl_print_format("%[' must only contain whitespace.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -358,8 +367,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend_s, main->error.notable); fl_print_format("%[' must not be an empty string.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -375,8 +384,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore_s, main->error.notable); fl_print_format("%[' was specified, but no values were given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -391,8 +400,8 @@ extern "C" { if (total_locations * 2 > total_arguments) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore_s, main->error.notable); fl_print_format("%[' requires two values.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -432,7 +441,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -455,7 +464,7 @@ extern "C" { } object.string = arguments->argv[main->parameters[fss_embedded_list_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; status = fss_embedded_list_write_process(main, output, quote, &object, 0, 0, &buffer); @@ -475,7 +484,7 @@ extern "C" { if (F_status_is_error(status)) break; content.string = arguments->argv[main->parameters[fss_embedded_list_write_parameter_content_e].values.array[i]]; - content.used = strnlen(content.string, f_console_parameter_size); + content.used = strnlen(content.string, F_console_parameter_size_d); content.size = content.used; status = fss_embedded_list_write_process(main, output, quote, 0, &content, &ignore, &buffer); @@ -496,11 +505,11 @@ extern "C" { if (F_status_is_error(status)) break; object.string = arguments->argv[main->parameters[fss_embedded_list_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; content.string = arguments->argv[main->parameters[fss_embedded_list_write_parameter_content_e].values.array[i]]; - content.used = strnlen(content.string, f_console_parameter_size); + content.used = strnlen(content.string, F_console_parameter_size_d); content.size = content.used; status = fss_embedded_list_write_process(main, output, quote, &object, &content, &ignore, &buffer); @@ -512,7 +521,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -525,7 +534,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(escaped); + f_string_dynamic_resize(0, &escaped); macro_f_string_ranges_t_delete_simple(ignore); // Object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free(). @@ -551,9 +560,9 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(buffer); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &buffer); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); fss_embedded_list_write_main_delete(main); return status; @@ -565,12 +574,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_embedded_list_write_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.h b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.h index 2ddc235..d909d50 100644 --- a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.h +++ b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.h @@ -8,14 +8,15 @@ * This program provides FSS-0008 Embedded List write functionality. */ #ifndef _fss_embedded_list_write_h +#define _fss_embedded_list_write_h -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -28,14 +29,14 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -45,24 +46,40 @@ extern "C" { #endif #ifndef _di_fss_embedded_list_write_program_version_ - #define fss_embedded_list_write_program_version_major_s F_string_ascii_0_s - #define fss_embedded_list_write_program_version_minor_s F_string_ascii_5_s - #define fss_embedded_list_write_program_version_micro_s F_string_ascii_8_s + #define FSS_EMBEDDED_LIST_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_EMBEDDED_LIST_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_EMBEDDED_LIST_WRITE_program_version_micro_s F_string_ascii_8_s - #ifndef fss_embedded_list_write_program_version_nano_prefix_s - #define fss_embedded_list_write_program_version_nano_prefix_s - #endif + #define FSS_EMBEDDED_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EMBEDDED_LIST_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EMBEDDED_LIST_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_embedded_list_write_program_version_nano_s - #define fss_embedded_list_write_program_version_nano_s - #endif + #if !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length)) + #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s + #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length)) - #define fss_embedded_list_write_program_version_s fss_embedded_list_write_program_version_major_s F_string_ascii_period_s fss_embedded_list_write_program_version_minor_s F_string_ascii_period_s fss_embedded_list_write_program_version_micro_s fss_embedded_list_write_program_version_nano_prefix_s fss_embedded_list_write_program_version_nano_s + #if !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length)) + #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_s + #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length)) + + #define FSS_EMBEDDED_LIST_WRITE_program_version_s FSS_EMBEDDED_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_EMBEDDED_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EMBEDDED_LIST_WRITE_program_version_micro_s FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s FSS_EMBEDDED_LIST_WRITE_program_version_nano_s + + #define FSS_EMBEDDED_LIST_WRITE_program_version_s_length FSS_EMBEDDED_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_micro_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_embedded_list_write_program_version_s; #endif // _di_fss_embedded_list_write_program_version_ #ifndef _di_fss_embedded_list_write_program_name_ - #define fss_embedded_list_write_program_name_s "fss_embedded_list_write" - #define fss_embedded_list_write_program_name_long_s "FSS Embedded List Write" + #define FSS_EMBEDDED_LIST_WRITE_program_name_s "fss_embedded_list_write" + #define FSS_EMBEDDED_LIST_WRITE_program_name_long_s "FSS Embedded List Write" + + #define FSS_EMBEDDED_LIST_WRITE_program_name_s_length 23 + #define FSS_EMBEDDED_LIST_WRITE_program_name_long_s_length 23 + + extern const f_string_static_t fss_embedded_list_write_program_name_s; + extern const f_string_static_t fss_embedded_list_write_program_name_long_s; #endif // _di_fss_embedded_list_write_program_name_ #ifndef _di_fss_embedded_list_write_defines_ diff --git a/level_3/fss_embedded_list_write/c/main.c b/level_3/fss_embedded_list_write/c/main.c index bba3014..8d9854d 100644 --- a/level_3/fss_embedded_list_write/c/main.c +++ b/level_3/fss_embedded_list_write/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_embedded_list_write_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_embedded_list_write/c/private-common.c b/level_3/fss_embedded_list_write/c/private-common.c index cce3865..35f7fc9 100644 --- a/level_3/fss_embedded_list_write/c/private-common.c +++ b/level_3/fss_embedded_list_write/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_embedded_list_write/c/private-write.c b/level_3/fss_embedded_list_write/c/private-write.c index 737100f..4042c5c 100644 --- a/level_3/fss_embedded_list_write/c/private-write.c +++ b/level_3/fss_embedded_list_write/c/private-write.c @@ -15,12 +15,12 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s, main->error.notable); + fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, main->error.notable); + fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -36,7 +36,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable); fl_print_format("%[' in objects.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -45,7 +45,7 @@ extern "C" { #endif // _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ #ifndef _di_fss_embedded_list_write_error_parameter_value_missing_print_ - void fss_embedded_list_write_error_parameter_value_missing_print(fss_embedded_list_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) { + void fss_embedded_list_write_error_parameter_value_missing_print(fss_embedded_list_write_main_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -53,8 +53,8 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%S%S%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -162,9 +162,9 @@ extern "C" { for (;;) { if (fss_embedded_list_write_signal_received(main)) { - macro_f_string_dynamic_t_delete_simple(block); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &block); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); return F_status_set_error(F_interrupt); } @@ -265,7 +265,7 @@ extern "C" { if (block.string[range.start] == fss_embedded_list_write_pipe_content_start_s) { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sThis standard only supports one content per object.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThis standard only supports one content per object.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } status = F_status_set_error(F_supported_not); @@ -344,9 +344,9 @@ extern "C" { status = fss_embedded_list_write_process(main, output, quote, &object, &content, ignore, buffer); } - macro_f_string_dynamic_t_delete_simple(block); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &block); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); return status; } @@ -402,7 +402,7 @@ extern "C" { index = main->parameters[fss_embedded_list_write_parameter_ignore_e].values.array[i * 2]; range.start = 0; - range.stop = strnlen(arguments->argv[index], f_console_parameter_size) - 1; + range.stop = strnlen(arguments->argv[index], F_console_parameter_size_d) - 1; // allow and ignore the positive sign. if (range.stop > 0 && arguments->argv[index][0] == '+') { @@ -422,7 +422,7 @@ extern "C" { index = main->parameters[fss_embedded_list_write_parameter_ignore_e].values.array[(i * 2) + 1]; range.start = 0; - range.stop = strnlen(arguments->argv[index], f_console_parameter_size) - 1; + range.stop = strnlen(arguments->argv[index], F_console_parameter_size_d) - 1; // allow and ignore the positive sign. if (range.stop > 0 && arguments->argv[index][0] == '+') { diff --git a/level_3/fss_embedded_list_write/c/private-write.h b/level_3/fss_embedded_list_write/c/private-write.h index b6abc13..6a4d9f5 100644 --- a/level_3/fss_embedded_list_write/c/private-write.h +++ b/level_3/fss_embedded_list_write/c/private-write.h @@ -43,7 +43,7 @@ extern "C" { * The parameter name, such as "help" in "--help". */ #ifndef _di_fss_embedded_list_write_error_parameter_value_missing_print_ - void fss_embedded_list_write_error_parameter_value_missing_print(fss_embedded_list_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) F_attribute_visibility_internal_d; + void fss_embedded_list_write_error_parameter_value_missing_print(fss_embedded_list_write_main_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_write_error_parameter_value_missing_print_ /** diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index d4b97d0..f0e8c4a 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -7,6 +7,15 @@ extern "C" { #endif +#ifndef _di_fss_extended_list_read_program_version_ + const f_string_static_t fss_extended_list_read_program_version_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_LIST_READ_program_version_s, 0, FSS_EXTENDED_LIST_READ_program_version_s_length); +#endif // _di_fss_extended_list_read_program_version_ + +#ifndef _di_fss_extended_list_read_program_name_ + const f_string_static_t fss_extended_list_read_program_name_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_LIST_READ_program_name_s, 0, FSS_EXTENDED_LIST_READ_program_name_s_length); + const f_string_static_t fss_extended_list_read_program_name_long_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_LIST_READ_program_name_long_s, 0, FSS_EXTENDED_LIST_READ_program_name_long_s_length); +#endif // _di_fss_extended_list_read_program_name_ + #ifndef _di_fss_extended_list_read_print_help_ f_status_t fss_extended_list_read_print_help(const f_file_t file, const f_color_context_t context) { @@ -14,32 +23,32 @@ extern "C" { fll_program_print_help_header(file, context, fss_extended_list_read_program_name_long_s, fss_extended_list_read_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_extended_list_read_short_at_s, fss_extended_list_read_long_at_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric index."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_content_s, fss_extended_list_read_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Content (default)."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_columns_s, fss_extended_list_read_long_columns_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of columns."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_delimit_s, fss_extended_list_read_long_delimit_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Designate how to handle applying delimits."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_depth_s, fss_extended_list_read_long_depth_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric depth."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_empty_s, fss_extended_list_read_long_empty_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Include empty Content when processing."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_line_s, fss_extended_list_read_long_line_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print only the Content at the given line."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_name_s, fss_extended_list_read_long_name_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object with this name."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_object_s, fss_extended_list_read_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Object."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_pipe_s, fss_extended_list_read_long_pipe_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print using the special pipe format."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_raw_s, fss_extended_list_read_long_raw_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print with the original quotes and escapes."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_select_s, fss_extended_list_read_long_select_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select sub-Content at this index."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_total_s, fss_extended_list_read_long_total_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of lines."); - fll_program_print_help_option(file, context, fss_extended_list_read_short_trim_s, fss_extended_list_read_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names on select or print."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_at_s, fss_extended_list_read_long_at_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_content_s, fss_extended_list_read_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default)."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_columns_s, fss_extended_list_read_long_columns_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of columns."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_delimit_s, fss_extended_list_read_long_delimit_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Designate how to handle applying delimits."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_depth_s, fss_extended_list_read_long_depth_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric depth."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_empty_s, fss_extended_list_read_long_empty_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Include empty Content when processing."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_line_s, fss_extended_list_read_long_line_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the Content at the given line."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_name_s, fss_extended_list_read_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_object_s, fss_extended_list_read_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_pipe_s, fss_extended_list_read_long_pipe_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_raw_s, fss_extended_list_read_long_raw_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_select_s, fss_extended_list_read_long_select_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_total_s, fss_extended_list_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_trim_s, fss_extended_list_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print."); fll_program_print_help_usage(file, context, fss_extended_list_read_program_name_s, "filename(s)"); @@ -262,8 +271,8 @@ extern "C" { if (main->parameters[parameter_code[i]].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); fl_print_format("%[' requires a %s.%]%q", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -284,7 +293,7 @@ extern "C" { fss_extended_list_read_parameter_total_e, }; - const f_string_t parameter_name[] = { + const f_string_static_t parameter_name[] = { fss_extended_list_read_long_depth_s, fss_extended_list_read_long_line_s, fss_extended_list_read_long_pipe_s, @@ -305,10 +314,10 @@ extern "C" { if (main->parameters[parameter_code[i]].result == parameter_match[i]) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_columns_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_columns_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -324,10 +333,10 @@ extern "C" { if (main->parameters[fss_extended_list_read_parameter_total_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -337,10 +346,10 @@ extern "C" { else if (main->parameters[fss_extended_list_read_parameter_line_e].result == f_console_result_additional_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_line_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_line_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -365,13 +374,13 @@ extern "C" { } location = main->parameters[fss_extended_list_read_parameter_delimit_e].values.array[i]; - length = strnlen(arguments->argv[location], f_console_parameter_size); + length = strnlen(arguments->argv[location], F_console_parameter_size_d); if (!length) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit_s, main->error.notable); fl_print_format("%[' must not be empty.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -504,8 +513,8 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_extended_list_read_parameter_select_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, main->error.notable); fl_print_format("%[' parameter requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -629,7 +638,7 @@ extern "C" { fss_extended_list_read_data_delete_simple(&data); } else { - fll_print_format("%q%[%sYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); status = F_status_set_error(F_parameter); } @@ -653,12 +662,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_extended_list_read_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); return F_none; diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.h b/level_3/fss_extended_list_read/c/fss_extended_list_read.h index 0d0400c..038cf34 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.h +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.h @@ -12,15 +12,16 @@ * This processes in accordance to the FSS-0003 Extended List specification. */ #ifndef _fss_extended_list_read_h +#define _fss_extended_list_read_h -// libc includes. +// Libc includes. #include #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -34,13 +35,13 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -52,24 +53,40 @@ extern "C" { #endif #ifndef _di_fss_extended_list_read_program_version_ - #define fss_extended_list_read_program_version_major_s F_string_ascii_0_s - #define fss_extended_list_read_program_version_minor_s F_string_ascii_5_s - #define fss_extended_list_read_program_version_micro_s F_string_ascii_8_s + #define FSS_EXTENDED_LIST_READ_program_version_major_s F_string_ascii_0_s + #define FSS_EXTENDED_LIST_READ_program_version_minor_s F_string_ascii_5_s + #define FSS_EXTENDED_LIST_READ_program_version_micro_s F_string_ascii_8_s - #ifndef fss_extended_list_read_version_nano_prefix_s - #define fss_extended_list_read_version_nano_prefix_s - #endif + #define FSS_EXTENDED_LIST_READ_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EXTENDED_LIST_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EXTENDED_LIST_READ_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_extended_list_read_version_nano_s - #define fss_extended_list_read_version_nano_s - #endif + #if !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s_length)) + #define FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s + #define FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s_length)) - #define fss_extended_list_read_program_version_s fss_extended_list_read_program_version_major_s F_string_ascii_period_s fss_extended_list_read_program_version_minor_s F_string_ascii_period_s fss_extended_list_read_program_version_micro_s fss_extended_list_read_version_nano_prefix_s fss_extended_list_read_version_nano_s + #if !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_s_length)) + #define FSS_EXTENDED_LIST_READ_program_version_nano_s + #define FSS_EXTENDED_LIST_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_s_length)) + + #define FSS_EXTENDED_LIST_READ_program_version_s FSS_EXTENDED_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_LIST_READ_program_version_micro_s FSS_EXTENDED_LIST_READ_version_nano_prefix_s FSS_EXTENDED_LIST_READ_version_nano_s + + #define FSS_EXTENDED_LIST_READ_program_version_s_length FSS_EXTENDED_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_READ_program_version_micro_s_length + FSS_EXTENDED_LIST_READ_version_nano_prefix_s_length + FSS_EXTENDED_LIST_READ_version_nano_s_length + + extern const f_string_static_t fss_extended_list_read_program_version_s; #endif // _di_fss_extended_list_read_program_version_ #ifndef _di_fss_extended_list_read_program_name_ - #define fss_extended_list_read_program_name_s "fss_extended_list_read" - #define fss_extended_list_read_program_name_long_s "FSS Extended List Read" + #define FSS_EXTENDED_LIST_READ_program_name_s "fss_extended_list_read" + #define FSS_EXTENDED_LIST_READ_program_name_long_s "FSS Extended List Read" + + #define FSS_EXTENDED_LIST_READ_program_name_s_length 22 + #define FSS_EXTENDED_LIST_READ_program_name_long_s_length 22 + + extern const f_string_static_t fss_extended_list_read_program_name_s; + extern const f_string_static_t fss_extended_list_read_program_name_long_s; #endif // _di_fss_extended_list_read_program_name_ #ifndef _di_fss_extended_list_read_defines_ diff --git a/level_3/fss_extended_list_read/c/main.c b/level_3/fss_extended_list_read/c/main.c index 9abf610..e29bdff 100644 --- a/level_3/fss_extended_list_read/c/main.c +++ b/level_3/fss_extended_list_read/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_extended_list_read_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_extended_list_read/c/private-common.c b/level_3/fss_extended_list_read/c/private-common.c index f027a08..ed5a0e9 100644 --- a/level_3/fss_extended_list_read/c/private-common.c +++ b/level_3/fss_extended_list_read/c/private-common.c @@ -14,7 +14,7 @@ extern "C" { fss_extended_list_read_depths_resize(0, &data->depths); - macro_f_string_dynamic_t_delete_simple(data->buffer); + f_string_dynamic_resize(0, &data->buffer); macro_f_fss_contents_t_delete_simple(data->contents); macro_f_fss_objects_t_delete_simple(data->objects); macro_f_fss_delimits_t_delete_simple(data->delimits_object); @@ -67,7 +67,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_extended_list_read/c/private-read.c b/level_3/fss_extended_list_read/c/private-read.c index 58fa3fb..789e36e 100644 --- a/level_3/fss_extended_list_read/c/private-read.c +++ b/level_3/fss_extended_list_read/c/private-read.c @@ -180,10 +180,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable); fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -195,8 +195,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, main->error.notable); fl_print_format("%[' may not have the value '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable); fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.context, main->error.context); @@ -272,7 +272,7 @@ extern "C" { if (main->parameters[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[parameter].values.array[main->parameters[parameter].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], f_console_parameter_size)); + const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], F_console_parameter_size_d)); const f_status_t status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, number); diff --git a/level_3/fss_extended_list_write/c/fss_extended_list_write.c b/level_3/fss_extended_list_write/c/fss_extended_list_write.c index 08cd0d3..fc91c0a 100644 --- a/level_3/fss_extended_list_write/c/fss_extended_list_write.c +++ b/level_3/fss_extended_list_write/c/fss_extended_list_write.c @@ -6,6 +6,15 @@ extern "C" { #endif +#ifndef _di_fss_extended_list_write_program_version_ + const f_string_static_t fss_extended_list_write_program_version_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_LIST_WRITE_program_version_s, 0, FSS_EXTENDED_LIST_WRITE_program_version_s_length); +#endif // _di_fss_extended_list_write_program_version_ + +#ifndef _di_fss_extended_list_write_program_name_ + const f_string_static_t fss_extended_list_write_program_name_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_LIST_WRITE_program_name_s, 0, FSS_EXTENDED_LIST_WRITE_program_name_s_length); + const f_string_static_t fss_extended_list_write_program_name_long_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_LIST_WRITE_program_name_long_s, 0, FSS_EXTENDED_LIST_WRITE_program_name_long_s_length); +#endif // _di_fss_extended_list_write_program_name_ + #ifndef _di_fss_extended_list_write_print_help_ f_status_t fss_extended_list_write_print_help(const f_file_t file, const f_color_context_t context) { @@ -13,27 +22,27 @@ extern "C" { fll_program_print_help_header(file, context, fss_extended_list_write_program_name_long_s, fss_extended_list_write_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_extended_list_write_short_file_s, fss_extended_list_write_long_file_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a file to send data to."); - fll_program_print_help_option(file, context, fss_extended_list_write_short_content_s, fss_extended_list_write_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "The Content to file."); - fll_program_print_help_option(file, context, fss_extended_list_write_short_double_s, fss_extended_list_write_long_double_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use double quotes (default)."); - fll_program_print_help_option(file, context, fss_extended_list_write_short_ignore_s, fss_extended_list_write_long_ignore_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Ignore a given range within a Content."); - fll_program_print_help_option(file, context, fss_extended_list_write_short_object_s, fss_extended_list_write_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " The Object to file."); - fll_program_print_help_option(file, context, fss_extended_list_write_short_partial_s, fss_extended_list_write_long_partial_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Do not file end of Object/Content character."); - fll_program_print_help_option(file, context, fss_extended_list_write_short_prepend_s, fss_extended_list_write_long_prepend_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Prepend the given whitespace characters to the start of each multi-line Content."); - fll_program_print_help_option(file, context, fss_extended_list_write_short_single_s, fss_extended_list_write_long_single_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use single quotes."); - fll_program_print_help_option(file, context, fss_extended_list_write_short_trim_s, fss_extended_list_write_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names."); + fll_program_print_help_option(file, context, fss_extended_list_write_short_file_s, fss_extended_list_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to."); + fll_program_print_help_option(file, context, fss_extended_list_write_short_content_s, fss_extended_list_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The Content to file."); + fll_program_print_help_option(file, context, fss_extended_list_write_short_double_s, fss_extended_list_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default)."); + fll_program_print_help_option(file, context, fss_extended_list_write_short_ignore_s, fss_extended_list_write_long_ignore_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Ignore a given range within a Content."); + fll_program_print_help_option(file, context, fss_extended_list_write_short_object_s, fss_extended_list_write_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The Object to file."); + fll_program_print_help_option(file, context, fss_extended_list_write_short_partial_s, fss_extended_list_write_long_partial_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Do not file end of Object/Content character."); + fll_program_print_help_option(file, context, fss_extended_list_write_short_prepend_s, fss_extended_list_write_long_prepend_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Prepend the given whitespace characters to the start of each multi-line Content."); + fll_program_print_help_option(file, context, fss_extended_list_write_short_single_s, fss_extended_list_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes."); + fll_program_print_help_option(file, context, fss_extended_list_write_short_trim_s, fss_extended_list_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names."); fll_program_print_help_usage(file, context, fss_extended_list_write_program_name_s, f_string_empty_s); @@ -167,8 +176,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_file_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_file_s, main->error.notable); fl_print_format("%[' may only be specified once.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -189,7 +198,7 @@ extern "C" { } } else if (main->parameters[fss_extended_list_write_parameter_file_e].result == f_console_result_found_e) { - fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_extended_list_write_long_file_s); + fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_list_write_long_file_s); status = F_status_set_error(F_parameter); } } @@ -198,11 +207,11 @@ extern "C" { if (main->parameters[fss_extended_list_write_parameter_object_e].locations.used || main->parameters[fss_extended_list_write_parameter_content_e].locations.used) { if (main->parameters[fss_extended_list_write_parameter_object_e].locations.used) { if (main->parameters[fss_extended_list_write_parameter_object_e].locations.used != main->parameters[fss_extended_list_write_parameter_object_e].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_extended_list_write_long_object_s); + fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s); status = F_status_set_error(F_parameter); } else if (main->parameters[fss_extended_list_write_parameter_content_e].locations.used != main->parameters[fss_extended_list_write_parameter_content_e].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_extended_list_write_long_content_s); + fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s); status = F_status_set_error(F_parameter); } else if (main->parameters[fss_extended_list_write_parameter_object_e].locations.used != main->parameters[fss_extended_list_write_parameter_content_e].locations.used && main->parameters[fss_extended_list_write_parameter_partial_e].result == f_console_result_none_e) { @@ -214,12 +223,12 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter only allows either the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s, main->error.notable); fl_print_format("%[' parameter or the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, main->error.notable); fl_print_format("%[' parameter, but not both.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -246,10 +255,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s, main->error.notable); fl_print_format("%[' parameter must be specified before a '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -264,7 +273,7 @@ extern "C" { } else if (main->parameters[fss_extended_list_write_parameter_content_e].locations.used) { if (main->parameters[fss_extended_list_write_parameter_content_e].locations.used != main->parameters[fss_extended_list_write_parameter_content_e].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_extended_list_write_long_content_s); + fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s); status = F_status_set_error(F_parameter); } else if (!main->parameters[fss_extended_list_write_parameter_partial_e].locations.used) { @@ -277,10 +286,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -294,8 +303,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter cannot be used when processing a pipe.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -311,8 +320,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend_s, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -322,7 +331,7 @@ extern "C" { } else if (main->parameters[fss_extended_list_write_parameter_prepend_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[fss_extended_list_write_parameter_prepend_e].values.array[main->parameters[fss_extended_list_write_parameter_prepend_e].values.used - 1]; - const f_array_length_t length = strnlen(arguments->argv[index], f_console_parameter_size); + const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d); if (length) { f_string_range_t range = macro_f_string_range_t_initialize(length); @@ -340,8 +349,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend_s, main->error.notable); fl_print_format("%[' must only contain whitespace.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -357,8 +366,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend_s, main->error.notable); fl_print_format("%[' must not be an empty string.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -374,8 +383,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore_s, main->error.notable); fl_print_format("%[' was specified, but no values were given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -390,8 +399,8 @@ extern "C" { if (total_locations * 2 > total_arguments) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore_s, main->error.notable); fl_print_format("%[' requires two values.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -431,7 +440,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -454,7 +463,7 @@ extern "C" { } object.string = arguments->argv[main->parameters[fss_extended_list_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; status = fss_extended_list_write_process(main, output, quote, &object, 0, 0, &buffer); @@ -474,7 +483,7 @@ extern "C" { if (F_status_is_error(status)) break; content.string = arguments->argv[main->parameters[fss_extended_list_write_parameter_content_e].values.array[i]]; - content.used = strnlen(content.string, f_console_parameter_size); + content.used = strnlen(content.string, F_console_parameter_size_d); content.size = content.used; status = fss_extended_list_write_process(main, output, quote, 0, &content, &ignore, &buffer); @@ -495,11 +504,11 @@ extern "C" { if (F_status_is_error(status)) break; object.string = arguments->argv[main->parameters[fss_extended_list_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; content.string = arguments->argv[main->parameters[fss_extended_list_write_parameter_content_e].values.array[i]]; - content.used = strnlen(content.string, f_console_parameter_size); + content.used = strnlen(content.string, F_console_parameter_size_d); content.size = content.used; status = fss_extended_list_write_process(main, output, quote, &object, &content, &ignore, &buffer); @@ -511,7 +520,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -524,7 +533,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(escaped); + f_string_dynamic_resize(0, &escaped); macro_f_string_ranges_t_delete_simple(ignore); // Object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free(). @@ -550,9 +559,9 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(buffer); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &buffer); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); fss_extended_list_write_main_delete(main); return status; @@ -564,12 +573,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_extended_list_write_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/fss_extended_list_write/c/fss_extended_list_write.h b/level_3/fss_extended_list_write/c/fss_extended_list_write.h index 8eda7fd..61c592a 100644 --- a/level_3/fss_extended_list_write/c/fss_extended_list_write.h +++ b/level_3/fss_extended_list_write/c/fss_extended_list_write.h @@ -8,14 +8,15 @@ * This program provides FSS-0003 Extended List write functionality. */ #ifndef _fss_extended_list_write_h +#define _fss_extended_list_write_h -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -28,14 +29,14 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -45,24 +46,40 @@ extern "C" { #endif #ifndef _di_fss_extended_list_write_program_version_ - #define fss_extended_list_write_program_version_major_s F_string_ascii_0_s - #define fss_extended_list_write_program_version_minor_s F_string_ascii_5_s - #define fss_extended_list_write_program_version_micro_s F_string_ascii_8_s + #define FSS_EXTENDED_LIST_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_EXTENDED_LIST_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_EXTENDED_LIST_WRITE_program_version_micro_s F_string_ascii_8_s - #ifndef fss_extended_list_write_program_version_nano_prefix_s - #define fss_extended_list_write_program_version_nano_prefix_s - #endif + #define FSS_EXTENDED_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EXTENDED_LIST_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EXTENDED_LIST_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_extended_list_write_program_version_nano_s - #define fss_extended_list_write_program_version_nano_s - #endif + #if !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length)) + #define FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s + #define FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length)) - #define fss_extended_list_write_program_version_s fss_extended_list_write_program_version_major_s F_string_ascii_period_s fss_extended_list_write_program_version_minor_s F_string_ascii_period_s fss_extended_list_write_program_version_micro_s fss_extended_list_write_program_version_nano_prefix_s fss_extended_list_write_program_version_nano_s + #if !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length)) + #define FSS_EXTENDED_LIST_WRITE_program_version_nano_s + #define FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length)) + + #define FSS_EXTENDED_LIST_WRITE_program_version_s FSS_EXTENDED_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_LIST_WRITE_program_version_micro_s FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s FSS_EXTENDED_LIST_WRITE_program_version_nano_s + + #define FSS_EXTENDED_LIST_WRITE_program_version_s_length FSS_EXTENDED_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_WRITE_program_version_micro_s_length + FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length + FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_extended_list_write_program_version_s; #endif // _di_fss_extended_list_write_program_version_ #ifndef _di_fss_extended_list_write_program_name_ - #define fss_extended_list_write_program_name_s "fss_extended_list_write" - #define fss_extended_list_write_program_name_long_s "FSS Extended List Write" + #define FSS_EXTENDED_LIST_WRITE_program_name_s "fss_extended_list_write" + #define FSS_EXTENDED_LIST_WRITE_program_name_long_s "FSS Extended List Write" + + #define FSS_EXTENDED_LIST_WRITE_program_name_s_length 23 + #define FSS_EXTENDED_LIST_WRITE_program_name_long_s_length 23 + + extern const f_string_static_t fss_extended_list_write_program_name_s; + extern const f_string_static_t fss_extended_list_write_program_name_long_s; #endif // _di_fss_extended_list_write_program_name_ #ifndef _di_fss_extended_list_write_defines_ diff --git a/level_3/fss_extended_list_write/c/main.c b/level_3/fss_extended_list_write/c/main.c index 17615f5..3eb348b 100644 --- a/level_3/fss_extended_list_write/c/main.c +++ b/level_3/fss_extended_list_write/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_extended_list_write_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_extended_list_write/c/private-common.c b/level_3/fss_extended_list_write/c/private-common.c index 3417754..7d670ff 100644 --- a/level_3/fss_extended_list_write/c/private-common.c +++ b/level_3/fss_extended_list_write/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_extended_list_write/c/private-write.c b/level_3/fss_extended_list_write/c/private-write.c index c01c886..63c1f28 100644 --- a/level_3/fss_extended_list_write/c/private-write.c +++ b/level_3/fss_extended_list_write/c/private-write.c @@ -15,12 +15,12 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s, main->error.notable); + fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, main->error.notable); + fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -36,7 +36,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable); fl_print_format("%[' in objects.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -45,7 +45,7 @@ extern "C" { #endif // _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ #ifndef _di_fss_extended_list_write_error_parameter_value_missing_print_ - void fss_extended_list_write_error_parameter_value_missing_print(fss_extended_list_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) { + void fss_extended_list_write_error_parameter_value_missing_print(fss_extended_list_write_main_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -53,8 +53,8 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%S%S%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -262,7 +262,7 @@ extern "C" { if (block.string[range.start] == fss_extended_list_write_pipe_content_start_s) { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sThis standard only supports one content per object.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThis standard only supports one content per object.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } status = F_status_set_error(F_supported_not); @@ -341,9 +341,9 @@ extern "C" { status = fss_extended_list_write_process(main, output, quote, &object, &content, ignore, buffer); } - macro_f_string_dynamic_t_delete_simple(block); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &block); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); return status; } @@ -399,7 +399,7 @@ extern "C" { index = main->parameters[fss_extended_list_write_parameter_ignore_e].values.array[i * 2]; range.start = 0; - range.stop = strnlen(arguments->argv[index], f_console_parameter_size) - 1; + range.stop = strnlen(arguments->argv[index], F_console_parameter_size_d) - 1; // allow and ignore the positive sign. if (range.stop > 0 && arguments->argv[index][0] == '+') { @@ -419,7 +419,7 @@ extern "C" { index = main->parameters[fss_extended_list_write_parameter_ignore_e].values.array[(i * 2) + 1]; range.start = 0; - range.stop = strnlen(arguments->argv[index], f_console_parameter_size) - 1; + range.stop = strnlen(arguments->argv[index], F_console_parameter_size_d) - 1; // allow and ignore the positive sign. if (range.stop > 0 && arguments->argv[index][0] == '+') { diff --git a/level_3/fss_extended_list_write/c/private-write.h b/level_3/fss_extended_list_write/c/private-write.h index bdcb28c..0acd101 100644 --- a/level_3/fss_extended_list_write/c/private-write.h +++ b/level_3/fss_extended_list_write/c/private-write.h @@ -43,7 +43,7 @@ extern "C" { * The parameter name, such as "help" in "--help". */ #ifndef _di_fss_extended_list_write_error_parameter_value_missing_print_ - void fss_extended_list_write_error_parameter_value_missing_print(fss_extended_list_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) F_attribute_visibility_internal_d; + void fss_extended_list_write_error_parameter_value_missing_print(fss_extended_list_write_main_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_write_error_parameter_value_missing_print_ /** diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 08bf2c7..f743753 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -7,6 +7,15 @@ extern "C" { #endif +#ifndef _di_fss_extended_read_program_version_ + const f_string_static_t fss_extended_read_program_version_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_READ_program_version_s, 0, FSS_EXTENDED_READ_program_version_s_length); +#endif // _di_fss_extended_read_program_version_ + +#ifndef _di_fss_extended_read_program_name_ + const f_string_static_t fss_extended_read_program_name_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_READ_program_name_s, 0, FSS_EXTENDED_READ_program_name_s_length); + const f_string_static_t fss_extended_read_program_name_long_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_READ_program_name_long_s, 0, FSS_EXTENDED_READ_program_name_long_s_length); +#endif // _di_fss_extended_read_program_name_ + #ifndef _di_fss_extended_read_print_help_ f_status_t fss_extended_read_print_help(const f_file_t file, const f_color_context_t context) { @@ -14,32 +23,32 @@ extern "C" { fll_program_print_help_header(file, context, fss_extended_read_program_name_long_s, fss_extended_read_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_extended_read_short_at_s, fss_extended_read_long_at_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric index."); - fll_program_print_help_option(file, context, fss_extended_read_short_content_s, fss_extended_read_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Content (default)."); - fll_program_print_help_option(file, context, fss_extended_read_short_columns_s, fss_extended_read_long_columns_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of columns."); - fll_program_print_help_option(file, context, fss_extended_read_short_delimit_s, fss_extended_read_long_delimit_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Designate how to handle applying delimits."); - fll_program_print_help_option(file, context, fss_extended_read_short_depth_s, fss_extended_read_long_depth_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric depth."); - fll_program_print_help_option(file, context, fss_extended_read_short_empty_s, fss_extended_read_long_empty_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Include empty Content when processing."); - fll_program_print_help_option(file, context, fss_extended_read_short_line_s, fss_extended_read_long_line_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print only the Content at the given line."); - fll_program_print_help_option(file, context, fss_extended_read_short_name_s, fss_extended_read_long_name_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object with this name."); - fll_program_print_help_option(file, context, fss_extended_read_short_object_s, fss_extended_read_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Object."); - fll_program_print_help_option(file, context, fss_extended_read_short_pipe_s, fss_extended_read_long_pipe_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print using the special pipe format."); - fll_program_print_help_option(file, context, fss_extended_read_short_raw_s, fss_extended_read_long_raw_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print with the original quotes and escapes."); - fll_program_print_help_option(file, context, fss_extended_read_short_select_s, fss_extended_read_long_select_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select sub-Content at this index."); - fll_program_print_help_option(file, context, fss_extended_read_short_total_s, fss_extended_read_long_total_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of lines."); - fll_program_print_help_option(file, context, fss_extended_read_short_trim_s, fss_extended_read_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names on select or print."); + fll_program_print_help_option(file, context, fss_extended_read_short_at_s, fss_extended_read_long_at_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index."); + fll_program_print_help_option(file, context, fss_extended_read_short_content_s, fss_extended_read_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default)."); + fll_program_print_help_option(file, context, fss_extended_read_short_columns_s, fss_extended_read_long_columns_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of columns."); + fll_program_print_help_option(file, context, fss_extended_read_short_delimit_s, fss_extended_read_long_delimit_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Designate how to handle applying delimits."); + fll_program_print_help_option(file, context, fss_extended_read_short_depth_s, fss_extended_read_long_depth_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric depth."); + fll_program_print_help_option(file, context, fss_extended_read_short_empty_s, fss_extended_read_long_empty_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Include empty Content when processing."); + fll_program_print_help_option(file, context, fss_extended_read_short_line_s, fss_extended_read_long_line_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the Content at the given line."); + fll_program_print_help_option(file, context, fss_extended_read_short_name_s, fss_extended_read_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name."); + fll_program_print_help_option(file, context, fss_extended_read_short_object_s, fss_extended_read_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object."); + fll_program_print_help_option(file, context, fss_extended_read_short_pipe_s, fss_extended_read_long_pipe_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format."); + fll_program_print_help_option(file, context, fss_extended_read_short_raw_s, fss_extended_read_long_raw_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes."); + fll_program_print_help_option(file, context, fss_extended_read_short_select_s, fss_extended_read_long_select_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index."); + fll_program_print_help_option(file, context, fss_extended_read_short_total_s, fss_extended_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines."); + fll_program_print_help_option(file, context, fss_extended_read_short_trim_s, fss_extended_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print."); fll_program_print_help_usage(file, context, fss_extended_read_program_name_s, "filename(s)"); @@ -235,7 +244,7 @@ extern "C" { fss_extended_read_parameter_delimit_e, }; - const f_string_t parameter_name[] = { + const f_string_static_t parameter_name[] = { fss_extended_read_long_at_s, fss_extended_read_long_depth_s, fss_extended_read_long_line_s, @@ -262,8 +271,8 @@ extern "C" { if (main->parameters[parameter_code[i]].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); fl_print_format("%[' requires a %s.%]%q", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -304,10 +313,10 @@ extern "C" { if (main->parameters[parameter_code[i]].result == parameter_match[i]) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_columns_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_columns_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -322,10 +331,10 @@ extern "C" { if (main->parameters[fss_extended_read_parameter_total_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_pipe_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_pipe_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -335,10 +344,10 @@ extern "C" { else if (main->parameters[fss_extended_read_parameter_line_e].result == f_console_result_additional_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_pipe_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_pipe_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_line_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_line_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -367,13 +376,13 @@ extern "C" { } location = main->parameters[fss_extended_read_parameter_delimit_e].values.array[i]; - length = strnlen(arguments->argv[location], f_console_parameter_size); + length = strnlen(arguments->argv[location], F_console_parameter_size_d); if (!length) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit_s, main->error.notable); fl_print_format("%[' must not be empty.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -506,8 +515,8 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_extended_read_parameter_select_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, main->error.notable); fl_print_format("%[' parameter requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -636,7 +645,7 @@ extern "C" { fss_extended_read_data_delete_simple(&data); } else { - fll_print_format("%q%[%sYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); status = F_status_set_error(F_parameter); } @@ -660,12 +669,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_extended_read_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); return F_none; diff --git a/level_3/fss_extended_read/c/fss_extended_read.h b/level_3/fss_extended_read/c/fss_extended_read.h index 3077064..d28fa02 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.h +++ b/level_3/fss_extended_read/c/fss_extended_read.h @@ -12,15 +12,16 @@ * This processes in accordance to the FSS-0001 Extended specification. */ #ifndef _fss_extended_read_h +#define _fss_extended_read_h -// libc includes. +// Libc includes. #include #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -34,13 +35,13 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -52,24 +53,40 @@ extern "C" { #endif #ifndef _di_fss_extended_read_program_version_ - #define fss_extended_read_program_version_major_s F_string_ascii_0_s - #define fss_extended_read_program_version_minor_s F_string_ascii_5_s - #define fss_extended_read_program_version_micro_s F_string_ascii_8_s + #define FSS_EXTENDED_READ_program_version_major_s F_string_ascii_0_s + #define FSS_EXTENDED_READ_program_version_minor_s F_string_ascii_5_s + #define FSS_EXTENDED_READ_program_version_micro_s F_string_ascii_8_s - #ifndef fss_extended_read_program_version_nano_prefix_s - #define fss_extended_read_program_version_nano_prefix_s - #endif + #define FSS_EXTENDED_READ_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EXTENDED_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EXTENDED_READ_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_extended_read_program_version_nano_s - #define fss_extended_read_program_version_nano_s - #endif + #if !(defined(FSS_EXTENDED_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_READ_program_version_nano_prefix_s_length)) + #define FSS_EXTENDED_READ_program_version_nano_prefix_s + #define FSS_EXTENDED_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EXTENDED_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_READ_program_version_nano_prefix_s_length)) - #define fss_extended_read_program_version_s fss_extended_read_program_version_major_s F_string_ascii_period_s fss_extended_read_program_version_minor_s F_string_ascii_period_s fss_extended_read_program_version_micro_s fss_extended_read_program_version_nano_prefix_s fss_extended_read_program_version_nano_s + #if !(defined(FSS_EXTENDED_READ_program_version_nano_s) && defined(FSS_EXTENDED_READ_program_version_nano_s_length)) + #define FSS_EXTENDED_READ_program_version_nano_s + #define FSS_EXTENDED_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_EXTENDED_READ_program_version_nano_s) && defined(FSS_EXTENDED_READ_program_version_nano_s_length)) + + #define FSS_EXTENDED_READ_program_version_s FSS_EXTENDED_READ_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_READ_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_READ_program_version_micro_s FSS_EXTENDED_READ_program_version_nano_prefix_s FSS_EXTENDED_READ_program_version_nano_s + + #define FSS_EXTENDED_READ_program_version_s_length FSS_EXTENDED_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_READ_program_version_micro_s_length + FSS_EXTENDED_READ_program_version_nano_prefix_s_length + FSS_EXTENDED_READ_program_version_nano_s_length + + extern const f_string_static_t fss_extended_read_program_version_s; #endif // _di_fss_extended_read_program_version_ #ifndef _di_fss_extended_read_program_name_ - #define fss_extended_read_program_name_s "fss_extended_read" - #define fss_extended_read_program_name_long_s "FSS Extended Read" + #define FSS_EXTENDED_READ_program_name_s "fss_extended_read" + #define FSS_EXTENDED_READ_program_name_long_s "FSS Extended Read" + + #define FSS_EXTENDED_READ_program_name_s_length 17 + #define FSS_EXTENDED_READ_program_name_long_s_length 17 + + extern const f_string_static_t fss_extended_read_program_name_s; + extern const f_string_static_t fss_extended_read_program_name_long_s; #endif // _di_fss_extended_read_program_name_ #ifndef _di_fss_extended_read_defines_ diff --git a/level_3/fss_extended_read/c/main.c b/level_3/fss_extended_read/c/main.c index 1c1ce44..c804df4 100644 --- a/level_3/fss_extended_read/c/main.c +++ b/level_3/fss_extended_read/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_extended_read_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_extended_read/c/private-common.c b/level_3/fss_extended_read/c/private-common.c index bfe98dd..916cc2f 100644 --- a/level_3/fss_extended_read/c/private-common.c +++ b/level_3/fss_extended_read/c/private-common.c @@ -68,7 +68,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_extended_read/c/private-read.c b/level_3/fss_extended_read/c/private-read.c index 80b245e..d6b9644 100644 --- a/level_3/fss_extended_read/c/private-read.c +++ b/level_3/fss_extended_read/c/private-read.c @@ -193,10 +193,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable); fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -208,8 +208,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, main->error.notable); fl_print_format("%[' may not have the value '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable); fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.context, main->error.context); @@ -287,7 +287,7 @@ extern "C" { if (main->parameters[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[parameter].values.array[main->parameters[parameter].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], f_console_parameter_size)); + const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], F_console_parameter_size_d)); const f_status_t status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, number); diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index d1599c3..3804492 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -6,6 +6,15 @@ extern "C" { #endif +#ifndef _di_fss_extended_write_program_version_ + const f_string_static_t fss_extended_write_program_version_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_WRITE_program_version_s, 0, FSS_EXTENDED_WRITE_program_version_s_length); +#endif // _di_fss_extended_write_program_version_ + +#ifndef _di_fss_extended_write_program_name_ + const f_string_static_t fss_extended_write_program_name_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_WRITE_program_name_s, 0, FSS_EXTENDED_WRITE_program_name_s_length); + const f_string_static_t fss_extended_write_program_name_long_s = macro_f_string_static_t_initialize2(FSS_EXTENDED_WRITE_program_name_long_s, 0, FSS_EXTENDED_WRITE_program_name_long_s_length); +#endif // _di_fss_extended_write_program_name_ + #ifndef _di_fss_extended_write_print_help_ f_status_t fss_extended_write_print_help(const f_file_t file, const f_color_context_t context) { @@ -13,27 +22,27 @@ extern "C" { fll_program_print_help_header(file, context, fss_extended_write_program_name_long_s, fss_extended_write_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_extended_write_short_file_s, fss_extended_write_long_file_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a file to send data to."); - fll_program_print_help_option(file, context, fss_extended_write_short_content_s, fss_extended_write_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "The Content to file."); - fll_program_print_help_option(file, context, fss_extended_write_short_double_s, fss_extended_write_long_double_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use double quotes (default)."); - fll_program_print_help_option(file, context, fss_extended_write_short_ignore_s, fss_extended_write_long_ignore_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Ignore a given range within a Content."); - fll_program_print_help_option(file, context, fss_extended_write_short_object_s, fss_extended_write_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " The Object to file."); - fll_program_print_help_option(file, context, fss_extended_write_short_partial_s, fss_extended_write_long_partial_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Do not file end of Object/Content character."); - fll_program_print_help_option(file, context, fss_extended_write_short_prepend_s, fss_extended_write_long_prepend_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Prepend the given whitespace characters to the start of each multi-line Content."); - fll_program_print_help_option(file, context, fss_extended_write_short_single_s, fss_extended_write_long_single_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use single quotes."); - fll_program_print_help_option(file, context, fss_extended_write_short_trim_s, fss_extended_write_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names."); + fll_program_print_help_option(file, context, fss_extended_write_short_file_s, fss_extended_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to."); + fll_program_print_help_option(file, context, fss_extended_write_short_content_s, fss_extended_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The Content to file."); + fll_program_print_help_option(file, context, fss_extended_write_short_double_s, fss_extended_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default)."); + fll_program_print_help_option(file, context, fss_extended_write_short_ignore_s, fss_extended_write_long_ignore_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Ignore a given range within a Content."); + fll_program_print_help_option(file, context, fss_extended_write_short_object_s, fss_extended_write_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The Object to file."); + fll_program_print_help_option(file, context, fss_extended_write_short_partial_s, fss_extended_write_long_partial_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Do not file end of Object/Content character."); + fll_program_print_help_option(file, context, fss_extended_write_short_prepend_s, fss_extended_write_long_prepend_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Prepend the given whitespace characters to the start of each multi-line Content."); + fll_program_print_help_option(file, context, fss_extended_write_short_single_s, fss_extended_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes."); + fll_program_print_help_option(file, context, fss_extended_write_short_trim_s, fss_extended_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names."); fll_program_print_help_usage(file, context, fss_extended_write_program_name_s, f_string_empty_s); @@ -163,8 +172,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_file_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_file_s, main->error.notable); fl_print_format("%[' may only be specified once.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -194,11 +203,11 @@ extern "C" { if (main->parameters[fss_extended_write_parameter_object_e].locations.used || main->parameters[fss_extended_write_parameter_content_e].locations.used) { if (main->parameters[fss_extended_write_parameter_object_e].locations.used) { if (main->parameters[fss_extended_write_parameter_object_e].locations.used != main->parameters[fss_extended_write_parameter_object_e].values.used) { - fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_extended_write_long_object_s); + fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_write_long_object_s); status = F_status_set_error(F_parameter); } else if (main->parameters[fss_extended_write_parameter_content_e].locations.used != main->parameters[fss_extended_write_parameter_content_e].values.used) { - fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_extended_write_long_content_s); + fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_write_long_content_s); status = F_status_set_error(F_parameter); } else if (!main->parameters[fss_extended_write_parameter_content_e].locations.used && main->parameters[fss_extended_write_parameter_partial_e].result == f_console_result_none_e) { @@ -210,12 +219,12 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter only allows either the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); fl_print_format("%[' parameter or the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable); fl_print_format("%[' parameter, but not both.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -236,10 +245,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); fl_print_format("%[' parameter must be specified before a '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -257,10 +266,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); fl_print_format("%[' parameter must have at least one '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -274,7 +283,7 @@ extern "C" { } else if (main->parameters[fss_extended_write_parameter_content_e].locations.used) { if (main->parameters[fss_extended_write_parameter_content_e].locations.used != main->parameters[fss_extended_write_parameter_content_e].values.used) { - fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_extended_write_long_content_s); + fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_write_long_content_s); status = F_status_set_error(F_parameter); } else if (!main->parameters[fss_extended_write_parameter_partial_e].locations.used) { @@ -287,10 +296,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -304,8 +313,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter cannot be used when processing a pipe.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -321,8 +330,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_prepend_s, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -332,7 +341,7 @@ extern "C" { } else if (main->parameters[fss_extended_write_parameter_prepend_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[fss_extended_write_parameter_prepend_e].values.array[main->parameters[fss_extended_write_parameter_prepend_e].values.used - 1]; - const f_array_length_t length = strnlen(arguments->argv[index], f_console_parameter_size); + const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d); // Even though this standard does not utilize this parameter, provide the validation for consistency. if (length) { @@ -348,8 +357,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_prepend_s, main->error.notable); fl_print_format("%[' must only contain whitespace.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -365,8 +374,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_prepend_s, main->error.notable); fl_print_format("%[' must not be an empty string.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -382,8 +391,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_ignore_s, main->error.notable); fl_print_format("%[' was specified, but no values were given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -398,8 +407,8 @@ extern "C" { if (total_locations * 2 > total_arguments) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_ignore_s, main->error.notable); fl_print_format("%[' requires two values.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -438,7 +447,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -465,7 +474,7 @@ extern "C" { } object.string = arguments->argv[main->parameters[fss_extended_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; status = fss_extended_write_process(main, output, quote, &object, 0, &buffer); @@ -490,7 +499,7 @@ extern "C" { for (; i < main->parameters[fss_extended_write_parameter_content_e].values.used; ++i) { contents.array[contents.used].string = arguments->argv[main->parameters[fss_extended_write_parameter_content_e].values.array[i]]; - contents.array[contents.used].used = strnlen(contents.array[contents.used].string, f_console_parameter_size); + contents.array[contents.used].used = strnlen(contents.array[contents.used].string, F_console_parameter_size_d); contents.array[contents.used].size = contents.array[contents.used].used; ++contents.used; } // for @@ -534,7 +543,7 @@ extern "C" { } object.string = arguments->argv[main->parameters[fss_extended_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; contents.used = 0; @@ -559,7 +568,7 @@ extern "C" { contents.array[contents.used].used = 0; } - status = f_string_append(arguments->argv[main->parameters[fss_extended_write_parameter_content_e].values.array[j]], strnlen(arguments->argv[main->parameters[fss_extended_write_parameter_content_e].values.array[j]], f_console_parameter_size), &contents.array[contents.used]); + status = f_string_append(arguments->argv[main->parameters[fss_extended_write_parameter_content_e].values.array[j]], strnlen(arguments->argv[main->parameters[fss_extended_write_parameter_content_e].values.array[j]], F_console_parameter_size_d), &contents.array[contents.used]); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true); @@ -581,7 +590,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -594,7 +603,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(escaped); + f_string_dynamic_resize(0, &escaped); // Object, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free(). object.string = 0; @@ -622,9 +631,9 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(buffer); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamics_t_delete_simple(contents); + f_string_dynamic_resize(0, &buffer); + f_string_dynamic_resize(0, &object); + f_string_dynamics_resize(0, &contents); fss_extended_write_main_delete(main); return status; @@ -636,12 +645,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_extended_write_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/fss_extended_write/c/fss_extended_write.h b/level_3/fss_extended_write/c/fss_extended_write.h index efcb106..c59ec6e 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.h +++ b/level_3/fss_extended_write/c/fss_extended_write.h @@ -8,14 +8,15 @@ * This program provides fss basic write functionality. */ #ifndef _fss_extended_write_h +#define _fss_extended_write_h -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -28,12 +29,12 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -44,24 +45,40 @@ extern "C" { #endif #ifndef _di_fss_extended_write_program_version_ - #define fss_extended_write_program_version_major_s F_string_ascii_0_s - #define fss_extended_write_program_version_minor_s F_string_ascii_5_s - #define fss_extended_write_program_version_micro_s F_string_ascii_8_s + #define FSS_EXTENDED_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_EXTENDED_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_EXTENDED_WRITE_program_version_micro_s F_string_ascii_8_s - #ifndef fss_extended_write_program_version_nano_prefix_s - #define fss_extended_write_program_version_nano_prefix_s - #endif + #define FSS_EXTENDED_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EXTENDED_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EXTENDED_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_extended_write_program_version_nano_s - #define fss_extended_write_program_version_nano_s - #endif + #if !(defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length)) + #define FSS_EXTENDED_WRITE_program_version_nano_prefix_s + #define FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length)) - #define fss_extended_write_program_version_s fss_extended_write_program_version_major_s F_string_ascii_period_s fss_extended_write_program_version_minor_s F_string_ascii_period_s fss_extended_write_program_version_micro_s fss_extended_write_program_version_nano_prefix_s fss_extended_write_program_version_nano_s + #if !(defined(FSS_EXTENDED_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_s_length)) + #define FSS_EXTENDED_WRITE_program_version_nano_s + #define FSS_EXTENDED_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_EXTENDED_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_s_length)) + + #define FSS_EXTENDED_WRITE_program_version_s FSS_EXTENDED_WRITE_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_WRITE_program_version_micro_s FSS_EXTENDED_WRITE_program_version_nano_prefix_s FSS_EXTENDED_WRITE_program_version_nano_s + + #define FSS_EXTENDED_WRITE_program_version_s_length FSS_EXTENDED_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_WRITE_program_version_micro_s_length + FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length + FSS_EXTENDED_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_extended_write_program_version_s; #endif // _di_fss_extended_write_program_version_ #ifndef _di_fss_extended_write_program_name_ - #define fss_extended_write_program_name_s "fss_extended_write" - #define fss_extended_write_program_name_long_s "FSS Extended Write" + #define FSS_EXTENDED_WRITE_program_name_s "fss_extended_write" + #define FSS_EXTENDED_WRITE_program_name_long_s "FSS Extended Write" + + #define FSS_EXTENDED_WRITE_program_name_s_length 18 + #define FSS_EXTENDED_WRITE_program_name_long_s_length 18 + + extern const f_string_static_t fss_extended_write_program_name_s; + extern const f_string_static_t fss_extended_write_program_name_long_s; #endif // _di_fss_extended_write_program_name_ #ifndef _di_fss_extended_write_defines_ diff --git a/level_3/fss_extended_write/c/main.c b/level_3/fss_extended_write/c/main.c index 3bb3f3a..12d2ee0 100644 --- a/level_3/fss_extended_write/c/main.c +++ b/level_3/fss_extended_write/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_extended_write_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_extended_write/c/private-common.c b/level_3/fss_extended_write/c/private-common.c index e80a9d6..3f0137f 100644 --- a/level_3/fss_extended_write/c/private-common.c +++ b/level_3/fss_extended_write/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_extended_write/c/private-write.c b/level_3/fss_extended_write/c/private-write.c index 4a343a8..78482a3 100644 --- a/level_3/fss_extended_write/c/private-write.c +++ b/level_3/fss_extended_write/c/private-write.c @@ -15,12 +15,12 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); + fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable); + fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -36,8 +36,8 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%S%S%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -53,7 +53,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable); fl_print_format("%[' in objects.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -357,9 +357,9 @@ extern "C" { status = fss_extended_write_process(main, output, quote, &object, &contents, buffer); } - macro_f_string_dynamic_t_delete_simple(block); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamics_t_delete_simple(contents); + f_string_dynamic_resize(0, &block); + f_string_dynamic_resize(0, &object); + f_string_dynamics_resize(0, &contents); return status; } diff --git a/level_3/fss_identify/c/fss_identify.c b/level_3/fss_identify/c/fss_identify.c index 07f8ace..8e503c9 100644 --- a/level_3/fss_identify/c/fss_identify.c +++ b/level_3/fss_identify/c/fss_identify.c @@ -6,6 +6,15 @@ extern "C" { #endif +#ifndef _di_fss_identify_program_version_ + const f_string_static_t fss_identify_program_version_s = macro_f_string_static_t_initialize2(FSS_IDENTIFY_program_version_s, 0, FSS_IDENTIFY_program_version_s_length); +#endif // _di_fss_identify_program_version_ + +#ifndef _di_fss_identify_program_name_ + const f_string_static_t fss_identify_program_name_s = macro_f_string_static_t_initialize2(FSS_IDENTIFY_program_name_s, 0, FSS_IDENTIFY_program_name_s_length); + const f_string_static_t fss_identify_program_name_long_s = macro_f_string_static_t_initialize2(FSS_IDENTIFY_program_name_long_s, 0, FSS_IDENTIFY_program_name_long_s_length); +#endif // _di_fss_identify_program_name_ + #ifndef _di_fss_identify_print_help_ f_status_t fss_identify_print_help(const f_file_t file, const f_color_context_t context) { @@ -13,26 +22,26 @@ extern "C" { fll_program_print_help_header(file, context, fss_identify_program_name_long_s, fss_identify_program_version); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_identify_short_content_s, fss_identify_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Print the Identifier content (the 4-digit hexidecimal type code)."); - fll_program_print_help_option(file, context, fss_identify_short_object_s, fss_identify_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Identifier object (the name)."); + fll_program_print_help_option(file, context, fss_identify_short_content_s, fss_identify_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print the Identifier content (the 4-digit hexidecimal type code)."); + fll_program_print_help_option(file, context, fss_identify_short_object_s, fss_identify_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Identifier object (the name)."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_identify_short_line_s, fss_identify_long_line_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print only the Identifier at the given line."); - fll_program_print_help_option(file, context, fss_identify_short_name_s, fss_identify_long_name_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object with this name."); - fll_program_print_help_option(file, context, fss_identify_short_total_s, fss_identify_long_total_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Print the total Identifiers found."); + fll_program_print_help_option(file, context, fss_identify_short_line_s, fss_identify_long_line_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the Identifier at the given line."); + fll_program_print_help_option(file, context, fss_identify_short_name_s, fss_identify_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name."); + fll_program_print_help_option(file, context, fss_identify_short_total_s, fss_identify_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print the total Identifiers found."); fll_program_print_help_usage(file, context, fss_identify_program_name_s, "filename(s)"); @@ -164,8 +173,8 @@ extern "C" { if (main->parameters[fss_identify_parameter_line_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_line_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_line_s, main->error.notable); fl_print_format("%[' requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -174,7 +183,7 @@ extern "C" { } else if (main->parameters[fss_identify_parameter_line_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[fss_identify_parameter_line_e].values.array[main->parameters[fss_identify_parameter_line_e].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], f_console_parameter_size)); + const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], F_console_parameter_size_d)); status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, &data.line); @@ -188,10 +197,10 @@ extern "C" { if (main->parameters[fss_identify_parameter_object_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_object_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_object_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -201,10 +210,10 @@ extern "C" { else if (main->parameters[fss_identify_parameter_content_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_content_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_content_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -217,8 +226,8 @@ extern "C" { if (main->parameters[fss_identify_parameter_name_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_name_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_name_s, main->error.notable); fl_print_format("%[' requires a string.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -227,14 +236,14 @@ extern "C" { } else if (main->parameters[fss_identify_parameter_name_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[fss_identify_parameter_name_e].values.array[main->parameters[fss_identify_parameter_name_e].values.used - 1]; - const f_array_length_t length = strnlen(arguments->argv[index], f_console_parameter_size); + const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d); const f_string_range_t range = macro_f_string_range_t_initialize(length); if (length == 0) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_name_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_name_s, main->error.notable); fl_print_format("%[' does not allow zero length strings.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -263,10 +272,10 @@ extern "C" { else if (status == F_false) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, arguments->argv[index], main->error.notable); fl_print_format("%[' for the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_name_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_name_s, main->error.notable); fl_print_format("%[' may only contain word characters.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -370,12 +379,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_identify_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/fss_identify/c/fss_identify.h b/level_3/fss_identify/c/fss_identify.h index ed31b27..59b73dd 100644 --- a/level_3/fss_identify/c/fss_identify.h +++ b/level_3/fss_identify/c/fss_identify.h @@ -12,11 +12,12 @@ * This program utilizes the Featureless Linux Library. */ #ifndef _fss_identify_h +#define _fss_identify_h -// libc includes. +// Libc includes. #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -32,14 +33,14 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -50,24 +51,40 @@ extern "C" { #endif #ifndef _di_fss_identify_program_version_ - #define fss_identify_program_version_major_s F_string_ascii_0_s - #define fss_identify_program_version_minor_s F_string_ascii_5_s - #define fss_identify_program_version_micro_s F_string_ascii_8_s + #define FSS_IDENTIFY_program_version_major_s F_string_ascii_0_s + #define FSS_IDENTIFY_program_version_minor_s F_string_ascii_5_s + #define FSS_IDENTIFY_program_version_micro_s F_string_ascii_8_s - #ifndef fss_identify_program_version_nano_prefix_s - #define fss_identify_program_version_nano_prefix_s - #endif + #define FSS_IDENTIFY_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_IDENTIFY_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_IDENTIFY_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_identify_program_version_nano_s - #define fss_identify_program_version_nano_s - #endif + #if !(defined(FSS_IDENTIFY_program_version_nano_prefix_s) && defined(FSS_IDENTIFY_program_version_nano_prefix_s_length)) + #define FSS_IDENTIFY_program_version_nano_prefix_s + #define FSS_IDENTIFY_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_IDENTIFY_program_version_nano_prefix_s) && defined(FSS_IDENTIFY_program_version_nano_prefix_s_length)) - #define fss_identify_program_version fss_identify_program_version_major_s F_string_ascii_period_s fss_identify_program_version_minor_s F_string_ascii_period_s fss_identify_program_version_micro_s fss_identify_program_version_nano_prefix_s fss_identify_program_version_nano_s + #if !(defined(FSS_IDENTIFY_program_version_nano_s) && defined(FSS_IDENTIFY_program_version_nano_s_length)) + #define FSS_IDENTIFY_program_version_nano_s + #define FSS_IDENTIFY_program_version_nano_s_length 0 + #endif // !(defined(FSS_IDENTIFY_program_version_nano_s) && defined(FSS_IDENTIFY_program_version_nano_s_length)) + + #define FSS_IDENTIFY_program_version_s FSS_IDENTIFY_program_version_major_s F_string_ascii_period_s FSS_IDENTIFY_program_version_minor_s F_string_ascii_period_s FSS_IDENTIFY_program_version_micro_s FSS_IDENTIFY_program_version_nano_prefix_s FSS_IDENTIFY_program_version_nano_s + + #define FSS_IDENTIFY_program_version_s_length FSS_IDENTIFY_program_version_major_s_length + F_string_ascii_period_s_length + FSS_IDENTIFY_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_IDENTIFY_program_version_micro_s_length + FSS_IDENTIFY_program_version_nano_prefix_s_length + FSS_IDENTIFY_program_version_nano_s_length + + const f_string_static_t fss_identify_program_version_s; #endif // _di_fss_identify_program_version_ #ifndef _di_fss_identify_program_name_ - #define fss_identify_program_name_s "fss_identify" - #define fss_identify_program_name_long_s "FSS Identify" + #define FSS_IDENTIFY_program_name_s "fss_identify" + #define FSS_IDENTIFY_program_name_long_s "FSS Identify" + + #define FSS_IDENTIFY_program_name_s_length 12 + #define FSS_IDENTIFY_program_name_long_s_length 12 + + const f_string_static_t fss_identify_program_name_s; + const f_string_static_t fss_identify_program_name_long_s; #endif // _di_fss_identify_program_name_ #ifndef _di_fss_identify_defines_ diff --git a/level_3/fss_identify/c/main.c b/level_3/fss_identify/c/main.c index 23c59a7..fc319ee 100644 --- a/level_3/fss_identify/c/main.c +++ b/level_3/fss_identify/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_identify_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_identify/c/private-common.c b/level_3/fss_identify/c/private-common.c index c960699..aae594d 100644 --- a/level_3/fss_identify/c/private-common.c +++ b/level_3/fss_identify/c/private-common.c @@ -24,7 +24,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_payload_read/c/fss_payload_read.c b/level_3/fss_payload_read/c/fss_payload_read.c index a962f7e..b25022f 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.c +++ b/level_3/fss_payload_read/c/fss_payload_read.c @@ -7,6 +7,15 @@ extern "C" { #endif +#ifndef _di_fss_payload_read_program_version_ + const f_string_static_t fss_payload_read_program_version_s = macro_f_string_static_t_initialize2(FSS_PAYLOAD_READ_program_version_s, 0, FSS_PAYLOAD_READ_program_version_s_length); +#endif // _di_fss_payload_read_program_version_ + +#ifndef _di_fss_payload_read_program_name_ + const f_string_static_t fss_payload_read_program_name_s = macro_f_string_static_t_initialize2(FSS_PAYLOAD_READ_program_name_s, 0, FSS_PAYLOAD_READ_program_name_s_length); + const f_string_static_t fss_payload_read_program_name_long_s = macro_f_string_static_t_initialize2(FSS_PAYLOAD_READ_program_name_long_s, 0, FSS_PAYLOAD_READ_program_name_long_s_length); +#endif // _di_fss_payload_read_program_name_ + #ifndef _di_fss_payload_read_print_help_ f_status_t fss_payload_read_print_help(const f_file_t file, const f_color_context_t context) { @@ -14,32 +23,32 @@ extern "C" { fll_program_print_help_header(file, context, fss_payload_program_name_long_s, fss_payload_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_payload_read_short_at_s, fss_payload_read_long_at_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric index."); - fll_program_print_help_option(file, context, fss_payload_read_short_content_s, fss_payload_read_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Content (default)."); - fll_program_print_help_option(file, context, fss_payload_read_short_columns_s, fss_payload_read_long_columns_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of columns."); - fll_program_print_help_option(file, context, fss_payload_read_short_delimit_s, fss_payload_read_long_delimit_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Designate how to handle applying delimits."); - fll_program_print_help_option(file, context, fss_payload_read_short_depth_s, fss_payload_read_long_depth_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object at this numeric depth."); - fll_program_print_help_option(file, context, fss_payload_read_short_empty_s, fss_payload_read_long_empty_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Include empty Content when processing."); - fll_program_print_help_option(file, context, fss_payload_read_short_line_s, fss_payload_read_long_line_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print only the Content at the given line."); - fll_program_print_help_option(file, context, fss_payload_read_short_name_s, fss_payload_read_long_name_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select Object with this name."); - fll_program_print_help_option(file, context, fss_payload_read_short_object_s, fss_payload_read_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the Object."); - fll_program_print_help_option(file, context, fss_payload_read_short_pipe_s, fss_payload_read_long_pipe_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print using the special pipe format."); - fll_program_print_help_option(file, context, fss_payload_read_short_raw_s, fss_payload_read_long_raw_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print with the original quotes and escapes."); - fll_program_print_help_option(file, context, fss_payload_read_short_select_s, fss_payload_read_long_select_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select sub-Content at this index."); - fll_program_print_help_option(file, context, fss_payload_read_short_total_s, fss_payload_read_long_total_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of lines."); - fll_program_print_help_option(file, context, fss_payload_read_short_trim_s, fss_payload_read_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names on select or print."); + fll_program_print_help_option(file, context, fss_payload_read_short_at_s, fss_payload_read_long_at_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index."); + fll_program_print_help_option(file, context, fss_payload_read_short_content_s, fss_payload_read_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default)."); + fll_program_print_help_option(file, context, fss_payload_read_short_columns_s, fss_payload_read_long_columns_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of columns."); + fll_program_print_help_option(file, context, fss_payload_read_short_delimit_s, fss_payload_read_long_delimit_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Designate how to handle applying delimits."); + fll_program_print_help_option(file, context, fss_payload_read_short_depth_s, fss_payload_read_long_depth_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric depth."); + fll_program_print_help_option(file, context, fss_payload_read_short_empty_s, fss_payload_read_long_empty_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Include empty Content when processing."); + fll_program_print_help_option(file, context, fss_payload_read_short_line_s, fss_payload_read_long_line_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the Content at the given line."); + fll_program_print_help_option(file, context, fss_payload_read_short_name_s, fss_payload_read_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name."); + fll_program_print_help_option(file, context, fss_payload_read_short_object_s, fss_payload_read_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object."); + fll_program_print_help_option(file, context, fss_payload_read_short_pipe_s, fss_payload_read_long_pipe_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format."); + fll_program_print_help_option(file, context, fss_payload_read_short_raw_s, fss_payload_read_long_raw_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes."); + fll_program_print_help_option(file, context, fss_payload_read_short_select_s, fss_payload_read_long_select_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index."); + fll_program_print_help_option(file, context, fss_payload_read_short_total_s, fss_payload_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines."); + fll_program_print_help_option(file, context, fss_payload_read_short_trim_s, fss_payload_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print."); fll_program_print_help_usage(file, context, fss_payload_program_name_s, "filename(s)"); @@ -243,7 +252,7 @@ extern "C" { fss_payload_read_parameter_delimit_e, }; - const f_string_t parameter_name[] = { + const f_string_static_t parameter_name[] = { fss_payload_read_long_at_s, fss_payload_read_long_depth_s, fss_payload_read_long_line_s, @@ -270,8 +279,8 @@ extern "C" { if (main->parameters[parameter_code[i]].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); fl_print_format("%[' requires a %s.%]%q", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -312,10 +321,10 @@ extern "C" { if (main->parameters[parameter_code[i]].result == parameter_match[i]) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_columns_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_columns_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -330,10 +339,10 @@ extern "C" { if (main->parameters[fss_payload_read_parameter_total_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -343,10 +352,10 @@ extern "C" { else if (main->parameters[fss_payload_read_parameter_line_e].result == f_console_result_additional_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_line_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_line_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -375,13 +384,13 @@ extern "C" { } location = main->parameters[fss_payload_read_parameter_delimit_e].values.array[i]; - length = strnlen(arguments->argv[location], f_console_parameter_size); + length = strnlen(arguments->argv[location], F_console_parameter_size_d); if (!length) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_delimit_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_delimit_s, main->error.notable); fl_print_format("%[' must not be empty.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -526,8 +535,8 @@ extern "C" { if (F_status_is_error_not(status) && main->parameters[fss_payload_read_parameter_select_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_select_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_select_s, main->error.notable); fl_print_format("%[' parameter requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -661,7 +670,7 @@ extern "C" { fss_payload_read_data_delete_simple(&data); } else { - fll_print_format("%q%[%sYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); status = F_status_set_error(F_parameter); } @@ -685,12 +694,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_payload_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); return F_none; diff --git a/level_3/fss_payload_read/c/fss_payload_read.h b/level_3/fss_payload_read/c/fss_payload_read.h index aab5170..9d7d5c3 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.h +++ b/level_3/fss_payload_read/c/fss_payload_read.h @@ -12,15 +12,16 @@ * This processes in accordance to the FSS-0002 Basic List specification. */ #ifndef _fss_payload_read_h +#define _fss_payload_read_h -// libc includes. +// Libc includes. #include #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -34,13 +35,13 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -53,24 +54,40 @@ extern "C" { #endif #ifndef _di_fss_payload_read_program_version_ - #define fss_payload_program_version_major_s F_string_ascii_0_s - #define fss_payload_program_version_minor_s F_string_ascii_5_s - #define fss_payload_program_version_micro_s F_string_ascii_8_s + #define FSS_PAYLOAD_READ_program_version_major_s F_string_ascii_0_s + #define FSS_PAYLOAD_READ_program_version_minor_s F_string_ascii_5_s + #define FSS_PAYLOAD_READ_program_version_micro_s F_string_ascii_8_s - #ifndef fss_payload_program_version_nano_prefix_s - #define fss_payload_program_version_nano_prefix_s - #endif + #define FSS_PAYLOAD_READ_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_PAYLOAD_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_PAYLOAD_READ_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_payload_program_version_nano_s - #define fss_payload_program_version_nano_s - #endif + #if !(defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s_length)) + #define FSS_PAYLOAD_READ_program_version_nano_prefix_s + #define FSS_PAYLOAD_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s_length)) - #define fss_payload_program_version_s fss_payload_program_version_major_s F_string_ascii_period_s fss_payload_program_version_minor_s F_string_ascii_period_s fss_payload_program_version_micro_s fss_payload_program_version_nano_prefix_s fss_payload_program_version_nano_s + #if !(defined(FSS_PAYLOAD_READ_program_version_nano_s) && defined(FSS_PAYLOAD_READ_program_version_nano_s_length)) + #define FSS_PAYLOAD_READ_program_version_nano_s + #define FSS_PAYLOAD_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_PAYLOAD_READ_program_version_nano_s) && defined(FSS_PAYLOAD_READ_program_version_nano_s_length)) + + #define FSS_PAYLOAD_READ_program_version_s FSS_PAYLOAD_READ_program_version_major_s F_string_ascii_period_s FSS_PAYLOAD_READ_program_version_minor_s F_string_ascii_period_s FSS_PAYLOAD_READ_program_version_micro_s FSS_PAYLOAD_READ_program_version_nano_prefix_s FSS_PAYLOAD_READ_program_version_nano_s + + #define FSS_PAYLOAD_READ_program_version_s_length FSS_PAYLOAD_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_READ_program_version_micro_s_length + FSS_PAYLOAD_READ_program_version_nano_prefix_s_length + FSS_PAYLOAD_READ_program_version_nano_s_length + + extern const f_string_static_t fss_payload_read_program_version_s; #endif // _di_fss_payload_read_program_version_ #ifndef _di_fss_payload_read_program_name_ - #define fss_payload_program_name_s "fss_payload_read" - #define fss_payload_program_name_long_s "FSS Basic List Read" + #define FSS_PAYLOAD_READ_program_name_s "fss_payload_read" + #define FSS_PAYLOAD_READ_program_name_long_s "FSS Payload Read" + + #define FSS_PAYLOAD_READ_program_name_s_length 16 + #define FSS_PAYLOAD_READ_program_name_long_s_length 16 + + extern const f_string_static_t fss_payload_read_program_name_s; + extern const f_string_static_t fss_payload_read_program_name_long_s; #endif // _di_fss_payload_read_program_name_ #ifndef _di_fss_payload_read_defines_ diff --git a/level_3/fss_payload_read/c/main.c b/level_3/fss_payload_read/c/main.c index f5caeb2..51382d2 100644 --- a/level_3/fss_payload_read/c/main.c +++ b/level_3/fss_payload_read/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_payload_read_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_payload_read/c/private-common.c b/level_3/fss_payload_read/c/private-common.c index aed5f76..fe0d085 100644 --- a/level_3/fss_payload_read/c/private-common.c +++ b/level_3/fss_payload_read/c/private-common.c @@ -14,7 +14,7 @@ extern "C" { fss_payload_read_depths_resize(0, &data->depths); - macro_f_string_dynamic_t_delete_simple(data->buffer); + f_string_dynamic_resize(0, &data->buffer); macro_f_fss_contents_t_delete_simple(data->contents); macro_f_fss_contents_t_delete_simple(data->contents_header); macro_f_fss_objects_t_delete_simple(data->objects); @@ -73,7 +73,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_payload_read/c/private-read.c b/level_3/fss_payload_read/c/private-read.c index f511a66..f227352 100644 --- a/level_3/fss_payload_read/c/private-read.c +++ b/level_3/fss_payload_read/c/private-read.c @@ -189,10 +189,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable); fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -204,8 +204,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, main->error.notable); fl_print_format("%[' may not have the value '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable); fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.context, main->error.context); @@ -261,10 +261,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%s%]", main->error.to.stream, main->error.notable, file_name, main->error.notable); + fl_print_format("%q%[%QThe file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%]", main->error.to.stream, main->error.notable, file_name, main->error.notable); fl_print_format("%[' does not have the required Object '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%s%]", main->error.to.stream, main->error.notable, F_fss_string_payload_s, main->error.notable); + fl_print_format("%[%q%]", main->error.to.stream, main->error.notable, f_fss_string_payload_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -318,7 +318,7 @@ extern "C" { if (main->parameters[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[parameter].values.array[main->parameters[parameter].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], f_console_parameter_size)); + const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], F_console_parameter_size_d)); const f_status_t status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, number); @@ -463,7 +463,7 @@ extern "C" { signal_check = 0; } - is_payload = fl_string_dynamic_partial_compare_string(F_fss_string_payload_s, data->buffer, F_fss_string_payload_s_length, data->objects.array[i]) == F_equal_to; + is_payload = fl_string_dynamic_partial_compare_string(f_fss_string_payload_s.string, data->buffer, f_fss_string_payload_s.used, data->objects.array[i]) == F_equal_to; fss_payload_read_print_at(main, is_payload, i, *delimits_object, *delimits_content, data); } // for @@ -536,7 +536,7 @@ extern "C" { funlockfile(main->output.to.stream); } else { - is_payload = fl_string_dynamic_partial_compare_string(F_fss_string_payload_s, data->buffer, F_fss_string_payload_s_length, data->objects.array[i]) == F_equal_to; + is_payload = fl_string_dynamic_partial_compare_string(f_fss_string_payload_s.string, data->buffer, f_fss_string_payload_s.used, data->objects.array[i]) == F_equal_to; fss_payload_read_print_at(main, is_payload, i, *delimits_object, *delimits_content, data); } diff --git a/level_3/fss_payload_write/c/fss_payload_write.c b/level_3/fss_payload_write/c/fss_payload_write.c index 1227b7b..975bb52 100644 --- a/level_3/fss_payload_write/c/fss_payload_write.c +++ b/level_3/fss_payload_write/c/fss_payload_write.c @@ -6,6 +6,15 @@ extern "C" { #endif +#ifndef _di_fss_payload_write_program_version_ + const f_string_static_t fss_payload_write_program_version_s = macro_f_string_static_t_initialize2(FSS_PAYLOAD_WRITE_program_version_s, 0, FSS_PAYLOAD_WRITE_program_version_s_length); +#endif // _di_fss_payload_write_program_version_ + +#ifndef _di_fss_payload_write_program_name_ + const f_string_static_t fss_payload_write_program_name_s = macro_f_string_static_t_initialize2(FSS_PAYLOAD_WRITE_program_name_s, 0, FSS_PAYLOAD_WRITE_program_name_s_length); + const f_string_static_t fss_payload_write_program_name_long_s = macro_f_string_static_t_initialize2(FSS_PAYLOAD_WRITE_program_name_long_s, 0, FSS_PAYLOAD_WRITE_program_name_long_s_length); +#endif // _di_fss_payload_write_program_name_ + #ifndef _di_fss_payload_write_print_help_ f_status_t fss_payload_write_print_help(const f_file_t file, const f_color_context_t context) { @@ -13,27 +22,27 @@ extern "C" { fll_program_print_help_header(file, context, fss_payload_write_program_name_long_s, fss_payload_write_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_payload_write_short_file_s, fss_payload_write_long_file_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a file to send data to."); - fll_program_print_help_option(file, context, fss_payload_write_short_content_s, fss_payload_write_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "The Content to file."); - fll_program_print_help_option(file, context, fss_payload_write_short_double_s, fss_payload_write_long_double_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use double quotes (default)."); - fll_program_print_help_option(file, context, fss_payload_write_short_ignore_s, fss_payload_write_long_ignore_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Ignore a given range within a Content."); - fll_program_print_help_option(file, context, fss_payload_write_short_object_s, fss_payload_write_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " The Object to file."); - fll_program_print_help_option(file, context, fss_payload_write_short_partial_s, fss_payload_write_long_partial_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Do not file end of Object/Content character."); - fll_program_print_help_option(file, context, fss_payload_write_short_prepend_s, fss_payload_write_long_prepend_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Prepend the given whitespace characters to the start of each multi-line Content."); - fll_program_print_help_option(file, context, fss_payload_write_short_single_s, fss_payload_write_long_single_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use single quotes."); - fll_program_print_help_option(file, context, fss_payload_write_short_trim_s, fss_payload_write_long_trim_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Trim Object names."); + fll_program_print_help_option(file, context, fss_payload_write_short_file_s, fss_payload_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to."); + fll_program_print_help_option(file, context, fss_payload_write_short_content_s, fss_payload_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The Content to file."); + fll_program_print_help_option(file, context, fss_payload_write_short_double_s, fss_payload_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default)."); + fll_program_print_help_option(file, context, fss_payload_write_short_ignore_s, fss_payload_write_long_ignore_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Ignore a given range within a Content."); + fll_program_print_help_option(file, context, fss_payload_write_short_object_s, fss_payload_write_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The Object to file."); + fll_program_print_help_option(file, context, fss_payload_write_short_partial_s, fss_payload_write_long_partial_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Do not file end of Object/Content character."); + fll_program_print_help_option(file, context, fss_payload_write_short_prepend_s, fss_payload_write_long_prepend_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Prepend the given whitespace characters to the start of each multi-line Content."); + fll_program_print_help_option(file, context, fss_payload_write_short_single_s, fss_payload_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes."); + fll_program_print_help_option(file, context, fss_payload_write_short_trim_s, fss_payload_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names."); fll_program_print_help_usage(file, context, fss_payload_write_program_name_s, f_string_empty_s); @@ -162,8 +171,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_file_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_file_s, main->error.notable); fl_print_format("%[' may only be specified once.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -184,7 +193,7 @@ extern "C" { } } else if (main->parameters[fss_payload_write_parameter_file_e].result == f_console_result_found_e) { - fss_payload_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_payload_write_long_file_s); + fss_payload_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_payload_write_long_file_s); status = F_status_set_error(F_parameter); } } @@ -193,11 +202,11 @@ extern "C" { if (main->parameters[fss_payload_write_parameter_object_e].locations.used || main->parameters[fss_payload_write_parameter_content_e].locations.used) { if (main->parameters[fss_payload_write_parameter_object_e].locations.used) { if (main->parameters[fss_payload_write_parameter_object_e].locations.used != main->parameters[fss_payload_write_parameter_object_e].values.used) { - fss_payload_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_payload_write_long_object_s); + fss_payload_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_payload_write_long_object_s); status = F_status_set_error(F_parameter); } else if (main->parameters[fss_payload_write_parameter_content_e].locations.used != main->parameters[fss_payload_write_parameter_content_e].values.used) { - fss_payload_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_payload_write_long_content_s); + fss_payload_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_payload_write_long_content_s); status = F_status_set_error(F_parameter); } else if (main->parameters[fss_payload_write_parameter_object_e].locations.used != main->parameters[fss_payload_write_parameter_content_e].locations.used && main->parameters[fss_payload_write_parameter_partial_e].result == f_console_result_none_e) { @@ -209,12 +218,12 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter only allows either the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_object_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_object_s, main->error.notable); fl_print_format("%[' parameter or the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_content_s, main->error.notable); fl_print_format("%[' parameter, but not both.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -241,10 +250,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_object_s, main->error.notable); fl_print_format("%[' parameter must be specified before a '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -259,7 +268,7 @@ extern "C" { } else if (main->parameters[fss_payload_write_parameter_content_e].locations.used) { if (main->parameters[fss_payload_write_parameter_content_e].locations.used != main->parameters[fss_payload_write_parameter_content_e].values.used) { - fss_payload_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s.string, fss_payload_write_long_content_s); + fss_payload_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_payload_write_long_content_s); status = F_status_set_error(F_parameter); } else if (!main->parameters[fss_payload_write_parameter_partial_e].locations.used) { @@ -272,10 +281,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_object_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -289,8 +298,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter cannot be used when processing a pipe.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -306,8 +315,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_prepend_s, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -317,7 +326,7 @@ extern "C" { } else if (main->parameters[fss_payload_write_parameter_prepend_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters[fss_payload_write_parameter_prepend_e].values.array[main->parameters[fss_payload_write_parameter_prepend_e].values.used - 1]; - const f_array_length_t length = strnlen(arguments->argv[index], f_console_parameter_size); + const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d); if (length) { f_string_range_t range = macro_f_string_range_t_initialize(length); @@ -335,8 +344,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_prepend_s, main->error.notable); fl_print_format("%[' must only contain whitespace.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -351,8 +360,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_prepend_s, main->error.notable); + fl_print_format("%q%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_prepend_s, main->error.notable); fl_print_format("%[' must not be an empty string.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -368,8 +377,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_ignore_s, main->error.notable); fl_print_format("%[' was specified, but no values were given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -384,8 +393,8 @@ extern "C" { if (total_locations * 2 > total_arguments) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_ignore_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_ignore_s, main->error.notable); fl_print_format("%[' requires two values.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -427,7 +436,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -447,7 +456,7 @@ extern "C" { } object.string = arguments->argv[main->parameters[fss_payload_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; status = fss_payload_write_process(main, output, quote, &object, 0, &buffer); @@ -463,7 +472,7 @@ extern "C" { } content.string = arguments->argv[main->parameters[fss_payload_write_parameter_content_e].values.array[i]]; - content.used = strnlen(content.string, f_console_parameter_size); + content.used = strnlen(content.string, F_console_parameter_size_d); content.size = content.used; status = fss_payload_write_process(main, output, quote, 0, &content, &buffer); @@ -480,11 +489,11 @@ extern "C" { } object.string = arguments->argv[main->parameters[fss_payload_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; content.string = arguments->argv[main->parameters[fss_payload_write_parameter_content_e].values.array[i]]; - content.used = strnlen(content.string, f_console_parameter_size); + content.used = strnlen(content.string, F_console_parameter_size_d); content.size = content.used; status = fss_payload_write_process(main, output, quote, &object, &content, &buffer); @@ -496,7 +505,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); + fl_print_format("%q%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -509,7 +518,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(escaped); + f_string_dynamic_resize(0, &escaped); // Object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free(). object.string = 0; @@ -534,9 +543,9 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(buffer); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &buffer); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); fss_payload_write_main_delete(main); return status; @@ -548,12 +557,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_payload_write_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/fss_payload_write/c/fss_payload_write.h b/level_3/fss_payload_write/c/fss_payload_write.h index 2609e24..b606c70 100644 --- a/level_3/fss_payload_write/c/fss_payload_write.h +++ b/level_3/fss_payload_write/c/fss_payload_write.h @@ -8,14 +8,15 @@ * This program provides fss basic list write functionality. */ #ifndef _fss_payload_write_h +#define _fss_payload_write_h -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -28,13 +29,13 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -45,24 +46,40 @@ extern "C" { #endif #ifndef _di_fss_payload_write_program_version_ - #define fss_payload_write_program_version_major_s F_string_ascii_0_s - #define fss_payload_write_program_version_minor_s F_string_ascii_5_s - #define fss_payload_write_program_version_micro_s F_string_ascii_8_s + #define FSS_PAYLOAD_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_PAYLOAD_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_PAYLOAD_WRITE_program_version_micro_s F_string_ascii_8_s - #ifndef fss_payload_write_program_version_nano_prefix_s - #define fss_payload_write_program_version_nano_prefix_s - #endif + #define FSS_PAYLOAD_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_PAYLOAD_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_PAYLOAD_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_payload_write_program_version_nano_s - #define fss_payload_write_program_version_nano_s - #endif + #if !(defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length)) + #define FSS_PAYLOAD_WRITE_program_version_nano_prefix_s + #define FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length)) - #define fss_payload_write_program_version_s fss_payload_write_program_version_major_s F_string_ascii_period_s fss_payload_write_program_version_minor_s F_string_ascii_period_s fss_payload_write_program_version_micro_s fss_payload_write_program_version_nano_prefix_s fss_payload_write_program_version_nano_s + #if !(defined(FSS_PAYLOAD_WRITE_program_version_nano_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_s_length)) + #define FSS_PAYLOAD_WRITE_program_version_nano_s + #define FSS_PAYLOAD_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_PAYLOAD_WRITE_program_version_nano_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_s_length)) + + #define FSS_PAYLOAD_WRITE_program_version_s FSS_PAYLOAD_WRITE_program_version_major_s F_string_ascii_period_s FSS_PAYLOAD_WRITE_program_version_minor_s F_string_ascii_period_s FSS_PAYLOAD_WRITE_program_version_micro_s FSS_PAYLOAD_WRITE_program_version_nano_prefix_s FSS_PAYLOAD_WRITE_program_version_nano_s + + #define FSS_PAYLOAD_WRITE_program_version_s_length FSS_PAYLOAD_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_WRITE_program_version_micro_s_length + FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length + FSS_PAYLOAD_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_payload_write_program_version_s; #endif // _di_fss_payload_write_program_version_ #ifndef _di_fss_payload_write_program_name_ - #define fss_payload_write_program_name_s "fss_payload_write" - #define fss_payload_write_program_name_long_s "FSS Basic List Write" + #define FSS_PAYLOAD_WRITE_program_name_s "fss_payload_write" + #define FSS_PAYLOAD_WRITE_program_name_long_s "FSS Payload Write" + + #define FSS_PAYLOAD_WRITE_program_name_s_length 17 + #define FSS_PAYLOAD_WRITE_program_name_long_s_length 17 + + extern const f_string_static_t fss_payload_write_program_name_s; + extern const f_string_static_t fss_payload_write_program_name_long_s; #endif // _di_fss_payload_write_program_name_ #ifndef _di_fss_payload_write_defines_ diff --git a/level_3/fss_payload_write/c/main.c b/level_3/fss_payload_write/c/main.c index 85b72ae..e66dfa8 100644 --- a/level_3/fss_payload_write/c/main.c +++ b/level_3/fss_payload_write/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_payload_write_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/fss_payload_write/c/private-common.c b/level_3/fss_payload_write/c/private-common.c index 1317e4e..1e40ae7 100644 --- a/level_3/fss_payload_write/c/private-common.c +++ b/level_3/fss_payload_write/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/fss_payload_write/c/private-write.c b/level_3/fss_payload_write/c/private-write.c index ce6cdaf..13305d8 100644 --- a/level_3/fss_payload_write/c/private-write.c +++ b/level_3/fss_payload_write/c/private-write.c @@ -15,12 +15,12 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_partial_s, main->error.notable); + fl_print_format("%q%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_object_s, main->error.notable); + fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_content_s, main->error.notable); + fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -36,7 +36,7 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThis standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable); fl_print_format("%[' in objects.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -53,8 +53,8 @@ extern "C" { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%S%S%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -280,7 +280,7 @@ extern "C" { } // When payload is provided, all data at this point is part of the payload until the end of the pipe. - if (fl_string_dynamic_compare_string(f_fss_string_payload_s, object, F_fss_string_payload_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(f_fss_string_payload_s, object) == F_equal_to) { if (total > 1) { // The first character is the terminating new line, which is not part of the payload. @@ -322,7 +322,7 @@ extern "C" { if (block.string[range.start] == fss_payload_write_pipe_content_start_s) { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sThis standard only supports one content per object.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThis standard only supports one content per object.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } status = F_status_set_error(F_supported_not); @@ -386,9 +386,9 @@ extern "C" { status = fss_payload_write_process(main, output, quote, &object, &content, buffer); } - macro_f_string_dynamic_t_delete_simple(block); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &block); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); return status; } diff --git a/level_3/fss_status_code/c/fss_status_code.c b/level_3/fss_status_code/c/fss_status_code.c index c6658a2..a166f78 100644 --- a/level_3/fss_status_code/c/fss_status_code.c +++ b/level_3/fss_status_code/c/fss_status_code.c @@ -6,6 +6,15 @@ extern "C" { #endif +#ifndef _di_fss_status_code_program_version_ + const f_string_static_t fss_status_code_program_version_s = macro_f_string_static_t_initialize2(FSS_STATUS_CODE_program_version_s, 0, FSS_STATUS_CODE_program_version_s_length); +#endif // _di_fss_status_code_program_version_ + +#ifndef _di_fss_status_code_program_name_ + const f_string_static_t fss_status_code_program_name_s = macro_f_string_static_t_initialize2(FSS_STATUS_CODE_program_name_s, 0, FSS_STATUS_CODE_program_name_s_length); + const f_string_static_t fss_status_code_program_name_long_s = macro_f_string_static_t_initialize2(FSS_STATUS_CODE_program_name_long_s, 0, FSS_STATUS_CODE_program_name_long_s_length); +#endif // _di_fss_status_code_program_name_ + #ifndef _di_fss_status_code_print_help_ f_status_t fss_status_code_print_help(const f_file_t file, const f_color_context_t context) { @@ -13,22 +22,22 @@ extern "C" { fll_program_print_help_header(file, context, fss_status_code_program_name_long_s, fss_status_code_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, fss_status_code_short_is_fine_s, fss_status_code_long_is_fine_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print F_true if the error code is not an error, F_false otherwise."); - fll_program_print_help_option(file, context, fss_status_code_short_is_warning_s, fss_status_code_long_is_warning_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Print F_true if the error code is a warning, F_false otherwise."); - fll_program_print_help_option(file, context, fss_status_code_short_is_error_s, fss_status_code_long_is_error_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print F_true if the error code is an error, F_false otherwise."); - fll_program_print_help_option(file, context, fss_status_code_short_number_s, fss_status_code_long_number_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Convert status code name to number."); + fll_program_print_help_option(file, context, fss_status_code_short_is_fine_s, fss_status_code_long_is_fine_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print F_true if the error code is not an error, F_false otherwise."); + fll_program_print_help_option(file, context, fss_status_code_short_is_warning_s, fss_status_code_long_is_warning_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print F_true if the error code is a warning, F_false otherwise."); + fll_program_print_help_option(file, context, fss_status_code_short_is_error_s, fss_status_code_long_is_error_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print F_true if the error code is an error, F_false otherwise."); + fll_program_print_help_option(file, context, fss_status_code_short_number_s, fss_status_code_long_number_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Convert status code name to number."); fll_program_print_help_usage(file, context, fss_status_code_program_name_s, "status code(s)"); @@ -134,10 +143,10 @@ extern "C" { if (main->parameters[fss_status_code_parameter_is_warning_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_error_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_error_s, main->error.notable); fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_warning_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_warning_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -148,10 +157,10 @@ extern "C" { else if (main->parameters[fss_status_code_parameter_is_fine_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_error_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_error_s, main->error.notable); fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_fine_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_fine_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -163,10 +172,10 @@ extern "C" { else if (main->parameters[fss_status_code_parameter_is_warning_e].result == f_console_result_found_e && main->parameters[fss_status_code_parameter_is_fine_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_warning_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_warning_s, main->error.notable); fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_fine_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_fine_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -297,12 +306,12 @@ extern "C" { for (f_array_length_t i = 0; i < fss_status_code_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/fss_status_code/c/fss_status_code.h b/level_3/fss_status_code/c/fss_status_code.h index 526f38e..099bfa3 100644 --- a/level_3/fss_status_code/c/fss_status_code.h +++ b/level_3/fss_status_code/c/fss_status_code.h @@ -8,14 +8,15 @@ * This program provides status code to/from string translation. */ #ifndef _fss_status_code_h +#define _fss_status_code_h -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -29,13 +30,13 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -47,24 +48,38 @@ extern "C" { #endif #ifndef _di_fss_status_code_program_version_ - #define fss_status_code_program_version_major_s F_string_ascii_0_s - #define fss_status_code_program_version_minor_s F_string_ascii_5_s - #define fss_status_code_program_version_micro_s F_string_ascii_8_s + #define FSS_STATUS_code_program_version_major_s F_string_ascii_0_s + #define FSS_STATUS_code_program_version_minor_s F_string_ascii_5_s + #define FSS_STATUS_code_program_version_micro_s F_string_ascii_8_s - #ifndef fss_status_code_program_version_nano_prefix_s - #define fss_status_code_program_version_nano_prefix_s - #endif + #define FSS_STATUS_code_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_STATUS_code_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_STATUS_code_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef fss_status_code_program_version_nano_s - #define fss_status_code_program_version_nano_s - #endif + #if !(defined(FSS_STATUS_program_version_nano_prefix_s) && defined(FSS_STATUS_program_version_nano_prefix_s_length)) + #define FSS_STATUS_program_version_nano_prefix_s + #define FSS_STATUS_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_STATUS_program_version_nano_prefix_s) && defined(FSS_STATUS_program_version_nano_prefix_s_length)) - #define fss_status_code_program_version_s fss_status_code_program_version_major_s F_string_ascii_period_s fss_status_code_program_version_minor_s F_string_ascii_period_s fss_status_code_program_version_micro_s fss_status_code_program_version_nano_prefix_s fss_status_code_program_version_nano_s + #if !(defined(FSS_STATUS_program_version_nano_s) && defined(FSS_STATUS_program_version_nano_s_length)) + #define FSS_STATUS_program_version_nano_s + #define FSS_STATUS_program_version_nano_s_length 0 + #endif // !(defined(FSS_STATUS_program_version_nano_s) && defined(FSS_STATUS_program_version_nano_s_length)) + + #define FSS_STATUS_code_program_version_length_s FSS_STATUS_code_program_version_major_s F_string_ascii_period_s FSS_STATUS_code_program_version_minor_s F_string_ascii_period_s FSS_STATUS_code_program_version_micro_s FSS_STATUS_code_program_version_nano_prefix_s FSS_STATUS_code_program_version_nano_s + + extern const f_string_static_t fss_status_code_program_version_s; #endif // _di_fss_status_code_program_version_ #ifndef _di_fss_status_code_program_name_ - #define fss_status_code_program_name_s "fss_status_code" - #define fss_status_code_program_name_long_s "FSS Status Code" + #define FSS_STATUS_code_program_name_s "FSS_STATUS_code" + #define FSS_STATUS_code_program_name_long_s "FSS Status Code" + + #define FSS_STATUS_CODE_program_name_s_length + #define FSS_STATUS_CODE_program_name_long_s_length + + const f_string_static_t fss_status_code_program_name_s; + const f_string_static_t fss_status_code_program_name_long_s; #endif // _di_fss_status_code_program_name_ #ifndef _di_fss_status_code_defines_ diff --git a/level_3/fss_status_code/c/main.c b/level_3/fss_status_code/c/main.c index f759ef3..29dac47 100644 --- a/level_3/fss_status_code/c/main.c +++ b/level_3/fss_status_code/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = fss_status_code_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status) || status == F_false) { - return 1; - } + if (F_status_is_error(status) || status == F_false) return 1; return 0; } diff --git a/level_3/fss_status_code/c/private-common.c b/level_3/fss_status_code/c/private-common.c index 052c043..3553be8 100644 --- a/level_3/fss_status_code/c/private-common.c +++ b/level_3/fss_status_code/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index 9812500..062c66d 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -6,6 +6,15 @@ extern "C" { #endif +#ifndef _di_iki_read_program_version_ + const f_string_static_t iki_read_program_version_s = macro_f_string_static_t_initialize2(IKI_READ_program_version_s, 0, IKI_READ_program_version_s_length); +#endif // _di_iki_read_program_version_ + +#ifndef _di_iki_read_program_name_ + const f_string_static_t iki_read_program_name_s = macro_f_string_static_t_initialize2(IKI_READ_program_name_s, 0, IKI_READ_program_name_s_length); + const f_string_static_t iki_read_program_name_long_s = macro_f_string_static_t_initialize2(IKI_READ_program_name_long_s, 0, IKI_READ_program_name_long_s_length); +#endif // _di_iki_read_program_name_ + #ifndef _di_iki_read_print_help_ f_status_t iki_read_print_help(const f_file_t file, const f_color_context_t context) { @@ -13,33 +22,33 @@ extern "C" { fll_program_print_help_header(file, context, iki_read_program_name_long_s, iki_read_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, iki_read_short_at_s, iki_read_long_at_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select variable at this numeric index."); - fll_program_print_help_option(file, context, iki_read_short_line_s, iki_read_long_line_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print only the variables at the given line within the file."); - fll_program_print_help_option(file, context, iki_read_short_name_s, iki_read_long_name_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Select variables with this name."); - fll_program_print_help_option(file, context, iki_read_short_whole_s, iki_read_long_whole_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Print all of the data instead of just the IKI variable data."); + fll_program_print_help_option(file, context, iki_read_short_at_s, iki_read_long_at_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select variable at this numeric index."); + fll_program_print_help_option(file, context, iki_read_short_line_s, iki_read_long_line_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the variables at the given line within the file."); + fll_program_print_help_option(file, context, iki_read_short_name_s, iki_read_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select variables with this name."); + fll_program_print_help_option(file, context, iki_read_short_whole_s, iki_read_long_whole_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print all of the data instead of just the IKI variable data."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, iki_read_short_content_s, iki_read_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Print the variable content (default)."); - fll_program_print_help_option(file, context, iki_read_short_literal_s, iki_read_long_literal_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Print the entire variable (aka: object, content, and syntax)."); - fll_program_print_help_option(file, context, iki_read_short_object_s, iki_read_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the variable name (aka: object)."); - fll_program_print_help_option(file, context, iki_read_short_total_s, iki_read_long_total_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print the total number of variables."); + fll_program_print_help_option(file, context, iki_read_short_content_s, iki_read_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print the variable content (default)."); + fll_program_print_help_option(file, context, iki_read_short_literal_s, iki_read_long_literal_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print the entire variable (aka: object, content, and syntax)."); + fll_program_print_help_option(file, context, iki_read_short_object_s, iki_read_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the variable name (aka: object)."); + fll_program_print_help_option(file, context, iki_read_short_total_s, iki_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of variables."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, iki_read_short_substitute_s, iki_read_long_substitute_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Substitute the entire variable for the given name and content value with the given string."); + fll_program_print_help_option(file, context, iki_read_short_substitute_s, iki_read_long_substitute_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Substitute the entire variable for the given name and content value with the given string."); fll_program_print_help_usage(file, context, iki_read_program_name_s, "filename(s)"); @@ -174,8 +183,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_at_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_at_s, main->error.notable); fl_print_format("%[' requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -203,10 +212,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_at_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_at_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_whole_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_whole_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -220,8 +229,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_line_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_line_s, main->error.notable); fl_print_format("%[' requires a positive number.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -250,8 +259,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_name_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_name_s, main->error.notable); fl_print_format("%[' requires a string.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -265,8 +274,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, main->error.notable); fl_print_format("%[' requires 3 strings.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -279,10 +288,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -297,10 +306,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_literal_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_literal_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_object_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_object_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -313,10 +322,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_literal_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_literal_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -329,10 +338,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_literal_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_literal_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -348,10 +357,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_object_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_object_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_content_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -364,10 +373,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_object_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_object_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -391,10 +400,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_whole_s, main->error.notable); + fl_print_format("%q%[%QCannot specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_whole_s, main->error.notable); fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_total_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_total_s, main->error.notable); fl_print_format("%[' parameter.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -429,7 +438,7 @@ extern "C" { } // Clear buffers before continuing. - macro_f_string_dynamic_t_delete_simple(main->buffer); + f_string_dynamic_resize(0, &main->buffer); } if (F_status_is_fine(status) && main->remaining.used > 0) { @@ -486,13 +495,13 @@ extern "C" { if (F_status_is_error(status)) break; // Clear buffers before repeating the loop. - macro_f_string_dynamic_t_delete_simple(main->buffer); + f_string_dynamic_resize(0, &main->buffer); } // for } } else { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QYou failed to specify one or more files.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } status = F_status_set_error(F_parameter); @@ -520,13 +529,13 @@ extern "C" { for (f_array_length_t i = 0; i < iki_read_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); - macro_f_string_dynamic_t_delete_simple(main->buffer); + f_type_array_lengths_resize(0, &main->remaining); + f_string_dynamic_resize(0, &main->buffer); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/iki_read/c/iki_read.h b/level_3/iki_read/c/iki_read.h index a4ee261..12af928 100644 --- a/level_3/iki_read/c/iki_read.h +++ b/level_3/iki_read/c/iki_read.h @@ -13,15 +13,16 @@ * This processes in accordance to the IKI specification. */ #ifndef _iki_read_h +#define _iki_read_h -// libc includes. +// Libc includes. #include #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -36,7 +37,7 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include @@ -44,7 +45,7 @@ #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -55,24 +56,40 @@ extern "C" { #endif #ifndef _di_iki_read_program_version_ - #define iki_read_program_version_major_s F_string_ascii_0_s - #define iki_read_program_version_minor_s F_string_ascii_5_s - #define iki_read_program_version_micro_s F_string_ascii_8_s + #define IKI_READ_program_version_major_s F_string_ascii_0_s + #define IKI_READ_program_version_minor_s F_string_ascii_5_s + #define IKI_READ_program_version_micro_s F_string_ascii_8_s - #ifndef iki_read_program_version_nano_prefix_s - #define iki_read_program_version_nano_prefix_s - #endif + #define IKI_READ_program_version_major_s_length F_string_ascii_0_s_length + #define IKI_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define IKI_READ_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef iki_read_program_version_nano_s - #define iki_read_program_version_nano_s - #endif + #if !(defined(IKI_READ_program_version_nano_prefix_s) && defined(IKI_READ_program_version_nano_prefix_s_length)) + #define IKI_READ_program_version_nano_prefix_s + #define IKI_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(IKI_READ_program_version_nano_prefix_s) && defined(IKI_READ_program_version_nano_prefix_s_length)) - #define iki_read_program_version_s iki_read_program_version_major_s F_string_ascii_period_s iki_read_program_version_minor_s F_string_ascii_period_s iki_read_program_version_micro_s iki_read_program_version_nano_prefix_s iki_read_program_version_nano_s + #if !(defined(IKI_READ_program_version_nano_s) && defined(IKI_READ_program_version_nano_s_length)) + #define IKI_READ_program_version_nano_s + #define IKI_READ_program_version_nano_s_length 0 + #endif // !(defined(IKI_READ_program_version_nano_s) && defined(IKI_READ_program_version_nano_s_length)) + + #define IKI_READ_program_version_s IKI_READ_program_version_major_s F_string_ascii_period_s IKI_READ_program_version_minor_s F_string_ascii_period_s IKI_READ_program_version_micro_s IKI_READ_program_version_nano_prefix_s IKI_READ_program_version_nano_s + + #define IKI_READ_program_version_s_length iki_read_program_version_major_s_length + F_string_ascii_period_s iki_read_program_version_minor_s_length + F_string_ascii_period_s_length + iki_read_program_version_micro_s_length + iki_read_program_version_nano_prefix_s_length + iki_read_program_version_nano_s_length + + extern const f_string_static_t iki_read_program_version_s; #endif // _di_iki_read_program_version_ #ifndef _di_iki_read_program_name_ - #define iki_read_program_name_s "iki_read" - #define iki_read_program_name_long_s "IKI Read" + #define IKI_READ_program_name_s "iki_read" + #define IKI_READ_program_name_long_s "IKI Read" + + #define IKI_READ_program_name_s_length 9 + #define IKI_READ_program_name_long_s_length 9 + + extern const f_string_static_t iki_read_program_name_s; + extern const f_string_static_t iki_read_program_name_long_s; #endif // _di_iki_read_program_name_ #ifndef _di_iki_read_defines_ diff --git a/level_3/iki_read/c/main.c b/level_3/iki_read/c/main.c index 5cf5f38..a3fa352 100644 --- a/level_3/iki_read/c/main.c +++ b/level_3/iki_read/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = iki_read_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/iki_read/c/private-common.c b/level_3/iki_read/c/private-common.c index 4f8908b..b2b3583 100644 --- a/level_3/iki_read/c/private-common.c +++ b/level_3/iki_read/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/iki_read/c/private-read.c b/level_3/iki_read/c/private-read.c index a5a72c0..e3803c9 100644 --- a/level_3/iki_read/c/private-read.c +++ b/level_3/iki_read/c/private-read.c @@ -162,7 +162,7 @@ extern "C" { macro_iki_read_substitutions_t_delete_simple(substitutionss[i]); } // for - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } @@ -195,7 +195,7 @@ extern "C" { funlockfile(main->output.to.stream); } // for - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); if (unmatched) status = F_data_not; else status = F_none; @@ -318,7 +318,7 @@ extern "C" { for (f_array_length_t index = 0; i < main->parameters[iki_read_parameter_name_e].values.used; ++i) { index = main->parameters[iki_read_parameter_name_e].values.array[i]; - length_argument = strnlen(arguments->argv[index], f_console_parameter_size); + length_argument = strnlen(arguments->argv[index], F_console_parameter_size_d); for (j = 0, name_missed = F_true; j < names.used; ++j) { @@ -357,7 +357,8 @@ extern "C" { macro_iki_read_substitutions_t_delete_simple(substitutionss[i]); } // for - macro_f_string_dynamics_t_delete_simple(names); + f_string_dynamics_resize(0, &names); + return status; } } @@ -443,7 +444,7 @@ extern "C" { macro_iki_read_substitutions_t_delete_simple(substitutionss[i]); } // for - macro_f_string_dynamics_t_delete_simple(names); + f_string_dynamics_resize(0, &names); return F_none; } @@ -501,7 +502,7 @@ extern "C" { if (!((++signal_check) % iki_read_signal_check_d)) { if (iki_read_signal_received(main)) { - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return F_status_set_error(F_interrupt); } @@ -517,7 +518,7 @@ extern "C" { if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); return status; } @@ -531,7 +532,7 @@ extern "C" { } // for } // for - macro_f_string_dynamic_t_delete_simple(name); + f_string_dynamic_resize(0, &name); } else { total = iki_data->variable.used; @@ -575,7 +576,7 @@ extern "C" { for (; i < parameter->values.used; i += 3) { index = parameter->values.array[i]; - length = strnlen(arguments->argv[index], f_console_parameter_size); + length = strnlen(arguments->argv[index], F_console_parameter_size_d); for (j = 0; j < vocabulary->used; ++j) { @@ -588,12 +589,12 @@ extern "C" { index = parameter->values.array[i + 1]; index_2 = substitutionss[j].used; substitutionss[j].array[index_2].replace.string = arguments->argv[index]; - substitutionss[j].array[index_2].replace.used = strnlen(arguments->argv[index], f_console_parameter_size); + substitutionss[j].array[index_2].replace.used = strnlen(arguments->argv[index], F_console_parameter_size_d); substitutionss[j].array[index_2].replace.size = substitutionss[j].array[index_2].replace.used; index = parameter->values.array[i + 2]; substitutionss[j].array[index_2].with.string = arguments->argv[index]; - substitutionss[j].array[index_2].with.used = strnlen(arguments->argv[index], f_console_parameter_size); + substitutionss[j].array[index_2].with.used = strnlen(arguments->argv[index], F_console_parameter_size_d); substitutionss[j].array[index_2].with.size = substitutionss[j].array[index_2].with.used; ++substitutionss[j].used; diff --git a/level_3/iki_write/c/iki_write.c b/level_3/iki_write/c/iki_write.c index c8f95b1..ff8222a 100644 --- a/level_3/iki_write/c/iki_write.c +++ b/level_3/iki_write/c/iki_write.c @@ -6,6 +6,15 @@ extern "C" { #endif +#ifndef _di_iki_write_program_version_ + const f_string_static_t iki_write_program_version_s = macro_f_string_static_t_initialize2(IKI_WRITE_program_version_s, 0, IKI_WRITE_program_version_s_length); +#endif // _di_iki_write_program_version_ + +#ifndef _di_iki_write_program_name_ + const f_string_static_t iki_write_program_name_s = macro_f_string_static_t_initialize2(IKI_WRITE_program_name_s, 0, IKI_WRITE_program_name_s_length); + const f_string_static_t iki_write_program_name_long_s = macro_f_string_static_t_initialize2(IKI_WRITE_program_name_long_s, 0, IKI_WRITE_program_name_long_s_length); +#endif // _di_iki_write_program_name_ + #ifndef _di_iki_write_print_help_ f_status_t iki_write_print_help(const f_file_t file, const f_color_context_t context) { @@ -13,23 +22,23 @@ extern "C" { fll_program_print_help_header(file, context, iki_write_program_name_long_s, iki_write_program_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, iki_write_short_file_s, iki_write_long_file_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Specify a file to send data to."); - fll_program_print_help_option(file, context, iki_write_short_content_s, iki_write_long_content_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "The content to file."); - fll_program_print_help_option(file, context, iki_write_short_double_s, iki_write_long_double_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use double quotes (default)."); - fll_program_print_help_option(file, context, iki_write_short_object_s, iki_write_long_object_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " The object to file."); - fll_program_print_help_option(file, context, iki_write_short_single_s, iki_write_long_single_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use single quotes."); + fll_program_print_help_option(file, context, iki_write_short_file_s, iki_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to."); + fll_program_print_help_option(file, context, iki_write_short_content_s, iki_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The content to file."); + fll_program_print_help_option(file, context, iki_write_short_double_s, iki_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default)."); + fll_program_print_help_option(file, context, iki_write_short_object_s, iki_write_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The object to file."); + fll_program_print_help_option(file, context, iki_write_short_single_s, iki_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes."); fll_program_print_help_usage(file, context, iki_write_program_name_s, f_string_empty_s); @@ -160,8 +169,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_file_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_file_s, main->error.notable); fl_print_format("%[' may only be specified once.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -186,8 +195,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_file_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_file_s, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -201,8 +210,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_object_s, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -215,8 +224,8 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_content_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_content_s, main->error.notable); fl_print_format("%[' is specified, but no value is given.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -230,10 +239,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sNo main provided, either pipe the main or use the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_object_s, main->error.notable); + fl_print_format("%q%[%QNo main provided, either pipe the main or use the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_object_s, main->error.notable); fl_print_format("%[' and the '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_content_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_content_s, main->error.notable); fl_print_format("%[' parameters.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -248,10 +257,10 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameters '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_content_s, main->error.notable); + fl_print_format("%q%[%QThe parameters '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_content_s, main->error.notable); fl_print_format("%[' and '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_object_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_object_s, main->error.notable); fl_print_format("%[' must be specified the same number of times.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -261,18 +270,18 @@ extern "C" { } } - uint8_t quote = f_iki_syntax_quote_double_s.string[0]; + data->quote = f_iki_syntax_quote_double_s.string[0]; if (F_status_is_error_not(status)) { if (main->parameters[iki_write_parameter_double_e].result == f_console_result_found_e) { if (main->parameters[iki_write_parameter_single_e].result == f_console_result_found_e) { if (main->parameters[iki_write_parameter_double_e].location < main->parameters[iki_write_parameter_single_e].location) { - quote = f_iki_syntax_quote_single_s.string[0]; + data->quote = f_iki_syntax_quote_single_s.string[0]; } } } else if (main->parameters[iki_write_parameter_single_e].result == f_console_result_found_e) { - quote = f_iki_syntax_quote_single_s.string[0]; + data->quote = f_iki_syntax_quote_single_s.string[0]; } } @@ -302,6 +311,7 @@ extern "C" { if (!((++signal_check) % iki_write_signal_check_d)) { if (iki_write_signal_received(main)) { status = F_status_set_error(F_interrupt); + break; } @@ -315,15 +325,17 @@ extern "C" { fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_to", F_true, "-", "read", fll_error_file_type_pipe_e); status = F_status_set_error(F_pipe); + break; } if (!buffer.used) { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sThe pipe has no main.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThe pipe has no main.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } status = F_status_set_error(F_parameter); + break; } @@ -335,6 +347,7 @@ extern "C" { if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_seek_line", F_true); + break; } @@ -342,15 +355,17 @@ extern "C" { status = F_status_set_error(F_parameter); fll_error_print(main->error, F_parameter, "f_string_dynamic_seek_line", F_true); + break; } if (object_ended && previous == range.start) { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sThe pipe has incorrectly placed newlines.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThe pipe has incorrectly placed newlines.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } status = F_status_set_error(F_parameter); + break; } @@ -365,11 +380,12 @@ extern "C" { if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true); + break; } } - status = iki_write_process(main, file, object, content, quote, &escaped); + status = iki_write_process(main, file, object, content, &escaped); if (F_status_is_error(status)) break; fll_print_dynamic(f_string_eol_s, file.stream); @@ -383,6 +399,7 @@ extern "C" { if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true); + break; } @@ -404,15 +421,15 @@ extern "C" { if (F_status_is_error_not(status) && object_ended) { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%q%[%sThe pipe has an object without content.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%q%[%QThe pipe has an object without content.%]%q", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } status = F_status_set_error(F_parameter); } - macro_f_string_dynamic_t_delete_simple(buffer); - macro_f_string_dynamic_t_delete_simple(object); - macro_f_string_dynamic_t_delete_simple(content); + f_string_dynamic_resize(0, &buffer); + f_string_dynamic_resize(0, &object); + f_string_dynamic_resize(0, &content); } if (F_status_is_error_not(status)) { @@ -432,14 +449,14 @@ extern "C" { } object.string = arguments->argv[main->parameters[iki_write_parameter_object_e].values.array[i]]; - object.used = strnlen(object.string, f_console_parameter_size); + object.used = strnlen(object.string, F_console_parameter_size_d); object.size = object.used; content.string = arguments->argv[main->parameters[iki_write_parameter_content_e].values.array[i]]; - content.used = strnlen(content.string, f_console_parameter_size); + content.used = strnlen(content.string, F_console_parameter_size_d); content.size = content.used; - status = iki_write_process(main, file, object, content, quote, &escaped); + status = iki_write_process(main, file, object, content, &escaped); if (F_status_is_error(status)) break; fll_print_dynamic(f_string_eol_s, file.stream); @@ -451,7 +468,7 @@ extern "C" { } } - macro_f_string_dynamic_t_delete_simple(escaped); + f_string_dynamic_resize(0, &escaped); } if (main->parameters[iki_write_parameter_file_e].result == f_console_result_additional_e) { @@ -482,13 +499,13 @@ extern "C" { for (f_array_length_t i = 0; i < iki_write_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); - macro_f_string_dynamic_t_delete_simple(main->buffer); + f_type_array_lengths_resize(0, &main->remaining); + f_string_dynamic_resize(0, &main->buffer); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/iki_write/c/iki_write.h b/level_3/iki_write/c/iki_write.h index 1e325b4..977de05 100644 --- a/level_3/iki_write/c/iki_write.h +++ b/level_3/iki_write/c/iki_write.h @@ -13,15 +13,16 @@ * This processes in accordance to the IKI specification. */ #ifndef _iki_write_h +#define _iki_write_h -// libc includes. +// Libc includes. #include #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -36,14 +37,14 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -55,24 +56,40 @@ extern "C" { #endif #ifndef _di_iki_write_program_version_ - #define iki_write_program_version_major_s F_string_ascii_0_s - #define iki_write_program_version_minor_s F_string_ascii_5_s - #define iki_write_program_version_micro_s F_string_ascii_8_s + #define IKI_WRITE_program_version_major_s F_string_ascii_0_s + #define IKI_WRITE_program_version_minor_s F_string_ascii_5_s + #define IKI_WRITE_program_version_micro_s F_string_ascii_8_s - #ifndef iki_write_program_version_nano_prefix_s - #define iki_write_program_version_nano_prefix_s - #endif + #define IKI_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define IKI_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define IKI_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef iki_write_program_version_nano_s - #define iki_write_program_version_nano_s - #endif + #if !(defined(IKI_WRITE_program_version_nano_prefix_s) && defined(IKI_WRITE_program_version_nano_prefix_s_length)) + #define IKI_WRITE_program_version_nano_prefix_s + #define IKI_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(IKI_WRITE_program_version_nano_prefix_s) && defined(IKI_WRITE_program_version_nano_prefix_s_length)) - #define iki_write_program_version_s iki_write_program_version_major_s F_string_ascii_period_s iki_write_program_version_minor_s F_string_ascii_period_s iki_write_program_version_micro_s iki_write_program_version_nano_prefix_s iki_write_program_version_nano_s + #if !(defined(IKI_WRITE_program_version_nano_s) && defined(IKI_WRITE_program_version_nano_s_length)) + #define IKI_WRITE_program_version_nano_s + #define IKI_WRITE_program_version_nano_s_length 0 + #endif // !(defined(IKI_WRITE_program_version_nano_s) && defined(IKI_WRITE_program_version_nano_s_length)) + + #define IKI_WRITE_program_version_s IKI_WRITE_program_version_major_s F_string_ascii_period_s IKI_WRITE_program_version_minor_s F_string_ascii_period_s IKI_WRITE_program_version_micro_s IKI_WRITE_program_version_nano_prefix_s IKI_WRITE_program_version_nano_s + + #define IKI_WRITE_program_version_s_length IKI_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + IKI_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + IKI_WRITE_program_version_micro_s_length + IKI_WRITE_program_version_nano_prefix_s_length + IKI_WRITE_program_version_nano_s_length + + extern const f_string_static_t iki_write_program_version_s; #endif // _di_iki_write_program_version_ #ifndef _di_iki_write_program_name_ #define iki_write_program_name_s "iki_write" #define iki_write_program_name_long_s "IKI Write" + + #define IKI_WRITE_program_name_s_length 9 + #define IKI_WRITE_program_name_long_s_length 9 + + extern const f_string_static_t iki_write_program_name_s; + extern const f_string_static_t iki_write_program_name_long_s; #endif // _di_iki_write_program_name_ #ifndef _di_iki_write_defines_ @@ -142,6 +159,7 @@ extern "C" { f_signal_t signal; + f_string_static_t quote; f_string_dynamic_t buffer; f_color_context_t context; @@ -156,6 +174,7 @@ extern "C" { macro_fl_print_t_initialize_error(), \ macro_fl_print_t_initialize_warning(), \ f_signal_t_initialize, \ + f_string_static_t_initialize, \ f_string_dynamic_t_initialize, \ f_color_context_t_initialize, \ } diff --git a/level_3/iki_write/c/main.c b/level_3/iki_write/c/main.c index 5892694..860a101 100644 --- a/level_3/iki_write/c/main.c +++ b/level_3/iki_write/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = iki_write_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status)) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/iki_write/c/private-common.c b/level_3/iki_write/c/private-common.c index bab9455..9092618 100644 --- a/level_3/iki_write/c/private-common.c +++ b/level_3/iki_write/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/iki_write/c/private-write.c b/level_3/iki_write/c/private-write.c index 719d308..2150c93 100644 --- a/level_3/iki_write/c/private-write.c +++ b/level_3/iki_write/c/private-write.c @@ -7,13 +7,13 @@ extern "C" { #endif #ifndef _di_iki_write_process_ - f_status_t iki_write_process(iki_write_main_t * const main, const f_file_t output, const f_string_static_t object, const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *escaped) { + f_status_t iki_write_process(iki_write_main_t * const main, const f_file_t output, const f_string_static_t object, const f_string_static_t content, f_string_dynamic_t *escaped) { if (!object.used) { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe object is missing, it must not have a length of %]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe object is missing, it must not have a length of %]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[0%]", main->error.to.stream, main->error.notable, main->error.notable); fl_print_format("%[.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -29,7 +29,7 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe object '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%q%[%QThe object '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, object, main->error.notable); fl_print_format("%[' is not a valid IKI object.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); @@ -46,17 +46,17 @@ extern "C" { escaped->used = 0; - status = fll_iki_content_escape(content, quote, escaped); + status = fll_iki_content_escape(content, main->quote, escaped); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_iki_content_escape", F_true); - macro_f_string_dynamic_t_delete_simple((*escaped)); + f_string_dynamic_resize(0, &escaped); return F_status_set_error(F_failure); } - fl_print_format("%Q%q%c%Q%c", output.stream, object, f_iki_syntax_separator_s, quote, *escaped, quote); + fl_print_format("%Q%q%q%Q%q", output.stream, object, f_iki_syntax_separator_s, main->quote, *escaped, main->quote); return F_none; } diff --git a/level_3/iki_write/c/private-write.h b/level_3/iki_write/c/private-write.h index 7c5a1a9..0fb86c5 100644 --- a/level_3/iki_write/c/private-write.h +++ b/level_3/iki_write/c/private-write.h @@ -23,9 +23,6 @@ extern "C" { * The object to validate and print. * @param content * The content to escape and print. - * @param quote - * The quote character to use. - * This is either F_iki_syntax_quote_single_s or F_iki_syntax_quote_double_s. * @param escaped * A string buffer used as a string cache to save the string into while escaping. * @@ -34,7 +31,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_iki_write_process_ - extern f_status_t iki_write_process(iki_write_main_t * const main, const f_file_t output, const f_string_static_t object, const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *escaped) F_attribute_visibility_internal_d; + extern f_status_t iki_write_process(iki_write_main_t * const main, const f_file_t output, const f_string_static_t object, const f_string_static_t content, f_string_dynamic_t *escaped) F_attribute_visibility_internal_d; #endif // _di_iki_write_process_ #ifdef __cplusplus diff --git a/level_3/status_code/c/main.c b/level_3/status_code/c/main.c index 4775cec..ccb77ae 100644 --- a/level_3/status_code/c/main.c +++ b/level_3/status_code/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = status_code_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status) || status == F_false) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/status_code/c/private-common.c b/level_3/status_code/c/private-common.c index 7de2a72..7e775c0 100644 --- a/level_3/status_code/c/private-common.c +++ b/level_3/status_code/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { flockfile(main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", main->warning.to.stream, main->context.set.reset, f_string_eol_s, f_string_eol_s, main->context.set.warning, main->context.set.warning); fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable); fl_print_format("%[.%]%q", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s); diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/status_code.c index 7affb76..0440630 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/status_code.c @@ -6,6 +6,15 @@ extern "C" { #endif +#ifndef _di_status_code_program_version_ + const f_string_static_t status_code_progam_version_s = macro_f_string_static_t_initialize2(STATUS_CODE_progam_version_s, 0, STATUS_CODE_progam_version_s_length); +#endif // _di_status_code_program_version_ + +#ifndef _di_status_code_program_name_ + const f_string_static_t status_code_program_name_s = macro_f_string_static_t_initialize2(STATUS_CODE_program_name_s, 0, STATUS_CODE_program_name_s_length); + const f_string_static_t status_code_program_name_long_s = macro_f_string_static_t_initialize2(STATUS_CODE_program_name_long_s, 0, STATUS_CODE_program_name_long_s_length); +#endif // _di_status_code_program_name_ + #ifndef _di_status_code_print_help_ f_status_t status_code_print_help(const f_file_t file, const f_color_context_t context) { @@ -13,22 +22,22 @@ extern "C" { fll_program_print_help_header(file, context, status_code_progam_name_long_s, status_code_progam_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, status_code_short_is_fine_s, status_code_long_is_fine_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print F_true if the error code is not an error, F_false otherwise."); - fll_program_print_help_option(file, context, status_code_short_is_warning_s, status_code_long_is_warning_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Print F_true if the error code is a warning, F_false otherwise."); - fll_program_print_help_option(file, context, status_code_short_is_error_s, status_code_long_is_error_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print F_true if the error code is an error, F_false otherwise."); - fll_program_print_help_option(file, context, status_code_short_number_s, status_code_long_number_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Convert status code name to number."); + fll_program_print_help_option(file, context, status_code_short_is_fine_s, status_code_long_is_fine_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print F_true if the error code is not an error, F_false otherwise."); + fll_program_print_help_option(file, context, status_code_short_is_warning_s, status_code_long_is_warning_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print F_true if the error code is a warning, F_false otherwise."); + fll_program_print_help_option(file, context, status_code_short_is_error_s, status_code_long_is_error_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print F_true if the error code is an error, F_false otherwise."); + fll_program_print_help_option(file, context, status_code_short_number_s, status_code_long_number_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Convert status code name to number."); fll_program_print_help_usage(file, context, status_code_progam_name_s, "status code(s)"); @@ -137,10 +146,10 @@ extern "C" { if (main->parameters[status_code_parameter_is_warning_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_error_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_error_s, main->error.notable); fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_warning_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_warning_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -152,10 +161,10 @@ extern "C" { else if (main->parameters[status_code_parameter_is_fine_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_error_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_error_s, main->error.notable); fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_fine_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_fine_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -168,10 +177,10 @@ extern "C" { else if (main->parameters[status_code_parameter_is_warning_e].result == f_console_result_found_e && main->parameters[status_code_parameter_is_fine_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); - fl_print_format("%q%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_warning_s, main->error.notable); + fl_print_format("%q%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_warning_s, main->error.notable); fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, main->error.context, main->error.context); - fl_print_format("%[%q%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_fine_s, main->error.notable); + fl_print_format("%[%q%q%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_fine_s, main->error.notable); fl_print_format("%['.%]%q", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); @@ -304,12 +313,12 @@ extern "C" { for (f_array_length_t i = 0; i < status_code_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/status_code/c/status_code.h b/level_3/status_code/c/status_code.h index b6b77e1..eb115b9 100644 --- a/level_3/status_code/c/status_code.h +++ b/level_3/status_code/c/status_code.h @@ -8,14 +8,15 @@ * This program provides status code to/from string translation. */ #ifndef _status_code_h +#define _status_code_h -// libc includes. +// Libc includes. #include #include #include #include -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -29,13 +30,13 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -46,24 +47,40 @@ extern "C" { #endif #ifndef _di_status_code_program_version_ - #define status_code_program_version_major_s F_string_ascii_0_s - #define status_code_program_version_minor_s F_string_ascii_5_s - #define status_code_program_version_micro_s F_string_ascii_8_s + #define STATUS_CODE_program_version_major_s F_string_ascii_0_s + #define STATUS_CODE_program_version_minor_s F_string_ascii_5_s + #define STATUS_CODE_program_version_micro_s F_string_ascii_8_s - #ifndef status_code_progam_version_nano_prefix_s - #define status_code_progam_version_nano_prefix_s - #endif + #define STATUS_CODE_program_version_major_s_length F_string_ascii_0_s_length + #define STATUS_CODE_program_version_minor_s_length F_string_ascii_5_s_length + #define STATUS_CODE_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef status_code_progam_version_nano_s - #define status_code_progam_version_nano_s - #endif + #if !(defined(STATUS_CODE_program_version_nano_prefix_s) && defined(STATUS_CODE_program_version_nano_prefix_s_length)) + #define STATUS_CODE_program_version_nano_prefix_s + #define STATUS_CODE_program_version_nano_prefix_s_length 0 + #endif // !(defined(STATUS_CODE_program_version_nano_prefix_s) && defined(STATUS_CODE_program_version_nano_prefix_s_length)) - #define status_code_progam_version_s status_code_program_version_major_s F_string_ascii_period_s status_code_program_version_minor_s F_string_ascii_period_s status_code_program_version_micro_s status_code_progam_version_nano_prefix_s status_code_progam_version_nano_s + #if !(defined(STATUS_CODE_program_version_nano_s) && defined(STATUS_CODE_program_version_nano_s_length)) + #define STATUS_CODE_program_version_nano_s + #define STATUS_CODE_program_version_nano_s_length 0 + #endif // !(defined(STATUS_CODE_program_version_nano_s) && defined(STATUS_CODE_program_version_nano_s_length)) + + #define STATUS_CODE_progam_version_s STATUS_CODE_program_version_major_s F_string_ascii_period_s STATUS_CODE_program_version_minor_s F_string_ascii_period_s STATUS_CODE_program_version_micro_s STATUS_CODE_progam_version_nano_prefix_s STATUS_CODE_progam_version_nano_s + + #define STATUS_CODE_progam_version_s_length STATUS_CODE_program_version_major_s_length + F_string_ascii_period_s_length + STATUS_CODE_program_version_minor_s_length + F_string_ascii_period_s_length + STATUS_CODE_program_version_micro_s_length + STATUS_CODE_progam_version_nano_prefix_s_length + STATUS_CODE_progam_version_nano_s_length + + extern const f_string_static_t status_code_program_version_s; #endif // _di_status_code_program_version_ #ifndef _di_status_code_program_name_ - #define status_code_progam_name_s "status_code" - #define status_code_progam_name_long_s "FSS Status Code" + #define STATUS_CODE_progam_name_s "status_code" + #define STATUS_CODE_progam_name_long_s "FSS Status Code" + + #define STATUS_CODE_program_name_s_length 11 + #define STATUS_CODE_program_name_long_s_length 15 + + extern const f_string_static_t status_code_program_name_s; + extern const f_string_static_t status_code_program_name_long_s; #endif // _di_status_code_program_name_ #ifndef _di_status_code_defines_ diff --git a/level_3/utf8/c/main.c b/level_3/utf8/c/main.c index 5c91bb9..8a08863 100644 --- a/level_3/utf8/c/main.c +++ b/level_3/utf8/c/main.c @@ -9,45 +9,13 @@ int main(const int argc, const f_string_t *argv) { data.process_pipe = F_true; } - // Handle signals so that program can cleanly exit, deallocating as appropriate. - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_broken_pipe, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - - f_status_t status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); - - if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); - - // If there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); - } - } - } + fll_program_standard_setup(&data.signal); const f_status_t status = utf8_main(&data, &arguments); - // Flush output pipes before closing. - fflush(F_type_output_d); - fflush(F_type_error_d); - - // Close all open file descriptors. - close(F_type_descriptor_output_d); - close(F_type_descriptor_input_d); - close(F_type_descriptor_error_d); + fll_program_standard_setdown(&data.signal); - f_signal_close(&data.signal); - - if (F_status_is_error(status) || status == F_false) { - return 1; - } + if (F_status_is_error(status)) return 1; return 0; } diff --git a/level_3/utf8/c/private-print.c b/level_3/utf8/c/private-print.c index 52f6913..e93df7a 100644 --- a/level_3/utf8/c/private-print.c +++ b/level_3/utf8/c/private-print.c @@ -98,7 +98,7 @@ extern "C" { if (data->main->parameters[utf8_parameter_strip_invalid_e].result == f_console_result_found_e) return; if (data->main->parameters[utf8_parameter_verify_e].result == f_console_result_found_e) return; - fl_print_format("%q%[%SFailed to decode character code '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error); + fl_print_format("%q%[%QFailed to decode character code '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error); if (character.used) { fl_print_format("%[0x", data->main->error.to.stream, data->main->context.set.notable); @@ -129,7 +129,7 @@ extern "C" { if (data->main->error.verbosity == f_console_verbosity_quiet_e) return; - fl_print_format("%q%[%SFailed to encode Unicode codepoint '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error); + fl_print_format("%q%[%QFailed to encode Unicode codepoint '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error); fl_print_format("%[U+%_U%]", data->main->error.to.stream, data->main->context.set.notable, codepoint, data->main->context.set.notable); if (F_status_set_fine(status) == F_utf) { @@ -148,7 +148,7 @@ extern "C" { if (data->main->error.verbosity == f_console_verbosity_quiet_e) return; - fll_print_format("%q%[%sNo from sources are specified, please pipe data, designate a file, or add parameters.%]%q", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context, f_string_eol_s); + fll_print_format("%q%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%q", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context, f_string_eol_s); } #endif // _di_utf8_print_error_no_from_ @@ -159,8 +159,8 @@ extern "C" { flockfile(data->main->error.to.stream); - fl_print_format("%q%[%SThe parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error); - fl_print_format("%[%q%S%]", data->main->error.to.stream, data->main->context.set.notable, f_console_symbol_long_enable_s, parameter, data->main->context.set.notable); + fl_print_format("%q%[%QThe parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error); + fl_print_format("%[%q%q%]", data->main->error.to.stream, data->main->context.set.notable, f_console_symbol_long_enable_s, parameter, data->main->context.set.notable); fl_print_format("%[' is specified, but no value was given.%]%q", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s); funlockfile(data->main->error.to.stream); @@ -174,7 +174,7 @@ extern "C" { flockfile(data->main->error.to.stream); - fl_print_format("%q%[%SNo file specified at parameter index %]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error); + fl_print_format("%q%[%QNo file specified at parameter index %]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error); fl_print_format("%[%ul%]", data->main->error.to.stream, data->main->context.set.notable, index, data->main->context.set.notable); fl_print_format("%[.%]%q", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s); @@ -189,7 +189,7 @@ extern "C" { flockfile(data->main->error.to.stream); - fl_print_format("%q%[%SFailed to find the %s file '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, from ? utf8_string_from_s : utf8_string_to_s, data->main->context.set.error); + fl_print_format("%q%[%QFailed to find the %s file '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, from ? utf8_string_from_s : utf8_string_to_s, data->main->context.set.error); fl_print_format("%[%S%]", data->main->error.to.stream, data->main->context.set.notable, name, data->main->context.set.notable); fl_print_format("%['.%]%q", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s); @@ -202,7 +202,7 @@ extern "C" { if (data->main->error.verbosity == f_console_verbosity_quiet_e) return; - fll_print_format("%q%[%SToo many %s files specified, there may only be one to file.%]%q", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, utf8_string_to_s, data->main->context.set.error, f_string_eol_s); + fll_print_format("%q%[%QToo many %q files specified, there may only be one to file.%]%q", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, utf8_string_to_s, data->main->context.set.error, f_string_eol_s); } #endif // _di_utf8_print_error_parameter_file_to_too_many_ @@ -262,7 +262,7 @@ extern "C" { flockfile(data->main->warning.to.stream); - fl_print_format("%]%c%c%[Received signal code %]", data->main->warning.to.stream, data->main->context.set.reset, f_string_eol_s, f_string_eol_s, data->main->context.set.warning, data->main->context.set.warning); + fl_print_format("%]%q%q%[Received signal code %]", data->main->warning.to.stream, data->main->context.set.reset, f_string_eol_s, f_string_eol_s, data->main->context.set.warning, data->main->context.set.warning); fl_print_format("%[%i%]", data->main->warning.to.stream, data->main->context.set.notable, signal, data->main->context.set.notable); fl_print_format("%[.%]%q", data->main->warning.to.stream, data->main->context.set.warning, data->main->context.set.warning, f_string_eol_s); diff --git a/level_3/utf8/c/private-utf8.c b/level_3/utf8/c/private-utf8.c index 713fb65..693c719 100644 --- a/level_3/utf8/c/private-utf8.c +++ b/level_3/utf8/c/private-utf8.c @@ -16,8 +16,8 @@ extern "C" { f_file_stream_close(F_true, &data->file); } - macro_f_string_dynamic_t_delete_simple(data->buffer); - macro_f_string_dynamic_t_delete_simple(data->text); + f_string_dynamic_resize(0, &data->buffer); + f_string_dynamic_resize(0, &data->text); } #endif // _di_utf8_data_delete_ @@ -102,7 +102,7 @@ extern "C" { // When headers are printed, they are printed with a newline so only print this newline when separate is used without headers being printed. if (data->main->parameters[utf8_parameter_headers_e].result == f_console_result_none_e && data->main->parameters[utf8_parameter_separate_e].result == f_console_result_found_e) { - f_print_terminated(f_string_eol_s, data->file.stream); + f_print_dynamic(f_string_eol_s, data->file.stream); } } diff --git a/level_3/utf8/c/utf8.c b/level_3/utf8/c/utf8.c index b949b7d..7937de5 100644 --- a/level_3/utf8/c/utf8.c +++ b/level_3/utf8/c/utf8.c @@ -9,6 +9,15 @@ extern "C" { #endif +#ifndef _di_utf8_program_version_ + const f_string_static_t utf8_program_version_s = macro_f_string_static_t_initialize2(UTF8_program_version_s, 0, UTF8_program_version_s_length); +#endif // _di_utf8_program_version_ + +#ifndef _di_utf8_program_name_ + const f_string_static_t utf8_program_name_s = macro_f_string_static_t_initialize2(UTF8_program_name_s, 0, UTF8_program_name_s_length); + const f_string_static_t utf8_program_name_long_s = macro_f_string_static_t_initialize2(UTF8_program_name_long_s, 0, UTF8_program_name_s_long_length); +#endif // _di_utf8_program_name_ + #ifndef _di_utf8_print_help_ f_status_t utf8_print_help(const f_file_t file, const f_color_context_t context) { @@ -16,36 +25,36 @@ extern "C" { fll_program_print_help_header(file, context, utf8_program_name_long_s, utf8_version_s); - fll_program_print_help_option(file, context, f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print this help message."); - fll_program_print_help_option(file, context, f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(file, context, f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, "Do not file in color."); - fll_program_print_help_option(file, context, f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Decrease verbosity, silencing most output."); - fll_program_print_help_option(file, context, f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Set verbosity to normal file."); - fll_program_print_help_option(file, context, f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Increase verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Enable debugging, significantly increasing verbosity beyond normal output."); - fll_program_print_help_option(file, context, f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, f_console_symbol_short_disable_s.string, f_console_symbol_long_disable_s.string, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not file in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Decrease verbosity, silencing most output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Set verbosity to normal file."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, significantly increasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, utf8_short_from_binary_s, utf8_long_from_binary_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " The expected input format is binary (character data)."); - fll_program_print_help_option(file, context, utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "The expected input format is codepoint (such as U+0000)."); - fll_program_print_help_option(file, context, utf8_short_from_file_s, utf8_long_from_file_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use the given file as the input source."); + fll_program_print_help_option(file, context, utf8_short_from_binary_s, utf8_long_from_binary_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The expected input format is binary (character data)."); + fll_program_print_help_option(file, context, utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The expected input format is codepoint (such as U+0000)."); + fll_program_print_help_option(file, context, utf8_short_from_file_s, utf8_long_from_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use the given file as the input source."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, utf8_short_to_binary_s, utf8_long_to_binary_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " The output format is binary (character data)."); - fll_program_print_help_option(file, context, utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "The output format is codepoint (such as U+0000)."); - fll_program_print_help_option(file, context, utf8_short_to_combining_s, utf8_long_to_combining_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "The output format is to print whether or not character is combining or not."); - fll_program_print_help_option(file, context, utf8_short_to_file_s, utf8_long_to_file_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Use the given file as the output destination."); - fll_program_print_help_option(file, context, utf8_short_to_width_s, utf8_long_to_width_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " The output format is to print the width of a character (either 0, 1, or 2)."); + fll_program_print_help_option(file, context, utf8_short_to_binary_s, utf8_long_to_binary_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The output format is binary (character data)."); + fll_program_print_help_option(file, context, utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The output format is codepoint (such as U+0000)."); + fll_program_print_help_option(file, context, utf8_short_to_combining_s, utf8_long_to_combining_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The output format is to print whether or not character is combining or not."); + fll_program_print_help_option(file, context, utf8_short_to_file_s, utf8_long_to_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use the given file as the output destination."); + fll_program_print_help_option(file, context, utf8_short_to_width_s, utf8_long_to_width_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The output format is to print the width of a character (either 0, 1, or 2)."); f_print_dynamic(f_string_eol_s, file.stream); - fll_program_print_help_option(file, context, utf8_short_headers_s, utf8_long_headers_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Print headers for each section (pipe, file, or parameter)."); - fll_program_print_help_option(file, context, utf8_short_separate_s, utf8_long_separate_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Separate characters by newlines (implied when printing headers)."); - fll_program_print_help_option(file, context, utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, "Strip invalid Unicode characters (do not print invalid sequences)."); - fll_program_print_help_option(file, context, utf8_short_verify_s, utf8_long_verify_s, f_console_symbol_short_enable_s.string, f_console_symbol_long_enable_s.string, " Only perform verification of valid sequences."); + fll_program_print_help_option(file, context, utf8_short_headers_s, utf8_long_headers_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print headers for each section (pipe, file, or parameter)."); + fll_program_print_help_option(file, context, utf8_short_separate_s, utf8_long_separate_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Separate characters by newlines (implied when printing headers)."); + fll_program_print_help_option(file, context, utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Strip invalid Unicode characters (do not print invalid sequences)."); + fll_program_print_help_option(file, context, utf8_short_verify_s, utf8_long_verify_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Only perform verification of valid sequences."); fll_program_print_help_usage(file, context, utf8_program_name_s, "filename(s)"); @@ -512,12 +521,12 @@ extern "C" { for (f_array_length_t i = 0; i < utf8_total_parameters_d; ++i) { - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations); - macro_f_array_lengths_t_delete_simple(main->parameters[i].locations_sub); - macro_f_array_lengths_t_delete_simple(main->parameters[i].values); + f_type_array_lengths_resize(0, &main->parameters[i].locations); + f_type_array_lengths_resize(0, &main->parameters[i].locations_sub); + f_type_array_lengths_resize(0, &main->parameters[i].values); } // for - macro_f_array_lengths_t_delete_simple(main->remaining); + f_type_array_lengths_resize(0, &main->remaining); macro_f_color_context_t_delete_simple(main->context); diff --git a/level_3/utf8/c/utf8.h b/level_3/utf8/c/utf8.h index b3344ba..650f50a 100644 --- a/level_3/utf8/c/utf8.h +++ b/level_3/utf8/c/utf8.h @@ -14,8 +14,9 @@ * - Convert from UTF-8 binary to Unicode Codepoint (such as U+0000). */ #ifndef _utf8_h +#define _utf8_h -// libc includes. +// Libc includes. #include #include #include @@ -27,7 +28,7 @@ #define PATH_MAX 4096 #endif /* PATH_MAX */ -// fll-0 includes. +// FLL-0 includes. #include #include #include @@ -42,14 +43,14 @@ #include #include -// fll-1 includes +// FLL-1 includes. #include #include #include #include #include -// fll-2 includes +// FLL-2 includes. #include #include #include @@ -59,24 +60,40 @@ extern "C" { #endif #ifndef _di_utf8_program_version_ - #define utf8_program_version_major_s F_string_ascii_0_s - #define utf8_program_version_minor_s F_string_ascii_5_s - #define utf8_program_version_micro_s F_string_ascii_8_s + #define UTF8_program_version_major_s F_string_ascii_0_s + #define UTF8_program_version_minor_s F_string_ascii_5_s + #define UTF8_program_version_micro_s F_string_ascii_8_s - #ifndef utf8_program_version_nano_prefix_s - #define utf8_program_version_nano_prefix_s - #endif + #define UTF8_program_version_major_s_length F_string_ascii_0_s_length + #define UTF8_program_version_minor_s_length F_string_ascii_5_s_length + #define UTF8_program_version_micro_s_length F_string_ascii_8_s_length - #ifndef utf8_program_version_nano_s - #define utf8_program_version_nano_s - #endif + #if !(defined(UTF8_program_version_nano_prefix_s) && defined(UTF8_program_version_nano_prefix_s_length)) + #define UTF8_program_version_nano_prefix_s + #define UTF8_program_version_nano_prefix_s_length 0 + #endif // !(defined(UTF8_program_version_nano_prefix_s) && defined(UTF8_program_version_nano_prefix_s_length)) - #define utf8_version_s utf8_program_version_major_s F_string_ascii_period_s utf8_program_version_minor_s F_string_ascii_period_s utf8_program_version_micro_s utf8_program_version_nano_prefix_s utf8_program_version_nano_s + #if !(defined(UTF8_program_version_nano_s) && defined(UTF8_program_version_nano_s_length)) + #define UTF8_program_version_nano_s + #define UTF8_program_version_nano_s_length 0 + #endif // !(defined(UTF8_program_version_nano_s) && defined(UTF8_program_version_nano_s_length)) + + #define UTF8_program_version_s UTF8_program_version_major_s F_string_ascii_period_s UTF8_program_version_minor_s F_string_ascii_period_s UTF8_program_version_micro_s UTF8_program_version_nano_prefix_s UTF8_program_version_nano_s + + #define UTF8_program_version_s_length UTF8_program_version_major_s_length + F_string_ascii_period_s_length + UTF8_program_version_minor_s_length + F_string_ascii_period_s_length + UTF8_program_version_micro_s_length + UTF8_program_version_nano_prefix_s_length + UTF8_program_version_nano_s_length + + extern const f_string_static_t utf8_program_version_s; #endif // _di_utf8_program_version_ #ifndef _di_utf8_program_name_ - #define utf8_program_name_s "utf8" - #define utf8_program_name_long_s "UTF-8" + #define UTF8_program_name_s "utf8" + #define UTF8_program_name_long_s "UTF-8" + + #define UTF8_program_name_s_length 4 + #define UTF8_program_name_long_s_length 5 + + extern const f_string_static_t utf8_program_name_s; + extern const f_string_static_t utf8_program_name_long_s; #endif // _di_utf8_program_name_ /** -- 1.8.3.1