From fe779d659c5d892b00f2164aca2699c1db540534 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 5 Feb 2022 18:57:37 -0600 Subject: [PATCH] Progress: Continue mass converting to f_string_static_t. Of particular note are: - Implementation of fll_program_data_t to provide a standard structure for basic use. - f_color deallocation function with appropriate unit tests. --- build/level_2/settings | 4 +- build/monolithic/settings | 4 +- level_0/f_color/c/color-common.c | 108 +++++++++ level_0/f_color/c/color-common.h | 38 +++ level_0/f_color/c/color.c | 2 +- level_0/f_color/data/build/settings-tests | 2 +- .../f_color/tests/c/test-color-context_delete.c | 124 ++++++++++ .../f_color/tests/c/test-color-context_delete.h | 29 +++ .../f_color/tests/c/test-color-context_destroy.c | 124 ++++++++++ .../f_color/tests/c/test-color-context_destroy.h | 29 +++ level_0/f_color/tests/c/test-color.c | 6 + level_0/f_color/tests/c/test-color.h | 2 + level_0/f_console/c/console-common.c | 16 +- level_0/f_console/c/console-common.h | 6 +- level_0/f_console/c/console.c | 12 +- level_0/f_console/c/console.h | 7 +- .../tests/c/test-console-parameter_process.c | 28 +-- level_2/fll_program/c/program-common.c | 50 ++++ level_2/fll_program/c/program-common.h | 115 +++++++++ level_2/fll_program/c/program.c | 4 +- level_2/fll_program/c/program.h | 7 +- level_2/fll_program/data/build/settings | 4 +- level_3/byte_dump/c/byte_dump.c | 26 +- level_3/byte_dump/c/common.c | 10 +- level_3/byte_dump/c/common.h | 101 +++++--- level_3/control/c/common.c | 14 +- level_3/control/c/common.h | 47 +--- level_3/control/c/control.c | 12 +- level_3/control/c/control.h | 4 +- level_3/control/c/main.c | 2 +- level_3/control/c/private-common.c | 4 +- level_3/control/c/private-common.h | 4 +- level_3/control/c/private-control.c | 28 +-- level_3/control/c/private-control.h | 6 +- level_3/control/c/private-print.c | 28 +-- level_3/control/c/private-print.h | 28 +-- level_3/controller/c/common.c | 5 +- level_3/controller/c/common.h | 32 ++- level_3/controller/c/controller.c | 6 +- level_3/fake/c/common.c | 6 +- level_3/fake/c/common.h | 44 +++- level_3/fake/c/fake.c | 2 +- level_3/firewall/c/common.c | 1 - level_3/firewall/c/common.h | 38 ++- level_3/firewall/c/firewall.c | 8 +- level_3/fss_basic_list_read/c/common.c | 47 +++- level_3/fss_basic_list_read/c/common.h | 209 ++++++++++------ .../fss_basic_list_read/c/fss_basic_list_read.c | 37 ++- .../fss_basic_list_read/c/fss_basic_list_read.h | 4 +- level_3/fss_basic_list_read/c/main.c | 2 +- level_3/fss_basic_list_read/c/private-common.c | 4 +- level_3/fss_basic_list_read/c/private-common.h | 4 +- level_3/fss_basic_list_read/c/private-print.c | 14 +- level_3/fss_basic_list_read/c/private-print.h | 14 +- level_3/fss_basic_list_read/c/private-read.c | 20 +- level_3/fss_basic_list_read/c/private-read.h | 20 +- level_3/fss_basic_list_write/c/common.c | 38 ++- level_3/fss_basic_list_write/c/common.h | 162 ++++++++----- .../fss_basic_list_write/c/fss_basic_list_write.c | 13 +- .../fss_basic_list_write/c/fss_basic_list_write.h | 2 +- level_3/fss_basic_list_write/c/main.c | 2 +- level_3/fss_basic_list_write/c/private-common.c | 4 +- level_3/fss_basic_list_write/c/private-common.h | 4 +- level_3/fss_basic_list_write/c/private-write.c | 10 +- level_3/fss_basic_list_write/c/private-write.h | 10 +- level_3/fss_basic_read/c/common.c | 47 +++- level_3/fss_basic_read/c/common.h | 209 ++++++++++------ level_3/fss_basic_read/c/fss_basic_read.c | 37 ++- level_3/fss_basic_read/c/fss_basic_read.h | 4 +- level_3/fss_basic_read/c/main.c | 2 +- level_3/fss_basic_read/c/private-common.c | 4 +- level_3/fss_basic_read/c/private-common.h | 4 +- level_3/fss_basic_read/c/private-print.c | 10 +- level_3/fss_basic_read/c/private-print.h | 10 +- level_3/fss_basic_read/c/private-read.c | 18 +- level_3/fss_basic_read/c/private-read.h | 18 +- level_3/fss_basic_write/c/common.c | 38 ++- level_3/fss_basic_write/c/common.h | 159 +++++++----- level_3/fss_basic_write/c/fss_basic_write.c | 13 +- level_3/fss_basic_write/c/fss_basic_write.h | 2 +- level_3/fss_basic_write/c/main.c | 2 +- level_3/fss_basic_write/c/private-common.c | 4 +- level_3/fss_basic_write/c/private-common.h | 4 +- level_3/fss_basic_write/c/private-write.c | 10 +- level_3/fss_basic_write/c/private-write.h | 12 +- level_3/fss_embedded_list_read/c/common.c | 33 ++- level_3/fss_embedded_list_read/c/common.h | 193 +++++++++++---- .../c/fss_embedded_list_read.c | 31 +-- level_3/fss_embedded_list_write/c/common.c | 38 ++- level_3/fss_embedded_list_write/c/common.h | 162 ++++++++----- .../c/fss_embedded_list_write.c | 19 +- .../c/fss_embedded_list_write.h | 2 +- level_3/fss_embedded_list_write/c/main.c | 2 +- level_3/fss_embedded_list_write/c/private-common.c | 4 +- level_3/fss_embedded_list_write/c/private-common.h | 4 +- level_3/fss_embedded_list_write/c/private-write.c | 12 +- level_3/fss_embedded_list_write/c/private-write.h | 12 +- level_3/fss_extended_list_read/c/common.c | 47 +++- level_3/fss_extended_list_read/c/common.h | 209 ++++++++++------ .../c/fss_extended_list_read.c | 37 ++- .../c/fss_extended_list_read.h | 4 +- level_3/fss_extended_list_read/c/main.c | 2 +- level_3/fss_extended_list_read/c/private-common.c | 4 +- level_3/fss_extended_list_read/c/private-common.h | 4 +- level_3/fss_extended_list_read/c/private-print.c | 14 +- level_3/fss_extended_list_read/c/private-print.h | 14 +- level_3/fss_extended_list_read/c/private-read.c | 20 +- level_3/fss_extended_list_read/c/private-read.h | 20 +- level_3/fss_extended_list_write/c/common.c | 38 ++- level_3/fss_extended_list_write/c/common.h | 162 ++++++++----- .../c/fss_extended_list_write.c | 13 +- .../c/fss_extended_list_write.h | 2 +- level_3/fss_extended_list_write/c/main.c | 2 +- level_3/fss_extended_list_write/c/private-common.c | 4 +- level_3/fss_extended_list_write/c/private-common.h | 4 +- level_3/fss_extended_list_write/c/private-write.c | 12 +- level_3/fss_extended_list_write/c/private-write.h | 12 +- level_3/fss_extended_read/c/common.c | 47 +++- level_3/fss_extended_read/c/common.h | 210 ++++++++++------ level_3/fss_extended_read/c/fss_extended_read.c | 37 ++- level_3/fss_extended_read/c/fss_extended_read.h | 4 +- level_3/fss_extended_read/c/main.c | 2 +- level_3/fss_extended_read/c/private-common.c | 4 +- level_3/fss_extended_read/c/private-common.h | 4 +- level_3/fss_extended_read/c/private-print.c | 14 +- level_3/fss_extended_read/c/private-print.h | 14 +- level_3/fss_extended_read/c/private-read.c | 18 +- level_3/fss_extended_read/c/private-read.h | 22 +- level_3/fss_extended_write/c/common.c | 38 ++- level_3/fss_extended_write/c/common.h | 162 ++++++++----- level_3/fss_extended_write/c/fss_extended_write.c | 13 +- level_3/fss_extended_write/c/fss_extended_write.h | 2 +- level_3/fss_extended_write/c/main.c | 2 +- level_3/fss_extended_write/c/private-common.c | 4 +- level_3/fss_extended_write/c/private-common.h | 4 +- level_3/fss_extended_write/c/private-write.c | 10 +- level_3/fss_extended_write/c/private-write.h | 10 +- level_3/fss_identify/c/common.c | 24 +- level_3/fss_identify/c/common.h | 103 ++++---- level_3/fss_identify/c/fss_identify.c | 25 +- level_3/fss_identify/c/fss_identify.h | 2 +- level_3/fss_identify/c/main.c | 2 +- level_3/fss_identify/c/private-common.c | 4 +- level_3/fss_identify/c/private-common.h | 4 +- level_3/fss_identify/c/private-identify.c | 4 +- level_3/fss_identify/c/private-identify.h | 4 +- level_3/fss_identify/c/private-print.c | 2 +- level_3/fss_identify/c/private-print.h | 2 +- level_3/fss_payload_read/c/common.c | 54 +++-- level_3/fss_payload_read/c/common.h | 209 ++++++++++------ level_3/fss_payload_read/c/fss_payload_read.c | 28 +-- level_3/fss_payload_read/c/fss_payload_read.h | 4 +- level_3/fss_payload_read/c/main.c | 2 +- level_3/fss_payload_read/c/private-common.c | 4 +- level_3/fss_payload_read/c/private-common.h | 4 +- level_3/fss_payload_read/c/private-print.c | 24 +- level_3/fss_payload_read/c/private-print.h | 24 +- level_3/fss_payload_read/c/private-read.c | 28 +-- level_3/fss_payload_read/c/private-read.h | 28 +-- level_3/fss_payload_write/c/common.c | 45 ++-- level_3/fss_payload_write/c/common.h | 162 ++++++++----- level_3/fss_payload_write/c/fss_payload_write.c | 4 +- level_3/fss_payload_write/c/fss_payload_write.h | 2 +- level_3/fss_payload_write/c/main.c | 2 +- level_3/fss_payload_write/c/private-common.c | 4 +- level_3/fss_payload_write/c/private-common.h | 4 +- level_3/fss_payload_write/c/private-write.c | 10 +- level_3/fss_payload_write/c/private-write.h | 10 +- level_3/fss_status_code/c/common.c | 33 +-- level_3/fss_status_code/c/common.h | 101 ++++---- level_3/fss_status_code/c/fss_status_code.c | 26 +- level_3/fss_status_code/c/fss_status_code.h | 2 +- level_3/fss_status_code/c/main.c | 2 +- level_3/fss_status_code/c/private-common.c | 4 +- level_3/fss_status_code/c/private-common.h | 4 +- .../fss_status_code/c/private-fss_status_code.c | 8 +- .../fss_status_code/c/private-fss_status_code.h | 8 +- level_3/iki_read/c/common.c | 23 +- level_3/iki_read/c/common.h | 127 +++++++--- level_3/iki_read/c/iki_read.c | 29 +-- level_3/iki_write/c/common.c | 15 +- level_3/iki_write/c/common.h | 87 +++++-- level_3/iki_write/c/iki_write.c | 11 +- level_3/status_code/c/common.c | 26 +- level_3/status_code/c/common.h | 103 ++++---- level_3/status_code/c/main.c | 2 +- level_3/status_code/c/private-common.c | 4 +- level_3/status_code/c/private-common.h | 4 +- level_3/status_code/c/private-status_code.c | 8 +- level_3/status_code/c/private-status_code.h | 8 +- level_3/status_code/c/status_code.c | 35 +-- level_3/status_code/c/status_code.h | 2 +- level_3/utf8/c/common.c | 62 ++++- level_3/utf8/c/common.h | 269 +++++++++++++-------- level_3/utf8/c/main.c | 2 +- level_3/utf8/c/private-common.h | 13 +- level_3/utf8/c/private-print.c | 40 +-- level_3/utf8/c/private-print.h | 2 +- level_3/utf8/c/private-utf8.c | 25 +- level_3/utf8/c/private-utf8.h | 2 +- level_3/utf8/c/utf8.c | 66 ++--- level_3/utf8/c/utf8.h | 2 +- 202 files changed, 3953 insertions(+), 2191 deletions(-) create mode 100644 level_0/f_color/tests/c/test-color-context_delete.c create mode 100644 level_0/f_color/tests/c/test-color-context_delete.h create mode 100644 level_0/f_color/tests/c/test-color-context_destroy.c create mode 100644 level_0/f_color/tests/c/test-color-context_destroy.h create mode 100644 level_2/fll_program/c/program-common.c create mode 100644 level_2/fll_program/c/program-common.h diff --git a/build/level_2/settings b/build/level_2/settings index ddff97c..049f06e 100644 --- a/build/level_2/settings +++ b/build/level_2/settings @@ -25,14 +25,14 @@ build_libraries-level -lfll_1 -lfll_0 build_libraries-level_threadless -lfll_1 -lfll_0 build_libraries_shared build_libraries_static -build_sources_library control_group.c error.c error-common.c private-error.c execute.c private-execute.c file.c private-file.c fss.c private-fss.c fss_basic.c fss_basic_list.c fss_embedded_list.c fss_extended.c fss_extended_list.c fss_payload.c fss_status_string.c iki.c private-iki.c path.c print.c program.c status_string.c +build_sources_library control_group.c error.c error-common.c private-error.c execute.c private-execute.c file.c private-file.c fss.c private-fss.c fss_basic.c fss_basic_list.c fss_embedded_list.c fss_extended.c fss_extended_list.c fss_payload.c fss_status_string.c iki.c private-iki.c path.c print.c program.c program-common.c status_string.c build_sources_library-level build_sources_library_shared build_sources_library_static build_sources_program build_sources_program_shared build_sources_program_static -build_sources_headers control_group.h error.h error-common.h execute.h file.h fss.h fss_basic.h fss_basic_list.h fss_embedded_list.h fss_extended.h fss_extended_list.h fss_payload.h fss_status_string.h iki.h path.h print.h program.h status_string.h +build_sources_headers control_group.h error.h error-common.h execute.h file.h fss.h fss_basic.h fss_basic_list.h fss_embedded_list.h fss_extended.h fss_extended_list.h fss_payload.h fss_status_string.h iki.h path.h print.h program.h program-common.h status_string.h build_sources_headers-level build_sources_headers_shared build_sources_headers_static diff --git a/build/monolithic/settings b/build/monolithic/settings index 8e2e758..8ff0899 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -25,14 +25,14 @@ build_libraries-monolithic build_libraries-monolithic_threadless build_libraries_shared build_libraries_static -build_sources_library level_0/account.c level_0/private-account.c level_0/capability.c level_0/color.c level_0/color-common.c level_0/console.c level_0/console-common.c level_0/control_group.c level_0/control_group-common.c level_0/conversion.c level_0/conversion-common.c level_0/private-conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/execute.c level_0/file.c level_0/file-common.c level_0/private-file.c level_0/fss.c level_0/private-fss.c level_0/fss-common.c level_0/fss_named.c level_0/fss_nest.c level_0/fss_set.c level_0/iki.c level_0/iki-common.c level_0/private-iki.c level_0/limit.c level_0/memory.c level_0/memory_structure.c level_0/private-memory.c level_0/path.c level_0/path-common.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/print_to.c level_0/print-common.c level_0/private-print.c level_0/private-print_to.c level_0/serialize.c level_0/serialize-common.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/status_string.c level_0/string.c level_0/string-common.c level_0/private-string.c level_0/string_dynamic.c level_0/string_map.c level_0/string_quantity.c level_0/string_range.c level_0/string_triple.c level_0/type_array.c level_0/private-type_array.c level_0/utf.c level_0/utf-common.c level_0/utf_dynamic.c level_0/utf_map.c level_0/utf_string.c level_0/utf_triple.c level_0/private-utf.c level_0/private-utf-is_unassigned.c level_0/private-utf_string.c level_1/console.c level_1/control_group.c level_1/conversion.c level_1/private-conversion.c level_1/directory.c level_1/directory-common.c level_1/private-directory.c level_1/environment.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_embedded_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/print-common.c level_1/private-print.c level_1/signal.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/control_group.c level_2/error.c level_2/error-common.c level_2/private-error.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_embedded_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_payload.c level_2/fss_status_string.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/print.c level_2/program.c level_2/status_string.c +build_sources_library level_0/account.c level_0/private-account.c level_0/capability.c level_0/color.c level_0/color-common.c level_0/console.c level_0/console-common.c level_0/control_group.c level_0/control_group-common.c level_0/conversion.c level_0/conversion-common.c level_0/private-conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/execute.c level_0/file.c level_0/file-common.c level_0/private-file.c level_0/fss.c level_0/private-fss.c level_0/fss-common.c level_0/fss_named.c level_0/fss_nest.c level_0/fss_set.c level_0/iki.c level_0/iki-common.c level_0/private-iki.c level_0/limit.c level_0/memory.c level_0/memory_structure.c level_0/private-memory.c level_0/path.c level_0/path-common.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/print_to.c level_0/print-common.c level_0/private-print.c level_0/private-print_to.c level_0/serialize.c level_0/serialize-common.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/status_string.c level_0/string.c level_0/string-common.c level_0/private-string.c level_0/string_dynamic.c level_0/string_map.c level_0/string_quantity.c level_0/string_range.c level_0/string_triple.c level_0/type_array.c level_0/private-type_array.c level_0/utf.c level_0/utf-common.c level_0/utf_dynamic.c level_0/utf_map.c level_0/utf_string.c level_0/utf_triple.c level_0/private-utf.c level_0/private-utf-is_unassigned.c level_0/private-utf_string.c level_1/console.c level_1/control_group.c level_1/conversion.c level_1/private-conversion.c level_1/directory.c level_1/directory-common.c level_1/private-directory.c level_1/environment.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_embedded_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/print-common.c level_1/private-print.c level_1/signal.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/control_group.c level_2/error.c level_2/error-common.c level_2/private-error.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_embedded_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_payload.c level_2/fss_status_string.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/print.c level_2/program.c level_2/program-common.c level_2/status_string.c build_sources_library-monolithic level_0/thread.c level_0/private-thread.c build_sources_library_shared build_sources_library_static build_sources_program build_sources_program_shared build_sources_program_static -build_sources_headers level_0/account.h level_0/account-common.h level_0/capability.h level_0/capability-common.h level_0/color.h level_0/color-common.h level_0/console.h level_0/console-common.h level_0/control_group.h level_0/control_group-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/execute.h level_0/execute-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/fss-common.h level_0/fss_comment.h level_0/fss_delimit.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quote.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/limit.h level_0/limit-common.h level_0/memory.h level_0/memory_structure.h level_0/memory-common.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/print_to.h level_0/print-common.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/status_string.h level_0/string.h level_0/string-common.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/string_triple.h level_0/type.h level_0/type_array.h level_0/type_array-common.h level_0/utf.h level_0/utf-common.h level_0/utf_dynamic.h level_0/utf_map.h level_0/utf_string.h level_0/utf_triple.h level_1/console.h level_1/control_group.h level_1/conversion.h level_1/directory.h level_1/directory-common.h level_1/environment.h level_1/execute.h level_1/execute-common.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_embedded_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/iki.h level_1/print.h level_1/print-common.h level_1/signal.h level_1/signal-common.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/control_group.h level_2/error.h level_2/error-common.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_embedded_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_payload.h level_2/fss_status_string.h level_2/iki.h level_2/path.h level_2/print.h level_2/program.h level_2/status_string.h +build_sources_headers level_0/account.h level_0/account-common.h level_0/capability.h level_0/capability-common.h level_0/color.h level_0/color-common.h level_0/console.h level_0/console-common.h level_0/control_group.h level_0/control_group-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/execute.h level_0/execute-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/fss-common.h level_0/fss_comment.h level_0/fss_delimit.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quote.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/limit.h level_0/limit-common.h level_0/memory.h level_0/memory_structure.h level_0/memory-common.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/print_to.h level_0/print-common.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/status_string.h level_0/string.h level_0/string-common.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/string_triple.h level_0/type.h level_0/type_array.h level_0/type_array-common.h level_0/utf.h level_0/utf-common.h level_0/utf_dynamic.h level_0/utf_map.h level_0/utf_string.h level_0/utf_triple.h level_1/console.h level_1/control_group.h level_1/conversion.h level_1/directory.h level_1/directory-common.h level_1/environment.h level_1/execute.h level_1/execute-common.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_embedded_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/iki.h level_1/print.h level_1/print-common.h level_1/signal.h level_1/signal-common.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/control_group.h level_2/error.h level_2/error-common.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_embedded_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_payload.h level_2/fss_status_string.h level_2/iki.h level_2/path.h level_2/print.h level_2/program.h level_2/program-common.h level_2/status_string.h build_sources_headers-monolithic level_0/thread.h level_0/thread-common.h build_sources_headers_shared build_sources_headers_static diff --git a/level_0/f_color/c/color-common.c b/level_0/f_color/c/color-common.c index 010b667..93a98bc 100644 --- a/level_0/f_color/c/color-common.c +++ b/level_0/f_color/c/color-common.c @@ -53,6 +53,114 @@ extern "C" { const f_color_set_t f_color_set_empty_s = macro_f_color_set_t_initialize(&f_string_empty_s, &f_string_empty_s); #endif // _di_f_color_set_string_empty_s_ +#ifndef _di_f_color_context_delete_ + f_status_t f_color_context_delete(f_color_context_t * const context) { + #ifndef _di_level_0_parameters_checking_ + if (!context) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameters_checking_ + + f_status_t status = F_none; + + status = f_string_dynamic_resize(0, &context->reset); + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_resize(0, &context->warning); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_resize(0, &context->error); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_resize(0, &context->title); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_resize(0, &context->notable); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_resize(0, &context->important); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_resize(0, &context->standout); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_resize(0, &context->success); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_resize(0, &context->normal); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_resize(0, &context->normal_reset); + } + + if (F_status_is_error(status)) return status; + + macro_f_color_context_t_clear((*context)) + + return F_none; + } +#endif // _di_f_color_context_delete_ + +#ifndef _di_f_color_context_destroy_ + f_status_t f_color_context_destroy(f_color_context_t * const context) { + #ifndef _di_level_0_parameters_checking_ + if (!context) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameters_checking_ + + f_status_t status = F_none; + + status = f_string_dynamic_adjust(0, &context->reset); + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_adjust(0, &context->warning); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_adjust(0, &context->error); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_adjust(0, &context->title); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_adjust(0, &context->notable); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_adjust(0, &context->important); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_adjust(0, &context->standout); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_adjust(0, &context->success); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_adjust(0, &context->normal); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_adjust(0, &context->normal_reset); + } + + if (F_status_is_error(status)) return status; + + macro_f_color_context_t_clear((*context)) + + return F_none; + } +#endif // _di_f_color_context_destroy_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_color/c/color-common.h b/level_0/f_color/c/color-common.h index 6b71d87..bd56468 100644 --- a/level_0/f_color/c/color-common.h +++ b/level_0/f_color/c/color-common.h @@ -826,6 +826,44 @@ extern "C" { macro_f_color_context_t_clear(context) #endif // _di_f_color__context_t_ +/** + * Delete any dynamic allocated data on the color context object. + * + * @param context + * The context object. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_resize(). + * + * @see f_string_dynamic_resize() + */ +#ifndef _di_f_color_context_delete_ + extern f_status_t f_color_context_delete(f_color_context_t * const context); +#endif // _di_f_color_context_delete_ + +/** + * Destroy any dynamic allocated data on the color context object. + * + * @param context + * The context object. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_adjust(). + * + * @see f_string_dynamic_adjust() + */ +#ifndef _di_f_color_context_destroy_ + extern f_status_t f_color_context_destroy(f_color_context_t * const context); +#endif // _di_f_color_context_destroy_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_color/c/color.c b/level_0/f_color/c/color.c index 8ddc43c..34eea15 100644 --- a/level_0/f_color/c/color.c +++ b/level_0/f_color/c/color.c @@ -12,7 +12,7 @@ extern "C" { // Switch to the appropriate terminal color mode. { - char *environment = getenv("TERM"); + char *environment = getenv("TERM"); // @todo make these strings static! if (!environment || strncmp(environment, "linux", 6) == 0) { macro_f_color_t_set_linux(context->list); diff --git a/level_0/f_color/data/build/settings-tests b/level_0/f_color/data/build/settings-tests index e5c1f03..b012d56 100644 --- a/level_0/f_color/data/build/settings-tests +++ b/level_0/f_color/data/build/settings-tests @@ -19,7 +19,7 @@ build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_string -lf_color build_libraries-level -lfll_0 build_libraries-monolithic -lfll -build_sources_program test-color-load_context.c test-color-save_1.c test-color-save_2.c test-color-save_3.c test-color-save_4.c test-color-save_5.c test-color.c +build_sources_program test-color-context_delete.c test-color-context_destroy.c test-color-load_context.c test-color-save_1.c test-color-save_2.c test-color-save_3.c test-color-save_4.c test-color-save_5.c test-color.c build_script no build_shared yes build_static no diff --git a/level_0/f_color/tests/c/test-color-context_delete.c b/level_0/f_color/tests/c/test-color-context_delete.c new file mode 100644 index 0000000..e9ef3bb --- /dev/null +++ b/level_0/f_color/tests/c/test-color-context_delete.c @@ -0,0 +1,124 @@ +#include "test-color.h" +#include "test-color-context_delete.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_color_context_delete__frees_memory(void **state) { + + const f_array_length_t size = 3; + + f_color_context_t context = f_color_context_t_initialize; + + { + const f_status_t status = f_string_dynamic_resize(size, &context.reset); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.reset.size, 0); + assert_non_null(context.reset.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.warning); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.warning.size, 0); + assert_non_null(context.warning.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.error); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.error.size, 0); + assert_non_null(context.error.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.title); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.title.size, 0); + assert_non_null(context.title.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.notable); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.notable.size, 0); + assert_non_null(context.notable.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.important); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.important.size, 0); + assert_non_null(context.important.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.standout); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.standout.size, 0); + assert_non_null(context.standout.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.success); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.success.size, 0); + assert_non_null(context.success.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.normal); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.normal.size, 0); + assert_non_null(context.normal.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.normal_reset); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.normal_reset.size, 0); + assert_non_null(context.normal_reset.string); + } + + { + const f_status_t status = f_color_context_delete(&context); + + assert_int_equal(status, F_none); + assert_int_equal(context.reset.size, 0); + assert_int_equal(context.warning.size, 0); + assert_int_equal(context.error.size, 0); + assert_int_equal(context.title.size, 0); + assert_int_equal(context.notable.size, 0); + assert_int_equal(context.important.size, 0); + assert_int_equal(context.standout.size, 0); + assert_int_equal(context.success.size, 0); + assert_int_equal(context.normal.size, 0); + assert_int_equal(context.normal_reset.size, 0); + } +} + +#ifndef _di_level_0_parameter_checking_ + void test__f_color_context_delete__parameter_checking(void **state) { + + { + const f_status_t status = f_color_context_delete(0); + + assert_int_equal(F_status_set_fine(status), F_parameter); + } + } +#endif // _di_level_0_parameter_checking_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_color/tests/c/test-color-context_delete.h b/level_0/f_color/tests/c/test-color-context_delete.h new file mode 100644 index 0000000..4355f72 --- /dev/null +++ b/level_0/f_color/tests/c/test-color-context_delete.h @@ -0,0 +1,29 @@ +/** + * FLL - Level 0 + * + * Project: Color + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the color project. + */ +#ifndef _TEST__F_color__delete +#define _TEST__F_color__delete + +/** + * Test that deallocation works. + * + * @see f_color_context_delete() + */ +extern void test__f_color_context_delete__frees_memory(void **state); + +/** + * Test that parameter checking works as expected. + * + * @see f_color_context_delete() + */ +#ifndef _di_level_0_parameter_checking_ + extern void test__f_color_context_delete__parameter_checking(void **state); +#endif // _di_level_0_parameter_checking_ + +#endif // _TEST__F_color__delete diff --git a/level_0/f_color/tests/c/test-color-context_destroy.c b/level_0/f_color/tests/c/test-color-context_destroy.c new file mode 100644 index 0000000..ab0572d --- /dev/null +++ b/level_0/f_color/tests/c/test-color-context_destroy.c @@ -0,0 +1,124 @@ +#include "test-color.h" +#include "test-color-context_destroy.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_color_context_destroy__frees_memory(void **state) { + + const f_array_length_t size = 3; + + f_color_context_t context = f_color_context_t_initialize; + + { + const f_status_t status = f_string_dynamic_resize(size, &context.reset); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.reset.size, 0); + assert_non_null(context.reset.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.warning); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.warning.size, 0); + assert_non_null(context.warning.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.error); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.error.size, 0); + assert_non_null(context.error.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.title); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.title.size, 0); + assert_non_null(context.title.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.notable); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.notable.size, 0); + assert_non_null(context.notable.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.important); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.important.size, 0); + assert_non_null(context.important.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.standout); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.standout.size, 0); + assert_non_null(context.standout.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.success); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.success.size, 0); + assert_non_null(context.success.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.normal); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.normal.size, 0); + assert_non_null(context.normal.string); + } + + { + const f_status_t status = f_string_dynamic_resize(size, &context.normal_reset); + + assert_int_equal(status, F_none); + assert_int_not_equal(context.normal_reset.size, 0); + assert_non_null(context.normal_reset.string); + } + + { + const f_status_t status = f_color_context_destroy(&context); + + assert_int_equal(status, F_none); + assert_int_equal(context.reset.size, 0); + assert_int_equal(context.warning.size, 0); + assert_int_equal(context.error.size, 0); + assert_int_equal(context.title.size, 0); + assert_int_equal(context.notable.size, 0); + assert_int_equal(context.important.size, 0); + assert_int_equal(context.standout.size, 0); + assert_int_equal(context.success.size, 0); + assert_int_equal(context.normal.size, 0); + assert_int_equal(context.normal_reset.size, 0); + } +} + +#ifndef _di_level_0_parameter_checking_ + void test__f_color_context_destroy__parameter_checking(void **state) { + + { + const f_status_t status = f_color_context_destroy(0); + + assert_int_equal(F_status_set_fine(status), F_parameter); + } + } +#endif // _di_level_0_parameter_checking_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_color/tests/c/test-color-context_destroy.h b/level_0/f_color/tests/c/test-color-context_destroy.h new file mode 100644 index 0000000..a5cabbf --- /dev/null +++ b/level_0/f_color/tests/c/test-color-context_destroy.h @@ -0,0 +1,29 @@ +/** + * FLL - Level 0 + * + * Project: Color + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the color project. + */ +#ifndef _TEST__F_color__destroy +#define _TEST__F_color__destroy + +/** + * Test that deallocation works. + * + * @see f_color_context_destroy() + */ +extern void test__f_color_context_destroy__frees_memory(void **state); + +/** + * Test that parameter checking works as expected. + * + * @see f_color_context_destroy() + */ +#ifndef _di_level_0_parameter_checking_ + extern void test__f_color_context_destroy__parameter_checking(void **state); +#endif // _di_level_0_parameter_checking_ + +#endif // _TEST__F_color__destroy diff --git a/level_0/f_color/tests/c/test-color.c b/level_0/f_color/tests/c/test-color.c index 3eb6d5d..b3c70b3 100644 --- a/level_0/f_color/tests/c/test-color.c +++ b/level_0/f_color/tests/c/test-color.c @@ -38,6 +38,10 @@ int main(void) { // f_color_save_5() only returns failures by other functions that have their own tests. cmocka_unit_test(test__f_color_save_5_works), + cmocka_unit_test(test__f_color_context_delete__frees_memory), + + cmocka_unit_test(test__f_color_context_destroy__frees_memory), + #ifndef _di_level_0_parameter_checking_ cmocka_unit_test(test__f_color_load_context__parameter_checking), cmocka_unit_test(test__f_color_save_1_parameter_checking), @@ -45,6 +49,8 @@ int main(void) { cmocka_unit_test(test__f_color_save_3_parameter_checking), cmocka_unit_test(test__f_color_save_4_parameter_checking), cmocka_unit_test(test__f_color_save_5_parameter_checking), + cmocka_unit_test(test__f_color_context_delete__parameter_checking), + cmocka_unit_test(test__f_color_context_destroy__parameter_checking), #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_color/tests/c/test-color.h b/level_0/f_color/tests/c/test-color.h index 9d4e312..865daa5 100644 --- a/level_0/f_color/tests/c/test-color.h +++ b/level_0/f_color/tests/c/test-color.h @@ -32,6 +32,8 @@ #include "test-color-save_3.h" #include "test-color-save_4.h" #include "test-color-save_5.h" +#include "test-color-context_delete.h" +#include "test-color-context_destroy.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_console/c/console-common.c b/level_0/f_console/c/console-common.c index 2cc4947..f53d98a 100644 --- a/level_0/f_console/c/console-common.c +++ b/level_0/f_console/c/console-common.c @@ -58,7 +58,13 @@ extern "C" { if (F_status_is_error(status)) return status; } // for - return f_string_dynamics_resize(0, ¶meters->arguments); + status = f_string_dynamics_resize(0, ¶meters->arguments); + if (F_status_is_error(status)) return status; + + status = f_type_array_lengths_resize(0, ¶meters->remaining); + if (F_status_is_error(status)) return status; + + return F_none; } #endif // _di_f_console_parameters_delete_ @@ -82,7 +88,13 @@ extern "C" { if (F_status_is_error(status)) return status; } // for - return f_string_dynamics_adjust(0, ¶meters->arguments); + status = f_string_dynamics_adjust(0, ¶meters->arguments); + if (F_status_is_error(status)) return status; + + status = f_type_array_lengths_adjust(0, ¶meters->remaining); + if (F_status_is_error(status)) return status; + + return F_none; } #endif // _di_f_console_parameters_destroy_ diff --git a/level_0/f_console/c/console-common.h b/level_0/f_console/c/console-common.h index 5a1f8bd..29fc25a 100644 --- a/level_0/f_console/c/console-common.h +++ b/level_0/f_console/c/console-common.h @@ -330,6 +330,7 @@ extern "C" { * * array: Intended to be populated with an array of f_console_parameter_t whose size is defined by the "used" property. * arguments: An array of arguments pointing to the argv[] strings with the string lengths already calculated (This is a dynamic array of f_string_static_t). + * remaining: An array of indexes within the arguments representing unmatched parameters. * length: The total number of parameters in the parameters array. */ #ifndef _di_f_console_parameters_t_ @@ -337,13 +338,14 @@ extern "C" { f_console_parameter_t *array; f_string_dynamics_t arguments; + f_array_lengths_t remaining; f_array_length_t used; } f_console_parameters_t; - #define f_console_parameters_t_initialize {0, f_string_dynamics_t_initialize, 0 } + #define f_console_parameters_t_initialize {0, f_string_dynamics_t_initialize, f_array_lengths_t_initialize, 0 } - #define macro_f_console_parameters_t_initialize(parameter, used) { parameter, f_string_dynamics_t_initialize, used } + #define macro_f_console_parameters_t_initialize(parameter, used) { parameter, f_string_dynamics_t_initialize, f_array_lengths_t_initialize, used } #endif // _di_f_console_parameters_t_ /** diff --git a/level_0/f_console/c/console.c b/level_0/f_console/c/console.c index 84915bc..1393ea4 100644 --- a/level_0/f_console/c/console.c +++ b/level_0/f_console/c/console.c @@ -153,9 +153,9 @@ extern "C" { #endif // _di_f_console_parameter_prioritize_right_ #ifndef _di_f_console_parameter_process_ - f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, f_array_lengths_t *remaining) { + f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters) { #ifndef _di_level_0_parameter_checking_ - if (!remaining) return F_status_set_error(F_parameter); + if (!parameters) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -388,12 +388,10 @@ extern "C" { if (!found) { // Populate list of remaining parameters->array that are not associated with anything. - if (remaining->used == remaining->size) { - status = f_type_array_lengths_increase(F_memory_default_allocation_small_d, remaining); - if (F_status_is_error(status)) break; - } + status = f_type_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->remaining); + if (F_status_is_error(status)) break; - remaining->array[remaining->used++] = location; + parameters->remaining.array[parameters->remaining.used++] = location; } ++location; diff --git a/level_0/f_console/c/console.h b/level_0/f_console/c/console.h index 9bb6b9e..f8e0dc0 100644 --- a/level_0/f_console/c/console.h +++ b/level_0/f_console/c/console.h @@ -6,9 +6,6 @@ * Licenses: lgpl-2.1-or-later * * Some console input/output commands. - * - * @todo It may be a good idea to provide a standard parameter process process disable sequence. - * This does not yet exist, so "--help" would always be a parameter, but would if there was something like "-/ --help" where this help does not designate the help option? */ #ifndef _F_console_h #define _F_console_h @@ -136,8 +133,6 @@ extern "C" { * The parameters passed to the process. * @param parameters * The console parameters to look for. - * @param remaining - * A list of remaining parameters not associated with anything. * * @return * F_none on success. @@ -153,7 +148,7 @@ extern "C" { * @see f_string_dynamics_increase_by() */ #ifndef _di_f_console_parameter_process_ - extern f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, f_array_lengths_t *remaining); + extern f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters); #endif // _di_f_console_parameter_process_ #ifdef __cplusplus diff --git a/level_0/f_console/tests/c/test-console-parameter_process.c b/level_0/f_console/tests/c/test-console-parameter_process.c index 200c317..08c706e 100644 --- a/level_0/f_console/tests/c/test-console-parameter_process.c +++ b/level_0/f_console/tests/c/test-console-parameter_process.c @@ -27,10 +27,9 @@ void test__f_console_parameter_process__no_arguments(void **state) { }; f_console_parameters_t parameters = macro_f_console_parameters_t_initialize(parameter, 9); - f_array_lengths_t remaining = f_array_lengths_t_initialize; { - const f_status_t status = f_console_parameter_process(arguments, ¶meters, &remaining); + const f_status_t status = f_console_parameter_process(arguments, ¶meters); assert_int_equal(status, F_none); @@ -88,10 +87,10 @@ void test__f_console_parameter_process__no_arguments(void **state) { assert_int_equal(parameter[8].location, 0); assert_int_equal(parameter[8].location_sub, 0); - assert_int_equal(remaining.used, 0); + assert_int_equal(parameters.remaining.used, 0); } - f_type_array_lengths_resize(0, &remaining); + f_console_parameters_delete(¶meters); } void test__f_console_parameter_process__only_remaining(void **state) { @@ -122,10 +121,9 @@ void test__f_console_parameter_process__only_remaining(void **state) { }; f_console_parameters_t parameters = macro_f_console_parameters_t_initialize(parameter, 9); - f_array_lengths_t remaining = f_array_lengths_t_initialize; { - const f_status_t status = f_console_parameter_process(arguments, ¶meters, &remaining); + const f_status_t status = f_console_parameter_process(arguments, ¶meters); assert_int_equal(status, F_none); @@ -183,20 +181,19 @@ void test__f_console_parameter_process__only_remaining(void **state) { assert_int_equal(parameter[8].location, 0); assert_int_equal(parameter[8].location_sub, 0); - assert_int_equal(remaining.used, 6); + assert_int_equal(parameters.remaining.used, 6); } - f_type_array_lengths_resize(0, &remaining); + f_console_parameters_delete(¶meters); } #ifndef _di_level_0_parameter_checking_ void test__f_console_parameter_process__parameter_checking(void **state) { const f_console_arguments_t arguments = f_console_arguments_t_initialize; - f_console_parameters_t parameters = f_console_parameters_t_initialize; { - const f_status_t status = f_console_parameter_process(arguments, ¶meters, 0); + const f_status_t status = f_console_parameter_process(arguments, 0); assert_int_equal(F_status_set_fine(status), F_parameter); } @@ -242,10 +239,9 @@ void test__f_console_parameter_process__works(void **state) { }; f_console_parameters_t parameters = macro_f_console_parameters_t_initialize(parameter, 9); - f_array_lengths_t remaining = f_array_lengths_t_initialize; { - const f_status_t status = f_console_parameter_process(arguments, ¶meters, &remaining); + const f_status_t status = f_console_parameter_process(arguments, ¶meters); assert_int_equal(status, F_none); @@ -319,12 +315,12 @@ void test__f_console_parameter_process__works(void **state) { assert_int_equal(parameter[8].locations.array[0], 6); assert_int_equal(parameter[8].locations.array[1], 15); - assert_int_equal(remaining.used, 2); - assert_string_equal(argv[remaining.array[0]], "free"); - assert_string_equal(argv[remaining.array[1]], "-4"); + assert_int_equal(parameters.remaining.used, 2); + assert_string_equal(argv[parameters.remaining.array[0]], "free"); + assert_string_equal(argv[parameters.remaining.array[1]], "-4"); } - f_type_array_lengths_resize(0, &remaining); + f_console_parameters_delete(¶meters); } #ifdef __cplusplus diff --git a/level_2/fll_program/c/program-common.c b/level_2/fll_program/c/program-common.c new file mode 100644 index 0000000..c67b6db --- /dev/null +++ b/level_2/fll_program/c/program-common.c @@ -0,0 +1,50 @@ +#include "program.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fll_program_parameters_ + const f_string_static_t fll_program_parameter_filename_s = macro_f_string_static_t_initialize(FLL_program_parameter_filename_s, 0, FLL_program_parameter_filename_s_length); + const f_string_static_t fll_program_parameter_filenames_s = macro_f_string_static_t_initialize(FLL_program_parameter_filenames_s, 0, FLL_program_parameter_filenames_s_length); +#endif // _di_fll_program_parameters_ + +#ifndef _di_fll_program_data_delete_ + f_status_t fll_program_data_delete(fll_program_data_t * const data) { + #ifndef _di_level_2_parameters_checking_ + if (!data) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameters_checking_ + + f_status_t status = F_none; + + status = f_console_parameters_delete(&data->parameters); + if (F_status_is_error(status)) return status; + + status = f_color_context_delete(&data->context); + if (F_status_is_error(status)) return status; + + return F_none; + } +#endif // _di_fll_program_data_delete_ + +#ifndef _di_fll_program_data_destroy_ + f_status_t fll_program_data_destroy(fll_program_data_t * const data) { + #ifndef _di_level_2_parameters_checking_ + if (!data) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameters_checking_ + + f_status_t status = F_none; + + status = f_console_parameters_destroy(&data->parameters); + if (F_status_is_error(status)) return status; + + status = f_color_context_destroy(&data->context); + if (F_status_is_error(status)) return status; + + return F_none; + } +#endif // _di_fll_program_data_destroy_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_2/fll_program/c/program-common.h b/level_2/fll_program/c/program-common.h new file mode 100644 index 0000000..2856780 --- /dev/null +++ b/level_2/fll_program/c/program-common.h @@ -0,0 +1,115 @@ +/** + * FLL - Level 2 + * + * Project: Program + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines common data to be used for/by project program. + * + * This is auto-included by program.h and should not need to be explicitly included. + */ +#ifndef _FLL_program_common_h +#define _FLL_program_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fll_program_parameters_ + #define FLL_program_parameter_filename_s "filename" + #define FLL_program_parameter_filenames_s "filename(s)" + + #define FLL_program_parameter_filename_s_length 8 + #define FLL_program_parameter_filenames_s_length 11 + + extern const f_string_static_t fll_program_parameter_filename_s; + extern const f_string_static_t fll_program_parameter_filenames_s; +#endif // _di_fll_program_parameters_ + +/** + * A common program structure to be used by simple programs needing no special structure. + * + * Complex programs or programs that need more data passed via the main should implement their own version of this. + * + * parameters: The state of pre-defined parameters passed to the program. + * process_pipe: Designate whether or not to process the input pipe. + * output: The output file for general printing. + * error: The output file for error printing. + * warning: The output file for warning printing. + * signal: The process signal management structure. + * signal_check: A counter used to map to for reducing the amount of actual signal check calls. + * context: The color context. + */ +#ifndef _di_fll_program_data_t_ + typedef struct { + f_console_parameters_t parameters; + + uint16_t signal_check; + bool process_pipe; + + fl_print_t output; + fl_print_t error; + fl_print_t warning; + + f_signal_t signal; + + f_color_context_t context; + } fll_program_data_t; + + #define fll_program_data_t_initialize \ + { \ + f_console_parameters_t_initialize, \ + 0, \ + 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_fll_program_data_t_ + +/** + * Delete any dynamic allocated data on the program data object. + * + * @param data + * The program data object. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_console_parameters_delete(). + * + * @see f_console_parameters_delete() + */ +#ifndef _di_fll_program_data_delete_ + extern f_status_t fll_program_data_delete(fll_program_data_t * const data); +#endif // _di_fll_program_data_delete_ + +/** + * Destroy any dynamic allocated data on the program data object. + * + * @param data + * The program data object. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_console_parameters_destroy(). + * + * @see f_console_parameters_destroy() + */ +#ifndef _di_fll_program_data_destroy_ + extern f_status_t fll_program_data_destroy(fll_program_data_t * const data); +#endif // _di_fll_program_data_destroy_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _FLL_program_common_h diff --git a/level_2/fll_program/c/program.c b/level_2/fll_program/c/program.c index 82d72b2..bd5fc68 100644 --- a/level_2/fll_program/c/program.c +++ b/level_2/fll_program/c/program.c @@ -69,11 +69,11 @@ extern "C" { #endif // _di_fll_program_print_version_ #ifndef _di_fll_program_parameter_process_ - f_status_t fll_program_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, const f_console_parameter_ids_t choices, const bool right, f_array_lengths_t *remaining, f_color_context_t *context) { + f_status_t fll_program_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, const f_console_parameter_ids_t choices, const bool right, f_color_context_t *context) { f_status_t status = F_none; - status = f_console_parameter_process(arguments, parameters, remaining); + status = f_console_parameter_process(arguments, parameters); if (F_status_is_error(status)) return status; f_console_parameter_id_t decision = choices.id[2]; diff --git a/level_2/fll_program/c/program.h b/level_2/fll_program/c/program.h index cda3f19..d2cd575 100644 --- a/level_2/fll_program/c/program.h +++ b/level_2/fll_program/c/program.h @@ -29,6 +29,9 @@ #include #include +// fll-2 program includes +#include + #ifdef __cplusplus extern "C" { #endif @@ -193,8 +196,6 @@ extern "C" { * This must have its used size set to 3 and the ids are expected to be in this order: no_color, light, and dark. * @param right * Set to TRUE for right priortization and FALSE for left prioritization. - * @param remaining - * A list of remaining parameters not associated with anything. * @param context * The color context. * @@ -216,7 +217,7 @@ extern "C" { * @see f_color_load_context() */ #ifndef _di_fll_program_parameter_process_ - extern f_status_t fll_program_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, const f_console_parameter_ids_t choices, const bool right, f_array_lengths_t *remaining, f_color_context_t *context); + extern f_status_t fll_program_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, const f_console_parameter_ids_t choices, const bool right, f_color_context_t *context); #endif // _di_fll_program_parameter_process_ /** diff --git a/level_2/fll_program/data/build/settings b/level_2/fll_program/data/build/settings index 4af4155..b005f03 100644 --- a/level_2/fll_program/data/build/settings +++ b/level_2/fll_program/data/build/settings @@ -24,13 +24,13 @@ build_libraries -lc 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 +build_sources_library program.c program-common.c build_sources_library_shared build_sources_library_static build_sources_program build_sources_program_shared build_sources_program_static -build_sources_headers program.h +build_sources_headers program.h program-common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index c116b5c..e0aae3e 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -54,7 +54,7 @@ extern "C" { 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, byte_dump_program_help_parameters_s); + fll_program_print_help_usage(file, context, byte_dump_program_name_s, fll_program_parameter_filenames_s); fl_print_format(" When using the %[%r%r%] option, some UTF-8 characters may be replaced by your instance and cause display alignment issues.%r%r", 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); @@ -87,7 +87,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { byte_dump_parameter_no_color_e, byte_dump_parameter_light_e, byte_dump_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -262,7 +262,7 @@ extern "C" { return F_none; } - if (main->remaining.used || main->process_pipe) { + if (main->parameters.remaining.used || main->process_pipe) { if (main->parameters.array[byte_dump_parameter_width_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); @@ -461,15 +461,15 @@ extern "C" { } } - if (main->remaining.used > 0) { + if (main->parameters.remaining.used > 0) { // Pre-process remaining arguments to ensure that they all files exist before processing. { f_status_t missing_files = F_none; - for (f_array_length_t counter = 0; counter < main->remaining.used; ++counter) { + for (f_array_length_t counter = 0; counter < main->parameters.remaining.used; ++counter) { - status = f_file_exists(argv[main->remaining.array[counter]]); + status = f_file_exists(argv[main->parameters.remaining.array[counter]]); if (status == F_false) { status = F_status_set_error(F_file_found_not); @@ -480,7 +480,7 @@ extern "C" { missing_files = status; } - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_exists", F_true, argv[main->remaining.array[counter]], f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_exists", F_true, argv[main->parameters.remaining.array[counter]], f_file_operation_open_s, fll_error_file_type_file_e); } } // for @@ -495,12 +495,12 @@ extern "C" { f_file_t file = f_file_t_initialize; - for (f_array_length_t counter = 0; counter < main->remaining.used; ++counter) { + for (f_array_length_t counter = 0; counter < main->parameters.remaining.used; ++counter) { - status = f_file_stream_open(argv[main->remaining.array[counter]], f_string_empty_s, &file); + status = f_file_stream_open(argv[main->parameters.remaining.array[counter]], f_string_empty_s, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, argv[main->remaining.array[counter]], f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, argv[main->parameters.remaining.array[counter]], f_file_operation_open_s, fll_error_file_type_file_e); byte_dump_main_delete(main); @@ -510,7 +510,7 @@ extern "C" { flockfile(main->output.to.stream); fl_print_format("%r%[Byte Dump of: %]%[", main->output.to.stream, f_string_eol_s, main->context.set.title, main->context.set.title, main->context.set.notable); - fl_print_format("%Q%] %[(in ", main->output.to.stream, argv[main->remaining.array[counter]], main->context.set.notable, main->context.set.title); + fl_print_format("%Q%] %[(in ", main->output.to.stream, argv[main->parameters.remaining.array[counter]], main->context.set.notable, main->context.set.title); if (main->mode == byte_dump_mode_hexidecimal_e) { f_print_dynamic_raw(byte_dump_print_strings_hexidecimal_s, main->output.to.stream); @@ -532,7 +532,7 @@ extern "C" { funlockfile(main->output.to.stream); - status = byte_dump_file(main, argv[main->remaining.array[counter]], file); + status = byte_dump_file(main, argv[main->parameters.remaining.array[counter]], file); f_file_stream_close(F_true, &file); @@ -548,7 +548,7 @@ extern "C" { } else { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_error_file_print(main->error, F_status_set_fine(status), "byte_dump_file", F_true, argv[main->remaining.array[counter]], f_file_operation_process_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "byte_dump_file", F_true, argv[main->parameters.remaining.array[counter]], f_file_operation_process_s, fll_error_file_type_file_e); } } diff --git a/level_3/byte_dump/c/common.c b/level_3/byte_dump/c/common.c index 98661a9..ce344ba 100644 --- a/level_3/byte_dump/c/common.c +++ b/level_3/byte_dump/c/common.c @@ -14,10 +14,6 @@ extern "C" { const f_string_static_t byte_dump_program_name_long_s = macro_f_string_static_t_initialize(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_initialize(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_print_strings_ const f_string_static_t byte_dump_print_strings_hexidecimal_s = macro_f_string_static_t_initialize(BYTE_DUMP_print_strings_hexidecimal_s, 0, BYTE_DUMP_print_strings_hexidecimal_s_length); const f_string_static_t byte_dump_print_strings_duodecimal_s = macro_f_string_static_t_initialize(BYTE_DUMP_print_strings_duodecimal_s, 0, BYTE_DUMP_print_strings_duodecimal_s_length); @@ -31,7 +27,9 @@ extern "C" { const f_string_static_t byte_dump_character_placeholder_s = macro_f_string_static_t_initialize(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_initialize(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_initialize(BYTE_DUMP_character_unused_s, 0, BYTE_DUMP_character_unused_s_length); +#endif // _di_byte_dump_defines_ +#ifndef _di_byte_dump_parameters_ const f_string_static_t byte_dump_short_binary_s = macro_f_string_static_t_initialize(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_initialize(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_initialize(BYTE_DUMP_short_duodecimal_s, 0, BYTE_DUMP_short_duodecimal_s_length); @@ -67,15 +65,13 @@ extern "C" { const f_string_static_t byte_dump_long_normal_s = macro_f_string_static_t_initialize(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_initialize(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_initialize(BYTE_DUMP_long_classic_s, 0, BYTE_DUMP_long_classic_s_length); -#endif // _di_byte_dump_defines_ +#endif // _di_byte_dump_parameters_ #ifndef _di_byte_dump_main_delete_ f_status_t byte_dump_main_delete(byte_dump_main_t * const main) { f_console_parameters_delete(&main->parameters); - 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) diff --git a/level_3/byte_dump/c/common.h b/level_3/byte_dump/c/common.h index 522f725..0edce15 100644 --- a/level_3/byte_dump/c/common.h +++ b/level_3/byte_dump/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t byte_dump_program_version_s; #endif // _di_byte_dump_program_version_ +/** + * The program name. + */ #ifndef _di_byte_dump_program_name_ #define BYTE_DUMP_program_name_s "byte_dump" #define BYTE_DUMP_program_name_long_s "Byte Dump" @@ -53,13 +59,9 @@ extern "C" { 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_ - +/** + * The program strings for printing. + */ #ifndef _di_byte_dump_print_strings_ #define BYTE_DUMP_print_strings_hexidecimal_s "Hexidecimal" #define BYTE_DUMP_print_strings_duodecimal_s "Duodecimal" @@ -88,7 +90,7 @@ extern "C" { #endif // _di_byte_dump_default_allocation_step_ /** - * Byte Dump defines. + * The program defines. * * byte_dump_mode_*: * - hexidecimal: Display using hexidecimal notation (base 16). @@ -126,6 +128,42 @@ extern "C" { #define BYTE_DUMP_character_incomplete_s "�" #define BYTE_DUMP_character_unused_s "�" + #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 + + 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; +#endif // _di_byte_dump_defines_ + +/** + * The program parameters. + * + * byte_dump_long_*: + * - first: First offset byte size. + * - last: Last offset byte size. + * + * - narrow: Each character in the displyed text will take at least 1 columns. + * - placeholder: Display (colored) placeholders to signify codes that are UTF-8 fragments. + * - text: Display text + * - wide: Each character in the displyed text will take at least 2 columns. + * - width: Number of characters to display per row. + * + * - binary: Display using binary format. + * - decimal: Display using decimal format. + * - duodecimal: Display using duodecimal format. + * - hexidecimal: Display using hexidecimal format. + * - octal: Display using octal format. + * - unicode: Display using Unicode format. + * + * - normal: Use normal presentation, displaying UTF-8 sequence codes for ASCII special codes. + * - simple: Use simple presentation, displaying spaces for ASCII special codes instead of UTF-8 sequence codes. + * - classic: Use classic presentation, displaying periods for ASCII special codes instead of UTF-8 sequence codes. + */ +#ifndef _di_byte_dump_parameters_ #define BYTE_DUMP_short_binary_s "b" #define BYTE_DUMP_short_decimal_s "d" #define BYTE_DUMP_short_duodecimal_s "D" @@ -149,23 +187,18 @@ extern "C" { #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_first_s "first" + #define BYTE_DUMP_long_last_s "last" - #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_narrow_s "narrow" + #define BYTE_DUMP_long_placeholder_s "placeholder" + #define BYTE_DUMP_long_text_s "text" + #define BYTE_DUMP_long_wide_s "wide" + #define BYTE_DUMP_long_width_s "width" - #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_long_normal_s "normal" + #define BYTE_DUMP_long_simple_s "simple" + #define BYTE_DUMP_long_classic_s "classic" #define BYTE_DUMP_short_binary_s_length 1 #define BYTE_DUMP_short_decimal_s_length 1 @@ -203,11 +236,6 @@ extern "C" { #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; @@ -306,13 +334,25 @@ extern "C" { } #define byte_dump_total_parameters_d 25 -#endif // _di_byte_dump_defines_ +#endif // _di_byte_dump_parameters_ +/** + * The main program data. + * + * parameters: The state of pre-defined parameters passed to the program. + * process_pipe: Designate whether or not to process the input pipe. + * output: The output file for general printing. + * error: The output file for error printing. + * warning: The output file for warning printing. + * signal: The process signal management structure. + * context: The color context. + * + * @todo + */ #ifndef _di_byte_dump_main_t_ typedef struct { f_console_parameters_t parameters; - f_array_lengths_t remaining; bool process_pipe; fl_print_t output; @@ -334,7 +374,6 @@ extern "C" { #define byte_dump_main_t_initialize \ { \ f_console_parameters_t_initialize, \ - f_array_lengths_t_initialize, \ F_false, \ fl_print_t_initialize, \ macro_fl_print_t_initialize_error(), \ diff --git a/level_3/control/c/common.c b/level_3/control/c/common.c index f2b5269..4109b47 100644 --- a/level_3/control/c/common.c +++ b/level_3/control/c/common.c @@ -13,7 +13,7 @@ extern "C" { const f_string_static_t control_program_name_long_s = macro_f_string_static_t_initialize(CONTROL_program_name_long_s, 0, CONTROL_program_name_long_s_length); #endif // _di_control_program_name_ -#ifndef _di_control_defines_ +#ifndef _di_control_parameters_ const f_string_static_t control_short_name_s = macro_f_string_static_t_initialize(CONTROL_short_name_s, 0, CONTROL_short_name_s_length); const f_string_static_t control_short_settings_s = macro_f_string_static_t_initialize(CONTROL_short_settings_s, 0, CONTROL_short_settings_s_length); const f_string_static_t control_short_socket_s = macro_f_string_static_t_initialize(CONTROL_short_socket_s, 0, CONTROL_short_socket_s_length); @@ -21,18 +21,12 @@ extern "C" { const f_string_static_t control_long_name_s = macro_f_string_static_t_initialize(CONTROL_long_name_s, 0, CONTROL_long_name_s_length); const f_string_static_t control_long_settings_s = macro_f_string_static_t_initialize(CONTROL_long_settings_s, 0, CONTROL_long_settings_s_length); const f_string_static_t control_long_socket_s = macro_f_string_static_t_initialize(CONTROL_long_socket_s, 0, CONTROL_long_socket_s_length); -#endif // _di_control_defines_ +#endif // _di_control_parameters_ #ifndef _di_control_main_delete_ - f_status_t control_main_delete(control_main_t * const main) { + f_status_t control_main_delete(fll_program_data_t * const main) { - f_console_parameters_delete(&main->parameters); - - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); - - return F_none; + return fll_program_data_delete(main); } #endif // _di_control_main_delete_ diff --git a/level_3/control/c/common.h b/level_3/control/c/common.h index 5bef205..a951fc8 100644 --- a/level_3/control/c/common.h +++ b/level_3/control/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t control_program_version_s; #endif // _di_control_program_version_ +/** + * The program name. + */ #ifndef _di_control_program_name_ #define CONTROL_program_name_s "control" #define CONTROL_program_name_long_s "Control Program" @@ -53,7 +59,10 @@ extern "C" { extern const f_string_static_t control_program_name_long_s; #endif // _di_control_program_name_ -#ifndef _di_control_defines_ +/** + * The main program parameters. + */ +#ifndef _di_control_parameters_ #define CONTROL_short_name_s "n" #define CONTROL_short_settings_s "s" #define CONTROL_short_socket_s "k" @@ -111,39 +120,7 @@ extern "C" { } #define control_total_parameters_d 12 -#endif // _di_control_defines_ - -#ifndef _di_control_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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 \ - { \ - f_console_parameters_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_ +#endif // _di_control_parameters_ /** * Deallocate main. @@ -161,7 +138,7 @@ extern "C" { * @see control_main() */ #ifndef _di_control_main_delete_ - extern f_status_t control_main_delete(control_main_t * const main); + extern f_status_t control_main_delete(fll_program_data_t * const main); #endif // _di_control_main_delete_ #ifdef __cplusplus diff --git a/level_3/control/c/control.c b/level_3/control/c/control.c index ce3bd6e..7e6c8da 100644 --- a/level_3/control/c/control.c +++ b/level_3/control/c/control.c @@ -8,7 +8,7 @@ extern "C" { #endif #ifndef _di_control_print_help_ - f_status_t control_print_help(control_main_t * const main) { + f_status_t control_print_help(fll_program_data_t * const main) { flockfile(main->output.to.stream); @@ -47,7 +47,7 @@ extern "C" { #endif // _di_control_print_help_ #ifndef _di_control_main_ - f_status_t control_main(control_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t control_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -59,7 +59,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { control_parameter_no_color_e, control_parameter_light_e, control_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -187,16 +187,16 @@ extern "C" { status = F_status_set_error(F_supported_not); } - else if (main->remaining.used) { + else if (main->parameters.remaining.used) { control_data_t data = control_data_t_initialize; data.argv = main->parameters.arguments.array; // Verify commands before attempting to connect to the socket. - if (control_command_identify(main, &data, data.argv[main->remaining.array[0]]) == F_found) { + if (control_command_identify(main, &data, data.argv[main->parameters.remaining.array[0]]) == F_found) { status = control_command_verify(main, &data); } else { - control_print_error_parameter_command_not(main, data.argv[main->remaining.array[0]]); + control_print_error_parameter_command_not(main, data.argv[main->parameters.remaining.array[0]]); status = F_status_set_error(F_parameter); } diff --git a/level_3/control/c/control.h b/level_3/control/c/control.h index 7818e63..281594a 100644 --- a/level_3/control/c/control.h +++ b/level_3/control/c/control.h @@ -63,7 +63,7 @@ extern "C" { * @see control_main() */ #ifndef _di_control_print_help_ - extern f_status_t control_print_help(control_main_t * const main); + extern f_status_t control_print_help(fll_program_data_t * const main); #endif // _di_control_print_help_ /** @@ -94,7 +94,7 @@ extern "C" { * @see control_main_delete() */ #ifndef _di_control_main_ - extern f_status_t control_main(control_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t control_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_control_main_ #ifdef __cplusplus diff --git a/level_3/control/c/main.c b/level_3/control/c/main.c index 1375ecc..a439f5f 100644 --- a/level_3/control/c/main.c +++ b/level_3/control/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - control_main_t data = control_main_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/control/c/private-common.c b/level_3/control/c/private-common.c index 46e6f8a..295bedf 100644 --- a/level_3/control/c/private-common.c +++ b/level_3/control/c/private-common.c @@ -47,7 +47,7 @@ extern "C" { #endif // _di_control_data_delete_ #ifndef _di_control_signal_received_ - f_status_t control_signal_received(control_main_t * const main) { + f_status_t control_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; @@ -88,7 +88,7 @@ extern "C" { return F_interrupt_not; } - control_main_t * const main = (control_main_t *) state_ptr->custom; + fll_program_data_t * const main = (fll_program_data_t *) state_ptr->custom; if (!((++main->signal_check) % control_signal_check_d)) { if (control_signal_received(main)) { diff --git a/level_3/control/c/private-common.h b/level_3/control/c/private-common.h index f03e624..dcfea3a 100644 --- a/level_3/control/c/private-common.h +++ b/level_3/control/c/private-common.h @@ -239,7 +239,7 @@ extern "C" { * command: The command type code. * cache: A cache. * socket: A socket used to connect to the controller. - * argv: The argument structure in control_main_t.parameters for simplifying syntax. + * argv: The argument structure in fll_program_data_t.parameters for simplifying syntax. */ #ifndef _di_control_data_t_ typedef struct { @@ -286,7 +286,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_control_signal_received_ - extern f_status_t control_signal_received(control_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t control_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_control_signal_received_ /** diff --git a/level_3/control/c/private-control.c b/level_3/control/c/private-control.c index 5d2846a..eaa6e04 100644 --- a/level_3/control/c/private-control.c +++ b/level_3/control/c/private-control.c @@ -8,7 +8,7 @@ extern "C" { #endif #ifndef _di_control_command_identify_ - f_status_t control_command_identify(control_main_t * const main, control_data_t * const data, const f_string_static_t command) { + f_status_t control_command_identify(fll_program_data_t * const main, control_data_t * const data, const f_string_static_t command) { if (fl_string_dynamic_compare(command, control_freeze_s) == F_equal_to) { data->command = control_command_type_freeze_e; @@ -87,7 +87,7 @@ extern "C" { #endif // _di_control_command_identify_ #ifndef _di_control_command_verify_ - f_status_t control_command_verify(control_main_t * const main, control_data_t * const data) { + f_status_t control_command_verify(fll_program_data_t * const main, control_data_t * const data) { switch (data->command) { case control_command_type_freeze_e: @@ -100,31 +100,31 @@ extern "C" { case control_command_type_start_e: case control_command_type_stop_e: case control_command_type_thaw_e: - if (main->remaining.used < 2) { - control_print_error_parameter_command_rule_not(main, data->argv[main->remaining.array[0]]); + if (main->parameters.remaining.used < 2) { + control_print_error_parameter_command_rule_not(main, data->argv[main->parameters.remaining.array[0]]); return F_status_set_error(F_parameter); } - else if (main->remaining.used > 3) { - control_print_error_parameter_command_rule_too_many(main, data->argv[main->remaining.array[0]]); + else if (main->parameters.remaining.used > 3) { + control_print_error_parameter_command_rule_too_many(main, data->argv[main->parameters.remaining.array[0]]); return F_status_set_error(F_parameter); } - if (!data->argv[main->remaining.array[1]].used) { - if (main->remaining.used == 2) { - control_print_error_parameter_command_rule_empty(main, data->argv[main->remaining.array[0]]); + if (!data->argv[main->parameters.remaining.array[1]].used) { + if (main->parameters.remaining.used == 2) { + control_print_error_parameter_command_rule_empty(main, data->argv[main->parameters.remaining.array[0]]); } else { - control_print_error_parameter_command_rule_directory_empty(main, data->argv[main->remaining.array[0]]); + control_print_error_parameter_command_rule_directory_empty(main, data->argv[main->parameters.remaining.array[0]]); } return F_status_set_error(F_parameter); } - if (main->remaining.used == 3) { - if (!data->argv[main->remaining.array[2]].used) { - control_print_error_parameter_command_rule_basename_empty(main, data->argv[main->remaining.array[0]]); + if (main->parameters.remaining.used == 3) { + if (!data->argv[main->parameters.remaining.array[2]].used) { + control_print_error_parameter_command_rule_basename_empty(main, data->argv[main->parameters.remaining.array[0]]); return F_status_set_error(F_parameter); } @@ -146,7 +146,7 @@ extern "C" { #endif // _di_control_command_verify_ #ifndef _di_control_settings_load_ - f_status_t control_settings_load(control_main_t * const main, control_data_t * const data) { + f_status_t control_settings_load(fll_program_data_t * const main, control_data_t * const data) { f_status_t status = F_none; diff --git a/level_3/control/c/private-control.h b/level_3/control/c/private-control.h index 3481458..ef1cc97 100644 --- a/level_3/control/c/private-control.h +++ b/level_3/control/c/private-control.h @@ -28,7 +28,7 @@ extern "C" { * F_found_not if name is unknown. */ #ifndef _di_control_command_identify_ - extern f_status_t control_command_identify(control_main_t * const main, control_data_t * const data, const f_string_static_t command) F_attribute_visibility_internal_d; + extern f_status_t control_command_identify(fll_program_data_t * const main, control_data_t * const data, const f_string_static_t command) F_attribute_visibility_internal_d; #endif // _di_control_command_identify_ /** @@ -40,7 +40,7 @@ extern "C" { * The control data. */ #ifndef _di_control_command_verify_ - extern f_status_t control_command_verify(control_main_t * const main, control_data_t * const data) F_attribute_visibility_internal_d; + extern f_status_t control_command_verify(fll_program_data_t * const main, control_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_control_command_verify_ /** * Load and process the control settings file. @@ -87,7 +87,7 @@ extern "C" { * @see fll_fss_extended_read() */ #ifndef _di_control_settings_load_ - extern f_status_t control_settings_load(control_main_t * const main, control_data_t * const data) F_attribute_visibility_internal_d; + extern f_status_t control_settings_load(fll_program_data_t * const main, control_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_control_settings_load_ #ifdef __cplusplus diff --git a/level_3/control/c/private-print.c b/level_3/control/c/private-print.c index 69b7a9d..8288b99 100644 --- a/level_3/control/c/private-print.c +++ b/level_3/control/c/private-print.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_control_print_error_parameter_command_not_ - void control_print_error_parameter_command_not(control_main_t * const main, const f_string_static_t command) { + void control_print_error_parameter_command_not(fll_program_data_t * const main, const f_string_static_t command) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -22,7 +22,7 @@ extern "C" { #endif // _di_control_print_error_parameter_command_not_ #ifndef _di_control_print_error_parameter_command_rule_basename_empty_ - void control_print_error_parameter_command_rule_basename_empty(control_main_t * const main, const f_string_static_t command) { + void control_print_error_parameter_command_rule_basename_empty(fll_program_data_t * const main, const f_string_static_t command) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -37,7 +37,7 @@ extern "C" { #endif // _di_control_print_error_parameter_command_rule_basename_empty_ #ifndef _di_control_print_error_parameter_command_rule_directory_empty_ - void control_print_error_parameter_command_rule_directory_empty(control_main_t * const main, const f_string_static_t command) { + void control_print_error_parameter_command_rule_directory_empty(fll_program_data_t * const main, const f_string_static_t command) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -52,7 +52,7 @@ extern "C" { #endif // _di_control_print_error_parameter_command_rule_directory_empty_ #ifndef _di_control_print_error_parameter_command_rule_empty_ - void control_print_error_parameter_command_rule_empty(control_main_t * const main, const f_string_static_t command) { + void control_print_error_parameter_command_rule_empty(fll_program_data_t * const main, const f_string_static_t command) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -67,7 +67,7 @@ extern "C" { #endif // _di_control_print_error_parameter_command_rule_empty_ #ifndef _di_control_print_error_parameter_command_rule_not_ - void control_print_error_parameter_command_rule_not(control_main_t * const main, const f_string_static_t command) { + void control_print_error_parameter_command_rule_not(fll_program_data_t * const main, const f_string_static_t command) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -82,7 +82,7 @@ extern "C" { #endif // _di_control_print_error_parameter_command_rule_not_ #ifndef _di_control_print_error_parameter_command_rule_too_many_ - void control_print_error_parameter_command_rule_too_many(control_main_t * const main, const f_string_static_t command) { + void control_print_error_parameter_command_rule_too_many(fll_program_data_t * const main, const f_string_static_t command) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -97,7 +97,7 @@ extern "C" { #endif // _di_control_print_error_parameter_command_rule_too_many_ #ifndef _di_control_print_error_commands_none_ - void control_print_error_commands_none(control_main_t * const main) { + void control_print_error_commands_none(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -106,7 +106,7 @@ extern "C" { #endif // _di_control_print_error_commands_none_ #ifndef _di_control_print_error_parameter_value_empty_ - void control_print_error_parameter_value_empty(control_main_t * const main, const f_string_static_t parameter) { + void control_print_error_parameter_value_empty(fll_program_data_t * const main, const f_string_static_t parameter) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -121,7 +121,7 @@ extern "C" { #endif // _di_control_print_error_parameter_value_empty_ #ifndef _di_control_print_error_parameter_value_not_ - void control_print_error_parameter_value_not(control_main_t * const main, const f_string_static_t parameter) { + void control_print_error_parameter_value_not(fll_program_data_t * const main, const f_string_static_t parameter) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -136,7 +136,7 @@ extern "C" { #endif // _di_control_print_error_parameter_value_not_ #ifndef _di_control_print_error_pipe_supported_not_ - void control_print_error_pipe_supported_not(control_main_t * const main) { + void control_print_error_pipe_supported_not(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -145,7 +145,7 @@ extern "C" { #endif // _di_control_print_error_pipe_supported_not_ #ifndef _di_control_print_error_socket_file_failed_ - void control_print_error_socket_file_failed(control_main_t * const main, const f_string_static_t path_socket) { + void control_print_error_socket_file_failed(fll_program_data_t * const main, const f_string_static_t path_socket) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -160,7 +160,7 @@ extern "C" { #endif // _di_control_print_error_socket_file_failed_ #ifndef _di_control_print_error_socket_file_missing_ - void control_print_error_socket_file_missing(control_main_t * const main, const f_string_static_t path_socket) { + void control_print_error_socket_file_missing(fll_program_data_t * const main, const f_string_static_t path_socket) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -175,7 +175,7 @@ extern "C" { #endif // _di_control_print_error_socket_file_missing_ #ifndef _di_control_print_error_socket_file_not_ - void control_print_error_socket_file_not(control_main_t * const main, const f_string_static_t path_socket) { + void control_print_error_socket_file_not(fll_program_data_t * const main, const f_string_static_t path_socket) { if (main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -190,7 +190,7 @@ extern "C" { #endif // _di_control_print_error_socket_file_not_ #ifndef _di_control_print_signal_received_ - void control_print_signal_received(control_main_t * const main, const f_status_t signal) { + void control_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; diff --git a/level_3/control/c/private-print.h b/level_3/control/c/private-print.h index 24f435a..ddba1f4 100644 --- a/level_3/control/c/private-print.h +++ b/level_3/control/c/private-print.h @@ -21,7 +21,7 @@ extern "C" { * The parameter representing a command. */ #ifndef _di_control_print_error_parameter_command_not_ - extern void control_print_error_parameter_command_not(control_main_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; + extern void control_print_error_parameter_command_not(fll_program_data_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; #endif // _di_control_print_error_parameter_command_not_ /** @@ -33,7 +33,7 @@ extern "C" { * The parameter representing a command. */ #ifndef _di_control_print_error_parameter_command_rule_basename_empty_ - extern void control_print_error_parameter_command_rule_basename_empty(control_main_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; + extern void control_print_error_parameter_command_rule_basename_empty(fll_program_data_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; #endif // _di_control_print_error_parameter_command_rule_basename_empty_ /** @@ -45,7 +45,7 @@ extern "C" { * The parameter representing a command. */ #ifndef _di_control_print_error_parameter_command_rule_directory_empty_ - extern void control_print_error_parameter_command_rule_directory_empty(control_main_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; + extern void control_print_error_parameter_command_rule_directory_empty(fll_program_data_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; #endif // _di_control_print_error_parameter_command_rule_directory_empty_ /** @@ -57,7 +57,7 @@ extern "C" { * The parameter representing a command. */ #ifndef _di_control_print_error_parameter_command_rule_empty_ - extern void control_print_error_parameter_command_rule_empty(control_main_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; + extern void control_print_error_parameter_command_rule_empty(fll_program_data_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; #endif // _di_control_print_error_parameter_command_rule_empty_ /** @@ -69,7 +69,7 @@ extern "C" { * The parameter representing a command. */ #ifndef _di_control_print_error_parameter_command_rule_not_ - extern void control_print_error_parameter_command_rule_not(control_main_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; + extern void control_print_error_parameter_command_rule_not(fll_program_data_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; #endif // _di_control_print_error_parameter_command_rule_not_ /** @@ -81,7 +81,7 @@ extern "C" { * The parameter representing a command. */ #ifndef _di_control_print_error_parameter_command_rule_too_many_ - extern void control_print_error_parameter_command_rule_too_many(control_main_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; + extern void control_print_error_parameter_command_rule_too_many(fll_program_data_t * const main, const f_string_static_t command) F_attribute_visibility_internal_d; #endif // _di_control_print_error_parameter_command_rule_too_many_ /** @@ -91,7 +91,7 @@ extern "C" { * The main program data. */ #ifndef _di_control_print_error_commands_none_ - extern void control_print_error_commands_none(control_main_t * const main) F_attribute_visibility_internal_d; + extern void control_print_error_commands_none(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_control_print_error_commands_none_ /** @@ -103,7 +103,7 @@ extern "C" { * The parameter name. */ #ifndef _di_control_print_error_parameter_value_empty_ - extern void control_print_error_parameter_value_empty(control_main_t * const main, const f_string_static_t parameter) F_attribute_visibility_internal_d; + extern void control_print_error_parameter_value_empty(fll_program_data_t * const main, const f_string_static_t parameter) F_attribute_visibility_internal_d; #endif // _di_control_print_error_parameter_value_empty_ /** @@ -115,7 +115,7 @@ extern "C" { * The parameter name. */ #ifndef _di_control_print_error_parameter_value_not_ - extern void control_print_error_parameter_value_not(control_main_t * const main, const f_string_static_t parameter) F_attribute_visibility_internal_d; + extern void control_print_error_parameter_value_not(fll_program_data_t * const main, const f_string_static_t parameter) F_attribute_visibility_internal_d; #endif // _di_control_print_error_parameter_value_not_ /** @@ -125,7 +125,7 @@ extern "C" { * The main program data. */ #ifndef _di_control_print_error_pipe_supported_not_ - extern void control_print_error_pipe_supported_not(control_main_t * const main) F_attribute_visibility_internal_d; + extern void control_print_error_pipe_supported_not(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_control_print_error_pipe_supported_not_ /** @@ -137,7 +137,7 @@ extern "C" { * The socket file path. */ #ifndef _di_control_print_error_socket_file_failed_ - extern void control_print_error_socket_file_failed(control_main_t * const main, const f_string_static_t path_socket) F_attribute_visibility_internal_d; + extern void control_print_error_socket_file_failed(fll_program_data_t * const main, const f_string_static_t path_socket) F_attribute_visibility_internal_d; #endif // _di_control_print_error_socket_file_failed_ /** @@ -149,7 +149,7 @@ extern "C" { * The socket file path. */ #ifndef _di_control_print_error_socket_file_missing_ - extern void control_print_error_socket_file_missing(control_main_t * const main, const f_string_static_t path_socket) F_attribute_visibility_internal_d; + extern void control_print_error_socket_file_missing(fll_program_data_t * const main, const f_string_static_t path_socket) F_attribute_visibility_internal_d; #endif // _di_control_print_error_socket_file_missing_ /** @@ -161,7 +161,7 @@ extern "C" { * The socket file path. */ #ifndef _di_control_print_error_socket_file_not_ - extern void control_print_error_socket_file_not(control_main_t * const main, const f_string_static_t path_socket) F_attribute_visibility_internal_d; + extern void control_print_error_socket_file_not(fll_program_data_t * const main, const f_string_static_t path_socket) F_attribute_visibility_internal_d; #endif // _di_control_print_error_socket_file_not_ /** @@ -173,7 +173,7 @@ extern "C" { * The signal received. */ #ifndef _di_control_print_signal_received_ - extern void control_print_signal_received(control_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void control_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_control_print_signal_received_ #ifdef __cplusplus diff --git a/level_3/controller/c/common.c b/level_3/controller/c/common.c index 2d35ced..aed3165 100644 --- a/level_3/controller/c/common.c +++ b/level_3/controller/c/common.c @@ -28,7 +28,9 @@ extern "C" { const f_string_static_t controller_path_socket_init_s = macro_f_string_static_t_initialize(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_initialize(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_initialize(CONTROLLER_path_socket_suffix_s, 0, CONTROLLER_path_socket_suffix_s_length); +#endif // _di_controller_defines_ +#ifndef _di_controller_parameters_ const f_string_static_t controller_short_cgroup_s = macro_f_string_static_t_initialize(CONTROLLER_short_cgroup_s, 0, CONTROLLER_short_cgroup_s_length); const f_string_static_t controller_short_daemon_s = macro_f_string_static_t_initialize(CONTROLLER_short_daemon_s, 0, CONTROLLER_short_daemon_s_length); const f_string_static_t controller_short_init_s = macro_f_string_static_t_initialize(CONTROLLER_short_init_s, 0, CONTROLLER_short_init_s_length); @@ -50,14 +52,13 @@ extern "C" { const f_string_static_t controller_long_socket_s = macro_f_string_static_t_initialize(CONTROLLER_long_socket_s, 0, CONTROLLER_long_socket_s_length); const f_string_static_t controller_long_uninterruptible_s = macro_f_string_static_t_initialize(CONTROLLER_long_uninterruptible_s, 0, CONTROLLER_long_uninterruptible_s_length); const f_string_static_t controller_long_validate_s = macro_f_string_static_t_initialize(CONTROLLER_long_validate_s, 0, CONTROLLER_long_validate_s_length); -#endif // _di_controller_defines_ +#endif // _di_controller_parameters_ #ifndef _di_controller_main_delete_ f_status_t controller_main_delete(controller_main_t * const main) { f_console_parameters_delete(&main->parameters); - 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/controller/c/common.h b/level_3/controller/c/common.h index fdb4821..20bc76f 100644 --- a/level_3/controller/c/common.h +++ b/level_3/controller/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #ifndef _di_controller_program_version_ #define CONTROLLER_program_version_major_s F_string_ascii_0_s #define CONTROLLER_program_version_minor_s F_string_ascii_5_s @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t controller_program_version_s; #endif // _di_controller_program_version_ +/** + * The program name. + */ #ifndef _di_controller_program_name_ #define CONTROLLER_program_name_s "controller" #define CONTROLLER_program_name_long_s "Controller Program" @@ -62,6 +68,9 @@ extern "C" { extern const f_string_static_t controller_program_name_init_long_s; #endif // _di_controller_program_name_ +/** + * The program defines. + */ #ifndef _di_controller_defines_ // The pid path is a system-specific path and needs to be more easily contolled at compile time. @@ -191,7 +200,12 @@ extern "C" { extern const f_string_static_t controller_path_socket_init_s; extern const f_string_static_t controller_path_socket_prefix_s; extern const f_string_static_t controller_path_socket_suffix_s; +#endif // _di_controller_defines_ +/** + * The main program parameters. + */ +#ifndef _di_controller_parameters_ #define CONTROLLER_short_cgroup_s "c" #define CONTROLLER_short_daemon_s "d" #define CONTROLLER_short_init_s "I" @@ -305,13 +319,26 @@ extern "C" { } #define controller_total_parameters_d 19 -#endif // _di_controller_defines_ +#endif // _di_controller_parameters_ +/** + * The main program data. + * + * parameters: The state of pre-defined parameters passed to the program. + * remaining: The remaining, non-pre-defined parameters, passed to the program. + * process_pipe: Designate whether or not to process the input pipe. + * output: The output file for general printing. + * error: The output file for error printing. + * warning: The output file for warning printing. + * signal: The process signal management structure. + * context: The color context. + * + * @todo + */ #ifndef _di_controller_main_t_ typedef struct { f_console_parameters_t parameters; - f_array_lengths_t remaining; bool process_pipe; bool as_init; @@ -337,7 +364,6 @@ extern "C" { #define controller_main_t_initialize \ { \ f_console_parameters_t_initialize, \ - f_array_lengths_t_initialize, \ F_false, \ F_false, \ fl_print_t_initialize, \ diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index 78b0b46..3cba463 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -76,7 +76,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { controller_parameter_no_color_e, controller_parameter_light_e, controller_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -180,8 +180,8 @@ extern "C" { memset(&address, 0, setting.control_socket.length); - if (main->remaining.used) { - status = f_string_dynamic_append(argv[main->remaining.array[0]], &setting.name_entry); + if (main->parameters.remaining.used) { + status = f_string_dynamic_append(argv[main->parameters.remaining.array[0]], &setting.name_entry); } else { status = f_string_dynamic_append(controller_default_s, &setting.name_entry); diff --git a/level_3/fake/c/common.c b/level_3/fake/c/common.c index 433fd8d..d681c13 100644 --- a/level_3/fake/c/common.c +++ b/level_3/fake/c/common.c @@ -78,7 +78,7 @@ extern "C" { const f_string_static_t fake_build_version_nano_s = macro_f_string_static_t_initialize(FAKE_build_version_nano_s, 0, FAKE_build_version_nano_s_length); #endif // _di_fake_build_version_ -#ifndef _di_fake_defines_ +#ifndef _di_fake_parameters_ const f_string_static_t fake_short_define_s = macro_f_string_static_t_initialize(FAKE_short_define_s, 0, FAKE_short_define_s_length); const f_string_static_t fake_short_fakefile_s = macro_f_string_static_t_initialize(FAKE_short_fakefile_s, 0, FAKE_short_fakefile_s_length); const f_string_static_t fake_short_mode_s = macro_f_string_static_t_initialize(FAKE_short_mode_s, 0, FAKE_short_mode_s_length); @@ -112,15 +112,13 @@ extern "C" { const f_string_static_t fake_other_operation_clean_s = macro_f_string_static_t_initialize(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_initialize(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_initialize(FAKE_other_operation_skeleton_s, 0, FAKE_other_operation_skeleton_s_length); -#endif // _di_fake_defines_ +#endif // _di_fake_parameters_ #ifndef _di_fake_main_delete_ f_status_t fake_main_delete(fake_main_t * const main) { f_console_parameters_delete(&main->parameters); - 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); diff --git a/level_3/fake/c/common.h b/level_3/fake/c/common.h index 5c1e06d..2c9b072 100644 --- a/level_3/fake/c/common.h +++ b/level_3/fake/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fake_program_version_s; #endif // _di_fake_program_version_ +/** + * The program name. + */ #ifndef _di_fake_program_name_ #define FAKE_program_name_s "fake" #define FAKE_program_name_long_s "Featureless Make" @@ -53,6 +59,9 @@ extern "C" { extern const f_string_static_t fake_program_name_long_s; #endif // _di_fake_program_name_ +/** + * The program help related data. + */ #ifndef _di_fake_program_help_parameters_ #define FAKE_program_help_parameters_s "operation" #define FAKE_program_help_parameters_s_length 9 @@ -130,6 +139,9 @@ extern "C" { extern const f_string_static_t fake_path_part_static_s; #endif // _di_fake_path_ +/** + * The file settings. + */ #ifndef _di_fake_file_ #define FAKE_file_defines_s "defines" #define FAKE_file_dependencies_s "dependencies" @@ -188,6 +200,9 @@ extern "C" { extern const f_string_static_t fake_default_settings_s; #endif // _di_fake_defaults_ +/** + * The build languages. + */ #ifndef _di_fake_build_language_ enum { fake_build_language_type_bash_e = 1, @@ -208,6 +223,9 @@ extern "C" { extern const f_string_static_t fake_build_language_cpp_s; #endif // _di_fake_build_language_ +/** + * The program version. + */ #ifndef _di_fake_build_version_ enum { fake_build_version_type_major_e = 1, @@ -232,6 +250,9 @@ extern "C" { extern const f_string_static_t fake_build_version_nano_s; #endif // _di_fake_build_version_ +/** + * The program defines. + */ #ifndef _di_fake_defines_ enum { fake_operation_build_e = 1, @@ -246,7 +267,12 @@ extern "C" { #define fake_operations_total_d 4 #define fake_operations_initialize { 0, 0, 0, 0 } +#endif // _di_fake_defines_ +/** + * The main program parameters. + */ +#ifndef _di_fake_parameters_ #define FAKE_short_define_s "d" #define FAKE_short_fakefile_s "f" #define FAKE_short_mode_s "m" @@ -418,13 +444,24 @@ extern "C" { } #define fake_total_parameters_d 28 -#endif // _di_fake_defines_ - +#endif // _di_fake_parameters_ +/** + * The main program data. + * + * parameters: The state of pre-defined parameters passed to the program. + * process_pipe: Designate whether or not to process the input pipe. + * output: The output file for general printing. + * error: The output file for error printing. + * warning: The output file for warning printing. + * signal: The process signal management structure. + * context: The color context. + * + * @todo + */ #ifndef _di_fake_main_t_ typedef struct { f_console_parameters_t parameters; - f_array_lengths_t remaining; bool process_pipe; fl_print_t output; @@ -500,7 +537,6 @@ extern "C" { #define fake_main_t_initialize \ { \ f_console_parameters_t_initialize, \ - f_array_lengths_t_initialize, \ F_false, \ fl_print_t_initialize, \ macro_fl_print_t_initialize_error(), \ diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index 57064a2..7d5bc49 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -97,7 +97,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fake_parameter_no_color_e, fake_parameter_light_e, fake_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; diff --git a/level_3/firewall/c/common.c b/level_3/firewall/c/common.c index 75c128b..11a0112 100644 --- a/level_3/firewall/c/common.c +++ b/level_3/firewall/c/common.c @@ -109,7 +109,6 @@ extern "C" { f_console_parameters_delete(&main->parameters); 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/common.h b/level_3/firewall/c/common.h index 2e3cf5d..b111829 100644 --- a/level_3/firewall/c/common.h +++ b/level_3/firewall/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t firewall_program_version_s; #endif // _di_firewall_program_version_ +/** + * The program name. + */ #ifndef _di_firewall_program_name_ #define FIREWALL_program_name_s "firewall" #define FIREWALL_program_name_long_s "Kevux Firewall Manager" @@ -53,6 +59,9 @@ extern "C" { extern const f_string_static_t firewall_program_name_long_s; #endif // _di_firewall_program_name_ +/** + * The program help related data. + */ #ifndef _di_firewall_program_help_parameters_ #define FIREWALL_program_help_parameters_s "command" #define FIREWALL_program_help_parameters_s_length 7 @@ -60,6 +69,9 @@ extern "C" { extern const f_string_static_t firewall_program_help_parameters_s; #endif // _di_firewall_program_help_parameters_ +/** + * The program paths. + */ #ifndef _di_firewall_paths_ #define FIREWALL_file_first_s "firewall-first" #define FIREWALL_file_last_s "firewall-last" @@ -86,13 +98,24 @@ extern "C" { extern const f_string_static_t firewall_network_devices_s; #endif // _di_firewall_paths_ +/** + * Default allocations. + */ #ifndef _di_firewall_default_allocation_step_ #define firewall_default_allocation_step_d F_memory_default_allocation_small_d #endif // _di_firewall_default_allocation_step_ +/** + * The program defines. + */ #ifndef _di_firewall_defines_ #define firewall_signal_check_d 10000 +#endif // _di_firewall_defines_ +/** + * The main program parameters. + */ +#ifndef _di_firewall_parameters_ #define FIREWALL_action_s "action" #define FIREWALL_action_append_s "append" #define FIREWALL_action_insert_s "insert" @@ -379,11 +402,23 @@ extern "C" { #define firewall_total_parameters_d 14 #endif // _di_firewall_defines_ +/** + * The main program data. + * + * parameters: The state of pre-defined parameters passed to the program. + * process_pipe: Designate whether or not to process the input pipe. + * output: The output file for general printing. + * error: The output file for error printing. + * warning: The output file for warning printing. + * signal: The process signal management structure. + * context: The color context. + * + * @todo + */ #ifndef _di_firewall_main_t_ typedef struct { f_console_parameters_t parameters; - f_array_lengths_t remaining; bool process_pipe; int child; @@ -402,7 +437,6 @@ extern "C" { #define firewall_main_t_initialize \ { \ f_console_parameters_t_initialize, \ - f_array_lengths_t_initialize, \ F_false, \ 0, \ fl_print_t_initialize, \ diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 6c724ff..9a11a9b 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -59,7 +59,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { firewall_parameter_no_color_e, firewall_parameter_light_e, firewall_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -215,16 +215,16 @@ extern "C" { int return_code = 0; - if (main->remaining.used > 0) { + if (main->parameters.remaining.used > 0) { show_nat = F_false; show_mangle = F_false; show_ports = F_false; f_array_length_t index = 0; - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { - index = main->remaining.array[i]; + index = main->parameters.remaining.array[i]; if (fl_string_dynamic_compare(firewall_show_nat_s, argv[index]) == F_equal_to) { show_nat = F_true; diff --git a/level_3/fss_basic_list_read/c/common.c b/level_3/fss_basic_list_read/c/common.c index 886acda..bceee12 100644 --- a/level_3/fss_basic_list_read/c/common.c +++ b/level_3/fss_basic_list_read/c/common.c @@ -13,15 +13,48 @@ extern "C" { const f_string_static_t fss_basic_list_read_program_name_long_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_program_name_long_s, 0, FSS_BASIC_LIST_READ_program_name_long_s_length); #endif // _di_fss_basic_list_read_program_name_ -#ifndef _di_fss_basic_list_read_main_delete_ - f_status_t fss_basic_list_read_main_delete(fss_basic_list_read_main_t * const main) { - - f_console_parameters_delete(&main->parameters); +#ifndef _di_fss_basic_list_read_defines_ + const f_string_static_t fss_basic_list_read_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_pipe_content_end_s, 0, FSS_BASIC_LIST_READ_pipe_content_end_s_length); + const f_string_static_t fss_basic_list_read_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_pipe_content_ignore_s, 0, FSS_BASIC_LIST_READ_pipe_content_ignore_s_length); + const f_string_static_t fss_basic_list_read_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_pipe_content_start_s, 0, FSS_BASIC_LIST_READ_pipe_content_start_s_length); +#endif // _di_fss_basic_list_read_defines_ + +#ifndef _di_fss_basic_list_read_parameters_ + const f_string_static_t fss_basic_list_read_short_at_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_at_s, 0, FSS_BASIC_LIST_READ_short_at_s_length); + const f_string_static_t fss_basic_list_read_short_content_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_content_s, 0, FSS_BASIC_LIST_READ_short_content_s_length); + const f_string_static_t fss_basic_list_read_short_columns_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_columns_s, 0, FSS_BASIC_LIST_READ_short_columns_s_length); + const f_string_static_t fss_basic_list_read_short_delimit_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_delimit_s, 0, FSS_BASIC_LIST_READ_short_delimit_s_length); + const f_string_static_t fss_basic_list_read_short_depth_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_depth_s, 0, FSS_BASIC_LIST_READ_short_depth_s_length); + const f_string_static_t fss_basic_list_read_short_empty_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_empty_s, 0, FSS_BASIC_LIST_READ_short_empty_s_length); + const f_string_static_t fss_basic_list_read_short_line_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_line_s, 0, FSS_BASIC_LIST_READ_short_line_s_length); + const f_string_static_t fss_basic_list_read_short_name_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_name_s, 0, FSS_BASIC_LIST_READ_short_name_s_length); + const f_string_static_t fss_basic_list_read_short_object_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_object_s, 0, FSS_BASIC_LIST_READ_short_object_s_length); + const f_string_static_t fss_basic_list_read_short_pipe_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_pipe_s, 0, FSS_BASIC_LIST_READ_short_pipe_s_length); + const f_string_static_t fss_basic_list_read_short_raw_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_raw_s, 0, FSS_BASIC_LIST_READ_short_raw_s_length); + const f_string_static_t fss_basic_list_read_short_select_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_select_s, 0, FSS_BASIC_LIST_READ_short_select_s_length); + const f_string_static_t fss_basic_list_read_short_total_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_total_s, 0, FSS_BASIC_LIST_READ_short_total_s_length); + const f_string_static_t fss_basic_list_read_short_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_short_trim_s, 0, FSS_BASIC_LIST_READ_short_trim_s_length); + + const f_string_static_t fss_basic_list_read_long_at_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_at_s, 0, FSS_BASIC_LIST_READ_long_at_s_length); + const f_string_static_t fss_basic_list_read_long_content_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_content_s, 0, FSS_BASIC_LIST_READ_long_content_s_length); + const f_string_static_t fss_basic_list_read_long_columns_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_columns_s, 0, FSS_BASIC_LIST_READ_long_columns_s_length); + const f_string_static_t fss_basic_list_read_long_delimit_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_delimit_s, 0, FSS_BASIC_LIST_READ_long_delimit_s_length); + const f_string_static_t fss_basic_list_read_long_depth_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_depth_s, 0, FSS_BASIC_LIST_READ_long_depth_s_length); + const f_string_static_t fss_basic_list_read_long_empty_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_empty_s, 0, FSS_BASIC_LIST_READ_long_empty_s_length); + const f_string_static_t fss_basic_list_read_long_line_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_line_s, 0, FSS_BASIC_LIST_READ_long_line_s_length); + const f_string_static_t fss_basic_list_read_long_name_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_name_s, 0, FSS_BASIC_LIST_READ_long_name_s_length); + const f_string_static_t fss_basic_list_read_long_object_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_object_s, 0, FSS_BASIC_LIST_READ_long_object_s_length); + const f_string_static_t fss_basic_list_read_long_pipe_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_pipe_s, 0, FSS_BASIC_LIST_READ_long_pipe_s_length); + const f_string_static_t fss_basic_list_read_long_raw_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_raw_s, 0, FSS_BASIC_LIST_READ_long_raw_s_length); + const f_string_static_t fss_basic_list_read_long_select_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_select_s, 0, FSS_BASIC_LIST_READ_long_select_s_length); + const f_string_static_t fss_basic_list_read_long_total_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_total_s, 0, FSS_BASIC_LIST_READ_long_total_s_length); + const f_string_static_t fss_basic_list_read_long_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_trim_s, 0, FSS_BASIC_LIST_READ_long_trim_s_length); +#endif // _di_fss_basic_list_read_parameters_ - f_type_array_lengths_resize(0, &main->remaining); - macro_f_color_context_t_delete_simple(main->context); +#ifndef _di_fss_basic_list_read_main_delete_ + f_status_t fss_basic_list_read_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_basic_list_read_main_delete_ diff --git a/level_3/fss_basic_list_read/c/common.h b/level_3/fss_basic_list_read/c/common.h index 8aa5e49..3828405 100644 --- a/level_3/fss_basic_list_read/c/common.h +++ b/level_3/fss_basic_list_read/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #ifndef _di_fss_basic_list_read_program_version_ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_basic_list_program_version_s; #endif // _di_fss_basic_list_read_program_version_ +/** + * The program name. + */ #ifndef _di_fss_basic_list_read_program_name_ #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" @@ -53,42 +59,118 @@ extern "C" { extern const f_string_static_t fss_basic_list_program_name_long_s; #endif // _di_fss_basic_list_read_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_basic_list_read_defines_ #define fss_basic_list_read_signal_check_d 10000 - #define fss_basic_list_read_pipe_content_end_s '\f' - #define fss_basic_list_read_pipe_content_ignore_s '\v' - #define fss_basic_list_read_pipe_content_start_s '\b' - - #define fss_basic_list_read_short_at_s "a" - #define fss_basic_list_read_short_content_s "c" - #define fss_basic_list_read_short_columns_s "C" - #define fss_basic_list_read_short_delimit_s "D" - #define fss_basic_list_read_short_depth_s "d" - #define fss_basic_list_read_short_empty_s "e" - #define fss_basic_list_read_short_line_s "l" - #define fss_basic_list_read_short_name_s "n" - #define fss_basic_list_read_short_object_s "o" - #define fss_basic_list_read_short_pipe_s "p" - #define fss_basic_list_read_short_raw_s "R" - #define fss_basic_list_read_short_select_s "s" - #define fss_basic_list_read_short_total_s "t" - #define fss_basic_list_read_short_trim_s "T" - - #define fss_basic_list_read_long_at_s "at" - #define fss_basic_list_read_long_content_s "content" - #define fss_basic_list_read_long_columns_s "columns" - #define fss_basic_list_read_long_delimit_s "delimit" - #define fss_basic_list_read_long_depth_s "depth" - #define fss_basic_list_read_long_empty_s "empty" - #define fss_basic_list_read_long_line_s "line" - #define fss_basic_list_read_long_name_s "name" - #define fss_basic_list_read_long_object_s "object" - #define fss_basic_list_read_long_pipe_s "pipe" - #define fss_basic_list_read_long_raw_s "raw" - #define fss_basic_list_read_long_select_s "select" - #define fss_basic_list_read_long_total_s "total" - #define fss_basic_list_read_long_trim_s "trim" + #define FSS_BASIC_LIST_READ_pipe_content_end_s "\f" + #define FSS_BASIC_LIST_READ_pipe_content_ignore_s "\v" + #define FSS_BASIC_LIST_READ_pipe_content_start_s "\b" + + #define FSS_BASIC_LIST_READ_pipe_content_end_s_length 1 + #define FSS_BASIC_LIST_READ_pipe_content_ignore_s_length 1 + #define FSS_BASIC_LIST_READ_pipe_content_start_s_length 1 + + extern const f_string_static_t fss_basic_list_read_pipe_content_end_s; + extern const f_string_static_t fss_basic_list_read_pipe_content_ignore_s; + extern const f_string_static_t fss_basic_list_read_pipe_content_start_s; +#endif // _di_fss_basic_list_read_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_fss_basic_list_read_parameters_ + #define FSS_BASIC_LIST_READ_short_at_s "a" + #define FSS_BASIC_LIST_READ_short_content_s "c" + #define FSS_BASIC_LIST_READ_short_columns_s "C" + #define FSS_BASIC_LIST_READ_short_delimit_s "D" + #define FSS_BASIC_LIST_READ_short_depth_s "d" + #define FSS_BASIC_LIST_READ_short_empty_s "e" + #define FSS_BASIC_LIST_READ_short_line_s "l" + #define FSS_BASIC_LIST_READ_short_name_s "n" + #define FSS_BASIC_LIST_READ_short_object_s "o" + #define FSS_BASIC_LIST_READ_short_pipe_s "p" + #define FSS_BASIC_LIST_READ_short_raw_s "R" + #define FSS_BASIC_LIST_READ_short_select_s "s" + #define FSS_BASIC_LIST_READ_short_total_s "t" + #define FSS_BASIC_LIST_READ_short_trim_s "T" + + #define FSS_BASIC_LIST_READ_long_at_s "at" + #define FSS_BASIC_LIST_READ_long_content_s "content" + #define FSS_BASIC_LIST_READ_long_columns_s "columns" + #define FSS_BASIC_LIST_READ_long_delimit_s "delimit" + #define FSS_BASIC_LIST_READ_long_depth_s "depth" + #define FSS_BASIC_LIST_READ_long_empty_s "empty" + #define FSS_BASIC_LIST_READ_long_line_s "line" + #define FSS_BASIC_LIST_READ_long_name_s "name" + #define FSS_BASIC_LIST_READ_long_object_s "object" + #define FSS_BASIC_LIST_READ_long_pipe_s "pipe" + #define FSS_BASIC_LIST_READ_long_raw_s "raw" + #define FSS_BASIC_LIST_READ_long_select_s "select" + #define FSS_BASIC_LIST_READ_long_total_s "total" + #define FSS_BASIC_LIST_READ_long_trim_s "trim" + + #define FSS_BASIC_LIST_READ_short_at_s_length 1 + #define FSS_BASIC_LIST_READ_short_content_s_length 1 + #define FSS_BASIC_LIST_READ_short_columns_s_length 1 + #define FSS_BASIC_LIST_READ_short_delimit_s_length 1 + #define FSS_BASIC_LIST_READ_short_depth_s_length 1 + #define FSS_BASIC_LIST_READ_short_empty_s_length 1 + #define FSS_BASIC_LIST_READ_short_line_s_length 1 + #define FSS_BASIC_LIST_READ_short_name_s_length 1 + #define FSS_BASIC_LIST_READ_short_object_s_length 1 + #define FSS_BASIC_LIST_READ_short_pipe_s_length 1 + #define FSS_BASIC_LIST_READ_short_raw_s_length 1 + #define FSS_BASIC_LIST_READ_short_select_s_length 1 + #define FSS_BASIC_LIST_READ_short_total_s_length 1 + #define FSS_BASIC_LIST_READ_short_trim_s_length 1 + + #define FSS_BASIC_LIST_READ_long_at_s_length 2 + #define FSS_BASIC_LIST_READ_long_content_s_length 7 + #define FSS_BASIC_LIST_READ_long_columns_s_length 8 + #define FSS_BASIC_LIST_READ_long_delimit_s_length 7 + #define FSS_BASIC_LIST_READ_long_depth_s_length 5 + #define FSS_BASIC_LIST_READ_long_empty_s_length 5 + #define FSS_BASIC_LIST_READ_long_line_s_length 4 + #define FSS_BASIC_LIST_READ_long_name_s_length 4 + #define FSS_BASIC_LIST_READ_long_object_s_length 6 + #define FSS_BASIC_LIST_READ_long_pipe_s_length 4 + #define FSS_BASIC_LIST_READ_long_raw_s_length 3 + #define FSS_BASIC_LIST_READ_long_select_s_length 6 + #define FSS_BASIC_LIST_READ_long_total_s_length 5 + #define FSS_BASIC_LIST_READ_long_trim_s_length 4 + + extern const f_string_static_t fss_basic_list_read_short_at_s; + extern const f_string_static_t fss_basic_list_read_short_content_s; + extern const f_string_static_t fss_basic_list_read_short_columns_s; + extern const f_string_static_t fss_basic_list_read_short_delimit_s; + extern const f_string_static_t fss_basic_list_read_short_depth_s; + extern const f_string_static_t fss_basic_list_read_short_empty_s; + extern const f_string_static_t fss_basic_list_read_short_line_s; + extern const f_string_static_t fss_basic_list_read_short_name_s; + extern const f_string_static_t fss_basic_list_read_short_object_s; + extern const f_string_static_t fss_basic_list_read_short_pipe_s; + extern const f_string_static_t fss_basic_list_read_short_raw_s; + extern const f_string_static_t fss_basic_list_read_short_select_s; + extern const f_string_static_t fss_basic_list_read_short_total_s; + extern const f_string_static_t fss_basic_list_read_short_trim_s; + + extern const f_string_static_t fss_basic_list_read_long_at_s; + extern const f_string_static_t fss_basic_list_read_long_content_s; + extern const f_string_static_t fss_basic_list_read_long_columns_s; + extern const f_string_static_t fss_basic_list_read_long_delimit_s; + extern const f_string_static_t fss_basic_list_read_long_depth_s; + extern const f_string_static_t fss_basic_list_read_long_empty_s; + extern const f_string_static_t fss_basic_list_read_long_line_s; + extern const f_string_static_t fss_basic_list_read_long_name_s; + extern const f_string_static_t fss_basic_list_read_long_object_s; + extern const f_string_static_t fss_basic_list_read_long_pipe_s; + extern const f_string_static_t fss_basic_list_read_long_raw_s; + extern const f_string_static_t fss_basic_list_read_long_select_s; + extern const f_string_static_t fss_basic_list_read_long_total_s; + extern const f_string_static_t fss_basic_list_read_long_trim_s; enum { fss_basic_list_read_parameter_help_e, @@ -128,24 +210,24 @@ extern "C" { 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(fss_basic_list_read_short_at_s, fss_basic_list_read_long_at_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_content_s, fss_basic_list_read_long_content_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_columns_s, fss_basic_list_read_long_columns_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_delimit_s, fss_basic_list_read_long_delimit_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_depth_s, fss_basic_list_read_long_depth_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_empty_s, fss_basic_list_read_long_empty_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_line_s, fss_basic_list_read_long_line_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_name_s, fss_basic_list_read_long_name_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_object_s, fss_basic_list_read_long_object_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_pipe_s, fss_basic_list_read_long_pipe_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_raw_s, fss_basic_list_read_long_raw_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_select_s, fss_basic_list_read_long_select_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_at_s.string, fss_basic_list_read_long_at_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_content_s.string, fss_basic_list_read_long_content_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_columns_s.string, fss_basic_list_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_delimit_s.string, fss_basic_list_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_depth_s.string, fss_basic_list_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_empty_s.string, fss_basic_list_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_line_s.string, fss_basic_list_read_long_line_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_name_s.string, fss_basic_list_read_long_name_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_object_s.string, fss_basic_list_read_long_object_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_pipe_s.string, fss_basic_list_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_raw_s.string, fss_basic_list_read_long_raw_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_select_s.string, fss_basic_list_read_long_select_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_total_s.string, fss_basic_list_read_long_total_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_read_short_trim_s.string, fss_basic_list_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_basic_list_total_parameters_d 23 -#endif // _di_fss_basic_list_read_defines_ +#endif // _di_fss_basic_list_read_parameters_ /** * FSS Delimit Parameter data. @@ -186,35 +268,6 @@ extern "C" { }; #endif // _di_fss_basic_list_read_delimit_modes_ -#ifndef _di_fss_basic_list_read_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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; - } fss_basic_list_read_main_t; - - #define fss_basic_list_read_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_basic_list_read_main_t_ - /** * Deallocate main. * @@ -231,7 +284,7 @@ extern "C" { * @see fss_basic_list_read_main() */ #ifndef _di_fss_basic_list_read_main_delete_ - extern f_status_t fss_basic_list_read_main_delete(fss_basic_list_read_main_t * const main); + extern f_status_t fss_basic_list_read_main_delete(fll_program_data_t * const main); #endif // _di_fss_basic_list_read_main_delete_ #ifdef __cplusplus 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 2e013c0..e86418c 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,15 +7,6 @@ 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_initialize(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_initialize(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_initialize(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) { @@ -50,7 +41,7 @@ extern "C" { 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)"); + fll_program_print_help_usage(file, context, fss_basic_list_program_name_s, fll_program_parameter_filenames_s); fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s); @@ -127,7 +118,7 @@ extern "C" { #endif // _di_fss_basic_list_read_print_help_ #ifndef _di_fss_basic_list_read_main_ - f_status_t fss_basic_list_read_main(fss_basic_list_read_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_basic_list_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -139,7 +130,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_basic_list_read_parameter_no_color_e, fss_basic_list_read_parameter_light_e, fss_basic_list_read_parameter_dark_e }; const f_console_parameter_ids_t choices = { ids, 3 }; - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -225,17 +216,17 @@ extern "C" { } // Provide a range designating where within the buffer a particular file exists, using a statically allocated array. - fss_basic_list_read_file_t files_array[main->remaining.used + 1]; + fss_basic_list_read_file_t files_array[main->parameters.remaining.used + 1]; fss_basic_list_read_data_t data = fss_basic_list_read_data_t_initialize; data.files.array = files_array; data.files.used = 1; - data.files.size = main->remaining.used + 1; + data.files.size = main->parameters.remaining.used + 1; data.files.array[0].name = "(pipe)"; data.files.array[0].range.start = 1; data.files.array[0].range.stop = 0; - if (main->remaining.used || main->process_pipe) { + if (main->parameters.remaining.used || main->process_pipe) { { const f_array_length_t parameter_code[] = { fss_basic_list_read_parameter_at_e, @@ -566,12 +557,12 @@ extern "C" { } } - if (F_status_is_error_not(status) && main->remaining.used > 0) { + if (F_status_is_error_not(status) && main->parameters.remaining.used > 0) { f_file_t file = f_file_t_initialize; f_array_length_t size_file = 0; uint16_t signal_check = 0; - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % fss_basic_list_read_signal_check_d)) { if (fss_basic_list_read_signal_received(main)) { @@ -587,10 +578,10 @@ extern "C" { file.stream = 0; file.id = -1; - status = f_file_stream_open(arguments->argv[main->remaining.array[i]], 0, &file); + status = f_file_stream_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); break; } @@ -599,7 +590,7 @@ extern "C" { status = f_file_size_by_id(file.id, &size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -608,7 +599,7 @@ extern "C" { status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -616,12 +607,12 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } else if (data.buffer.used > data.files.array[data.files.used].range.start) { - data.files.array[data.files.used].name = arguments->argv[main->remaining.array[i]]; + data.files.array[data.files.used].name = arguments->argv[main->parameters.remaining.array[i]]; data.files.array[data.files.used++].range.stop = data.buffer.used - 1; // This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter. 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 cc3b30e..62bbf1a 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 @@ -7,7 +7,7 @@ * * This is the FSS Basic List Read program * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the fss_basic_list_read_main_t. + * This program processes files or other input in fss format and stores the results in the fll_program_data_t. * * This processes in accordance to the FSS-0002 Basic List specification. */ @@ -96,7 +96,7 @@ extern "C" { * @see fss_basic_list_read_main_delete() */ #ifndef _di_fss_basic_list_read_main_ - extern f_status_t fss_basic_list_read_main(fss_basic_list_read_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_basic_list_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_basic_list_read_main_ #ifdef __cplusplus diff --git a/level_3/fss_basic_list_read/c/main.c b/level_3/fss_basic_list_read/c/main.c index a09d464..c758ed4 100644 --- a/level_3/fss_basic_list_read/c/main.c +++ b/level_3/fss_basic_list_read/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { f_console_arguments_t arguments = { argc, argv }; - fss_basic_list_read_main_t data = fss_basic_list_read_main_t_initialize; + fll_program_data_t data = fss_basic_list_read_main_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; 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 2d3ffd2..0a3a246 100644 --- a/level_3/fss_basic_list_read/c/private-common.c +++ b/level_3/fss_basic_list_read/c/private-common.c @@ -58,7 +58,7 @@ extern "C" { #endif // _di_fss_basic_list_read_depths_resize_ #ifndef _di_fss_basic_list_read_print_signal_received_ - void fss_basic_list_read_print_signal_received(fss_basic_list_read_main_t * const main, const f_status_t signal) { + void fss_basic_list_read_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -76,7 +76,7 @@ extern "C" { #endif // _di_fss_basic_list_read_print_signal_received_ #ifndef _di_fss_basic_list_read_signal_received_ - f_status_t fss_basic_list_read_signal_received(fss_basic_list_read_main_t * const main) { + f_status_t fss_basic_list_read_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_basic_list_read/c/private-common.h b/level_3/fss_basic_list_read/c/private-common.h index 6513007..be183e5 100644 --- a/level_3/fss_basic_list_read/c/private-common.h +++ b/level_3/fss_basic_list_read/c/private-common.h @@ -257,7 +257,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_basic_list_read_print_signal_received_ - extern void fss_basic_list_read_print_signal_received(fss_basic_list_read_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_basic_list_read_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_print_signal_received_ /** @@ -275,7 +275,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_basic_list_read_signal_received_ - extern f_status_t fss_basic_list_read_signal_received(fss_basic_list_read_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_signal_received_ #ifdef __cplusplus diff --git a/level_3/fss_basic_list_read/c/private-print.c b/level_3/fss_basic_list_read/c/private-print.c index ca8c918..67a7339 100644 --- a/level_3/fss_basic_list_read/c/private-print.c +++ b/level_3/fss_basic_list_read/c/private-print.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_basic_list_read_print_at_ - void fss_basic_list_read_print_at(fss_basic_list_read_main_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_list_read_data_t * const data) { + void fss_basic_list_read_print_at(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_list_read_data_t * const data) { if (at >= data->contents.used) { return; @@ -45,7 +45,7 @@ extern "C" { #endif // _di_fss_basic_list_read_print_at_ #ifndef _di_fss_basic_list_read_print_at_object_ - void fss_basic_list_read_print_at_object(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) { + void fss_basic_list_read_print_at_object(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) { if (at >= data->objects.used) { return; @@ -63,7 +63,7 @@ extern "C" { #endif // _di_fss_basic_list_read_print_at_object_ #ifndef _di_fss_basic_list_read_print_content_ignore_ - void fss_basic_list_read_print_content_ignore(fss_basic_list_read_main_t * const main) { + void fss_basic_list_read_print_content_ignore(fll_program_data_t * const main) { if (main->parameters.array[fss_basic_list_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_basic_list_read_pipe_content_ignore_s, main->output.to.stream); @@ -72,7 +72,7 @@ extern "C" { #endif // _di_fss_basic_list_read_print_content_ignore_ #ifndef _di_fss_basic_list_read_print_object_end_ - void fss_basic_list_read_print_object_end(fss_basic_list_read_main_t * const main) { + void fss_basic_list_read_print_object_end(fll_program_data_t * const main) { if (main->parameters.array[fss_basic_list_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_basic_list_read_pipe_content_start_s, main->output.to.stream); @@ -90,7 +90,7 @@ extern "C" { #endif // _di_fss_basic_list_read_print_object_end_ #ifndef _di_fss_basic_list_read_print_set_end_ - void fss_basic_list_read_print_set_end(fss_basic_list_read_main_t * const main) { + void fss_basic_list_read_print_set_end(fll_program_data_t * const main) { if (main->parameters.array[fss_basic_list_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_basic_list_read_pipe_content_end_s, main->output.to.stream); @@ -99,7 +99,7 @@ extern "C" { #endif // _di_fss_basic_list_read_print_set_end_ #ifndef _di_fss_basic_list_read_print_one_ - void fss_basic_list_read_print_one(fss_basic_list_read_main_t * const main) { + void fss_basic_list_read_print_one(fll_program_data_t * const main) { f_print_character(f_string_ascii_1_s.string[0], main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); @@ -107,7 +107,7 @@ extern "C" { #endif // _di_fss_basic_list_read_print_one_ #ifndef _di_fss_basic_list_read_print_zero_ - void fss_basic_list_read_print_zero(fss_basic_list_read_main_t * const main) { + void fss_basic_list_read_print_zero(fll_program_data_t * const main) { f_print_character(f_string_ascii_0_s.string[0], main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); diff --git a/level_3/fss_basic_list_read/c/private-print.h b/level_3/fss_basic_list_read/c/private-print.h index 7d988ac..7ce6a3c 100644 --- a/level_3/fss_basic_list_read/c/private-print.h +++ b/level_3/fss_basic_list_read/c/private-print.h @@ -29,7 +29,7 @@ extern "C" { * The program data. */ #ifndef _di_fss_basic_list_read_print_at_ - extern void fss_basic_list_read_print_at(fss_basic_list_read_main_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_list_read_data_t * const data) F_attribute_visibility_internal_d; + extern void fss_basic_list_read_print_at(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_list_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_print_at_ /** @@ -45,7 +45,7 @@ extern "C" { * The delimits to be applied to an Object. */ #ifndef _di_fss_basic_list_read_print_at_object_ - extern void fss_basic_list_read_print_at_object(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) F_attribute_visibility_internal_d; + extern void fss_basic_list_read_print_at_object(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_print_at_object_ /** @@ -57,7 +57,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_list_read_print_content_ignore_ - extern void fss_basic_list_read_print_content_ignore(fss_basic_list_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_basic_list_read_print_content_ignore(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_print_content_ignore_ /** @@ -67,7 +67,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_list_read_print_object_end_ - extern void fss_basic_list_read_print_object_end(fss_basic_list_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_basic_list_read_print_object_end(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_print_object_end_ /** @@ -77,7 +77,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_list_read_print_one_ - extern void fss_basic_list_read_print_one(fss_basic_list_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_basic_list_read_print_one(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_print_one_ /** @@ -87,7 +87,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_list_read_print_set_end_ - extern void fss_basic_list_read_print_set_end(fss_basic_list_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_basic_list_read_print_set_end(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_print_set_end_ /** @@ -97,7 +97,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_list_read_print_zero_ - extern void fss_basic_list_read_print_zero(fss_basic_list_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_basic_list_read_print_zero(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_print_zero_ #ifdef __cplusplus 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 eb4b3fe..928ea68 100644 --- a/level_3/fss_basic_list_read/c/private-read.c +++ b/level_3/fss_basic_list_read/c/private-read.c @@ -56,7 +56,7 @@ extern "C" { #endif // _di_fss_basic_list_read_delimit_object_is_ #ifndef _di_fss_basic_list_read_depth_process_ - f_status_t fss_basic_list_read_depth_process(fss_basic_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) { + f_status_t fss_basic_list_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) { f_status_t status = F_none; @@ -244,7 +244,7 @@ extern "C" { #endif // _di_fss_basic_list_read_file_identify_ #ifndef _di_fss_basic_list_read_load_ - f_status_t fss_basic_list_read_load(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data) { + f_status_t fss_basic_list_read_load(fll_program_data_t * const main, fss_basic_list_read_data_t *data) { f_state_t state = macro_f_state_t_initialize(fss_basic_list_common_allocation_large_d, fss_basic_list_read_common_allocation_small_d, 0, 0, 0, 0, 0); f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used); @@ -281,7 +281,7 @@ extern "C" { #endif // _di_fss_basic_list_read_load_ #ifndef _di_fss_basic_list_read_load_number_ - f_status_t fss_basic_list_read_load_number(fss_basic_list_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) { + f_status_t fss_basic_list_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; @@ -303,7 +303,7 @@ extern "C" { #endif // _di_fss_basic_list_read_load_number_ #ifndef _di_fss_basic_list_read_process_ - f_status_t fss_basic_list_read_process(fss_basic_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) { + f_status_t fss_basic_list_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) { f_status_t status = fss_basic_list_read_process_option(main, arguments, data); if (F_status_is_error(status)) return status; @@ -375,7 +375,7 @@ extern "C" { #endif // _di_fss_basic_list_read_process_ #ifndef _di_fss_basic_list_read_process_at_ - f_status_t fss_basic_list_read_process_at(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) { + f_status_t fss_basic_list_read_process_at(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) { if (data->depths.array[0].value_at >= data->objects.used) { if (data->option & (fss_basic_list_read_data_option_columns_d | fss_basic_list_read_data_option_total_d)) { @@ -459,7 +459,7 @@ extern "C" { #endif // _di_fss_basic_list_read_process_at_ #ifndef _di_fss_basic_list_read_process_at_line_ - f_status_t fss_basic_list_read_process_at_line(fss_basic_list_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_basic_list_read_data_t *data, f_array_length_t *line) { + f_status_t fss_basic_list_read_process_at_line(fll_program_data_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_basic_list_read_data_t *data, f_array_length_t *line) { if (data->option & fss_basic_list_read_data_option_object_d) { if (*line == data->line) { @@ -563,7 +563,7 @@ extern "C" { #endif // _di_fss_basic_list_read_process_at_line_ #ifndef _di_fss_basic_list_read_process_columns_ - f_status_t fss_basic_list_read_process_columns(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) { + f_status_t fss_basic_list_read_process_columns(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) { if (!(data->option & fss_basic_list_read_data_option_content_d)) { flockfile(main->output.to.stream); @@ -602,7 +602,7 @@ extern "C" { #endif // _di_fss_basic_list_read_process_columns_ #ifndef _di_fss_basic_list_read_process_line_ - f_status_t fss_basic_list_read_process_line(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) { + f_status_t fss_basic_list_read_process_line(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) { f_array_lengths_t except_none = f_array_lengths_t_initialize; f_array_lengths_t *delimits_object = fss_basic_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none; @@ -664,7 +664,7 @@ extern "C" { #endif // _di_fss_basic_list_read_process_name_ #ifndef _di_fss_basic_list_read_process_option_ - f_status_t fss_basic_list_read_process_option(fss_basic_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) { + f_status_t fss_basic_list_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) { f_status_t status = F_none; @@ -728,7 +728,7 @@ extern "C" { #endif // _di_fss_basic_list_read_process_option_ #ifndef _di_fss_basic_list_read_process_total_ - f_status_t fss_basic_list_read_process_total(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) { + f_status_t fss_basic_list_read_process_total(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) { f_array_length_t total = 0; f_string_range_t range = f_string_range_t_initialize; diff --git a/level_3/fss_basic_list_read/c/private-read.h b/level_3/fss_basic_list_read/c/private-read.h index 8361f50..5711d75 100644 --- a/level_3/fss_basic_list_read/c/private-read.h +++ b/level_3/fss_basic_list_read/c/private-read.h @@ -74,7 +74,7 @@ extern "C" { * @see fss_basic_list_read_depths_resize() */ #ifndef _di_fss_basic_list_read_depth_process_ - extern f_status_t fss_basic_list_read_depth_process(fss_basic_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_depth_process_ /** @@ -118,7 +118,7 @@ extern "C" { * @see fss_basic_list_read_process_option() */ #ifndef _di_fss_basic_list_read_load_ - extern f_status_t fss_basic_list_read_load(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_load(fll_program_data_t * const main, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_load_ /** @@ -148,7 +148,7 @@ extern "C" { * @see fss_basic_list_read_depths_resize() */ #ifndef _di_fss_basic_list_read_load_number_ - extern f_status_t fss_basic_list_read_load_number(fss_basic_list_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_load_number_ /** @@ -173,7 +173,7 @@ extern "C" { * @see fss_basic_list_read_process_option() */ #ifndef _di_fss_basic_list_read_process_ - extern f_status_t fss_basic_list_read_process(fss_basic_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_ /** @@ -193,7 +193,7 @@ extern "C" { * @see fss_basic_list_read_process_at_line() */ #ifndef _di_fss_basic_list_read_process_at_ - extern f_status_t fss_basic_list_read_process_at(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_at(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_at_ /** @@ -216,7 +216,7 @@ extern "C" { * F_success on success and the line was matched (and possibly printed). */ #ifndef _di_fss_basic_list_read_process_at_line_ - extern f_status_t fss_basic_list_read_process_at_line(fss_basic_list_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_basic_list_read_data_t *data, f_array_length_t *line) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_at_line(fll_program_data_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_basic_list_read_data_t *data, f_array_length_t *line) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_at_line_ /** @@ -234,7 +234,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_list_read_process_columns_ - extern f_status_t fss_basic_list_read_process_columns(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_columns(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_columns_ /** @@ -252,7 +252,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_list_read_process_line_ - extern f_status_t fss_basic_list_read_process_line(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_line(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_line_ /** @@ -293,7 +293,7 @@ extern "C" { * @see fss_basic_list_read_load_setting() */ #ifndef _di_fss_basic_list_read_process_option_ - extern f_status_t fss_basic_list_read_process_option(fss_basic_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_option_ /** @@ -311,7 +311,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_list_read_process_total_ - extern f_status_t fss_basic_list_read_process_total(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_total(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_total_ #ifdef __cplusplus diff --git a/level_3/fss_basic_list_write/c/common.c b/level_3/fss_basic_list_write/c/common.c index 42e4508..2cdfa3e 100644 --- a/level_3/fss_basic_list_write/c/common.c +++ b/level_3/fss_basic_list_write/c/common.c @@ -13,16 +13,38 @@ extern "C" { const f_string_static_t fss_basic_list_write_program_name_long_s = macro_f_string_static_t_initialize(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_main_delete_ - f_status_t fss_basic_list_write_main_delete(fss_basic_list_write_main_t * const main) { - - f_console_parameters_delete(&main->parameters); +#ifndef _di_fss_basic_list_write_defines_ + const f_string_static_t fss_basic_list_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_pipe_content_end_s, 0, FSS_BASIC_LIST_WRITE_pipe_content_end_s_length); + const f_string_static_t fss_basic_list_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_pipe_content_ignore_s, 0, FSS_BASIC_LIST_WRITE_pipe_content_ignore_s_length); + const f_string_static_t fss_basic_list_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_pipe_content_start_s, 0, FSS_BASIC_LIST_WRITE_pipe_content_start_s_length); +#endif // _di_fss_basic_list_write_defines_ + +#ifndef _di_fss_basic_list_write_parameters_ + const f_string_static_t fss_basic_list_write_short_file_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_file_s, 0, FSS_BASIC_LIST_WRITE_short_file_s_length); + const f_string_static_t fss_basic_list_write_short_content_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_content_s, 0, FSS_BASIC_LIST_WRITE_short_content_s_length); + const f_string_static_t fss_basic_list_write_short_double_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_double_s, 0, FSS_BASIC_LIST_WRITE_short_double_s_length); + const f_string_static_t fss_basic_list_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_ignore_s, 0, FSS_BASIC_LIST_WRITE_short_ignore_s_length); + const f_string_static_t fss_basic_list_write_short_object_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_object_s, 0, FSS_BASIC_LIST_WRITE_short_object_s_length); + const f_string_static_t fss_basic_list_write_short_partial_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_partial_s, 0, FSS_BASIC_LIST_WRITE_short_partial_s_length); + const f_string_static_t fss_basic_list_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_prepend_s, 0, FSS_BASIC_LIST_WRITE_short_prepend_s_length); + const f_string_static_t fss_basic_list_write_short_single_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_single_s, 0, FSS_BASIC_LIST_WRITE_short_single_s_length); + const f_string_static_t fss_basic_list_write_short_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_trim_s, 0, FSS_BASIC_LIST_WRITE_short_trim_s_length); + + const f_string_static_t fss_basic_list_write_long_file_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_file_s, 0, FSS_BASIC_LIST_WRITE_long_file_s_length); + const f_string_static_t fss_basic_list_write_long_content_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_content_s, 0, FSS_BASIC_LIST_WRITE_long_content_s_length); + const f_string_static_t fss_basic_list_write_long_double_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_double_s, 0, FSS_BASIC_LIST_WRITE_long_double_s_length); + const f_string_static_t fss_basic_list_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_ignore_s, 0, FSS_BASIC_LIST_WRITE_long_ignore_s_length); + const f_string_static_t fss_basic_list_write_long_object_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_object_s, 0, FSS_BASIC_LIST_WRITE_long_object_s_length); + const f_string_static_t fss_basic_list_write_long_partial_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_partial_s, 0, FSS_BASIC_LIST_WRITE_long_partial_s_length); + const f_string_static_t fss_basic_list_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_prepend_s, 0, FSS_BASIC_LIST_WRITE_long_prepend_s_length); + const f_string_static_t fss_basic_list_write_long_single_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_single_s, 0, FSS_BASIC_LIST_WRITE_long_single_s_length); + const f_string_static_t fss_basic_list_write_long_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_trim_s, 0, FSS_BASIC_LIST_WRITE_long_trim_s_length); +#endif // _di_fss_basic_list_write_parameters_ - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); +#ifndef _di_fss_basic_list_write_main_delete_ + f_status_t fss_basic_list_write_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_basic_list_write_main_delete_ diff --git a/level_3/fss_basic_list_write/c/common.h b/level_3/fss_basic_list_write/c/common.h index 816d71d..a1a57e2 100644 --- a/level_3/fss_basic_list_write/c/common.h +++ b/level_3/fss_basic_list_write/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_basic_list_write_program_version_s; #endif // _di_fss_basic_list_write_program_version_ +/** + * The program name. + */ #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" @@ -53,32 +59,88 @@ extern "C" { extern const f_string_static_t fss_basic_list_write_program_name_long_s; #endif // _di_fss_basic_list_write_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_basic_list_write_defines_ #define fss_basic_list_write_signal_check_d 10000 - #define fss_basic_list_write_pipe_content_end_s '\f' - #define fss_basic_list_write_pipe_content_ignore_s '\v' - #define fss_basic_list_write_pipe_content_start_s '\b' - - #define fss_basic_list_write_short_file_s "f" - #define fss_basic_list_write_short_content_s "c" - #define fss_basic_list_write_short_double_s "d" - #define fss_basic_list_write_short_ignore_s "I" - #define fss_basic_list_write_short_object_s "o" - #define fss_basic_list_write_short_partial_s "p" - #define fss_basic_list_write_short_prepend_s "P" - #define fss_basic_list_write_short_single_s "s" - #define fss_basic_list_write_short_trim_s "T" - - #define fss_basic_list_write_long_file_s "file" - #define fss_basic_list_write_long_content_s "content" - #define fss_basic_list_write_long_double_s "double" - #define fss_basic_list_write_long_ignore_s "ignore" - #define fss_basic_list_write_long_object_s "object" - #define fss_basic_list_write_long_partial_s "partial" - #define fss_basic_list_write_long_prepend_s "prepend" - #define fss_basic_list_write_long_single_s "single" - #define fss_basic_list_write_long_trim_s "trim" + #define FSS_BASIC_LIST_WRITE_pipe_content_end_s '\f' + #define FSS_BASIC_LIST_WRITE_pipe_content_ignore_s '\v' + #define FSS_BASIC_LIST_WRITE_pipe_content_start_s '\b' + + #define FSS_BASIC_LIST_WRITE_pipe_content_end_s_length 1 + #define FSS_BASIC_LIST_WRITE_pipe_content_ignore_s_length 1 + #define FSS_BASIC_LIST_WRITE_pipe_content_start_s_length 1 + + extern const f_string_static_t fss_basic_list_write_pipe_content_end_s; + extern const f_string_static_t fss_basic_list_write_pipe_content_ignore_s; + extern const f_string_static_t fss_basic_list_write_pipe_content_start_s; +#endif // _di_fss_basic_list_write_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_fss_basic_list_write_parameters_ + #define FSS_BASIC_LIST_WRITE_short_file_s "f" + #define FSS_BASIC_LIST_WRITE_short_content_s "c" + #define FSS_BASIC_LIST_WRITE_short_double_s "d" + #define FSS_BASIC_LIST_WRITE_short_ignore_s "I" + #define FSS_BASIC_LIST_WRITE_short_object_s "o" + #define FSS_BASIC_LIST_WRITE_short_partial_s "p" + #define FSS_BASIC_LIST_WRITE_short_prepend_s "P" + #define FSS_BASIC_LIST_WRITE_short_single_s "s" + #define FSS_BASIC_LIST_WRITE_short_trim_s "T" + + #define FSS_BASIC_LIST_WRITE_long_file_s "file" + #define FSS_BASIC_LIST_WRITE_long_content_s "content" + #define FSS_BASIC_LIST_WRITE_long_double_s "double" + #define FSS_BASIC_LIST_WRITE_long_ignore_s "ignore" + #define FSS_BASIC_LIST_WRITE_long_object_s "object" + #define FSS_BASIC_LIST_WRITE_long_partial_s "partial" + #define FSS_BASIC_LIST_WRITE_long_prepend_s "prepend" + #define FSS_BASIC_LIST_WRITE_long_single_s "single" + #define FSS_BASIC_LIST_WRITE_long_trim_s "trim" + + #define FSS_BASIC_LIST_WRITE_short_file_s_length 1 + #define FSS_BASIC_LIST_WRITE_short_content_s_length 1 + #define FSS_BASIC_LIST_WRITE_short_double_s_length 1 + #define FSS_BASIC_LIST_WRITE_short_ignore_s_length 1 + #define FSS_BASIC_LIST_WRITE_short_object_s_length 1 + #define FSS_BASIC_LIST_WRITE_short_partial_s_length 1 + #define FSS_BASIC_LIST_WRITE_short_prepend_s_length 1 + #define FSS_BASIC_LIST_WRITE_short_single_s_length 1 + #define FSS_BASIC_LIST_WRITE_short_trim_s_length 1 + + #define FSS_BASIC_LIST_WRITE_long_file_s_length 4 + #define FSS_BASIC_LIST_WRITE_long_content_s_length 7 + #define FSS_BASIC_LIST_WRITE_long_double_s_length 6 + #define FSS_BASIC_LIST_WRITE_long_ignore_s_length 6 + #define FSS_BASIC_LIST_WRITE_long_object_s_length 6 + #define FSS_BASIC_LIST_WRITE_long_partial_s_length 7 + #define FSS_BASIC_LIST_WRITE_long_prepend_s_length 7 + #define FSS_BASIC_LIST_WRITE_long_single_s_length 6 + #define FSS_BASIC_LIST_WRITE_long_trim_s_length 4 + + extern const f_string_static_t fss_basic_list_write_short_file_s; + extern const f_string_static_t fss_basic_list_write_short_content_s; + extern const f_string_static_t fss_basic_list_write_short_double_s; + extern const f_string_static_t fss_basic_list_write_short_ignore_s; + extern const f_string_static_t fss_basic_list_write_short_object_s; + extern const f_string_static_t fss_basic_list_write_short_partial_s; + extern const f_string_static_t fss_basic_list_write_short_prepend_s; + extern const f_string_static_t fss_basic_list_write_short_single_s; + extern const f_string_static_t fss_basic_list_write_short_trim_s; + + extern const f_string_static_t fss_basic_list_write_long_file_s; + extern const f_string_static_t fss_basic_list_write_long_content_s; + extern const f_string_static_t fss_basic_list_write_long_double_s; + extern const f_string_static_t fss_basic_list_write_long_ignore_s; + extern const f_string_static_t fss_basic_list_write_long_object_s; + extern const f_string_static_t fss_basic_list_write_long_partial_s; + extern const f_string_static_t fss_basic_list_write_long_prepend_s; + extern const f_string_static_t fss_basic_list_write_long_single_s; + extern const f_string_static_t fss_basic_list_write_long_trim_s; enum { fss_basic_list_write_parameter_help_e, @@ -113,51 +175,19 @@ extern "C" { 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(fss_basic_list_write_short_file_s, fss_basic_list_write_long_file_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_write_short_content_s, fss_basic_list_write_long_content_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_write_short_double_s, fss_basic_list_write_long_double_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_write_short_ignore_s, fss_basic_list_write_long_ignore_s, 0, 2, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_write_short_object_s, fss_basic_list_write_long_object_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_write_short_partial_s, fss_basic_list_write_long_partial_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_write_short_prepend_s, fss_basic_list_write_long_prepend_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_write_short_single_s, fss_basic_list_write_long_single_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_list_write_short_trim_s, fss_basic_list_write_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_write_short_file_s.string, fss_basic_list_write_long_file_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_write_short_content_s.string, fss_basic_list_write_long_content_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_write_short_double_s.string, fss_basic_list_write_long_double_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_write_short_ignore_s.string, fss_basic_list_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_write_short_object_s.string, fss_basic_list_write_long_object_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_write_short_partial_s.string, fss_basic_list_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_write_short_prepend_s.string, fss_basic_list_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_write_short_single_s.string, fss_basic_list_write_long_single_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_list_write_short_trim_s.string, fss_basic_list_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_basic_list_write_total_parameters_d 18 -#endif // _di_fss_basic_list_write_defines_ - -#ifndef _di_fss_basic_list_write_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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_string_static_t prepend; - - f_color_context_t context; - } fss_basic_list_write_main_t; - - #define fss_basic_list_write_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_string_static_t_initialize, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_basic_list_write_main_t_ +#endif // _di_fss_basic_list_write_parameters_ /** * Deallocate main. @@ -175,7 +205,7 @@ extern "C" { * @see fss_basic_list_write_main() */ #ifndef _di_fss_basic_list_write_main_delete_ - extern f_status_t fss_basic_list_write_main_delete(fss_basic_list_write_main_t * const main); + extern f_status_t fss_basic_list_write_main_delete(fll_program_data_t * const main); #endif // _di_fss_basic_list_write_main_delete_ #ifdef __cplusplus 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 2203649..13aec61 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,15 +6,6 @@ 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_initialize(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_initialize(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_initialize(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) { @@ -66,7 +57,7 @@ extern "C" { #endif // _di_fss_basic_list_write_print_help_ #ifndef _di_fss_basic_list_write_main_ - f_status_t fss_basic_list_write_main(fss_basic_list_write_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_basic_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -78,7 +69,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_basic_list_write_parameter_no_color_e, fss_basic_list_write_parameter_light_e, fss_basic_list_write_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; 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 dc1b8fb..ce37b35 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 @@ -88,7 +88,7 @@ extern "C" { * @see fss_basic_list_write_main_delete() */ #ifndef _di_fss_basic_list_write_main_ - extern f_status_t fss_basic_list_write_main(fss_basic_list_write_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_basic_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_basic_list_write_main_ #ifdef __cplusplus diff --git a/level_3/fss_basic_list_write/c/main.c b/level_3/fss_basic_list_write/c/main.c index f847a28..bf62b59 100644 --- a/level_3/fss_basic_list_write/c/main.c +++ b/level_3/fss_basic_list_write/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_basic_list_write_main_t data = fss_basic_list_write_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; 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 94f07d7..c1b3834 100644 --- a/level_3/fss_basic_list_write/c/private-common.c +++ b/level_3/fss_basic_list_write/c/private-common.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fss_basic_list_write_print_signal_received_ - void fss_basic_list_write_print_signal_received(fss_basic_list_write_main_t * const main, const f_status_t signal) { + void fss_basic_list_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -24,7 +24,7 @@ extern "C" { #endif // _di_fss_basic_list_write_print_signal_received_ #ifndef _di_fss_basic_list_write_signal_received_ - f_status_t fss_basic_list_write_signal_received(fss_basic_list_write_main_t * const main) { + f_status_t fss_basic_list_write_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_basic_list_write/c/private-common.h b/level_3/fss_basic_list_write/c/private-common.h index 0493e91..ebf42c8 100644 --- a/level_3/fss_basic_list_write/c/private-common.h +++ b/level_3/fss_basic_list_write/c/private-common.h @@ -33,7 +33,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_basic_list_write_print_signal_received_ - extern void fss_basic_list_write_print_signal_received(fss_basic_list_write_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_basic_list_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_write_print_signal_received_ /** @@ -51,7 +51,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_basic_list_write_signal_received_ - extern f_status_t fss_basic_list_write_signal_received(fss_basic_list_write_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_write_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_write_signal_received_ #ifdef __cplusplus 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 e8fe783..a16924c 100644 --- a/level_3/fss_basic_list_write/c/private-write.c +++ b/level_3/fss_basic_list_write/c/private-write.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_basic_list_write_error_parameter_same_times_print_ - void fss_basic_list_write_error_parameter_same_times_print(fss_basic_list_write_main_t * const main) { + void fss_basic_list_write_error_parameter_same_times_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -28,7 +28,7 @@ extern "C" { #endif // _di_fss_basic_list_write_error_parameter_same_times_print_ #ifndef _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ - void fss_basic_list_write_error_parameter_unsupported_eol_print(fss_basic_list_write_main_t * const main) { + void fss_basic_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -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_static_t symbol, const f_string_static_t parameter) { + void fss_basic_list_write_error_parameter_value_missing_print(fll_program_data_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; @@ -62,7 +62,7 @@ extern "C" { #endif // _di_fss_basic_list_write_error_parameter_value_missing_print_ #ifndef _di_fss_basic_list_write_process_ - f_status_t fss_basic_list_write_process(fss_basic_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) { + f_status_t fss_basic_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_state_t state = macro_f_state_t_initialize(fss_basic_list_write_common_allocation_large_d, fss_basic_list_write_common_allocation_small_d, 0, 0, 0, 0, 0); @@ -136,7 +136,7 @@ extern "C" { #endif // _di_fss_basic_list_write_process_ #ifndef _di_fss_basic_list_write_process_pipe_ - f_status_t fss_basic_list_write_process_pipe(fss_basic_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { + f_status_t fss_basic_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_status_t status_pipe = F_none; 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 d329d56..220962e 100644 --- a/level_3/fss_basic_list_write/c/private-write.h +++ b/level_3/fss_basic_list_write/c/private-write.h @@ -19,7 +19,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_list_write_error_parameter_same_times_print_ - void fss_basic_list_write_error_parameter_same_times_print(fss_basic_list_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_basic_list_write_error_parameter_same_times_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_write_error_parameter_same_times_print_ /** @@ -29,7 +29,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ - void fss_basic_list_write_error_parameter_unsupported_eol_print(fss_basic_list_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_basic_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ /** @@ -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_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; + void fss_basic_list_write_error_parameter_value_missing_print(fll_program_data_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_ /** @@ -70,7 +70,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_basic_list_write_process_ - extern f_status_t fss_basic_list_write_process(fss_basic_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_write_process_ /** @@ -91,7 +91,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_basic_list_write_process_pipe_ - extern f_status_t fss_basic_list_write_process_pipe(fss_basic_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_write_process_pipe_ #ifdef __cplusplus diff --git a/level_3/fss_basic_read/c/common.c b/level_3/fss_basic_read/c/common.c index 00b15d7..bc287cd 100644 --- a/level_3/fss_basic_read/c/common.c +++ b/level_3/fss_basic_read/c/common.c @@ -13,15 +13,48 @@ extern "C" { const f_string_static_t fss_basic_read_program_name_long_s = macro_f_string_static_t_initialize(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_main_delete_ - f_status_t fss_basic_read_main_delete(fss_basic_read_main_t * const main) { - - f_console_parameters_delete(&main->parameters); +#ifndef _di_fss_basic_read_defines_ + const f_string_static_t fss_basic_read_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_pipe_content_end_s, 0, FSS_BASIC_READ_pipe_content_end_s_length); + const f_string_static_t fss_basic_read_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_pipe_content_ignore_s, 0, FSS_BASIC_READ_pipe_content_ignore_s_length); + const f_string_static_t fss_basic_read_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_pipe_content_start_s, 0, FSS_BASIC_READ_pipe_content_start_s_length); +#endif // _di_fss_basic_read_defines_ + +#ifndef _di_fss_basic_read_parameters_ + const f_string_static_t fss_basic_read_short_at_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_at_s, 0, FSS_BASIC_READ_short_at_s_length); + const f_string_static_t fss_basic_read_short_content_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_content_s, 0, FSS_BASIC_READ_short_content_s_length); + const f_string_static_t fss_basic_read_short_columns_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_columns_s, 0, FSS_BASIC_READ_short_columns_s_length); + const f_string_static_t fss_basic_read_short_delimit_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_delimit_s, 0, FSS_BASIC_READ_short_delimit_s_length); + const f_string_static_t fss_basic_read_short_depth_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_depth_s, 0, FSS_BASIC_READ_short_depth_s_length); + const f_string_static_t fss_basic_read_short_empty_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_empty_s, 0, FSS_BASIC_READ_short_empty_s_length); + const f_string_static_t fss_basic_read_short_line_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_line_s, 0, FSS_BASIC_READ_short_line_s_length); + const f_string_static_t fss_basic_read_short_name_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_name_s, 0, FSS_BASIC_READ_short_name_s_length); + const f_string_static_t fss_basic_read_short_object_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_object_s, 0, FSS_BASIC_READ_short_object_s_length); + const f_string_static_t fss_basic_read_short_pipe_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_pipe_s, 0, FSS_BASIC_READ_short_pipe_s_length); + const f_string_static_t fss_basic_read_short_raw_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_raw_s, 0, FSS_BASIC_READ_short_raw_s_length); + const f_string_static_t fss_basic_read_short_select_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_select_s, 0, FSS_BASIC_READ_short_select_s_length); + const f_string_static_t fss_basic_read_short_total_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_total_s, 0, FSS_BASIC_READ_short_total_s_length); + const f_string_static_t fss_basic_read_short_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_short_trim_s, 0, FSS_BASIC_READ_short_trim_s_length); + + const f_string_static_t fss_basic_read_long_at_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_at_s, 0, FSS_BASIC_READ_long_at_s_length); + const f_string_static_t fss_basic_read_long_content_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_content_s, 0, FSS_BASIC_READ_long_content_s_length); + const f_string_static_t fss_basic_read_long_columns_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_columns_s, 0, FSS_BASIC_READ_long_columns_s_length); + const f_string_static_t fss_basic_read_long_delimit_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_delimit_s, 0, FSS_BASIC_READ_long_delimit_s_length); + const f_string_static_t fss_basic_read_long_depth_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_depth_s, 0, FSS_BASIC_READ_long_depth_s_length); + const f_string_static_t fss_basic_read_long_empty_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_empty_s, 0, FSS_BASIC_READ_long_empty_s_length); + const f_string_static_t fss_basic_read_long_line_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_line_s, 0, FSS_BASIC_READ_long_line_s_length); + const f_string_static_t fss_basic_read_long_name_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_name_s, 0, FSS_BASIC_READ_long_name_s_length); + const f_string_static_t fss_basic_read_long_object_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_object_s, 0, FSS_BASIC_READ_long_object_s_length); + const f_string_static_t fss_basic_read_long_pipe_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_pipe_s, 0, FSS_BASIC_READ_long_pipe_s_length); + const f_string_static_t fss_basic_read_long_raw_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_raw_s, 0, FSS_BASIC_READ_long_raw_s_length); + const f_string_static_t fss_basic_read_long_select_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_select_s, 0, FSS_BASIC_READ_long_select_s_length); + const f_string_static_t fss_basic_read_long_total_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_total_s, 0, FSS_BASIC_READ_long_total_s_length); + const f_string_static_t fss_basic_read_long_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_trim_s, 0, FSS_BASIC_READ_long_trim_s_length); +#endif // _di_fss_basic_read_parameters_ - f_type_array_lengths_resize(0, &main->remaining); - macro_f_color_context_t_delete_simple(main->context); +#ifndef _di_fss_basic_read_main_delete_ + f_status_t fss_basic_read_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_basic_read_main_delete_ diff --git a/level_3/fss_basic_read/c/common.h b/level_3/fss_basic_read/c/common.h index a157de5..be67b79 100644 --- a/level_3/fss_basic_read/c/common.h +++ b/level_3/fss_basic_read/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_basic_read_program_version_s; #endif // _di_fss_basic_read_program_version_ +/** + * The program name. + */ #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" @@ -53,42 +59,118 @@ extern "C" { extern const f_string_static_t fss_basic_read_program_name_long_s; #endif // _di_fss_basic_read_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_basic_read_defines_ #define fss_basic_read_signal_check_d 10000 - #define fss_basic_read_pipe_content_end_s '\f' - #define fss_basic_read_pipe_content_ignore_s '\v' - #define fss_basic_read_pipe_content_start_s '\b' - - #define fss_basic_read_short_at_s "a" - #define fss_basic_read_short_content_s "c" - #define fss_basic_read_short_columns_s "C" - #define fss_basic_read_short_delimit_s "D" - #define fss_basic_read_short_depth_s "d" - #define fss_basic_read_short_empty_s "e" - #define fss_basic_read_short_line_s "l" - #define fss_basic_read_short_name_s "n" - #define fss_basic_read_short_object_s "o" - #define fss_basic_read_short_pipe_s "p" - #define fss_basic_read_short_raw_s "R" - #define fss_basic_read_short_select_s "s" - #define fss_basic_read_short_total_s "t" - #define fss_basic_read_short_trim_s "T" - - #define fss_basic_read_long_at_s "at" - #define fss_basic_read_long_content_s "content" - #define fss_basic_read_long_columns_s "columns" - #define fss_basic_read_long_delimit_s "delimit" - #define fss_basic_read_long_depth_s "depth" - #define fss_basic_read_long_empty_s "empty" - #define fss_basic_read_long_line_s "line" - #define fss_basic_read_long_name_s "name" - #define fss_basic_read_long_object_s "object" - #define fss_basic_read_long_pipe_s "pipe" - #define fss_basic_read_long_raw_s "raw" - #define fss_basic_read_long_select_s "select" - #define fss_basic_read_long_total_s "total" - #define fss_basic_read_long_trim_s "trim" + #define FSS_BASIC_READ_pipe_content_end_s "\f" + #define FSS_BASIC_READ_pipe_content_ignore_s "\v" + #define FSS_BASIC_READ_pipe_content_start_s "\b" + + #define FSS_BASIC_READ_pipe_content_end_s_length 1 + #define FSS_BASIC_READ_pipe_content_ignore_s_length 1 + #define FSS_BASIC_READ_pipe_content_start_s_length 1 + + extern const f_string_static_t fss_basic_read_pipe_content_end_s; + extern const f_string_static_t fss_basic_read_pipe_content_ignore_s; + extern const f_string_static_t fss_basic_read_pipe_content_start_s; +#endif // _di_fss_basic_read_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_fss_basic_read_parameters_ + #define FSS_BASIC_READ_short_at_s "a" + #define FSS_BASIC_READ_short_content_s "c" + #define FSS_BASIC_READ_short_columns_s "C" + #define FSS_BASIC_READ_short_delimit_s "D" + #define FSS_BASIC_READ_short_depth_s "d" + #define FSS_BASIC_READ_short_empty_s "e" + #define FSS_BASIC_READ_short_line_s "l" + #define FSS_BASIC_READ_short_name_s "n" + #define FSS_BASIC_READ_short_object_s "o" + #define FSS_BASIC_READ_short_pipe_s "p" + #define FSS_BASIC_READ_short_raw_s "R" + #define FSS_BASIC_READ_short_select_s "s" + #define FSS_BASIC_READ_short_total_s "t" + #define FSS_BASIC_READ_short_trim_s "T" + + #define FSS_BASIC_READ_long_at_s "at" + #define FSS_BASIC_READ_long_content_s "content" + #define FSS_BASIC_READ_long_columns_s "columns" + #define FSS_BASIC_READ_long_delimit_s "delimit" + #define FSS_BASIC_READ_long_depth_s "depth" + #define FSS_BASIC_READ_long_empty_s "empty" + #define FSS_BASIC_READ_long_line_s "line" + #define FSS_BASIC_READ_long_name_s "name" + #define FSS_BASIC_READ_long_object_s "object" + #define FSS_BASIC_READ_long_pipe_s "pipe" + #define FSS_BASIC_READ_long_raw_s "raw" + #define FSS_BASIC_READ_long_select_s "select" + #define FSS_BASIC_READ_long_total_s "total" + #define FSS_BASIC_READ_long_trim_s "trim" + + #define FSS_BASIC_READ_short_at_s_length 1 + #define FSS_BASIC_READ_short_content_s_length 1 + #define FSS_BASIC_READ_short_columns_s_length 1 + #define FSS_BASIC_READ_short_delimit_s_length 1 + #define FSS_BASIC_READ_short_depth_s_length 1 + #define FSS_BASIC_READ_short_empty_s_length 1 + #define FSS_BASIC_READ_short_line_s_length 1 + #define FSS_BASIC_READ_short_name_s_length 1 + #define FSS_BASIC_READ_short_object_s_length 1 + #define FSS_BASIC_READ_short_pipe_s_length 1 + #define FSS_BASIC_READ_short_raw_s_length 1 + #define FSS_BASIC_READ_short_select_s_length 1 + #define FSS_BASIC_READ_short_total_s_length 1 + #define FSS_BASIC_READ_short_trim_s_length 1 + + #define FSS_BASIC_READ_long_at_s_length 2 + #define FSS_BASIC_READ_long_content_s_length 7 + #define FSS_BASIC_READ_long_columns_s_length 7 + #define FSS_BASIC_READ_long_delimit_s_length 7 + #define FSS_BASIC_READ_long_depth_s_length 5 + #define FSS_BASIC_READ_long_empty_s_length 5 + #define FSS_BASIC_READ_long_line_s_length 4 + #define FSS_BASIC_READ_long_name_s_length 4 + #define FSS_BASIC_READ_long_object_s_length 6 + #define FSS_BASIC_READ_long_pipe_s_length 4 + #define FSS_BASIC_READ_long_raw_s_length 3 + #define FSS_BASIC_READ_long_select_s_length 6 + #define FSS_BASIC_READ_long_total_s_length 5 + #define FSS_BASIC_READ_long_trim_s_length 4 + + extern const f_string_static_t fss_basic_read_short_at_s; + extern const f_string_static_t fss_basic_read_short_content_s; + extern const f_string_static_t fss_basic_read_short_columns_s; + extern const f_string_static_t fss_basic_read_short_delimit_s; + extern const f_string_static_t fss_basic_read_short_depth_s; + extern const f_string_static_t fss_basic_read_short_empty_s; + extern const f_string_static_t fss_basic_read_short_line_s; + extern const f_string_static_t fss_basic_read_short_name_s; + extern const f_string_static_t fss_basic_read_short_object_s; + extern const f_string_static_t fss_basic_read_short_pipe_s; + extern const f_string_static_t fss_basic_read_short_raw_s; + extern const f_string_static_t fss_basic_read_short_select_s; + extern const f_string_static_t fss_basic_read_short_total_s; + extern const f_string_static_t fss_basic_read_short_trim_s; + + extern const f_string_static_t fss_basic_read_long_at_s; + extern const f_string_static_t fss_basic_read_long_content_s; + extern const f_string_static_t fss_basic_read_long_columns_s; + extern const f_string_static_t fss_basic_read_long_delimit_s; + extern const f_string_static_t fss_basic_read_long_depth_s; + extern const f_string_static_t fss_basic_read_long_empty_s; + extern const f_string_static_t fss_basic_read_long_line_s; + extern const f_string_static_t fss_basic_read_long_name_s; + extern const f_string_static_t fss_basic_read_long_object_s; + extern const f_string_static_t fss_basic_read_long_pipe_s; + extern const f_string_static_t fss_basic_read_long_raw_s; + extern const f_string_static_t fss_basic_read_long_select_s; + extern const f_string_static_t fss_basic_read_long_total_s; + extern const f_string_static_t fss_basic_read_long_trim_s; enum { fss_basic_read_parameter_help_e, @@ -128,24 +210,24 @@ extern "C" { 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(fss_basic_read_short_at_s, fss_basic_read_long_at_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_content_s, fss_basic_read_long_content_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_columns_s, fss_basic_read_long_columns_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_delimit_s, fss_basic_read_long_delimit_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_depth_s, fss_basic_read_long_depth_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_empty_s, fss_basic_read_long_empty_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_line_s, fss_basic_read_long_line_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_name_s, fss_basic_read_long_name_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_object_s, fss_basic_read_long_object_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_pipe_s, fss_basic_read_long_pipe_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_raw_s, fss_basic_read_long_raw_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_select_s, fss_basic_read_long_select_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_total_s, fss_basic_read_long_total_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_read_short_trim_s, fss_basic_read_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_at_s.string, fss_basic_read_long_at_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_content_s.string, fss_basic_read_long_content_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_columns_s.string, fss_basic_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_delimit_s.string, fss_basic_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_depth_s.string, fss_basic_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_empty_s.string, fss_basic_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_line_s.string, fss_basic_read_long_line_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_name_s.string, fss_basic_read_long_name_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_object_s.string, fss_basic_read_long_object_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_pipe_s.string, fss_basic_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_raw_s.string, fss_basic_read_long_raw_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_select_s.string, fss_basic_read_long_select_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_total_s.string, fss_basic_read_long_total_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_read_short_trim_s.string, fss_basic_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_basic_read_total_parameters_d 23 -#endif // _di_fss_basic_read_defines_ +#endif // _di_fss_basic_read_parameters_ /** * FSS Delimit Parameter data. @@ -186,35 +268,6 @@ extern "C" { }; #endif // _di_fss_basic_read_delimit_modes_ -#ifndef _di_fss_basic_read_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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; - } fss_basic_read_main_t; - - #define fss_basic_read_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_basic_read_main_t_ - /** * Deallocate main. * @@ -231,7 +284,7 @@ extern "C" { * @see fss_basic_read_main() */ #ifndef _di_fss_basic_read_main_delete_ - extern f_status_t fss_basic_read_main_delete(fss_basic_read_main_t * const main); + extern f_status_t fss_basic_read_main_delete(fll_program_data_t * const main); #endif // _di_fss_basic_read_main_delete_ #ifdef __cplusplus 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 a6ab074..f687e15 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -7,15 +7,6 @@ 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_initialize(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_initialize(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_initialize(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) { @@ -50,7 +41,7 @@ extern "C" { 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)"); + fll_program_print_help_usage(file, context, fss_basic_read_program_name_s, fll_program_parameter_filenames_s); fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s); @@ -127,7 +118,7 @@ extern "C" { #endif // _di_fss_basic_read_print_help_ #ifndef _di_fss_basic_read_main_ - f_status_t fss_basic_read_main(fss_basic_read_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_basic_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -139,7 +130,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_basic_read_parameter_no_color_e, fss_basic_read_parameter_light_e, fss_basic_read_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -225,17 +216,17 @@ extern "C" { } // Provide a range designating where within the buffer a particular file exists, using a statically allocated array. - fss_basic_read_file_t files_array[main->remaining.used + 1]; + fss_basic_read_file_t files_array[main->parameters.remaining.used + 1]; fss_basic_read_data_t data = fss_basic_read_data_t_initialize; data.files.array = files_array; data.files.used = 1; - data.files.size = main->remaining.used + 1; + data.files.size = main->parameters.remaining.used + 1; data.files.array[0].name = "(pipe)"; data.files.array[0].range.start = 1; data.files.array[0].range.stop = 0; - if (main->remaining.used || main->process_pipe) { + if (main->parameters.remaining.used || main->process_pipe) { { const f_array_length_t parameter_code[] = { fss_basic_read_parameter_at_e, @@ -561,11 +552,11 @@ extern "C" { } } - if (F_status_is_error_not(status) && main->remaining.used > 0) { + if (F_status_is_error_not(status) && main->parameters.remaining.used > 0) { f_file_t file = f_file_t_initialize; f_array_length_t size_file = 0; - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (fss_basic_read_signal_received(main)) { status = F_status_set_error(F_signal); @@ -576,10 +567,10 @@ extern "C" { file.stream = 0; file.id = -1; - status = f_file_stream_open(arguments->argv[main->remaining.array[i]], 0, &file); + status = f_file_stream_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); break; } @@ -588,7 +579,7 @@ extern "C" { status = f_file_size_by_id(file.id, &size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -597,7 +588,7 @@ extern "C" { status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -605,13 +596,13 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } if (data.buffer.used > data.files.array[data.files.used].range.start) { - data.files.array[data.files.used].name = arguments->argv[main->remaining.array[i]]; + data.files.array[data.files.used].name = arguments->argv[main->parameters.remaining.array[i]]; data.files.array[data.files.used++].range.stop = data.buffer.used - 1; // This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter. 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 fb2b822..a11835d 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.h +++ b/level_3/fss_basic_read/c/fss_basic_read.h @@ -7,7 +7,7 @@ * * This is the FSS Basic Read program * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the fss_basic_read_main_t. + * This program processes files or other input in fss format and stores the results in the fll_program_data_t. * * This processes in accordance to the FSS-0000 Basic specification. */ @@ -96,7 +96,7 @@ extern "C" { * @see fss_basic_read_main_delete() */ #ifndef _di_fss_basic_read_main_ - extern f_status_t fss_basic_read_main(fss_basic_read_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_basic_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_basic_read_main_ #ifdef __cplusplus diff --git a/level_3/fss_basic_read/c/main.c b/level_3/fss_basic_read/c/main.c index 38a29b1..79d532f 100644 --- a/level_3/fss_basic_read/c/main.c +++ b/level_3/fss_basic_read/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { f_console_arguments_t arguments = { argc, argv }; - fss_basic_read_main_t data = fss_basic_read_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/fss_basic_read/c/private-common.c b/level_3/fss_basic_read/c/private-common.c index 0dcd5e2..1961d07 100644 --- a/level_3/fss_basic_read/c/private-common.c +++ b/level_3/fss_basic_read/c/private-common.c @@ -57,7 +57,7 @@ extern "C" { #endif // _di_fss_basic_read_depths_resize_ #ifndef _di_fss_basic_read_print_signal_received_ - void fss_basic_read_print_signal_received(fss_basic_read_main_t * const main, const f_status_t signal) { + void fss_basic_read_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -75,7 +75,7 @@ extern "C" { #endif // _di_fss_basic_read_print_signal_received_ #ifndef _di_fss_basic_read_signal_received_ - f_status_t fss_basic_read_signal_received(fss_basic_read_main_t * const main) { + f_status_t fss_basic_read_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_basic_read/c/private-common.h b/level_3/fss_basic_read/c/private-common.h index 3ce37ce..8cc0c37 100644 --- a/level_3/fss_basic_read/c/private-common.h +++ b/level_3/fss_basic_read/c/private-common.h @@ -252,7 +252,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_basic_read_print_signal_received_ - extern void fss_basic_read_print_signal_received(fss_basic_read_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_basic_read_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_print_signal_received_ /** @@ -270,7 +270,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_basic_read_signal_received_ - extern f_status_t fss_basic_read_signal_received(fss_basic_read_main_t * const main); + extern f_status_t fss_basic_read_signal_received(fll_program_data_t * const main); #endif // _di_fss_basic_read_signal_received_ #ifdef __cplusplus diff --git a/level_3/fss_basic_read/c/private-print.c b/level_3/fss_basic_read/c/private-print.c index 1f74fcb..7b406c9 100644 --- a/level_3/fss_basic_read/c/private-print.c +++ b/level_3/fss_basic_read/c/private-print.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_basic_read_print_at_ - void fss_basic_read_print_at(fss_basic_read_main_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_read_data_t * const data) { + void fss_basic_read_print_at(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_read_data_t * const data) { if (at >= data->contents.used) { return; @@ -72,7 +72,7 @@ extern "C" { #endif // _di_fss_basic_read_print_at_ #ifndef _di_fss_basic_read_print_object_end_ - void fss_basic_read_print_object_end(fss_basic_read_main_t * const main) { + void fss_basic_read_print_object_end(fll_program_data_t * const main) { if (main->parameters.array[fss_basic_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_basic_read_pipe_content_start_s, main->output.to.stream); @@ -84,7 +84,7 @@ extern "C" { #endif // _di_fss_basic_read_print_object_end_ #ifndef _di_fss_basic_read_print_one_ - void fss_basic_read_print_one(fss_basic_read_main_t * const main) { + void fss_basic_read_print_one(fll_program_data_t * const main) { f_print_character(f_string_ascii_1_s.string[0], main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); @@ -92,7 +92,7 @@ extern "C" { #endif // _di_fss_basic_read_print_one_ #ifndef _di_fss_basic_read_print_set_end_ - void fss_basic_read_print_set_end(fss_basic_read_main_t * const main) { + void fss_basic_read_print_set_end(fll_program_data_t * const main) { if (main->parameters.array[fss_basic_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_basic_read_pipe_content_end_s, main->output.to.stream); @@ -104,7 +104,7 @@ extern "C" { #endif // _di_fss_basic_read_print_set_end_ #ifndef _di_fss_basic_read_print_zero_ - void fss_basic_read_print_zero(fss_basic_read_main_t * const main) { + void fss_basic_read_print_zero(fll_program_data_t * const main) { f_print_character(f_string_ascii_0_s.string[0], main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); diff --git a/level_3/fss_basic_read/c/private-print.h b/level_3/fss_basic_read/c/private-print.h index 5ac0017..2f6941a 100644 --- a/level_3/fss_basic_read/c/private-print.h +++ b/level_3/fss_basic_read/c/private-print.h @@ -29,7 +29,7 @@ extern "C" { * The program data. */ #ifndef _di_fss_basic_read_print_at_ - extern void fss_basic_read_print_at(fss_basic_read_main_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_read_data_t * const data) F_attribute_visibility_internal_d; + extern void fss_basic_read_print_at(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_print_at_ /** @@ -39,7 +39,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_read_print_object_end_ - extern void fss_basic_read_print_object_end(fss_basic_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_basic_read_print_object_end(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_print_object_end_ /** @@ -49,7 +49,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_read_print_one_ - extern void fss_basic_read_print_one(fss_basic_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_basic_read_print_one(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_print_one_ /** @@ -59,7 +59,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_read_print_set_end_ - extern void fss_basic_read_print_set_end(fss_basic_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_basic_read_print_set_end(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_print_set_end_ /** @@ -69,7 +69,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_read_print_zero_ - extern void fss_basic_read_print_zero(fss_basic_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_basic_read_print_zero(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_print_zero_ #ifdef __cplusplus diff --git a/level_3/fss_basic_read/c/private-read.c b/level_3/fss_basic_read/c/private-read.c index d69cdc4..3089404 100644 --- a/level_3/fss_basic_read/c/private-read.c +++ b/level_3/fss_basic_read/c/private-read.c @@ -33,7 +33,7 @@ extern "C" { #endif // _di_fss_basic_read_delimit_object_is_ #ifndef _di_fss_basic_read_depth_process_ - f_status_t fss_basic_read_depth_process(fss_basic_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) { + f_status_t fss_basic_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) { f_status_t status = F_none; @@ -213,7 +213,7 @@ extern "C" { #endif // _di_fss_basic_read_file_identify_ #ifndef _di_fss_basic_read_load_ - f_status_t fss_basic_read_load(fss_basic_read_main_t * const main, fss_basic_read_data_t *data) { + f_status_t fss_basic_read_load(fll_program_data_t * const main, fss_basic_read_data_t *data) { f_state_t state = macro_f_state_t_initialize(fss_basic_read_common_allocation_large_d, fss_basic_read_delimit_common_allocation_small_d, 0, 0, 0, 0, 0); f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used); @@ -246,7 +246,7 @@ extern "C" { #endif // _di_fss_basic_read_load_ #ifndef _di_fss_basic_read_load_number_ - f_status_t fss_basic_read_load_number(fss_basic_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) { + f_status_t fss_basic_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; @@ -268,7 +268,7 @@ extern "C" { #endif // _di_fss_basic_read_load_number_ #ifndef _di_fss_basic_read_process_ - f_status_t fss_basic_read_process(fss_basic_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) { + f_status_t fss_basic_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) { f_status_t status = fss_basic_read_process_option(main, arguments, data); if (F_status_is_error(status)) return status; @@ -325,7 +325,7 @@ extern "C" { #endif // _di_fss_basic_read_process_ #ifndef _di_fss_basic_read_process_at_ - f_status_t fss_basic_read_process_at(fss_basic_read_main_t * const main, fss_basic_read_data_t *data, bool names[]) { + f_status_t fss_basic_read_process_at(fll_program_data_t * const main, fss_basic_read_data_t *data, bool names[]) { if (data->depths.array[0].value_at >= data->objects.used) { if (data->option & (fss_basic_read_data_option_columns_d | fss_basic_read_data_option_total_d)) { @@ -422,7 +422,7 @@ extern "C" { #endif // _di_fss_basic_read_process_at_ #ifndef _di_fss_basic_read_process_columns_ - f_status_t fss_basic_read_process_columns(fss_basic_read_main_t * const main, fss_basic_read_data_t *data, bool names[]) { + f_status_t fss_basic_read_process_columns(fll_program_data_t * const main, fss_basic_read_data_t *data, bool names[]) { if (!(data->option & fss_basic_read_data_option_content_d)) { flockfile(main->output.to.stream); @@ -456,7 +456,7 @@ extern "C" { #endif // _di_fss_basic_read_process_columns_ #ifndef _di_fss_basic_read_process_line_ - f_status_t fss_basic_read_process_line(fss_basic_read_main_t * const main, fss_basic_read_data_t *data, bool names[]) { + f_status_t fss_basic_read_process_line(fll_program_data_t * const main, fss_basic_read_data_t *data, bool names[]) { f_array_lengths_t except_none = f_array_lengths_t_initialize; f_array_lengths_t *delimits = fss_basic_read_delimit_object_is(0, data) ? &data->delimits : &except_none; @@ -540,7 +540,7 @@ extern "C" { #endif // _di_fss_basic_read_process_name_ #ifndef _di_fss_basic_read_process_option_ - f_status_t fss_basic_read_process_option(fss_basic_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) { + f_status_t fss_basic_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) { f_status_t status = F_none; @@ -604,7 +604,7 @@ extern "C" { #endif // _di_fss_basic_read_process_option_ #ifndef _di_fss_basic_read_process_total_ - f_status_t fss_basic_read_process_total(fss_basic_read_main_t * const main, fss_basic_read_data_t *data, bool names[]) { + f_status_t fss_basic_read_process_total(fll_program_data_t * const main, fss_basic_read_data_t *data, bool names[]) { f_array_length_t total = 0; diff --git a/level_3/fss_basic_read/c/private-read.h b/level_3/fss_basic_read/c/private-read.h index 0859834..b85bbc9 100644 --- a/level_3/fss_basic_read/c/private-read.h +++ b/level_3/fss_basic_read/c/private-read.h @@ -56,7 +56,7 @@ extern "C" { * @see fss_basic_read_depths_resize() */ #ifndef _di_fss_basic_read_depth_process_ - extern f_status_t fss_basic_read_depth_process(fss_basic_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_depth_process_ /** @@ -100,7 +100,7 @@ extern "C" { * @see fss_basic_read_process_option() */ #ifndef _di_fss_basic_read_load_ - extern f_status_t fss_basic_read_load(fss_basic_read_main_t * const main, fss_basic_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_read_load(fll_program_data_t * const main, fss_basic_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_load_ /** @@ -130,7 +130,7 @@ extern "C" { * @see fss_basic_read_depths_resize() */ #ifndef _di_fss_basic_read_load_number_ - extern f_status_t fss_basic_read_load_number(fss_basic_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_load_number_ /** @@ -155,7 +155,7 @@ extern "C" { * @see fss_basic_read_process_option() */ #ifndef _di_fss_basic_read_process_ - extern f_status_t fss_basic_read_process(fss_basic_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_process_ /** @@ -173,7 +173,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_read_process_at_ - extern f_status_t fss_basic_read_process_at(fss_basic_read_main_t * const main, fss_basic_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_read_process_at(fll_program_data_t * const main, fss_basic_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_process_at_ /** @@ -191,7 +191,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_read_process_columns_ - extern f_status_t fss_basic_read_process_columns(fss_basic_read_main_t * const main, fss_basic_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_read_process_columns(fll_program_data_t * const main, fss_basic_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_process_columns_ /** @@ -209,7 +209,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_read_process_line_ - extern f_status_t fss_basic_read_process_line(fss_basic_read_main_t * const main, fss_basic_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_read_process_line(fll_program_data_t * const main, fss_basic_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_process_line_ /** @@ -250,7 +250,7 @@ extern "C" { * @see fss_basic_read_load_setting() */ #ifndef _di_fss_basic_read_process_option_ - extern f_status_t fss_basic_read_process_option(fss_basic_read_main_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_process_option_ /** @@ -268,7 +268,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_read_process_total_ - extern f_status_t fss_basic_read_process_total(fss_basic_read_main_t * const main, fss_basic_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_read_process_total(fll_program_data_t * const main, fss_basic_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_read_process_total_ #ifdef __cplusplus diff --git a/level_3/fss_basic_write/c/common.c b/level_3/fss_basic_write/c/common.c index 7dbeed0..14f0638 100644 --- a/level_3/fss_basic_write/c/common.c +++ b/level_3/fss_basic_write/c/common.c @@ -13,16 +13,38 @@ extern "C" { const f_string_static_t fss_basic_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_program_name_long_s, 0, FSS_BASIC_WRITE_program_name_long_s_length); #endif // _di_fss_basic_write_program_name_ -#ifndef _di_fss_basic_write_main_delete_ - f_status_t fss_basic_write_main_delete(fss_basic_write_main_t * const main) { - - f_console_parameters_delete(&main->parameters); +#ifndef _di_fss_basic_write_defines_ + const f_string_static_t fss_basic_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_pipe_content_end_s, 0, FSS_BASIC_WRITE_pipe_content_end_s_length); + const f_string_static_t fss_basic_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_pipe_content_ignore_s, 0, FSS_BASIC_WRITE_pipe_content_ignore_s_length); + const f_string_static_t fss_basic_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_pipe_content_start_s, 0, FSS_BASIC_WRITE_pipe_content_start_s_length); +#endif // _di_fss_basic_write_defines. + +#ifndef _di_fss_basic_write_program_parameters_ + const f_string_static_t fss_basic_write_short_file_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_file_s, 0, FSS_BASIC_WRITE_short_file_s_length); + const f_string_static_t fss_basic_write_short_content_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_content_s, 0, FSS_BASIC_WRITE_short_content_s_length); + const f_string_static_t fss_basic_write_short_double_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_double_s, 0, FSS_BASIC_WRITE_short_double_s_length); + const f_string_static_t fss_basic_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_ignore_s, 0, FSS_BASIC_WRITE_short_ignore_s_length); + const f_string_static_t fss_basic_write_short_object_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_object_s, 0, FSS_BASIC_WRITE_short_object_s_length); + const f_string_static_t fss_basic_write_short_partial_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_partial_s, 0, FSS_BASIC_WRITE_short_partial_s_length); + const f_string_static_t fss_basic_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_prepend_s, 0, FSS_BASIC_WRITE_short_prepend_s_length); + const f_string_static_t fss_basic_write_short_single_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_single_s, 0, FSS_BASIC_WRITE_short_single_s_length); + const f_string_static_t fss_basic_write_short_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_trim_s, 0, FSS_BASIC_WRITE_short_trim_s_length); + + const f_string_static_t fss_basic_write_long_file_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_file_s, 0, FSS_BASIC_WRITE_long_file_s_length); + const f_string_static_t fss_basic_write_long_content_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_content_s, 0, FSS_BASIC_WRITE_long_content_s_length); + const f_string_static_t fss_basic_write_long_double_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_double_s, 0, FSS_BASIC_WRITE_long_double_s_length); + const f_string_static_t fss_basic_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_ignore_s, 0, FSS_BASIC_WRITE_long_ignore_s_length); + const f_string_static_t fss_basic_write_long_object_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_object_s, 0, FSS_BASIC_WRITE_long_object_s_length); + const f_string_static_t fss_basic_write_long_partial_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_partial_s, 0, FSS_BASIC_WRITE_long_partial_s_length); + const f_string_static_t fss_basic_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_prepend_s, 0, FSS_BASIC_WRITE_long_prepend_s_length); + const f_string_static_t fss_basic_write_long_single_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_single_s, 0, FSS_BASIC_WRITE_long_single_s_length); + const f_string_static_t fss_basic_write_long_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_trim_s, 0, FSS_BASIC_WRITE_long_trim_s_length); +#endif // _di_fss_basic_write_program_parameters_ - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); +#ifndef _di_fss_basic_write_main_delete_ + f_status_t fss_basic_write_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_basic_write_main_delete_ diff --git a/level_3/fss_basic_write/c/common.h b/level_3/fss_basic_write/c/common.h index 1704a32..46bc033 100644 --- a/level_3/fss_basic_write/c/common.h +++ b/level_3/fss_basic_write/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_basic_write_program_version_s; #endif // _di_fss_basic_write_program_version_ +/** + * The main program name. + */ #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" @@ -53,32 +59,88 @@ extern "C" { extern const f_string_static_t fss_basic_write_program_name_long_s; #endif // _di_fss_basic_write_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_basic_write_defines_ #define fss_basic_write_signal_check_d 10000 - #define fss_basic_write_pipe_content_end_s '\f' - #define fss_basic_write_pipe_content_ignore_s '\v' - #define fss_basic_write_pipe_content_start_s '\b' - - #define fss_basic_write_short_file_s "f" - #define fss_basic_write_short_content_s "c" - #define fss_basic_write_short_double_s "d" - #define fss_basic_write_short_ignore_s "I" - #define fss_basic_write_short_object_s "o" - #define fss_basic_write_short_partial_s "p" - #define fss_basic_write_short_prepend_s "P" - #define fss_basic_write_short_single_s "s" - #define fss_basic_write_short_trim_s "T" - - #define fss_basic_write_long_file_s "file" - #define fss_basic_write_long_content_s "content" - #define fss_basic_write_long_double_s "double" - #define fss_basic_write_long_ignore_s "ignore" - #define fss_basic_write_long_object_s "object" - #define fss_basic_write_long_partial_s "partial" - #define fss_basic_write_long_prepend_s "prepend" - #define fss_basic_write_long_single_s "single" - #define fss_basic_write_long_trim_s "trim" + #define FSS_BASIC_WRITE_pipe_content_end_s "\f" + #define FSS_BASIC_WRITE_pipe_content_ignore_s "\v" + #define FSS_BASIC_WRITE_pipe_content_start_s "\b" + + #define FSS_BASIC_WRITE_pipe_content_end_s_length 1 + #define FSS_BASIC_WRITE_pipe_content_ignore_s_length 1 + #define FSS_BASIC_WRITE_pipe_content_start_s_length 1 + + extern const f_string_static_t fss_basic_write_pipe_content_end_s; + extern const f_string_static_t fss_basic_write_pipe_content_ignore_s; + extern const f_string_static_t fss_basic_write_pipe_content_start_s; +#endif // _di_fss_basic_write_defines. + +/** + * The main program parameters. + */ +#ifndef _di_fss_basic_write_parameters_ + #define FSS_BASIC_WRITE_short_file_s "f" + #define FSS_BASIC_WRITE_short_content_s "c" + #define FSS_BASIC_WRITE_short_double_s "d" + #define FSS_BASIC_WRITE_short_ignore_s "I" + #define FSS_BASIC_WRITE_short_object_s "o" + #define FSS_BASIC_WRITE_short_partial_s "p" + #define FSS_BASIC_WRITE_short_prepend_s "P" + #define FSS_BASIC_WRITE_short_single_s "s" + #define FSS_BASIC_WRITE_short_trim_s "T" + + #define FSS_BASIC_WRITE_long_file_s "file" + #define FSS_BASIC_WRITE_long_content_s "content" + #define FSS_BASIC_WRITE_long_double_s "double" + #define FSS_BASIC_WRITE_long_ignore_s "ignore" + #define FSS_BASIC_WRITE_long_object_s "object" + #define FSS_BASIC_WRITE_long_partial_s "partial" + #define FSS_BASIC_WRITE_long_prepend_s "prepend" + #define FSS_BASIC_WRITE_long_single_s "single" + #define FSS_BASIC_WRITE_long_trim_s "trim" + + #define FSS_BASIC_WRITE_short_file_s_length 1 + #define FSS_BASIC_WRITE_short_content_s_length 1 + #define FSS_BASIC_WRITE_short_double_s_length 1 + #define FSS_BASIC_WRITE_short_ignore_s_length 1 + #define FSS_BASIC_WRITE_short_object_s_length 1 + #define FSS_BASIC_WRITE_short_partial_s_length 1 + #define FSS_BASIC_WRITE_short_prepend_s_length 1 + #define FSS_BASIC_WRITE_short_single_s_length 1 + #define FSS_BASIC_WRITE_short_trim_s_length 1 + + #define FSS_BASIC_WRITE_long_file_s_length 4 + #define FSS_BASIC_WRITE_long_content_s_length 7 + #define FSS_BASIC_WRITE_long_double_s_length 6 + #define FSS_BASIC_WRITE_long_ignore_s_length 6 + #define FSS_BASIC_WRITE_long_object_s_length 6 + #define FSS_BASIC_WRITE_long_partial_s_length 7 + #define FSS_BASIC_WRITE_long_prepend_s_length 7 + #define FSS_BASIC_WRITE_long_single_s_length 6 + #define FSS_BASIC_WRITE_long_trim_s_length 4 + + extern const f_string_static_t fss_basic_write_short_file_s; + extern const f_string_static_t fss_basic_write_short_content_s; + extern const f_string_static_t fss_basic_write_short_double_s; + extern const f_string_static_t fss_basic_write_short_ignore_s; + extern const f_string_static_t fss_basic_write_short_object_s; + extern const f_string_static_t fss_basic_write_short_partial_s; + extern const f_string_static_t fss_basic_write_short_prepend_s; + extern const f_string_static_t fss_basic_write_short_single_s; + extern const f_string_static_t fss_basic_write_short_trim_s; + + extern const f_string_static_t fss_basic_write_long_file_s; + extern const f_string_static_t fss_basic_write_long_content_s; + extern const f_string_static_t fss_basic_write_long_double_s; + extern const f_string_static_t fss_basic_write_long_ignore_s; + extern const f_string_static_t fss_basic_write_long_object_s; + extern const f_string_static_t fss_basic_write_long_partial_s; + extern const f_string_static_t fss_basic_write_long_prepend_s; + extern const f_string_static_t fss_basic_write_long_single_s; + extern const f_string_static_t fss_basic_write_long_trim_s; enum { fss_basic_write_parameter_help_e, @@ -113,48 +175,19 @@ extern "C" { 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(fss_basic_write_short_file_s, fss_basic_write_long_file_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_write_short_content_s, fss_basic_write_long_content_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_write_short_double_s, fss_basic_write_long_double_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_write_short_ignore_s, fss_basic_write_long_ignore_s, 0, 2, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_write_short_object_s, fss_basic_write_long_object_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_write_short_partial_s, fss_basic_write_long_partial_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_write_short_prepend_s, fss_basic_write_long_prepend_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_write_short_single_s, fss_basic_write_long_single_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_basic_write_short_trim_s, fss_basic_write_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_write_short_file_s.string, fss_basic_write_long_file_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_write_short_content_s.string, fss_basic_write_long_content_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_write_short_double_s.string, fss_basic_write_long_double_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_write_short_ignore_s.string, fss_basic_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_write_short_object_s.string, fss_basic_write_long_object_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_write_short_partial_s.string, fss_basic_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_write_short_prepend_s.string, fss_basic_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_write_short_single_s.string, fss_basic_write_long_single_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_basic_write_short_trim_s.string, fss_basic_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_basic_write_total_parameters_d 18 -#endif // _di_fss_basic_write_defines_ - -#ifndef _di_fss_basic_write_data_ - typedef struct { - f_console_parameters_t parameters; - - 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; - } fss_basic_write_main_t; - - #define fss_basic_write_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_basic_write_data_ +#endif // _di_fss_basic_write_parameters_ /** * Deallocate main. @@ -171,7 +204,7 @@ extern "C" { * @see fss_basic_write_main() */ #ifndef _di_fss_basic_write_main_delete_ - extern f_status_t fss_basic_write_main_delete(fss_basic_write_main_t * const main); + extern f_status_t fss_basic_write_main_delete(fll_program_data_t * const main); #endif // _di_fss_basic_write_main_delete_ #ifdef __cplusplus 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 36236b6..30028a8 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -6,15 +6,6 @@ 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_initialize(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_initialize(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_initialize(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) { @@ -66,7 +57,7 @@ extern "C" { #endif // _di_fss_basic_write_print_help_ #ifndef _di_fss_basic_write_main_ - f_status_t fss_basic_write_main(fss_basic_write_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_basic_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -78,7 +69,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_basic_write_parameter_no_color_e, fss_basic_write_parameter_light_e, fss_basic_write_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; 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 ed2fe64..2246264 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.h +++ b/level_3/fss_basic_write/c/fss_basic_write.h @@ -88,7 +88,7 @@ extern "C" { * @see fss_basic_write_main_delete() */ #ifndef _di_fss_basic_write_main_ - extern f_status_t fss_basic_write_main(fss_basic_write_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_basic_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_basic_write_main_ #ifdef __cplusplus diff --git a/level_3/fss_basic_write/c/main.c b/level_3/fss_basic_write/c/main.c index e1bc3b6..3e7ab46 100644 --- a/level_3/fss_basic_write/c/main.c +++ b/level_3/fss_basic_write/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_basic_write_main_t data = fss_basic_write_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/fss_basic_write/c/private-common.c b/level_3/fss_basic_write/c/private-common.c index 1fd1fad..63c624a 100644 --- a/level_3/fss_basic_write/c/private-common.c +++ b/level_3/fss_basic_write/c/private-common.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fss_basic_write_print_signal_received_ - void fss_basic_write_print_signal_received(fss_basic_write_main_t * const main, const f_status_t signal) { + void fss_basic_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -24,7 +24,7 @@ extern "C" { #endif // _di_fss_basic_write_print_signal_received_ #ifndef _di_fss_basic_write_signal_received_ - f_status_t fss_basic_write_signal_received(fss_basic_write_main_t * const main) { + f_status_t fss_basic_write_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_basic_write/c/private-common.h b/level_3/fss_basic_write/c/private-common.h index 870ad35..2eb6cd7 100644 --- a/level_3/fss_basic_write/c/private-common.h +++ b/level_3/fss_basic_write/c/private-common.h @@ -33,7 +33,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_basic_write_print_signal_received_ - extern void fss_basic_write_print_signal_received(fss_basic_write_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_basic_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_basic_write_print_signal_received_ /** @@ -51,7 +51,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_basic_write_signal_received_ - extern f_status_t fss_basic_write_signal_received(fss_basic_write_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_write_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_write_signal_received_ #ifdef __cplusplus diff --git a/level_3/fss_basic_write/c/private-write.c b/level_3/fss_basic_write/c/private-write.c index 33c49ec..372c673 100644 --- a/level_3/fss_basic_write/c/private-write.c +++ b/level_3/fss_basic_write/c/private-write.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_basic_write_error_parameter_same_times_print_ - void fss_basic_write_error_parameter_same_times_print(fss_basic_write_main_t * const main) { + void fss_basic_write_error_parameter_same_times_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -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_static_t symbol, const f_string_static_t parameter) { + void fss_basic_write_error_parameter_value_missing_print(fll_program_data_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; @@ -45,7 +45,7 @@ extern "C" { #endif // _di_fss_basic_write_error_parameter_value_missing_print_ #ifndef _di_fss_basic_write_error_parameter_unsupported_eol_print_ - void fss_basic_write_error_parameter_unsupported_eol_print(fss_basic_write_main_t * const main) { + void fss_basic_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -62,7 +62,7 @@ extern "C" { #endif // _di_fss_basic_write_error_parameter_unsupported_eol_print_ #ifndef _di_fss_basic_write_process_ - f_status_t fss_basic_write_process(fss_basic_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) { + f_status_t fss_basic_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_state_t state = macro_f_state_t_initialize(fss_basic_write_common_allocation_large_d, fss_basic_write_common_allocation_small_d, 0, 0, 0, 0, 0); @@ -148,7 +148,7 @@ extern "C" { #endif // _di_fss_basic_write_process_ #ifndef _di_fss_basic_write_process_pipe_ - f_status_t fss_basic_write_process_pipe(fss_basic_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { + f_status_t fss_basic_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_status_t status_pipe = F_none; diff --git a/level_3/fss_basic_write/c/private-write.h b/level_3/fss_basic_write/c/private-write.h index fab8ad2..e8c09e4 100644 --- a/level_3/fss_basic_write/c/private-write.h +++ b/level_3/fss_basic_write/c/private-write.h @@ -19,7 +19,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_write_error_parameter_same_times_print_ - void fss_basic_write_error_parameter_same_times_print(fss_basic_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_basic_write_error_parameter_same_times_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_write_error_parameter_same_times_print_ /** @@ -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_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; + void fss_basic_write_error_parameter_value_missing_print(fll_program_data_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_ /** @@ -43,7 +43,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_basic_write_error_parameter_unsupported_eol_print_ - void fss_basic_write_error_parameter_unsupported_eol_print(fss_basic_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_basic_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_write_error_parameter_unsupported_eol_print_ /** @@ -70,7 +70,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_basic_write_process_ - extern f_status_t fss_basic_write_process(fss_basic_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; #endif // _di_fss_basic_write_process_ /** @@ -91,7 +91,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_basic_write_process_pipe_ - extern f_status_t fss_basic_write_process_pipe(fss_basic_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; #endif // _di_fss_basic_write_process_pipe_ /** @@ -109,7 +109,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_basic_write_signal_received_ - extern f_status_t fss_basic_write_signal_received(fss_basic_write_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_write_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_basic_write_signal_received_ #ifdef __cplusplus diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c index e084a68..0d2ff7b 100644 --- a/level_3/fss_embedded_list_read/c/common.c +++ b/level_3/fss_embedded_list_read/c/common.c @@ -13,6 +13,38 @@ extern "C" { const f_string_static_t fss_embedded_list_read_program_name_long_s = macro_f_string_static_t_initialize(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_parameters_ + const f_string_static_t fss_embedded_list_read_short_at_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_at_s, 0, FSS_EMBEDDED_LIST_READ_short_at_s_length); + const f_string_static_t fss_embedded_list_read_short_content_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_content_s, 0, FSS_EMBEDDED_LIST_READ_short_content_s_length); + const f_string_static_t fss_embedded_list_read_short_columns_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_columns_s, 0, FSS_EMBEDDED_LIST_READ_short_columns_s_length); + const f_string_static_t fss_embedded_list_read_short_delimit_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_delimit_s, 0, FSS_EMBEDDED_LIST_READ_short_delimit_s_length); + const f_string_static_t fss_embedded_list_read_short_depth_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_depth_s, 0, FSS_EMBEDDED_LIST_READ_short_depth_s_length); + const f_string_static_t fss_embedded_list_read_short_empty_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_empty_s, 0, FSS_EMBEDDED_LIST_READ_short_empty_s_length); + const f_string_static_t fss_embedded_list_read_short_line_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_line_s, 0, FSS_EMBEDDED_LIST_READ_short_line_s_length); + const f_string_static_t fss_embedded_list_read_short_name_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_name_s, 0, FSS_EMBEDDED_LIST_READ_short_name_s_length); + const f_string_static_t fss_embedded_list_read_short_object_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_object_s, 0, FSS_EMBEDDED_LIST_READ_short_object_s_length); + const f_string_static_t fss_embedded_list_read_short_pipe_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_pipe_s, 0, FSS_EMBEDDED_LIST_READ_short_pipe_s_length); + const f_string_static_t fss_embedded_list_read_short_raw_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_raw_s, 0, FSS_EMBEDDED_LIST_READ_short_raw_s_length); + const f_string_static_t fss_embedded_list_read_short_select_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_select_s, 0, FSS_EMBEDDED_LIST_READ_short_select_s_length); + const f_string_static_t fss_embedded_list_read_short_total_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_total_s, 0, FSS_EMBEDDED_LIST_READ_short_total_s_length); + const f_string_static_t fss_embedded_list_read_short_trim_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_short_trim_s, 0, FSS_EMBEDDED_LIST_READ_short_trim_s_length); + + const f_string_static_t fss_embedded_list_read_long_at_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_at_s, 0, FSS_EMBEDDED_LIST_READ_long_at_s_length); + const f_string_static_t fss_embedded_list_read_long_content_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_content_s, 0, FSS_EMBEDDED_LIST_READ_long_content_s_length); + const f_string_static_t fss_embedded_list_read_long_columns_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_columns_s, 0, FSS_EMBEDDED_LIST_READ_long_columns_s_length); + const f_string_static_t fss_embedded_list_read_long_delimit_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_delimit_s, 0, FSS_EMBEDDED_LIST_READ_long_delimit_s_length); + const f_string_static_t fss_embedded_list_read_long_depth_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_depth_s, 0, FSS_EMBEDDED_LIST_READ_long_depth_s_length); + const f_string_static_t fss_embedded_list_read_long_empty_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_empty_s, 0, FSS_EMBEDDED_LIST_READ_long_empty_s_length); + const f_string_static_t fss_embedded_list_read_long_line_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_line_s, 0, FSS_EMBEDDED_LIST_READ_long_line_s_length); + const f_string_static_t fss_embedded_list_read_long_name_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_name_s, 0, FSS_EMBEDDED_LIST_READ_long_name_s_length); + const f_string_static_t fss_embedded_list_read_long_object_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_object_s, 0, FSS_EMBEDDED_LIST_READ_long_object_s_length); + const f_string_static_t fss_embedded_list_read_long_pipe_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_pipe_s, 0, FSS_EMBEDDED_LIST_READ_long_pipe_s_length); + const f_string_static_t fss_embedded_list_read_long_raw_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_raw_s, 0, FSS_EMBEDDED_LIST_READ_long_raw_s_length); + const f_string_static_t fss_embedded_list_read_long_select_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_select_s, 0, FSS_EMBEDDED_LIST_READ_long_select_s_length); + const f_string_static_t fss_embedded_list_read_long_total_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_total_s, 0, FSS_EMBEDDED_LIST_READ_long_total_s_length); + const f_string_static_t fss_embedded_list_read_long_trim_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_trim_s, 0, FSS_EMBEDDED_LIST_READ_long_trim_s_length); +#endif // _di_fss_embedded_list_read_parameters_ + #ifndef _di_fss_embedded_list_read_main_delete_ f_status_t fss_embedded_list_read_main_delete(fss_embedded_list_read_main_t * const main) { @@ -21,7 +53,6 @@ extern "C" { macro_f_fss_nest_t_delete_simple(main->nest); 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/common.h b/level_3/fss_embedded_list_read/c/common.h index c6e4307..c6ceb65 100644 --- a/level_3/fss_embedded_list_read/c/common.h +++ b/level_3/fss_embedded_list_read/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_embedded_list_read_program_version_s; #endif // _di_fss_embedded_list_read_program_version_ +/** + * The program name. + */ #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" @@ -53,42 +59,118 @@ extern "C" { extern const f_string_static_t fss_embedded_list_read_program_name_long_s; #endif // _di_fss_embedded_list_read_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_embedded_list_read_defines_ #define fss_embedded_list_read_signal_check_d 10000 - #define fss_embedded_list_read_pipe_content_end_s '\f' - #define fss_embedded_list_read_pipe_content_ignore_s '\v' - #define fss_embedded_list_read_pipe_content_start_s '\b' - - #define fss_embedded_list_read_short_at_s "a" - #define fss_embedded_list_read_short_content_s "c" - #define fss_embedded_list_read_short_columns_s "C" - #define fss_embedded_list_read_short_delimit_s "D" - #define fss_embedded_list_read_short_depth_s "d" - #define fss_embedded_list_read_short_empty_s "e" - #define fss_embedded_list_read_short_line_s "l" - #define fss_embedded_list_read_short_name_s "n" - #define fss_embedded_list_read_short_object_s "o" - #define fss_embedded_list_read_short_pipe_s "p" - #define fss_embedded_list_read_short_raw_s "R" - #define fss_embedded_list_read_short_select_s "s" - #define fss_embedded_list_read_short_total_s "t" - #define fss_embedded_list_read_short_trim_s "T" - - #define fss_embedded_list_read_long_at_s "at" - #define fss_embedded_list_read_long_content_s "content" - #define fss_embedded_list_read_long_columns_s "columns" - #define fss_embedded_list_read_long_delimit_s "delimit" - #define fss_embedded_list_read_long_depth_s "depth" - #define fss_embedded_list_read_long_empty_s "empty" - #define fss_embedded_list_read_long_line_s "line" - #define fss_embedded_list_read_long_name_s "name" - #define fss_embedded_list_read_long_object_s "object" - #define fss_embedded_list_read_long_pipe_s "pipe" - #define fss_embedded_list_read_long_raw_s "raw" - #define fss_embedded_list_read_long_select_s "select" - #define fss_embedded_list_read_long_total_s "total" - #define fss_embedded_list_read_long_trim_s "trim" + #define FSS_EMBEDDED_LIST_READ_pipe_content_end_s "\f" + #define FSS_EMBEDDED_LIST_READ_pipe_content_ignore_s "\v" + #define FSS_EMBEDDED_LIST_READ_pipe_content_start_s "\b" + + #define FSS_EMBEDDED_LIST_READ_pipe_content_end_s_length 1 + #define FSS_EMBEDDED_LIST_READ_pipe_content_ignore_s_length 1 + #define FSS_EMBEDDED_LIST_READ_pipe_content_start_s_length 1 + + extern const f_string_static_t fss_embedded_list_read_pipe_content_end_s; + extern const f_string_static_t fss_embedded_list_read_pipe_content_ignore_s; + extern const f_string_static_t fss_embedded_list_read_pipe_content_start_s; +#endif // _di_fss_embedded_list_read_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_fss_embedded_list_read_parameters_ + #define FSS_EMBEDDED_LIST_READ_short_at_s "a" + #define FSS_EMBEDDED_LIST_READ_short_content_s "c" + #define FSS_EMBEDDED_LIST_READ_short_columns_s "C" + #define FSS_EMBEDDED_LIST_READ_short_delimit_s "D" + #define FSS_EMBEDDED_LIST_READ_short_depth_s "d" + #define FSS_EMBEDDED_LIST_READ_short_empty_s "e" + #define FSS_EMBEDDED_LIST_READ_short_line_s "l" + #define FSS_EMBEDDED_LIST_READ_short_name_s "n" + #define FSS_EMBEDDED_LIST_READ_short_object_s "o" + #define FSS_EMBEDDED_LIST_READ_short_pipe_s "p" + #define FSS_EMBEDDED_LIST_READ_short_raw_s "R" + #define FSS_EMBEDDED_LIST_READ_short_select_s "s" + #define FSS_EMBEDDED_LIST_READ_short_total_s "t" + #define FSS_EMBEDDED_LIST_READ_short_trim_s "T" + + #define FSS_EMBEDDED_LIST_READ_long_at_s "at" + #define FSS_EMBEDDED_LIST_READ_long_content_s "content" + #define FSS_EMBEDDED_LIST_READ_long_columns_s "columns" + #define FSS_EMBEDDED_LIST_READ_long_delimit_s "delimit" + #define FSS_EMBEDDED_LIST_READ_long_depth_s "depth" + #define FSS_EMBEDDED_LIST_READ_long_empty_s "empty" + #define FSS_EMBEDDED_LIST_READ_long_line_s "line" + #define FSS_EMBEDDED_LIST_READ_long_name_s "name" + #define FSS_EMBEDDED_LIST_READ_long_object_s "object" + #define FSS_EMBEDDED_LIST_READ_long_pipe_s "pipe" + #define FSS_EMBEDDED_LIST_READ_long_raw_s "raw" + #define FSS_EMBEDDED_LIST_READ_long_select_s "select" + #define FSS_EMBEDDED_LIST_READ_long_total_s "total" + #define FSS_EMBEDDED_LIST_READ_long_trim_s "trim" + + #define FSS_EMBEDDED_LIST_READ_short_at_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_content_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_columns_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_delimit_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_depth_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_empty_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_line_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_name_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_object_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_pipe_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_raw_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_select_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_total_s_length 1 + #define FSS_EMBEDDED_LIST_READ_short_trim_s_length 1 + + #define FSS_EMBEDDED_LIST_READ_long_at_s_length 2 + #define FSS_EMBEDDED_LIST_READ_long_content_s_length 7 + #define FSS_EMBEDDED_LIST_READ_long_columns_s_length 7 + #define FSS_EMBEDDED_LIST_READ_long_delimit_s_length 7 + #define FSS_EMBEDDED_LIST_READ_long_depth_s_length 5 + #define FSS_EMBEDDED_LIST_READ_long_empty_s_length 5 + #define FSS_EMBEDDED_LIST_READ_long_line_s_length 4 + #define FSS_EMBEDDED_LIST_READ_long_name_s_length 4 + #define FSS_EMBEDDED_LIST_READ_long_object_s_length 6 + #define FSS_EMBEDDED_LIST_READ_long_pipe_s_length 4 + #define FSS_EMBEDDED_LIST_READ_long_raw_s_length 3 + #define FSS_EMBEDDED_LIST_READ_long_select_s_length 6 + #define FSS_EMBEDDED_LIST_READ_long_total_s_length 5 + #define FSS_EMBEDDED_LIST_READ_long_trim_s_length 4 + + extern const f_string_static_t fss_embedded_list_read_short_at_s; + extern const f_string_static_t fss_embedded_list_read_short_content_s; + extern const f_string_static_t fss_embedded_list_read_short_columns_s; + extern const f_string_static_t fss_embedded_list_read_short_delimit_s; + extern const f_string_static_t fss_embedded_list_read_short_depth_s; + extern const f_string_static_t fss_embedded_list_read_short_empty_s; + extern const f_string_static_t fss_embedded_list_read_short_line_s; + extern const f_string_static_t fss_embedded_list_read_short_name_s; + extern const f_string_static_t fss_embedded_list_read_short_object_s; + extern const f_string_static_t fss_embedded_list_read_short_pipe_s; + extern const f_string_static_t fss_embedded_list_read_short_raw_s; + extern const f_string_static_t fss_embedded_list_read_short_select_s; + extern const f_string_static_t fss_embedded_list_read_short_total_s; + extern const f_string_static_t fss_embedded_list_read_short_trim_s; + + extern const f_string_static_t fss_embedded_list_read_long_at_s; + extern const f_string_static_t fss_embedded_list_read_long_content_s; + extern const f_string_static_t fss_embedded_list_read_long_columns_s; + extern const f_string_static_t fss_embedded_list_read_long_delimit_s; + extern const f_string_static_t fss_embedded_list_read_long_depth_s; + extern const f_string_static_t fss_embedded_list_read_long_empty_s; + extern const f_string_static_t fss_embedded_list_read_long_line_s; + extern const f_string_static_t fss_embedded_list_read_long_name_s; + extern const f_string_static_t fss_embedded_list_read_long_object_s; + extern const f_string_static_t fss_embedded_list_read_long_pipe_s; + extern const f_string_static_t fss_embedded_list_read_long_raw_s; + extern const f_string_static_t fss_embedded_list_read_long_select_s; + extern const f_string_static_t fss_embedded_list_read_long_total_s; + extern const f_string_static_t fss_embedded_list_read_long_trim_s; enum { fss_embedded_list_read_parameter_help_e, @@ -128,25 +210,28 @@ extern "C" { 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(fss_embedded_list_read_short_at_s, fss_embedded_list_read_long_at_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_content_s, fss_embedded_list_read_long_content_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_columns_s, fss_embedded_list_read_long_columns_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_delimit_s, fss_embedded_list_read_long_delimit_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_depth_s, fss_embedded_list_read_long_depth_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_empty_s, fss_embedded_list_read_long_empty_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_line_s, fss_embedded_list_read_long_line_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_name_s, fss_embedded_list_read_long_name_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_object_s, fss_embedded_list_read_long_object_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_pipe_s, fss_embedded_list_read_long_pipe_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_raw_s, fss_embedded_list_read_long_raw_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_select_s, fss_embedded_list_read_long_select_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_total_s, fss_embedded_list_read_long_total_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_trim_s, fss_embedded_list_read_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_at_s.string, fss_embedded_list_read_long_at_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_content_s.string, fss_embedded_list_read_long_content_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_columns_s.string, fss_embedded_list_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_delimit_s.string, fss_embedded_list_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_depth_s.string, fss_embedded_list_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_empty_s.string, fss_embedded_list_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_line_s.string, fss_embedded_list_read_long_line_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_name_s.string, fss_embedded_list_read_long_name_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_object_s.string, fss_embedded_list_read_long_object_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_pipe_s.string, fss_embedded_list_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_raw_s.string, fss_embedded_list_read_long_raw_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_select_s.string, fss_embedded_list_read_long_select_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_total_s.string, fss_embedded_list_read_long_total_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_trim_s.string, fss_embedded_list_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_embedded_list_read_total_parameters_d 23 -#endif // _di_fss_embedded_list_read_defines_ +#endif // _di_fss_embedded_list_read_parameters_ +/** + * Provide delimit management. + */ #ifndef _di_fss_embedded_list_read_delimit_mode_ #define fss_embedded_list_read_delimit_mode_name_none_s "none" #define fss_embedded_list_read_delimit_mode_name_all_s "all" @@ -167,6 +252,18 @@ extern "C" { }; #endif // _di_fss_embedded_list_read_delimit_modes_ +/** + * The main program data. + * + * parameters: The state of pre-defined parameters passed to the program. + * remaining: The remaining, non-pre-defined parameters, passed to the program. + * process_pipe: Designate whether or not to process the input pipe. + * output: The output file for general printing. + * error: The output file for error printing. + * warning: The output file for warning printing. + * signal: The process signal management structure. + * context: The color context. + */ #ifndef _di_fss_embedded_list_read_main_t_ typedef struct { f_console_parameters_t parameters; 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 f7d2f18..09d713d 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,15 +7,6 @@ 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_initialize(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_initialize(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_initialize(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) { @@ -50,7 +41,7 @@ extern "C" { 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)"); + fll_program_print_help_usage(file, context, fss_embedded_list_read_program_name_s, fll_program_parameter_filenames_s); fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s); @@ -140,7 +131,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_embedded_list_read_parameter_no_color_e, fss_embedded_list_read_parameter_light_e, fss_embedded_list_read_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -240,7 +231,7 @@ extern "C" { } } - if (main->remaining.used > 0 || main->process_pipe) { + if (main->parameters.remaining.used > 0 || main->process_pipe) { if (main->parameters.array[fss_embedded_list_read_parameter_at_e].result == f_console_result_found_e) { flockfile(main->error.to.stream); @@ -449,8 +440,8 @@ extern "C" { f_string_dynamic_resize(0, &main->buffer); } - if (F_status_is_error_not(status) && main->remaining.used > 0) { - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + if (F_status_is_error_not(status) && main->parameters.remaining.used > 0) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (fss_embedded_list_read_signal_received(main)) { status = F_status_set_error(F_interrupt); @@ -459,12 +450,12 @@ extern "C" { f_file_t file = f_file_t_initialize; - status = f_file_open(arguments->argv[main->remaining.array[i]], 0, &file); + status = f_file_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file); main->quantity.total = original_size; if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); break; } @@ -472,7 +463,7 @@ extern "C" { if (!main->quantity.total) { status = f_file_size_by_id(file.id, &main->quantity.total); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); f_file_stream_close(F_true, &file); @@ -496,15 +487,15 @@ extern "C" { f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } - status = fss_embedded_list_read_main_process_file(main, arguments, arguments->argv[main->remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments); + status = fss_embedded_list_read_main_process_file(main, arguments, arguments->argv[main->parameters.remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } diff --git a/level_3/fss_embedded_list_write/c/common.c b/level_3/fss_embedded_list_write/c/common.c index 7e5d00c..30df6b0 100644 --- a/level_3/fss_embedded_list_write/c/common.c +++ b/level_3/fss_embedded_list_write/c/common.c @@ -13,16 +13,38 @@ extern "C" { const f_string_static_t fss_embedded_list_write_program_name_long_s = macro_f_string_static_t_initialize(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_main_delete_ - f_status_t fss_embedded_list_write_main_delete(fss_embedded_list_write_main_t * const main) { - - f_console_parameters_delete(&main->parameters); +#ifndef _di_fss_embedded_list_write_defines_ + const f_string_static_t fss_embedded_list_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_pipe_content_end_s, 0, FSS_EMBEDDED_LIST_WRITE_pipe_content_end_s_length); + const f_string_static_t fss_embedded_list_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_pipe_content_ignore_s, 0, FSS_EMBEDDED_LIST_WRITE_pipe_content_ignore_s_length); + const f_string_static_t fss_embedded_list_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_pipe_content_start_s, 0, FSS_EMBEDDED_LIST_WRITE_pipe_content_start_s_length); +#endif // _di_fss_embedded_list_write_defines_ + +#ifndef _di_fss_embedded_list_write_parameters_ + const f_string_static_t fss_embedded_list_write_short_file_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_file_s, 0, FSS_EMBEDDED_LIST_WRITE_short_file_s_length); + const f_string_static_t fss_embedded_list_write_short_content_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_content_s, 0, FSS_EMBEDDED_LIST_WRITE_short_content_s_length); + const f_string_static_t fss_embedded_list_write_short_double_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_double_s, 0, FSS_EMBEDDED_LIST_WRITE_short_double_s_length); + const f_string_static_t fss_embedded_list_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_ignore_s, 0, FSS_EMBEDDED_LIST_WRITE_short_ignore_s_length); + const f_string_static_t fss_embedded_list_write_short_object_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_object_s, 0, FSS_EMBEDDED_LIST_WRITE_short_object_s_length); + const f_string_static_t fss_embedded_list_write_short_partial_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_partial_s, 0, FSS_EMBEDDED_LIST_WRITE_short_partial_s_length); + const f_string_static_t fss_embedded_list_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_prepend_s, 0, FSS_EMBEDDED_LIST_WRITE_short_prepend_s_length); + const f_string_static_t fss_embedded_list_write_short_single_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_single_s, 0, FSS_EMBEDDED_LIST_WRITE_short_single_s_length); + const f_string_static_t fss_embedded_list_write_short_trim_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_trim_s, 0, FSS_EMBEDDED_LIST_WRITE_short_trim_s_length); + + const f_string_static_t fss_embedded_list_write_long_file_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_file_s, 0, FSS_EMBEDDED_LIST_WRITE_long_file_s_length); + const f_string_static_t fss_embedded_list_write_long_content_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_content_s, 0, FSS_EMBEDDED_LIST_WRITE_long_content_s_length); + const f_string_static_t fss_embedded_list_write_long_double_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_double_s, 0, FSS_EMBEDDED_LIST_WRITE_long_double_s_length); + const f_string_static_t fss_embedded_list_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_ignore_s, 0, FSS_EMBEDDED_LIST_WRITE_long_ignore_s_length); + const f_string_static_t fss_embedded_list_write_long_object_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_object_s, 0, FSS_EMBEDDED_LIST_WRITE_long_object_s_length); + const f_string_static_t fss_embedded_list_write_long_partial_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_partial_s, 0, FSS_EMBEDDED_LIST_WRITE_long_partial_s_length); + const f_string_static_t fss_embedded_list_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_prepend_s, 0, FSS_EMBEDDED_LIST_WRITE_long_prepend_s_length); + const f_string_static_t fss_embedded_list_write_long_single_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_single_s, 0, FSS_EMBEDDED_LIST_WRITE_long_single_s_length); + const f_string_static_t fss_embedded_list_write_long_trim_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_trim_s, 0, FSS_EMBEDDED_LIST_WRITE_long_trim_s_length); +#endif // _di_fss_embedded_list_write_parameters_ - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); +#ifndef _di_fss_embedded_list_write_main_delete_ + f_status_t fss_embedded_list_write_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_embedded_list_write_main_delete_ diff --git a/level_3/fss_embedded_list_write/c/common.h b/level_3/fss_embedded_list_write/c/common.h index 4d09ff3..3234dbf 100644 --- a/level_3/fss_embedded_list_write/c/common.h +++ b/level_3/fss_embedded_list_write/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_embedded_list_write_program_version_s; #endif // _di_fss_embedded_list_write_program_version_ +/** + * The program name. + */ #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" @@ -53,32 +59,88 @@ extern "C" { extern const f_string_static_t fss_embedded_list_write_program_name_long_s; #endif // _di_fss_embedded_list_write_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_embedded_list_write_defines_ #define fss_embedded_list_write_signal_check_d 10000 - #define fss_embedded_list_write_pipe_content_end_s '\f' - #define fss_embedded_list_write_pipe_content_ignore_s '\v' - #define fss_embedded_list_write_pipe_content_start_s '\b' - - #define fss_embedded_list_write_short_file_s "f" - #define fss_embedded_list_write_short_content_s "c" - #define fss_embedded_list_write_short_double_s "d" - #define fss_embedded_list_write_short_ignore_s "I" - #define fss_embedded_list_write_short_object_s "o" - #define fss_embedded_list_write_short_partial_s "p" - #define fss_embedded_list_write_short_prepend_s "P" - #define fss_embedded_list_write_short_single_s "s" - #define fss_embedded_list_write_short_trim_s "T" - - #define fss_embedded_list_write_long_file_s "file" - #define fss_embedded_list_write_long_content_s "content" - #define fss_embedded_list_write_long_double_s "double" - #define fss_embedded_list_write_long_ignore_s "ignore" - #define fss_embedded_list_write_long_object_s "object" - #define fss_embedded_list_write_long_partial_s "partial" - #define fss_embedded_list_write_long_prepend_s "prepend" - #define fss_embedded_list_write_long_single_s "single" - #define fss_embedded_list_write_long_trim_s "trim" + #define FSS_EMBEDDED_LIST_WRITE_pipe_content_end_s "\f" + #define FSS_EMBEDDED_LIST_WRITE_pipe_content_ignore_s "\v" + #define FSS_EMBEDDED_LIST_WRITE_pipe_content_start_s "\b" + + #define FSS_EMBEDDED_LIST_WRITE_pipe_content_end_s_length 1 + #define FSS_EMBEDDED_LIST_WRITE_pipe_content_ignore_s_length 1 + #define FSS_EMBEDDED_LIST_WRITE_pipe_content_start_s_length 1 + + extern const f_string_static_t fss_embedded_list_write_pipe_content_end_s; + extern const f_string_static_t fss_embedded_list_write_pipe_content_ignore_s; + extern const f_string_static_t fss_embedded_list_write_pipe_content_start_s; +#endif // _di_fss_embedded_list_write_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_fss_embedded_list_write_parameters_ + #define FSS_EMBEDDED_LIST_WRITE_short_file_s "f" + #define FSS_EMBEDDED_LIST_WRITE_short_content_s "c" + #define FSS_EMBEDDED_LIST_WRITE_short_double_s "d" + #define FSS_EMBEDDED_LIST_WRITE_short_ignore_s "I" + #define FSS_EMBEDDED_LIST_WRITE_short_object_s "o" + #define FSS_EMBEDDED_LIST_WRITE_short_partial_s "p" + #define FSS_EMBEDDED_LIST_WRITE_short_prepend_s "P" + #define FSS_EMBEDDED_LIST_WRITE_short_single_s "s" + #define FSS_EMBEDDED_LIST_WRITE_short_trim_s "T" + + #define FSS_EMBEDDED_LIST_WRITE_long_file_s "file" + #define FSS_EMBEDDED_LIST_WRITE_long_content_s "content" + #define FSS_EMBEDDED_LIST_WRITE_long_double_s "double" + #define FSS_EMBEDDED_LIST_WRITE_long_ignore_s "ignore" + #define FSS_EMBEDDED_LIST_WRITE_long_object_s "object" + #define FSS_EMBEDDED_LIST_WRITE_long_partial_s "partial" + #define FSS_EMBEDDED_LIST_WRITE_long_prepend_s "prepend" + #define FSS_EMBEDDED_LIST_WRITE_long_single_s "single" + #define FSS_EMBEDDED_LIST_WRITE_long_trim_s "trim" + + #define FSS_EMBEDDED_LIST_WRITE_short_file_s_length 1 + #define FSS_EMBEDDED_LIST_WRITE_short_content_s_length 1 + #define FSS_EMBEDDED_LIST_WRITE_short_double_s_length 1 + #define FSS_EMBEDDED_LIST_WRITE_short_ignore_s_length 1 + #define FSS_EMBEDDED_LIST_WRITE_short_object_s_length 1 + #define FSS_EMBEDDED_LIST_WRITE_short_partial_s_length 1 + #define FSS_EMBEDDED_LIST_WRITE_short_prepend_s_length 1 + #define FSS_EMBEDDED_LIST_WRITE_short_single_s_length 1 + #define FSS_EMBEDDED_LIST_WRITE_short_trim_s_length 1 + + #define FSS_EMBEDDED_LIST_WRITE_long_file_s_length 4 + #define FSS_EMBEDDED_LIST_WRITE_long_content_s_length 7 + #define FSS_EMBEDDED_LIST_WRITE_long_double_s_length 6 + #define FSS_EMBEDDED_LIST_WRITE_long_ignore_s_length 6 + #define FSS_EMBEDDED_LIST_WRITE_long_object_s_length 6 + #define FSS_EMBEDDED_LIST_WRITE_long_partial_s_length 7 + #define FSS_EMBEDDED_LIST_WRITE_long_prepend_s_length 7 + #define FSS_EMBEDDED_LIST_WRITE_long_single_s_length 6 + #define FSS_EMBEDDED_LIST_WRITE_long_trim_s_length 4 + + extern const f_string_static_t fss_embedded_list_write_short_file_s; + extern const f_string_static_t fss_embedded_list_write_short_content_s; + extern const f_string_static_t fss_embedded_list_write_short_double_s; + extern const f_string_static_t fss_embedded_list_write_short_ignore_s; + extern const f_string_static_t fss_embedded_list_write_short_object_s; + extern const f_string_static_t fss_embedded_list_write_short_partial_s; + extern const f_string_static_t fss_embedded_list_write_short_prepend_s; + extern const f_string_static_t fss_embedded_list_write_short_single_s; + extern const f_string_static_t fss_embedded_list_write_short_trim_s; + + extern const f_string_static_t fss_embedded_list_write_long_file_s; + extern const f_string_static_t fss_embedded_list_write_long_content_s; + extern const f_string_static_t fss_embedded_list_write_long_double_s; + extern const f_string_static_t fss_embedded_list_write_long_ignore_s; + extern const f_string_static_t fss_embedded_list_write_long_object_s; + extern const f_string_static_t fss_embedded_list_write_long_partial_s; + extern const f_string_static_t fss_embedded_list_write_long_prepend_s; + extern const f_string_static_t fss_embedded_list_write_long_single_s; + extern const f_string_static_t fss_embedded_list_write_long_trim_s; enum { fss_embedded_list_write_parameter_help_e, @@ -113,51 +175,19 @@ extern "C" { 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(fss_embedded_list_write_short_file_s, fss_embedded_list_write_long_file_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_content_s, fss_embedded_list_write_long_content_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_double_s, fss_embedded_list_write_long_double_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_ignore_s, fss_embedded_list_write_long_ignore_s, 0, 2, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_object_s, fss_embedded_list_write_long_object_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_partial_s, fss_embedded_list_write_long_partial_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_prepend_s, fss_embedded_list_write_long_prepend_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_single_s, fss_embedded_list_write_long_single_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_trim_s, fss_embedded_list_write_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_file_s.string, fss_embedded_list_write_long_file_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_content_s.string, fss_embedded_list_write_long_content_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_double_s.string, fss_embedded_list_write_long_double_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_ignore_s.string, fss_embedded_list_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_object_s.string, fss_embedded_list_write_long_object_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_partial_s.string, fss_embedded_list_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_prepend_s.string, fss_embedded_list_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_single_s.string, fss_embedded_list_write_long_single_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_trim_s.string, fss_embedded_list_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_embedded_list_write_total_parameters_d 18 -#endif // _di_fss_embedded_list_write_defines_ - -#ifndef _di_fss_embedded_list_write_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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_string_static_t prepend; - - f_color_context_t context; - } fss_embedded_list_write_main_t; - - #define fss_embedded_list_write_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_string_static_t_initialize, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_embedded_list_write_main_t_ +#endif // _di_fss_embedded_list_write_parameters_ /** * Deallocate main. @@ -175,7 +205,7 @@ extern "C" { * @see fss_embedded_list_write_main() */ #ifndef _di_fss_embedded_list_write_main_delete_ - extern f_status_t fss_embedded_list_write_main_delete(fss_embedded_list_write_main_t * const main); + extern f_status_t fss_embedded_list_write_main_delete(fll_program_data_t * const main); #endif // _di_fss_embedded_list_write_main_delete_ #ifdef __cplusplus 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 7cccab6..7630190 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,15 +6,6 @@ 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_initialize(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_initialize(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_initialize(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) { @@ -69,7 +60,7 @@ extern "C" { #endif // _di_fss_embedded_list_write_print_help_ #ifndef _di_fss_embedded_list_write_main_ - f_status_t fss_embedded_list_write_main(fss_embedded_list_write_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_embedded_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -81,7 +72,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_embedded_list_write_parameter_no_color_e, fss_embedded_list_write_parameter_light_e, fss_embedded_list_write_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -339,13 +330,9 @@ extern "C" { if (length) { f_string_range_t range = macro_f_string_range_t_initialize(length); - main->prepend.string = arguments->argv[index]; - main->prepend.used = length; - main->prepend.size = length; - for (; range.start < length; ++range.start) { - status = f_fss_is_space(main->prepend, range); + status = f_fss_is_space(main->parameter->arguments.array[index], range); if (F_status_is_error(status)) break; if (status == F_false) { 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 e595656..8bc23ad 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 @@ -89,7 +89,7 @@ extern "C" { * @see fss_embedded_list_write_main_delete() */ #ifndef _di_fss_embedded_list_write_main_ - extern f_status_t fss_embedded_list_write_main(fss_embedded_list_write_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_embedded_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_embedded_list_write_main_ #ifdef __cplusplus diff --git a/level_3/fss_embedded_list_write/c/main.c b/level_3/fss_embedded_list_write/c/main.c index 8d9854d..ae17ec2 100644 --- a/level_3/fss_embedded_list_write/c/main.c +++ b/level_3/fss_embedded_list_write/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_embedded_list_write_main_t data = fss_embedded_list_write_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; 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 ca865e5..f0dc8a7 100644 --- a/level_3/fss_embedded_list_write/c/private-common.c +++ b/level_3/fss_embedded_list_write/c/private-common.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fss_embedded_list_write_print_signal_received_ - void fss_embedded_list_write_print_signal_received(fss_embedded_list_write_main_t * const main, const f_status_t signal) { + void fss_embedded_list_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -24,7 +24,7 @@ extern "C" { #endif // _di_fss_embedded_list_write_print_signal_received_ #ifndef _di_fss_embedded_list_write_signal_received_ - f_status_t fss_embedded_list_write_signal_received(fss_embedded_list_write_main_t * const main) { + f_status_t fss_embedded_list_write_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_embedded_list_write/c/private-common.h b/level_3/fss_embedded_list_write/c/private-common.h index 1e01411..4ff4b1c 100644 --- a/level_3/fss_embedded_list_write/c/private-common.h +++ b/level_3/fss_embedded_list_write/c/private-common.h @@ -34,7 +34,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_embedded_list_write_print_signal_received_ - extern void fss_embedded_list_write_print_signal_received(fss_embedded_list_write_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_embedded_list_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_write_print_signal_received_ /** @@ -52,7 +52,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_embedded_list_write_signal_received_ - extern f_status_t fss_embedded_list_write_signal_received(fss_embedded_list_write_main_t * const main); + extern f_status_t fss_embedded_list_write_signal_received(fll_program_data_t * const main); #endif // _di_fss_embedded_list_write_signal_received_ #ifdef __cplusplus 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 5c3c7c7..73f72cf 100644 --- a/level_3/fss_embedded_list_write/c/private-write.c +++ b/level_3/fss_embedded_list_write/c/private-write.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_embedded_list_write_error_parameter_same_times_print_ - void fss_embedded_list_write_error_parameter_same_times_print(fss_embedded_list_write_main_t * const main) { + void fss_embedded_list_write_error_parameter_same_times_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -28,7 +28,7 @@ extern "C" { #endif // _di_fss_embedded_list_write_error_parameter_same_times_print_ #ifndef _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ - void fss_embedded_list_write_error_parameter_unsupported_eol_print(fss_embedded_list_write_main_t * const main) { + void fss_embedded_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -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_static_t symbol, const f_string_static_t parameter) { + void fss_embedded_list_write_error_parameter_value_missing_print(fll_program_data_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; @@ -62,7 +62,7 @@ extern "C" { #endif // _di_fss_embedded_list_write_error_parameter_value_missing_print_ #ifndef _di_fss_embedded_list_write_process_ - f_status_t fss_embedded_list_write_process(fss_embedded_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) { + f_status_t fss_embedded_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_state_t state = macro_f_state_t_initialize(fss_embedded_list_write_common_allocation_large_d, fss_embedded_list_write_common_allocation_small_d, 0, 0, 0, 0, 0); @@ -136,7 +136,7 @@ extern "C" { #endif // _di_fss_embedded_list_write_process_ #ifndef _di_fss_embedded_list_write_process_pipe_ - f_status_t fss_embedded_list_write_process_pipe(fss_embedded_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) { + f_status_t fss_embedded_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) { f_status_t status = F_none; f_status_t status_pipe = F_none; @@ -353,7 +353,7 @@ extern "C" { #endif // _di_fss_embedded_list_write_process_pipe_ #ifndef _di_fss_embedded_list_write_process_parameter_ignore_ - f_status_t fss_embedded_list_write_process_parameter_ignore(fss_embedded_list_write_main_t * const main, const f_console_arguments_t *arguments, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) { + f_status_t fss_embedded_list_write_process_parameter_ignore(fll_program_data_t * const main, const f_console_arguments_t *arguments, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) { f_status_t status = F_none; 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 6a4d9f5..bf59fd0 100644 --- a/level_3/fss_embedded_list_write/c/private-write.h +++ b/level_3/fss_embedded_list_write/c/private-write.h @@ -19,7 +19,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_embedded_list_write_error_parameter_same_times_print_ - void fss_embedded_list_write_error_parameter_same_times_print(fss_embedded_list_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_embedded_list_write_error_parameter_same_times_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_write_error_parameter_same_times_print_ /** @@ -29,7 +29,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ - void fss_embedded_list_write_error_parameter_unsupported_eol_print(fss_embedded_list_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_embedded_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ /** @@ -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_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; + void fss_embedded_list_write_error_parameter_value_missing_print(fll_program_data_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_ /** @@ -73,7 +73,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_embedded_list_write_process_ - extern f_status_t fss_embedded_list_write_process(fss_embedded_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; + extern f_status_t fss_embedded_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_write_process_ /** @@ -97,7 +97,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_embedded_list_write_process_pipe_ - extern f_status_t fss_embedded_list_write_process_pipe(fss_embedded_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; + extern f_status_t fss_embedded_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_write_process_pipe_ /** @@ -119,7 +119,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_embedded_list_write_process_parameter_ignore_ - extern f_status_t fss_embedded_list_write_process_parameter_ignore(fss_embedded_list_write_main_t * const main, const f_console_arguments_t *arguments, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; + extern f_status_t fss_embedded_list_write_process_parameter_ignore(fll_program_data_t * const main, const f_console_arguments_t *arguments, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_write_process_parameter_ignore_ #ifdef __cplusplus diff --git a/level_3/fss_extended_list_read/c/common.c b/level_3/fss_extended_list_read/c/common.c index 07fd628..9bbe35e 100644 --- a/level_3/fss_extended_list_read/c/common.c +++ b/level_3/fss_extended_list_read/c/common.c @@ -13,15 +13,48 @@ extern "C" { const f_string_static_t fss_extended_list_read_program_name_long_s = macro_f_string_static_t_initialize(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_main_delete_ - f_status_t fss_extended_list_read_main_delete(fss_extended_list_read_main_t *main) { - - f_console_parameters_delete(&main->parameters); +#ifndef _di_fss_extended_list_read_defines_ + const f_string_static_t fss_extended_list_read_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_pipe_content_end_s, 0, FSS_EXTENDED_LIST_READ_pipe_content_end_s_length); + const f_string_static_t fss_extended_list_read_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_pipe_content_ignore_s, 0, FSS_EXTENDED_LIST_READ_pipe_content_ignore_s_length); + const f_string_static_t fss_extended_list_read_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_pipe_content_start_s, 0, FSS_EXTENDED_LIST_READ_pipe_content_start_s_length); +#endif // _di_fss_extended_list_read_defines_ + +#ifndef _di_fss_extended_list_read_parameters_ + const f_string_static_t fss_extended_list_read_short_at_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_at_s, 0, FSS_EXTENDED_LIST_READ_short_at_s_length); + const f_string_static_t fss_extended_list_read_short_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_content_s, 0, FSS_EXTENDED_LIST_READ_short_content_s_length); + const f_string_static_t fss_extended_list_read_short_columns_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_columns_s, 0, FSS_EXTENDED_LIST_READ_short_columns_s_length); + const f_string_static_t fss_extended_list_read_short_delimit_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_delimit_s, 0, FSS_EXTENDED_LIST_READ_short_delimit_s_length); + const f_string_static_t fss_extended_list_read_short_depth_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_depth_s, 0, FSS_EXTENDED_LIST_READ_short_depth_s_length); + const f_string_static_t fss_extended_list_read_short_empty_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_empty_s, 0, FSS_EXTENDED_LIST_READ_short_empty_s_length); + const f_string_static_t fss_extended_list_read_short_line_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_line_s, 0, FSS_EXTENDED_LIST_READ_short_line_s_length); + const f_string_static_t fss_extended_list_read_short_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_name_s, 0, FSS_EXTENDED_LIST_READ_short_name_s_length); + const f_string_static_t fss_extended_list_read_short_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_object_s, 0, FSS_EXTENDED_LIST_READ_short_object_s_length); + const f_string_static_t fss_extended_list_read_short_pipe_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_pipe_s, 0, FSS_EXTENDED_LIST_READ_short_pipe_s_length); + const f_string_static_t fss_extended_list_read_short_raw_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_raw_s, 0, FSS_EXTENDED_LIST_READ_short_raw_s_length); + const f_string_static_t fss_extended_list_read_short_select_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_select_s, 0, FSS_EXTENDED_LIST_READ_short_select_s_length); + const f_string_static_t fss_extended_list_read_short_total_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_total_s, 0, FSS_EXTENDED_LIST_READ_short_total_s_length); + const f_string_static_t fss_extended_list_read_short_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_short_trim_s, 0, FSS_EXTENDED_LIST_READ_short_trim_s_length); + + const f_string_static_t fss_extended_list_read_long_at_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_at_s, 0, FSS_EXTENDED_LIST_READ_long_at_s_length); + const f_string_static_t fss_extended_list_read_long_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_content_s, 0, FSS_EXTENDED_LIST_READ_long_content_s_length); + const f_string_static_t fss_extended_list_read_long_columns_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_columns_s, 0, FSS_EXTENDED_LIST_READ_long_columns_s_length); + const f_string_static_t fss_extended_list_read_long_delimit_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_delimit_s, 0, FSS_EXTENDED_LIST_READ_long_delimit_s_length); + const f_string_static_t fss_extended_list_read_long_depth_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_depth_s, 0, FSS_EXTENDED_LIST_READ_long_depth_s_length); + const f_string_static_t fss_extended_list_read_long_empty_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_empty_s, 0, FSS_EXTENDED_LIST_READ_long_empty_s_length); + const f_string_static_t fss_extended_list_read_long_line_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_line_s, 0, FSS_EXTENDED_LIST_READ_long_line_s_length); + const f_string_static_t fss_extended_list_read_long_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_name_s, 0, FSS_EXTENDED_LIST_READ_long_name_s_length); + const f_string_static_t fss_extended_list_read_long_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_object_s, 0, FSS_EXTENDED_LIST_READ_long_object_s_length); + const f_string_static_t fss_extended_list_read_long_pipe_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_pipe_s, 0, FSS_EXTENDED_LIST_READ_long_pipe_s_length); + const f_string_static_t fss_extended_list_read_long_raw_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_raw_s, 0, FSS_EXTENDED_LIST_READ_long_raw_s_length); + const f_string_static_t fss_extended_list_read_long_select_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_select_s, 0, FSS_EXTENDED_LIST_READ_long_select_s_length); + const f_string_static_t fss_extended_list_read_long_total_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_total_s, 0, FSS_EXTENDED_LIST_READ_long_total_s_length); + const f_string_static_t fss_extended_list_read_long_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_trim_s, 0, FSS_EXTENDED_LIST_READ_long_trim_s_length); +#endif // _di_fss_extended_list_read_parameters_ - f_type_array_lengths_resize(0, &main->remaining); - macro_f_color_context_t_delete_simple(main->context); +#ifndef _di_fss_extended_list_read_main_delete_ + f_status_t fss_extended_list_read_main_delete(fll_program_data_t *main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_extended_list_read_main_delete_ diff --git a/level_3/fss_extended_list_read/c/common.h b/level_3/fss_extended_list_read/c/common.h index f14c7ae..0369ea7 100644 --- a/level_3/fss_extended_list_read/c/common.h +++ b/level_3/fss_extended_list_read/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_extended_list_read_program_version_s; #endif // _di_fss_extended_list_read_program_version_ +/** + * The program name. + */ #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" @@ -53,42 +59,118 @@ extern "C" { extern const f_string_static_t fss_extended_list_read_program_name_long_s; #endif // _di_fss_extended_list_read_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_extended_list_read_defines_ #define fss_extended_list_read_signal_check_d 10000 - #define fss_extended_list_read_pipe_content_end '\f' - #define fss_extended_list_read_pipe_content_ignore '\v' - #define fss_extended_list_read_pipe_content_start '\b' - - #define fss_extended_list_read_short_at_s "a" - #define fss_extended_list_read_short_content_s "c" - #define fss_extended_list_read_short_columns_s "C" - #define fss_extended_list_read_short_delimit_s "D" - #define fss_extended_list_read_short_depth_s "d" - #define fss_extended_list_read_short_empty_s "e" - #define fss_extended_list_read_short_line_s "l" - #define fss_extended_list_read_short_name_s "n" - #define fss_extended_list_read_short_object_s "o" - #define fss_extended_list_read_short_pipe_s "p" - #define fss_extended_list_read_short_raw_s "R" - #define fss_extended_list_read_short_select_s "s" - #define fss_extended_list_read_short_total_s "t" - #define fss_extended_list_read_short_trim_s "T" - - #define fss_extended_list_read_long_at_s "at" - #define fss_extended_list_read_long_content_s "content" - #define fss_extended_list_read_long_columns_s "columns" - #define fss_extended_list_read_long_delimit_s "delimit" - #define fss_extended_list_read_long_depth_s "depth" - #define fss_extended_list_read_long_empty_s "empty" - #define fss_extended_list_read_long_line_s "line" - #define fss_extended_list_read_long_name_s "name" - #define fss_extended_list_read_long_object_s "object" - #define fss_extended_list_read_long_pipe_s "pipe" - #define fss_extended_list_read_long_raw_s "raw" - #define fss_extended_list_read_long_select_s "select" - #define fss_extended_list_read_long_total_s "total" - #define fss_extended_list_read_long_trim_s "trim" + #define FSS_EXTENDED_LIST_READ_pipe_content_end_s "\f" + #define FSS_EXTENDED_LIST_READ_pipe_content_ignore_s "\v" + #define FSS_EXTENDED_LIST_READ_pipe_content_start_s "\b" + + #define FSS_EXTENDED_LIST_READ_pipe_content_end_s_length 1 + #define FSS_EXTENDED_LIST_READ_pipe_content_ignore_s_length 1 + #define FSS_EXTENDED_LIST_READ_pipe_content_start_s_length 1 + + extern const f_string_static_t fss_extended_list_read_pipe_content_end_s; + extern const f_string_static_t fss_extended_list_read_pipe_content_ignore_s; + extern const f_string_static_t fss_extended_list_read_pipe_content_start_s; +#endif // _di_fss_extended_list_read_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_fss_extended_list_read_parameters_ + #define FSS_EXTENDED_LIST_READ_short_at_s "a" + #define FSS_EXTENDED_LIST_READ_short_content_s "c" + #define FSS_EXTENDED_LIST_READ_short_columns_s "C" + #define FSS_EXTENDED_LIST_READ_short_delimit_s "D" + #define FSS_EXTENDED_LIST_READ_short_depth_s "d" + #define FSS_EXTENDED_LIST_READ_short_empty_s "e" + #define FSS_EXTENDED_LIST_READ_short_line_s "l" + #define FSS_EXTENDED_LIST_READ_short_name_s "n" + #define FSS_EXTENDED_LIST_READ_short_object_s "o" + #define FSS_EXTENDED_LIST_READ_short_pipe_s "p" + #define FSS_EXTENDED_LIST_READ_short_raw_s "R" + #define FSS_EXTENDED_LIST_READ_short_select_s "s" + #define FSS_EXTENDED_LIST_READ_short_total_s "t" + #define FSS_EXTENDED_LIST_READ_short_trim_s "T" + + #define FSS_EXTENDED_LIST_READ_long_at_s "at" + #define FSS_EXTENDED_LIST_READ_long_content_s "content" + #define FSS_EXTENDED_LIST_READ_long_columns_s "columns" + #define FSS_EXTENDED_LIST_READ_long_delimit_s "delimit" + #define FSS_EXTENDED_LIST_READ_long_depth_s "depth" + #define FSS_EXTENDED_LIST_READ_long_empty_s "empty" + #define FSS_EXTENDED_LIST_READ_long_line_s "line" + #define FSS_EXTENDED_LIST_READ_long_name_s "name" + #define FSS_EXTENDED_LIST_READ_long_object_s "object" + #define FSS_EXTENDED_LIST_READ_long_pipe_s "pipe" + #define FSS_EXTENDED_LIST_READ_long_raw_s "raw" + #define FSS_EXTENDED_LIST_READ_long_select_s "select" + #define FSS_EXTENDED_LIST_READ_long_total_s "total" + #define FSS_EXTENDED_LIST_READ_long_trim_s "trim" + + #define FSS_EXTENDED_LIST_READ_short_at_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_content_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_columns_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_delimit_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_depth_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_empty_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_line_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_name_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_object_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_pipe_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_raw_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_select_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_total_s_length 1 + #define FSS_EXTENDED_LIST_READ_short_trim_s_length 1 + + #define FSS_EXTENDED_LIST_READ_long_at_s_length 2 + #define FSS_EXTENDED_LIST_READ_long_content_s_length 7 + #define FSS_EXTENDED_LIST_READ_long_columns_s_length 7 + #define FSS_EXTENDED_LIST_READ_long_delimit_s_length 7 + #define FSS_EXTENDED_LIST_READ_long_depth_s_length 5 + #define FSS_EXTENDED_LIST_READ_long_empty_s_length 5 + #define FSS_EXTENDED_LIST_READ_long_line_s_length 4 + #define FSS_EXTENDED_LIST_READ_long_name_s_length 4 + #define FSS_EXTENDED_LIST_READ_long_object_s_length 6 + #define FSS_EXTENDED_LIST_READ_long_pipe_s_length 4 + #define FSS_EXTENDED_LIST_READ_long_raw_s_length 3 + #define FSS_EXTENDED_LIST_READ_long_select_s_length 6 + #define FSS_EXTENDED_LIST_READ_long_total_s_length 5 + #define FSS_EXTENDED_LIST_READ_long_trim_s_length 4 + + extern const f_string_static_t fss_extended_list_read_short_at_s; + extern const f_string_static_t fss_extended_list_read_short_content_s; + extern const f_string_static_t fss_extended_list_read_short_columns_s; + extern const f_string_static_t fss_extended_list_read_short_delimit_s; + extern const f_string_static_t fss_extended_list_read_short_depth_s; + extern const f_string_static_t fss_extended_list_read_short_empty_s; + extern const f_string_static_t fss_extended_list_read_short_line_s; + extern const f_string_static_t fss_extended_list_read_short_name_s; + extern const f_string_static_t fss_extended_list_read_short_object_s; + extern const f_string_static_t fss_extended_list_read_short_pipe_s; + extern const f_string_static_t fss_extended_list_read_short_raw_s; + extern const f_string_static_t fss_extended_list_read_short_select_s; + extern const f_string_static_t fss_extended_list_read_short_total_s; + extern const f_string_static_t fss_extended_list_read_short_trim_s; + + extern const f_string_static_t fss_extended_list_read_long_at_s; + extern const f_string_static_t fss_extended_list_read_long_content_s; + extern const f_string_static_t fss_extended_list_read_long_columns_s; + extern const f_string_static_t fss_extended_list_read_long_delimit_s; + extern const f_string_static_t fss_extended_list_read_long_depth_s; + extern const f_string_static_t fss_extended_list_read_long_empty_s; + extern const f_string_static_t fss_extended_list_read_long_line_s; + extern const f_string_static_t fss_extended_list_read_long_name_s; + extern const f_string_static_t fss_extended_list_read_long_object_s; + extern const f_string_static_t fss_extended_list_read_long_pipe_s; + extern const f_string_static_t fss_extended_list_read_long_raw_s; + extern const f_string_static_t fss_extended_list_read_long_select_s; + extern const f_string_static_t fss_extended_list_read_long_total_s; + extern const f_string_static_t fss_extended_list_read_long_trim_s; enum { fss_extended_list_read_parameter_help_e, @@ -128,24 +210,24 @@ extern "C" { 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(fss_extended_list_read_short_at_s, fss_extended_list_read_long_at_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_content_s, fss_extended_list_read_long_content_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_columns_s, fss_extended_list_read_long_columns_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_delimit_s, fss_extended_list_read_long_delimit_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_depth_s, fss_extended_list_read_long_depth_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_empty_s, fss_extended_list_read_long_empty_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_line_s, fss_extended_list_read_long_line_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_name_s, fss_extended_list_read_long_name_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_object_s, fss_extended_list_read_long_object_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_pipe_s, fss_extended_list_read_long_pipe_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_raw_s, fss_extended_list_read_long_raw_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_select_s, fss_extended_list_read_long_select_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_total_s, fss_extended_list_read_long_total_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_read_short_trim_s, fss_extended_list_read_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_at_s.string, fss_extended_list_read_long_at_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_content_s.string, fss_extended_list_read_long_content_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_columns_s.string, fss_extended_list_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_delimit_s.string, fss_extended_list_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_depth_s.string, fss_extended_list_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_empty_s.string, fss_extended_list_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_line_s.string, fss_extended_list_read_long_line_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_name_s.string, fss_extended_list_read_long_name_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_object_s.string, fss_extended_list_read_long_object_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_pipe_s.string, fss_extended_list_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_raw_s.string, fss_extended_list_read_long_raw_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_select_s.string, fss_extended_list_read_long_select_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_total_s.string, fss_extended_list_read_long_total_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_read_short_trim_s.string, fss_extended_list_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_extended_list_read_total_parameters_d 23 -#endif // _di_fss_extended_list_read_defines_ +#endif // _di_fss_extended_list_read_parameters_ /** * FSS Delimit Parameter data. @@ -186,35 +268,6 @@ extern "C" { }; #endif // _di_fss_extended_list_read_delimit_modes_ -#ifndef _di_fss_extended_list_read_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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; - } fss_extended_list_read_main_t; - - #define fss_extended_list_read_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_extended_list_read_main_t_ - /** * Deallocate main. * @@ -231,7 +284,7 @@ extern "C" { * @see fss_extended_list_read_main() */ #ifndef _di_fss_extended_list_read_main_delete_ - extern f_status_t fss_extended_list_read_main_delete(fss_extended_list_read_main_t *main); + extern f_status_t fss_extended_list_read_main_delete(fll_program_data_t *main); #endif // _di_fss_extended_list_read_main_delete_ #ifdef __cplusplus 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 18cb5ca..f31ace0 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,15 +7,6 @@ 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_initialize(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_initialize(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_initialize(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) { @@ -50,7 +41,7 @@ extern "C" { 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)"); + fll_program_print_help_usage(file, context, fss_extended_list_read_program_name_s, fll_program_parameter_filenames_s); fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s); @@ -127,7 +118,7 @@ extern "C" { #endif // _di_fss_extended_list_read_print_help_ #ifndef _di_fss_extended_list_read_main_ - f_status_t fss_extended_list_read_main(fss_extended_list_read_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_extended_list_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -139,7 +130,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_extended_list_read_parameter_no_color_e, fss_extended_list_read_parameter_light_e, fss_extended_list_read_parameter_dark_e }; const f_console_parameter_ids_t choices = { ids, 3 }; - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -225,17 +216,17 @@ extern "C" { } // Provide a range designating where within the buffer a particular file exists, using a statically allocated array. - fss_extended_list_read_file_t files_array[main->remaining.used + 1]; + fss_extended_list_read_file_t files_array[main->parameters.remaining.used + 1]; fss_extended_list_read_data_t data = fss_extended_list_read_data_t_initialize; data.files.array = files_array; data.files.used = 1; - data.files.size = main->remaining.used + 1; + data.files.size = main->parameters.remaining.used + 1; data.files.array[0].name = "(pipe)"; data.files.array[0].range.start = 1; data.files.array[0].range.stop = 0; - if (main->remaining.used || main->process_pipe) { + if (main->parameters.remaining.used || main->process_pipe) { { const f_array_length_t parameter_code[] = { fss_extended_list_read_parameter_at_e, @@ -561,11 +552,11 @@ extern "C" { } } - if (F_status_is_error_not(status) && main->remaining.used > 0) { + if (F_status_is_error_not(status) && main->parameters.remaining.used > 0) { f_file_t file = f_file_t_initialize; f_array_length_t size_file = 0; - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (fss_extended_list_read_signal_received(main)) { status = F_status_set_error(F_interrupt); @@ -577,10 +568,10 @@ extern "C" { file.stream = 0; file.id = -1; - status = f_file_stream_open(arguments->argv[main->remaining.array[i]], 0, &file); + status = f_file_stream_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); break; } @@ -589,7 +580,7 @@ extern "C" { status = f_file_size_by_id(file.id, &size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -598,7 +589,7 @@ extern "C" { status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -606,12 +597,12 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } else if (data.buffer.used > data.files.array[data.files.used].range.start) { - data.files.array[data.files.used].name = arguments->argv[main->remaining.array[i]]; + data.files.array[data.files.used].name = arguments->argv[main->parameters.remaining.array[i]]; data.files.array[data.files.used++].range.stop = data.buffer.used - 1; // This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter. 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 cbfef7e..d4579a3 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 @@ -7,7 +7,7 @@ * * This is the FSS Extended List Read program * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the fss_extended_list_read_main_t. + * This program processes files or other input in fss format and stores the results in the fll_program_data_t. * * This processes in accordance to the FSS-0003 Extended List specification. */ @@ -96,7 +96,7 @@ extern "C" { * @see fss_extended_list_read_main_delete() */ #ifndef _di_fss_extended_list_read_main_ - extern f_status_t fss_extended_list_read_main(fss_extended_list_read_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_extended_list_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_extended_list_read_main_ #ifdef __cplusplus diff --git a/level_3/fss_extended_list_read/c/main.c b/level_3/fss_extended_list_read/c/main.c index e29bdff..5213a2a 100644 --- a/level_3/fss_extended_list_read/c/main.c +++ b/level_3/fss_extended_list_read/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { f_console_arguments_t arguments = { argc, argv }; - fss_extended_list_read_main_t data = fss_extended_list_read_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; 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 9491846..a986258 100644 --- a/level_3/fss_extended_list_read/c/private-common.c +++ b/level_3/fss_extended_list_read/c/private-common.c @@ -58,7 +58,7 @@ extern "C" { #endif // _di_fss_extended_list_read_depths_resize_ #ifndef _di_fss_extended_list_read_print_signal_received_ - void fss_extended_list_read_print_signal_received(fss_extended_list_read_main_t * const main, const f_status_t signal) { + void fss_extended_list_read_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -76,7 +76,7 @@ extern "C" { #endif // _di_fss_extended_list_read_print_signal_received_ #ifndef _di_fss_extended_list_read_signal_received_ - f_status_t fss_extended_list_read_signal_received(fss_extended_list_read_main_t * const main) { + f_status_t fss_extended_list_read_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_extended_list_read/c/private-common.h b/level_3/fss_extended_list_read/c/private-common.h index 3a5752b..3a77365 100644 --- a/level_3/fss_extended_list_read/c/private-common.h +++ b/level_3/fss_extended_list_read/c/private-common.h @@ -258,7 +258,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_extended_list_read_print_signal_received_ - extern void fss_extended_list_read_print_signal_received(fss_extended_list_read_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_extended_list_read_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_print_signal_received_ /** @@ -276,7 +276,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_extended_list_read_signal_received_ - extern f_status_t fss_extended_list_read_signal_received(fss_extended_list_read_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_read_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_signal_received_ #ifdef __cplusplus diff --git a/level_3/fss_extended_list_read/c/private-print.c b/level_3/fss_extended_list_read/c/private-print.c index e55ccc0..d8380dc 100644 --- a/level_3/fss_extended_list_read/c/private-print.c +++ b/level_3/fss_extended_list_read/c/private-print.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_extended_list_read_print_at_ - void fss_extended_list_read_print_at(fss_extended_list_read_main_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_extended_list_read_data_t * const data) { + void fss_extended_list_read_print_at(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_extended_list_read_data_t * const data) { if (at >= data->contents.used) { return; @@ -47,7 +47,7 @@ extern "C" { #endif // _di_fss_extended_list_read_print_at_ #ifndef _di_fss_extended_list_read_print_at_object_ - void fss_extended_list_read_print_at_object(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) { + void fss_extended_list_read_print_at_object(fll_program_data_t * const main, fss_extended_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) { if (at >= data->objects.used) { return; @@ -65,7 +65,7 @@ extern "C" { #endif // _di_fss_extended_list_read_print_at_object_ #ifndef _di_fss_extended_list_read_print_content_ignore_ - void fss_extended_list_read_print_content_ignore(fss_extended_list_read_main_t * const main) { + void fss_extended_list_read_print_content_ignore(fll_program_data_t * const main) { if (main->parameters.array[fss_extended_list_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_extended_list_read_pipe_content_ignore, main->output.to.stream); @@ -74,7 +74,7 @@ extern "C" { #endif // _di_fss_extended_list_read_print_content_ignore_ #ifndef _di_fss_extended_list_read_print_object_end_ - void fss_extended_list_read_print_object_end(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t * const data) { + void fss_extended_list_read_print_object_end(fll_program_data_t * const main, fss_extended_list_read_data_t * const data) { if (main->parameters.array[fss_extended_list_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_extended_list_read_pipe_content_start, main->output.to.stream); @@ -89,7 +89,7 @@ extern "C" { #endif // _di_fss_extended_list_read_print_object_end_ #ifndef _di_fss_extended_list_read_print_set_end_ - void fss_extended_list_read_print_set_end(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t * const data) { + void fss_extended_list_read_print_set_end(fll_program_data_t * const main, fss_extended_list_read_data_t * const data) { if (main->parameters.array[fss_extended_list_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_extended_list_read_pipe_content_end, main->output.to.stream); @@ -109,7 +109,7 @@ extern "C" { #endif // _di_fss_extended_list_read_print_set_end_ #ifndef _di_fss_extended_list_read_print_one_ - void fss_extended_list_read_print_one(fss_extended_list_read_main_t * const main) { + void fss_extended_list_read_print_one(fll_program_data_t * const main) { f_print_character(f_string_ascii_1_s.string[0], main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); @@ -117,7 +117,7 @@ extern "C" { #endif // _di_fss_extended_list_read_print_one_ #ifndef _di_fss_extended_list_read_print_zero_ - void fss_extended_list_read_print_zero(fss_extended_list_read_main_t * const main) { + void fss_extended_list_read_print_zero(fll_program_data_t * const main) { f_print_character(f_string_ascii_0_s.string[0], main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); diff --git a/level_3/fss_extended_list_read/c/private-print.h b/level_3/fss_extended_list_read/c/private-print.h index c30e38e..f42f77a 100644 --- a/level_3/fss_extended_list_read/c/private-print.h +++ b/level_3/fss_extended_list_read/c/private-print.h @@ -29,7 +29,7 @@ extern "C" { * The program data. */ #ifndef _di_fss_extended_list_read_print_at_ - extern void fss_extended_list_read_print_at(fss_extended_list_read_main_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_extended_list_read_data_t * const data) F_attribute_visibility_internal_d; + extern void fss_extended_list_read_print_at(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_extended_list_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_print_at_ /** @@ -45,7 +45,7 @@ extern "C" { * The delimits to be applied to an Object. */ #ifndef _di_fss_extended_list_read_print_at_object_ - extern void fss_extended_list_read_print_at_object(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) F_attribute_visibility_internal_d; + extern void fss_extended_list_read_print_at_object(fll_program_data_t * const main, fss_extended_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_print_at_object_ /** @@ -57,7 +57,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_extended_list_read_print_content_ignore_ - extern void fss_extended_list_read_print_content_ignore(fss_extended_list_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_extended_list_read_print_content_ignore(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_print_content_ignore_ /** @@ -69,7 +69,7 @@ extern "C" { * The program data. */ #ifndef _di_fss_extended_list_read_print_object_end_ - extern void fss_extended_list_read_print_object_end(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t * const data) F_attribute_visibility_internal_d; + extern void fss_extended_list_read_print_object_end(fll_program_data_t * const main, fss_extended_list_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_print_object_end_ /** @@ -79,7 +79,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_extended_list_read_print_one_ - extern void fss_extended_list_read_print_one(fss_extended_list_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_extended_list_read_print_one(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_print_one_ /** @@ -91,7 +91,7 @@ extern "C" { * The program data. */ #ifndef _di_fss_extended_list_read_print_set_end_ - extern void fss_extended_list_read_print_set_end(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t * const data) F_attribute_visibility_internal_d; + extern void fss_extended_list_read_print_set_end(fll_program_data_t * const main, fss_extended_list_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_print_set_end_ /** @@ -101,7 +101,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_extended_list_read_print_zero_ - extern void fss_extended_list_read_print_zero(fss_extended_list_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_extended_list_read_print_zero(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_print_zero_ #ifdef __cplusplus 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 a26a33c..0a747b9 100644 --- a/level_3/fss_extended_list_read/c/private-read.c +++ b/level_3/fss_extended_list_read/c/private-read.c @@ -56,7 +56,7 @@ extern "C" { #endif // _di_fss_extended_list_read_delimit_object_is_ #ifndef _di_fss_extended_list_read_depth_process_ - f_status_t fss_extended_list_read_depth_process(fss_extended_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) { + f_status_t fss_extended_list_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) { f_status_t status = F_none; @@ -235,7 +235,7 @@ extern "C" { #endif // _di_fss_extended_list_read_file_identify_ #ifndef _di_fss_extended_list_read_load_ - f_status_t fss_extended_list_read_load(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data) { + f_status_t fss_extended_list_read_load(fll_program_data_t * const main, fss_extended_list_read_data_t *data) { f_state_t state = macro_f_state_t_initialize(fss_extended_list_read_common_allocation_large_d, fss_extended_list_read_common_allocation_small_d, 0, 0, 0, 0, 0); f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used); @@ -268,7 +268,7 @@ extern "C" { #endif // _di_fss_extended_list_read_load_ #ifndef _di_fss_extended_list_read_load_number_ - f_status_t fss_extended_list_read_load_number(fss_extended_list_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) { + f_status_t fss_extended_list_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; @@ -290,7 +290,7 @@ extern "C" { #endif // _di_fss_extended_list_read_load_number_ #ifndef _di_fss_extended_list_read_process_ - f_status_t fss_extended_list_read_process(fss_extended_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) { + f_status_t fss_extended_list_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) { f_status_t status = fss_extended_list_read_process_option(main, arguments, data); if (F_status_is_error(status)) return status; @@ -349,7 +349,7 @@ extern "C" { #endif // _di_fss_extended_list_read_process_ #ifndef _di_fss_extended_list_read_process_at_ - f_status_t fss_extended_list_read_process_at(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) { + f_status_t fss_extended_list_read_process_at(fll_program_data_t * const main, fss_extended_list_read_data_t *data, bool names[]) { if (data->depths.array[0].value_at >= data->objects.used) { if (data->option & (fss_extended_list_read_data_option_columns_d | fss_extended_list_read_data_option_total_d)) { @@ -468,7 +468,7 @@ extern "C" { #endif // _di_fss_extended_list_read_process_at_ #ifndef _di_fss_extended_list_read_process_at_line_ - f_status_t fss_extended_list_read_process_at_line(fss_extended_list_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_extended_list_read_data_t *data, f_array_length_t *line) { + f_status_t fss_extended_list_read_process_at_line(fll_program_data_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_extended_list_read_data_t *data, f_array_length_t *line) { if (data->option & fss_extended_list_read_data_option_object_d) { @@ -564,7 +564,7 @@ extern "C" { #endif // _di_fss_extended_list_read_process_at_line_ #ifndef _di_fss_extended_list_read_process_columns_ - f_status_t fss_extended_list_read_process_columns(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) { + f_status_t fss_extended_list_read_process_columns(fll_program_data_t * const main, fss_extended_list_read_data_t *data, bool names[]) { if (!(data->option & fss_extended_list_read_data_option_content_d)) { flockfile(main->output.to.stream); @@ -594,7 +594,7 @@ extern "C" { #endif // _di_fss_extended_list_read_process_columns_ #ifndef _di_fss_extended_list_read_process_line_ - f_status_t fss_extended_list_read_process_line(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) { + f_status_t fss_extended_list_read_process_line(fll_program_data_t * const main, fss_extended_list_read_data_t *data, bool names[]) { f_array_lengths_t except_none = f_array_lengths_t_initialize; f_array_lengths_t *delimits_object = fss_extended_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none; @@ -647,7 +647,7 @@ extern "C" { #endif // _di_fss_extended_list_read_process_name_ #ifndef _di_fss_extended_list_read_process_option_ - f_status_t fss_extended_list_read_process_option(fss_extended_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) { + f_status_t fss_extended_list_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) { f_status_t status = F_none; @@ -711,7 +711,7 @@ extern "C" { #endif // _di_fss_extended_list_read_process_option_ #ifndef _di_fss_extended_list_read_process_total_ - f_status_t fss_extended_list_read_process_total(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) { + f_status_t fss_extended_list_read_process_total(fll_program_data_t * const main, fss_extended_list_read_data_t *data, bool names[]) { f_array_length_t total = 0; f_string_range_t range = f_string_range_t_initialize; diff --git a/level_3/fss_extended_list_read/c/private-read.h b/level_3/fss_extended_list_read/c/private-read.h index a2ddfcb..35664c3 100644 --- a/level_3/fss_extended_list_read/c/private-read.h +++ b/level_3/fss_extended_list_read/c/private-read.h @@ -72,7 +72,7 @@ extern "C" { * @see fss_extended_list_read_depths_resize() */ #ifndef _di_fss_extended_list_read_depth_process_ - extern f_status_t fss_extended_list_read_depth_process(fss_extended_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_depth_process_ /** @@ -116,7 +116,7 @@ extern "C" { * @see fss_extended_list_read_process_option() */ #ifndef _di_fss_extended_list_read_load_ - extern f_status_t fss_extended_list_read_load(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_read_load(fll_program_data_t * const main, fss_extended_list_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_load_ /** @@ -146,7 +146,7 @@ extern "C" { * @see fss_extended_list_read_depths_resize() */ #ifndef _di_fss_extended_list_read_load_number_ - extern f_status_t fss_extended_list_read_load_number(fss_extended_list_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_load_number_ /** @@ -171,7 +171,7 @@ extern "C" { * @see fss_extended_list_read_process_option() */ #ifndef _di_fss_extended_list_read_process_ - extern f_status_t fss_extended_list_read_process(fss_extended_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_process_ /** @@ -191,7 +191,7 @@ extern "C" { * @see fss_extended_list_read_process_at_line() */ #ifndef _di_fss_extended_list_read_process_at_ - extern f_status_t fss_extended_list_read_process_at(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_read_process_at(fll_program_data_t * const main, fss_extended_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_process_at_ /** @@ -214,7 +214,7 @@ extern "C" { * F_success on success and the line was matched (and possibly printed). */ #ifndef _di_fss_extended_list_read_process_at_line_ - extern f_status_t fss_extended_list_read_process_at_line(fss_extended_list_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_extended_list_read_data_t *data, f_array_length_t *line) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_read_process_at_line(fll_program_data_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_extended_list_read_data_t *data, f_array_length_t *line) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_process_at_line_ /** @@ -232,7 +232,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_extended_list_read_process_columns_ - extern f_status_t fss_extended_list_read_process_columns(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_read_process_columns(fll_program_data_t * const main, fss_extended_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_process_columns_ /** @@ -250,7 +250,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_extended_list_read_process_line_ - extern f_status_t fss_extended_list_read_process_line(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_read_process_line(fll_program_data_t * const main, fss_extended_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_process_line_ /** @@ -291,7 +291,7 @@ extern "C" { * @see fss_extended_list_read_load_setting() */ #ifndef _di_fss_extended_list_read_process_option_ - extern f_status_t fss_extended_list_read_process_option(fss_extended_list_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_list_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_process_option_ /** @@ -309,7 +309,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_extended_list_read_process_total_ - extern f_status_t fss_extended_list_read_process_total(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_read_process_total(fll_program_data_t * const main, fss_extended_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_read_process_total_ #ifdef __cplusplus diff --git a/level_3/fss_extended_list_write/c/common.c b/level_3/fss_extended_list_write/c/common.c index 7a09a32..b5174cf 100644 --- a/level_3/fss_extended_list_write/c/common.c +++ b/level_3/fss_extended_list_write/c/common.c @@ -13,16 +13,38 @@ extern "C" { const f_string_static_t fss_extended_list_write_program_name_long_s = macro_f_string_static_t_initialize(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_main_delete_ - f_status_t fss_extended_list_write_main_delete(fss_extended_list_write_main_t *main) { - - f_console_parameters_delete(&main->parameters); +#ifndef _di_fss_extended_list_write_defines_ + const f_string_static_t fss_extended_list_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_pipe_content_end_s, 0, FSS_EXTENDED_LIST_WRITE_pipe_content_end_s_length); + const f_string_static_t fss_extended_list_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_pipe_content_ignore_s, 0, FSS_EXTENDED_LIST_WRITE_pipe_content_ignore_s_length); + const f_string_static_t fss_extended_list_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_pipe_content_start_s, 0, FSS_EXTENDED_LIST_WRITE_pipe_content_start_s_length); +#endif // _di_fss_extended_list_write_defines_ + +#ifndef _di_fss_extended_list_write_parameters_ + const f_string_static_t fss_extended_list_write_short_file_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_file_s, 0, FSS_EXTENDED_LIST_WRITE_short_file_s_length); + const f_string_static_t fss_extended_list_write_short_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_content_s, 0, FSS_EXTENDED_LIST_WRITE_short_content_s_length); + const f_string_static_t fss_extended_list_write_short_double_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_double_s, 0, FSS_EXTENDED_LIST_WRITE_short_double_s_length); + const f_string_static_t fss_extended_list_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_ignore_s, 0, FSS_EXTENDED_LIST_WRITE_short_ignore_s_length); + const f_string_static_t fss_extended_list_write_short_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_object_s, 0, FSS_EXTENDED_LIST_WRITE_short_object_s_length); + const f_string_static_t fss_extended_list_write_short_partial_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_partial_s, 0, FSS_EXTENDED_LIST_WRITE_short_partial_s_length); + const f_string_static_t fss_extended_list_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_prepend_s, 0, FSS_EXTENDED_LIST_WRITE_short_prepend_s_length); + const f_string_static_t fss_extended_list_write_short_single_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_single_s, 0, FSS_EXTENDED_LIST_WRITE_short_single_s_length); + const f_string_static_t fss_extended_list_write_short_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_trim_s, 0, FSS_EXTENDED_LIST_WRITE_short_trim_s_length); + + const f_string_static_t fss_extended_list_write_long_file_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_file_s, 0, FSS_EXTENDED_LIST_WRITE_long_file_s_length); + const f_string_static_t fss_extended_list_write_long_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_content_s, 0, FSS_EXTENDED_LIST_WRITE_long_content_s_length); + const f_string_static_t fss_extended_list_write_long_double_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_double_s, 0, FSS_EXTENDED_LIST_WRITE_long_double_s_length); + const f_string_static_t fss_extended_list_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_ignore_s, 0, FSS_EXTENDED_LIST_WRITE_long_ignore_s_length); + const f_string_static_t fss_extended_list_write_long_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_object_s, 0, FSS_EXTENDED_LIST_WRITE_long_object_s_length); + const f_string_static_t fss_extended_list_write_long_partial_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_partial_s, 0, FSS_EXTENDED_LIST_WRITE_long_partial_s_length); + const f_string_static_t fss_extended_list_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_prepend_s, 0, FSS_EXTENDED_LIST_WRITE_long_prepend_s_length); + const f_string_static_t fss_extended_list_write_long_single_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_single_s, 0, FSS_EXTENDED_LIST_WRITE_long_single_s_length); + const f_string_static_t fss_extended_list_write_long_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_trim_s, 0, FSS_EXTENDED_LIST_WRITE_long_trim_s_length); +#endif // _di_fss_extended_list_write_parameters_ - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); +#ifndef _di_fss_extended_list_write_main_delete_ + f_status_t fss_extended_list_write_main_delete(fll_program_data_t *main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_extended_list_write_main_delete_ diff --git a/level_3/fss_extended_list_write/c/common.h b/level_3/fss_extended_list_write/c/common.h index 3352294..824c00f 100644 --- a/level_3/fss_extended_list_write/c/common.h +++ b/level_3/fss_extended_list_write/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_extended_list_write_program_version_s; #endif // _di_fss_extended_list_write_program_version_ +/** + * The program name. + */ #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" @@ -53,32 +59,88 @@ extern "C" { extern const f_string_static_t fss_extended_list_write_program_name_long_s; #endif // _di_fss_extended_list_write_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_extended_list_write_defines_ #define fss_extended_list_write_signal_check_d 10000 - #define fss_extended_list_write_pipe_content_end_s '\f' - #define fss_extended_list_write_pipe_content_ignore_s '\v' - #define fss_extended_list_write_pipe_content_start_s '\b' - - #define fss_extended_list_write_short_file_s "f" - #define fss_extended_list_write_short_content_s "c" - #define fss_extended_list_write_short_double_s "d" - #define fss_extended_list_write_short_ignore_s "I" - #define fss_extended_list_write_short_object_s "o" - #define fss_extended_list_write_short_partial_s "p" - #define fss_extended_list_write_short_prepend_s "P" - #define fss_extended_list_write_short_single_s "s" - #define fss_extended_list_write_short_trim_s "T" - - #define fss_extended_list_write_long_file_s "file" - #define fss_extended_list_write_long_content_s "content" - #define fss_extended_list_write_long_double_s "double" - #define fss_extended_list_write_long_ignore_s "ignore" - #define fss_extended_list_write_long_object_s "object" - #define fss_extended_list_write_long_partial_s "partial" - #define fss_extended_list_write_long_prepend_s "prepend" - #define fss_extended_list_write_long_single_s "single" - #define fss_extended_list_write_long_trim_s "trim" + #define FSS_EXTENDED_LIST_WRITE_pipe_content_end_s "\f" + #define FSS_EXTENDED_LIST_WRITE_pipe_content_ignore_s "\v" + #define FSS_EXTENDED_LIST_WRITE_pipe_content_start_s "\b" + + #define FSS_EXTENDED_LIST_WRITE_pipe_content_end_s_length 1 + #define FSS_EXTENDED_LIST_WRITE_pipe_content_ignore_s_length 1 + #define FSS_EXTENDED_LIST_WRITE_pipe_content_start_s_length 1 + + extern const f_string_static_t fss_extended_list_write_pipe_content_end_s; + extern const f_string_static_t fss_extended_list_write_pipe_content_ignore_s; + extern const f_string_static_t fss_extended_list_write_pipe_content_start_s; +#endif // _di_fss_extended_list_write_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_fss_extended_list_write_parameters_ + #define FSS_EXTENDED_LIST_WRITE_short_file_s "f" + #define FSS_EXTENDED_LIST_WRITE_short_content_s "c" + #define FSS_EXTENDED_LIST_WRITE_short_double_s "d" + #define FSS_EXTENDED_LIST_WRITE_short_ignore_s "I" + #define FSS_EXTENDED_LIST_WRITE_short_object_s "o" + #define FSS_EXTENDED_LIST_WRITE_short_partial_s "p" + #define FSS_EXTENDED_LIST_WRITE_short_prepend_s "P" + #define FSS_EXTENDED_LIST_WRITE_short_single_s "s" + #define FSS_EXTENDED_LIST_WRITE_short_trim_s "T" + + #define FSS_EXTENDED_LIST_WRITE_long_file_s "file" + #define FSS_EXTENDED_LIST_WRITE_long_content_s "content" + #define FSS_EXTENDED_LIST_WRITE_long_double_s "double" + #define FSS_EXTENDED_LIST_WRITE_long_ignore_s "ignore" + #define FSS_EXTENDED_LIST_WRITE_long_object_s "object" + #define FSS_EXTENDED_LIST_WRITE_long_partial_s "partial" + #define FSS_EXTENDED_LIST_WRITE_long_prepend_s "prepend" + #define FSS_EXTENDED_LIST_WRITE_long_single_s "single" + #define FSS_EXTENDED_LIST_WRITE_long_trim_s "trim" + + #define FSS_EXTENDED_LIST_WRITE_short_file_s_length 1 + #define FSS_EXTENDED_LIST_WRITE_short_content_s_length 1 + #define FSS_EXTENDED_LIST_WRITE_short_double_s_length 1 + #define FSS_EXTENDED_LIST_WRITE_short_ignore_s_length 1 + #define FSS_EXTENDED_LIST_WRITE_short_object_s_length 1 + #define FSS_EXTENDED_LIST_WRITE_short_partial_s_length 1 + #define FSS_EXTENDED_LIST_WRITE_short_prepend_s_length 1 + #define FSS_EXTENDED_LIST_WRITE_short_single_s_length 1 + #define FSS_EXTENDED_LIST_WRITE_short_trim_s_length 1 + + #define FSS_EXTENDED_LIST_WRITE_long_file_s_length 4 + #define FSS_EXTENDED_LIST_WRITE_long_content_s_length 7 + #define FSS_EXTENDED_LIST_WRITE_long_double_s_length 6 + #define FSS_EXTENDED_LIST_WRITE_long_ignore_s_length 6 + #define FSS_EXTENDED_LIST_WRITE_long_object_s_length 6 + #define FSS_EXTENDED_LIST_WRITE_long_partial_s_length 7 + #define FSS_EXTENDED_LIST_WRITE_long_prepend_s_length 7 + #define FSS_EXTENDED_LIST_WRITE_long_single_s_length 6 + #define FSS_EXTENDED_LIST_WRITE_long_trim_s_length 4 + + extern const f_string_static_t fss_extended_list_write_short_file_s; + extern const f_string_static_t fss_extended_list_write_short_content_s; + extern const f_string_static_t fss_extended_list_write_short_double_s; + extern const f_string_static_t fss_extended_list_write_short_ignore_s; + extern const f_string_static_t fss_extended_list_write_short_object_s; + extern const f_string_static_t fss_extended_list_write_short_partial_s; + extern const f_string_static_t fss_extended_list_write_short_prepend_s; + extern const f_string_static_t fss_extended_list_write_short_single_s; + extern const f_string_static_t fss_extended_list_write_short_trim_s; + + extern const f_string_static_t fss_extended_list_write_long_file_s; + extern const f_string_static_t fss_extended_list_write_long_content_s; + extern const f_string_static_t fss_extended_list_write_long_double_s; + extern const f_string_static_t fss_extended_list_write_long_ignore_s; + extern const f_string_static_t fss_extended_list_write_long_object_s; + extern const f_string_static_t fss_extended_list_write_long_partial_s; + extern const f_string_static_t fss_extended_list_write_long_prepend_s; + extern const f_string_static_t fss_extended_list_write_long_single_s; + extern const f_string_static_t fss_extended_list_write_long_trim_s; enum { fss_extended_list_write_parameter_help_e, @@ -113,51 +175,19 @@ extern "C" { 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(fss_extended_list_write_short_file_s, fss_extended_list_write_long_file_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_write_short_content_s, fss_extended_list_write_long_content_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_write_short_double_s, fss_extended_list_write_long_double_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_write_short_ignore_s, fss_extended_list_write_long_ignore_s, 0, 2, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_write_short_object_s, fss_extended_list_write_long_object_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_write_short_partial_s, fss_extended_list_write_long_partial_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_write_short_prepend_s, fss_extended_list_write_long_prepend_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_write_short_single_s, fss_extended_list_write_long_single_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_list_write_short_trim_s, fss_extended_list_write_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_write_short_file_s.string, fss_extended_list_write_long_file_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_write_short_content_s.string, fss_extended_list_write_long_content_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_write_short_double_s.string, fss_extended_list_write_long_double_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_write_short_ignore_s.string, fss_extended_list_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_write_short_object_s.string, fss_extended_list_write_long_object_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_write_short_partial_s.string, fss_extended_list_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_write_short_prepend_s.string, fss_extended_list_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_write_short_single_s.string, fss_extended_list_write_long_single_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_list_write_short_trim_s.string, fss_extended_list_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_extended_list_write_total_parameters_d 18 -#endif // _di_fss_extended_list_write_defines_ - -#ifndef _di_fss_extended_list_write_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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_string_static_t prepend; - - f_color_context_t context; - } fss_extended_list_write_main_t; - - #define fss_extended_list_write_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_string_static_t_initialize, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_extended_list_write_main_t_ +#endif // _di_fss_extended_list_write_parameters_ /** * Deallocate main. @@ -175,7 +205,7 @@ extern "C" { * @see fss_extended_list_write_main() */ #ifndef _di_fss_extended_list_write_main_delete_ - extern f_status_t fss_extended_list_write_main_delete(fss_extended_list_write_main_t *main); + extern f_status_t fss_extended_list_write_main_delete(fll_program_data_t *main); #endif // _di_fss_extended_list_write_main_delete_ #ifdef __cplusplus 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 1f7ff57..6e4217c 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,15 +6,6 @@ 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_initialize(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_initialize(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_initialize(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) { @@ -69,7 +60,7 @@ extern "C" { #endif // _di_fss_extended_list_write_print_help_ #ifndef _di_fss_extended_list_write_main_ - f_status_t fss_extended_list_write_main(fss_extended_list_write_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_extended_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -81,7 +72,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_extended_list_write_parameter_no_color_e, fss_extended_list_write_parameter_light_e, fss_extended_list_write_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; 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 c6d34bc..36691a5 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 @@ -89,7 +89,7 @@ extern "C" { * @see fss_extended_list_write_main_delete() */ #ifndef _di_fss_extended_list_write_main_ - extern f_status_t fss_extended_list_write_main(fss_extended_list_write_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_extended_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_extended_list_write_main_ #ifdef __cplusplus diff --git a/level_3/fss_extended_list_write/c/main.c b/level_3/fss_extended_list_write/c/main.c index 3eb348b..672633e 100644 --- a/level_3/fss_extended_list_write/c/main.c +++ b/level_3/fss_extended_list_write/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_extended_list_write_main_t data = fss_extended_list_write_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; 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 2241196..efead66 100644 --- a/level_3/fss_extended_list_write/c/private-common.c +++ b/level_3/fss_extended_list_write/c/private-common.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fss_extended_list_write_print_signal_received_ - void fss_extended_list_write_print_signal_received(fss_extended_list_write_main_t * const main, const f_status_t signal) { + void fss_extended_list_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -24,7 +24,7 @@ extern "C" { #endif // _di_fss_extended_list_write_print_signal_received_ #ifndef _di_fss_extended_list_write_signal_received_ - f_status_t fss_extended_list_write_signal_received(fss_extended_list_write_main_t * const main) { + f_status_t fss_extended_list_write_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_extended_list_write/c/private-common.h b/level_3/fss_extended_list_write/c/private-common.h index d93b623..ad7c928 100644 --- a/level_3/fss_extended_list_write/c/private-common.h +++ b/level_3/fss_extended_list_write/c/private-common.h @@ -33,7 +33,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_extended_list_write_print_signal_received_ - extern void fss_extended_list_write_print_signal_received(fss_extended_list_write_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_extended_list_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_write_print_signal_received_ /** @@ -51,7 +51,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_extended_list_write_signal_received_ - extern f_status_t fss_extended_list_write_signal_received(fss_extended_list_write_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_write_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_write_signal_received_ #ifdef __cplusplus 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 685f569..d74149a 100644 --- a/level_3/fss_extended_list_write/c/private-write.c +++ b/level_3/fss_extended_list_write/c/private-write.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_extended_list_write_error_parameter_same_times_print_ - void fss_extended_list_write_error_parameter_same_times_print(fss_extended_list_write_main_t * const main) { + void fss_extended_list_write_error_parameter_same_times_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -28,7 +28,7 @@ extern "C" { #endif // _di_fss_extended_list_write_error_parameter_same_times_print_ #ifndef _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ - void fss_extended_list_write_error_parameter_unsupported_eol_print(fss_extended_list_write_main_t * const main) { + void fss_extended_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -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_static_t symbol, const f_string_static_t parameter) { + void fss_extended_list_write_error_parameter_value_missing_print(fll_program_data_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; @@ -62,7 +62,7 @@ extern "C" { #endif // _di_fss_extended_list_write_error_parameter_value_missing_print_ #ifndef _di_fss_extended_list_write_process_ - f_status_t fss_extended_list_write_process(fss_extended_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) { + f_status_t fss_extended_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_state_t state = macro_f_state_t_initialize(fss_extended_list_write_common_allocation_large_d, fss_extended_list_write_common_allocation_small_d, 0, 0, 0, 0, 0); @@ -136,7 +136,7 @@ extern "C" { #endif // _di_fss_extended_list_write_process_ #ifndef _di_fss_extended_list_write_process_pipe_ - f_status_t fss_extended_list_write_process_pipe(fss_extended_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) { + f_status_t fss_extended_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) { f_status_t status = F_none; f_status_t status_pipe = F_none; @@ -350,7 +350,7 @@ extern "C" { #endif // _di_fss_extended_list_write_process_pipe_ #ifndef _di_fss_extended_list_write_process_parameter_ignore_ - f_status_t fss_extended_list_write_process_parameter_ignore(fss_extended_list_write_main_t * const main, const f_console_arguments_t *arguments, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) { + f_status_t fss_extended_list_write_process_parameter_ignore(fll_program_data_t * const main, const f_console_arguments_t *arguments, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) { f_status_t status = F_none; 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 0acd101..0883710 100644 --- a/level_3/fss_extended_list_write/c/private-write.h +++ b/level_3/fss_extended_list_write/c/private-write.h @@ -19,7 +19,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_extended_list_write_error_parameter_same_times_print_ - void fss_extended_list_write_error_parameter_same_times_print(fss_extended_list_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_extended_list_write_error_parameter_same_times_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_write_error_parameter_same_times_print_ /** @@ -29,7 +29,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ - void fss_extended_list_write_error_parameter_unsupported_eol_print(fss_extended_list_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_extended_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ /** @@ -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_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; + void fss_extended_list_write_error_parameter_value_missing_print(fll_program_data_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_ /** @@ -73,7 +73,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_list_write_process_ - extern f_status_t fss_extended_list_write_process(fss_extended_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_write_process_ /** @@ -97,7 +97,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_list_write_process_pipe_ - extern f_status_t fss_extended_list_write_process_pipe(fss_extended_list_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_write_process_pipe_ /** @@ -119,7 +119,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_list_write_process_parameter_ignore_ - extern f_status_t fss_extended_list_write_process_parameter_ignore(fss_extended_list_write_main_t * const main, const f_console_arguments_t *arguments, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_list_write_process_parameter_ignore(fll_program_data_t * const main, const f_console_arguments_t *arguments, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; #endif // _di_fss_extended_list_write_process_parameter_ignore_ #ifdef __cplusplus diff --git a/level_3/fss_extended_read/c/common.c b/level_3/fss_extended_read/c/common.c index 6df5397..b92e376 100644 --- a/level_3/fss_extended_read/c/common.c +++ b/level_3/fss_extended_read/c/common.c @@ -13,15 +13,48 @@ extern "C" { const f_string_static_t fss_extended_read_program_name_long_s = macro_f_string_static_t_initialize(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_main_delete_ - f_status_t fss_extended_read_main_delete(fss_extended_read_main_t * const main) { - - f_console_parameters_delete(&main->parameters); +#ifndef _di_fss_extended_read_defines_ + const f_string_static_t fss_extended_read_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_pipe_content_end_s, 0, FSS_EXTENDED_READ_pipe_content_end_s_length); + const f_string_static_t fss_extended_read_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_pipe_content_ignore_s, 0, FSS_EXTENDED_READ_pipe_content_ignore_s_length); + const f_string_static_t fss_extended_read_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_pipe_content_start_s, 0, FSS_EXTENDED_READ_pipe_content_start_s_length); +#endif // _di_fss_extended_read_defines_ + +#ifndef _di_fss_extended_read_parameters_ + const f_string_static_t fss_extended_read_short_at_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_at_s, 0, FSS_EXTENDED_READ_short_at_s_length); + const f_string_static_t fss_extended_read_short_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_content_s, 0, FSS_EXTENDED_READ_short_content_s_length); + const f_string_static_t fss_extended_read_short_columns_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_columns_s, 0, FSS_EXTENDED_READ_short_columns_s_length); + const f_string_static_t fss_extended_read_short_delimit_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_delimit_s, 0, FSS_EXTENDED_READ_short_delimit_s_length); + const f_string_static_t fss_extended_read_short_depth_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_depth_s, 0, FSS_EXTENDED_READ_short_depth_s_length); + const f_string_static_t fss_extended_read_short_empty_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_empty_s, 0, FSS_EXTENDED_READ_short_empty_s_length); + const f_string_static_t fss_extended_read_short_line_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_line_s, 0, FSS_EXTENDED_READ_short_line_s_length); + const f_string_static_t fss_extended_read_short_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_name_s, 0, FSS_EXTENDED_READ_short_name_s_length); + const f_string_static_t fss_extended_read_short_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_object_s, 0, FSS_EXTENDED_READ_short_object_s_length); + const f_string_static_t fss_extended_read_short_pipe_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_pipe_s, 0, FSS_EXTENDED_READ_short_pipe_s_length); + const f_string_static_t fss_extended_read_short_raw_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_raw_s, 0, FSS_EXTENDED_READ_short_raw_s_length); + const f_string_static_t fss_extended_read_short_select_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_select_s, 0, FSS_EXTENDED_READ_short_select_s_length); + const f_string_static_t fss_extended_read_short_total_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_total_s, 0, FSS_EXTENDED_READ_short_total_s_length); + const f_string_static_t fss_extended_read_short_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_short_trim_s, 0, FSS_EXTENDED_READ_short_trim_s_length); + + const f_string_static_t fss_extended_read_long_at_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_at_s, 0, FSS_EXTENDED_READ_long_at_s_length); + const f_string_static_t fss_extended_read_long_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_content_s, 0, FSS_EXTENDED_READ_long_content_s_length); + const f_string_static_t fss_extended_read_long_columns_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_columns_s, 0, FSS_EXTENDED_READ_long_columns_s_length); + const f_string_static_t fss_extended_read_long_delimit_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_delimit_s, 0, FSS_EXTENDED_READ_long_delimit_s_length); + const f_string_static_t fss_extended_read_long_depth_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_depth_s, 0, FSS_EXTENDED_READ_long_depth_s_length); + const f_string_static_t fss_extended_read_long_empty_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_empty_s, 0, FSS_EXTENDED_READ_long_empty_s_length); + const f_string_static_t fss_extended_read_long_line_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_line_s, 0, FSS_EXTENDED_READ_long_line_s_length); + const f_string_static_t fss_extended_read_long_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_name_s, 0, FSS_EXTENDED_READ_long_name_s_length); + const f_string_static_t fss_extended_read_long_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_object_s, 0, FSS_EXTENDED_READ_long_object_s_length); + const f_string_static_t fss_extended_read_long_pipe_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_pipe_s, 0, FSS_EXTENDED_READ_long_pipe_s_length); + const f_string_static_t fss_extended_read_long_raw_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_raw_s, 0, FSS_EXTENDED_READ_long_raw_s_length); + const f_string_static_t fss_extended_read_long_select_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_select_s, 0, FSS_EXTENDED_READ_long_select_s_length); + const f_string_static_t fss_extended_read_long_total_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_total_s, 0, FSS_EXTENDED_READ_long_total_s_length); + const f_string_static_t fss_extended_read_long_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_trim_s, 0, FSS_EXTENDED_READ_long_trim_s_length); +#endif // _di_fss_extended_read_parameters_ - f_type_array_lengths_resize(0, &main->remaining); - macro_f_color_context_t_delete_simple(main->context); +#ifndef _di_fss_extended_read_main_delete_ + f_status_t fss_extended_read_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_extended_read_main_delete_ diff --git a/level_3/fss_extended_read/c/common.h b/level_3/fss_extended_read/c/common.h index d20dcda..f73ee23 100644 --- a/level_3/fss_extended_read/c/common.h +++ b/level_3/fss_extended_read/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_extended_read_program_version_s; #endif // _di_fss_extended_read_program_version_ +/** + * The program name. + */ #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" @@ -53,42 +59,118 @@ extern "C" { extern const f_string_static_t fss_extended_read_program_name_long_s; #endif // _di_fss_extended_read_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_extended_read_defines_ #define fss_extended_read_signal_check_d 10000 - #define fss_extended_read_pipe_content_end_s '\f' - #define fss_extended_read_pipe_content_ignore_s '\v' - #define fss_extended_read_pipe_content_start_s '\b' - - #define fss_extended_read_short_at_s "a" - #define fss_extended_read_short_content_s "c" - #define fss_extended_read_short_columns_s "C" - #define fss_extended_read_short_delimit_s "D" - #define fss_extended_read_short_depth_s "d" - #define fss_extended_read_short_empty_s "e" - #define fss_extended_read_short_line_s "l" - #define fss_extended_read_short_name_s "n" - #define fss_extended_read_short_object_s "o" - #define fss_extended_read_short_pipe_s "p" - #define fss_extended_read_short_raw_s "R" - #define fss_extended_read_short_select_s "s" - #define fss_extended_read_short_total_s "t" - #define fss_extended_read_short_trim_s "T" - - #define fss_extended_read_long_at_s "at" - #define fss_extended_read_long_content_s "content" - #define fss_extended_read_long_columns_s "columns" - #define fss_extended_read_long_delimit_s "delimit" - #define fss_extended_read_long_depth_s "depth" - #define fss_extended_read_long_empty_s "empty" - #define fss_extended_read_long_line_s "line" - #define fss_extended_read_long_name_s "name" - #define fss_extended_read_long_object_s "object" - #define fss_extended_read_long_pipe_s "pipe" - #define fss_extended_read_long_raw_s "raw" - #define fss_extended_read_long_select_s "select" - #define fss_extended_read_long_total_s "total" - #define fss_extended_read_long_trim_s "trim" + #define FSS_EXTENDED_READ_pipe_content_end_s "\f" + #define FSS_EXTENDED_READ_pipe_content_ignore_s "\v" + #define FSS_EXTENDED_READ_pipe_content_start_s "\b" + + #define FSS_EXTENDED_READ_pipe_content_end_s_length 1 + #define FSS_EXTENDED_READ_pipe_content_ignore_s_length 1 + #define FSS_EXTENDED_READ_pipe_content_start_s_length 1 + + extern const f_string_static_t fss_extended_read_pipe_content_end_s; + extern const f_string_static_t fss_extended_read_pipe_content_ignore_s; + extern const f_string_static_t fss_extended_read_pipe_content_start_s; +#endif // _di_fss_extended_read_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_fss_extended_read_parameters_ + #define FSS_EXTENDED_READ_short_at_s "a" + #define FSS_EXTENDED_READ_short_content_s "c" + #define FSS_EXTENDED_READ_short_columns_s "C" + #define FSS_EXTENDED_READ_short_delimit_s "D" + #define FSS_EXTENDED_READ_short_depth_s "d" + #define FSS_EXTENDED_READ_short_empty_s "e" + #define FSS_EXTENDED_READ_short_line_s "l" + #define FSS_EXTENDED_READ_short_name_s "n" + #define FSS_EXTENDED_READ_short_object_s "o" + #define FSS_EXTENDED_READ_short_pipe_s "p" + #define FSS_EXTENDED_READ_short_raw_s "R" + #define FSS_EXTENDED_READ_short_select_s "s" + #define FSS_EXTENDED_READ_short_total_s "t" + #define FSS_EXTENDED_READ_short_trim_s "T" + + #define FSS_EXTENDED_READ_long_at_s "at" + #define FSS_EXTENDED_READ_long_content_s "content" + #define FSS_EXTENDED_READ_long_columns_s "columns" + #define FSS_EXTENDED_READ_long_delimit_s "delimit" + #define FSS_EXTENDED_READ_long_depth_s "depth" + #define FSS_EXTENDED_READ_long_empty_s "empty" + #define FSS_EXTENDED_READ_long_line_s "line" + #define FSS_EXTENDED_READ_long_name_s "name" + #define FSS_EXTENDED_READ_long_object_s "object" + #define FSS_EXTENDED_READ_long_pipe_s "pipe" + #define FSS_EXTENDED_READ_long_raw_s "raw" + #define FSS_EXTENDED_READ_long_select_s "select" + #define FSS_EXTENDED_READ_long_total_s "total" + #define FSS_EXTENDED_READ_long_trim_s "trim" + + #define FSS_EXTENDED_READ_short_at_s_length 1 + #define FSS_EXTENDED_READ_short_content_s_length 1 + #define FSS_EXTENDED_READ_short_columns_s_length 1 + #define FSS_EXTENDED_READ_short_delimit_s_length 1 + #define FSS_EXTENDED_READ_short_depth_s_length 1 + #define FSS_EXTENDED_READ_short_empty_s_length 1 + #define FSS_EXTENDED_READ_short_line_s_length 1 + #define FSS_EXTENDED_READ_short_name_s_length 1 + #define FSS_EXTENDED_READ_short_object_s_length 1 + #define FSS_EXTENDED_READ_short_pipe_s_length 1 + #define FSS_EXTENDED_READ_short_raw_s_length 1 + #define FSS_EXTENDED_READ_short_select_s_length 1 + #define FSS_EXTENDED_READ_short_total_s_length 1 + #define FSS_EXTENDED_READ_short_trim_s_length 1 + + #define FSS_EXTENDED_READ_long_at_s_length 2 + #define FSS_EXTENDED_READ_long_content_s_length 7 + #define FSS_EXTENDED_READ_long_columns_s_length 7 + #define FSS_EXTENDED_READ_long_delimit_s_length 7 + #define FSS_EXTENDED_READ_long_depth_s_length 5 + #define FSS_EXTENDED_READ_long_empty_s_length 5 + #define FSS_EXTENDED_READ_long_line_s_length 4 + #define FSS_EXTENDED_READ_long_name_s_length 4 + #define FSS_EXTENDED_READ_long_object_s_length 6 + #define FSS_EXTENDED_READ_long_pipe_s_length 4 + #define FSS_EXTENDED_READ_long_raw_s_length 3 + #define FSS_EXTENDED_READ_long_select_s_length 6 + #define FSS_EXTENDED_READ_long_total_s_length 5 + #define FSS_EXTENDED_READ_long_trim_s_length 4 + + extern const f_string_static_t fss_extended_read_short_at_s; + extern const f_string_static_t fss_extended_read_short_content_s; + extern const f_string_static_t fss_extended_read_short_columns_s; + extern const f_string_static_t fss_extended_read_short_delimit_s; + extern const f_string_static_t fss_extended_read_short_depth_s; + extern const f_string_static_t fss_extended_read_short_empty_s; + extern const f_string_static_t fss_extended_read_short_line_s; + extern const f_string_static_t fss_extended_read_short_name_s; + extern const f_string_static_t fss_extended_read_short_object_s; + extern const f_string_static_t fss_extended_read_short_pipe_s; + extern const f_string_static_t fss_extended_read_short_raw_s; + extern const f_string_static_t fss_extended_read_short_select_s; + extern const f_string_static_t fss_extended_read_short_total_s; + extern const f_string_static_t fss_extended_read_short_trim_s; + + extern const f_string_static_t fss_extended_read_long_at_s; + extern const f_string_static_t fss_extended_read_long_content_s; + extern const f_string_static_t fss_extended_read_long_columns_s; + extern const f_string_static_t fss_extended_read_long_delimit_s; + extern const f_string_static_t fss_extended_read_long_depth_s; + extern const f_string_static_t fss_extended_read_long_empty_s; + extern const f_string_static_t fss_extended_read_long_line_s; + extern const f_string_static_t fss_extended_read_long_name_s; + extern const f_string_static_t fss_extended_read_long_object_s; + extern const f_string_static_t fss_extended_read_long_pipe_s; + extern const f_string_static_t fss_extended_read_long_raw_s; + extern const f_string_static_t fss_extended_read_long_select_s; + extern const f_string_static_t fss_extended_read_long_total_s; + extern const f_string_static_t fss_extended_read_long_trim_s; enum { fss_extended_read_parameter_help_e, @@ -128,24 +210,24 @@ extern "C" { 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(fss_extended_read_short_at_s, fss_extended_read_long_at_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_content_s, fss_extended_read_long_content_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_columns_s, fss_extended_read_long_columns_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_delimit_s, fss_extended_read_long_delimit_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_depth_s, fss_extended_read_long_depth_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_empty_s, fss_extended_read_long_empty_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_line_s, fss_extended_read_long_line_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_name_s, fss_extended_read_long_name_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_object_s, fss_extended_read_long_object_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_pipe_s, fss_extended_read_long_pipe_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_raw_s, fss_extended_read_long_raw_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_select_s, fss_extended_read_long_select_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_total_s, fss_extended_read_long_total_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_read_short_trim_s, fss_extended_read_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_at_s.string, fss_extended_read_long_at_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_content_s.string, fss_extended_read_long_content_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_columns_s.string, fss_extended_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_delimit_s.string, fss_extended_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_depth_s.string, fss_extended_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_empty_s.string, fss_extended_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_line_s.string, fss_extended_read_long_line_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_name_s.string, fss_extended_read_long_name_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_object_s.string, fss_extended_read_long_object_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_pipe_s.string, fss_extended_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_raw_s.string, fss_extended_read_long_raw_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_select_s.string, fss_extended_read_long_select_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_total_s.string, fss_extended_read_long_total_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_read_short_trim_s.string, fss_extended_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_extended_read_total_parameters_d 23 -#endif // _di_fss_extended_read_defines_ +#endif // _di_fss_extended_read_parameters_ /** * FSS Delimit Parameter data. @@ -186,36 +268,6 @@ extern "C" { }; #endif // _di_fss_extended_read_delimit_modes_ - -#ifndef _di_fss_extended_read_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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; - } fss_extended_read_main_t; - - #define fss_extended_read_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_extended_read_main_t_ - /** * Deallocate main. * @@ -232,7 +284,7 @@ extern "C" { * @see fss_extended_read_main() */ #ifndef _di_fss_extended_read_main_delete_ - extern f_status_t fss_extended_read_main_delete(fss_extended_read_main_t * const main); + extern f_status_t fss_extended_read_main_delete(fll_program_data_t * const main); #endif // _di_fss_extended_read_main_delete_ #ifdef __cplusplus 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 30eb18f..0db7da4 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -7,15 +7,6 @@ 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_initialize(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_initialize(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_initialize(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) { @@ -50,7 +41,7 @@ extern "C" { 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)"); + fll_program_print_help_usage(file, context, fss_extended_read_program_name_s, fll_program_parameter_filenames_s); fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s); @@ -127,7 +118,7 @@ extern "C" { #endif // _di_fss_extended_read_print_help_ #ifndef _di_fss_extended_read_main_ - f_status_t fss_extended_read_main(fss_extended_read_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_extended_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -139,7 +130,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_extended_read_parameter_no_color_e, fss_extended_read_parameter_light_e, fss_extended_read_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -225,17 +216,17 @@ extern "C" { } // Provide a range designating where within the buffer a particular file exists, using a statically allocated array. - fss_extended_read_file_t files_array[main->remaining.used + 1]; + fss_extended_read_file_t files_array[main->parameters.remaining.used + 1]; fss_extended_read_data_t data = fss_extended_read_data_t_initialize; data.files.array = files_array; data.files.used = 1; - data.files.size = main->remaining.used + 1; + data.files.size = main->parameters.remaining.used + 1; data.files.array[0].name = "(pipe)"; data.files.array[0].range.start = 1; data.files.array[0].range.stop = 0; - if (main->remaining.used || main->process_pipe) { + if (main->parameters.remaining.used || main->process_pipe) { { const f_array_length_t parameter_code[] = { fss_extended_read_parameter_at_e, @@ -563,12 +554,12 @@ extern "C" { } } - if (F_status_is_error_not(status) && main->remaining.used > 0) { + if (F_status_is_error_not(status) && main->parameters.remaining.used > 0) { f_file_t file = f_file_t_initialize; f_array_length_t size_file = 0; uint16_t signal_check = 0; - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % fss_extended_read_signal_check_d)) { if (fss_extended_read_signal_received(main)) { @@ -583,10 +574,10 @@ extern "C" { file.stream = 0; file.id = -1; - status = f_file_stream_open(arguments->argv[main->remaining.array[i]], 0, &file); + status = f_file_stream_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); break; } @@ -595,7 +586,7 @@ extern "C" { status = f_file_size_by_id(file.id, &size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -604,7 +595,7 @@ extern "C" { status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -612,13 +603,13 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } if (data.buffer.used > data.files.array[data.files.used].range.start) { - data.files.array[data.files.used].name = arguments->argv[main->remaining.array[i]]; + data.files.array[data.files.used].name = arguments->argv[main->parameters.remaining.array[i]]; data.files.array[data.files.used++].range.stop = data.buffer.used - 1; // This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter. 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 aea06f9..45cf617 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.h +++ b/level_3/fss_extended_read/c/fss_extended_read.h @@ -7,7 +7,7 @@ * * This is the FSS Basic Read program * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the fss_extended_read_main_t. + * This program processes files or other input in fss format and stores the results in the fll_program_data_t. * * This processes in accordance to the FSS-0001 Extended specification. */ @@ -96,7 +96,7 @@ extern "C" { * @see fss_extended_read_main_delete() */ #ifndef _di_fss_extended_read_main_ - extern f_status_t fss_extended_read_main(fss_extended_read_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_extended_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_extended_read_main_ #ifdef __cplusplus diff --git a/level_3/fss_extended_read/c/main.c b/level_3/fss_extended_read/c/main.c index c804df4..492c3bc 100644 --- a/level_3/fss_extended_read/c/main.c +++ b/level_3/fss_extended_read/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { f_console_arguments_t arguments = { argc, argv }; - fss_extended_read_main_t data = fss_extended_read_main_t_initialize; + fll_program_data_t data = fss_extended_read_main_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/fss_extended_read/c/private-common.c b/level_3/fss_extended_read/c/private-common.c index c12242e..9e850e6 100644 --- a/level_3/fss_extended_read/c/private-common.c +++ b/level_3/fss_extended_read/c/private-common.c @@ -59,7 +59,7 @@ extern "C" { #endif // _di_fss_extended_read_depths_resize_ #ifndef _di_fss_extended_read_print_signal_received_ - void fss_extended_read_print_signal_received(fss_extended_read_main_t * const main, const f_status_t signal) { + void fss_extended_read_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -77,7 +77,7 @@ extern "C" { #endif // _di_fss_extended_read_print_signal_received_ #ifndef _di_fss_extended_read_signal_received_ - f_status_t fss_extended_read_signal_received(fss_extended_read_main_t * const main) { + f_status_t fss_extended_read_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_extended_read/c/private-common.h b/level_3/fss_extended_read/c/private-common.h index d88cd00..0094e54 100644 --- a/level_3/fss_extended_read/c/private-common.h +++ b/level_3/fss_extended_read/c/private-common.h @@ -257,7 +257,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_extended_read_print_signal_received_ - extern void fss_extended_read_print_signal_received(fss_extended_read_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_extended_read_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_print_signal_received_ /** @@ -275,7 +275,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_extended_read_signal_received_ - extern f_status_t fss_extended_read_signal_received(fss_extended_read_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_signal_received_ #ifdef __cplusplus diff --git a/level_3/fss_extended_read/c/private-print.c b/level_3/fss_extended_read/c/private-print.c index 84c2403..9b1edb7 100644 --- a/level_3/fss_extended_read/c/private-print.c +++ b/level_3/fss_extended_read/c/private-print.c @@ -8,7 +8,7 @@ extern "C" { #endif #ifndef _di_fss_extended_read_print_at_ - void fss_extended_read_print_at(fss_extended_read_main_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_extended_read_data_t * const data) { + void fss_extended_read_print_at(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_extended_read_data_t * const data) { if (at >= data->contents.used) { return; @@ -100,7 +100,7 @@ extern "C" { #endif // _di_fss_extended_read_print_at_ #ifndef _di_fss_extended_read_print_at_total_ - f_status_t fss_extended_read_print_at_total(fss_extended_read_main_t * const main, const f_array_length_t at, fss_extended_read_data_t *data) { + f_status_t fss_extended_read_print_at_total(fll_program_data_t * const main, const f_array_length_t at, fss_extended_read_data_t *data) { if (data->option & fss_extended_read_data_option_select_d) { if (data->option & fss_extended_read_data_option_object_d) { @@ -154,7 +154,7 @@ extern "C" { #endif // _di_fss_extended_read_print_at_total_ #ifndef _di_fss_extended_read_print_content_end_ - void fss_extended_read_print_content_end(fss_extended_read_main_t * const main) { + void fss_extended_read_print_content_end(fll_program_data_t * const main) { if (main->parameters.array[fss_extended_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_extended_read_pipe_content_start_s, main->output.to.stream); @@ -166,7 +166,7 @@ extern "C" { #endif // _di_fss_extended_read_print_content_end_ #ifndef _di_fss_extended_read_print_object_end_ - void fss_extended_read_print_object_end(fss_extended_read_main_t * const main) { + void fss_extended_read_print_object_end(fll_program_data_t * const main) { if (main->parameters.array[fss_extended_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_extended_read_pipe_content_end_s, main->output.to.stream); @@ -178,7 +178,7 @@ extern "C" { #endif // _di_fss_extended_read_print_object_end_ #ifndef _di_fss_extended_read_print_one_ - void fss_extended_read_print_one(fss_extended_read_main_t * const main) { + void fss_extended_read_print_one(fll_program_data_t * const main) { f_print_character(f_string_ascii_1_s.string[0], main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); @@ -186,7 +186,7 @@ extern "C" { #endif // _di_fss_extended_read_print_one_ #ifndef _di_fss_extended_read_print_set_end_ - void fss_extended_read_print_set_end(fss_extended_read_main_t * const main) { + void fss_extended_read_print_set_end(fll_program_data_t * const main) { if (main->parameters.array[fss_extended_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_extended_read_pipe_content_end_s, main->output.to.stream); @@ -198,7 +198,7 @@ extern "C" { #endif // _di_fss_extended_read_print_set_end_ #ifndef _di_fss_extended_read_print_zero_ - void fss_extended_read_print_zero(fss_extended_read_main_t * const main) { + void fss_extended_read_print_zero(fll_program_data_t * const main) { f_print_character(f_string_ascii_0_s.string[0], main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); diff --git a/level_3/fss_extended_read/c/private-print.h b/level_3/fss_extended_read/c/private-print.h index dbc2bb4..59692c8 100644 --- a/level_3/fss_extended_read/c/private-print.h +++ b/level_3/fss_extended_read/c/private-print.h @@ -29,7 +29,7 @@ extern "C" { * The program data. */ #ifndef _di_fss_extended_read_print_at_ - extern void fss_extended_read_print_at(fss_extended_read_main_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_extended_read_data_t * const data) F_attribute_visibility_internal_d; + extern void fss_extended_read_print_at(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_extended_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_print_at_ /** @@ -47,7 +47,7 @@ extern "C" { * F_success on success and something was matched (and total was printed). */ #ifndef _di_fss_extended_read_print_at_total_ - extern f_status_t fss_extended_read_print_at_total(fss_extended_read_main_t * const main, const f_array_length_t at, fss_extended_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_print_at_total(fll_program_data_t * const main, const f_array_length_t at, fss_extended_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_print_at_total_ /** @@ -57,7 +57,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_extended_read_print_content_end_ - extern void fss_extended_read_print_content_end(fss_extended_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_extended_read_print_content_end(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_print_content_end_ /** @@ -67,7 +67,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_extended_read_print_object_end_ - extern void fss_extended_read_print_object_end(fss_extended_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_extended_read_print_object_end(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_print_object_end_ /** @@ -77,7 +77,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_extended_read_print_one_ - extern void fss_extended_read_print_one(fss_extended_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_extended_read_print_one(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_print_one_ /** @@ -87,7 +87,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_extended_read_print_set_end_ - extern void fss_extended_read_print_set_end(fss_extended_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_extended_read_print_set_end(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_print_set_end_ /** @@ -97,7 +97,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_extended_read_print_zero_ - extern void fss_extended_read_print_zero(fss_extended_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_extended_read_print_zero(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_print_zero_ #ifdef __cplusplus diff --git a/level_3/fss_extended_read/c/private-read.c b/level_3/fss_extended_read/c/private-read.c index c220574..7dced40 100644 --- a/level_3/fss_extended_read/c/private-read.c +++ b/level_3/fss_extended_read/c/private-read.c @@ -60,7 +60,7 @@ extern "C" { #endif // _di_fss_extended_read_delimit_content_is_ #ifndef _di_fss_extended_read_depth_process_ - f_status_t fss_extended_read_depth_process(fss_extended_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) { + f_status_t fss_extended_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) { f_status_t status = F_none; @@ -248,7 +248,7 @@ extern "C" { #endif // _di_fss_extended_read_file_identify_ #ifndef _di_fss_extended_read_load_ - f_status_t fss_extended_read_load(fss_extended_read_main_t * const main, fss_extended_read_data_t *data) { + f_status_t fss_extended_read_load(fll_program_data_t * const main, fss_extended_read_data_t *data) { f_state_t state = macro_f_state_t_initialize(fss_extended_read_common_allocation_large_d, fss_extended_read_common_allocation_small_d, 0, 0, 0, 0, 0); f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used); @@ -283,7 +283,7 @@ extern "C" { #endif // _di_fss_extended_read_load_ #ifndef _di_fss_extended_read_load_number_ - f_status_t fss_extended_read_load_number(fss_extended_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) { + f_status_t fss_extended_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; @@ -305,7 +305,7 @@ extern "C" { #endif // _di_fss_extended_read_load_number_ #ifndef _di_fss_extended_read_process_ - f_status_t fss_extended_read_process(fss_extended_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) { + f_status_t fss_extended_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) { f_status_t status = fss_extended_read_process_option(main, arguments, data); if (F_status_is_error(status)) return status; @@ -355,7 +355,7 @@ extern "C" { #endif // _di_fss_extended_read_process_ #ifndef _di_fss_extended_read_process_at_ - f_status_t fss_extended_read_process_at(fss_extended_read_main_t * const main, fss_extended_read_data_t *data, bool names[]) { + f_status_t fss_extended_read_process_at(fll_program_data_t * const main, fss_extended_read_data_t *data, bool names[]) { if (data->depths.array[0].value_at >= data->objects.used) { if (data->option & (fss_extended_read_data_option_columns_d | fss_extended_read_data_option_total_d)) { @@ -461,7 +461,7 @@ extern "C" { #endif // _di_fss_extended_read_process_at_ #ifndef _di_fss_extended_read_process_columns_ - f_status_t fss_extended_read_process_columns(fss_extended_read_main_t * const main, fss_extended_read_data_t *data, bool names[]) { + f_status_t fss_extended_read_process_columns(fll_program_data_t * const main, fss_extended_read_data_t *data, bool names[]) { if (!(data->option & fss_extended_read_data_option_content_d)) { flockfile(main->output.to.stream); @@ -491,7 +491,7 @@ extern "C" { #endif // _di_fss_extended_read_process_columns_ #ifndef _di_fss_extended_read_process_line_ - f_status_t fss_extended_read_process_line(fss_extended_read_main_t * const main, fss_extended_read_data_t *data, bool names[]) { + f_status_t fss_extended_read_process_line(fll_program_data_t * const main, fss_extended_read_data_t *data, bool names[]) { f_array_lengths_t except_none = f_array_lengths_t_initialize; f_array_lengths_t *delimits_object = fss_extended_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none; @@ -577,7 +577,7 @@ extern "C" { #endif // _di_fss_extended_read_process_name_ #ifndef _di_fss_extended_read_process_option_ - f_status_t fss_extended_read_process_option(fss_extended_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) { + f_status_t fss_extended_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) { f_status_t status = F_none; @@ -641,7 +641,7 @@ extern "C" { #endif // _di_fss_extended_read_process_option_ #ifndef _di_fss_extended_read_process_total_ - f_status_t fss_extended_read_process_total(fss_extended_read_main_t * const main, fss_extended_read_data_t *data, bool names[]) { + f_status_t fss_extended_read_process_total(fll_program_data_t * const main, fss_extended_read_data_t *data, bool names[]) { f_array_length_t total = 0; diff --git a/level_3/fss_extended_read/c/private-read.h b/level_3/fss_extended_read/c/private-read.h index 7462de5..509e3ef 100644 --- a/level_3/fss_extended_read/c/private-read.h +++ b/level_3/fss_extended_read/c/private-read.h @@ -72,7 +72,7 @@ extern "C" { * @see fss_extended_read_depths_resize() */ #ifndef _di_fss_extended_read_depth_process_ - extern f_status_t fss_extended_read_depth_process(fss_extended_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_depth_process_ /** @@ -116,7 +116,7 @@ extern "C" { * @see fss_extended_read_process_option() */ #ifndef _di_fss_extended_read_load_ - extern f_status_t fss_extended_read_load(fss_extended_read_main_t * const main, fss_extended_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_load(fll_program_data_t * const main, fss_extended_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_load_ /** @@ -146,7 +146,7 @@ extern "C" { * @see fss_extended_read_depths_resize() */ #ifndef _di_fss_extended_read_load_number_ - extern f_status_t fss_extended_read_load_number(fss_extended_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_load_number_ /** @@ -171,7 +171,7 @@ extern "C" { * @see fss_extended_read_process_option() */ #ifndef _di_fss_extended_read_process_ - extern f_status_t fss_extended_read_process(fss_extended_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_process_ /** @@ -189,7 +189,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_extended_read_process_at_ - extern f_status_t fss_extended_read_process_at(fss_extended_read_main_t * const main, fss_extended_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_process_at(fll_program_data_t * const main, fss_extended_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_process_at_ /** @@ -207,7 +207,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_extended_read_process_columns_ - extern f_status_t fss_extended_read_process_columns(fss_extended_read_main_t * const main, fss_extended_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_process_columns(fll_program_data_t * const main, fss_extended_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_process_columns_ /** @@ -225,7 +225,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_extended_read_process_line_ - extern f_status_t fss_extended_read_process_line(fss_extended_read_main_t * const main, fss_extended_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_process_line(fll_program_data_t * const main, fss_extended_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_process_line_ /** @@ -266,7 +266,7 @@ extern "C" { * @see fss_extended_read_load_setting() */ #ifndef _di_fss_extended_read_process_option_ - extern f_status_t fss_extended_read_process_option(fss_extended_read_main_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_extended_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_process_option_ /** @@ -284,7 +284,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_extended_read_process_total_ - extern f_status_t fss_extended_read_process_total(fss_extended_read_main_t * const main, fss_extended_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_process_total(fll_program_data_t * const main, fss_extended_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_process_total_ /** @@ -300,7 +300,7 @@ extern "C" { * F_false if not delimited. */ #ifndef _di_fss_extended_read_is_delimited_at_depth_ - extern f_status_t fss_extended_read_is_delimited_at_depth(fss_extended_read_main_t * const main, const f_array_length_t depth) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_is_delimited_at_depth(fll_program_data_t * const main, const f_array_length_t depth) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_is_delimited_at_depth_ /** @@ -327,7 +327,7 @@ extern "C" { * @see fss_extended_read_main_preprocess_depth() */ #ifndef _di_fss_extended_read_main_process_file_ - extern f_status_t fss_extended_read_main_process_file(fss_extended_read_main_t * const main, const f_console_arguments_t arguments, const f_string_t file_name, const fss_extended_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_read_main_process_file(fll_program_data_t * const main, const f_console_arguments_t arguments, const f_string_t file_name, const fss_extended_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) F_attribute_visibility_internal_d; #endif // _di_fss_extended_read_main_process_file_ #ifdef __cplusplus diff --git a/level_3/fss_extended_write/c/common.c b/level_3/fss_extended_write/c/common.c index 823700d..d7ec540 100644 --- a/level_3/fss_extended_write/c/common.c +++ b/level_3/fss_extended_write/c/common.c @@ -13,16 +13,38 @@ extern "C" { const f_string_static_t fss_extended_write_program_name_long_s = macro_f_string_static_t_initialize(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_main_delete_ - f_status_t fss_extended_write_main_delete(fss_extended_write_main_t * const main) { - - f_console_parameters_delete(&main->parameters); +#ifndef _di_fss_extended_write_defines_ + const f_string_static_t fss_extended_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_pipe_content_end_s, 0, FSS_EXTENDED_WRITE_pipe_content_end_s_length); + const f_string_static_t fss_extended_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_pipe_content_ignore_s, 0, FSS_EXTENDED_WRITE_pipe_content_ignore_s_length); + const f_string_static_t fss_extended_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_pipe_content_start_s, 0, FSS_EXTENDED_WRITE_pipe_content_start_s_length); +#endif // _di_fss_extended_write_defines_ + +#ifndef _di_fss_extended_write_parameters_ + const f_string_static_t fss_extended_write_short_file_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_file_s, 0, FSS_EXTENDED_WRITE_short_file_s_length); + const f_string_static_t fss_extended_write_short_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_content_s, 0, FSS_EXTENDED_WRITE_short_content_s_length); + const f_string_static_t fss_extended_write_short_double_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_double_s, 0, FSS_EXTENDED_WRITE_short_double_s_length); + const f_string_static_t fss_extended_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_ignore_s, 0, FSS_EXTENDED_WRITE_short_ignore_s_length); + const f_string_static_t fss_extended_write_short_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_object_s, 0, FSS_EXTENDED_WRITE_short_object_s_length); + const f_string_static_t fss_extended_write_short_partial_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_partial_s, 0, FSS_EXTENDED_WRITE_short_partial_s_length); + const f_string_static_t fss_extended_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_prepend_s, 0, FSS_EXTENDED_WRITE_short_prepend_s_length); + const f_string_static_t fss_extended_write_short_single_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_single_s, 0, FSS_EXTENDED_WRITE_short_single_s_length); + const f_string_static_t fss_extended_write_short_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_trim_s, 0, FSS_EXTENDED_WRITE_short_trim_s_length); + + const f_string_static_t fss_extended_write_long_file_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_file_s, 0, FSS_EXTENDED_WRITE_long_file_s_length); + const f_string_static_t fss_extended_write_long_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_content_s, 0, FSS_EXTENDED_WRITE_long_content_s_length); + const f_string_static_t fss_extended_write_long_double_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_double_s, 0, FSS_EXTENDED_WRITE_long_double_s_length); + const f_string_static_t fss_extended_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_ignore_s, 0, FSS_EXTENDED_WRITE_long_ignore_s_length); + const f_string_static_t fss_extended_write_long_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_object_s, 0, FSS_EXTENDED_WRITE_long_object_s_length); + const f_string_static_t fss_extended_write_long_partial_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_partial_s, 0, FSS_EXTENDED_WRITE_long_partial_s_length); + const f_string_static_t fss_extended_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_prepend_s, 0, FSS_EXTENDED_WRITE_long_prepend_s_length); + const f_string_static_t fss_extended_write_long_single_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_single_s, 0, FSS_EXTENDED_WRITE_long_single_s_length); + const f_string_static_t fss_extended_write_long_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_trim_s, 0, FSS_EXTENDED_WRITE_long_trim_s_length); +#endif // _di_fss_extended_write_parameters_ - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); +#ifndef _di_fss_extended_write_main_delete_ + f_status_t fss_extended_write_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_extended_write_main_delete_ diff --git a/level_3/fss_extended_write/c/common.h b/level_3/fss_extended_write/c/common.h index 1d5480c..405778c 100644 --- a/level_3/fss_extended_write/c/common.h +++ b/level_3/fss_extended_write/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_extended_write_program_version_s; #endif // _di_fss_extended_write_program_version_ +/** + * The program name. + */ #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" @@ -53,32 +59,88 @@ extern "C" { extern const f_string_static_t fss_extended_write_program_name_long_s; #endif // _di_fss_extended_write_program_name_ +/** + * The main program defines. + */ #ifndef _di_fss_extended_write_defines_ #define fss_extended_write_signal_check_d 10000 - #define fss_extended_write_pipe_content_end_s '\f' - #define fss_extended_write_pipe_content_ignore_s '\v' - #define fss_extended_write_pipe_content_start_s '\b' - - #define fss_extended_write_short_file_s "f" - #define fss_extended_write_short_content_s "c" - #define fss_extended_write_short_double_s "d" - #define fss_extended_write_short_ignore_s "I" - #define fss_extended_write_short_object_s "o" - #define fss_extended_write_short_partial_s "p" - #define fss_extended_write_short_prepend_s "P" - #define fss_extended_write_short_single_s "s" - #define fss_extended_write_short_trim_s "T" - - #define fss_extended_write_long_file_s "file" - #define fss_extended_write_long_content_s "content" - #define fss_extended_write_long_double_s "double" - #define fss_extended_write_long_ignore_s "ignore" - #define fss_extended_write_long_object_s "object" - #define fss_extended_write_long_partial_s "partial" - #define fss_extended_write_long_prepend_s "prepend" - #define fss_extended_write_long_single_s "single" - #define fss_extended_write_long_trim_s "trim" + #define FSS_EXTENDED_WRITE_pipe_content_end_s "\f" + #define FSS_EXTENDED_WRITE_pipe_content_ignore_s "\v" + #define FSS_EXTENDED_WRITE_pipe_content_start_s "\b" + + #define FSS_EXTENDED_WRITE_pipe_content_end_s_length 1 + #define FSS_EXTENDED_WRITE_pipe_content_ignore_s_length 1 + #define FSS_EXTENDED_WRITE_pipe_content_start_s_length 1 + + extern const f_string_static_t fss_extended_write_pipe_content_end_s; + extern const f_string_static_t fss_extended_write_pipe_content_ignore_s; + extern const f_string_static_t fss_extended_write_pipe_content_start_s; +#endif // _di_fss_extended_write_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_fss_extended_write_parameters_ + #define FSS_EXTENDED_WRITE_short_file_s "f" + #define FSS_EXTENDED_WRITE_short_content_s "c" + #define FSS_EXTENDED_WRITE_short_double_s "d" + #define FSS_EXTENDED_WRITE_short_ignore_s "I" + #define FSS_EXTENDED_WRITE_short_object_s "o" + #define FSS_EXTENDED_WRITE_short_partial_s "p" + #define FSS_EXTENDED_WRITE_short_prepend_s "P" + #define FSS_EXTENDED_WRITE_short_single_s "s" + #define FSS_EXTENDED_WRITE_short_trim_s "T" + + #define FSS_EXTENDED_WRITE_long_file_s "file" + #define FSS_EXTENDED_WRITE_long_content_s "content" + #define FSS_EXTENDED_WRITE_long_double_s "double" + #define FSS_EXTENDED_WRITE_long_ignore_s "ignore" + #define FSS_EXTENDED_WRITE_long_object_s "object" + #define FSS_EXTENDED_WRITE_long_partial_s "partial" + #define FSS_EXTENDED_WRITE_long_prepend_s "prepend" + #define FSS_EXTENDED_WRITE_long_single_s "single" + #define FSS_EXTENDED_WRITE_long_trim_s "trim" + + #define FSS_EXTENDED_WRITE_short_file_s_length 1 + #define FSS_EXTENDED_WRITE_short_content_s_length 1 + #define FSS_EXTENDED_WRITE_short_double_s_length 1 + #define FSS_EXTENDED_WRITE_short_ignore_s_length 1 + #define FSS_EXTENDED_WRITE_short_object_s_length 1 + #define FSS_EXTENDED_WRITE_short_partial_s_length 1 + #define FSS_EXTENDED_WRITE_short_prepend_s_length 1 + #define FSS_EXTENDED_WRITE_short_single_s_length 1 + #define FSS_EXTENDED_WRITE_short_trim_s_length 1 + + #define FSS_EXTENDED_WRITE_long_file_s_length 4 + #define FSS_EXTENDED_WRITE_long_content_s_length 7 + #define FSS_EXTENDED_WRITE_long_double_s_length 6 + #define FSS_EXTENDED_WRITE_long_ignore_s_length 6 + #define FSS_EXTENDED_WRITE_long_object_s_length 6 + #define FSS_EXTENDED_WRITE_long_partial_s_length 7 + #define FSS_EXTENDED_WRITE_long_prepend_s_length 7 + #define FSS_EXTENDED_WRITE_long_single_s_length 6 + #define FSS_EXTENDED_WRITE_long_trim_s_length 4 + + extern const f_string_static_t fss_extended_write_short_file_s; + extern const f_string_static_t fss_extended_write_short_content_s; + extern const f_string_static_t fss_extended_write_short_double_s; + extern const f_string_static_t fss_extended_write_short_ignore_s; + extern const f_string_static_t fss_extended_write_short_object_s; + extern const f_string_static_t fss_extended_write_short_partial_s; + extern const f_string_static_t fss_extended_write_short_prepend_s; + extern const f_string_static_t fss_extended_write_short_single_s; + extern const f_string_static_t fss_extended_write_short_trim_s; + + extern const f_string_static_t fss_extended_write_long_file_s; + extern const f_string_static_t fss_extended_write_long_content_s; + extern const f_string_static_t fss_extended_write_long_double_s; + extern const f_string_static_t fss_extended_write_long_ignore_s; + extern const f_string_static_t fss_extended_write_long_object_s; + extern const f_string_static_t fss_extended_write_long_partial_s; + extern const f_string_static_t fss_extended_write_long_prepend_s; + extern const f_string_static_t fss_extended_write_long_single_s; + extern const f_string_static_t fss_extended_write_long_trim_s; enum { fss_extended_write_parameter_help_e, @@ -113,51 +175,19 @@ extern "C" { 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, F_false, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(fss_extended_write_short_file_s, fss_extended_write_long_file_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_write_short_content_s, fss_extended_write_long_content_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_write_short_double_s, fss_extended_write_long_double_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_write_short_ignore_s, fss_extended_write_long_ignore_s, 0, 2, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_write_short_object_s, fss_extended_write_long_object_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_write_short_partial_s, fss_extended_write_long_partial_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_write_short_prepend_s, fss_extended_write_long_prepend_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_write_short_single_s, fss_extended_write_long_single_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_extended_write_short_trim_s, fss_extended_write_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_write_short_file_s.string, fss_extended_write_long_file_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_write_short_content_s.string, fss_extended_write_long_content_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_write_short_double_s.string, fss_extended_write_long_double_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_write_short_ignore_s.string, fss_extended_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_write_short_object_s.string, fss_extended_write_long_object_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_write_short_partial_s.string, fss_extended_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_write_short_prepend_s.string, fss_extended_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_write_short_single_s.string, fss_extended_write_long_single_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_extended_write_short_trim_s.string, fss_extended_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_extended_write_total_parameters_d 18 -#endif // _di_fss_extended_write_defines_ - -#ifndef _di_fss_extended_write_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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_string_static_t prepend; - - f_color_context_t context; - } fss_extended_write_main_t; - - #define fss_extended_write_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_string_static_t_initialize, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_extended_write_main_t_ +#endif // _di_fss_extended_write_parameters_ /** * Deallocate main. @@ -175,7 +205,7 @@ extern "C" { * @see fss_extended_write_main() */ #ifndef _di_fss_extended_write_main_delete_ - extern f_status_t fss_extended_write_main_delete(fss_extended_write_main_t * const main); + extern f_status_t fss_extended_write_main_delete(fll_program_data_t * const main); #endif // _di_fss_extended_write_main_delete_ #ifdef __cplusplus 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 d898e2e..71a1691 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -6,15 +6,6 @@ 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_initialize(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_initialize(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_initialize(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) { @@ -66,7 +57,7 @@ extern "C" { #endif // _di_fss_extended_write_print_help_ #ifndef _di_fss_extended_write_main_ - f_status_t fss_extended_write_main(fss_extended_write_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_extended_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -78,7 +69,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_extended_write_parameter_no_color_e, fss_extended_write_parameter_light_e, fss_extended_write_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; 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 d60aea7..835744e 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.h +++ b/level_3/fss_extended_write/c/fss_extended_write.h @@ -88,7 +88,7 @@ extern "C" { * @see fss_extended_write_main_delete() */ #ifndef _di_fss_extended_write_main_ - extern f_status_t fss_extended_write_main(fss_extended_write_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_extended_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_extended_write_main_ #ifdef __cplusplus diff --git a/level_3/fss_extended_write/c/main.c b/level_3/fss_extended_write/c/main.c index 12d2ee0..83662f0 100644 --- a/level_3/fss_extended_write/c/main.c +++ b/level_3/fss_extended_write/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_extended_write_main_t data = fss_extended_write_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/fss_extended_write/c/private-common.c b/level_3/fss_extended_write/c/private-common.c index 5fd86f5..8cf08ea 100644 --- a/level_3/fss_extended_write/c/private-common.c +++ b/level_3/fss_extended_write/c/private-common.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fss_extended_write_print_signal_received_ - void fss_extended_write_print_signal_received(fss_extended_write_main_t * const main, const f_status_t signal) { + void fss_extended_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -24,7 +24,7 @@ extern "C" { #endif // _di_fss_extended_write_print_signal_received_ #ifndef _di_fss_extended_write_signal_received_ - f_status_t fss_extended_write_signal_received(fss_extended_write_main_t * const main) { + f_status_t fss_extended_write_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_extended_write/c/private-common.h b/level_3/fss_extended_write/c/private-common.h index 495e5e4..4b439d9 100644 --- a/level_3/fss_extended_write/c/private-common.h +++ b/level_3/fss_extended_write/c/private-common.h @@ -33,7 +33,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_extended_write_print_signal_received_ - extern void fss_extended_write_print_signal_received(fss_extended_write_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_extended_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_extended_write_print_signal_received_ /** @@ -51,7 +51,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_extended_write_signal_received_ - extern f_status_t fss_extended_write_signal_received(fss_extended_write_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_write_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_write_signal_received_ #ifdef __cplusplus diff --git a/level_3/fss_extended_write/c/private-write.c b/level_3/fss_extended_write/c/private-write.c index af48d10..fbce8d7 100644 --- a/level_3/fss_extended_write/c/private-write.c +++ b/level_3/fss_extended_write/c/private-write.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_extended_write_error_parameter_at_least_once_print_ - void fss_extended_write_error_parameter_at_least_once(fss_extended_write_main_t * const main) { + void fss_extended_write_error_parameter_at_least_once(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -28,7 +28,7 @@ extern "C" { #endif // _di_fss_extended_write_error_parameter_at_least_once_print_ #ifndef _di_fss_extended_write_error_parameter_value_missing_print_ - void fss_extended_write_error_parameter_value_missing_print(fss_extended_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) { + void fss_extended_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_t symbol, const f_string_t parameter) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -45,7 +45,7 @@ extern "C" { #endif // _di_fss_extended_write_error_parameter_value_missing_print_ #ifndef _di_fss_extended_write_error_parameter_unsupported_eol_print_ - void fss_extended_write_error_parameter_unsupported_eol_print(fss_extended_write_main_t * const main) { + void fss_extended_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -62,7 +62,7 @@ extern "C" { #endif // _di_fss_extended_write_error_parameter_unsupported_eol_print_ #ifndef _di_fss_extended_write_process_ - f_status_t fss_extended_write_process(fss_extended_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) { + f_status_t fss_extended_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_state_t state = macro_f_state_t_initialize(fss_extended_write_common_allocation_large_d, fss_extended_write_common_allocation_small_d, 0, 0, 0, 0, 0); @@ -152,7 +152,7 @@ extern "C" { #endif // _di_fss_extended_write_process_ #ifndef _di_fss_extended_write_process_pipe_ - f_status_t fss_extended_write_process_pipe(fss_extended_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { + f_status_t fss_extended_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_status_t status_pipe = F_none; diff --git a/level_3/fss_extended_write/c/private-write.h b/level_3/fss_extended_write/c/private-write.h index bae6eb9..b5a5066 100644 --- a/level_3/fss_extended_write/c/private-write.h +++ b/level_3/fss_extended_write/c/private-write.h @@ -23,7 +23,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_write_error_parameter_at_least_once_print_ - void fss_extended_write_error_parameter_at_least_once(fss_extended_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_extended_write_error_parameter_at_least_once(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_write_error_parameter_at_least_once_print_ /** @@ -41,7 +41,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_write_error_parameter_value_missing_print_ - void fss_extended_write_error_parameter_value_missing_print(fss_extended_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) F_attribute_visibility_internal_d; + void fss_extended_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_t symbol, const f_string_t parameter) F_attribute_visibility_internal_d; #endif // _di_fss_extended_write_error_parameter_value_missing_print_ /** @@ -55,7 +55,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_write_error_parameter_unsupported_eol_print_ - void fss_extended_write_error_parameter_unsupported_eol_print(fss_extended_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_extended_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_extended_write_error_parameter_unsupported_eol_print_ /** @@ -82,7 +82,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_write_process_ - extern f_status_t fss_extended_write_process(fss_extended_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; #endif // _di_fss_extended_write_process_ /** @@ -103,7 +103,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_write_process_pipe_ - extern f_status_t fss_extended_write_process_pipe(fss_extended_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; + extern f_status_t fss_extended_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; #endif // _di_fss_extended_write_process_pipe_ #ifdef __cplusplus diff --git a/level_3/fss_identify/c/common.c b/level_3/fss_identify/c/common.c index ae737ea..6beb761 100644 --- a/level_3/fss_identify/c/common.c +++ b/level_3/fss_identify/c/common.c @@ -13,16 +13,24 @@ extern "C" { const f_string_static_t fss_identify_program_name_long_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_program_name_long_s, 0, FSS_IDENTIFY_program_name_long_s_length); #endif // _di_fss_identify_program_name_ -#ifndef _di_fss_identify_main_delete_ - f_status_t fss_identify_main_delete(fss_identify_main_t * const main) { - - f_console_parameters_delete(&main->parameters); +#ifndef _di_fss_identify_parameters_ + const f_string_static_t fss_identify_short_content_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_short_content_s, 0, FSS_IDENTIFY_short_content_s_length); + const f_string_static_t fss_identify_short_line_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_short_line_s, 0, FSS_IDENTIFY_short_line_s_length); + const f_string_static_t fss_identify_short_name_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_short_name_s, 0, FSS_IDENTIFY_short_name_s_length); + const f_string_static_t fss_identify_short_object_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_short_object_s, 0, FSS_IDENTIFY_short_object_s_length); + const f_string_static_t fss_identify_short_total_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_short_total_s, 0, FSS_IDENTIFY_short_total_s_length); + + const f_string_static_t fss_identify_long_content_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_long_content_s, 0, FSS_IDENTIFY_long_content_s_length); + const f_string_static_t fss_identify_long_line_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_long_line_s, 0, FSS_IDENTIFY_long_line_s_length); + const f_string_static_t fss_identify_long_name_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_long_name_s, 0, FSS_IDENTIFY_long_name_s_length); + const f_string_static_t fss_identify_long_object_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_long_object_s, 0, FSS_IDENTIFY_long_object_s_length); + const f_string_static_t fss_identify_long_total_s = macro_f_string_static_t_initialize(FSS_IDENTIFY_long_total_s, 0, FSS_IDENTIFY_long_total_s_length); +#endif // _di_fss_identify_parameters_ - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); +#ifndef _di_fss_identify_main_delete_ + f_status_t fss_identify_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_identify_main_delete_ diff --git a/level_3/fss_identify/c/common.h b/level_3/fss_identify/c/common.h index 6e2786e..5d51e21 100644 --- a/level_3/fss_identify/c/common.h +++ b/level_3/fss_identify/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { const f_string_static_t fss_identify_program_version_s; #endif // _di_fss_identify_program_version_ +/** + * The program name. + */ #ifndef _di_fss_identify_program_name_ #define FSS_IDENTIFY_program_name_s "fss_identify" #define FSS_IDENTIFY_program_name_long_s "FSS Identify" @@ -53,20 +59,52 @@ extern "C" { const f_string_static_t fss_identify_program_name_long_s; #endif // _di_fss_identify_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_identify_defines_ #define fss_identify_signal_check_d 10000 +#endif // _di_fss_identify_defines_ - #define fss_identify_short_content_s "c" - #define fss_identify_short_line_s "l" - #define fss_identify_short_name_s "n" - #define fss_identify_short_object_s "o" - #define fss_identify_short_total_s "t" - - #define fss_identify_long_content_s "content" - #define fss_identify_long_line_s "line" - #define fss_identify_long_name_s "name" - #define fss_identify_long_object_s "object" - #define fss_identify_long_total_s "total" +/** + * The main program parameters. + */ +#ifndef _di_fss_identify_parameters_ + #define FSS_IDENTIFY_short_content_s "c" + #define FSS_IDENTIFY_short_line_s "l" + #define FSS_IDENTIFY_short_name_s "n" + #define FSS_IDENTIFY_short_object_s "o" + #define FSS_IDENTIFY_short_total_s "t" + + #define FSS_IDENTIFY_long_content_s "content" + #define FSS_IDENTIFY_long_line_s "line" + #define FSS_IDENTIFY_long_name_s "name" + #define FSS_IDENTIFY_long_object_s "object" + #define FSS_IDENTIFY_long_total_s "total" + + #define FSS_IDENTIFY_short_content_s_length 1 + #define FSS_IDENTIFY_short_line_s_length 1 + #define FSS_IDENTIFY_short_name_s_length 1 + #define FSS_IDENTIFY_short_object_s_length 1 + #define FSS_IDENTIFY_short_total_s_length 1 + + #define FSS_IDENTIFY_long_content_s_length 7 + #define FSS_IDENTIFY_long_line_s_length 4 + #define FSS_IDENTIFY_long_name_s_length 4 + #define FSS_IDENTIFY_long_object_s_length 6 + #define FSS_IDENTIFY_long_total_s_length 5 + + extern const f_string_static_t fss_identify_short_content_s; + extern const f_string_static_t fss_identify_short_line_s; + extern const f_string_static_t fss_identify_short_name_s; + extern const f_string_static_t fss_identify_short_object_s; + extern const f_string_static_t fss_identify_short_total_s; + + extern const f_string_static_t fss_identify_long_content_s; + extern const f_string_static_t fss_identify_long_line_s; + extern const f_string_static_t fss_identify_long_name_s; + extern const f_string_static_t fss_identify_long_object_s; + extern const f_string_static_t fss_identify_long_total_s; enum { fss_identify_parameter_help_e, @@ -97,44 +135,15 @@ extern "C" { 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(fss_identify_short_content_s, fss_identify_long_content_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_identify_short_line_s, fss_identify_long_line_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_identify_short_name_s, fss_identify_long_name_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_identify_short_object_s, fss_identify_long_object_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_identify_short_total_s, fss_identify_long_total_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_identify_short_content_s.string, fss_identify_long_content_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_identify_short_line_s.string, fss_identify_long_line_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_identify_short_name_s.string, fss_identify_long_name_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_identify_short_object_s.string, fss_identify_long_object_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_identify_short_total_s.string, fss_identify_long_total_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_identify_total_parameters_d 14 -#endif // _di_fss_identify_defines_ - -#ifndef _di_fss_identify_data_t_ - typedef struct { - f_console_parameters_t parameters; - - 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; - } fss_identify_main_t; - - #define fss_identify_data_initialize \ - { \ - f_console_parameters_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, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_identify_data_t_ +#endif // _di_fss_identify_parameters_ /** * Deallocate main. @@ -152,7 +161,7 @@ extern "C" { * @see fss_identify_main() */ #ifndef _di_fss_identify_main_delete_ - extern f_status_t fss_identify_main_delete(fss_identify_main_t * const main); + extern f_status_t fss_identify_main_delete(fll_program_data_t * const main); #endif // _di_fss_identify_main_delete_ #ifdef __cplusplus diff --git a/level_3/fss_identify/c/fss_identify.c b/level_3/fss_identify/c/fss_identify.c index 0ea7f0b..4a118fe 100644 --- a/level_3/fss_identify/c/fss_identify.c +++ b/level_3/fss_identify/c/fss_identify.c @@ -6,15 +6,6 @@ extern "C" { #endif -#ifndef _di_fss_identify_program_version_ - const f_string_static_t fss_identify_program_version_s = macro_f_string_static_t_initialize(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_initialize(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_initialize(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) { @@ -43,7 +34,7 @@ extern "C" { 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)"); + fll_program_print_help_usage(file, context, fss_identify_program_name_s, fll_program_parameter_filenames_s); fl_print_format(" The %[%r%s%] parameter refers to the file lines and not the lines in a given file.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_line_s, context.set.notable, f_string_eol_s, f_string_eol_s); @@ -67,7 +58,7 @@ extern "C" { #endif // _di_fss_identify_print_help_ #ifndef _di_fss_identify_main_ - f_status_t fss_identify_main(fss_identify_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_identify_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -79,7 +70,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_identify_parameter_no_color_e, fss_identify_parameter_light_e, fss_identify_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -312,7 +303,7 @@ extern "C" { if (F_status_is_error_not(status)) { uint16_t signal_check = 0; - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % fss_identify_signal_check_d)) { if (fss_identify_signal_received(main)) { @@ -331,16 +322,16 @@ extern "C" { file.size_read = 512; - status = f_file_stream_open(arguments->argv[main->remaining.array[i]], 0, &file); + status = f_file_stream_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); } else { - status = fss_identify_load_line(main, file, arguments->argv[main->remaining.array[i]], &buffer, &range); + status = fss_identify_load_line(main, file, arguments->argv[main->parameters.remaining.array[i]], &buffer, &range); if (F_status_is_error_not(status)) { - status = fss_identify_process(main, arguments->argv[main->remaining.array[i]], buffer, &range, &data); + status = fss_identify_process(main, arguments->argv[main->parameters.remaining.array[i]], buffer, &range, &data); } } diff --git a/level_3/fss_identify/c/fss_identify.h b/level_3/fss_identify/c/fss_identify.h index b1b8d45..4ff3d1e 100644 --- a/level_3/fss_identify/c/fss_identify.h +++ b/level_3/fss_identify/c/fss_identify.h @@ -94,7 +94,7 @@ extern "C" { * @see fss_identify_main_delete() */ #ifndef _di_fss_identify_main_ - extern f_status_t fss_identify_main(fss_identify_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_identify_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_identify_main_ #ifdef __cplusplus diff --git a/level_3/fss_identify/c/main.c b/level_3/fss_identify/c/main.c index fc319ee..5a783e7 100644 --- a/level_3/fss_identify/c/main.c +++ b/level_3/fss_identify/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_identify_main_t data = fss_identify_data_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/fss_identify/c/private-common.c b/level_3/fss_identify/c/private-common.c index c7ee2c3..fc42402 100644 --- a/level_3/fss_identify/c/private-common.c +++ b/level_3/fss_identify/c/private-common.c @@ -15,7 +15,7 @@ extern "C" { #endif // _di_fss_identify_data_delete_ #ifndef _di_fss_identify_print_signal_received_ - void fss_identify_print_signal_received(fss_identify_main_t * const main, const f_status_t signal) { + void fss_identify_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -33,7 +33,7 @@ extern "C" { #endif // _di_fss_identify_print_signal_received_ #ifndef _di_fss_identify_signal_received_ - f_status_t fss_identify_signal_received(fss_identify_main_t * const main) { + f_status_t fss_identify_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_identify/c/private-common.h b/level_3/fss_identify/c/private-common.h index 4d3c1c1..d102665 100644 --- a/level_3/fss_identify/c/private-common.h +++ b/level_3/fss_identify/c/private-common.h @@ -57,7 +57,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_identify_print_signal_received_ - extern void fss_identify_print_signal_received(fss_identify_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_identify_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_identify_print_signal_received_ /** @@ -75,7 +75,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_identify_signal_received_ - extern f_status_t fss_identify_signal_received(fss_identify_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_identify_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_identify_signal_received_ #ifdef __cplusplus diff --git a/level_3/fss_identify/c/private-identify.c b/level_3/fss_identify/c/private-identify.c index b9852ae..2909152 100644 --- a/level_3/fss_identify/c/private-identify.c +++ b/level_3/fss_identify/c/private-identify.c @@ -8,7 +8,7 @@ extern "C" { #endif #ifndef _di_fss_identify_load_line_ - f_status_t fss_identify_load_line(fss_identify_main_t * const main, const f_file_t file, const f_string_static_t name, f_string_static_t *buffer, f_string_range_t *range) { + f_status_t fss_identify_load_line(fll_program_data_t * const main, const f_file_t file, const f_string_static_t name, f_string_static_t *buffer, f_string_range_t *range) { f_status_t status = F_none; uint16_t signal_check = 0; @@ -64,7 +64,7 @@ extern "C" { #endif // _di_fss_identify_load_line_ #ifndef _di_fss_identify_process_ - f_status_t fss_identify_process(fss_identify_main_t * const main, const f_string_t name, const f_string_static_t buffer, f_string_range_t *range, fss_identify_data_t *data) { + f_status_t fss_identify_process(fll_program_data_t * const main, const f_string_t name, const f_string_static_t buffer, f_string_range_t *range, fss_identify_data_t *data) { f_status_t status = F_none; f_fll_ids_t ids = f_fll_ids_t_initialize; diff --git a/level_3/fss_identify/c/private-identify.h b/level_3/fss_identify/c/private-identify.h index 11db1e5..05c04bf 100644 --- a/level_3/fss_identify/c/private-identify.h +++ b/level_3/fss_identify/c/private-identify.h @@ -37,7 +37,7 @@ extern "C" { * @see f_string_dynamic_resize() */ #ifndef _di_fss_identify_load_line_ - extern f_status_t fss_identify_load_line(fss_identify_main_t * const main, const f_file_t file, const f_string_t name, f_string_static_t *buffer, f_string_range_t *range) F_attribute_visibility_internal_d; + extern f_status_t fss_identify_load_line(fll_program_data_t * const main, const f_file_t file, const f_string_t name, f_string_static_t *buffer, f_string_range_t *range) F_attribute_visibility_internal_d; #endif // _di_fss_identify_load_line_ /** @@ -63,7 +63,7 @@ extern "C" { * @see fll_fss_identify() */ #ifndef _di_fss_identify_process_ - extern f_status_t fss_identify_process(fss_identify_main_t * const main, const f_string_t name, const f_string_static_t buffer, f_string_range_t *range, fss_identify_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_identify_process(fll_program_data_t * const main, const f_string_t name, const f_string_static_t buffer, f_string_range_t *range, fss_identify_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_identify_process_ #ifdef __cplusplus diff --git a/level_3/fss_identify/c/private-print.c b/level_3/fss_identify/c/private-print.c index b8bc971..4be9196 100644 --- a/level_3/fss_identify/c/private-print.c +++ b/level_3/fss_identify/c/private-print.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_identify_print_ - void fss_identify_print(fss_identify_main_t * const main, f_fll_id_t id) { + void fss_identify_print(fll_program_data_t * const main, f_fll_id_t id) { flockfile(main->output.to.stream); diff --git a/level_3/fss_identify/c/private-print.h b/level_3/fss_identify/c/private-print.h index cc92489..a03314d 100644 --- a/level_3/fss_identify/c/private-print.h +++ b/level_3/fss_identify/c/private-print.h @@ -21,7 +21,7 @@ extern "C" { * The Identifier to print. */ #ifndef _di_fss_identify_print_ - extern void fss_identify_print(fss_identify_main_t * const main, f_fll_id_t id) F_attribute_visibility_internal_d; + extern void fss_identify_print(fll_program_data_t * const main, f_fll_id_t id) F_attribute_visibility_internal_d; #endif // _di_fss_identify_print_ #ifdef __cplusplus diff --git a/level_3/fss_payload_read/c/common.c b/level_3/fss_payload_read/c/common.c index fab4106..5ed0865 100644 --- a/level_3/fss_payload_read/c/common.c +++ b/level_3/fss_payload_read/c/common.c @@ -4,24 +4,48 @@ 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_initialize(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_initialize(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_initialize(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_defines_ + const f_string_static_t fss_payload_read_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_pipe_content_end_s, 0, FSS_PAYLOAD_READ_pipe_content_end_s_length); + const f_string_static_t fss_payload_read_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_pipe_content_ignore_s, 0, FSS_PAYLOAD_READ_pipe_content_ignore_s_length); + const f_string_static_t fss_payload_read_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_pipe_content_start_s, 0, FSS_PAYLOAD_READ_pipe_content_start_s_length); +#endif // _di_fss_payload_read_defines_ + +#ifndef _di_fss_payload_read_parameters_ + const f_string_static_t fss_payload_read_short_at_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_at_s, 0, FSS_PAYLOAD_READ_short_at_s_length); + const f_string_static_t fss_payload_read_short_content_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_content_s, 0, FSS_PAYLOAD_READ_short_content_s_length); + const f_string_static_t fss_payload_read_short_columns_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_columns_s, 0, FSS_PAYLOAD_READ_short_columns_s_length); + const f_string_static_t fss_payload_read_short_delimit_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_delimit_s, 0, FSS_PAYLOAD_READ_short_delimit_s_length); + const f_string_static_t fss_payload_read_short_depth_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_depth_s, 0, FSS_PAYLOAD_READ_short_depth_s_length); + const f_string_static_t fss_payload_read_short_empty_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_empty_s, 0, FSS_PAYLOAD_READ_short_empty_s_length); + const f_string_static_t fss_payload_read_short_line_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_line_s, 0, FSS_PAYLOAD_READ_short_line_s_length); + const f_string_static_t fss_payload_read_short_name_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_name_s, 0, FSS_PAYLOAD_READ_short_name_s_length); + const f_string_static_t fss_payload_read_short_object_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_object_s, 0, FSS_PAYLOAD_READ_short_object_s_length); + const f_string_static_t fss_payload_read_short_pipe_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_pipe_s, 0, FSS_PAYLOAD_READ_short_pipe_s_length); + const f_string_static_t fss_payload_read_short_raw_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_raw_s, 0, FSS_PAYLOAD_READ_short_raw_s_length); + const f_string_static_t fss_payload_read_short_select_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_select_s, 0, FSS_PAYLOAD_READ_short_select_s_length); + const f_string_static_t fss_payload_read_short_total_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_total_s, 0, FSS_PAYLOAD_READ_short_total_s_length); + const f_string_static_t fss_payload_read_short_trim_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_short_trim_s, 0, FSS_PAYLOAD_READ_short_trim_s_length); + + const f_string_static_t fss_payload_read_long_at_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_at_s, 0, FSS_PAYLOAD_READ_long_at_s_length); + const f_string_static_t fss_payload_read_long_content_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_content_s, 0, FSS_PAYLOAD_READ_long_content_s_length); + const f_string_static_t fss_payload_read_long_columns_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_columns_s, 0, FSS_PAYLOAD_READ_long_columns_s_length); + const f_string_static_t fss_payload_read_long_delimit_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_delimit_s, 0, FSS_PAYLOAD_READ_long_delimit_s_length); + const f_string_static_t fss_payload_read_long_depth_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_depth_s, 0, FSS_PAYLOAD_READ_long_depth_s_length); + const f_string_static_t fss_payload_read_long_empty_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_empty_s, 0, FSS_PAYLOAD_READ_long_empty_s_length); + const f_string_static_t fss_payload_read_long_line_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_line_s, 0, FSS_PAYLOAD_READ_long_line_s_length); + const f_string_static_t fss_payload_read_long_name_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_name_s, 0, FSS_PAYLOAD_READ_long_name_s_length); + const f_string_static_t fss_payload_read_long_object_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_object_s, 0, FSS_PAYLOAD_READ_long_object_s_length); + const f_string_static_t fss_payload_read_long_pipe_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_pipe_s, 0, FSS_PAYLOAD_READ_long_pipe_s_length); + const f_string_static_t fss_payload_read_long_raw_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_raw_s, 0, FSS_PAYLOAD_READ_long_raw_s_length); + const f_string_static_t fss_payload_read_long_select_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_select_s, 0, FSS_PAYLOAD_READ_long_select_s_length); + const f_string_static_t fss_payload_read_long_total_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_total_s, 0, FSS_PAYLOAD_READ_long_total_s_length); + const f_string_static_t fss_payload_read_long_trim_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_trim_s, 0, FSS_PAYLOAD_READ_long_trim_s_length); +#endif // _di_fss_payload_read_parameters_ #ifndef _di_fss_payload_read_main_delete_ - f_status_t fss_payload_read_main_delete(fss_payload_read_main_t * const main) { - - f_console_parameters_delete(&main->parameters); - - f_type_array_lengths_resize(0, &main->remaining); - macro_f_color_context_t_delete_simple(main->context); + f_status_t fss_payload_read_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_payload_read_main_delete_ diff --git a/level_3/fss_payload_read/c/common.h b/level_3/fss_payload_read/c/common.h index 375e5f9..bbab7ee 100644 --- a/level_3/fss_payload_read/c/common.h +++ b/level_3/fss_payload_read/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #ifndef _di_fss_payload_read_program_version_ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_payload_read_program_version_s; #endif // _di_fss_payload_read_program_version_ +/** + * The program name. + */ #ifndef _di_fss_payload_read_program_name_ #define FSS_PAYLOAD_READ_program_name_s "fss_payload_read" #define FSS_PAYLOAD_READ_program_name_long_s "FSS Payload Read" @@ -53,42 +59,118 @@ extern "C" { extern const f_string_static_t fss_payload_read_program_name_long_s; #endif // _di_fss_payload_read_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_payload_read_defines_ #define fss_payload_read_signal_check_d 10000 - #define fss_payload_read_pipe_content_end_s '\f' - #define fss_payload_read_pipe_content_ignore_s '\v' - #define fss_payload_read_pipe_content_start_s '\b' - - #define fss_payload_read_short_at_s "a" - #define fss_payload_read_short_content_s "c" - #define fss_payload_read_short_columns_s "C" - #define fss_payload_read_short_delimit_s "D" - #define fss_payload_read_short_depth_s "d" - #define fss_payload_read_short_empty_s "e" - #define fss_payload_read_short_line_s "l" - #define fss_payload_read_short_name_s "n" - #define fss_payload_read_short_object_s "o" - #define fss_payload_read_short_pipe_s "p" - #define fss_payload_read_short_raw_s "R" - #define fss_payload_read_short_select_s "s" - #define fss_payload_read_short_total_s "t" - #define fss_payload_read_short_trim_s "T" - - #define fss_payload_read_long_at_s "at" - #define fss_payload_read_long_content_s "content" - #define fss_payload_read_long_columns_s "columns" - #define fss_payload_read_long_delimit_s "delimit" - #define fss_payload_read_long_depth_s "depth" - #define fss_payload_read_long_empty_s "empty" - #define fss_payload_read_long_line_s "line" - #define fss_payload_read_long_name_s "name" - #define fss_payload_read_long_object_s "object" - #define fss_payload_read_long_pipe_s "pipe" - #define fss_payload_read_long_raw_s "raw" - #define fss_payload_read_long_select_s "select" - #define fss_payload_read_long_total_s "total" - #define fss_payload_read_long_trim_s "trim" + #define FSS_PAYLOAD_READ_pipe_content_end_s '\f' + #define FSS_PAYLOAD_READ_pipe_content_ignore_s '\v' + #define FSS_PAYLOAD_READ_pipe_content_start_s '\b' + + #define FSS_PAYLOAD_READ_pipe_content_end_s_length 1 + #define FSS_PAYLOAD_READ_pipe_content_ignore_s_length 1 + #define FSS_PAYLOAD_READ_pipe_content_start_s_length 1 + + extern const fss_payload_read_pipe_content_end_s; + extern const fss_payload_read_pipe_content_ignore_s; + extern const fss_payload_read_pipe_content_start_s; +#endif // _di_fss_payload_read_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_fss_payload_read_parameters_ + #define FSS_PAYLOAD_READ_short_at_s "a" + #define FSS_PAYLOAD_READ_short_content_s "c" + #define FSS_PAYLOAD_READ_short_columns_s "C" + #define FSS_PAYLOAD_READ_short_delimit_s "D" + #define FSS_PAYLOAD_READ_short_depth_s "d" + #define FSS_PAYLOAD_READ_short_empty_s "e" + #define FSS_PAYLOAD_READ_short_line_s "l" + #define FSS_PAYLOAD_READ_short_name_s "n" + #define FSS_PAYLOAD_READ_short_object_s "o" + #define FSS_PAYLOAD_READ_short_pipe_s "p" + #define FSS_PAYLOAD_READ_short_raw_s "R" + #define FSS_PAYLOAD_READ_short_select_s "s" + #define FSS_PAYLOAD_READ_short_total_s "t" + #define FSS_PAYLOAD_READ_short_trim_s "T" + + #define FSS_PAYLOAD_READ_long_at_s "at" + #define FSS_PAYLOAD_READ_long_content_s "content" + #define FSS_PAYLOAD_READ_long_columns_s "columns" + #define FSS_PAYLOAD_READ_long_delimit_s "delimit" + #define FSS_PAYLOAD_READ_long_depth_s "depth" + #define FSS_PAYLOAD_READ_long_empty_s "empty" + #define FSS_PAYLOAD_READ_long_line_s "line" + #define FSS_PAYLOAD_READ_long_name_s "name" + #define FSS_PAYLOAD_READ_long_object_s "object" + #define FSS_PAYLOAD_READ_long_pipe_s "pipe" + #define FSS_PAYLOAD_READ_long_raw_s "raw" + #define FSS_PAYLOAD_READ_long_select_s "select" + #define FSS_PAYLOAD_READ_long_total_s "total" + #define FSS_PAYLOAD_READ_long_trim_s "trim" + + #define FSS_PAYLOAD_READ_short_at_s_length 1 + #define FSS_PAYLOAD_READ_short_content_s_length 1 + #define FSS_PAYLOAD_READ_short_columns_s_length 1 + #define FSS_PAYLOAD_READ_short_delimit_s_length 1 + #define FSS_PAYLOAD_READ_short_depth_s_length 1 + #define FSS_PAYLOAD_READ_short_empty_s_length 1 + #define FSS_PAYLOAD_READ_short_line_s_length 1 + #define FSS_PAYLOAD_READ_short_name_s_length 1 + #define FSS_PAYLOAD_READ_short_object_s_length 1 + #define FSS_PAYLOAD_READ_short_pipe_s_length 1 + #define FSS_PAYLOAD_READ_short_raw_s_length 1 + #define FSS_PAYLOAD_READ_short_select_s_length 1 + #define FSS_PAYLOAD_READ_short_total_s_length 1 + #define FSS_PAYLOAD_READ_short_trim_s_length 1 + + #define FSS_PAYLOAD_READ_long_at_s_length 2 + #define FSS_PAYLOAD_READ_long_content_s_length 7 + #define FSS_PAYLOAD_READ_long_columns_s_length 7 + #define FSS_PAYLOAD_READ_long_delimit_s_length 7 + #define FSS_PAYLOAD_READ_long_depth_s_length 5 + #define FSS_PAYLOAD_READ_long_empty_s_length 5 + #define FSS_PAYLOAD_READ_long_line_s_length 4 + #define FSS_PAYLOAD_READ_long_name_s_length 4 + #define FSS_PAYLOAD_READ_long_object_s_length 6 + #define FSS_PAYLOAD_READ_long_pipe_s_length 4 + #define FSS_PAYLOAD_READ_long_raw_s_length 3 + #define FSS_PAYLOAD_READ_long_select_s_length 6 + #define FSS_PAYLOAD_READ_long_total_s_length 5 + #define FSS_PAYLOAD_READ_long_trim_s_length 4 + + extern const f_string_static_t fss_payload_read_short_at_s; + extern const f_string_static_t fss_payload_read_short_content_s; + extern const f_string_static_t fss_payload_read_short_columns_s; + extern const f_string_static_t fss_payload_read_short_delimit_s; + extern const f_string_static_t fss_payload_read_short_depth_s; + extern const f_string_static_t fss_payload_read_short_empty_s; + extern const f_string_static_t fss_payload_read_short_line_s; + extern const f_string_static_t fss_payload_read_short_name_s; + extern const f_string_static_t fss_payload_read_short_object_s; + extern const f_string_static_t fss_payload_read_short_pipe_s; + extern const f_string_static_t fss_payload_read_short_raw_s; + extern const f_string_static_t fss_payload_read_short_select_s; + extern const f_string_static_t fss_payload_read_short_total_s; + extern const f_string_static_t fss_payload_read_short_trim_s; + + extern const f_string_static_t fss_payload_read_long_at_s; + extern const f_string_static_t fss_payload_read_long_content_s; + extern const f_string_static_t fss_payload_read_long_columns_s; + extern const f_string_static_t fss_payload_read_long_delimit_s; + extern const f_string_static_t fss_payload_read_long_depth_s; + extern const f_string_static_t fss_payload_read_long_empty_s; + extern const f_string_static_t fss_payload_read_long_line_s; + extern const f_string_static_t fss_payload_read_long_name_s; + extern const f_string_static_t fss_payload_read_long_object_s; + extern const f_string_static_t fss_payload_read_long_pipe_s; + extern const f_string_static_t fss_payload_read_long_raw_s; + extern const f_string_static_t fss_payload_read_long_select_s; + extern const f_string_static_t fss_payload_read_long_total_s; + extern const f_string_static_t fss_payload_read_long_trim_s; enum { fss_payload_read_parameter_help_e, @@ -128,24 +210,24 @@ extern "C" { 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(fss_payload_read_short_at_s, fss_payload_read_long_at_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_content_s, fss_payload_read_long_content_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_columns_s, fss_payload_read_long_columns_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_delimit_s, fss_payload_read_long_delimit_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_depth_s, fss_payload_read_long_depth_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_empty_s, fss_payload_read_long_empty_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_line_s, fss_payload_read_long_line_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_name_s, fss_payload_read_long_name_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_object_s, fss_payload_read_long_object_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_pipe_s, fss_payload_read_long_pipe_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_raw_s, fss_payload_read_long_raw_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_select_s, fss_payload_read_long_select_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_total_s, fss_payload_read_long_total_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_read_short_trim_s, fss_payload_read_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_at_s.string, fss_payload_read_long_at_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_content_s.string, fss_payload_read_long_content_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_columns_s.string, fss_payload_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_delimit_s.string, fss_payload_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_depth_s.string, fss_payload_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_empty_s.string, fss_payload_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_line_s.string, fss_payload_read_long_line_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_name_s.string, fss_payload_read_long_name_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_object_s.string, fss_payload_read_long_object_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_pipe_s.string, fss_payload_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_raw_s.string, fss_payload_read_long_raw_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_select_s.string, fss_payload_read_long_select_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_total_s.string, fss_payload_read_long_total_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_read_short_trim_s.string, fss_payload_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_payload_total_parameters_d 23 -#endif // _di_fss_payload_read_defines_ +#endif // _di_fss_payload_read_parameters_ /** * FSS Delimit Parameter data. @@ -186,35 +268,6 @@ extern "C" { }; #endif // _di_fss_payload_read_delimit_modes_ -#ifndef _di_fss_payload_read_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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; - } fss_payload_read_main_t; - - #define fss_payload_read_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_payload_read_main_t_ - /** * Deallocate main. * @@ -231,7 +284,7 @@ extern "C" { * @see fss_payload_read_main() */ #ifndef _di_fss_payload_read_main_delete_ - extern f_status_t fss_payload_read_main_delete(fss_payload_read_main_t * const main); + extern f_status_t fss_payload_read_main_delete(fll_program_data_t * const main); #endif // _di_fss_payload_read_main_delete_ #ifdef __cplusplus 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 979c877..f976226 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.c +++ b/level_3/fss_payload_read/c/fss_payload_read.c @@ -50,7 +50,7 @@ extern "C" { 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)"); + fll_program_print_help_usage(file, context, fss_payload_program_name_s, fll_program_parameter_filenames_s); fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s); @@ -137,7 +137,7 @@ extern "C" { #endif // _di_fss_payload_read_print_help_ #ifndef _di_fss_payload_read_main_ - f_status_t fss_payload_read_main(fss_payload_read_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_payload_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -149,7 +149,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_payload_read_parameter_no_color_e, fss_payload_read_parameter_light_e, fss_payload_read_parameter_dark_e }; const f_console_parameter_ids_t choices = { ids, 3 }; - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -233,17 +233,17 @@ extern "C" { } // Provide a range designating where within the buffer a particular file exists, using a statically allocated array. - fss_payload_read_file_t files_array[main->remaining.used + 1]; + fss_payload_read_file_t files_array[main->parameters.remaining.used + 1]; fss_payload_read_data_t data = fss_payload_read_data_t_initialize; data.files.array = files_array; data.files.used = 1; - data.files.size = main->remaining.used + 1; + data.files.size = main->parameters.remaining.used + 1; data.files.array[0].name = "(pipe)"; data.files.array[0].range.start = 1; data.files.array[0].range.stop = 0; - if (main->remaining.used || main->process_pipe) { + if (main->parameters.remaining.used || main->process_pipe) { { const f_array_length_t parameter_code[] = { fss_payload_read_parameter_at_e, @@ -583,13 +583,13 @@ extern "C" { } } - if (F_status_is_error_not(status) && main->remaining.used > 0) { + if (F_status_is_error_not(status) && main->parameters.remaining.used > 0) { f_file_t file = f_file_t_initialize; f_array_length_t size_file = 0; const f_array_length_t buffer_used = data.buffer.used; uint16_t signal_check = 0; - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % fss_payload_read_signal_check_d)) { if (fss_payload_read_signal_received(main)) { @@ -605,10 +605,10 @@ extern "C" { file.stream = 0; file.id = -1; - status = f_file_stream_open(arguments->argv[main->remaining.array[i]], 0, &file); + status = f_file_stream_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); break; } @@ -617,7 +617,7 @@ extern "C" { status = f_file_size_by_id(file.id, &size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -626,7 +626,7 @@ extern "C" { status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -646,12 +646,12 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } else if (data.buffer.used > data.files.array[data.files.used].range.start) { - data.files.array[data.files.used].name = arguments->argv[main->remaining.array[i]]; + data.files.array[data.files.used].name = arguments->argv[main->parameters.remaining.array[i]]; data.files.array[data.files.used++].range.stop = data.buffer.used - 1; } } 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 8dc2e92..f6bba6e 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.h +++ b/level_3/fss_payload_read/c/fss_payload_read.h @@ -7,7 +7,7 @@ * * This is the FSS Basic List Read program * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the fss_payload_read_main_t. + * This program processes files or other input in fss format and stores the results in the fll_program_data_t. * * This processes in accordance to the FSS-0002 Basic List specification. */ @@ -97,7 +97,7 @@ extern "C" { * @see fss_payload_read_main_delete() */ #ifndef _di_fss_payload_read_main_ - extern f_status_t fss_payload_read_main(fss_payload_read_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_payload_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_payload_read_main_ #ifdef __cplusplus diff --git a/level_3/fss_payload_read/c/main.c b/level_3/fss_payload_read/c/main.c index 51382d2..c21cfad 100644 --- a/level_3/fss_payload_read/c/main.c +++ b/level_3/fss_payload_read/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { f_console_arguments_t arguments = { argc, argv }; - fss_payload_read_main_t data = fss_payload_read_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/fss_payload_read/c/private-common.c b/level_3/fss_payload_read/c/private-common.c index 75c7b77..af41595 100644 --- a/level_3/fss_payload_read/c/private-common.c +++ b/level_3/fss_payload_read/c/private-common.c @@ -64,7 +64,7 @@ extern "C" { #endif // _di_fss_payload_read_depths_resize_ #ifndef _di_fss_payload_read_print_signal_received_ - void fss_payload_read_print_signal_received(fss_payload_read_main_t * const main, const f_status_t signal) { + void fss_payload_read_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -82,7 +82,7 @@ extern "C" { #endif // _di_fss_payload_read_print_signal_received_ #ifndef _di_fss_payload_read_signal_received_ - f_status_t fss_payload_read_signal_received(fss_payload_read_main_t * const main) { + f_status_t fss_payload_read_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_payload_read/c/private-common.h b/level_3/fss_payload_read/c/private-common.h index 13ab8fa..badfb20 100644 --- a/level_3/fss_payload_read/c/private-common.h +++ b/level_3/fss_payload_read/c/private-common.h @@ -277,7 +277,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_payload_read_print_signal_received_ - extern void fss_payload_read_print_signal_received(fss_payload_read_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_signal_received_ /** @@ -295,7 +295,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_payload_read_signal_received_ - extern f_status_t fss_payload_read_signal_received(fss_payload_read_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_signal_received_ #ifdef __cplusplus diff --git a/level_3/fss_payload_read/c/private-print.c b/level_3/fss_payload_read/c/private-print.c index 889c46e..66b5af0 100644 --- a/level_3/fss_payload_read/c/private-print.c +++ b/level_3/fss_payload_read/c/private-print.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_payload_read_print_at_ - void fss_payload_read_print_at(fss_payload_read_main_t * const main, const bool is_payload, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_payload_read_data_t * const data) { + void fss_payload_read_print_at(fll_program_data_t * const main, const bool is_payload, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_payload_read_data_t * const data) { if (at >= data->contents.used) { return; @@ -56,7 +56,7 @@ extern "C" { #endif // _di_fss_payload_read_print_at_ #ifndef _di_fss_payload_read_print_at_extended_ - void fss_payload_read_print_at_extended(fss_payload_read_main_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_payload_read_data_t * const data) { + void fss_payload_read_print_at_extended(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_payload_read_data_t * const data) { if (at >= data->contents_header.used) { return; @@ -148,7 +148,7 @@ extern "C" { #endif // _di_fss_payload_read_print_at_extended_ #ifndef _di_fss_payload_read_print_at_object_ - void fss_payload_read_print_at_object(fss_payload_read_main_t * const main, fss_payload_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) { + void fss_payload_read_print_at_object(fll_program_data_t * const main, fss_payload_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) { if (at >= data->objects.used) { return; @@ -166,7 +166,7 @@ extern "C" { #endif // _di_fss_payload_read_print_at_object_ #ifndef _di_fss_payload_read_print_at_total_exteded_ - f_status_t fss_payload_read_print_at_total_extended(fss_payload_read_main_t * const main, const f_array_length_t at, fss_payload_read_data_t *data) { + f_status_t fss_payload_read_print_at_total_extended(fll_program_data_t * const main, const f_array_length_t at, fss_payload_read_data_t *data) { if (data->option & fss_payload_read_data_option_select_d) { if (data->option & fss_payload_read_data_option_object_d) { @@ -220,7 +220,7 @@ extern "C" { #endif // _di_fss_payload_read_print_at_total_extended_ #ifndef _di_fss_payload_read_print_content_end_extended_ - void fss_payload_read_print_content_end_extended(fss_payload_read_main_t * const main) { + void fss_payload_read_print_content_end_extended(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_payload_read_pipe_content_start_s, main->output.to.stream); @@ -232,7 +232,7 @@ extern "C" { #endif // _di_fss_payload_read_print_content_end_extended_ #ifndef _di_fss_payload_read_print_content_ignore_ - void fss_payload_read_print_content_ignore(fss_payload_read_main_t * const main) { + void fss_payload_read_print_content_ignore(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_payload_read_pipe_content_ignore_s, main->output.to.stream); @@ -241,7 +241,7 @@ extern "C" { #endif // _di_fss_payload_read_print_content_ignore_ #ifndef _di_fss_payload_read_print_object_end_ - void fss_payload_read_print_object_end(fss_payload_read_main_t * const main) { + void fss_payload_read_print_object_end(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_payload_read_pipe_content_start_s, main->output.to.stream); @@ -259,7 +259,7 @@ extern "C" { #endif // _di_fss_payload_read_print_object_end_ #ifndef _di_fss_payload_read_print_object_end_extended_ - void fss_payload_read_print_object_end_extended(fss_payload_read_main_t * const main) { + void fss_payload_read_print_object_end_extended(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_payload_read_pipe_content_end_s, main->output.to.stream); @@ -271,7 +271,7 @@ extern "C" { #endif // _di_fss_payload_read_print_object_end_extended_ #ifndef _di_fss_payload_read_print_set_end_ - void fss_payload_read_print_set_end(fss_payload_read_main_t * const main) { + void fss_payload_read_print_set_end(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_payload_read_pipe_content_end_s, main->output.to.stream); @@ -280,7 +280,7 @@ extern "C" { #endif // _di_fss_payload_read_print_set_end_ #ifndef _di_fss_payload_read_print_set_end_extended_ - void fss_payload_read_print_set_end_extended(fss_payload_read_main_t * const main) { + void fss_payload_read_print_set_end_extended(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { f_print_character(fss_payload_read_pipe_content_end_s, main->output.to.stream); @@ -292,7 +292,7 @@ extern "C" { #endif // _di_fss_payload_read_print_set_end_extended_ #ifndef _di_fss_payload_read_print_one_ - void fss_payload_read_print_one(fss_payload_read_main_t * const main) { + void fss_payload_read_print_one(fll_program_data_t * const main) { f_print_dynamic_raw(f_string_ascii_1_s, main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); @@ -300,7 +300,7 @@ extern "C" { #endif // _di_fss_payload_read_print_one_ #ifndef _di_fss_payload_read_print_zero_ - void fss_payload_read_print_zero(fss_payload_read_main_t * const main) { + void fss_payload_read_print_zero(fll_program_data_t * const main) { f_print_dynamic_raw(f_string_ascii_0_s, main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); diff --git a/level_3/fss_payload_read/c/private-print.h b/level_3/fss_payload_read/c/private-print.h index e3abe57..971b694 100644 --- a/level_3/fss_payload_read/c/private-print.h +++ b/level_3/fss_payload_read/c/private-print.h @@ -31,7 +31,7 @@ extern "C" { * The program data. */ #ifndef _di_fss_payload_read_print_at_ - extern void fss_payload_read_print_at(fss_payload_read_main_t * const main, const bool is_payload, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_payload_read_data_t * const data) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_at(fll_program_data_t * const main, const bool is_payload, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_payload_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_at_ /** @@ -51,7 +51,7 @@ extern "C" { * The program data. */ #ifndef _di_fss_payload_read_print_at_extended_ - extern void fss_payload_read_print_at_extended(fss_payload_read_main_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_payload_read_data_t * const data) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_at_extended(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_payload_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_at_extended_ /** @@ -67,7 +67,7 @@ extern "C" { * The delimits to be applied to an Object. */ #ifndef _di_fss_payload_read_print_at_object_ - extern void fss_payload_read_print_at_object(fss_payload_read_main_t * const main, fss_payload_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_at_object(fll_program_data_t * const main, fss_payload_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_at_object_ /** @@ -85,7 +85,7 @@ extern "C" { * F_success on success and something was matched (and total was printed). */ #ifndef _di_fss_payload_read_print_at_total_extended_ - extern f_status_t fss_payload_read_print_at_total_extended(fss_payload_read_main_t * const main, const f_array_length_t at, fss_payload_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_print_at_total_extended(fll_program_data_t * const main, const f_array_length_t at, fss_payload_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_at_total_extended_ /** @@ -95,7 +95,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_payload_read_print_content_end_extended_ - extern void fss_payload_read_print_content_end_extended(fss_payload_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_content_end_extended(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_content_end_extended_ /** @@ -107,7 +107,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_payload_read_print_content_ignore_ - extern void fss_payload_read_print_content_ignore(fss_payload_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_content_ignore(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_content_ignore_ /** @@ -117,7 +117,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_payload_read_print_object_end_ - extern void fss_payload_read_print_object_end(fss_payload_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_object_end(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_object_end_ /** @@ -127,7 +127,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_payload_read_print_object_end_extended_ - extern void fss_payload_read_print_object_end_extended(fss_payload_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_object_end_extended(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_object_end_extended_ /** @@ -137,7 +137,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_payload_read_print_one_ - extern void fss_payload_read_print_one(fss_payload_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_one(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_one_ /** @@ -147,7 +147,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_payload_read_print_set_end_ - extern void fss_payload_read_print_set_end(fss_payload_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_set_end(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_set_end_ /** @@ -157,7 +157,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_payload_read_print_set_end_extended_ - extern void fss_payload_read_print_set_end_extended(fss_payload_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_set_end_extended(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_set_end_extended_ /** @@ -167,7 +167,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_payload_read_print_zero_ - extern void fss_payload_read_print_zero(fss_payload_read_main_t * const main) F_attribute_visibility_internal_d; + extern void fss_payload_read_print_zero(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_print_zero_ #ifdef __cplusplus diff --git a/level_3/fss_payload_read/c/private-read.c b/level_3/fss_payload_read/c/private-read.c index c6ee4e8..af307ae 100644 --- a/level_3/fss_payload_read/c/private-read.c +++ b/level_3/fss_payload_read/c/private-read.c @@ -56,7 +56,7 @@ extern "C" { #endif // _di_fss_payload_read_delimit_object_is_ #ifndef _di_fss_payload_read_depth_process_ - f_status_t fss_payload_read_depth_process(fss_payload_read_main_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) { + f_status_t fss_payload_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) { f_status_t status = F_none; @@ -244,7 +244,7 @@ extern "C" { #endif // _di_fss_payload_read_file_identify_ #ifndef _di_fss_payload_read_load_ - f_status_t fss_payload_read_load(fss_payload_read_main_t * const main, fss_payload_read_data_t *data) { + f_status_t fss_payload_read_load(fll_program_data_t * const main, fss_payload_read_data_t *data) { f_state_t state = macro_f_state_t_initialize(fss_payload_common_allocation_large_d, fss_payload_read_common_allocation_small_d, 0, 0, 0, 0, 0); f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used); @@ -314,7 +314,7 @@ extern "C" { #endif // _di_fss_payload_read_load_ #ifndef _di_fss_payload_read_load_number_ - f_status_t fss_payload_read_load_number(fss_payload_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) { + f_status_t fss_payload_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; @@ -336,7 +336,7 @@ extern "C" { #endif // _di_fss_payload_read_load_number_ #ifndef _di_fss_payload_read_process_ - f_status_t fss_payload_read_process(fss_payload_read_main_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) { + f_status_t fss_payload_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) { f_status_t status = fss_payload_read_process_option(main, arguments, data); if (F_status_is_error(status)) return status; @@ -473,7 +473,7 @@ extern "C" { #endif // _di_fss_payload_read_process_ #ifndef _di_fss_payload_read_process_at_ - f_status_t fss_payload_read_process_at(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) { + f_status_t fss_payload_read_process_at(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) { if (data->depths.array[0].value_at >= data->objects.used) { if (data->option & (fss_payload_read_data_option_columns_d | fss_payload_read_data_option_total_d)) { @@ -560,7 +560,7 @@ extern "C" { #endif // _di_fss_payload_read_process_at_ #ifndef _di_fss_payload_read_process_at_extended_ - f_status_t fss_payload_read_process_at_extended(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) { + f_status_t fss_payload_read_process_at_extended(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) { if (data->depths.array[data->depths.used - 1].value_at >= data->objects_header.used) { if (data->option & (fss_payload_read_data_option_columns_d | fss_payload_read_data_option_total_d)) { @@ -666,7 +666,7 @@ extern "C" { #endif // _di_fss_payload_read_process_at_extended_ #ifndef _di_fss_payload_read_process_at_line_ - f_status_t fss_payload_read_process_at_line(fss_payload_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_payload_read_data_t *data, f_array_length_t *line) { + f_status_t fss_payload_read_process_at_line(fll_program_data_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_payload_read_data_t *data, f_array_length_t *line) { if (data->option & fss_payload_read_data_option_object_d) { if (*line == data->line) { @@ -770,7 +770,7 @@ extern "C" { #endif // _di_fss_payload_read_process_at_line_ #ifndef _di_fss_payload_read_process_columns_ - f_status_t fss_payload_read_process_columns(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) { + f_status_t fss_payload_read_process_columns(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) { if (!(data->option & fss_payload_read_data_option_content_d)) { flockfile(main->output.to.stream); @@ -809,7 +809,7 @@ extern "C" { #endif // _di_fss_payload_read_process_columns_ #ifndef _di_fss_payload_read_process_columns_extended_ - f_status_t fss_payload_read_process_columns_extended(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) { + f_status_t fss_payload_read_process_columns_extended(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) { if (!(data->option & fss_payload_read_data_option_content_d)) { flockfile(main->output.to.stream); @@ -839,7 +839,7 @@ extern "C" { #endif // _di_fss_payload_read_process_columns_extended_ #ifndef _di_fss_payload_read_process_line_ - f_status_t fss_payload_read_process_line(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) { + f_status_t fss_payload_read_process_line(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) { f_array_lengths_t except_none = f_array_lengths_t_initialize; f_array_lengths_t *delimits_object = fss_payload_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none; @@ -875,7 +875,7 @@ extern "C" { #endif // _di_fss_payload_read_process_line_ #ifndef _di_fss_payload_read_process_line_extended_ - f_status_t fss_payload_read_process_line_extended(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) { + f_status_t fss_payload_read_process_line_extended(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) { f_array_lengths_t except_none = f_array_lengths_t_initialize; f_array_lengths_t *delimits_object = fss_payload_read_delimit_object_is(0, data) ? &data->delimits_object_header : &except_none; @@ -987,7 +987,7 @@ extern "C" { #endif // _di_fss_payload_read_process_name_extended_ #ifndef _di_fss_payload_read_process_option_ - f_status_t fss_payload_read_process_option(fss_payload_read_main_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) { + f_status_t fss_payload_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) { f_status_t status = F_none; @@ -1051,7 +1051,7 @@ extern "C" { #endif // _di_fss_payload_read_process_option_ #ifndef _di_fss_payload_read_process_total_ - f_status_t fss_payload_read_process_total(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) { + f_status_t fss_payload_read_process_total(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) { f_array_length_t total = 0; f_string_range_t range = f_string_range_t_initialize; @@ -1126,7 +1126,7 @@ extern "C" { #endif // _di_fss_payload_read_process_total_ #ifndef _di_fss_payload_read_process_total_extended_ - f_status_t fss_payload_read_process_total_extended(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) { + f_status_t fss_payload_read_process_total_extended(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) { f_array_length_t total = 0; diff --git a/level_3/fss_payload_read/c/private-read.h b/level_3/fss_payload_read/c/private-read.h index 39494af..1d35991 100644 --- a/level_3/fss_payload_read/c/private-read.h +++ b/level_3/fss_payload_read/c/private-read.h @@ -74,7 +74,7 @@ extern "C" { * @see fss_payload_read_depths_resize() */ #ifndef _di_fss_payload_read_depth_process_ - extern f_status_t fss_payload_read_depth_process(fss_payload_read_main_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_depth_process_ /** @@ -118,7 +118,7 @@ extern "C" { * @see fss_payload_read_process_option() */ #ifndef _di_fss_payload_read_load_ - extern f_status_t fss_payload_read_load(fss_payload_read_main_t * const main, fss_payload_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_load(fll_program_data_t * const main, fss_payload_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_load_ /** @@ -148,7 +148,7 @@ extern "C" { * @see fss_payload_read_depths_resize() */ #ifndef _di_fss_payload_read_load_number_ - extern f_status_t fss_payload_read_load_number(fss_payload_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_load_number_ /** @@ -173,7 +173,7 @@ extern "C" { * @see fss_payload_read_process_option() */ #ifndef _di_fss_payload_read_process_ - extern f_status_t fss_payload_read_process(fss_payload_read_main_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_process_ /** @@ -193,7 +193,7 @@ extern "C" { * @see fss_payload_read_process_at_line() */ #ifndef _di_fss_payload_read_process_at_ - extern f_status_t fss_payload_read_process_at(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_process_at(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_process_at_ /** @@ -213,7 +213,7 @@ extern "C" { * @see fss_payload_read_process_at_line() */ #ifndef _di_fss_payload_read_process_at_extended_ - extern f_status_t fss_payload_read_process_at_extended(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_process_at_extended(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_process_at_extended_ /** @@ -236,7 +236,7 @@ extern "C" { * F_success on success and the line was matched (and possibly printed). */ #ifndef _di_fss_payload_read_process_at_line_ - extern f_status_t fss_payload_read_process_at_line(fss_payload_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_payload_read_data_t *data, f_array_length_t *line) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_process_at_line(fll_program_data_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_payload_read_data_t *data, f_array_length_t *line) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_process_at_line_ /** @@ -254,7 +254,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_payload_read_process_columns_ - extern f_status_t fss_payload_read_process_columns(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_process_columns(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_process_columns_ /** @@ -272,7 +272,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_payload_read_process_columns_extended_ - extern f_status_t fss_payload_read_process_columns_extended(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_process_columns_extended(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_process_columns_extended_ /** @@ -290,7 +290,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_payload_read_process_line_ - extern f_status_t fss_payload_read_process_line(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_process_line(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_process_line_ /** @@ -308,7 +308,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_payload_read_process_line_extended_ - extern f_status_t fss_payload_read_process_line_extended(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_process_line_extended(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_process_line_extended_ /** @@ -367,7 +367,7 @@ extern "C" { * @see fss_payload_read_load_setting() */ #ifndef _di_fss_payload_read_process_option_ - extern f_status_t fss_payload_read_process_option(fss_payload_read_main_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_payload_read_data_t *data) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_process_option_ /** @@ -385,7 +385,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_payload_read_process_total_ - extern f_status_t fss_payload_read_process_total(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_process_total(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_process_total_ /** @@ -403,7 +403,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_payload_read_process_total_extended_ - extern f_status_t fss_payload_read_process_total_extended(fss_payload_read_main_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_read_process_total_extended(fll_program_data_t * const main, fss_payload_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_payload_read_process_total_extended_ #ifdef __cplusplus diff --git a/level_3/fss_payload_write/c/common.c b/level_3/fss_payload_write/c/common.c index 73ec236..2a8a2aa 100644 --- a/level_3/fss_payload_write/c/common.c +++ b/level_3/fss_payload_write/c/common.c @@ -4,25 +4,38 @@ 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_initialize(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_initialize(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_initialize(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_defines_ + const f_string_static_t fss_payload_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_pipe_content_end_s, 0, FSS_PAYLOAD_WRITE_pipe_content_end_s_length); + const f_string_static_t fss_payload_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_pipe_content_ignore_s, 0, FSS_PAYLOAD_WRITE_pipe_content_ignore_s_length); + const f_string_static_t fss_payload_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_pipe_content_start_s, 0, FSS_PAYLOAD_WRITE_pipe_content_start_s_length); +#endif // _di_fss_payload_write_defines_ + +##ifndef _di_fss_payload_write_parameters_ + const f_string_static_t fss_payload_write_short_file_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_short_file_s, 0, FSS_PAYLOAD_WRITE_short_file_s_length); + const f_string_static_t fss_payload_write_short_content_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_short_content_s, 0, FSS_PAYLOAD_WRITE_short_content_s_length); + const f_string_static_t fss_payload_write_short_double_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_short_double_s, 0, FSS_PAYLOAD_WRITE_short_double_s_length); + const f_string_static_t fss_payload_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_short_ignore_s, 0, FSS_PAYLOAD_WRITE_short_ignore_s_length); + const f_string_static_t fss_payload_write_short_object_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_short_object_s, 0, FSS_PAYLOAD_WRITE_short_object_s_length); + const f_string_static_t fss_payload_write_short_partial_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_short_partial_s, 0, FSS_PAYLOAD_WRITE_short_partial_s_length); + const f_string_static_t fss_payload_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_short_prepend_s, 0, FSS_PAYLOAD_WRITE_short_prepend_s_length); + const f_string_static_t fss_payload_write_short_single_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_short_single_s, 0, FSS_PAYLOAD_WRITE_short_single_s_length); + const f_string_static_t fss_payload_write_short_trim_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_short_trim_s, 0, FSS_PAYLOAD_WRITE_short_trim_s_length); + + const f_string_static_t fss_payload_write_long_file_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_long_file_s, 0, FSS_PAYLOAD_WRITE_long_file_s_length); + const f_string_static_t fss_payload_write_long_content_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_long_content_s, 0, FSS_PAYLOAD_WRITE_long_content_s_length); + const f_string_static_t fss_payload_write_long_double_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_long_double_s, 0, FSS_PAYLOAD_WRITE_long_double_s_length); + const f_string_static_t fss_payload_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_long_ignore_s, 0, FSS_PAYLOAD_WRITE_long_ignore_s_length); + const f_string_static_t fss_payload_write_long_object_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_long_object_s, 0, FSS_PAYLOAD_WRITE_long_object_s_length); + const f_string_static_t fss_payload_write_long_partial_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_long_partial_s, 0, FSS_PAYLOAD_WRITE_long_partial_s_length); + const f_string_static_t fss_payload_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_long_prepend_s, 0, FSS_PAYLOAD_WRITE_long_prepend_s_length); + const f_string_static_t fss_payload_write_long_single_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_long_single_s, 0, FSS_PAYLOAD_WRITE_long_single_s_length); + const f_string_static_t fss_payload_write_long_trim_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_long_trim_s, 0, FSS_PAYLOAD_WRITE_long_trim_s_length); +#endif // _di_fss_payload_write_parameters_ #ifndef _di_fss_payload_write_main_delete_ - f_status_t fss_payload_write_main_delete(fss_payload_write_main_t * const main) { - - f_console_parameters_delete(&main->parameters); - - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); + f_status_t fss_payload_write_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_payload_write_main_delete_ diff --git a/level_3/fss_payload_write/c/common.h b/level_3/fss_payload_write/c/common.h index d6f079d..8198f55 100644 --- a/level_3/fss_payload_write/c/common.h +++ b/level_3/fss_payload_write/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t fss_payload_write_program_version_s; #endif // _di_fss_payload_write_program_version_ +/** + * The program name. + */ #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 Payload Write" @@ -53,32 +59,88 @@ extern "C" { extern const f_string_static_t fss_payload_write_program_name_long_s; #endif // _di_fss_payload_write_program_name_ +/** + * The program defines. + */ #ifndef _di_fss_payload_write_defines_ #define fss_payload_write_signal_check_d 10000 - #define fss_payload_write_pipe_content_end_s '\f' - #define fss_payload_write_pipe_content_ignore_s '\v' - #define fss_payload_write_pipe_content_start_s '\b' - - #define fss_payload_write_short_file_s "f" - #define fss_payload_write_short_content_s "c" - #define fss_payload_write_short_double_s "d" - #define fss_payload_write_short_ignore_s "I" - #define fss_payload_write_short_object_s "o" - #define fss_payload_write_short_partial_s "p" - #define fss_payload_write_short_prepend_s "P" - #define fss_payload_write_short_single_s "s" - #define fss_payload_write_short_trim_s "T" - - #define fss_payload_write_long_file_s "file" - #define fss_payload_write_long_content_s "content" - #define fss_payload_write_long_double_s "double" - #define fss_payload_write_long_ignore_s "ignore" - #define fss_payload_write_long_object_s "object" - #define fss_payload_write_long_partial_s "partial" - #define fss_payload_write_long_prepend_s "prepend" - #define fss_payload_write_long_single_s "single" - #define fss_payload_write_long_trim_s "trim" + #define FSS_PAYLOAD_WRITE_pipe_content_end_s "\f" + #define FSS_PAYLOAD_WRITE_pipe_content_ignore_s "\v" + #define FSS_PAYLOAD_WRITE_pipe_content_start_s "\b" + + #define FSS_PAYLOAD_WRITE_pipe_content_end_s_length 1 + #define FSS_PAYLOAD_WRITE_pipe_content_ignore_s_length 1 + #define FSS_PAYLOAD_WRITE_pipe_content_start_s_length 1 + + extern const f_string_static_t fss_payload_write_pipe_content_end_s; + extern const f_string_static_t fss_payload_write_pipe_content_ignore_s; + extern const f_string_static_t fss_payload_write_pipe_content_start_s; +#endif // _di_fss_payload_write_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_fss_payload_write_parameters_ + #define FSS_PAYLOAD_WRITE_short_file_s "f" + #define FSS_PAYLOAD_WRITE_short_content_s "c" + #define FSS_PAYLOAD_WRITE_short_double_s "d" + #define FSS_PAYLOAD_WRITE_short_ignore_s "I" + #define FSS_PAYLOAD_WRITE_short_object_s "o" + #define FSS_PAYLOAD_WRITE_short_partial_s "p" + #define FSS_PAYLOAD_WRITE_short_prepend_s "P" + #define FSS_PAYLOAD_WRITE_short_single_s "s" + #define FSS_PAYLOAD_WRITE_short_trim_s "T" + + #define FSS_PAYLOAD_WRITE_long_file_s "file" + #define FSS_PAYLOAD_WRITE_long_content_s "content" + #define FSS_PAYLOAD_WRITE_long_double_s "double" + #define FSS_PAYLOAD_WRITE_long_ignore_s "ignore" + #define FSS_PAYLOAD_WRITE_long_object_s "object" + #define FSS_PAYLOAD_WRITE_long_partial_s "partial" + #define FSS_PAYLOAD_WRITE_long_prepend_s "prepend" + #define FSS_PAYLOAD_WRITE_long_single_s "single" + #define FSS_PAYLOAD_WRITE_long_trim_s "trim" + + #define FSS_PAYLOAD_WRITE_short_file_s_length 1 + #define FSS_PAYLOAD_WRITE_short_content_s_length 1 + #define FSS_PAYLOAD_WRITE_short_double_s_length 1 + #define FSS_PAYLOAD_WRITE_short_ignore_s_length 1 + #define FSS_PAYLOAD_WRITE_short_object_s_length 1 + #define FSS_PAYLOAD_WRITE_short_partial_s_length 1 + #define FSS_PAYLOAD_WRITE_short_prepend_s_length 1 + #define FSS_PAYLOAD_WRITE_short_single_s_length 1 + #define FSS_PAYLOAD_WRITE_short_trim_s_length 1 + + #define FSS_PAYLOAD_WRITE_long_file_s_length 4 + #define FSS_PAYLOAD_WRITE_long_content_s_length 7 + #define FSS_PAYLOAD_WRITE_long_double_s_length 6 + #define FSS_PAYLOAD_WRITE_long_ignore_s_length 6 + #define FSS_PAYLOAD_WRITE_long_object_s_length 6 + #define FSS_PAYLOAD_WRITE_long_partial_s_length 7 + #define FSS_PAYLOAD_WRITE_long_prepend_s_length 7 + #define FSS_PAYLOAD_WRITE_long_single_s_length 6 + #define FSS_PAYLOAD_WRITE_long_trim_s_length 4 + + extern const f_string_static_t fss_payload_write_short_file_s; + extern const f_string_static_t fss_payload_write_short_content_s; + extern const f_string_static_t fss_payload_write_short_double_s; + extern const f_string_static_t fss_payload_write_short_ignore_s; + extern const f_string_static_t fss_payload_write_short_object_s; + extern const f_string_static_t fss_payload_write_short_partial_s; + extern const f_string_static_t fss_payload_write_short_prepend_s; + extern const f_string_static_t fss_payload_write_short_single_s; + extern const f_string_static_t fss_payload_write_short_trim_s; + + extern const f_string_static_t fss_payload_write_long_file_s; + extern const f_string_static_t fss_payload_write_long_content_s; + extern const f_string_static_t fss_payload_write_long_double_s; + extern const f_string_static_t fss_payload_write_long_ignore_s; + extern const f_string_static_t fss_payload_write_long_object_s; + extern const f_string_static_t fss_payload_write_long_partial_s; + extern const f_string_static_t fss_payload_write_long_prepend_s; + extern const f_string_static_t fss_payload_write_long_single_s; + extern const f_string_static_t fss_payload_write_long_trim_s; enum { fss_payload_write_parameter_help_e, @@ -113,51 +175,19 @@ extern "C" { 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(fss_payload_write_short_file_s, fss_payload_write_long_file_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_write_short_content_s, fss_payload_write_long_content_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_write_short_double_s, fss_payload_write_long_double_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_write_short_ignore_s, fss_payload_write_long_ignore_s, 0, 2, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_write_short_object_s, fss_payload_write_long_object_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_write_short_partial_s, fss_payload_write_long_partial_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_write_short_prepend_s, fss_payload_write_long_prepend_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_write_short_single_s, fss_payload_write_long_single_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_payload_write_short_trim_s, fss_payload_write_long_trim_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_write_short_file_s.string, fss_payload_write_long_file_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_write_short_content_s.string, fss_payload_write_long_content_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_write_short_double_s.string, fss_payload_write_long_double_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_write_short_ignore_s.string, fss_payload_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_write_short_object_s.string, fss_payload_write_long_object_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_write_short_partial_s.string, fss_payload_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_write_short_prepend_s.string, fss_payload_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_write_short_single_s.string, fss_payload_write_long_single_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_payload_write_short_trim_s.string, fss_payload_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_payload_write_total_parameters_d 18 -#endif // _di_fss_payload_write_defines_ - -#ifndef _di_fss_payload_write_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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_string_static_t prepend; - - f_color_context_t context; - } fss_payload_write_main_t; - - #define fss_payload_write_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_string_static_t_initialize, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_payload_write_main_t_ +#endif // _di_fss_payload_write_parameters_ /** * Deallocate main. @@ -175,7 +205,7 @@ extern "C" { * @see fss_payload_write_main() */ #ifndef _di_fss_payload_write_main_delete_ - extern f_status_t fss_payload_write_main_delete(fss_payload_write_main_t * const main); + extern f_status_t fss_payload_write_main_delete(fll_program_data_t * const main); #endif // _di_fss_payload_write_main_delete_ #ifdef __cplusplus 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 0ccf724..302bc1e 100644 --- a/level_3/fss_payload_write/c/fss_payload_write.c +++ b/level_3/fss_payload_write/c/fss_payload_write.c @@ -66,7 +66,7 @@ extern "C" { #endif // _di_fss_payload_write_print_help_ #ifndef _di_fss_payload_write_main_ - f_status_t fss_payload_write_main(fss_payload_write_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_payload_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -78,7 +78,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_payload_write_parameter_no_color_e, fss_payload_write_parameter_light_e, fss_payload_write_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; 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 6c9e4ce..890c29c 100644 --- a/level_3/fss_payload_write/c/fss_payload_write.h +++ b/level_3/fss_payload_write/c/fss_payload_write.h @@ -89,7 +89,7 @@ extern "C" { * @see fss_payload_write_main_delete() */ #ifndef _di_fss_payload_write_main_ - extern f_status_t fss_payload_write_main(fss_payload_write_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_payload_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_payload_write_main_ #ifdef __cplusplus diff --git a/level_3/fss_payload_write/c/main.c b/level_3/fss_payload_write/c/main.c index e66dfa8..9a3a0a3 100644 --- a/level_3/fss_payload_write/c/main.c +++ b/level_3/fss_payload_write/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_payload_write_main_t data = fss_payload_write_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/fss_payload_write/c/private-common.c b/level_3/fss_payload_write/c/private-common.c index e331b5f..5cb2006 100644 --- a/level_3/fss_payload_write/c/private-common.c +++ b/level_3/fss_payload_write/c/private-common.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fss_payload_write_print_signal_received_ - void fss_payload_write_print_signal_received(fss_payload_write_main_t * const main, const f_status_t signal) { + void fss_payload_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -24,7 +24,7 @@ extern "C" { #endif // _di_fss_payload_write_print_signal_received_ #ifndef _di_fss_payload_write_signal_received_ - f_status_t fss_payload_write_signal_received(fss_payload_write_main_t * const main) { + f_status_t fss_payload_write_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_payload_write/c/private-common.h b/level_3/fss_payload_write/c/private-common.h index 340fb78..a612a40 100644 --- a/level_3/fss_payload_write/c/private-common.h +++ b/level_3/fss_payload_write/c/private-common.h @@ -33,7 +33,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_payload_write_print_signal_received_ - extern void fss_payload_write_print_signal_received(fss_payload_write_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_payload_write_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_payload_write_print_signal_received_ /** @@ -51,7 +51,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_payload_write_signal_received_ - extern f_status_t fss_payload_write_signal_received(fss_payload_write_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_write_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_write_signal_received_ #ifdef __cplusplus diff --git a/level_3/fss_payload_write/c/private-write.c b/level_3/fss_payload_write/c/private-write.c index 166b7d1..a862b10 100644 --- a/level_3/fss_payload_write/c/private-write.c +++ b/level_3/fss_payload_write/c/private-write.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_payload_write_error_parameter_same_times_print_ - void fss_payload_write_error_parameter_same_times_print(fss_payload_write_main_t * const main) { + void fss_payload_write_error_parameter_same_times_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -28,7 +28,7 @@ extern "C" { #endif // _di_fss_payload_write_error_parameter_same_times_print_ #ifndef _di_fss_payload_write_error_parameter_unsupported_eol_print_ - void fss_payload_write_error_parameter_unsupported_eol_print(fss_payload_write_main_t * const main) { + void fss_payload_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -45,7 +45,7 @@ extern "C" { #endif // _di_fss_payload_write_error_parameter_unsupported_eol_print_ #ifndef _di_fss_payload_write_error_parameter_value_missing_print_ - void fss_payload_write_error_parameter_value_missing_print(fss_payload_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) { + void fss_payload_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_t symbol, const f_string_t parameter) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -62,7 +62,7 @@ extern "C" { #endif // _di_fss_payload_write_error_parameter_value_missing_print_ #ifndef _di_fss_payload_write_process_ - f_status_t fss_payload_write_process(fss_payload_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) { + f_status_t fss_payload_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_state_t state = macro_f_state_t_initialize(fss_payload_write_common_allocation_large_d, fss_payload_write_common_allocation_small_d, 0, 0, 0, 0, 0); @@ -169,7 +169,7 @@ extern "C" { #endif // _di_fss_payload_write_process_ #ifndef _di_fss_payload_write_process_pipe_ - f_status_t fss_payload_write_process_pipe(fss_payload_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { + f_status_t fss_payload_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_status_t status_pipe = F_none; diff --git a/level_3/fss_payload_write/c/private-write.h b/level_3/fss_payload_write/c/private-write.h index dedaa62..ffe2782 100644 --- a/level_3/fss_payload_write/c/private-write.h +++ b/level_3/fss_payload_write/c/private-write.h @@ -19,7 +19,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_payload_write_error_parameter_same_times_print_ - void fss_payload_write_error_parameter_same_times_print(fss_payload_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_payload_write_error_parameter_same_times_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_write_error_parameter_same_times_print_ /** @@ -29,7 +29,7 @@ extern "C" { * The main program data. */ #ifndef _di_fss_payload_write_error_parameter_unsupported_eol_print_ - void fss_payload_write_error_parameter_unsupported_eol_print(fss_payload_write_main_t * const main) F_attribute_visibility_internal_d; + void fss_payload_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_payload_write_error_parameter_unsupported_eol_print_ /** @@ -43,7 +43,7 @@ extern "C" { * The parameter name, such as "help" in "--help". */ #ifndef _di_fss_payload_write_error_parameter_value_missing_print_ - void fss_payload_write_error_parameter_value_missing_print(fss_payload_write_main_t * const main, const f_string_t symbol, const f_string_t parameter) F_attribute_visibility_internal_d; + void fss_payload_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_t symbol, const f_string_t parameter) F_attribute_visibility_internal_d; #endif // _di_fss_payload_write_error_parameter_value_missing_print_ /** @@ -70,7 +70,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_payload_write_process_ - extern f_status_t fss_payload_write_process(fss_payload_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; #endif // _di_fss_payload_write_process_ /** @@ -91,7 +91,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_payload_write_process_pipe_ - extern f_status_t fss_payload_write_process_pipe(fss_payload_write_main_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; + extern f_status_t fss_payload_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; #endif // _di_fss_payload_write_process_pipe_ #ifdef __cplusplus diff --git a/level_3/fss_status_code/c/common.c b/level_3/fss_status_code/c/common.c index 7938516..f9744fd 100644 --- a/level_3/fss_status_code/c/common.c +++ b/level_3/fss_status_code/c/common.c @@ -4,25 +4,26 @@ 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_initialize(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_initialize(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_initialize(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_program_help_parameters_ + const f_string_static_t fss_status_code_program_help_parameters_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_program_help_parameters_s, 0, FSS_STATUS_CODE_program_help_parameters_s_length); +#endif // _di_fss_status_code_program_help_parameters_ + +#ifndef _di_fss_status_code_parameters_ + const f_string_static_t fss_status_code_short_is_fine_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_short_is_fine_s, 0, FSS_STATUS_CODE_short_is_fine_s_length); + const f_string_static_t fss_status_code_short_is_warning_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_short_is_warning_s, 0, FSS_STATUS_CODE_short_is_warning_s_length); + const f_string_static_t fss_status_code_short_is_error_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_short_is_error_s, 0, FSS_STATUS_CODE_short_is_error_s_length); + const f_string_static_t fss_status_code_short_number_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_short_number_s, 0, FSS_STATUS_CODE_short_number_s_length); + + const f_string_static_t fss_status_code_long_is_fine_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_long_is_fine_s, 0, FSS_STATUS_CODE_long_is_fine_s_length); + const f_string_static_t fss_status_code_long_is_warning_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_long_is_warning_s, 0, FSS_STATUS_CODE_long_is_warning_s_length); + const f_string_static_t fss_status_code_long_is_error_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_long_is_error_s, 0, FSS_STATUS_CODE_long_is_error_s_length); + const f_string_static_t fss_status_code_long_number_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_long_number_s, 0, FSS_STATUS_CODE_long_number_s_length); +#endif // _di_fss_status_code_parameters_ #ifndef _di_fss_status_code_main_delete_ - f_status_t fss_status_code_main_delete(fss_status_code_main_t * const main) { - - f_console_parameters_delete(&main->parameters); - - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); + f_status_t fss_status_code_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_fss_status_code_main_delete_ diff --git a/level_3/fss_status_code/c/common.h b/level_3/fss_status_code/c/common.h index ef9e3b2..b9855df 100644 --- a/level_3/fss_status_code/c/common.h +++ b/level_3/fss_status_code/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -40,6 +43,9 @@ extern "C" { extern const f_string_static_t fss_status_code_program_version_s; #endif // _di_fss_status_code_program_version_ +/** + * The program name. + */ #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" @@ -51,18 +57,56 @@ extern "C" { const f_string_static_t fss_status_code_program_name_long_s; #endif // _di_fss_status_code_program_name_ +/** + * The program help related data. + */ +#ifndef _di_fss_status_code_program_help_parameters_ + #define FSS_STATUS_CODE_program_help_parameters_s "status code(s)" + #define FSS_STATUS_CODE_program_help_parameters_s_length 14 + + extern const f_string_static_t fss_status_code_program_help_parameters_s; +#endif // _di_fss_status_code_program_help_parameters_ + +/** + * The program defines. + */ #ifndef _di_fss_status_code_defines_ #define fss_status_code_signal_check_d 10000 +#endif // _di_fss_status_code_defines_ - #define fss_status_code_short_is_fine_s "f" - #define fss_status_code_short_is_warning_s "w" - #define fss_status_code_short_is_error_s "e" - #define fss_status_code_short_number_s "n" - - #define fss_status_code_long_is_fine_s "is_fine" - #define fss_status_code_long_is_warning_s "is_warning" - #define fss_status_code_long_is_error_s "is_error" - #define fss_status_code_long_number_s "number" +/** + * The main program parameters. + */ +#ifndef _di_fss_status_code_parameters_ + #define FSS_STATUS_CODE_short_is_fine_s "f" + #define FSS_STATUS_CODE_short_is_warning_s "w" + #define FSS_STATUS_CODE_short_is_error_s "e" + #define FSS_STATUS_CODE_short_number_s "n" + + #define FSS_STATUS_CODE_long_is_fine_s "is_fine" + #define FSS_STATUS_CODE_long_is_warning_s "is_warning" + #define FSS_STATUS_CODE_long_is_error_s "is_error" + #define FSS_STATUS_CODE_long_number_s "number" + + #define FSS_STATUS_CODE_short_is_fine_s_length 1 + #define FSS_STATUS_CODE_short_is_warning_s_length 1 + #define FSS_STATUS_CODE_short_is_error_s_length 1 + #define FSS_STATUS_CODE_short_number_s_length 1 + + #define FSS_STATUS_CODE_long_is_fine_s_length 7 + #define FSS_STATUS_CODE_long_is_warning_s_length 10 + #define FSS_STATUS_CODE_long_is_error_s_length 8 + #define FSS_STATUS_CODE_long_number_s_length 6 + + extern const f_string_static_t fss_status_code_short_is_fine_s; + extern const f_string_static_t fss_status_code_short_is_warning_s; + extern const f_string_static_t fss_status_code_short_is_error_s; + extern const f_string_static_t fss_status_code_short_number_s; + + extern const f_string_static_t fss_status_code_long_is_fine_s; + extern const f_string_static_t fss_status_code_long_is_warning_s; + extern const f_string_static_t fss_status_code_long_is_error_s; + extern const f_string_static_t fss_status_code_long_number_s; enum { fss_status_code_parameter_help_e, @@ -92,44 +136,15 @@ extern "C" { 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(fss_status_code_short_is_fine_s, fss_status_code_long_is_fine_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_status_code_short_is_warning_s, fss_status_code_long_is_warning_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_status_code_short_is_error_s, fss_status_code_long_is_error_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(fss_status_code_short_number_s, fss_status_code_long_number_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_status_code_short_is_fine_s.string, fss_status_code_long_is_fine_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_status_code_short_is_warning_s.string, fss_status_code_long_is_warning_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_status_code_short_is_error_s.string, fss_status_code_long_is_error_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(fss_status_code_short_number_s.string, fss_status_code_long_number_s.string, 0, 0, f_console_type_normal_e), \ } #define fss_status_code_total_parameters_d 13 #endif // _di_fss_status_code_defines_ -#ifndef _di_fss_status_code_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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; - } fss_status_code_main_t; - - #define fss_status_code_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_status_code_main_t_ - /** * Deallocate main. * @@ -146,7 +161,7 @@ extern "C" { * @see fss_status_code_main() */ #ifndef _di_fss_status_code_main_delete_ - extern f_status_t fss_status_code_main_delete(fss_status_code_main_t * const main); + extern f_status_t fss_status_code_main_delete(fll_program_data_t * const main); #endif // _di_fss_status_code_main_delete_ #ifdef __cplusplus 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 730cd8d..c3247ec 100644 --- a/level_3/fss_status_code/c/fss_status_code.c +++ b/level_3/fss_status_code/c/fss_status_code.c @@ -39,7 +39,7 @@ extern "C" { 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)"); + fll_program_print_help_usage(file, context, fss_status_code_program_name_s, fss_status_code_program_help_parameters_s); funlockfile(file.stream); @@ -48,7 +48,7 @@ extern "C" { #endif // _di_fss_status_code_print_help_ #ifndef _di_fss_status_code_main_ - f_status_t fss_status_code_main(fss_status_code_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t fss_status_code_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -60,7 +60,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { fss_status_code_parameter_no_color_e, fss_status_code_parameter_light_e, fss_status_code_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -186,7 +186,7 @@ extern "C" { return F_status_set_error(status); } - if (main->remaining.used == 0 && !main->process_pipe) { + if (main->parameters.remaining.used == 0 && !main->process_pipe) { fll_print_format("%[You failed to specify an error code.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); fss_status_code_main_delete(main); @@ -200,12 +200,12 @@ extern "C" { // @todo call fss_status_code_process_check() here for all main from pipe that is space separated. } - if (main->remaining.used > 0) { + if (main->parameters.remaining.used > 0) { uint16_t signal_check = 0; flockfile(main->output.to.stream); - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % fss_status_code_signal_check_d)) { if (fss_status_code_signal_received(main)) { @@ -216,7 +216,7 @@ extern "C" { signal_check = 0; } - status2 = fss_status_code_process_check(main, arguments->argv[main->remaining.array[i]]); + status2 = fss_status_code_process_check(main, arguments->argv[main->parameters.remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; @@ -231,12 +231,12 @@ extern "C" { // @todo call fss_status_code_process_number() here for all main from pipe that is space separated. } - if (main->remaining.used > 0) { + if (main->parameters.remaining.used > 0) { uint16_t signal_check = 0; flockfile(main->output.to.stream); - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % fss_status_code_signal_check_d)) { if (fss_status_code_signal_received(main)) { @@ -247,7 +247,7 @@ extern "C" { signal_check = 0; } - status2 = fss_status_code_process_number(main, arguments->argv[main->remaining.array[i]]); + status2 = fss_status_code_process_number(main, arguments->argv[main->parameters.remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; @@ -262,12 +262,12 @@ extern "C" { // @todo call fss_status_code_process_normal() here for all main from pipe that is space separated. } - if (main->remaining.used > 0) { + if (main->parameters.remaining.used > 0) { uint16_t signal_check = 0; flockfile(main->output.to.stream); - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % fss_status_code_signal_check_d)) { if (fss_status_code_signal_received(main)) { @@ -278,7 +278,7 @@ extern "C" { signal_check = 0; } - status2 = fss_status_code_process_normal(main, arguments->argv[main->remaining.array[i]]); + status2 = fss_status_code_process_normal(main, arguments->argv[main->parameters.remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; 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 9b4ad8e..1cffaa2 100644 --- a/level_3/fss_status_code/c/fss_status_code.h +++ b/level_3/fss_status_code/c/fss_status_code.h @@ -91,7 +91,7 @@ extern "C" { * @see fss_status_code_main_delete() */ #ifndef _di_fss_status_code_main_ - extern f_status_t fss_status_code_main(fss_status_code_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t fss_status_code_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_status_code_main_ #ifdef __cplusplus diff --git a/level_3/fss_status_code/c/main.c b/level_3/fss_status_code/c/main.c index 29dac47..836c447 100644 --- a/level_3/fss_status_code/c/main.c +++ b/level_3/fss_status_code/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_status_code_main_t data = fss_status_code_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/fss_status_code/c/private-common.c b/level_3/fss_status_code/c/private-common.c index 1e848a2..b0617ca 100644 --- a/level_3/fss_status_code/c/private-common.c +++ b/level_3/fss_status_code/c/private-common.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fss_status_code_print_signal_received_ - void fss_status_code_print_signal_received(fss_status_code_main_t * const main, const f_status_t signal) { + void fss_status_code_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -24,7 +24,7 @@ extern "C" { #endif // _di_fss_status_code_print_signal_received_ #ifndef _di_fss_status_code_signal_received_ - f_status_t fss_status_code_signal_received(fss_status_code_main_t * const main) { + f_status_t fss_status_code_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/fss_status_code/c/private-common.h b/level_3/fss_status_code/c/private-common.h index 3b433f6..ecd02d2 100644 --- a/level_3/fss_status_code/c/private-common.h +++ b/level_3/fss_status_code/c/private-common.h @@ -21,7 +21,7 @@ extern "C" { * The signal received. */ #ifndef _di_fss_status_code_print_signal_received_ - extern void fss_status_code_print_signal_received(fss_status_code_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void fss_status_code_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_fss_status_code_print_signal_received_ /** @@ -39,7 +39,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fss_status_code_signal_received_ - extern f_status_t fss_status_code_signal_received(fss_status_code_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t fss_status_code_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_fss_status_code_signal_received_ #ifdef __cplusplus diff --git a/level_3/fss_status_code/c/private-fss_status_code.c b/level_3/fss_status_code/c/private-fss_status_code.c index 30bec61..2b0f84a 100644 --- a/level_3/fss_status_code/c/private-fss_status_code.c +++ b/level_3/fss_status_code/c/private-fss_status_code.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_fss_status_code_process_check_ - f_status_t fss_status_code_process_check(fss_status_code_main_t * const main, const f_string_t value) { + f_status_t fss_status_code_process_check(fll_program_data_t * const main, const f_string_t value) { f_number_unsigned_t number = 0; @@ -52,7 +52,7 @@ extern "C" { #endif // _di_fss_status_code_process_check_ #ifndef _di_fss_status_code_process_number_ - f_status_t fss_status_code_process_number(fss_status_code_main_t * const main, const f_string_t value) { + f_status_t fss_status_code_process_number(fll_program_data_t * const main, const f_string_t value) { f_status_t status = F_none; @@ -110,7 +110,7 @@ extern "C" { #endif // _di_fss_status_code_process_number_ #ifndef _di_fss_status_code_process_normal_ - f_status_t fss_status_code_process_normal(fss_status_code_main_t * const main, const f_string_t value) { + f_status_t fss_status_code_process_normal(fll_program_data_t * const main, const f_string_t value) { f_number_unsigned_t number = 0; @@ -140,7 +140,7 @@ extern "C" { #endif // _di_fss_status_code_process_normal_ #ifndef _di_fss_status_code_convert_number_ - f_status_t fss_status_code_convert_number(fss_status_code_main_t * const main, const f_string_t value, f_number_unsigned_t *number) { + f_status_t fss_status_code_convert_number(fll_program_data_t * const main, const f_string_t value, f_number_unsigned_t *number) { const f_string_range_t range = macro_f_string_range_t_initialize(strlen(value)); diff --git a/level_3/fss_status_code/c/private-fss_status_code.h b/level_3/fss_status_code/c/private-fss_status_code.h index c7f630f..648718d 100644 --- a/level_3/fss_status_code/c/private-fss_status_code.h +++ b/level_3/fss_status_code/c/private-fss_status_code.h @@ -34,7 +34,7 @@ extern "C" { * @see fss_status_code_convert_number() */ #ifndef _di_fss_status_code_process_check_ - extern f_status_t fss_status_code_process_check(fss_status_code_main_t * const main, const f_string_t value) F_attribute_visibility_internal_d; + extern f_status_t fss_status_code_process_check(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d; #endif // _di_fss_status_code_process_check_ /** @@ -56,7 +56,7 @@ extern "C" { * @see fll_fss_status_string_from() */ #ifndef _di_fss_status_code_process_number_ - extern f_status_t fss_status_code_process_number(fss_status_code_main_t * const main, const f_string_t value) F_attribute_visibility_internal_d; + extern f_status_t fss_status_code_process_number(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d; #endif // _di_fss_status_code_process_number_ /** @@ -83,7 +83,7 @@ extern "C" { * @see fss_status_code_convert_number() */ #ifndef _di_fss_status_code_process_normal_ - extern f_status_t fss_status_code_process_normal(fss_status_code_main_t * const main, const f_string_t value) F_attribute_visibility_internal_d; + extern f_status_t fss_status_code_process_normal(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d; #endif // _di_fss_status_code_process_normal_ /** @@ -111,7 +111,7 @@ extern "C" { * @see fl_console_parameter_to_number_unsigned() */ #ifndef _di_fss_status_code_convert_number_ - extern f_status_t fss_status_code_convert_number(fss_status_code_main_t * const main, const f_string_t value, f_number_unsigned_t *number) F_attribute_visibility_internal_d; + extern f_status_t fss_status_code_convert_number(fll_program_data_t * const main, const f_string_t value, f_number_unsigned_t *number) F_attribute_visibility_internal_d; #endif // _di_fss_status_code_convert_number_ #ifdef __cplusplus diff --git a/level_3/iki_read/c/common.c b/level_3/iki_read/c/common.c index c177de7..5f2872c 100644 --- a/level_3/iki_read/c/common.c +++ b/level_3/iki_read/c/common.c @@ -13,12 +13,33 @@ extern "C" { const f_string_static_t iki_read_program_name_long_s = macro_f_string_static_t_initialize(IKI_READ_program_name_long_s, 0, IKI_READ_program_name_long_s_length); #endif // _di_iki_read_program_name_ +#ifndef _di_iki_read_parameters_ + const f_string_static_t iki_read_short_at_s = macro_f_string_static_t_initialize(IKI_READ_short_at_s, 0, IKI_READ_short_at_s_length); + const f_string_static_t iki_read_short_content_s = macro_f_string_static_t_initialize(IKI_READ_short_content_s, 0, IKI_READ_short_content_s_length); + const f_string_static_t iki_read_short_line_s = macro_f_string_static_t_initialize(IKI_READ_short_line_s, 0, IKI_READ_short_line_s_length); + const f_string_static_t iki_read_short_literal_s = macro_f_string_static_t_initialize(IKI_READ_short_literal_s, 0, IKI_READ_short_literal_s_length); + const f_string_static_t iki_read_short_name_s = macro_f_string_static_t_initialize(IKI_READ_short_name_s, 0, IKI_READ_short_name_s_length); + const f_string_static_t iki_read_short_object_s = macro_f_string_static_t_initialize(IKI_READ_short_object_s, 0, IKI_READ_short_object_s_length); + const f_string_static_t iki_read_short_substitute_s = macro_f_string_static_t_initialize(IKI_READ_short_substitute_s, 0, IKI_READ_short_substitute_s_length); + const f_string_static_t iki_read_short_total_s = macro_f_string_static_t_initialize(IKI_READ_short_total_s, 0, IKI_READ_short_total_s_length); + const f_string_static_t iki_read_short_whole_s = macro_f_string_static_t_initialize(IKI_READ_short_whole_s, 0, IKI_READ_short_whole_s_length); + + const f_string_static_t iki_read_long_at_s = macro_f_string_static_t_initialize(IKI_READ_long_at_s, 0, IKI_READ_long_at_s_length); + const f_string_static_t iki_read_long_content_s = macro_f_string_static_t_initialize(IKI_READ_long_content_s, 0, IKI_READ_long_content_s_length); + const f_string_static_t iki_read_long_line_s = macro_f_string_static_t_initialize(IKI_READ_long_line_s, 0, IKI_READ_long_line_s_length); + const f_string_static_t iki_read_long_literal_s = macro_f_string_static_t_initialize(IKI_READ_long_literal_s, 0, IKI_READ_long_literal_s_length); + const f_string_static_t iki_read_long_name_s = macro_f_string_static_t_initialize(IKI_READ_long_name_s, 0, IKI_READ_long_name_s_length); + const f_string_static_t iki_read_long_object_s = macro_f_string_static_t_initialize(IKI_READ_long_object_s, 0, IKI_READ_long_object_s_length); + const f_string_static_t iki_read_long_substitute_s = macro_f_string_static_t_initialize(IKI_READ_long_substitute_s, 0, IKI_READ_long_substitute_s_length); + const f_string_static_t iki_read_long_total_s = macro_f_string_static_t_initialize(IKI_READ_long_total_s, 0, IKI_READ_long_total_s_length); + const f_string_static_t iki_read_long_whole_s = macro_f_string_static_t_initialize(IKI_READ_long_whole_s, 0, IKI_READ_long_whole_s_length); +#endif // _di_iki_read_parameters_ + #ifndef _di_iki_read_main_delete_ f_status_t iki_read_main_delete(iki_read_main_t * const main) { f_console_parameters_delete(&main->parameters); - 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/common.h b/level_3/iki_read/c/common.h index a8a2c43..012f9a5 100644 --- a/level_3/iki_read/c/common.h +++ b/level_3/iki_read/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t iki_read_program_version_s; #endif // _di_iki_read_program_version_ +/** + * The program name. + */ #ifndef _di_iki_read_program_name_ #define IKI_READ_program_name_s "iki_read" #define IKI_READ_program_name_long_s "IKI Read" @@ -53,6 +59,9 @@ extern "C" { extern const f_string_static_t iki_read_program_name_long_s; #endif // _di_iki_read_program_name_ +/** + * The program defines. + */ #ifndef _di_iki_read_defines_ #define iki_read_signal_check_d 10000 @@ -62,26 +71,71 @@ extern "C" { iki_read_mode_object_e, iki_read_mode_total_e, }; +#endif // _di_iki_read_defines_ - #define iki_read_short_at_s "a" - #define iki_read_short_content_s "c" - #define iki_read_short_line_s "l" - #define iki_read_short_literal_s "L" - #define iki_read_short_name_s "n" - #define iki_read_short_object_s "o" - #define iki_read_short_substitute_s "s" - #define iki_read_short_total_s "t" - #define iki_read_short_whole_s "w" - - #define iki_read_long_at_s "at" - #define iki_read_long_content_s "content" - #define iki_read_long_line_s "line" - #define iki_read_long_literal_s "literal" - #define iki_read_long_name_s "name" - #define iki_read_long_object_s "object" - #define iki_read_long_substitute_s "substitute" - #define iki_read_long_total_s "total" - #define iki_read_long_whole_s "whole" +/** + * The main program parameters. + */ +#ifndef _di_iki_read_parameters_ + #define IKI_READ_short_at_s "a" + #define IKI_READ_short_content_s "c" + #define IKI_READ_short_line_s "l" + #define IKI_READ_short_literal_s "L" + #define IKI_READ_short_name_s "n" + #define IKI_READ_short_object_s "o" + #define IKI_READ_short_substitute_s "s" + #define IKI_READ_short_total_s "t" + #define IKI_READ_short_whole_s "w" + + #define IKI_READ_long_at_s "at" + #define IKI_READ_long_content_s "content" + #define IKI_READ_long_line_s "line" + #define IKI_READ_long_literal_s "literal" + #define IKI_READ_long_name_s "name" + #define IKI_READ_long_object_s "object" + #define IKI_READ_long_substitute_s "substitute" + #define IKI_READ_long_total_s "total" + #define IKI_READ_long_whole_s "whole" + + #define IKI_READ_short_at_s_length 1 + #define IKI_READ_short_content_s_length 1 + #define IKI_READ_short_line_s_length 1 + #define IKI_READ_short_literal_s_length 1 + #define IKI_READ_short_name_s_length 1 + #define IKI_READ_short_object_s_length 1 + #define IKI_READ_short_substitute_s_length 1 + #define IKI_READ_short_total_s_length 1 + #define IKI_READ_short_whole_s_length 1 + + #define IKI_READ_long_at_s_length 2 + #define IKI_READ_long_content_s_length 7 + #define IKI_READ_long_line_s_length 4 + #define IKI_READ_long_literal_s_length 7 + #define IKI_READ_long_name_s_length 4 + #define IKI_READ_long_object_s_length 7 + #define IKI_READ_long_substitute_s_length 10 + #define IKI_READ_long_total_s_length 5 + #define IKI_READ_long_whole_s_length 5 + + extern const f_string_static_t iki_read_short_at_s; + extern const f_string_static_t iki_read_short_content_s; + extern const f_string_static_t iki_read_short_line_s; + extern const f_string_static_t iki_read_short_literal_s; + extern const f_string_static_t iki_read_short_name_s; + extern const f_string_static_t iki_read_short_object_s; + extern const f_string_static_t iki_read_short_substitute_s; + extern const f_string_static_t iki_read_short_total_s; + extern const f_string_static_t iki_read_short_whole_s; + + extern const f_string_static_t iki_read_long_at_s; + extern const f_string_static_t iki_read_long_content_s; + extern const f_string_static_t iki_read_long_line_s; + extern const f_string_static_t iki_read_long_literal_s; + extern const f_string_static_t iki_read_long_name_s; + extern const f_string_static_t iki_read_long_object_s; + extern const f_string_static_t iki_read_long_substitute_s; + extern const f_string_static_t iki_read_long_total_s; + extern const f_string_static_t iki_read_long_whole_s; enum { iki_read_parameter_help_e, @@ -116,19 +170,19 @@ extern "C" { 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(iki_read_short_at_s, iki_read_long_at_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_read_short_content_s, iki_read_long_content_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_read_short_line_s, iki_read_long_line_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_read_short_literal_s, iki_read_long_literal_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_read_short_name_s, iki_read_long_name_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_read_short_object_s, iki_read_long_object_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_read_short_whole_s, iki_read_long_whole_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_read_short_substitute_s, iki_read_long_substitute_s, 0, 3, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_read_short_total_s, iki_read_long_total_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_read_short_at_s.string, iki_read_long_at_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_read_short_content_s.string, iki_read_long_content_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_read_short_line_s.string, iki_read_long_line_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_read_short_literal_s.string, iki_read_long_literal_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_read_short_name_s.string, iki_read_long_name_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_read_short_object_s.string, iki_read_long_object_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_read_short_whole_s.string, iki_read_long_whole_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_read_short_substitute_s.string, iki_read_long_substitute_s.string, 0, 3, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_read_short_total_s.string, iki_read_long_total_s.string, 0, 0, f_console_type_normal_e), \ } #define iki_read_total_parameters_d 18 -#endif // _di_iki_read_defines_ +#endif // _di_iki_read_parameters_ #ifndef _di_iki_read_substitution_t_ #define iki_read_substitution_vocabulary_s "vocabulary" @@ -172,11 +226,24 @@ extern "C" { #define macro_iki_read_substitutions_t_adjust(status, replacements, length) macro_f_memory_structure_adjust(status, replacements, iki_read_substitution_t, length) #endif // _di_iki_read_substitutions_t_ +/** + * The main program data. + * + * parameters: The state of pre-defined parameters passed to the program. + * remaining: The remaining, non-pre-defined parameters, passed to the program. + * process_pipe: Designate whether or not to process the input pipe. + * output: The output file for general printing. + * error: The output file for error printing. + * warning: The output file for warning printing. + * signal: The process signal management structure. + * context: The color context. + * + * @todo + */ #ifndef _di_iki_read_main_t_ typedef struct { f_console_parameters_t parameters; - f_array_lengths_t remaining; bool process_pipe; fl_print_t output; diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index b10e394..8c5b5a0 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -6,15 +6,6 @@ extern "C" { #endif -#ifndef _di_iki_read_program_version_ - const f_string_static_t iki_read_program_version_s = macro_f_string_static_t_initialize(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_initialize(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_initialize(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) { @@ -50,7 +41,7 @@ extern "C" { 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)"); + fll_program_print_help_usage(file, context, iki_read_program_name_s, fll_program_parameter_filenames_s); fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s); fl_print_format(" This program will find and print variables, vocabularies, or content following the IKI standard, without focusing on any particular vocabulary specification.%r%r", file.stream, f_string_eol_s, f_string_eol_s); @@ -87,7 +78,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { iki_read_parameter_no_color_e, iki_read_parameter_light_e, iki_read_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -180,7 +171,7 @@ extern "C" { return F_none; } - if (main->remaining.used > 0 || main->process_pipe) { + if (main->parameters.remaining.used > 0 || main->process_pipe) { if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_found_e) { if (main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(main->error.to.stream); @@ -443,12 +434,12 @@ extern "C" { f_string_dynamic_resize(0, &main->buffer); } - if (F_status_is_fine(status) && main->remaining.used > 0) { + if (F_status_is_fine(status) && main->parameters.remaining.used > 0) { f_array_length_t i = 0; f_array_length_t total = 0; f_file_t file = f_file_t_initialize; - for (uint16_t signal_check = 0; i < main->remaining.used; ++i) { + for (uint16_t signal_check = 0; i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % iki_read_signal_check_d)) { if (iki_read_signal_received(main)) { @@ -462,17 +453,17 @@ extern "C" { macro_f_file_t_reset(file); total = 0; - status = f_file_open(arguments->argv[main->remaining.array[i]], 0, &file); + status = f_file_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e); break; } status = f_file_size_by_id(file.id, &total); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e); f_file_stream_close(F_true, &file); break; @@ -489,11 +480,11 @@ extern "C" { f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e); break; } - status = iki_read_process_buffer(main, arguments, arguments->argv[main->remaining.array[i]]); + status = iki_read_process_buffer(main, arguments, arguments->argv[main->parameters.remaining.array[i]]); if (F_status_is_error(status)) break; // Clear buffers before repeating the loop. diff --git a/level_3/iki_write/c/common.c b/level_3/iki_write/c/common.c index 37f36f4..cdd85e6 100644 --- a/level_3/iki_write/c/common.c +++ b/level_3/iki_write/c/common.c @@ -13,12 +13,25 @@ extern "C" { const f_string_static_t iki_write_program_name_long_s = macro_f_string_static_t_initialize(IKI_WRITE_program_name_long_s, 0, IKI_WRITE_program_name_long_s_length); #endif // _di_iki_write_program_name_ +#ifndef _di_iki_write_parameters_ + const f_string_static_t iki_write_short_file_s = macro_f_string_static_t_initialize(IKI_WRITE_short_file_s, 0, IKI_WRITE_short_file_s_length); + const f_string_static_t iki_write_short_content_s = macro_f_string_static_t_initialize(IKI_WRITE_short_content_s, 0, IKI_WRITE_short_content_s_length); + const f_string_static_t iki_write_short_double_s = macro_f_string_static_t_initialize(IKI_WRITE_short_double_s, 0, IKI_WRITE_short_double_s_length); + const f_string_static_t iki_write_short_object_s = macro_f_string_static_t_initialize(IKI_WRITE_short_object_s, 0, IKI_WRITE_short_object_s_length); + const f_string_static_t iki_write_short_single_s = macro_f_string_static_t_initialize(IKI_WRITE_short_single_s, 0, IKI_WRITE_short_single_s_length); + + const f_string_static_t iki_write_long_file_s = macro_f_string_static_t_initialize(IKI_WRITE_long_file_s, 0, IKI_WRITE_long_file_s_length); + const f_string_static_t iki_write_long_content_s = macro_f_string_static_t_initialize(IKI_WRITE_long_content_s, 0, IKI_WRITE_long_content_s_length); + const f_string_static_t iki_write_long_double_s = macro_f_string_static_t_initialize(IKI_WRITE_long_double_s, 0, IKI_WRITE_long_double_s_length); + const f_string_static_t iki_write_long_object_s = macro_f_string_static_t_initialize(IKI_WRITE_long_object_s, 0, IKI_WRITE_long_object_s_length); + const f_string_static_t iki_write_long_single_s = macro_f_string_static_t_initialize(IKI_WRITE_long_single_s, 0, IKI_WRITE_long_single_s_length); +#endif // _di_iki_write_parameters_ + #ifndef _di_iki_write_main_delete_ f_status_t iki_write_main_delete(iki_write_main_t * const main) { f_console_parameters_delete(&main->parameters); - 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/common.h b/level_3/iki_write/c/common.h index 2042e13..b3d4ba7 100644 --- a/level_3/iki_write/c/common.h +++ b/level_3/iki_write/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t iki_write_program_version_s; #endif // _di_iki_write_program_version_ +/** + * The program name. + */ #ifndef _di_iki_write_program_name_ #define iki_write_program_name_s "iki_write" #define iki_write_program_name_long_s "IKI Write" @@ -53,20 +59,52 @@ extern "C" { extern const f_string_static_t iki_write_program_name_long_s; #endif // _di_iki_write_program_name_ +/** + * The program defines. + */ #ifndef _di_iki_write_defines_ #define iki_write_signal_check_d 10000 +#endif // _di_iki_write_defines_ - #define iki_write_short_file_s "f" - #define iki_write_short_content_s "c" - #define iki_write_short_double_s "d" - #define iki_write_short_object_s "o" - #define iki_write_short_single_s "s" - - #define iki_write_long_file_s "file" - #define iki_write_long_content_s "content" - #define iki_write_long_double_s "double" - #define iki_write_long_object_s "object" - #define iki_write_long_single_s "single" +/** + * The main program parameters. + */ +#ifndef _di_iki_write_parameters_ + #define IKI_WRITE_short_file_s "f" + #define IKI_WRITE_short_content_s "c" + #define IKI_WRITE_short_double_s "d" + #define IKI_WRITE_short_object_s "o" + #define IKI_WRITE_short_single_s "s" + + #define IKI_WRITE_long_file_s "file" + #define IKI_WRITE_long_content_s "content" + #define IKI_WRITE_long_double_s "double" + #define IKI_WRITE_long_object_s "object" + #define IKI_WRITE_long_single_s "single" + + #define IKI_WRITE_short_file_s_length 1 + #define IKI_WRITE_short_content_s_length 1 + #define IKI_WRITE_short_double_s_length 1 + #define IKI_WRITE_short_object_s_length 1 + #define IKI_WRITE_short_single_s_length 1 + + #define IKI_WRITE_long_file_s_length 4 + #define IKI_WRITE_long_content_s_length 7 + #define IKI_WRITE_long_double_s_length 6 + #define IKI_WRITE_long_object_s_length 6 + #define IKI_WRITE_long_single_s_length 6 + + extern const f_string_static_t iki_write_short_file_s; + extern const f_string_static_t iki_write_short_content_s; + extern const f_string_static_t iki_write_short_double_s; + extern const f_string_static_t iki_write_short_object_s; + extern const f_string_static_t iki_write_short_single_s; + + extern const f_string_static_t iki_write_long_file_s; + extern const f_string_static_t iki_write_long_content_s; + extern const f_string_static_t iki_write_long_double_s; + extern const f_string_static_t iki_write_long_object_s; + extern const f_string_static_t iki_write_long_single_s; enum { iki_write_parameter_help_e, @@ -97,21 +135,34 @@ extern "C" { 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(iki_write_short_file_s, iki_write_long_file_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_write_short_content_s, iki_write_long_content_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_write_short_double_s, iki_write_long_double_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_write_short_object_s, iki_write_long_object_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(iki_write_short_single_s, iki_write_long_single_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_write_short_file_s.string, iki_write_long_file_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_write_short_content_s.string, iki_write_long_content_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_write_short_double_s.string, iki_write_long_double_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_write_short_object_s.string, iki_write_long_object_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(iki_write_short_single_s.string, iki_write_long_single_s.string, 0, 0, f_console_type_normal_e), \ } #define iki_write_total_parameters_d 14 -#endif // _di_iki_write_defines_ +#endif // _di_iki_write_parameters_ +/** + * The main program data. + * + * parameters: The state of pre-defined parameters passed to the program. + * remaining: The remaining, non-pre-defined parameters, passed to the program. + * process_pipe: Designate whether or not to process the input pipe. + * output: The output file for general printing. + * error: The output file for error printing. + * warning: The output file for warning printing. + * signal: The process signal management structure. + * context: The color context. + * + * @todo + */ #ifndef _di_iki_write_main_t_ typedef struct { f_console_parameters_t parameters; - f_array_lengths_t remaining; bool process_pipe; fl_print_t output; diff --git a/level_3/iki_write/c/iki_write.c b/level_3/iki_write/c/iki_write.c index fa14b47..68d7c8a 100644 --- a/level_3/iki_write/c/iki_write.c +++ b/level_3/iki_write/c/iki_write.c @@ -6,15 +6,6 @@ extern "C" { #endif -#ifndef _di_iki_write_program_version_ - const f_string_static_t iki_write_program_version_s = macro_f_string_static_t_initialize(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_initialize(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_initialize(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) { @@ -69,7 +60,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { iki_write_parameter_no_color_e, iki_write_parameter_light_e, iki_write_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; diff --git a/level_3/status_code/c/common.c b/level_3/status_code/c/common.c index 5389d22..20208f3 100644 --- a/level_3/status_code/c/common.c +++ b/level_3/status_code/c/common.c @@ -13,16 +13,26 @@ extern "C" { const f_string_static_t status_code_program_name_long_s = macro_f_string_static_t_initialize(STATUS_CODE_program_name_long_s, 0, STATUS_CODE_program_name_long_s_length); #endif // _di_status_code_program_name_ -#ifndef _di_status_code_main_delete_ - f_status_t status_code_main_delete(status_code_main_t * const main) { - - f_console_parameters_delete(&main->parameters); +#ifndef _di_status_code_program_help_parameters_ + const f_string_static_t status_code_program_help_parameters_s = macro_f_string_static_t_initialize(STATUS_CODE_program_help_parameters_s, 0, STATUS_CODE_program_help_parameters_s_length); +#endif // _di_status_code_program_help_parameters_ + +#ifndef _di_status_code_parameters_ + const f_string_static_t status_code_short_is_fine_s = macro_f_string_static_t_initialize(STATUS_CODE_short_is_fine_s, 0, STATUS_CODE_short_is_fine_s_length); + const f_string_static_t status_code_short_is_warning_s = macro_f_string_static_t_initialize(STATUS_CODE_short_is_warning_s, 0, STATUS_CODE_short_is_warning_s_length); + const f_string_static_t status_code_short_is_error_s = macro_f_string_static_t_initialize(STATUS_CODE_short_is_error_s, 0, STATUS_CODE_short_is_error_s_length); + const f_string_static_t status_code_short_number_s = macro_f_string_static_t_initialize(STATUS_CODE_short_number_s, 0, STATUS_CODE_short_number_s_length); + + const f_string_static_t status_code_long_is_fine_s = macro_f_string_static_t_initialize(STATUS_CODE_long_is_fine_s, 0, STATUS_CODE_long_is_fine_s_length); + const f_string_static_t status_code_long_is_warning_s = macro_f_string_static_t_initialize(STATUS_CODE_long_is_warning_s, 0, STATUS_CODE_long_is_warning_s_length); + const f_string_static_t status_code_long_is_error_s = macro_f_string_static_t_initialize(STATUS_CODE_long_is_error_s, 0, STATUS_CODE_long_is_error_s_length); + const f_string_static_t status_code_long_number_s = macro_f_string_static_t_initialize(STATUS_CODE_long_number_s, 0, STATUS_CODE_long_number_s_length); +#endif // _di_status_code_parameters_ - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); +#ifndef _di_status_code_main_delete_ + f_status_t status_code_main_delete(fll_program_data_t * const main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_status_code_main_delete_ diff --git a/level_3/status_code/c/common.h b/level_3/status_code/c/common.h index ba5bd97..fcfb967 100644 --- a/level_3/status_code/c/common.h +++ b/level_3/status_code/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -42,6 +45,9 @@ extern "C" { extern const f_string_static_t status_code_program_version_s; #endif // _di_status_code_program_version_ +/** + * The program name. + */ #ifndef _di_status_code_program_name_ #define STATUS_CODE_progam_name_s "status_code" #define STATUS_CODE_progam_name_long_s "FSS Status Code" @@ -53,18 +59,56 @@ extern "C" { extern const f_string_static_t status_code_program_name_long_s; #endif // _di_status_code_program_name_ +/** + * The program help related data. + */ +#ifndef _di_status_code_program_help_parameters_ + #define STATUS_CODE_program_help_parameters_s "status code(s)" + #define STATUS_CODE_program_help_parameters_s_length 14 + + extern const f_string_static_t status_code_program_help_parameters_s; +#endif // _di_status_code_program_help_parameters_ + +/** + * The program defines. + */ #ifndef _di_status_code_defines_ #define status_code_signal_check_d 10000 +#endif // _di_status_code_defines_ - #define status_code_short_is_fine_s "f" - #define status_code_short_is_warning_s "w" - #define status_code_short_is_error_s "e" - #define status_code_short_number_s "n" - - #define status_code_long_is_fine_s "is_fine" - #define status_code_long_is_warning_s "is_warning" - #define status_code_long_is_error_s "is_error" - #define status_code_long_number_s "number" +/** + * The main program parameters. + */ +#ifndef _di_status_code_parameters_ + #define STATUS_CODE_short_is_fine_s "f" + #define STATUS_CODE_short_is_warning_s "w" + #define STATUS_CODE_short_is_error_s "e" + #define STATUS_CODE_short_number_s "n" + + #define STATUS_CODE_long_is_fine_s "is_fine" + #define STATUS_CODE_long_is_warning_s "is_warning" + #define STATUS_CODE_long_is_error_s "is_error" + #define STATUS_CODE_long_number_s "number" + + #define STATUS_CODE_short_is_fine_s_length 1 + #define STATUS_CODE_short_is_warning_s_length 1 + #define STATUS_CODE_short_is_error_s_length 1 + #define STATUS_CODE_short_number_s_length 1 + + #define STATUS_CODE_long_is_fine_s_length 7 + #define STATUS_CODE_long_is_warning_s_length 10 + #define STATUS_CODE_long_is_error_s_length 8 + #define STATUS_CODE_long_number_s_length 6 + + extern const f_string_static_t status_code_short_is_fine_s; + extern const f_string_static_t status_code_short_is_warning_s; + extern const f_string_static_t status_code_short_is_error_s; + extern const f_string_static_t status_code_short_number_s; + + extern const f_string_static_t status_code_long_is_fine_s; + extern const f_string_static_t status_code_long_is_warning_s; + extern const f_string_static_t status_code_long_is_error_s; + extern const f_string_static_t status_code_long_number_s; enum { status_code_parameter_help_e, @@ -94,43 +138,14 @@ extern "C" { 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(status_code_short_is_fine_s, status_code_long_is_fine_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(status_code_short_is_warning_s, status_code_long_is_warning_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(status_code_short_is_error_s, status_code_long_is_error_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(status_code_short_number_s, status_code_long_number_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(status_code_short_is_fine_s.string, status_code_long_is_fine_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(status_code_short_is_warning_s.string, status_code_long_is_warning_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(status_code_short_is_error_s.string, status_code_long_is_error_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(status_code_short_number_s.string, status_code_long_number_s.string, 0, 0, f_console_type_normal_e), \ } #define status_code_total_parameters_d 13 -#endif // _di_status_code_defines_ - -#ifndef _di_status_code_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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; - } status_code_main_t; - - #define status_code_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_color_context_t_initialize, \ - } -#endif // _di_status_code_main_t_ +#endif // _di_status_code_parameters_ /** * Deallocate main. @@ -148,7 +163,7 @@ extern "C" { * @see status_code_main() */ #ifndef _di_status_code_main_delete_ - extern f_status_t status_code_main_delete(status_code_main_t * const main); + extern f_status_t status_code_main_delete(fll_program_data_t * const main); #endif // _di_status_code_main_delete_ #ifdef __cplusplus diff --git a/level_3/status_code/c/main.c b/level_3/status_code/c/main.c index ccb77ae..1d394a7 100644 --- a/level_3/status_code/c/main.c +++ b/level_3/status_code/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - status_code_main_t data = status_code_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/status_code/c/private-common.c b/level_3/status_code/c/private-common.c index b1cd010..6ce8b7a 100644 --- a/level_3/status_code/c/private-common.c +++ b/level_3/status_code/c/private-common.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_status_code_print_signal_received_ - void status_code_print_signal_received(status_code_main_t * const main, const f_status_t signal) { + void status_code_print_signal_received(fll_program_data_t * const main, const f_status_t signal) { if (main->warning.verbosity != f_console_verbosity_verbose_e) return; @@ -24,7 +24,7 @@ extern "C" { #endif // _di_status_code_print_signal_received_ #ifndef _di_status_code_signal_received_ - f_status_t status_code_signal_received(status_code_main_t * const main) { + f_status_t status_code_signal_received(fll_program_data_t * const main) { if (main->signal.id == -1) { return F_false; diff --git a/level_3/status_code/c/private-common.h b/level_3/status_code/c/private-common.h index 2e701e8..4b58f32 100644 --- a/level_3/status_code/c/private-common.h +++ b/level_3/status_code/c/private-common.h @@ -21,7 +21,7 @@ extern "C" { * The signal received. */ #ifndef _di_status_code_print_signal_received_ - extern void status_code_print_signal_received(status_code_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; + extern void status_code_print_signal_received(fll_program_data_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; #endif // _di_status_code_print_signal_received_ /** @@ -39,7 +39,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_status_code_signal_received_ - extern f_status_t status_code_signal_received(status_code_main_t * const main) F_attribute_visibility_internal_d; + extern f_status_t status_code_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; #endif // _di_status_code_signal_received_ #ifdef __cplusplus diff --git a/level_3/status_code/c/private-status_code.c b/level_3/status_code/c/private-status_code.c index 95dca9d..29fdfde 100644 --- a/level_3/status_code/c/private-status_code.c +++ b/level_3/status_code/c/private-status_code.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_status_code_process_check_ - f_status_t status_code_process_check(status_code_main_t * const main, const f_string_t value) { + f_status_t status_code_process_check(fll_program_data_t * const main, const f_string_t value) { f_number_unsigned_t number = 0; f_status_t status = status_code_convert_number(main, value, &number); @@ -52,7 +52,7 @@ extern "C" { #endif // _di_status_code_process_check_ #ifndef _di_status_code_process_number_ - f_status_t status_code_process_number(status_code_main_t * const main, const f_string_t value) { + f_status_t status_code_process_number(fll_program_data_t * const main, const f_string_t value) { f_status_t status = F_none; @@ -104,7 +104,7 @@ extern "C" { #endif // _di_status_code_process_number_ #ifndef _di_status_code_process_normal_ - f_status_t status_code_process_normal(status_code_main_t * const main, const f_string_t value) { + f_status_t status_code_process_normal(fll_program_data_t * const main, const f_string_t value) { f_number_unsigned_t number = 0; f_status_t status = status_code_convert_number(main, value, &number); @@ -136,7 +136,7 @@ extern "C" { #endif // _di_status_code_process_normal_ #ifndef _di_status_code_convert_number_ - f_status_t status_code_convert_number(status_code_main_t * const main, const f_string_t value, f_number_unsigned_t *number) { + f_status_t status_code_convert_number(fll_program_data_t * const main, const f_string_t value, f_number_unsigned_t *number) { const f_string_range_t range = macro_f_string_range_t_initialize(strlen(value)); diff --git a/level_3/status_code/c/private-status_code.h b/level_3/status_code/c/private-status_code.h index 3aa76f2..d2da737 100644 --- a/level_3/status_code/c/private-status_code.h +++ b/level_3/status_code/c/private-status_code.h @@ -34,7 +34,7 @@ extern "C" { * @see fss_status_code_convert_number() */ #ifndef _di_status_code_process_check_ - extern f_status_t status_code_process_check(status_code_main_t * const main, const f_string_t value) F_attribute_visibility_internal_d; + extern f_status_t status_code_process_check(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d; #endif // _di_status_code_process_check_ /** @@ -56,7 +56,7 @@ extern "C" { * @see fll_fss_status_string_from() */ #ifndef _di_status_code_process_number_ - extern f_status_t status_code_process_number(status_code_main_t * const main, const f_string_t value) F_attribute_visibility_internal_d; + extern f_status_t status_code_process_number(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d; #endif // _di_status_code_process_number_ /** @@ -83,7 +83,7 @@ extern "C" { * @see fss_status_code_convert_number() */ #ifndef _di_status_code_process_normal_ - extern f_status_t status_code_process_normal(status_code_main_t * const main, const f_string_t value) F_attribute_visibility_internal_d; + extern f_status_t status_code_process_normal(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d; #endif // _di_status_code_process_normal_ /** @@ -111,7 +111,7 @@ extern "C" { * @see fl_console_parameter_to_number_unsigned() */ #ifndef _di_status_code_convert_number_ - extern f_status_t status_code_convert_number(status_code_main_t * const main, const f_string_t value, f_number_unsigned_t *number) F_attribute_visibility_internal_d; + extern f_status_t status_code_convert_number(fll_program_data_t * const main, const f_string_t value, f_number_unsigned_t *number) F_attribute_visibility_internal_d; #endif // _di_status_code_convert_number_ #ifdef __cplusplus diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/status_code.c index 1ae1f9b..c96880f 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/status_code.c @@ -6,15 +6,6 @@ extern "C" { #endif -#ifndef _di_status_code_program_version_ - const f_string_static_t status_code_progam_version_s = macro_f_string_static_t_initialize(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_initialize(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_initialize(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) { @@ -39,7 +30,7 @@ extern "C" { 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)"); + fll_program_print_help_usage(file, context, status_code_progam_name_s, status_code_program_help_parameters_s); funlockfile(file.stream); @@ -48,7 +39,7 @@ extern "C" { #endif // _di_status_code_print_help_ #ifndef _di_status_code_main_ - f_status_t status_code_main(status_code_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t status_code_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -60,7 +51,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { status_code_parameter_no_color_e, status_code_parameter_light_e, status_code_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -192,7 +183,7 @@ extern "C" { return F_status_set_error(status); } - if (main->remaining.used == 0 && !main->process_pipe) { + if (main->parameters.remaining.used == 0 && !main->process_pipe) { fll_print_format("%[You failed to specify a status code.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); status_code_main_delete(main); @@ -207,12 +198,12 @@ extern "C" { // @todo call status_code_process_check() here for all main from pipe that is space separated. } - if (main->remaining.used > 0) { + if (main->parameters.remaining.used > 0) { uint16_t signal_check = 0; flockfile(main->output.to.stream); - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % status_code_signal_check_d)) { if (status_code_signal_received(main)) { @@ -223,7 +214,7 @@ extern "C" { signal_check = 0; } - status2 = status_code_process_check(main, arguments->argv[main->remaining.array[i]]); + status2 = status_code_process_check(main, arguments->argv[main->parameters.remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; @@ -238,12 +229,12 @@ extern "C" { // @todo call status_code_process_number() here for all main from pipe that is space separated. } - if (main->remaining.used > 0) { + if (main->parameters.remaining.used > 0) { uint16_t signal_check = 0; flockfile(main->output.to.stream); - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % status_code_signal_check_d)) { if (status_code_signal_received(main)) { @@ -254,7 +245,7 @@ extern "C" { signal_check = 0; } - status2 = status_code_process_number(main, arguments->argv[main->remaining.array[i]]); + status2 = status_code_process_number(main, arguments->argv[main->parameters.remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; @@ -269,12 +260,12 @@ extern "C" { // @todo call status_code_process_normal() here for all main from pipe that is space separated. } - if (main->remaining.used > 0) { + if (main->parameters.remaining.used > 0) { uint16_t signal_check = 0; flockfile(main->output.to.stream); - for (f_array_length_t i = 0; i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % status_code_signal_check_d)) { if (status_code_signal_received(main)) { @@ -285,7 +276,7 @@ extern "C" { signal_check = 0; } - status2 = status_code_process_normal(main, arguments->argv[main->remaining.array[i]]); + status2 = status_code_process_normal(main, arguments->argv[main->parameters.remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; diff --git a/level_3/status_code/c/status_code.h b/level_3/status_code/c/status_code.h index c091bb7..09623cb 100644 --- a/level_3/status_code/c/status_code.h +++ b/level_3/status_code/c/status_code.h @@ -90,7 +90,7 @@ extern "C" { * @see status_code_main_delete() */ #ifndef _di_status_code_main_ - extern f_status_t status_code_main(status_code_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t status_code_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_status_code_main_ #ifdef __cplusplus diff --git a/level_3/utf8/c/common.c b/level_3/utf8/c/common.c index 9071f8c..a02780d 100644 --- a/level_3/utf8/c/common.c +++ b/level_3/utf8/c/common.c @@ -13,16 +13,66 @@ extern "C" { const f_string_static_t utf8_program_name_long_s = macro_f_string_static_t_initialize(UTF8_program_name_long_s, 0, UTF8_program_name_long_s_length); #endif // _di_utf8_program_name_ -#ifndef _di_utf8_main_delete_ - f_status_t utf8_main_delete(utf8_main_t *main) { +#ifndef _di_utf8_program_help_parameters_ + const f_string_static_t utf8_program_help_parameters_s = macro_f_string_static_t_initialize(UTF8_program_help_parameters_s, 0, UTF8_program_help_parameters_s_length); +#endif // _di_utf8_program_help_parameters_ + +#ifndef _di_utf8_defines_ + const f_string_static_t utf8_string_combining_is_s = macro_f_string_static_t_initialize(UTF8_string_combining_is_s, 0, UTF8_string_combining_is_s_length); + const f_string_static_t utf8_string_combining_not_s = macro_f_string_static_t_initialize(UTF8_string_combining_not_s, 0, UTF8_string_combining_not_s_length); + const f_string_static_t utf8_string_unknown_s = macro_f_string_static_t_initialize(UTF8_string_unknown_s, 0, UTF8_string_unknown_s_length); + + const f_string_static_t utf8_string_from_s = macro_f_string_static_t_initialize(UTF8_string_from_s, 0, UTF8_string_from_s_length); + const f_string_static_t utf8_string_to_s = macro_f_string_static_t_initialize(UTF8_string_to_s, 0, UTF8_string_to_s_length); + + const f_string_static_t utf8_string_prepend_padding_s = macro_f_string_static_t_initialize(UTF8_string_prepend_padding_s, 0, UTF8_string_prepend_padding_s_length); + + const f_string_static_t utf8_string_valid_not_s = macro_f_string_static_t_initialize(UTF8_string_valid_not_s, 0, UTF8_string_valid_not_s_length); + + const f_string_static_t utf8_string_verified_valid_s = macro_f_string_static_t_initialize(UTF8_string_verified_valid_s, 0, UTF8_string_verified_valid_s_length); + const f_string_static_t utf8_string_verified_valid_not_s = macro_f_string_static_t_initialize(UTF8_string_verified_valid_not_s, 0, UTF8_string_verified_valid_not_s_length); - f_console_parameters_delete(&main->parameters); + const f_string_static_t utf8_string_width_0_s = macro_f_string_static_t_initialize(UTF8_string_width_0_s, 0, UTF8_string_width_0_s_length); + const f_string_static_t utf8_string_width_1_s = macro_f_string_static_t_initialize(UTF8_string_width_1_s, 0, UTF8_string_width_1_s_length); + const f_string_static_t utf8_string_width_2_s = macro_f_string_static_t_initialize(UTF8_string_width_2_s, 0, UTF8_string_width_2_s_length); +#endif // _di_utf8_defines_ - f_type_array_lengths_resize(0, &main->remaining); +#ifndef _di_utf8_parameters_ + const f_string_static_t utf8_short_from_binary_s = macro_f_string_static_t_initialize(UTF8_short_from_binary_s, 0, UTF8_short_from_binary_s_length); + const f_string_static_t utf8_short_from_codepoint_s = macro_f_string_static_t_initialize(UTF8_short_from_codepoint_s, 0, UTF8_short_from_codepoint_s_length); + const f_string_static_t utf8_short_from_file_s = macro_f_string_static_t_initialize(UTF8_short_from_file_s, 0, UTF8_short_from_file_s_length); - macro_f_color_context_t_delete_simple(main->context); + const f_string_static_t utf8_short_headers_s = macro_f_string_static_t_initialize(UTF8_short_headers_s, 0, UTF8_short_headers_s_length); + const f_string_static_t utf8_short_separate_s = macro_f_string_static_t_initialize(UTF8_short_separate_s, 0, UTF8_short_separate_s_length); + const f_string_static_t utf8_short_strip_invalid_s = macro_f_string_static_t_initialize(UTF8_short_strip_invalid_s, 0, UTF8_short_strip_invalid_s_length); + const f_string_static_t utf8_short_verify_s = macro_f_string_static_t_initialize(UTF8_short_verify_s, 0, UTF8_short_verify_s_length); + + const f_string_static_t utf8_short_to_binary_s = macro_f_string_static_t_initialize(UTF8_short_to_binary_s, 0, UTF8_short_to_binary_s_length); + const f_string_static_t utf8_short_to_codepoint_s = macro_f_string_static_t_initialize(UTF8_short_to_codepoint_s, 0, UTF8_short_to_codepoint_s_length); + const f_string_static_t utf8_short_to_combining_s = macro_f_string_static_t_initialize(UTF8_short_to_combining_s, 0, UTF8_short_to_combining_s_length); + const f_string_static_t utf8_short_to_file_s = macro_f_string_static_t_initialize(UTF8_short_to_file_s, 0, UTF8_short_to_file_s_length); + const f_string_static_t utf8_short_to_width_s = macro_f_string_static_t_initialize(UTF8_short_to_width_s, 0, UTF8_short_to_width_s_length); + + const f_string_static_t utf8_long_from_binary_s = macro_f_string_static_t_initialize(UTF8_long_from_binary_s, 0, UTF8_long_from_binary_s_length); + const f_string_static_t utf8_long_from_codepoint_s = macro_f_string_static_t_initialize(UTF8_long_from_codepoint_s, 0, UTF8_long_from_codepoint_s_length); + const f_string_static_t utf8_long_from_file_s = macro_f_string_static_t_initialize(UTF8_long_from_file_s, 0, UTF8_long_from_file_s_length); + + const f_string_static_t utf8_long_headers_s = macro_f_string_static_t_initialize(UTF8_long_headers_s, 0, UTF8_long_headers_s_length); + const f_string_static_t utf8_long_separate_s = macro_f_string_static_t_initialize(UTF8_long_separate_s, 0, UTF8_long_separate_s_length); + const f_string_static_t utf8_long_strip_invalid_s = macro_f_string_static_t_initialize(UTF8_long_strip_invalid_s, 0, UTF8_long_strip_invalid_s_length); + const f_string_static_t utf8_long_verify_s = macro_f_string_static_t_initialize(UTF8_long_verify_s, 0, UTF8_long_verify_s_length); + + const f_string_static_t utf8_long_to_binary_s = macro_f_string_static_t_initialize(UTF8_long_to_binary_s, 0, UTF8_long_to_binary_s_length); + const f_string_static_t utf8_long_to_codepoint_s = macro_f_string_static_t_initialize(UTF8_long_to_codepoint_s, 0, UTF8_long_to_codepoint_s_length); + const f_string_static_t utf8_long_to_combining_s = macro_f_string_static_t_initialize(UTF8_long_to_combining_s, 0, UTF8_long_to_combining_s_length); + const f_string_static_t utf8_long_to_file_s = macro_f_string_static_t_initialize(UTF8_long_to_file_s, 0, UTF8_long_to_file_s_length); + const f_string_static_t utf8_long_to_width_s = macro_f_string_static_t_initialize(UTF8_long_to_width_s, 0, UTF8_long_to_width_s_length); +#endif // _di_utf8_parameters_ + +#ifndef _di_utf8_main_delete_ + f_status_t utf8_main_delete(fll_program_data_t *main) { - return F_none; + return fll_program_data_delete(main); } #endif // _di_utf8_main_delete_ diff --git a/level_3/utf8/c/common.h b/level_3/utf8/c/common.h index 934eb40..9e4fd32 100644 --- a/level_3/utf8/c/common.h +++ b/level_3/utf8/c/common.h @@ -16,6 +16,9 @@ extern "C" { #endif +/** + * The program version. + */ #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 @@ -39,9 +42,12 @@ extern "C" { #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; + extern const f_string_static_t utf8_program_version_s; #endif // _di_utf8_program_version_ +/** + * The program name. + */ #ifndef _di_utf8_program_name_ #define UTF8_program_name_s "utf8" #define UTF8_program_name_long_s "UTF-8" @@ -54,74 +60,176 @@ extern "C" { #endif // _di_utf8_program_name_ /** + * The program help related data. + */ +#ifndef _di_utf8_program_help_parameters_ + #define UTF8_program_help_parameters_s "character(s)" + #define UTF8_program_help_parameters_s_length 12 + + extern const f_string_static_t utf8_program_help_parameters_s; +#endif // _di_utf8_program_help_parameters_ + +/** * Set to at least 4 to provide a UTF-8 friendly allocation step. */ #ifndef _di_utf8_default_allocation_step_ #define utf8_default_allocation_step_d 16 #endif // _di_utf8_default_allocation_step_ +/** + * The program defines. + */ #ifndef _di_utf8_defines_ #define utf8_signal_check_d 10000 - #define utf8_string_from_s "from" - #define utf8_string_to_s "to" + #define UTF8_string_combining_is_s "C" + #define UTF8_string_combining_not_s "N" + #define UTF8_string_unknown_s "?" + + #define UTF8_string_from_s "from" + #define UTF8_string_to_s "to" + + #define UTF8_string_prepend_padding_s " " - #define utf8_string_verified_valid_s "Verified Valid" - #define utf8_string_verified_valid_not_s "Verified Invalid" + #define UTF8_string_valid_not_s "�" - #define utf8_string_combining_is_s "C" - #define utf8_string_combining_not_s "N" - #define utf8_string_unknown_s "?" + #define UTF8_string_verified_valid_s "Verified Valid" + #define UTF8_string_verified_valid_not_s "Verified Invalid" - #define utf8_string_width_0_s "0" - #define utf8_string_width_1_s "1" - #define utf8_string_width_2_s "2" + #define UTF8_string_width_0_s "0" + #define UTF8_string_width_1_s "1" + #define UTF8_string_width_2_s "2" - #define utf8_string_from_s_length 4 - #define utf8_string_to_s_length 2 + #define UTF8_string_combining_is_s_length 1 + #define UTF8_string_combining_not_s_length 1 + #define UTF8_string_unknown_s_length 1 - #define utf8_string_verified_valid_s_length 14 - #define utf8_string_verified_valid_not_s_length 16 + #define UTF8_string_from_s_length 4 + #define UTF8_string_to_s_length 2 - #define utf8_string_combining_is_s_length 1 - #define utf8_string_combining_not_s_length 1 - #define utf8_string_unknown_s_length 1 + #define UTF8_string_prepend_padding_s_length 2 - #define utf8_string_width_0_s_length 1 - #define utf8_string_width_1_s_length 1 - #define utf8_string_width_2_s_length 1 + #define UTF8_string_valid_not_s_length 3 - #define utf8_character_valid_not_s "�" + #define UTF8_string_verified_valid_s_length 14 + #define UTF8_string_verified_valid_not_s_length 16 - #define utf8_short_from_binary_s "b" - #define utf8_short_from_codepoint_s "c" - #define utf8_short_from_file_s "f" + #define UTF8_string_width_0_s_length 1 + #define UTF8_string_width_1_s_length 1 + #define UTF8_string_width_2_s_length 1 - #define utf8_short_headers_s "H" - #define utf8_short_separate_s "S" - #define utf8_short_strip_invalid_s "s" - #define utf8_short_verify_s "v" + extern const f_string_static_t utf8_string_combining_is_s; + extern const f_string_static_t utf8_string_combining_not_s; + extern const f_string_static_t utf8_string_unknown_s; - #define utf8_short_to_binary_s "B" - #define utf8_short_to_codepoint_s "C" - #define utf8_short_to_combining_s "O" - #define utf8_short_to_file_s "F" - #define utf8_short_to_width_s "W" + extern const f_string_static_t utf8_string_from_s; + extern const f_string_static_t utf8_string_to_s; - #define utf8_long_from_binary_s "from_binary" - #define utf8_long_from_codepoint_s "from_codepoint" - #define utf8_long_from_file_s "from_file" + extern const f_string_static_t utf8_string_prepend_padding_s; - #define utf8_long_headers_s "headers" - #define utf8_long_separate_s "separate" - #define utf8_long_strip_invalid_s "strip_invalid" - #define utf8_long_verify_s "verify" + extern const f_string_static_t utf8_string_verified_valid_s; + extern const f_string_static_t utf8_string_verified_valid_not_s; - #define utf8_long_to_binary_s "to_binary" - #define utf8_long_to_codepoint_s "to_codepoint" - #define utf8_long_to_combining_s "to_combining" - #define utf8_long_to_file_s "to_file" - #define utf8_long_to_width_s "to_width" + extern const f_string_static_t utf8_string_width_0_s; + extern const f_string_static_t utf8_string_width_1_s; + extern const f_string_static_t utf8_string_width_2_s; + + extern const f_string_static_t utf8_string_valid_not_s; +#endif // _di_utf8_defines_ + +/** + * The main program parameters. + */ +#ifndef _di_utf8_parameters_ + #define UTF8_short_from_binary_s "b" + #define UTF8_short_from_codepoint_s "c" + #define UTF8_short_from_file_s "f" + + #define UTF8_short_headers_s "H" + #define UTF8_short_separate_s "S" + #define UTF8_short_strip_invalid_s "s" + #define UTF8_short_verify_s "v" + + #define UTF8_short_to_binary_s "B" + #define UTF8_short_to_codepoint_s "C" + #define UTF8_short_to_combining_s "O" + #define UTF8_short_to_file_s "F" + #define UTF8_short_to_width_s "W" + + #define UTF8_long_from_binary_s "from_binary" + #define UTF8_long_from_codepoint_s "from_codepoint" + #define UTF8_long_from_file_s "from_file" + + #define UTF8_long_headers_s "headers" + #define UTF8_long_separate_s "separate" + #define UTF8_long_strip_invalid_s "strip_invalid" + #define UTF8_long_verify_s "verify" + + #define UTF8_long_to_binary_s "to_binary" + #define UTF8_long_to_codepoint_s "to_codepoint" + #define UTF8_long_to_combining_s "to_combining" + #define UTF8_long_to_file_s "to_file" + #define UTF8_long_to_width_s "to_width" + + #define UTF8_short_from_binary_s_length 1 + #define UTF8_short_from_codepoint_s_length 1 + #define UTF8_short_from_file_s_length 1 + + #define UTF8_short_headers_s_length 1 + #define UTF8_short_separate_s_length 1 + #define UTF8_short_strip_invalid_s_length 1 + #define UTF8_short_verify_s_length 1 + + #define UTF8_short_to_binary_s_length 1 + #define UTF8_short_to_codepoint_s_length 1 + #define UTF8_short_to_combining_s_length 1 + #define UTF8_short_to_file_s_length 1 + #define UTF8_short_to_width_s_length 1 + + #define UTF8_long_from_binary_s_length 11 + #define UTF8_long_from_codepoint_s_length 14 + #define UTF8_long_from_file_s_length 9 + + #define UTF8_long_headers_s_length 7 + #define UTF8_long_separate_s_length 8 + #define UTF8_long_strip_invalid_s_length 13 + #define UTF8_long_verify_s_length 6 + + #define UTF8_long_to_binary_s_length 9 + #define UTF8_long_to_codepoint_s_length 12 + #define UTF8_long_to_combining_s_length 12 + #define UTF8_long_to_file_s_length 7 + #define UTF8_long_to_width_s_length 8 + + extern const f_string_static_t utf8_short_from_binary_s; + extern const f_string_static_t utf8_short_from_codepoint_s; + extern const f_string_static_t utf8_short_from_file_s; + + extern const f_string_static_t utf8_short_headers_s; + extern const f_string_static_t utf8_short_separate_s; + extern const f_string_static_t utf8_short_strip_invalid_s; + extern const f_string_static_t utf8_short_verify_s; + + extern const f_string_static_t utf8_short_to_binary_s; + extern const f_string_static_t utf8_short_to_codepoint_s; + extern const f_string_static_t utf8_short_to_combining_s; + extern const f_string_static_t utf8_short_to_file_s; + extern const f_string_static_t utf8_short_to_width_s; + + extern const f_string_static_t utf8_long_from_binary_s; + extern const f_string_static_t utf8_long_from_codepoint_s; + extern const f_string_static_t utf8_long_from_file_s; + + extern const f_string_static_t utf8_long_headers_s; + extern const f_string_static_t utf8_long_separate_s; + extern const f_string_static_t utf8_long_strip_invalid_s; + extern const f_string_static_t utf8_long_verify_s; + + extern const f_string_static_t utf8_long_to_binary_s; + extern const f_string_static_t utf8_long_to_codepoint_s; + extern const f_string_static_t utf8_long_to_combining_s; + extern const f_string_static_t utf8_long_to_file_s; + extern const f_string_static_t utf8_long_to_width_s; enum { utf8_parameter_help_e, @@ -162,22 +270,22 @@ extern "C" { 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(utf8_short_from_binary_s, utf8_long_from_binary_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(utf8_short_from_file_s, utf8_long_from_file_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(utf8_short_headers_s, utf8_long_headers_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(utf8_short_separate_s, utf8_long_headers_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(utf8_short_to_binary_s, utf8_long_to_binary_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(utf8_short_to_combining_s, utf8_long_to_combining_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(utf8_short_to_file_s, utf8_long_to_file_s, 0, 1, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(utf8_short_to_width_s, utf8_long_to_width_s, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(utf8_short_verify_s, utf8_long_verify_s, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_from_binary_s.string, utf8_long_from_binary_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_from_codepoint_s.string, utf8_long_from_codepoint_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_from_file_s.string, utf8_long_from_file_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_headers_s.string, utf8_long_headers_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_separate_s.string, utf8_long_headers_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_strip_invalid_s.string, utf8_long_strip_invalid_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_to_binary_s.string, utf8_long_to_binary_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_to_codepoint_s.string, utf8_long_to_codepoint_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_to_combining_s.string, utf8_long_to_combining_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_to_file_s.string, utf8_long_to_file_s.string, 0, 1, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_to_width_s.string, utf8_long_to_width_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(utf8_short_verify_s.string, utf8_long_verify_s.string, 0, 0, f_console_type_normal_e), \ } #define utf8_total_parameters_d 21 -#endif // _di_utf8_defines_ +#endif // _di_utf8_parameters_ /** * Modes used to designate how to the input and output are to be processed. @@ -202,47 +310,6 @@ extern "C" { #endif // _di_utf8_modes_ /** - * The main program data. - * - * parameters: The state of pre-defined parameters passed to the program. - * remaining: The remaining, non-pre-defined parameters, passed to the program. - * process_pipe: Designate whether or not to process the input pipe. - * output: The output file for general printing. - * error: The output file for error printing. - * warning: The output file for warning printing. - * signal: The process signal management structure. - * context: The color context. - */ -#ifndef _di_utf8_main_t_ - typedef struct { - f_console_parameters_t parameters; - - 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; - } utf8_main_t; - - #define utf8_main_t_initialize \ - { \ - f_console_parameters_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, \ - f_color_context_t_initialize, \ - } -#endif // _di_utf8_main_t_ - -/** * Deallocate main. * * Be sure to call this after executing utf8_main(). @@ -258,7 +325,7 @@ extern "C" { * @see utf8_main() */ #ifndef _di_utf8_main_delete_ - extern f_status_t utf8_main_delete(utf8_main_t *main); + extern f_status_t utf8_main_delete(fll_program_data_t *main); #endif // _di_utf8_main_delete_ #ifdef __cplusplus diff --git a/level_3/utf8/c/main.c b/level_3/utf8/c/main.c index 8a08863..a424fe8 100644 --- a/level_3/utf8/c/main.c +++ b/level_3/utf8/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - utf8_main_t data = utf8_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/utf8/c/private-common.h b/level_3/utf8/c/private-common.h index 5ed8e94..ee6b9bb 100644 --- a/level_3/utf8/c/private-common.h +++ b/level_3/utf8/c/private-common.h @@ -38,20 +38,19 @@ extern "C" { * The program data. * * main: The main program data. - * argv: The argument structure in utf8_main_t.parameters for simplifying syntax. + * argv: The argument structure in fll_program_data_t.parameters for simplifying syntax. * file: The output file for writing the processed data to (may potentially default to "output"). * mode: The input/output mode (see utf8_modes). * valid: Designate the output context set for valid characters. * valid_not: Designate the output context set for invalid characters. * append: A string to append. A value of NULL results in not appending. * prepend: A string to prepend. A value of NULL results in not prepending. - * file_name: The name of the file being output to for processed data (is empty if defaulting to "output"). * buffer: A buffer to use for printing output (generally for storing a block of input from an input file). * text: A buffer for storing a series of characters for processing (generally for codepoint processing). */ #ifndef _di_utf8_data_t_ typedef struct { - utf8_main_t *main; + fll_program_data_t *main; f_string_static_t *argv; f_file_t file; @@ -60,10 +59,9 @@ extern "C" { f_color_set_t valid; f_color_set_t valid_not; - f_string_t append; - f_string_t prepend; + f_string_static_t append; + f_string_static_t prepend; - f_string_static_t file_name; f_string_dynamic_t buffer; f_string_dynamic_t text; } utf8_data_t; @@ -76,8 +74,7 @@ extern "C" { utf8_mode_from_binary_d | utf8_mode_to_codepoint_d, \ f_color_set_t_initialize, \ f_color_set_t_initialize, \ - f_string_t_initialize, \ - f_string_t_initialize, \ + f_string_static_t_initialize, \ f_string_static_t_initialize, \ f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ diff --git a/level_3/utf8/c/private-print.c b/level_3/utf8/c/private-print.c index 089f99c..3b88459 100644 --- a/level_3/utf8/c/private-print.c +++ b/level_3/utf8/c/private-print.c @@ -9,7 +9,7 @@ extern "C" { #ifndef _di_utf8_print_binary_ void utf8_print_binary(utf8_data_t * const data, const f_string_static_t character) { - fl_print_format("%s%r%s", data->file.stream, data->prepend, character, data->append); + fl_print_format("%r%r%r", data->file.stream, data->prepend, character, data->append); } #endif // _di_utf8_print_binary_ @@ -25,19 +25,19 @@ extern "C" { utf8_print_combining_or_width(data, character); } else if (data->mode & utf8_mode_to_binary_d) { - fl_print_format("%s%[%r%]%s", data->file.stream, data->prepend, data->valid_not, character, data->valid_not, data->append); + fl_print_format("%r%[%r%]%r", data->file.stream, data->prepend, data->valid_not, character, data->valid_not, data->append); } else if (data->mode & utf8_mode_from_codepoint_d) { - fl_print_format("%s%[%Q%]%s", data->file.stream, data->prepend, data->valid_not, character, data->valid_not, data->append); + fl_print_format("%r%[%Q%]%r", data->file.stream, data->prepend, data->valid_not, character, data->valid_not, data->append); } else { - fl_print_format("%s%[0x", data->file.stream, data->prepend, data->valid_not); + fl_print_format("%r%[0x", data->file.stream, data->prepend, data->valid_not); for (uint8_t i = 0; i < character.used; ++i) { fl_print_format("%02_uii", data->file.stream, (uint8_t) character.string[i]); } // for - fl_print_format("%]%s", data->file.stream, data->valid_not, data->append); + fl_print_format("%]%r", data->file.stream, data->valid_not, data->append); } } #endif // _di_utf8_print_character_invalid_ @@ -46,13 +46,13 @@ extern "C" { void utf8_print_codepoint(utf8_data_t * const data, const uint32_t codepoint) { if (codepoint < 0xffff) { - fl_print_format("%sU+%04_U%s", data->file.stream, data->prepend, codepoint, data->append); + fl_print_format("%rU+%04_U%r", data->file.stream, data->prepend, codepoint, data->append); } else if (codepoint < 0x100000) { - fl_print_format("%sU+%05_U%s", data->file.stream, data->prepend, codepoint, data->append); + fl_print_format("%rU+%05_U%r", data->file.stream, data->prepend, codepoint, data->append); } else { - fl_print_format("%sU+%06_U%s", data->file.stream, data->prepend, codepoint, data->append); + fl_print_format("%rU+%06_U%r", data->file.stream, data->prepend, codepoint, data->append); } } #endif // _di_utf8_print_codepoint_ @@ -66,23 +66,23 @@ extern "C" { status = f_utf_is_combining(character.string, character.used); if (status == F_true) { - fl_print_format("%s%s%s", data->file.stream, data->prepend, utf8_string_combining_is_s, data->append); + fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_combining_is_s, data->append); } else if (status == F_false) { status = f_utf_is_private(character.string, character.used); if (status == F_true) { - fl_print_format("%s%s%s", data->file.stream, data->prepend, utf8_string_unknown_s, data->append); + fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_unknown_s, data->append); } else if (data->mode & utf8_mode_to_width_d) { utf8_print_width(data, character); } else { - fl_print_format("%s%s%s", data->file.stream, data->prepend, utf8_string_combining_not_s, data->append); + fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_combining_not_s, data->append); } } else if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_none_e && data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_none_e) { - fl_print_format("%s%[%s%]%s", data->file.stream, data->prepend, data->valid_not, utf8_string_unknown_s, data->valid_not, data->append); + fl_print_format("%r%[%r%]%r", data->file.stream, data->prepend, data->valid_not, utf8_string_unknown_s, data->valid_not, data->append); } } else if (data->mode & utf8_mode_to_width_d) { @@ -189,7 +189,7 @@ extern "C" { flockfile(data->main->error.to.stream); - fl_print_format("%r%[%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("%r%[%QFailed to find the %r 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%]", data->main->error.to.stream, data->main->context.set.notable, name, data->main->context.set.notable); fl_print_format("%['.%]%r", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s); @@ -207,7 +207,7 @@ extern "C" { #endif // _di_utf8_print_error_parameter_file_to_too_many_ #ifndef _di_utf8_print_section_header_file_ - void utf8_print_section_header_file(utf8_data_t * const data, const f_string_t name) { + void utf8_print_section_header_file(utf8_data_t * const data, const f_string_static_t name) { if (data->main->parameters.array[utf8_parameter_headers_e].result == f_console_result_none_e) return; if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return; @@ -217,10 +217,10 @@ extern "C" { fl_print_format("%r%[File%] ", data->main->output.to.stream, f_string_eol_s, data->main->output.set->title, data->main->output.set->title); if (data->file.stream == data->main->output.to.stream) { - fl_print_format("%[%S%]:%r", data->main->output.to.stream, data->main->output.set->notable, name, data->main->output.set->notable, f_string_eol_s); + fl_print_format("%[%Q%]:%r", data->main->output.to.stream, data->main->output.set->notable, name, data->main->output.set->notable, f_string_eol_s); } else { - fl_print_format("%[%S%]: %S.%r", data->main->output.to.stream, data->main->output.set->notable, name, data->main->output.set->notable, data->file_name, f_string_eol_s); + fl_print_format("%[%Q%]: %Q.%r", data->main->output.to.stream, data->main->output.set->notable, name, data->main->output.set->notable, data->argv[data->main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_string_eol_s); } funlockfile(data->main->output.to.stream); @@ -276,7 +276,7 @@ extern "C" { f_status_t status = f_utf_is_wide(character.string, character.used); if (status == F_true) { - fl_print_format("%s%s%s", data->file.stream, data->prepend, utf8_string_width_2_s, data->append); + fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_width_2_s, data->append); return; } @@ -285,20 +285,20 @@ extern "C" { status = f_utf_is_graph(character.string, character.used); if (status == F_true) { - fl_print_format("%s%s%s", data->file.stream, data->prepend, utf8_string_width_1_s, data->append); + fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_width_1_s, data->append); return; } if (status == F_false) { - fl_print_format("%s%s%s", data->file.stream, data->prepend, utf8_string_width_0_s, data->append); + fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_width_0_s, data->append); return; } } if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_none_e && data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_none_e) { - fl_print_format("%s%[%s%]%s", data->file.stream, data->prepend, data->valid_not, utf8_string_unknown_s, data->valid_not, data->append); + fl_print_format("%r%[%r%]%r", data->file.stream, data->prepend, data->valid_not, utf8_string_unknown_s, data->valid_not, data->append); } } #endif // _di_utf8_print_width_ diff --git a/level_3/utf8/c/private-print.h b/level_3/utf8/c/private-print.h index d45df80..a4033a7 100644 --- a/level_3/utf8/c/private-print.h +++ b/level_3/utf8/c/private-print.h @@ -160,7 +160,7 @@ extern "C" { * The name of the file. */ #ifndef _di_utf8_print_section_header_file_ - extern void utf8_print_section_header_file(utf8_data_t * const data, const f_string_t name) F_attribute_visibility_internal_d; + extern void utf8_print_section_header_file(utf8_data_t * const data, const f_string_static_t name) F_attribute_visibility_internal_d; #endif // _di_utf8_print_section_header_file_ /** diff --git a/level_3/utf8/c/private-utf8.c b/level_3/utf8/c/private-utf8.c index d99723e..6d700ac 100644 --- a/level_3/utf8/c/private-utf8.c +++ b/level_3/utf8/c/private-utf8.c @@ -22,9 +22,9 @@ extern "C" { #endif // _di_utf8_data_delete_ #ifndef _di_utf8_process_text_ - f_status_t utf8_process_text(utf8_data_t * const data, const f_string_t text) { + f_status_t utf8_process_text(utf8_data_t * const data, f_string_static_t text) { - if (!text) { + if (!text.used) { return F_true; } @@ -32,19 +32,18 @@ extern "C" { bool valid = F_true; uint8_t mode_codepoint = utf8_codepoint_mode_ready_e; - f_string_static_t current = macro_f_string_static_t_initialize2(text, 0); - - utf8_process_text_width(¤t); + utf8_process_text_width(&text); flockfile(data->file.stream); - for (uint16_t signal_check = 0; current.string[0] && F_status_is_error_not(status); ) { + for (uint16_t signal_check = 0; text.string[0] && F_status_is_error_not(status); ) { if (!((++signal_check) % utf8_signal_check_d)) { if (utf8_signal_received(data)) { utf8_print_signal_received(data, status); status = F_status_set_error(F_signal); + break; } } @@ -52,10 +51,10 @@ extern "C" { status = F_none; if (data->mode & utf8_mode_from_binary_d) { - status = utf8_convert_binary(data, current); + status = utf8_convert_binary(data, text); } else { - status = utf8_detect_codepoint(data, current, &mode_codepoint); + status = utf8_detect_codepoint(data, text, &mode_codepoint); if (F_status_is_error(status)) { fll_error_print(data->main->error, F_status_set_fine(status), "utf8_detect_codepoint", F_true); @@ -64,7 +63,7 @@ extern "C" { } if (F_status_is_fine(status) && status != F_next) { - status = utf8_convert_codepoint(data, current, &mode_codepoint); + status = utf8_convert_codepoint(data, text, &mode_codepoint); } } @@ -72,8 +71,8 @@ extern "C" { valid = F_false; } - current.string += current.used; - utf8_process_text_width(¤t); + text.string += text.used; + utf8_process_text_width(&text); } // for if (F_status_is_error_not(status) && !(data->mode & utf8_mode_from_binary_d)) { @@ -86,9 +85,9 @@ extern "C" { valid = F_false; } - current.used = 0; + text.used = 0; - status = utf8_convert_codepoint(data, current, &mode_codepoint); + status = utf8_convert_codepoint(data, text, &mode_codepoint); } } diff --git a/level_3/utf8/c/private-utf8.h b/level_3/utf8/c/private-utf8.h index 618abda..f95bf03 100644 --- a/level_3/utf8/c/private-utf8.h +++ b/level_3/utf8/c/private-utf8.h @@ -49,7 +49,7 @@ extern "C" { * @see utf8_signal_received() */ #ifndef _di_utf8_process_text_ - extern f_status_t utf8_process_text(utf8_data_t * const data, const f_string_t text) F_attribute_visibility_internal_d; + extern f_status_t utf8_process_text(utf8_data_t * const data, f_string_static_t text) F_attribute_visibility_internal_d; #endif // _di_utf8_process_text_ /** diff --git a/level_3/utf8/c/utf8.c b/level_3/utf8/c/utf8.c index 5f27334..e4f7650 100644 --- a/level_3/utf8/c/utf8.c +++ b/level_3/utf8/c/utf8.c @@ -9,21 +9,12 @@ extern "C" { #endif -#ifndef _di_utf8_program_version_ - const f_string_static_t utf8_program_version_s = macro_f_string_static_t_initialize(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_initialize(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_initialize(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) { flockfile(file.stream); - fll_program_print_help_header(file, context, utf8_program_name_long_s, utf8_version_s); + fll_program_print_help_header(file, context, utf8_program_name_long_s, utf8_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."); @@ -56,17 +47,17 @@ extern "C" { 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)"); + fll_program_print_help_usage(file, context, utf8_program_name_s, utf8_program_help_parameters_s); fl_print_format(" The default behavior is to assume the expected input is binary from the command line to be output to the screen as codepoints.%r%r", file.stream, f_string_eol_s, f_string_eol_s); fl_print_format(" Multiple input sources are allowed but only a single output destination is allowed.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When using the parameter '%[%r%s%]', no data is printed and 0 is returned if valid or 1 is returned if invalid.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_verify_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When using the parameter '%[%r%r%]', no data is printed and 0 is returned if valid or 1 is returned if invalid.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_verify_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" When using the parameter '%[%r%s%]' with the parameter ", file.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_to_combining_s, context.set.notable); - fl_print_format("'%[%r%s%]', the ", file.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_to_width_s, context.set.notable); - fl_print_format("'%[%s%]' character is printed to represent the combining and the digits are used to represent widths.%r", file.stream, context.set.notable, utf8_string_combining_is_s, context.set.notable, f_string_eol_s); + fl_print_format(" When using the parameter '%[%r%r%]' with the parameter ", file.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_to_combining_s, context.set.notable); + fl_print_format("'%[%r%r%]', the ", file.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_to_width_s, context.set.notable); + fl_print_format("'%[%r%]' character is printed to represent the combining and the digits are used to represent widths.%r", file.stream, context.set.notable, utf8_string_combining_is_s, context.set.notable, f_string_eol_s); fl_print_format(" The combining characters should be considered 1-width by themselves or 0-width when combined.%r%r", file.stream, f_string_eol_s, f_string_eol_s); funlockfile(file.stream); @@ -76,7 +67,7 @@ extern "C" { #endif // _di_utf8_print_help_ #ifndef _di_utf8_main_ - f_status_t utf8_main(utf8_main_t * const main, const f_console_arguments_t *arguments) { + f_status_t utf8_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) { f_status_t status = F_none; @@ -92,7 +83,7 @@ extern "C" { f_console_parameter_id_t ids[3] = { utf8_parameter_no_color_e, utf8_parameter_light_e, utf8_parameter_dark_e }; const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->remaining, &main->context); + status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context); main->output.set = &main->context.set; main->error.set = &main->context.set; @@ -290,7 +281,7 @@ extern "C" { } if (main->parameters.array[utf8_parameter_version_e].result == f_console_result_found_e) { - fll_program_print_version(main->output.to, utf8_version_s); + fll_program_print_version(main->output.to, utf8_program_version_s); utf8_data_delete(&data); utf8_main_delete(main); @@ -307,7 +298,7 @@ extern "C" { index = main->parameters.array[utf8_parameter_from_file_e].values.array[i]; - if (arguments->argv[index][0]) { + if (!data.argv[index].used) { if (!f_file_exists(data.argv[index])) { utf8_print_error_parameter_file_not_found(&data, F_true, data.argv[index]); @@ -342,14 +333,11 @@ extern "C" { status = F_status_set_error(F_parameter); } else { - data.file_name.string = arguments->argv[main->parameters.array[utf8_parameter_to_file_e].values.array[0]]; - data.file_name.used = strnlen(data.file_name.string, PATH_MAX); - - if (data.file_name.used) { - status = f_file_stream_open(data.file_name.string, "a", &data.file); + if (data.argv[main->parameters.array[utf8_parameter_to_file_e].values.array[0]].used) { + status = f_file_stream_open(data.argv[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &data.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.file_name.string, f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, data.argv[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e); } } else { @@ -370,7 +358,7 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_none_e && !(main->process_pipe || main->remaining.used)) { + if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_none_e && !(main->process_pipe || main->parameters.remaining.used)) { utf8_print_error_no_from(&data); status = F_status_set_error(F_parameter); @@ -378,7 +366,7 @@ extern "C" { if (!(data.mode & utf8_mode_to_binary_d)) { if (main->parameters.array[utf8_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[utf8_parameter_headers_e].result == f_console_result_found_e) { - data.prepend = " "; + data.prepend = utf8_string_prepend_padding_s; data.append = f_string_eol_s; } else { @@ -408,7 +396,7 @@ extern "C" { } if (F_status_is_error(status) && F_status_set_fine(status) != F_utf_fragment) { - fll_error_file_print(main->error, F_status_set_fine(status), data.mode & utf8_mode_from_binary_d ? "utf8_process_file_binary" : "utf8_process_file_codepoint", F_true, 0, f_file_operation_process_s, fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), data.mode & utf8_mode_from_binary_d ? "utf8_process_file_binary" : "utf8_process_file_codepoint", F_true, f_string_empty_s, f_file_operation_process_s, fll_error_file_type_pipe_e); } } @@ -431,12 +419,12 @@ extern "C" { index = main->parameters.array[utf8_parameter_from_file_e].values.array[i]; - utf8_print_section_header_file(&data, arguments->argv[index]); + utf8_print_section_header_file(&data, data.argv[index]); - status = f_file_stream_open(arguments->argv[index], 0, &file); + status = f_file_stream_open(data.argv[index], f_string_empty_s, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[index], f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, data.argv[index], f_file_operation_open_s, fll_error_file_type_file_e); break; } @@ -457,33 +445,31 @@ extern "C" { } if (F_status_is_error(status) && F_status_set_fine(status) != F_utf_fragment) { - fll_error_file_print(main->error, F_status_set_fine(status), data.mode & utf8_mode_from_binary_d ? "utf8_process_file_binary" : "utf8_process_file_codepoint", F_true, arguments->argv[index], f_file_operation_process_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), data.mode & utf8_mode_from_binary_d ? "utf8_process_file_binary" : "utf8_process_file_codepoint", F_true, data.argv[index], f_file_operation_process_s, fll_error_file_type_file_e); break; } } // for } - if (F_status_is_error_not(status) && status != F_signal && main->remaining.used) { - f_array_length_t i = 0; - f_array_length_t index = 0; + if (F_status_is_error_not(status) && status != F_signal && main->parameters.remaining.used) { + uint16_t signal_check = 0; - for (uint16_t signal_check = 0; F_status_is_error_not(status) && i < main->remaining.used; ++i) { + for (f_array_length_t i = 0; F_status_is_error_not(status) && i < main->parameters.remaining.used; ++i) { if (!((++signal_check) % utf8_signal_check_d)) { if (utf8_signal_received(&data)) { status = F_status_set_error(F_signal); + break; } signal_check = 0; } - index = main->remaining.array[i]; - - utf8_print_section_header_parameter(&data, index); + utf8_print_section_header_parameter(&data, main->parameters.remaining.array[i]); - status = utf8_process_text(&data, arguments->argv[index]); + status = utf8_process_text(&data, data.argv[main->parameters.remaining.array[i]]); if (main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) { if (status == F_false) { diff --git a/level_3/utf8/c/utf8.h b/level_3/utf8/c/utf8.h index aa1f211..df6a933 100644 --- a/level_3/utf8/c/utf8.h +++ b/level_3/utf8/c/utf8.h @@ -106,7 +106,7 @@ extern "C" { * @see utf8_main_delete() */ #ifndef _di_utf8_main_ - extern f_status_t utf8_main(utf8_main_t * const main, const f_console_arguments_t *arguments); + extern f_status_t utf8_main(fll_program_data_t * const main, const f_console_arguments_t *arguments); #endif // _di_utf8_main_ #ifdef __cplusplus -- 1.8.3.1