From 8ce0d4c821625d630ef14098107359a634acc78f Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 3 Feb 2022 23:02:58 -0600 Subject: [PATCH] Progress: Continue mass converting to f_string_static_t. Additional cleanups and improvements performed as noticed. --- level_0/f_console/c/console-common.h | 2 +- level_0/f_console/data/build/settings-tests | 2 +- .../c/test-console-parameter_prioritize_left.c | 14 +- .../c/test-console-parameter_prioritize_right.c | 14 +- .../tests/c/test-console-parameter_process.c | 10 +- .../tests/c/test-console-parameters_delete.c | 66 +++ .../tests/c/test-console-parameters_delete.h | 29 ++ .../tests/c/test-console-parameters_destroy.c | 66 +++ .../tests/c/test-console-parameters_destroy.h | 29 ++ level_0/f_console/tests/c/test-console.c | 6 + level_0/f_console/tests/c/test-console.h | 2 + level_0/f_control_group/c/control_group.h | 2 +- level_0/f_string/c/private-string.c | 18 +- level_0/f_string/c/private-string.h | 26 +- level_0/f_string/c/string.c | 48 +-- level_0/f_string/c/string.h | 48 +-- level_0/f_string/c/string_dynamic.c | 122 +++--- level_0/f_string/c/string_dynamic.h | 118 +++--- level_0/f_string/c/string_map.c | 28 +- level_0/f_string/c/string_map.h | 26 +- level_0/f_string/c/string_quantity.c | 22 +- level_0/f_string/c/string_quantity.h | 26 +- level_0/f_string/c/string_range.c | 26 +- level_0/f_string/c/string_triple.c | 14 +- level_0/f_string/c/string_triple.h | 14 +- level_0/f_utf/c/utf_dynamic.c | 2 - level_1/fl_environment/c/environment.c | 18 +- level_2/fll_execute/c/execute.c | 10 +- level_2/fll_execute/c/execute.h | 20 +- level_2/fll_execute/c/private-execute.c | 17 +- level_2/fll_execute/c/private-execute.h | 4 +- level_3/byte_dump/c/common.h | 2 +- level_3/controller/c/rule/private-rule_print.c | 4 +- level_3/fake/c/common.h | 10 +- level_3/fake/c/fake.c | 5 +- level_3/fake/c/private-build-library.c | 314 +++++++-------- level_3/fake/c/private-build-load.c | 29 +- level_3/fake/c/private-build-objects.c | 6 +- level_3/fake/c/private-build-program.c | 21 +- level_3/fake/c/private-build.c | 16 +- level_3/fake/c/private-make-load_fakefile.c | 4 +- level_3/fake/c/private-make-operate_process.c | 4 +- level_3/fake/c/private-make-operate_process_type.c | 6 +- level_3/fake/c/private-make-operate_validate.c | 3 +- level_3/firewall/c/common.c | 123 ++++++ level_3/firewall/c/common.h | 441 +++++++++++++++++++++ level_3/firewall/c/firewall.c | 389 +++++++++--------- level_3/firewall/c/firewall.h | 304 +------------- level_3/firewall/c/main.c | 4 + level_3/firewall/c/private-common.c | 24 +- level_3/firewall/c/private-common.h | 8 +- level_3/firewall/c/private-firewall.c | 156 ++++---- level_3/firewall/c/private-firewall.h | 8 +- level_3/firewall/data/build/settings | 4 +- level_3/fss_basic_list_read/c/common.c | 30 ++ level_3/fss_basic_list_read/c/common.h | 241 +++++++++++ .../fss_basic_list_read/c/fss_basic_list_read.c | 12 - .../fss_basic_list_read/c/fss_basic_list_read.h | 221 +---------- level_3/fss_basic_list_read/data/build/settings | 4 +- level_3/fss_basic_list_write/c/common.c | 31 ++ level_3/fss_basic_list_write/c/common.h | 185 +++++++++ .../fss_basic_list_write/c/fss_basic_list_write.c | 13 - .../fss_basic_list_write/c/fss_basic_list_write.h | 165 +------- level_3/fss_basic_list_write/data/build/settings | 4 +- level_3/fss_basic_read/c/common.c | 30 ++ level_3/fss_basic_read/c/common.h | 241 +++++++++++ level_3/fss_basic_read/c/fss_basic_read.c | 12 - level_3/fss_basic_read/c/fss_basic_read.h | 221 +---------- level_3/fss_basic_read/data/build/settings | 4 +- level_3/fss_basic_write/c/common.c | 31 ++ level_3/fss_basic_write/c/common.h | 181 +++++++++ level_3/fss_basic_write/c/fss_basic_write.c | 13 - level_3/fss_basic_write/c/fss_basic_write.h | 161 +------- level_3/fss_basic_write/data/build/settings | 4 +- level_3/fss_embedded_list_read/c/common.c | 34 ++ level_3/fss_embedded_list_read/c/common.h | 234 +++++++++++ .../c/fss_embedded_list_read.c | 22 +- .../c/fss_embedded_list_read.h | 214 +--------- level_3/fss_embedded_list_read/data/build/settings | 4 +- level_3/fss_embedded_list_write/c/common.c | 31 ++ level_3/fss_embedded_list_write/c/common.h | 185 +++++++++ .../c/fss_embedded_list_write.c | 13 - .../c/fss_embedded_list_write.h | 165 +------- .../fss_embedded_list_write/data/build/settings | 4 +- level_3/fss_extended_list_read/c/common.c | 30 ++ level_3/fss_extended_list_read/c/common.h | 241 +++++++++++ .../c/fss_extended_list_read.c | 12 - .../c/fss_extended_list_read.h | 221 +---------- level_3/fss_extended_list_read/data/build/settings | 4 +- level_3/fss_extended_list_write/c/common.c | 31 ++ level_3/fss_extended_list_write/c/common.h | 185 +++++++++ .../c/fss_extended_list_write.c | 13 - .../c/fss_extended_list_write.h | 165 +------- .../fss_extended_list_write/data/build/settings | 4 +- level_3/fss_extended_read/c/common.c | 30 ++ level_3/fss_extended_read/c/common.h | 242 +++++++++++ level_3/fss_extended_read/c/fss_extended_read.c | 12 - level_3/fss_extended_read/c/fss_extended_read.h | 222 +---------- level_3/fss_extended_read/data/build/settings | 4 +- level_3/fss_extended_write/c/common.c | 31 ++ level_3/fss_extended_write/c/common.h | 185 +++++++++ level_3/fss_extended_write/c/fss_extended_write.c | 13 - level_3/fss_extended_write/c/fss_extended_write.h | 165 +------- level_3/fss_extended_write/data/build/settings | 4 +- level_3/fss_identify/c/common.c | 31 ++ level_3/fss_identify/c/common.h | 162 ++++++++ level_3/fss_identify/c/fss_identify.c | 13 - level_3/fss_identify/c/fss_identify.h | 142 +------ level_3/fss_identify/data/build/settings | 4 +- level_3/fss_payload_read/c/common.c | 30 ++ level_3/fss_payload_read/c/common.h | 241 +++++++++++ level_3/fss_payload_read/c/fss_payload_read.c | 12 - level_3/fss_payload_read/c/fss_payload_read.h | 221 +---------- level_3/fss_payload_read/data/build/settings | 4 +- level_3/fss_payload_write/c/common.c | 31 ++ level_3/fss_payload_write/c/common.h | 185 +++++++++ level_3/fss_payload_write/c/fss_payload_write.c | 13 - level_3/fss_payload_write/c/fss_payload_write.h | 165 +------- level_3/fss_payload_write/data/build/settings | 4 +- level_3/fss_status_code/c/common.c | 31 ++ level_3/fss_status_code/c/common.h | 156 ++++++++ level_3/fss_status_code/c/fss_status_code.c | 13 - level_3/fss_status_code/c/fss_status_code.h | 136 +------ level_3/fss_status_code/data/build/settings | 4 +- level_3/iki_read/c/common.c | 32 ++ level_3/iki_read/c/common.h | 241 +++++++++++ level_3/iki_read/c/iki_read.c | 14 - level_3/iki_read/c/iki_read.h | 221 +---------- level_3/iki_read/data/build/settings | 4 +- level_3/iki_write/c/common.c | 32 ++ level_3/iki_write/c/common.h | 167 ++++++++ level_3/iki_write/c/iki_write.c | 14 - level_3/iki_write/c/iki_write.h | 147 +------ level_3/iki_write/data/build/settings | 4 +- level_3/status_code/c/common.c | 31 ++ level_3/status_code/c/common.h | 158 ++++++++ level_3/status_code/c/status_code.c | 13 - level_3/status_code/c/status_code.h | 138 +------ level_3/status_code/data/build/settings | 4 +- level_3/utf8/c/common.c | 31 ++ level_3/utf8/c/common.h | 268 +++++++++++++ level_3/utf8/c/utf8.c | 13 - level_3/utf8/c/utf8.h | 248 +----------- level_3/utf8/data/build/settings | 4 +- 144 files changed, 5937 insertions(+), 4703 deletions(-) create mode 100644 level_0/f_console/tests/c/test-console-parameters_delete.c create mode 100644 level_0/f_console/tests/c/test-console-parameters_delete.h create mode 100644 level_0/f_console/tests/c/test-console-parameters_destroy.c create mode 100644 level_0/f_console/tests/c/test-console-parameters_destroy.h create mode 100644 level_3/firewall/c/common.c create mode 100644 level_3/firewall/c/common.h create mode 100644 level_3/fss_basic_list_read/c/common.c create mode 100644 level_3/fss_basic_list_read/c/common.h create mode 100644 level_3/fss_basic_list_write/c/common.c create mode 100644 level_3/fss_basic_list_write/c/common.h create mode 100644 level_3/fss_basic_read/c/common.c create mode 100644 level_3/fss_basic_read/c/common.h create mode 100644 level_3/fss_basic_write/c/common.c create mode 100644 level_3/fss_basic_write/c/common.h create mode 100644 level_3/fss_embedded_list_read/c/common.c create mode 100644 level_3/fss_embedded_list_read/c/common.h create mode 100644 level_3/fss_embedded_list_write/c/common.c create mode 100644 level_3/fss_embedded_list_write/c/common.h create mode 100644 level_3/fss_extended_list_read/c/common.c create mode 100644 level_3/fss_extended_list_read/c/common.h create mode 100644 level_3/fss_extended_list_write/c/common.c create mode 100644 level_3/fss_extended_list_write/c/common.h create mode 100644 level_3/fss_extended_read/c/common.c create mode 100644 level_3/fss_extended_read/c/common.h create mode 100644 level_3/fss_extended_write/c/common.c create mode 100644 level_3/fss_extended_write/c/common.h create mode 100644 level_3/fss_identify/c/common.c create mode 100644 level_3/fss_identify/c/common.h create mode 100644 level_3/fss_payload_read/c/common.c create mode 100644 level_3/fss_payload_read/c/common.h create mode 100644 level_3/fss_payload_write/c/common.c create mode 100644 level_3/fss_payload_write/c/common.h create mode 100644 level_3/fss_status_code/c/common.c create mode 100644 level_3/fss_status_code/c/common.h create mode 100644 level_3/iki_read/c/common.c create mode 100644 level_3/iki_read/c/common.h create mode 100644 level_3/iki_write/c/common.c create mode 100644 level_3/iki_write/c/common.h create mode 100644 level_3/status_code/c/common.c create mode 100644 level_3/status_code/c/common.h create mode 100644 level_3/utf8/c/common.c create mode 100644 level_3/utf8/c/common.h diff --git a/level_0/f_console/c/console-common.h b/level_0/f_console/c/console-common.h index b756452..5a1f8bd 100644 --- a/level_0/f_console/c/console-common.h +++ b/level_0/f_console/c/console-common.h @@ -343,7 +343,7 @@ extern "C" { #define f_console_parameters_t_initialize {0, f_string_dynamics_t_initialize, 0 } - #define macro_f_console_parameters_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, used } #endif // _di_f_console_parameters_t_ /** diff --git a/level_0/f_console/data/build/settings-tests b/level_0/f_console/data/build/settings-tests index 495df17..cf8fbb4 100644 --- a/level_0/f_console/data/build/settings-tests +++ b/level_0/f_console/data/build/settings-tests @@ -19,7 +19,7 @@ build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -lf_console build_libraries-level -lfll_0 build_libraries-monolithic -lfll -build_sources_program test-console-identify.c test-console-parameter_prioritize_left.c test-console-parameter_prioritize_right.c test-console-parameter_process.c test-console.c +build_sources_program test-console-identify.c test-console-parameter_prioritize_left.c test-console-parameter_prioritize_right.c test-console-parameter_process.c test-console-parameters_delete.c test-console-parameters_destroy.c test-console.c build_script no build_shared yes build_static no diff --git a/level_0/f_console/tests/c/test-console-parameter_prioritize_left.c b/level_0/f_console/tests/c/test-console-parameter_prioritize_left.c index b5d9af1..bc1d30f 100644 --- a/level_0/f_console/tests/c/test-console-parameter_prioritize_left.c +++ b/level_0/f_console/tests/c/test-console-parameter_prioritize_left.c @@ -18,19 +18,21 @@ void test__f_console_parameter_prioritize_left__fails(void **state) { f_console_parameter_t parameter = f_console_parameter_t_initialize; f_console_parameter_t parameters_array[1] = { parameter }; - parameters.parameter = parameters_array; + parameters.array = parameters_array; parameters.used = 1; const f_status_t status = f_console_parameter_prioritize_left(parameters, choices, &decision); assert_int_equal(F_status_set_fine(status), F_parameter); } + + f_console_parameters_delete(¶meters); } #ifndef _di_level_0_parameter_checking_ void test__f_console_parameter_prioritize_left__parameter_checking(void **state) { - const f_console_parameters_t parameters = f_console_parameters_t_initialize; + f_console_parameters_t parameters = f_console_parameters_t_initialize; f_console_parameter_ids_t choices = f_console_parameter_ids_t_initialize; { @@ -47,6 +49,8 @@ void test__f_console_parameter_prioritize_left__fails(void **state) { assert_int_equal(F_status_set_fine(status), F_parameter); } + + f_console_parameters_delete(¶meters); } #endif // _di_level_0_parameter_checking_ @@ -72,7 +76,7 @@ void test__f_console_parameter_prioritize_left__works(void **state) { f_console_parameter_t parameter = f_console_parameter_t_initialize; f_console_parameter_t parameters_array[1] = { parameter }; - parameters.parameter = parameters_array; + parameters.array = parameters_array; parameters.used = 1; const f_status_t status = f_console_parameter_prioritize_left(parameters, choices, &decision); @@ -96,7 +100,7 @@ void test__f_console_parameter_prioritize_left__works(void **state) { parameter_2.location_sub = 4; f_console_parameter_t parameters_array[2] = { parameter_1, parameter_2 }; - parameters.parameter = parameters_array; + parameters.array = parameters_array; parameters.used = 2; const f_status_t status = f_console_parameter_prioritize_left(parameters, choices, &decision); @@ -104,6 +108,8 @@ void test__f_console_parameter_prioritize_left__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(decision, 1); } + + f_console_parameters_delete(¶meters); } #ifdef __cplusplus diff --git a/level_0/f_console/tests/c/test-console-parameter_prioritize_right.c b/level_0/f_console/tests/c/test-console-parameter_prioritize_right.c index eb80b46..3e38a64 100644 --- a/level_0/f_console/tests/c/test-console-parameter_prioritize_right.c +++ b/level_0/f_console/tests/c/test-console-parameter_prioritize_right.c @@ -18,19 +18,21 @@ void test__f_console_parameter_prioritize_right__fails(void **state) { f_console_parameter_t parameter = f_console_parameter_t_initialize; f_console_parameter_t parameters_array[1] = { parameter }; - parameters.parameter = parameters_array; + parameters.array = parameters_array; parameters.used = 1; const f_status_t status = f_console_parameter_prioritize_right(parameters, choices, &decision); assert_int_equal(F_status_set_fine(status), F_parameter); } + + f_console_parameters_delete(¶meters); } #ifndef _di_level_0_parameter_checking_ void test__f_console_parameter_prioritize_right__parameter_checking(void **state) { - const f_console_parameters_t parameters = f_console_parameters_t_initialize; + f_console_parameters_t parameters = f_console_parameters_t_initialize; f_console_parameter_ids_t choices = f_console_parameter_ids_t_initialize; { @@ -47,6 +49,8 @@ void test__f_console_parameter_prioritize_right__fails(void **state) { assert_int_equal(F_status_set_fine(status), F_parameter); } + + f_console_parameters_delete(¶meters); } #endif // _di_level_0_parameter_checking_ @@ -72,7 +76,7 @@ void test__f_console_parameter_prioritize_right__works(void **state) { f_console_parameter_t parameter = f_console_parameter_t_initialize; f_console_parameter_t parameters_array[1] = { parameter }; - parameters.parameter = parameters_array; + parameters.array = parameters_array; parameters.used = 1; const f_status_t status = f_console_parameter_prioritize_right(parameters, choices, &decision); @@ -96,7 +100,7 @@ void test__f_console_parameter_prioritize_right__works(void **state) { parameter_2.location_sub = 4; f_console_parameter_t parameters_array[2] = { parameter_1, parameter_2 }; - parameters.parameter = parameters_array; + parameters.array = parameters_array; parameters.used = 2; const f_status_t status = f_console_parameter_prioritize_right(parameters, choices, &decision); @@ -104,6 +108,8 @@ void test__f_console_parameter_prioritize_right__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(decision, 0); } + + f_console_parameters_delete(¶meters); } #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 30edde0..200c317 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 @@ -30,7 +30,7 @@ void test__f_console_parameter_process__no_arguments(void **state) { f_array_lengths_t remaining = f_array_lengths_t_initialize; { - const f_status_t status = f_console_parameter_process(arguments, parameters, &remaining); + const f_status_t status = f_console_parameter_process(arguments, ¶meters, &remaining); assert_int_equal(status, F_none); @@ -125,7 +125,7 @@ void test__f_console_parameter_process__only_remaining(void **state) { f_array_lengths_t remaining = f_array_lengths_t_initialize; { - const f_status_t status = f_console_parameter_process(arguments, parameters, &remaining); + const f_status_t status = f_console_parameter_process(arguments, ¶meters, &remaining); assert_int_equal(status, F_none); @@ -193,10 +193,10 @@ void test__f_console_parameter_process__only_remaining(void **state) { void test__f_console_parameter_process__parameter_checking(void **state) { const f_console_arguments_t arguments = f_console_arguments_t_initialize; - const f_console_parameters_t parameters = f_console_parameters_t_initialize; + f_console_parameters_t parameters = f_console_parameters_t_initialize; { - const f_status_t status = f_console_parameter_process(arguments, parameters, 0); + const f_status_t status = f_console_parameter_process(arguments, ¶meters, 0); assert_int_equal(F_status_set_fine(status), F_parameter); } @@ -245,7 +245,7 @@ void test__f_console_parameter_process__works(void **state) { f_array_lengths_t remaining = f_array_lengths_t_initialize; { - const f_status_t status = f_console_parameter_process(arguments, parameters, &remaining); + const f_status_t status = f_console_parameter_process(arguments, ¶meters, &remaining); assert_int_equal(status, F_none); diff --git a/level_0/f_console/tests/c/test-console-parameters_delete.c b/level_0/f_console/tests/c/test-console-parameters_delete.c new file mode 100644 index 0000000..6eb1b48 --- /dev/null +++ b/level_0/f_console/tests/c/test-console-parameters_delete.c @@ -0,0 +1,66 @@ +#include "test-console.h" +#include "test-console-parameters_delete.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_console_parameters_delete__frees_memory(void **state) { + + const f_array_length_t size = 3; + + f_console_parameters_t parameters = f_console_parameters_t_initialize; + f_console_parameter_t parameter = f_console_parameter_t_initialize; + f_console_parameter_t parameters_array[1] = { parameter }; + + parameters.array = parameters_array; + parameters.used = 1; + + { + const f_status_t status = f_string_dynamics_resize(size, ¶meters.arguments); + + assert_int_equal(status, F_none); + assert_int_not_equal(parameters.arguments.size, 0); + assert_non_null(parameters.arguments.array); + } + + { + const f_status_t status = f_type_array_lengths_resize(3, ¶meters.array[0].locations); + + assert_int_equal(status, F_none); + assert_int_not_equal(parameters.array[0].locations.size, 0); + assert_non_null(parameters.array[0].locations.array); + } + + { + const f_status_t status = f_type_array_lengths_resize(size, ¶meters.array[0].locations_sub); + + assert_int_equal(status, F_none); + assert_int_not_equal(parameters.array[0].locations_sub.size, 0); + assert_non_null(parameters.array[0].locations_sub.array); + } + + { + const f_status_t status = f_console_parameters_delete(¶meters); + + assert_int_equal(status, F_none); + assert_int_equal(parameters.arguments.size, 0); + assert_int_equal(parameters.array[0].locations.size, 0); + assert_int_equal(parameters.array[0].locations_sub.size, 0); + } +} + +#ifndef _di_level_0_parameter_checking_ + void test__f_console_parameters_delete__parameter_checking(void **state) { + + { + const f_status_t status = f_console_parameters_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_console/tests/c/test-console-parameters_delete.h b/level_0/f_console/tests/c/test-console-parameters_delete.h new file mode 100644 index 0000000..b15c282 --- /dev/null +++ b/level_0/f_console/tests/c/test-console-parameters_delete.h @@ -0,0 +1,29 @@ +/** + * FLL - Level 0 + * + * Project: Console + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the console project. + */ +#ifndef _TEST__F_console__delete +#define _TEST__F_console__delete + +/** + * Test that deallocation works. + * + * @see f_console_parameters_delete() + */ +extern void test__f_console_parameters_delete__frees_memory(void **state); + +/** + * Test that parameter checking works as expected. + * + * @see f_console_parameters_delete() + */ +#ifndef _di_level_0_parameter_checking_ + extern void test__f_console_parameters_delete__parameter_checking(void **state); +#endif // _di_level_0_parameter_checking_ + +#endif // _TEST__F_console__delete diff --git a/level_0/f_console/tests/c/test-console-parameters_destroy.c b/level_0/f_console/tests/c/test-console-parameters_destroy.c new file mode 100644 index 0000000..a4ac15c --- /dev/null +++ b/level_0/f_console/tests/c/test-console-parameters_destroy.c @@ -0,0 +1,66 @@ +#include "test-console.h" +#include "test-console-parameters_destroy.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_console_parameters_destroy__frees_memory(void **state) { + + const f_array_length_t size = 3; + + f_console_parameters_t parameters = f_console_parameters_t_initialize; + f_console_parameter_t parameter = f_console_parameter_t_initialize; + f_console_parameter_t parameters_array[1] = { parameter }; + + parameters.array = parameters_array; + parameters.used = 1; + + { + const f_status_t status = f_string_dynamics_resize(size, ¶meters.arguments); + + assert_int_equal(status, F_none); + assert_int_not_equal(parameters.arguments.size, 0); + assert_non_null(parameters.arguments.array); + } + + { + const f_status_t status = f_type_array_lengths_resize(size, ¶meters.array[0].locations); + + assert_int_equal(status, F_none); + assert_int_not_equal(parameters.array[0].locations.size, 0); + assert_non_null(parameters.array[0].locations.array); + } + + { + const f_status_t status = f_type_array_lengths_resize(size, ¶meters.array[0].locations_sub); + + assert_int_equal(status, F_none); + assert_int_not_equal(parameters.array[0].locations_sub.size, 0); + assert_non_null(parameters.array[0].locations_sub.array); + } + + { + const f_status_t status = f_console_parameters_destroy(¶meters); + + assert_int_equal(status, F_none); + assert_int_equal(parameters.arguments.size, 0); + assert_int_equal(parameters.array[0].locations.size, 0); + assert_int_equal(parameters.array[0].locations_sub.size, 0); + } +} + +#ifndef _di_level_0_parameter_checking_ + void test__f_console_parameters_destroy__parameter_checking(void **state) { + + { + const f_status_t status = f_console_parameters_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_console/tests/c/test-console-parameters_destroy.h b/level_0/f_console/tests/c/test-console-parameters_destroy.h new file mode 100644 index 0000000..588e561 --- /dev/null +++ b/level_0/f_console/tests/c/test-console-parameters_destroy.h @@ -0,0 +1,29 @@ +/** + * FLL - Level 0 + * + * Project: Console + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the console project. + */ +#ifndef _TEST__F_console__destroy +#define _TEST__F_console__destroy + +/** + * Test that deallocation works. + * + * @see f_console_parameters_destroy() + */ +extern void test__f_console_parameters_destroy__frees_memory(void **state); + +/** + * Test that parameter checking works as expected. + * + * @see f_console_parameters_destroy() + */ +#ifndef _di_level_0_parameter_checking_ + extern void test__f_console_parameters_destroy__parameter_checking(void **state); +#endif // _di_level_0_parameter_checking_ + +#endif // _TEST__F_console__destroy diff --git a/level_0/f_console/tests/c/test-console.c b/level_0/f_console/tests/c/test-console.c index a554c69..b8267b6 100644 --- a/level_0/f_console/tests/c/test-console.c +++ b/level_0/f_console/tests/c/test-console.c @@ -34,11 +34,17 @@ int main(void) { cmocka_unit_test(test__f_console_parameter_process__only_remaining), cmocka_unit_test(test__f_console_parameter_process__works), + cmocka_unit_test(test__f_console_parameters_delete__frees_memory), + + cmocka_unit_test(test__f_console_parameters_destroy__frees_memory), + #ifndef _di_level_0_parameter_checking_ cmocka_unit_test(test__f_console_identify__parameter_checking), cmocka_unit_test(test__f_console_parameter_prioritize_left__parameter_checking), cmocka_unit_test(test__f_console_parameter_prioritize_right__parameter_checking), cmocka_unit_test(test__f_console_parameter_process__parameter_checking), + cmocka_unit_test(test__f_console_parameters_delete__parameter_checking), + cmocka_unit_test(test__f_console_parameters_destroy__parameter_checking), #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_console/tests/c/test-console.h b/level_0/f_console/tests/c/test-console.h index 53e9577..43f0c93 100644 --- a/level_0/f_console/tests/c/test-console.h +++ b/level_0/f_console/tests/c/test-console.h @@ -27,6 +27,8 @@ #include "test-console-parameter_prioritize_left.h" #include "test-console-parameter_prioritize_right.h" #include "test-console-parameter_process.h" +#include "test-console-parameters_delete.h" +#include "test-console-parameters_destroy.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_control_group/c/control_group.h b/level_0/f_control_group/c/control_group.h index f958bd6..c409ad2 100644 --- a/level_0/f_control_group/c/control_group.h +++ b/level_0/f_control_group/c/control_group.h @@ -24,7 +24,7 @@ #include #include -// fll-1 control includes +// FLL-1 control includes. #include #ifdef __cplusplus diff --git a/level_0/f_string/c/private-string.c b/level_0/f_string/c/private-string.c index 5919c4e..8d2f650 100644 --- a/level_0/f_string/c/private-string.c +++ b/level_0/f_string/c/private-string.c @@ -6,7 +6,7 @@ extern "C" { #endif #if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_mash_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_triples_append_) - f_status_t private_f_string_append(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t private_f_string_append(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { if (destination->used + length > destination->size) { const f_status_t status = private_f_string_dynamic_increase_by(length, destination); @@ -21,7 +21,7 @@ extern "C" { #endif // !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_mash_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_triples_append_) #if !defined(_di_f_string_append_assure_nulless_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_assure_nulless_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_assure_nulless_) || !defined(_di_f_string_dynamic_partial_append_nulless_) || !defined(_di_f_string_dynamic_partial_mash_nulless_) || !defined(_di_f_string_mash_nulless_) - f_status_t private_f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t private_f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { if (destination->used + length > F_string_t_size_d) { return F_status_set_error(F_string_too_large); @@ -73,7 +73,7 @@ extern "C" { #endif // !defined(_di_f_string_append_assure_nulless_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_assure_nulless_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_assure_nulless_) || !defined(_di_f_string_dynamic_partial_append_nulless_) || !defined(_di_f_string_dynamic_partial_mash_nulless_) || !defined(_di_f_string_mash_nulless_) #if !defined(_di_f_string_dynamic_adjust_) || !defined(_di_f_string_dynamic_decimate_by_) || !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_) - f_status_t private_f_string_dynamic_adjust(const f_array_length_t length, f_string_dynamic_t *dynamic) { + f_status_t private_f_string_dynamic_adjust(const f_array_length_t length, f_string_dynamic_t * const dynamic) { f_status_t status = f_memory_adjust(dynamic->size, length, sizeof(f_string_t), (void **) & dynamic->string); @@ -90,7 +90,7 @@ extern "C" { #endif // !defined(_di_f_string_dynamic_adjust_) || !defined(_di_f_string_dynamic_decimate_by_) || !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_) #if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_) - f_status_t private_f_string_dynamic_increase_by(const f_array_length_t amount, f_string_dynamic_t *dynamic) { + f_status_t private_f_string_dynamic_increase_by(const f_array_length_t amount, f_string_dynamic_t * const dynamic) { if (dynamic->used + amount > dynamic->size) { if (dynamic->used + amount > F_string_t_size_d) { @@ -105,7 +105,7 @@ extern "C" { #endif // !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_) #if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_decrease_by_) || !defined(_di_f_string_dynamic_increase_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamic_terminate_) || !defined(_di_f_string_dynamic_terminate_after_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_) - f_status_t private_f_string_dynamic_resize(const f_array_length_t length, f_string_dynamic_t *dynamic) { + f_status_t private_f_string_dynamic_resize(const f_array_length_t length, f_string_dynamic_t * const dynamic) { const f_status_t status = f_memory_resize(dynamic->size, length, sizeof(f_string_t), (void **) & dynamic->string); @@ -122,7 +122,7 @@ extern "C" { #endif // !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_decrease_by_) || !defined(_di_f_string_dynamic_increase_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamic_terminate_) || !defined(_di_f_string_dynamic_terminate_after_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_) #if !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) - f_status_t private_f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t *dynamics) { + f_status_t private_f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t * const dynamics) { if (dynamics->used + length > F_array_length_t_size_d) { return F_status_set_error(F_array_too_large); @@ -174,7 +174,7 @@ extern "C" { #endif // !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) #if !defined(_di_f_string_dynamics_decrease_by_) || !defined(_di_f_string_dynamics_increase_) || !defined(_di_f_string_dynamics_increase_by_) - f_status_t private_f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t *dynamics) { + f_status_t private_f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t * const dynamics) { if (dynamics->used + length > F_array_length_t_size_d) { return F_status_set_error(F_array_too_large); @@ -331,7 +331,7 @@ extern "C" { #endif // !defined(_di_f_string_maps_decrease_by_) || !defined(_di_f_string_maps_increase_) || !defined(_di_f_string_maps_increase_by_) || !defined(_di_f_string_maps_terminate_) || !defined(_di_f_string_maps_terminate_after_) #if !defined(_di_f_string_dynamic_mish_) || !defined(_di_f_string_dynamic_partial_mish_) || !defined(_di_f_string_dynamic_partial_prepend_assure_) || !defined(_di_f_string_dynamic_partial_prepend_) || !defined(_di_f_string_dynamic_prepend_assure_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_mish_) || !defined(_di_f_string_prepend_assure_) || !defined(_di_f_string_prepend_) - f_status_t private_f_string_prepend(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t private_f_string_prepend(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { if (destination->used + length > F_string_t_size_d) { return F_status_set_error(F_string_too_large); @@ -356,7 +356,7 @@ extern "C" { #endif // !defined(_di_f_string_dynamic_mish_) || !defined(_di_f_string_dynamic_partial_mish_) || !defined(_di_f_string_dynamic_partial_prepend_assure_) || !defined(_di_f_string_dynamic_partial_prepend_) || !defined(_di_f_string_dynamic_prepend_assure_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_mish_) || !defined(_di_f_string_prepend_assure_) || !defined(_di_f_string_prepend_) #if !defined(_di_f_string_dynamic_mish_nulless_) || !defined(_di_f_string_dynamic_partial_mish_nulless_) || !defined(_di_f_string_dynamic_partial_prepend_assure_nulless_) || !defined(_di_f_string_dynamic_partial_prepend_nulless_) || !defined(_di_f_string_dynamic_prepend_assure_nulless_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_mish_nulless_) || !defined(_di_f_string_prepend_assure_nulless_) || !defined(_di_f_string_prepend_nulless_) - f_status_t private_f_string_prepend_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t private_f_string_prepend_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { if (destination->used + length > F_string_t_size_d) { return F_status_set_error(F_string_too_large); diff --git a/level_0/f_string/c/private-string.h b/level_0/f_string/c/private-string.h index 73ddcff..74511c4 100644 --- a/level_0/f_string/c/private-string.h +++ b/level_0/f_string/c/private-string.h @@ -84,7 +84,7 @@ extern "C" { * @see f_string_mash_nulless() */ #if !defined(_di_f_string_append_assure_nulless_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_assure_nulless_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_assure_nulless_) || !defined(_di_f_string_dynamic_partial_append_nulless_) || !defined(_di_f_string_dynamic_partial_mash_nulless_) || !defined(_di_f_string_mash_nulless_) - extern f_status_t private_f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) F_attribute_visibility_internal_d; + extern f_status_t private_f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) F_attribute_visibility_internal_d; #endif // !defined(_di_f_string_append_assure_nulless_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_assure_nulless_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_assure_nulless_) || !defined(_di_f_string_dynamic_partial_append_nulless_) || !defined(_di_f_string_dynamic_partial_mash_nulless_) || !defined(_di_f_string_mash_nulless_) /** @@ -94,7 +94,7 @@ extern "C" { * * @param length * The new size to use. - * @param string + * @param dynamic * The string to adjust. * * @return @@ -114,7 +114,7 @@ extern "C" { * @see f_string_triples_decimate_by() */ #if !defined(_di_f_string_dynamic_adjust_) || !defined(_di_f_string_dynamic_decimate_by_) || !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_) - extern f_status_t private_f_string_dynamic_adjust(const f_array_length_t length, f_string_dynamic_t *string) F_attribute_visibility_internal_d; + extern f_status_t private_f_string_dynamic_adjust(const f_array_length_t length, f_string_dynamic_t * const dynamic) F_attribute_visibility_internal_d; #endif // !defined(_di_f_string_dynamic_adjust_) || !defined(_di_f_string_dynamic_decimate_by_) || !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_) /** @@ -124,7 +124,7 @@ extern "C" { * * @param amount * A positive number representing how much to increase the size by. - * @param string + * @param dynamic * The string to resize. * * @return @@ -162,7 +162,7 @@ extern "C" { * @see f_string_triples_append() */ #if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_) - extern f_status_t private_f_string_dynamic_increase_by(const f_array_length_t amount, f_string_dynamic_t *string) F_attribute_visibility_internal_d; + extern f_status_t private_f_string_dynamic_increase_by(const f_array_length_t amount, f_string_dynamic_t * const dynamic) F_attribute_visibility_internal_d; #endif // !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_) /** @@ -172,7 +172,7 @@ extern "C" { * * @param length * The new size to use. - * @param string + * @param dynamic * The string to resize. * * @return @@ -210,7 +210,7 @@ extern "C" { * @see f_string_triples_append() */ #if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_decrease_by_) || !defined(_di_f_string_dynamic_increase_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamic_terminate_) || !defined(_di_f_string_dynamic_terminate_after_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_) - extern f_status_t private_f_string_dynamic_resize(const f_array_length_t length, f_string_dynamic_t *string) F_attribute_visibility_internal_d; + extern f_status_t private_f_string_dynamic_resize(const f_array_length_t length, f_string_dynamic_t * const dynamic) F_attribute_visibility_internal_d; #endif // !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_decrease_by_) || !defined(_di_f_string_dynamic_increase_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamic_terminate_) || !defined(_di_f_string_dynamic_terminate_after_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_) /** @@ -220,7 +220,7 @@ extern "C" { * * @param length * The new size to use. - * @param strings + * @param dynamics * The strings to adjust. * * @return @@ -238,7 +238,7 @@ extern "C" { * @see f_string_map_multis_append() */ #if !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) - extern f_status_t private_f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t *strings) F_attribute_visibility_internal_d; + extern f_status_t private_f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t * const dynamics) F_attribute_visibility_internal_d; #endif // !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) /** @@ -272,7 +272,7 @@ extern "C" { * * @param length * The new size to use. - * @param strings + * @param dynamics * The strings to resize. * * @return @@ -288,7 +288,7 @@ extern "C" { * @see f_string_dynamics_increase_by() */ #if !defined(_di_f_string_dynamics_decrease_by_) || !defined(_di_f_string_dynamics_increase_) || !defined(_di_f_string_dynamics_increase_by_) - extern f_status_t private_f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t *strings) F_attribute_visibility_internal_d; + extern f_status_t private_f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t * const dynamics) F_attribute_visibility_internal_d; #endif // !defined(_di_f_string_dynamics_decrease_by_) || !defined(_di_f_string_dynamics_increase_) || !defined(_di_f_string_dynamics_increase_by_) /** @@ -428,7 +428,7 @@ extern "C" { * @see f_string_prepend() */ #if !defined(_di_f_string_dynamic_mish_) || !defined(_di_f_string_dynamic_partial_mish_) || !defined(_di_f_string_dynamic_partial_prepend_assure_) || !defined(_di_f_string_dynamic_partial_prepend_) || !defined(_di_f_string_dynamic_prepend_assure_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_mish_) || !defined(_di_f_string_prepend_assure_) || !defined(_di_f_string_prepend_) - extern f_status_t private_f_string_prepend(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) F_attribute_visibility_internal_d; + extern f_status_t private_f_string_prepend(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) F_attribute_visibility_internal_d; #endif // !defined(_di_f_string_dynamic_mish_) || !defined(_di_f_string_dynamic_partial_mish_) || !defined(_di_f_string_dynamic_partial_prepend_assure_) || !defined(_di_f_string_dynamic_partial_prepend_) || !defined(_di_f_string_dynamic_prepend_assure_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_mish_) || !defined(_di_f_string_prepend_assure_) || !defined(_di_f_string_prepend_) /** @@ -464,7 +464,7 @@ extern "C" { * @see f_string_prepend_nulless() */ #if !defined(_di_f_string_dynamic_mish_nulless_) || !defined(_di_f_string_dynamic_partial_mish_nulless_) || !defined(_di_f_string_dynamic_partial_prepend_assure_nulless_) || !defined(_di_f_string_dynamic_partial_prepend_nulless_) || !defined(_di_f_string_dynamic_prepend_assure_nulless_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_mish_nulless_) || !defined(_di_f_string_prepend_assure_nulless_) || !defined(_di_f_string_prepend_nulless_) - extern f_status_t private_f_string_prepend_nulless(const f_string_t source, f_array_length_t length, f_string_dynamic_t *destination) F_attribute_visibility_internal_d; + extern f_status_t private_f_string_prepend_nulless(const f_string_t source, f_array_length_t length, f_string_dynamic_t * const destination) F_attribute_visibility_internal_d; #endif // !defined(_di_f_string_dynamic_mish_nulless_) || !defined(_di_f_string_dynamic_partial_mish_nulless_) || !defined(_di_f_string_dynamic_partial_prepend_assure_nulless_) || !defined(_di_f_string_dynamic_partial_prepend_nulless_) || !defined(_di_f_string_dynamic_prepend_assure_nulless_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_mish_nulless_) || !defined(_di_f_string_prepend_assure_nulless_) || !defined(_di_f_string_prepend_nulless_) /** diff --git a/level_0/f_string/c/string.c b/level_0/f_string/c/string.c index b707135..7aaa7a1 100644 --- a/level_0/f_string/c/string.c +++ b/level_0/f_string/c/string.c @@ -6,13 +6,13 @@ extern "C" { #endif #ifndef _di_f_string_append_ - f_status_t f_string_append(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_append(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } return private_f_string_append(source, length, destination); @@ -20,13 +20,13 @@ extern "C" { #endif // _di_f_string_append_ #ifndef _di_f_string_append_assure_ - f_status_t f_string_append_assure(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_append_assure(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } if (destination->used < length) { @@ -63,13 +63,13 @@ extern "C" { #endif // _di_f_string_append_assure_ #ifndef _di_f_string_append_assure_nulless_ - f_status_t f_string_append_assure_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_append_assure_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } if (destination->used < length) { @@ -106,13 +106,13 @@ extern "C" { #endif // _di_f_string_append_assure_nulless_ #ifndef _di_f_string_append_nulless_ - f_status_t f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } return private_f_string_append_nulless(source, length, destination); @@ -120,13 +120,13 @@ extern "C" { #endif // _di_f_string_append_nulless_ #ifndef _di_f_string_mash_ - f_status_t f_string_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } if (glue_length && destination->used) { @@ -139,13 +139,13 @@ extern "C" { #endif // _di_f_string_mash_ #ifndef _di_f_string_mash_nulless_ - f_status_t f_string_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } if (glue_length && destination->used) { @@ -158,13 +158,13 @@ extern "C" { #endif // _di_f_string_mash_nulless_ #ifndef _di_f_string_mish_ - f_status_t f_string_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } if (glue_length && destination->used) { @@ -177,13 +177,13 @@ extern "C" { #endif // _di_f_string_mish_ #ifndef _di_f_string_mish_nulless_ - f_status_t f_string_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } if (glue_length && destination->used) { @@ -196,13 +196,13 @@ extern "C" { #endif // _di_f_string_mish_nulless_ #ifndef _di_f_string_prepend_ - f_status_t f_string_prepend(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_prepend(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } return private_f_string_prepend(source, length, destination); @@ -210,13 +210,13 @@ extern "C" { #endif // _di_f_string_prepend_ #ifndef _di_f_string_prepend_assure_ - f_status_t f_string_prepend_assure(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_prepend_assure(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } if (destination->used < length) { @@ -253,13 +253,13 @@ extern "C" { #endif // _di_f_string_prepend_assure_ #ifndef _di_f_string_prepend_assure_nulless_ - f_status_t f_string_prepend_assure_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_prepend_assure_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } if (destination->used < length) { @@ -296,13 +296,13 @@ extern "C" { #endif // _di_f_string_prepend_assure_nulless_ #ifndef _di_f_string_prepend_nulless_ - f_status_t f_string_prepend_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + f_status_t f_string_prepend_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!length) { - return F_data_not_eos; + return F_data_not; } return private_f_string_prepend_nulless(source, length, destination); diff --git a/level_0/f_string/c/string.h b/level_0/f_string/c/string.h index c71ffc7..5bd4d0a 100644 --- a/level_0/f_string/c/string.h +++ b/level_0/f_string/c/string.h @@ -45,7 +45,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -53,7 +53,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_append_ - extern f_status_t f_string_append(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_append(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_append_ /** @@ -70,7 +70,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -78,7 +78,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_append_assure_ - extern f_status_t f_string_append_assure(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_append_assure(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_append_assure_ /** @@ -96,7 +96,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -104,7 +104,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_append_assure_nulless_ - extern f_status_t f_string_append_assure_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_append_assure_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_append_assure_nulless_ /** @@ -121,7 +121,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -129,7 +129,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_append_nulless_ - extern f_status_t f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_append_nulless_ /** @@ -150,7 +150,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -158,7 +158,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_mash_ - extern f_status_t f_string_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_mash_ /** @@ -181,7 +181,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -189,7 +189,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_mash_nulless_ - extern f_status_t f_string_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_mash_nulless_ /** @@ -210,7 +210,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -218,7 +218,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_mish_ - extern f_status_t f_string_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_mish_ /** @@ -241,7 +241,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -249,7 +249,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_mish_nulless_ - extern f_status_t f_string_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_mish_nulless_ /** @@ -266,7 +266,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -274,7 +274,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_prepend_ - extern f_status_t f_string_prepend(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_prepend(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_prepend_ /** @@ -293,7 +293,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -301,7 +301,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_prepend_assure_ - extern f_status_t f_string_prepend_assure(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_prepend_assure(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_prepend_assure_ /** @@ -321,7 +321,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -329,7 +329,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_prepend_assure_nulless_ - extern f_status_t f_string_prepend_assure_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_prepend_assure_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_prepend_assure_nulless_ /** @@ -349,7 +349,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -357,7 +357,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_prepend_nulless_ - extern f_status_t f_string_prepend_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); + extern f_status_t f_string_prepend_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination); #endif // _di_f_string_prepend_nulless_ /** diff --git a/level_0/f_string/c/string_dynamic.c b/level_0/f_string/c/string_dynamic.c index ee6af60..ab55d23 100644 --- a/level_0/f_string/c/string_dynamic.c +++ b/level_0/f_string/c/string_dynamic.c @@ -158,13 +158,13 @@ extern "C" { #endif // _di_f_string_dynamic_adjust_ #ifndef _di_f_string_dynamic_append_ - f_status_t f_string_dynamic_append(const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_append(const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } return private_f_string_append(source.string, source.used, destination); @@ -172,13 +172,13 @@ extern "C" { #endif // _di_f_string_dynamic_append_ #ifndef _di_f_string_dynamic_append_assure_ - f_status_t f_string_dynamic_append_assure(const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_append_assure(const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (destination->used < source.used) { @@ -215,13 +215,13 @@ extern "C" { #endif // _di_f_string_dynamic_append_assure_ #ifndef _di_f_string_dynamic_append_assure_nulless_ - f_status_t f_string_dynamic_append_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_append_assure_nulless(const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (destination->used < source.used) { @@ -258,13 +258,13 @@ extern "C" { #endif // _di_f_string_dynamic_append_assure_nulless_ #ifndef _di_f_string_dynamic_append_nulless_ - f_status_t f_string_dynamic_append_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_append_nulless(const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } return private_f_string_append_nulless(source.string, source.used, destination); @@ -337,13 +337,13 @@ extern "C" { #endif // _di_f_string_dynamic_increase_by_ #ifndef _di_f_string_dynamic_mash_ - f_status_t f_string_dynamic_mash(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_mash(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (glue.used && destination->used) { @@ -356,13 +356,13 @@ extern "C" { #endif // _di_f_string_dynamic_mash_ #ifndef _di_f_string_dynamic_mash_nulless_ - f_status_t f_string_dynamic_mash_nulless(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_mash_nulless(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (glue.used && destination->used) { @@ -375,13 +375,13 @@ extern "C" { #endif // _di_f_string_dynamic_mash_nulless_ #ifndef _di_f_string_dynamic_mish_ - f_status_t f_string_dynamic_mish(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_mish(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (glue.used && destination->used) { @@ -394,13 +394,13 @@ extern "C" { #endif // _di_f_string_dynamic_mish_ #ifndef _di_f_string_dynamic_mish_nulless_ - f_status_t f_string_dynamic_mish_nulless(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_mish_nulless(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (glue.used && destination->used) { @@ -413,14 +413,14 @@ extern "C" { #endif // _di_f_string_dynamic_mish_nulless_ #ifndef _di_f_string_dynamic_partial_append_ - f_status_t f_string_dynamic_partial_append(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_partial_append(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -432,14 +432,14 @@ extern "C" { #endif // _di_f_string_dynamic_partial_append_ #ifndef _di_f_string_dynamic_partial_append_assure_ - f_status_t f_string_dynamic_partial_append_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_partial_append_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -482,14 +482,14 @@ extern "C" { #endif // _di_f_string_dynamic_partial_append_assure_ #ifndef _di_f_string_dynamic_partial_append_assure_nulless_ - f_status_t f_string_dynamic_partial_append_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_partial_append_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -532,14 +532,14 @@ extern "C" { #endif // _di_f_string_dynamic_append_assure_nulless_ #ifndef _di_f_string_dynamic_partial_append_nulless_ - f_status_t f_string_dynamic_partial_append_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_partial_append_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -551,14 +551,14 @@ extern "C" { #endif // _di_f_string_dynamic_partial_append_nulless_ #ifndef _di_f_string_dynamic_partial_mash_ - f_status_t f_string_dynamic_partial_mash(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_partial_mash(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -575,14 +575,14 @@ extern "C" { #endif // _di_f_string_dynamic_partial_mash_ #ifndef _di_f_string_dynamic_partial_mash_nulless_ - f_status_t f_string_dynamic_partial_mash_nulless(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_partial_mash_nulless(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -599,14 +599,14 @@ extern "C" { #endif // _di_f_string_dynamic_partial_mash_nulless_ #ifndef _di_f_string_dynamic_partial_mish_ - f_status_t f_string_partial_dynamic_mish(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_partial_dynamic_mish(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -623,14 +623,14 @@ extern "C" { #endif // _di_f_string_dynamic_partial_mish_ #ifndef _di_f_string_dynamic_partial_mish_nulless_ - f_status_t f_string_dynamic_partial_mish_nulless(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_partial_mish_nulless(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -647,14 +647,14 @@ extern "C" { #endif // _di_f_string_dynamic_partial_mish_nulless_ #ifndef _di_f_string_dynamic_partial_prepend_ - f_status_t f_string_dynamic_partial_prepend(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_partial_prepend(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -666,14 +666,14 @@ extern "C" { #endif // _di_f_string_dynamic_partial_prepend_ #ifndef _di_f_string_dynamic_partial_prepend_assure_ - f_status_t f_string_dynamic_partial_prepend_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_partial_prepend_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -716,14 +716,14 @@ extern "C" { #endif // _di_f_string_dynamic_partial_prepend_assure_ #ifndef _di_f_string_dynamic_partial_prepend_assure_nulless_ - f_status_t f_string_dynamic_partial_prepend_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_partial_prepend_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -766,14 +766,14 @@ extern "C" { #endif // _di_f_string_dynamic_partial_prepend_assure_nulless #ifndef _di_f_string_dynamic_partial_prepend_nulless_ - f_status_t f_string_dynamic_partial_prepend_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_partial_prepend_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (range.start > range.stop) { @@ -785,13 +785,13 @@ extern "C" { #endif // _di_f_string_dynamic_partial_prepend_nulless #ifndef _di_f_string_dynamic_prepend_ - f_status_t f_string_dynamic_prepend(const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_prepend(const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } return private_f_string_prepend(source.string, source.used, destination); @@ -799,13 +799,13 @@ extern "C" { #endif // _di_f_string_dynamic_prepend_ #ifndef _di_f_string_dynamic_prepend_assure_ - f_status_t f_string_dynamic_prepend_assure(const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_prepend_assure(const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (destination->used < source.used) { @@ -842,13 +842,13 @@ extern "C" { #endif // _di_f_string_dynamic_prepend_assure_ #ifndef _di_f_string_dynamic_prepend_assure_nulless_ - f_status_t f_string_dynamic_prepend_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_prepend_assure_nulless(const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!source.used) { - return F_data_not_eos; + return F_data_not; } if (destination->used < source.used) { @@ -885,12 +885,12 @@ extern "C" { #endif // _di_f_string_dynamic_prepend_assure_nulless_ #ifndef _di_f_string_dynamic_prepend_nulless_ - f_status_t f_string_dynamic_prepend_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_prepend_nulless(const f_string_static_t source, f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) return F_data_not; return private_f_string_prepend_nulless(source.string, source.used, destination); } @@ -912,7 +912,7 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used) return F_data_not_eos; + if (!buffer.used) return F_data_not; if (range->start > range->stop) return F_data_not_stop; while (buffer.string[range->start] != f_string_eol_s.string[0]) { @@ -933,7 +933,7 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used) return F_data_not_eos; + if (!buffer.used) return F_data_not; if (range->start > range->stop) return F_data_not_stop; while (buffer.string[range->start] != seek_to_this) { @@ -956,7 +956,7 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used) return F_data_not_eos; + if (!buffer.used) return F_data_not; if (range->start > range->stop) return F_data_not_stop; while (buffer.string[range->start] != seek_to_this) { @@ -972,13 +972,12 @@ extern "C" { #endif // _di_f_string_dynamic_seek_to_ #ifndef _di_f_string_dynamic_terminate_ - f_status_t f_string_dynamic_terminate(f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_terminate(f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); - if (destination->used > destination->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!destination->used && destination->size && !destination->string[destination->used - 1]) { + if (destination->used && !destination->string[destination->used - 1]) { return F_none; } @@ -1001,10 +1000,9 @@ extern "C" { #endif // _di_f_string_dynamic_terminate_ #ifndef _di_f_string_dynamic_terminate_after_ - f_status_t f_string_dynamic_terminate_after(f_string_dynamic_t *destination) { + f_status_t f_string_dynamic_terminate_after(f_string_dynamic_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); - if (destination->used > destination->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (destination->used) { @@ -1032,7 +1030,7 @@ extern "C" { #endif // _di_f_string_dynamic_terminate_after_ #ifndef _di_f_string_dynamics_adjust_ - f_status_t f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t *dynamics) { + f_status_t f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t * const dynamics) { #ifndef _di_level_0_parameter_checking_ if (!dynamics) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -1056,7 +1054,7 @@ extern "C" { #endif // _di_f_string_dynamics_append_ #ifndef _di_f_string_dynamics_decimate_by_ - f_status_t f_string_dynamics_decimate_by(const f_array_length_t amount, f_string_dynamics_t *dynamics) { + f_status_t f_string_dynamics_decimate_by(const f_array_length_t amount, f_string_dynamics_t * const dynamics) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!dynamics) return F_status_set_error(F_parameter); @@ -1071,7 +1069,7 @@ extern "C" { #endif // _di_f_string_dynamics_decimate_by_ #ifndef _di_f_string_dynamics_decrease_by_ - f_status_t f_string_dynamics_decrease_by(const f_array_length_t amount, f_string_dynamics_t *dynamics) { + f_status_t f_string_dynamics_decrease_by(const f_array_length_t amount, f_string_dynamics_t * const dynamics) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!dynamics) return F_status_set_error(F_parameter); @@ -1086,7 +1084,7 @@ extern "C" { #endif // _di_f_string_dynamics_decrease_by_ #ifndef _di_f_string_dynamics_increase_ - f_status_t f_string_dynamics_increase(const uint16_t step, f_string_dynamics_t *dynamics) { + f_status_t f_string_dynamics_increase(const uint16_t step, f_string_dynamics_t * const dynamics) { #ifndef _di_level_0_parameter_checking_ if (!step) return F_status_set_error(F_parameter); if (!dynamics) return F_status_set_error(F_parameter); @@ -1111,7 +1109,7 @@ extern "C" { #endif // _di_f_string_dynamics_increase_ #ifndef _di_f_string_dynamics_increase_by_ - f_status_t f_string_dynamics_increase_by(const f_array_length_t amount, f_string_dynamics_t *dynamics) { + f_status_t f_string_dynamics_increase_by(const f_array_length_t amount, f_string_dynamics_t * const dynamics) { #ifndef _di_level_0_parameter_checking_ if (!dynamics) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -1129,7 +1127,7 @@ extern "C" { #endif // _di_f_string_dynamics_increase_by_ #ifndef _di_f_string_dynamics_resize_ - f_status_t f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t *dynamics) { + f_status_t f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t * const dynamics) { #ifndef _di_level_0_parameter_checking_ if (!dynamics) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string_dynamic.h b/level_0/f_string/c/string_dynamic.h index 1f9c4ab..48c6175 100644 --- a/level_0/f_string/c/string_dynamic.h +++ b/level_0/f_string/c/string_dynamic.h @@ -627,7 +627,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -635,7 +635,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_append_ - extern f_status_t f_string_dynamic_append(const f_string_dynamic_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_append(const f_string_dynamic_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_append_ /** @@ -648,7 +648,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -656,7 +656,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_append_assure_ - extern f_status_t f_string_dynamic_append_assure(const f_string_static_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_append_assure(const f_string_static_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_append_assure_ /** @@ -671,7 +671,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -679,7 +679,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_append_assure_nulless_ - extern f_status_t f_string_dynamic_append_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_append_assure_nulless(const f_string_static_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_append_assure_nulless_ /** @@ -694,7 +694,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -702,7 +702,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_append_nulless_ - extern f_status_t f_string_dynamic_append_nulless(const f_string_static_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_append_nulless(const f_string_static_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_append_nulless_ /** @@ -794,7 +794,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -802,7 +802,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_mash_ - extern f_status_t f_string_dynamic_mash(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_mash(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_mash_ /** @@ -821,7 +821,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -829,7 +829,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_mash_nulless_ - extern f_status_t f_string_dynamic_mash_nulless(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_mash_nulless(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_mash_nulless_ /** @@ -846,7 +846,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -854,7 +854,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_mish_ - extern f_status_t f_string_dynamic_mish(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_mish(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_mish_ /** @@ -873,7 +873,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -881,7 +881,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_mish_nulless_ - extern f_status_t f_string_dynamic_mish_nulless(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_mish_nulless(const f_string_static_t glue, const f_string_static_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_mish_nulless_ /** @@ -896,7 +896,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -905,7 +905,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_append_ - extern f_status_t f_string_dynamic_partial_append(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_append(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_append_ /** @@ -922,7 +922,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -931,7 +931,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_append_assure_ - extern f_status_t f_string_dynamic_partial_append_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_append_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_append_assure_ /** @@ -950,7 +950,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -959,7 +959,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_append_assure_nulless_ - extern f_status_t f_string_dynamic_partial_append_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_append_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_append_assure_nulless_ /** @@ -976,7 +976,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -985,7 +985,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_append_nulless_ - extern f_status_t f_string_dynamic_partial_append_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_append_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_append_nulless_ /** @@ -1004,7 +1004,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1013,7 +1013,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_mash_ - extern f_status_t f_string_dynamic_partial_mash(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_mash(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_mash_ /** @@ -1034,7 +1034,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1043,7 +1043,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_mash_nulless_ - extern f_status_t f_string_dynamic_partial_mash_nulless(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_mash_nulless(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_mash_nulless_ /** @@ -1062,7 +1062,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1071,7 +1071,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_mish_ - extern f_status_t f_string_dynamic_partial_mish(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_mish(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_mish_ /** @@ -1092,7 +1092,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1101,7 +1101,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_mish_nulless_ - extern f_status_t f_string_dynamic_partial_mish_nulless(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_mish_nulless(const f_string_static_t glue, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_mish_nulless_ /** @@ -1118,7 +1118,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1127,7 +1127,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_prepend_ - extern f_status_t f_string_dynamic_partial_prepend(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_prepend(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_prepend_ /** @@ -1146,7 +1146,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1155,7 +1155,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_prepend_assure_ - extern f_status_t f_string_dynamic_partial_prepend_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_prepend_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_prepend_assure_ /** @@ -1174,7 +1174,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1183,7 +1183,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_prepend_assure_nulless_ - extern f_status_t f_string_dynamic_partial_prepend_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_prepend_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_prepend_assure_nulless_ /** @@ -1200,7 +1200,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1209,7 +1209,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_partial_prepend_nulless_ - extern f_status_t f_string_dynamic_partial_prepend_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_partial_prepend_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_partial_prepend_nulless_ /** @@ -1224,7 +1224,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1233,7 +1233,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_prepend_ - extern f_status_t f_string_dynamic_prepend(const f_string_static_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_prepend(const f_string_static_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_prepend_ /** @@ -1250,7 +1250,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1259,7 +1259,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_prepend_assure_ - extern f_status_t f_string_dynamic_prepend_assure(const f_string_static_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_prepend_assure(const f_string_static_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_prepend_assure_ /** @@ -1276,7 +1276,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1285,7 +1285,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_prepend_assure_nulless_ - extern f_status_t f_string_dynamic_prepend_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_prepend_assure_nulless(const f_string_static_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_prepend_assure_nulless_ /** @@ -1300,7 +1300,7 @@ extern "C" { * * @return * F_none on success. - * F_data_not_eos if source length is 0. + * F_data_not if source length is 0. * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1309,7 +1309,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_prepend_nulless_ - extern f_status_t f_string_dynamic_prepend_nulless(const f_string_static_t source, f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_prepend_nulless(const f_string_static_t source, f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_prepend_nulless_ /** @@ -1344,7 +1344,7 @@ extern "C" { * F_none on success. * F_none_eos on success, but stopped at end of string. * F_none_stop on success, but stopped at end of range. - * F_data_not_eos on success, but there was no string data to seek. + * F_data_not on success, but there was no string data to seek. * F_data_not_stop on success, but the range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1370,7 +1370,7 @@ extern "C" { * F_none on success. * F_none_eos on success, but stopped at end of string. * F_none_stop on success, but stopped at end of range. - * F_data_not_eos on success, but there was no string data to seek. + * F_data_not on success, but there was no string data to seek. * F_data_not_stop on success, but the range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1396,7 +1396,7 @@ extern "C" { * F_none on success. * F_none_eos on success, but stopped at end of string. * F_none_stop on success, but stopped at end of range. - * F_data_not_eos on success, but there was no string data to seek. + * F_data_not on success, but there was no string data to seek. * F_data_not_stop on success, but the range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. @@ -1427,7 +1427,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_terminate_ - extern f_status_t f_string_dynamic_terminate(f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_terminate(f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_terminate_ /** @@ -1452,7 +1452,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_terminate_after_ - extern f_status_t f_string_dynamic_terminate_after(f_string_dynamic_t *destination); + extern f_status_t f_string_dynamic_terminate_after(f_string_dynamic_t * const destination); #endif // _di_f_string_dynamic_terminate_after_ /** @@ -1471,7 +1471,7 @@ extern "C" { * Errors (with error bit) from: f_memory_adjust(). */ #ifndef _di_f_string_dynamics_adjust_ - extern f_status_t f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t *dynamics); + extern f_status_t f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t * const dynamics); #endif // _di_f_string_dynamics_adjust_ /** @@ -1516,7 +1516,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamics_decimate_by_ - extern f_status_t f_string_dynamics_decimate_by(const f_array_length_t amount, f_string_dynamics_t *dynamics); + extern f_status_t f_string_dynamics_decimate_by(const f_array_length_t amount, f_string_dynamics_t * const dynamics); #endif // _di_f_string_dynamics_decimate_by_ /** @@ -1540,7 +1540,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamics_decrease_by_ - extern f_status_t f_string_dynamics_decrease_by(const f_array_length_t amount, f_string_dynamics_t *dynamics); + extern f_status_t f_string_dynamics_decrease_by(const f_array_length_t amount, f_string_dynamics_t * const dynamics); #endif // _di_f_string_dynamics_decrease_by_ /** @@ -1565,7 +1565,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamics_increase_ - extern f_status_t f_string_dynamics_increase(const uint16_t step, f_string_dynamics_t *dynamics); + extern f_status_t f_string_dynamics_increase(const uint16_t step, f_string_dynamics_t * const dynamics); #endif // _di_f_string_dynamics_increase_ /** @@ -1590,7 +1590,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamics_increase_by_ - extern f_status_t f_string_dynamics_increase_by(const f_array_length_t amount, f_string_dynamics_t *dynamics); + extern f_status_t f_string_dynamics_increase_by(const f_array_length_t amount, f_string_dynamics_t * const dynamics); #endif // _di_f_string_dynamics_increase_by_ /** @@ -1609,7 +1609,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamics_resize_ - extern f_status_t f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t *dynamics); + extern f_status_t f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t * const dynamics); #endif // _di_f_string_dynamics_resize_ #ifdef __cplusplus diff --git a/level_0/f_string/c/string_map.c b/level_0/f_string/c/string_map.c index b9541de..ce80853 100644 --- a/level_0/f_string/c/string_map.c +++ b/level_0/f_string/c/string_map.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_f_string_map_multis_adjust_ - f_status_t f_string_map_multis_adjust(const f_array_length_t length, f_string_map_multis_t *map_multis) { + f_status_t f_string_map_multis_adjust(const f_array_length_t length, f_string_map_multis_t * const map_multis) { #ifndef _di_level_0_parameter_checking_ if (!map_multis) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -16,7 +16,7 @@ extern "C" { #endif // _di_f_string_map_multis_adjust_ #ifndef _di_f_string_map_multis_append_ - f_status_t f_string_map_multis_append(const f_string_map_multis_t source, f_string_map_multis_t *destination) { + f_status_t f_string_map_multis_append(const f_string_map_multis_t source, f_string_map_multis_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -49,7 +49,7 @@ extern "C" { #endif // _di_f_string_map_multis_append_ #ifndef _di_f_string_map_multis_decimate_by_ - f_status_t f_string_map_multis_decimate_by(const f_array_length_t amount, f_string_map_multis_t *map_multis) { + f_status_t f_string_map_multis_decimate_by(const f_array_length_t amount, f_string_map_multis_t * const map_multis) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!map_multis) return F_status_set_error(F_parameter); @@ -64,7 +64,7 @@ extern "C" { #endif // _di_f_string_map_multis_decimate_by_ #ifndef _di_f_string_map_multis_decrease_by_ - f_status_t f_string_map_multis_decrease_by(const f_array_length_t amount, f_string_map_multis_t *map_multis) { + f_status_t f_string_map_multis_decrease_by(const f_array_length_t amount, f_string_map_multis_t * const map_multis) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!map_multis) return F_status_set_error(F_parameter); @@ -79,7 +79,7 @@ extern "C" { #endif // _di_f_string_map_multis_decrease_by_ #ifndef _di_f_string_map_multis_increase_ - f_status_t f_string_map_multis_increase(const uint16_t step, f_string_map_multis_t *map_multis) { + f_status_t f_string_map_multis_increase(const uint16_t step, f_string_map_multis_t * const map_multis) { #ifndef _di_level_0_parameter_checking_ if (!step) return F_status_set_error(F_parameter); if (!map_multis) return F_status_set_error(F_parameter); @@ -104,7 +104,7 @@ extern "C" { #endif // _di_f_string_map_multis_increase_ #ifndef _di_f_string_map_multis_increase_by_ - f_status_t f_string_map_multis_increase_by(const f_array_length_t amount, f_string_map_multis_t *map_multis) { + f_status_t f_string_map_multis_increase_by(const f_array_length_t amount, f_string_map_multis_t * const map_multis) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!map_multis) return F_status_set_error(F_parameter); @@ -123,7 +123,7 @@ extern "C" { #endif // _di_f_string_map_multis_increase_by_ #ifndef _di_f_string_map_multis_resize_ - f_status_t f_string_map_multis_resize(const f_array_length_t length, f_string_map_multis_t *map_multis) { + f_status_t f_string_map_multis_resize(const f_array_length_t length, f_string_map_multis_t * const map_multis) { #ifndef _di_level_0_parameter_checking_ if (!map_multis) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -133,7 +133,7 @@ extern "C" { #endif // _di_f_string_map_multis_resize_ #ifndef _di_f_string_maps_adjust_ - f_status_t f_string_maps_adjust(const f_array_length_t length, f_string_maps_t *maps) { + f_status_t f_string_maps_adjust(const f_array_length_t length, f_string_maps_t * const maps) { #ifndef _di_level_0_parameter_checking_ if (!maps) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -143,7 +143,7 @@ extern "C" { #endif // _di_f_string_maps_adjust_ #ifndef _di_f_string_maps_append_ - f_status_t f_string_maps_append(const f_string_maps_t source, f_string_maps_t *destination) { + f_status_t f_string_maps_append(const f_string_maps_t source, f_string_maps_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -178,7 +178,7 @@ extern "C" { #endif // _di_f_string_maps_append_ #ifndef _di_f_string_maps_decimate_by_ - f_status_t f_string_maps_decimate_by(const f_array_length_t amount, f_string_maps_t *maps) { + f_status_t f_string_maps_decimate_by(const f_array_length_t amount, f_string_maps_t * const maps) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!maps) return F_status_set_error(F_parameter); @@ -193,7 +193,7 @@ extern "C" { #endif // _di_f_string_maps_decimate_by_ #ifndef _di_f_string_maps_decrease_by_ - f_status_t f_string_maps_decrease_by(const f_array_length_t amount, f_string_maps_t *maps) { + f_status_t f_string_maps_decrease_by(const f_array_length_t amount, f_string_maps_t * const maps) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!maps) return F_status_set_error(F_parameter); @@ -208,7 +208,7 @@ extern "C" { #endif // _di_f_string_maps_decrease_by_ #ifndef _di_f_string_maps_increase_ - f_status_t f_string_maps_increase(const uint16_t step, f_string_maps_t *maps) { + f_status_t f_string_maps_increase(const uint16_t step, f_string_maps_t * const maps) { #ifndef _di_level_0_parameter_checking_ if (!step) return F_status_set_error(F_parameter); if (!maps) return F_status_set_error(F_parameter); @@ -233,7 +233,7 @@ extern "C" { #endif // _di_f_string_maps_increase_ #ifndef _di_f_string_maps_increase_by_ - f_status_t f_string_maps_increase_by(const f_array_length_t amount, f_string_maps_t *maps) { + f_status_t f_string_maps_increase_by(const f_array_length_t amount, f_string_maps_t * const maps) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!maps) return F_status_set_error(F_parameter); @@ -252,7 +252,7 @@ extern "C" { #endif // _di_f_string_maps_increase_by_ #ifndef _di_f_string_maps_resize_ - f_status_t f_string_maps_resize(const f_array_length_t length, f_string_maps_t *maps) { + f_status_t f_string_maps_resize(const f_array_length_t length, f_string_maps_t * const maps) { #ifndef _di_level_0_parameter_checking_ if (!maps) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string_map.h b/level_0/f_string/c/string_map.h index 08ee703..e3bbd46 100644 --- a/level_0/f_string/c/string_map.h +++ b/level_0/f_string/c/string_map.h @@ -148,7 +148,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_map_multis_adjust_ - extern f_status_t f_string_map_multis_adjust(const f_array_length_t length, f_string_map_multis_t *map_multis); + extern f_status_t f_string_map_multis_adjust(const f_array_length_t length, f_string_map_multis_t * const map_multis); #endif // _di_f_string_map_multis_adjust_ /** @@ -192,7 +192,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_map_multis_decimate_by_ - extern f_status_t f_string_map_multis_decimate_by(const f_array_length_t amount, f_string_map_multis_t *map_multis); + extern f_status_t f_string_map_multis_decimate_by(const f_array_length_t amount, f_string_map_multis_t * const map_multis); #endif // _di_f_string_map_multis_decimate_by_ /** @@ -215,7 +215,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_map_multis_decrease_by_ - extern f_status_t f_string_map_multis_decrease_by(const f_array_length_t amount, f_string_map_multis_t *map_multis); + extern f_status_t f_string_map_multis_decrease_by(const f_array_length_t amount, f_string_map_multis_t * const map_multis); #endif // _di_f_string_map_multis_decrease_by_ /** @@ -240,7 +240,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_map_multis_increase_ - extern f_status_t f_string_map_multis_increase(const uint16_t step, f_string_map_multis_t *map_multis); + extern f_status_t f_string_map_multis_increase(const uint16_t step, f_string_map_multis_t * const map_multis); #endif // _di_f_string_map_multis_increase_ /** @@ -265,7 +265,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_map_multis_increase_by_ - extern f_status_t f_string_map_multis_increase_by(const f_array_length_t amount, f_string_map_multis_t *map_multis); + extern f_status_t f_string_map_multis_increase_by(const f_array_length_t amount, f_string_map_multis_t * const map_multis); #endif // _di_f_string_map_multis_increase_by_ /** @@ -284,7 +284,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_map_multis_resize_ - extern f_status_t f_string_map_multis_resize(const f_array_length_t length, f_string_map_multis_t *map_multis); + extern f_status_t f_string_map_multis_resize(const f_array_length_t length, f_string_map_multis_t * const map_multis); #endif // _di_f_string_map_multis_resize_ /** @@ -303,7 +303,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_maps_adjust_ - extern f_status_t f_string_maps_adjust(const f_array_length_t length, f_string_maps_t *maps); + extern f_status_t f_string_maps_adjust(const f_array_length_t length, f_string_maps_t * const maps); #endif // _di_f_string_maps_adjust_ /** @@ -324,7 +324,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_maps_append_ - extern f_status_t f_string_maps_append(const f_string_maps_t source, f_string_maps_t *destination); + extern f_status_t f_string_maps_append(const f_string_maps_t source, f_string_maps_t * const destination); #endif // _di_f_string_maps_append_ /** @@ -347,7 +347,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_maps_decimate_by_ - extern f_status_t f_string_maps_decimate_by(const f_array_length_t amount, f_string_maps_t *maps); + extern f_status_t f_string_maps_decimate_by(const f_array_length_t amount, f_string_maps_t * const maps); #endif // _di_f_string_maps_decimate_by_ /** @@ -370,7 +370,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_maps_decrease_by_ - extern f_status_t f_string_maps_decrease_by(const f_array_length_t amount, f_string_maps_t *maps); + extern f_status_t f_string_maps_decrease_by(const f_array_length_t amount, f_string_maps_t * const maps); #endif // _di_f_string_maps_decrease_by_ /** @@ -395,7 +395,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_maps_increase_ - extern f_status_t f_string_maps_increase(const uint16_t step, f_string_maps_t *maps); + extern f_status_t f_string_maps_increase(const uint16_t step, f_string_maps_t * const maps); #endif // _di_f_string_maps_increase_ /** @@ -420,7 +420,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_maps_increase_by_ - extern f_status_t f_string_maps_increase_by(const f_array_length_t amount, f_string_maps_t *maps); + extern f_status_t f_string_maps_increase_by(const f_array_length_t amount, f_string_maps_t * const maps); #endif // _di_f_string_maps_increase_by_ /** @@ -439,7 +439,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_maps_resize_ - extern f_status_t f_string_maps_resize(const f_array_length_t length, f_string_maps_t *maps); + extern f_status_t f_string_maps_resize(const f_array_length_t length, f_string_maps_t * const maps); #endif // _di_f_string_maps_resize_ #ifdef __cplusplus diff --git a/level_0/f_string/c/string_quantity.c b/level_0/f_string/c/string_quantity.c index c39d998..00d3381 100644 --- a/level_0/f_string/c/string_quantity.c +++ b/level_0/f_string/c/string_quantity.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_f_string_quantitys_adjust_ - f_status_t f_string_quantitys_adjust(const f_array_length_t length, f_string_quantitys_t *quantitys) { + f_status_t f_string_quantitys_adjust(const f_array_length_t length, f_string_quantitys_t * const quantitys) { #ifndef _di_level_0_parameter_checking_ if (!quantitys) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -43,7 +43,7 @@ extern "C" { #endif // _di_f_string_quantitys_append_ #ifndef _di_f_string_quantitys_decimate_by_ - f_status_t f_string_quantitys_decimate_by(const f_array_length_t amount, f_string_quantitys_t *quantitys) { + f_status_t f_string_quantitys_decimate_by(const f_array_length_t amount, f_string_quantitys_t * const quantitys) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!quantitys) return F_status_set_error(F_parameter); @@ -58,7 +58,7 @@ extern "C" { #endif // _di_f_string_quantitys_decimate_by_ #ifndef _di_f_string_quantitys_decrease_by_ - f_status_t f_string_quantitys_decrease_by(const f_array_length_t amount, f_string_quantitys_t *quantitys) { + f_status_t f_string_quantitys_decrease_by(const f_array_length_t amount, f_string_quantitys_t * const quantitys) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!quantitys) return F_status_set_error(F_parameter); @@ -73,7 +73,7 @@ extern "C" { #endif // _di_f_string_quantitys_decrease_by_ #ifndef _di_f_string_quantitys_increase_ - f_status_t f_string_quantitys_increase(const uint16_t step, f_string_quantitys_t *quantitys) { + f_status_t f_string_quantitys_increase(const uint16_t step, f_string_quantitys_t * const quantitys) { #ifndef _di_level_0_parameter_checking_ if (!step) return F_status_set_error(F_parameter); if (!quantitys) return F_status_set_error(F_parameter); @@ -98,7 +98,7 @@ extern "C" { #endif // _di_f_string_quantitys_increase_ #ifndef _di_f_string_quantitys_increase_by_ - f_status_t f_string_quantitys_increase_by(const f_array_length_t amount, f_string_quantitys_t *quantitys) { + f_status_t f_string_quantitys_increase_by(const f_array_length_t amount, f_string_quantitys_t * const quantitys) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!quantitys) return F_status_set_error(F_parameter); @@ -117,7 +117,7 @@ extern "C" { #endif // _di_f_string_quantitys_increase_by_ #ifndef _di_f_string_quantitys_resize_ - f_status_t f_string_quantitys_resize(const f_array_length_t length, f_string_quantitys_t *quantitys) { + f_status_t f_string_quantitys_resize(const f_array_length_t length, f_string_quantitys_t * const quantitys) { #ifndef _di_level_0_parameter_checking_ if (!quantitys) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -137,7 +137,7 @@ extern "C" { #endif // _di_f_string_quantityss_adjust_ #ifndef _di_f_string_quantityss_decimate_by_ - f_status_t f_string_quantityss_decimate_by(const f_array_length_t amount, f_string_quantityss_t *quantityss) { + f_status_t f_string_quantityss_decimate_by(const f_array_length_t amount, f_string_quantityss_t * const quantityss) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!quantityss) return F_status_set_error(F_parameter); @@ -152,7 +152,7 @@ extern "C" { #endif // _di_f_string_quantityss_decimate_by_ #ifndef _di_f_string_quantityss_decrease_by_ - f_status_t f_string_quantityss_decrease_by(const f_array_length_t amount, f_string_quantityss_t *quantityss) { + f_status_t f_string_quantityss_decrease_by(const f_array_length_t amount, f_string_quantityss_t * const quantityss) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!quantityss) return F_status_set_error(F_parameter); @@ -167,7 +167,7 @@ extern "C" { #endif // _di_f_string_quantityss_decrease_by_ #ifndef _di_f_string_quantityss_increase_ - f_status_t f_string_quantityss_increase(const uint16_t step, f_string_quantityss_t *quantityss) { + f_status_t f_string_quantityss_increase(const uint16_t step, f_string_quantityss_t * const quantityss) { #ifndef _di_level_0_parameter_checking_ if (!step) return F_status_set_error(F_parameter); if (!quantityss) return F_status_set_error(F_parameter); @@ -192,7 +192,7 @@ extern "C" { #endif // _di_f_string_quantityss_increase_ #ifndef _di_f_string_quantityss_increase_by_ - f_status_t f_string_quantityss_increase_by(const f_array_length_t amount, f_string_quantityss_t *quantityss) { + f_status_t f_string_quantityss_increase_by(const f_array_length_t amount, f_string_quantityss_t * const quantityss) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!quantityss) return F_status_set_error(F_parameter); @@ -211,7 +211,7 @@ extern "C" { #endif // _di_f_string_quantityss_increase_by_ #ifndef _di_f_string_quantityss_resize_ - f_status_t f_string_quantityss_resize(const f_array_length_t length, f_string_quantityss_t *quantityss) { + f_status_t f_string_quantityss_resize(const f_array_length_t length, f_string_quantityss_t * const quantityss) { #ifndef _di_level_0_parameter_checking_ if (!quantityss) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string_quantity.h b/level_0/f_string/c/string_quantity.h index 0516e1f..19bce66 100644 --- a/level_0/f_string/c/string_quantity.h +++ b/level_0/f_string/c/string_quantity.h @@ -115,7 +115,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantitys_adjust_ - extern f_status_t f_string_quantitys_adjust(const f_array_length_t length, f_string_quantitys_t *quantitys); + extern f_status_t f_string_quantitys_adjust(const f_array_length_t length, f_string_quantitys_t * const quantitys); #endif // _di_f_string_quantitys_adjust_ /** @@ -135,7 +135,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantitys_append_ - extern f_status_t f_string_quantitys_append(const f_string_quantitys_t source, f_string_quantitys_t *destination); + extern f_status_t f_string_quantitys_append(const f_string_quantitys_t source, f_string_quantitys_t * const destination); #endif // _di_f_string_quantitys_append_ /** @@ -158,7 +158,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantitys_decimate_by_ - extern f_status_t f_string_quantitys_decimate_by(const f_array_length_t amount, f_string_quantitys_t *quantitys); + extern f_status_t f_string_quantitys_decimate_by(const f_array_length_t amount, f_string_quantitys_t * const quantitys); #endif // _di_f_string_quantitys_decimate_by_ /** @@ -181,7 +181,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantitys_decrease_by_ - extern f_status_t f_string_quantitys_decrease_by(const f_array_length_t amount, f_string_quantitys_t *quantitys); + extern f_status_t f_string_quantitys_decrease_by(const f_array_length_t amount, f_string_quantitys_t * const quantitys); #endif // _di_f_string_quantitys_decrease_by_ /** @@ -205,7 +205,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantitys_increase_ - extern f_status_t f_string_quantitys_increase(const uint16_t step, f_string_quantitys_t *quantitys); + extern f_status_t f_string_quantitys_increase(const uint16_t step, f_string_quantitys_t * const quantitys); #endif // _di_f_string_quantitys_increase_ /** @@ -229,7 +229,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantitys_increase_by_ - extern f_status_t f_string_quantitys_increase_by(const f_array_length_t amount, f_string_quantitys_t *quantitys); + extern f_status_t f_string_quantitys_increase_by(const f_array_length_t amount, f_string_quantitys_t * const quantitys); #endif // _di_f_string_quantitys_increase_by_ /** @@ -248,7 +248,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantitys_resize_ - extern f_status_t f_string_quantitys_resize(const f_array_length_t length, f_string_quantitys_t *quantitys); + extern f_status_t f_string_quantitys_resize(const f_array_length_t length, f_string_quantitys_t * const quantitys); #endif // _di_f_string_quantitys_resize_ /** @@ -267,7 +267,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantityss_adjust_ - extern f_status_t f_string_quantityss_adjust(const f_array_length_t length, f_string_quantityss_t *quantityss); + extern f_status_t f_string_quantityss_adjust(const f_array_length_t length, f_string_quantityss_t * const quantityss); #endif // _di_f_string_quantityss_adjust_ /** @@ -290,7 +290,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantityss_decimate_by_ - extern f_status_t f_string_quantityss_decimate_by(const f_array_length_t amount, f_string_quantityss_t *quantityss); + extern f_status_t f_string_quantityss_decimate_by(const f_array_length_t amount, f_string_quantityss_t * const quantityss); #endif // _di_f_string_quantityss_decimate_by_ /** @@ -313,7 +313,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantityss_decrease_by_ - extern f_status_t f_string_quantityss_decrease_by(const f_array_length_t amount, f_string_quantityss_t *quantityss); + extern f_status_t f_string_quantityss_decrease_by(const f_array_length_t amount, f_string_quantityss_t * const quantityss); #endif // _di_f_string_quantityss_decrease_by_ /** @@ -338,7 +338,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantityss_increase_ - extern f_status_t f_string_quantityss_increase(const uint16_t step, f_string_quantityss_t *quantityss); + extern f_status_t f_string_quantityss_increase(const uint16_t step, f_string_quantityss_t * const quantityss); #endif // _di_f_string_quantityss_increase_ /** @@ -363,7 +363,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantityss_increase_by_ - extern f_status_t f_string_quantityss_increase_by(const f_array_length_t amount, f_string_quantityss_t *quantityss); + extern f_status_t f_string_quantityss_increase_by(const f_array_length_t amount, f_string_quantityss_t * const quantityss); #endif // _di_f_string_quantityss_increase_by_ /** @@ -382,7 +382,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantityss_resize_ - extern f_status_t f_string_quantityss_resize(const f_array_length_t length, f_string_quantityss_t *quantityss); + extern f_status_t f_string_quantityss_resize(const f_array_length_t length, f_string_quantityss_t * const quantityss); #endif // _di_f_string_quantityss_resize_ #ifdef __cplusplus diff --git a/level_0/f_string/c/string_range.c b/level_0/f_string/c/string_range.c index 11d94f7..7aaa09e 100644 --- a/level_0/f_string/c/string_range.c +++ b/level_0/f_string/c/string_range.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_f_string_ranges_adjust_ - f_status_t f_string_ranges_adjust(const f_array_length_t length, f_string_ranges_t *ranges) { + f_status_t f_string_ranges_adjust(const f_array_length_t length, f_string_ranges_t * const ranges) { #ifndef _di_level_0_parameter_checking_ if (!ranges) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -16,7 +16,7 @@ extern "C" { #endif // _di_f_string_ranges_adjust_ #ifndef _di_f_string_ranges_append_ - f_status_t f_string_ranges_append(const f_string_ranges_t source, f_string_ranges_t *destination) { + f_status_t f_string_ranges_append(const f_string_ranges_t source, f_string_ranges_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -43,7 +43,7 @@ extern "C" { #endif // _di_f_string_ranges_append_ #ifndef _di_f_string_ranges_decimate_by_ - f_status_t f_string_ranges_decimate_by(const f_array_length_t amount, f_string_ranges_t *ranges) { + f_status_t f_string_ranges_decimate_by(const f_array_length_t amount, f_string_ranges_t * const ranges) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!ranges) return F_status_set_error(F_parameter); @@ -58,7 +58,7 @@ extern "C" { #endif // _di_f_string_ranges_decimate_by_ #ifndef _di_f_string_ranges_decrease_by_ - f_status_t f_string_ranges_decrease_by(const f_array_length_t amount, f_string_ranges_t *ranges) { + f_status_t f_string_ranges_decrease_by(const f_array_length_t amount, f_string_ranges_t * const ranges) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!ranges) return F_status_set_error(F_parameter); @@ -73,7 +73,7 @@ extern "C" { #endif // _di_f_string_ranges_decrease_by_ #ifndef _di_f_string_ranges_increase_ - f_status_t f_string_ranges_increase(const uint16_t step, f_string_ranges_t *ranges) { + f_status_t f_string_ranges_increase(const uint16_t step, f_string_ranges_t * const ranges) { #ifndef _di_level_0_parameter_checking_ if (!step) return F_status_set_error(F_parameter); if (!ranges) return F_status_set_error(F_parameter); @@ -98,7 +98,7 @@ extern "C" { #endif // _di_f_string_ranges_increase_ #ifndef _di_f_string_ranges_increase_by_ - f_status_t f_string_ranges_increase_by(const f_array_length_t amount, f_string_ranges_t *ranges) { + f_status_t f_string_ranges_increase_by(const f_array_length_t amount, f_string_ranges_t * const ranges) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!ranges) return F_status_set_error(F_parameter); @@ -117,7 +117,7 @@ extern "C" { #endif // _di_f_string_ranges_increase_by_ #ifndef _di_f_string_ranges_resize_ - f_status_t f_string_ranges_resize(const f_array_length_t length, f_string_ranges_t *ranges) { + f_status_t f_string_ranges_resize(const f_array_length_t length, f_string_ranges_t * const ranges) { #ifndef _di_level_0_parameter_checking_ if (!ranges) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -127,7 +127,7 @@ extern "C" { #endif // _di_f_string_ranges_resize_ #ifndef _di_f_string_rangess_adjust_ - f_status_t f_string_rangess_adjust(const f_array_length_t length, f_string_rangess_t *rangess) { + f_status_t f_string_rangess_adjust(const f_array_length_t length, f_string_rangess_t * const rangess) { #ifndef _di_level_0_parameter_checking_ if (!rangess) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -137,7 +137,7 @@ extern "C" { #endif // _di_f_string_rangess_adjust_ #ifndef _di_f_string_rangess_decimate_by_ - f_status_t f_string_rangess_decimate_by(const f_array_length_t amount, f_string_rangess_t *rangess) { + f_status_t f_string_rangess_decimate_by(const f_array_length_t amount, f_string_rangess_t * const rangess) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!rangess) return F_status_set_error(F_parameter); @@ -152,7 +152,7 @@ extern "C" { #endif // _di_f_string_rangess_decimate_by_ #ifndef _di_f_string_rangess_decrease_by_ - f_status_t f_string_rangess_decrease_by(const f_array_length_t amount, f_string_rangess_t *rangess) { + f_status_t f_string_rangess_decrease_by(const f_array_length_t amount, f_string_rangess_t * const rangess) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!rangess) return F_status_set_error(F_parameter); @@ -167,7 +167,7 @@ extern "C" { #endif // _di_f_string_rangess_decrease_by_ #ifndef _di_f_string_rangess_increase_ - f_status_t f_string_rangess_increase(const uint16_t step, f_string_rangess_t *rangess) { + f_status_t f_string_rangess_increase(const uint16_t step, f_string_rangess_t * const rangess) { #ifndef _di_level_0_parameter_checking_ if (!step) return F_status_set_error(F_parameter); if (!rangess) return F_status_set_error(F_parameter); @@ -192,7 +192,7 @@ extern "C" { #endif // _di_f_string_rangess_increase_ #ifndef _di_f_string_rangess_increase_by_ - f_status_t f_string_rangess_increase_by(const f_array_length_t amount, f_string_rangess_t *rangess) { + f_status_t f_string_rangess_increase_by(const f_array_length_t amount, f_string_rangess_t * const rangess) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!rangess) return F_status_set_error(F_parameter); @@ -211,7 +211,7 @@ extern "C" { #endif // _di_f_string_rangess_increase_by_ #ifndef _di_f_string_rangess_resize_ - f_status_t f_string_rangess_resize(const f_array_length_t length, f_string_rangess_t *rangess) { + f_status_t f_string_rangess_resize(const f_array_length_t length, f_string_rangess_t * const rangess) { #ifndef _di_level_0_parameter_checking_ if (!rangess) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string_triple.c b/level_0/f_string/c/string_triple.c index cc540da..cbde60c 100644 --- a/level_0/f_string/c/string_triple.c +++ b/level_0/f_string/c/string_triple.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_f_string_triples_adjust_ - f_status_t f_string_triples_adjust(const f_array_length_t length, f_string_triples_t *triples) { + f_status_t f_string_triples_adjust(const f_array_length_t length, f_string_triples_t * const triples) { #ifndef _di_level_0_parameter_checking_ if (!triples) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -16,7 +16,7 @@ extern "C" { #endif // _di_f_string_triples_adjust_ #ifndef _di_f_string_triples_append_ - f_status_t f_string_triples_append(const f_string_triples_t source, f_string_triples_t *destination) { + f_status_t f_string_triples_append(const f_string_triples_t source, f_string_triples_t * const destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -59,7 +59,7 @@ extern "C" { #endif // _di_f_string_triples_append_ #ifndef _di_f_string_triples_decimate_by_ - f_status_t f_string_triples_decimate_by(const f_array_length_t amount, f_string_triples_t *triples) { + f_status_t f_string_triples_decimate_by(const f_array_length_t amount, f_string_triples_t * const triples) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!triples) return F_status_set_error(F_parameter); @@ -74,7 +74,7 @@ extern "C" { #endif // _di_f_string_triples_decimate_by_ #ifndef _di_f_string_triples_decrease_by_ - f_status_t f_string_triples_decrease_by(const f_array_length_t amount, f_string_triples_t *triples) { + f_status_t f_string_triples_decrease_by(const f_array_length_t amount, f_string_triples_t * const triples) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!triples) return F_status_set_error(F_parameter); @@ -89,7 +89,7 @@ extern "C" { #endif // _di_f_string_triples_decrease_by_ #ifndef _di_f_string_triples_increase_ - f_status_t f_string_triples_increase(const uint16_t step, f_string_triples_t *triples) { + f_status_t f_string_triples_increase(const uint16_t step, f_string_triples_t * const triples) { #ifndef _di_level_0_parameter_checking_ if (!step) return F_status_set_error(F_parameter); if (!triples) return F_status_set_error(F_parameter); @@ -114,7 +114,7 @@ extern "C" { #endif // _di_f_string_triples_increase_ #ifndef _di_f_string_triples_increase_by_ - f_status_t f_string_triples_increase_by(const f_array_length_t amount, f_string_triples_t *triples) { + f_status_t f_string_triples_increase_by(const f_array_length_t amount, f_string_triples_t * const triples) { #ifndef _di_level_0_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!triples) return F_status_set_error(F_parameter); @@ -133,7 +133,7 @@ extern "C" { #endif // _di_f_string_triples_increase_by_ #ifndef _di_f_string_triples_resize_ - f_status_t f_string_triples_resize(const f_array_length_t length, f_string_triples_t *triples) { + f_status_t f_string_triples_resize(const f_array_length_t length, f_string_triples_t * const triples) { #ifndef _di_level_0_parameter_checking_ if (!triples) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string_triple.h b/level_0/f_string/c/string_triple.h index 24f63cd..27a0d71 100644 --- a/level_0/f_string/c/string_triple.h +++ b/level_0/f_string/c/string_triple.h @@ -100,7 +100,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_string_triples_adjust_ - extern f_status_t f_string_triples_adjust(const f_array_length_t length, f_string_triples_t *triples); + extern f_status_t f_string_triples_adjust(const f_array_length_t length, f_string_triples_t * const triples); #endif // _di_f_string_triples_adjust_ /** @@ -121,7 +121,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_triples_append_ - extern f_status_t f_string_triples_append(const f_string_triples_t source, f_string_triples_t *destination); + extern f_status_t f_string_triples_append(const f_string_triples_t source, f_string_triples_t * const destination); #endif // _di_f_string_triples_append_ /** @@ -144,7 +144,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_triples_decimate_by_ - extern f_status_t f_string_triples_decimate_by(const f_array_length_t amount, f_string_triples_t *triples); + extern f_status_t f_string_triples_decimate_by(const f_array_length_t amount, f_string_triples_t * const triples); #endif // _di_f_string_triples_decimate_by_ /** @@ -167,7 +167,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_triples_decrease_by_ - extern f_status_t f_string_triples_decrease_by(const f_array_length_t amount, f_string_triples_t *triples); + extern f_status_t f_string_triples_decrease_by(const f_array_length_t amount, f_string_triples_t * const triples); #endif // _di_f_string_triples_decrease_by_ /** @@ -192,7 +192,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_triples_increase_ - extern f_status_t f_string_triples_increase(const uint16_t step, f_string_triples_t *triples); + extern f_status_t f_string_triples_increase(const uint16_t step, f_string_triples_t * const triples); #endif // _di_f_string_triples_increase_ /** @@ -217,7 +217,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_triples_increase_by_ - extern f_status_t f_string_triples_increase_by(const f_array_length_t amount, f_string_triples_t *triples); + extern f_status_t f_string_triples_increase_by(const f_array_length_t amount, f_string_triples_t * const triples); #endif // _di_f_string_triples_increase_by_ /** @@ -236,7 +236,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_triples_resize_ - extern f_status_t f_string_triples_resize(const f_array_length_t length, f_string_triples_t *triples); + extern f_status_t f_string_triples_resize(const f_array_length_t length, f_string_triples_t * const triples); #endif // _di_f_string_triples_resize_ #ifdef __cplusplus diff --git a/level_0/f_utf/c/utf_dynamic.c b/level_0/f_utf/c/utf_dynamic.c index c38016a..c288018 100644 --- a/level_0/f_utf/c/utf_dynamic.c +++ b/level_0/f_utf/c/utf_dynamic.c @@ -829,7 +829,6 @@ extern "C" { f_status_t f_utf_string_dynamic_terminate(f_utf_string_dynamic_t *destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); - if (destination->used > destination->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!destination->used && destination->size && !destination->string[destination->used - 1]) { @@ -858,7 +857,6 @@ extern "C" { f_status_t f_utf_string_dynamic_terminate_after(f_utf_string_dynamic_t *destination) { #ifndef _di_level_0_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); - if (destination->used > destination->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (destination->used) { diff --git a/level_1/fl_environment/c/environment.c b/level_1/fl_environment/c/environment.c index fccd562..10d9608 100644 --- a/level_1/fl_environment/c/environment.c +++ b/level_1/fl_environment/c/environment.c @@ -123,16 +123,19 @@ extern "C" { paths->array[paths->used].used = 0; if (total) { - char buffer[total]; + char buffer[total + 1]; - for (j = 0, k = 0; j < total; ++j) { + for (j = first, k = 0; j < i; ++j) { - if (!path.string[first + j]) continue; + if (!path.string[j]) continue; - buffer[k++] = path.string[first + j]; + buffer[k++] = path.string[j]; } // for - buffer[k++] = f_path_separator_s.string[0]; + // Guarantee a trailing directory separator. + if (buffer[k - 1] != f_path_separator_s.string[0]) { + buffer[k++] = f_path_separator_s.string[0]; + } status = f_string_dynamic_increase_by(k, &paths->array[paths->used]); if (F_status_is_error(status)) return status; @@ -207,7 +210,10 @@ extern "C" { buffer[k++] = path.string[r + j + 1]; } // for - buffer[k++] = f_path_separator_s.string[0]; + // Guarantee a trailing directory separator. + if (buffer[k - 1] != f_path_separator_s.string[0]) { + buffer[k++] = f_path_separator_s.string[0]; + } status = f_string_dynamic_increase_by(k, &paths->array[paths->used]); if (F_status_is_error(status)) return status; diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index 77b573c..efb7cee 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -27,7 +27,10 @@ extern "C" { if (!arguments) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - const f_status_t status = private_fll_execute_arguments_add_parameter(prefix, name, value, arguments); + f_status_t status = f_string_dynamics_increase(F_memory_default_allocation_small_d, arguments); + if (F_status_is_error(status)) return status; + + status = private_fll_execute_arguments_add_parameter(prefix, name, value, arguments); if (F_status_is_error(status)) return status; return F_none; @@ -40,12 +43,11 @@ extern "C" { if (!arguments) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - f_status_t status = F_none; + f_status_t status = f_string_dynamics_increase_by(size, arguments); - for (f_array_length_t i = 0; i < size; ++i) { + for (f_array_length_t i = 0; F_status_is_error_not(status) && i < size; ++i) { status = private_fll_execute_arguments_add_parameter(prefix[i], name[i], value[i], arguments); - if (F_status_is_error(status)) return status; } // for return status; diff --git a/level_2/fll_execute/c/execute.h b/level_2/fll_execute/c/execute.h index 058593e..fa0f1bd 100644 --- a/level_2/fll_execute/c/execute.h +++ b/level_2/fll_execute/c/execute.h @@ -92,7 +92,7 @@ extern "C" { * * The arguments are only appended if the length of name and value are not 0. * - * This guarantees that an end of string exists at the end of each argument. + * This guarantees that NULL exists at the end of each argument (after the argumunets[..].used length). * This does not check for NULL characters anywhere else in the string. * * @param prefix @@ -109,12 +109,12 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate(). + * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_append() * @see f_string_dynamic_resize() - * @see f_string_dynamic_terminate() + * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() */ #ifndef _di_fll_execute_arguments_add_parameter_ @@ -130,11 +130,9 @@ extern "C" { * * The arguments are only appended if the length of name and value are not 0. * - * This guarantees that an end of string exists at the end of each argument. + * This guarantees that NULL exists at the end of each argument (after the argumunets[..].used length). * This does not check for NULL characters anywhere else in the string. * - * @todo functions like this should be changed to accept arrays of f_string_static, reducing the number of parameters passed to it. - * * @param prefix * An array of the strings prepend to the name. * @param name @@ -151,12 +149,12 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate(). + * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_append() * @see f_string_dynamic_resize() - * @see f_string_dynamic_terminate() + * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() */ #ifndef _di_fll_execute_arguments_add_parameter_set_ @@ -166,7 +164,7 @@ extern "C" { /** * Add a set of arguments to the execution arguments array. * - * This guarantees that an end of string exists at the end of the copied string. + * This guarantees that NULL exists at the end of each argument (after the argumunets[..].used length). * This does not check for NULL characters anywhere else in the string. * * @param source @@ -181,12 +179,12 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate(). + * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_append() * @see f_string_dynamic_resize() - * @see f_string_dynamic_terminate() + * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() */ #ifndef _di_fll_execute_arguments_add_set_ diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index fb195aa..16b8bc9 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -28,20 +28,15 @@ extern "C" { #if !defined(_di_fll_execute_arguments_add_parameter_) || !defined(_di_fll_execute_arguments_add_parameter_set_) f_status_t private_fll_execute_arguments_add_parameter(const f_string_static_t prefix, const f_string_static_t name, const f_string_static_t value, f_string_dynamics_t *arguments) { - f_status_t status = f_string_dynamics_increase(F_memory_default_allocation_small_d, arguments); - if (F_status_is_error(status)) return status; - arguments->array[arguments->used].used = 0; - status = f_string_dynamic_increase_by(prefix.used + name.used + 1, &arguments->array[arguments->used]); + f_status_t status = f_string_dynamic_increase_by(prefix.used + name.used + 1, &arguments->array[arguments->used]); if (F_status_is_error(status)) return status; status = f_string_dynamic_append(prefix, &arguments->array[arguments->used]); + if (F_status_is_error(status)) return status; - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate(&arguments->array[arguments->used]); - } - + status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); if (F_status_is_error(status)) return status; ++arguments->used; @@ -55,11 +50,9 @@ extern "C" { if (F_status_is_error(status)) return status; status = f_string_dynamic_append(value, &arguments->array[arguments->used]); + if (F_status_is_error(status)) return status; - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate(&arguments->array[arguments->used]); - } - + status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); if (F_status_is_error(status)) return status; ++arguments->used; diff --git a/level_2/fll_execute/c/private-execute.h b/level_2/fll_execute/c/private-execute.h index 59f6699..2e25848 100644 --- a/level_2/fll_execute/c/private-execute.h +++ b/level_2/fll_execute/c/private-execute.h @@ -61,12 +61,12 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate(). + * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_append() * @see f_string_dynamic_resize() - * @see f_string_dynamic_terminate() + * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() * @see fll_execute_arguments_add_parameter() * @see fll_execute_arguments_add_parameter_set() diff --git a/level_3/byte_dump/c/common.h b/level_3/byte_dump/c/common.h index ca3bea4..522f725 100644 --- a/level_3/byte_dump/c/common.h +++ b/level_3/byte_dump/c/common.h @@ -122,7 +122,7 @@ extern "C" { #define byte_dump_signal_check_d 10000 #define BYTE_DUMP_character_wall_s "|" - #define BYTE_DUMP_character_placeholder_s "␣" // other likely choices: (substitute form 1: '␚', substitute form 2: '␦'). + #define BYTE_DUMP_character_placeholder_s "␣" // Other likely choices: (substitute form 1: '␚', substitute form 2: '␦'). #define BYTE_DUMP_character_incomplete_s "�" #define BYTE_DUMP_character_unused_s "�" diff --git a/level_3/controller/c/rule/private-rule_print.c b/level_3/controller/c/rule/private-rule_print.c index ca70efc..18ee146 100644 --- a/level_3/controller/c/rule/private-rule_print.c +++ b/level_3/controller/c/rule/private-rule_print.c @@ -85,7 +85,7 @@ extern "C" { controller_lock_print(print->to, (controller_thread_t *) process->main_thread); - fl_print_format("%r%[%SThe %s '%]", print->to.stream, f_string_eol_s, print->context, print->prefix, script_is ? controller_script_s : controller_program_s, print->context); + fl_print_format("%r%[%QThe %r '%]", print->to.stream, f_string_eol_s, print->context, print->prefix, script_is ? controller_script_s : controller_program_s, print->context); fl_print_format("%[%Q%]", print->to.stream, print->notable, name, print->notable); if (status == F_control_group || status == F_limit || status == F_processor || status == F_schedule) { @@ -110,7 +110,7 @@ extern "C" { const uint8_t code = WIFEXITED(process->result) ? WEXITSTATUS(process->result) : 0; if (code == F_execute_access) { - fl_print_format("%[' access denied.%]%r", print->to.stream, print->context, print->context, f_string_eol_s); + fl_print_format("%[' cannot be executed, access is denied.%]%r", print->to.stream, print->context, print->context, f_string_eol_s); } else if (code == F_execute_bad) { fl_print_format("%[' cannot execute, unsupported format.%]%r", print->to.stream, print->context, print->context, f_string_eol_s); diff --git a/level_3/fake/c/common.h b/level_3/fake/c/common.h index 97cfd26..5c1e06d 100644 --- a/level_3/fake/c/common.h +++ b/level_3/fake/c/common.h @@ -28,18 +28,18 @@ extern "C" { #ifndef FAKE_program_version_nano_prefix_s #define FAKE_program_version_nano_prefix_s #define FAKE_program_version_nano_prefix_s_length 0 - #endif + #endif // FAKE_program_version_major_s_length F_string_ascii_0_s_length #ifndef FAKE_program_version_nano_s #define FAKE_program_version_nano_s #define FAKE_program_version_nano_s_length 0 - #endif + #endif // FAKE_program_version_nano_s #define FAKE_program_version_s FAKE_program_version_major_s F_string_ascii_period_s FAKE_program_version_minor_s F_string_ascii_period_s FAKE_program_version_micro_s FAKE_program_version_nano_prefix_s FAKE_program_version_nano_s #define FAKE_program_version_s_length FAKE_program_version_major_s_length + F_string_ascii_period_s_length + FAKE_program_version_minor_s_length + F_string_ascii_period_s_length + FAKE_program_version_micro_s_length + FAKE_program_version_nano_prefix_s_length + FAKE_program_version_nano_s_length - const f_string_static_t fake_program_version_s; + extern const f_string_static_t fake_program_version_s; #endif // _di_fake_program_version_ #ifndef _di_fake_program_name_ @@ -49,8 +49,8 @@ extern "C" { #define FAKE_program_name_s_length 4 #define FAKE_program_name_long_s_length 16 - const f_string_static_t fake_program_name_s; - const f_string_static_t fake_program_name_long_s; + extern const f_string_static_t fake_program_name_s; + extern const f_string_static_t fake_program_name_long_s; #endif // _di_fake_program_name_ #ifndef _di_fake_program_help_parameters_ diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index 812bbe1..57064a2 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -164,7 +164,6 @@ extern "C" { } } - f_string_static_t * const argv = main->parameters.arguments.array; status = F_none; f_array_length_t operations_length = main->parameters.array[fake_parameter_operation_build_e].locations.used; @@ -305,9 +304,7 @@ extern "C" { } if (F_status_is_error_not(status)) { - f_string_static_t stub = f_string_static_t_initialize; - - status = fake_build_operate(stub, main); + status = fake_build_operate(f_string_empty_s, main); } } else if (main->operation == fake_operation_clean_e) { diff --git a/level_3/fake/c/private-build-library.c b/level_3/fake/c/private-build-library.c index 7d785a8..f2c65b3 100644 --- a/level_3/fake/c/private-build-library.c +++ b/level_3/fake/c/private-build-library.c @@ -66,10 +66,10 @@ extern "C" { char source_string[source.used + 1]; source.string = source_string; + source_string[source.used] = 0; memcpy(source_string, path_sources->string, path_sources->used); memcpy(source_string + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used); - source_string[source.used] = 0; *status = fll_execute_arguments_add(source, &arguments); if (F_status_is_error(*status)) break; @@ -93,11 +93,29 @@ extern "C" { f_string_static_t parameter_file_name_micro = f_string_static_t_initialize; f_string_static_t parameter_file_name_nano = f_string_static_t_initialize; + f_array_length_t strings_length = 1; + parameter_file_name.used = fake_build_parameter_library_name_prefix_s.used + data_build.setting.project_name.used + fake_build_parameter_library_name_suffix_shared_s.used; - parameter_file_name_major.used = data_build.setting.version_major.used ? parameter_file_name.used + data_build.setting.version_major_prefix.used + data_build.setting.version_major.used : 0; - parameter_file_name_minor.used = data_build.setting.version_minor.used ? parameter_file_name_major.used + data_build.setting.version_minor_prefix.used + data_build.setting.version_minor.used : 0; - parameter_file_name_micro.used = data_build.setting.version_micro.used ? parameter_file_name_micro.used + data_build.setting.version_micro_prefix.used + data_build.setting.version_micro.used : 0; - parameter_file_name_nano.used = data_build.setting.version_nano.used ? parameter_file_name_nano.used + data_build.setting.version_nano_prefix.used + data_build.setting.version_nano.used : 0; + + if (data_build.setting.version_major.used) { + parameter_file_name_major.used = parameter_file_name.used + data_build.setting.version_major_prefix.used + data_build.setting.version_major.used; + strings_length = 2; + + if (data_build.setting.version_minor.used) { + parameter_file_name_minor.used = parameter_file_name_major.used + data_build.setting.version_minor_prefix.used + data_build.setting.version_minor.used; + strings_length = 3; + + if (data_build.setting.version_micro.used) { + parameter_file_name_micro.used = parameter_file_name_minor.used + data_build.setting.version_micro_prefix.used + data_build.setting.version_micro.used; + strings_length = 4; + + if (data_build.setting.version_nano.used) { + parameter_file_name_nano.used = parameter_file_name_micro.used + data_build.setting.version_nano_prefix.used + data_build.setting.version_nano.used; + strings_length = 5; + } + } + } + } char parameter_file_name_string[parameter_file_name.used + 1]; char parameter_file_name_major_string[parameter_file_name_major.used + 1]; @@ -105,169 +123,120 @@ extern "C" { char parameter_file_name_micro_string[parameter_file_name_micro.used + 1]; char parameter_file_name_nano_string[parameter_file_name_nano.used + 1]; + parameter_file_name.string = parameter_file_name_string; + parameter_file_name_major.string = parameter_file_name_major_string; + parameter_file_name_minor.string = parameter_file_name_minor_string; + parameter_file_name_micro.string = parameter_file_name_micro_string; + parameter_file_name_nano.string = parameter_file_name_nano_string; + parameter_file_name_string[parameter_file_name.used] = 0; parameter_file_name_major_string[parameter_file_name_major.used] = 0; parameter_file_name_minor_string[parameter_file_name_minor.used] = 0; parameter_file_name_micro_string[parameter_file_name_micro.used] = 0; parameter_file_name_nano_string[parameter_file_name_nano.used] = 0; - memcpy(parameter_file_name_string, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); - - if (parameter_file_name_major.used) { - memcpy(parameter_file_name_major_string, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); - - if (parameter_file_name_minor.used) { - memcpy(parameter_file_name_minor_string, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); - - if (parameter_file_name_micro.used) { - memcpy(parameter_file_name_micro_string, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); - - if (parameter_file_name_nano.used) { - memcpy(parameter_file_name_nano_string, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); - } - } - } - } - - f_array_length_t count = fake_build_parameter_library_name_prefix_s.used; - - memcpy(parameter_file_name_string + count, data_build.setting.project_name.string, data_build.setting.project_name.used); + f_string_t strings[5] = { + parameter_file_name_string, + parameter_file_name_major_string, + parameter_file_name_minor_string, + parameter_file_name_micro_string, + parameter_file_name_nano_string, + }; - if (parameter_file_name_major.used) { - memcpy(parameter_file_name_major_string + count, data_build.setting.project_name.string, data_build.setting.project_name.used); + { + f_array_length_t offset = 0; - if (parameter_file_name_minor.used) { - memcpy(parameter_file_name_minor_string + count, data_build.setting.project_name.string, data_build.setting.project_name.used); + uint8_t i = 0; - if (parameter_file_name_micro.used) { - memcpy(parameter_file_name_micro_string + count, data_build.setting.project_name.string, data_build.setting.project_name.used); + for (; i < strings_length; ++i) { + memcpy(strings[i], fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); + } // for - if (parameter_file_name_nano.used) { - memcpy(parameter_file_name_nano_string + count, data_build.setting.project_name.string, data_build.setting.project_name.used); - } - } - } - } + offset = fake_build_parameter_library_name_prefix_s.used; - count += data_build.setting.project_name.used; + for (i = 0; i < strings_length; ++i) { + memcpy(strings[i] + offset, data_build.setting.project_name.string, data_build.setting.project_name.used); + } // for - memcpy(parameter_file_name_string + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); + offset += data_build.setting.project_name.used; - if (parameter_file_name_major.used) { - memcpy(parameter_file_name_major_string + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); + for (i = 0; i < strings_length; ++i) { + memcpy(strings[i] + offset, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); + } // for - if (parameter_file_name_minor.used) { - memcpy(parameter_file_name_minor_string + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); + offset += fake_build_parameter_library_name_suffix_shared_s.used; - if (parameter_file_name_micro.used) { - memcpy(parameter_file_name_micro_string + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); + if (parameter_file_name_major.used) { + if (data_build.setting.version_major_prefix.used) { + for (i = 1; i < strings_length; ++i) { + memcpy(strings[i] + offset, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); + } // for - if (parameter_file_name_nano.used) { - memcpy(parameter_file_name_nano_string + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); - } + offset += data_build.setting.version_major_prefix.used; } - } - } - if (parameter_file_name_major.used) { - count += fake_build_parameter_library_name_suffix_shared_s.used; + for (i = 1; i < strings_length; ++i) { + memcpy(strings[i] + offset, data_build.setting.version_major.string, data_build.setting.version_major.used); + } // for - if (data_build.setting.version_major_prefix.used) { - memcpy(parameter_file_name_major_string + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); + offset += data_build.setting.version_major.used; if (parameter_file_name_minor.used) { - memcpy(parameter_file_name_minor_string + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); - - if (parameter_file_name_micro.used) { - memcpy(parameter_file_name_micro_string + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); - - if (parameter_file_name_nano.used) { - memcpy(parameter_file_name_nano_string + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); - } - } - } + if (data_build.setting.version_minor_prefix.used) { + for (i = 2; i < strings_length; ++i) { + memcpy(strings[i] + offset, data_build.setting.version_minor_prefix.string, data_build.setting.version_minor_prefix.used); + } // for - count += data_build.setting.version_major_prefix.used; - } - - memcpy(parameter_file_name_major_string + count, data_build.setting.version_major.string, data_build.setting.version_major.used); - - if (parameter_file_name_minor.used) { - memcpy(parameter_file_name_minor_string + count, data_build.setting.version_major.string, data_build.setting.version_major.used); - - if (parameter_file_name_micro.used) { - memcpy(parameter_file_name_micro_string + count, data_build.setting.version_major.string, data_build.setting.version_major.used); - - if (parameter_file_name_nano.used) { - memcpy(parameter_file_name_nano_string + count, data_build.setting.version_major.string, data_build.setting.version_major.used); + offset += data_build.setting.version_minor_prefix.used; } - } - } - if (parameter_file_name_minor.used) { - count += data_build.setting.version_major.used; + for (i = 2; i < strings_length; ++i) { + memcpy(strings[i] + offset, data_build.setting.version_minor.string, data_build.setting.version_minor.used); + } // for - if (data_build.setting.version_minor_prefix.used) { - memcpy(parameter_file_name_minor_string + count, data_build.setting.version_minor_prefix.string, data_build.setting.version_minor_prefix.used); + offset += data_build.setting.version_minor.used; if (parameter_file_name_micro.used) { - memcpy(parameter_file_name_micro_string + count, data_build.setting.version_minor_prefix.string, data_build.setting.version_minor_prefix.used); + if (data_build.setting.version_micro_prefix.used) { + for (i = 3; i < strings_length; ++i) { + memcpy(strings[i] + offset, data_build.setting.version_micro_prefix.string, data_build.setting.version_micro_prefix.used); + } // for - if (parameter_file_name_nano.used) { - memcpy(parameter_file_name_nano_string + count, data_build.setting.version_minor_prefix.string, data_build.setting.version_minor_prefix.used); + offset += data_build.setting.version_micro_prefix.used; } - } - count += data_build.setting.version_minor_prefix.used; - } - - memcpy(parameter_file_name_minor_string + count, data_build.setting.version_minor.string, data_build.setting.version_minor.used); - - if (parameter_file_name_micro.used) { - memcpy(parameter_file_name_micro_string + count, data_build.setting.version_minor.string, data_build.setting.version_minor.used); + for (i = 3; i < strings_length; ++i) { + memcpy(strings[i] + offset, data_build.setting.version_micro.string, data_build.setting.version_micro.used); + } // for - if (parameter_file_name_nano.used) { - memcpy(parameter_file_name_nano_string + count, data_build.setting.version_minor.string, data_build.setting.version_minor.used); - } - } - - if (parameter_file_name_micro.used) { - count += data_build.setting.version_minor.used; - - if (data_build.setting.version_micro_prefix.used) { - memcpy(parameter_file_name_micro_string + count, data_build.setting.version_micro_prefix.string, data_build.setting.version_micro_prefix.used); + offset += data_build.setting.version_micro.used; if (parameter_file_name_nano.used) { - memcpy(parameter_file_name_nano_string + count, data_build.setting.version_micro_prefix.string, data_build.setting.version_micro_prefix.used); - } + if (data_build.setting.version_nano_prefix.used) { + for (i = 4; i < strings_length; ++i) { + memcpy(strings[i] + offset, data_build.setting.version_nano_prefix.string, data_build.setting.version_nano_prefix.used); + } // for - count += data_build.setting.version_micro_prefix.used; - } + offset += data_build.setting.version_nano_prefix.used; + } - memcpy(parameter_file_name_micro_string + count, data_build.setting.version_micro.string, data_build.setting.version_micro.used); + for (i = 4; i < strings_length; ++i) { + memcpy(strings[i] + offset, data_build.setting.version_nano.string, data_build.setting.version_nano.used); + } // for - if (parameter_file_name_nano.used) { - memcpy(parameter_file_name_nano_string + count, data_build.setting.version_micro.string, data_build.setting.version_micro.used); - - count += data_build.setting.version_micro.used; - - if (data_build.setting.version_nano_prefix.used) { - memcpy(parameter_file_name_nano_string + count, data_build.setting.version_nano_prefix.string, data_build.setting.version_nano_prefix.used); - count += data_build.setting.version_nano_prefix.used; + offset += data_build.setting.version_nano.used; } - - memcpy(parameter_file_name_nano_string + count, data_build.setting.version_nano.string, data_build.setting.version_nano.used); } } } } { - f_string_static_t parameter_linker = f_string_static_t_initialize; f_string_static_t parameter_file_path = f_string_static_t_initialize; + f_string_static_t parameter_linker = f_string_static_t_initialize; - parameter_linker.used = fake_build_parameter_library_shared_prefix_s.used; parameter_file_path.used = main->path_build_libraries_shared.used; + parameter_linker.used = fake_build_parameter_library_shared_prefix_s.used; if (data_build.setting.version_file == fake_build_version_type_major_e) { parameter_file_path.used += parameter_file_name_major.used; @@ -295,14 +264,17 @@ extern "C" { parameter_linker.used += parameter_file_name_nano.used; } - char parameter_linker_string[parameter_linker.used + 1]; char parameter_file_path_string[parameter_file_path.used + 1]; + char parameter_linker_string[parameter_linker.used + 1]; - parameter_linker.string = parameter_linker_string; parameter_file_path.string = parameter_file_path_string; + parameter_linker.string = parameter_linker_string; + + parameter_file_path_string[parameter_file_path.used] = 0; + parameter_linker_string[parameter_linker.used] = 0; - memcpy(parameter_linker_string, fake_build_parameter_library_shared_prefix_s.string, fake_build_parameter_library_shared_prefix_s.used); memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); + memcpy(parameter_linker_string, fake_build_parameter_library_shared_prefix_s.string, fake_build_parameter_library_shared_prefix_s.used); if (data_build.setting.version_file == fake_build_version_type_major_e) { memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_major_string, parameter_file_name_major.used); @@ -330,9 +302,6 @@ extern "C" { memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_nano_string, parameter_file_name_nano.used); } - parameter_linker_string[parameter_linker.used] = 0; - parameter_file_path_string[parameter_file_path.used] = 0; - const f_string_static_t values[] = { fake_build_parameter_library_shared_s, parameter_linker, @@ -374,12 +343,11 @@ extern "C" { char parameter_file_path_string[parameter_file_path.used + 1]; parameter_file_path.string = parameter_file_path_string; - - memcpy(parameter_file_path.string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_file_path.string + main->path_build_libraries_shared.used, parameter_file_name.string, parameter_file_name.used); - parameter_file_path_string[parameter_file_path.used] = 0; + memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name.string, parameter_file_name.used); + *status = f_file_link(parameter_file_name_major, parameter_file_path); if (F_status_is_error_not(*status) && main->error.verbosity == f_console_verbosity_verbose_e) { @@ -400,74 +368,74 @@ extern "C" { if (data_build.setting.version_file != fake_build_version_type_major_e && parameter_file_name_major.used) { f_string_static_t parameter_file_path = f_string_static_t_initialize; - parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name_major.used; - - char parameter_file_path_string[parameter_file_path.used + 1]; - memcpy(parameter_file_path.string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_file_path.string + main->path_build_libraries_shared.used, parameter_file_name_major.string, parameter_file_name_major.used); + { + parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name_major.used; - parameter_file_path_string[parameter_file_path.used] = 0; - parameter_file_path.string = parameter_file_path_string; + char parameter_file_path_string[parameter_file_path.used + 1]; + parameter_file_path.string = parameter_file_path_string; + parameter_file_path_string[parameter_file_path.used] = 0; - *status = f_file_link(parameter_file_name_minor, parameter_file_path); + memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_major.string, parameter_file_name_major.used); - if (F_status_is_error_not(*status) && main->error.verbosity == f_console_verbosity_verbose_e) { - fll_print_format("Linked file '%Q' to '%Q'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_minor, f_string_eol_s); - } - else if (F_status_is_error(*status)) { - if (F_status_set_fine(*status) == F_file_found) { - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); + *status = f_file_link(parameter_file_name_minor, parameter_file_path); - return 0; + if (F_status_is_error_not(*status) && main->error.verbosity == f_console_verbosity_verbose_e) { + fll_print_format("Linked file '%Q' to '%Q'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_minor, f_string_eol_s); } + else if (F_status_is_error(*status)) { + if (F_status_set_fine(*status) == F_file_found) { + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_minor, f_file_operation_link_s, fll_error_file_type_file_e); + return 0; + } - return 0; + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_minor, f_file_operation_link_s, fll_error_file_type_file_e); + + return 0; + } } if (data_build.setting.version_file != fake_build_version_type_minor_e && parameter_file_name_minor.used) { - f_string_static_t parameter_file_path = f_string_static_t_initialize; - parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name_minor.used; + { + parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name_minor.used; - char parameter_file_path_string[parameter_file_path.used + 1]; - parameter_file_path.string = parameter_file_path_string; + char parameter_file_path_string[parameter_file_path.used + 1]; + parameter_file_path.string = parameter_file_path_string; + parameter_file_path_string[parameter_file_path.used] = 0; - memcpy(parameter_file_path.string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_file_path.string + main->path_build_libraries_shared.used, parameter_file_name_minor.string, parameter_file_name_minor.used); + memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_minor.string, parameter_file_name_minor.used); - parameter_file_path_string[parameter_file_path.used] = 0; + *status = f_file_link(parameter_file_name_micro, parameter_file_path); - *status = f_file_link(parameter_file_name_micro, parameter_file_path); + if (F_status_is_error_not(*status) && main->error.verbosity == f_console_verbosity_verbose_e) { + fll_print_format("Linked file '%Q' to '%Q'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_micro, f_string_eol_s); + } + else if (F_status_is_error(*status)) { + if (F_status_set_fine(*status) == F_file_found) { + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); - if (F_status_is_error_not(*status) && main->error.verbosity == f_console_verbosity_verbose_e) { - fll_print_format("Linked file '%Q' to '%Q'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_micro, f_string_eol_s); - } - else if (F_status_is_error(*status)) { - if (F_status_set_fine(*status) == F_file_found) { - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); + return 0; + } + + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_micro, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } - - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_micro, f_file_operation_link_s, fll_error_file_type_file_e); - - return 0; } if (data_build.setting.version_file != fake_build_version_type_micro_e && parameter_file_name_micro.used) { - f_string_static_t parameter_file_path = f_string_static_t_initialize; parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name_micro.used; char parameter_file_path_string[parameter_file_path.used + 1]; parameter_file_path.string = parameter_file_path_string; + parameter_file_path_string[parameter_file_path.used] = 0; memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_micro.string, parameter_file_name_micro.used); - parameter_file_path_string[parameter_file_path.used] = 0; - *status = f_file_link(parameter_file_name_nano, parameter_file_path); if (F_status_is_error_not(*status) && main->error.verbosity == f_console_verbosity_verbose_e) { @@ -525,6 +493,7 @@ extern "C" { char destination_string[destination.used + 1]; destination.string = destination_string; + destination_string[destination.used] = 0; destination.used = 0; @@ -540,8 +509,6 @@ extern "C" { memcpy(destination_string + destination.used, fake_build_parameter_library_name_suffix_static_s.string, fake_build_parameter_library_name_suffix_static_s.used); destination.used += fake_build_parameter_library_name_suffix_static_s.used; - destination_string[destination.used] = 0; - *status = fll_execute_arguments_add(destination, &arguments); } @@ -609,6 +576,7 @@ extern "C" { char source_string[source.used + 1]; source.string = source_string; + source_string[source.used] = 0; if (source_path.used) { memcpy(source_string, source_path.string, source_path.used); @@ -621,8 +589,6 @@ extern "C" { memcpy(source_string + main->path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, fake_build_parameter_object_name_suffix_s.used); } - source_string[source.used] = 0; - *status = fll_execute_arguments_add(source, &arguments); if (F_status_is_error(*status)) { diff --git a/level_3/fake/c/private-build-load.c b/level_3/fake/c/private-build-load.c index 511611c..202a532 100644 --- a/level_3/fake/c/private-build-load.c +++ b/level_3/fake/c/private-build-load.c @@ -86,6 +86,7 @@ extern "C" { char path_file_string[path_file.used + 1]; path_file.string = path_file_string; + path_file_string[path_file.used] = 0; { f_string_dynamic_t buffer = f_string_dynamic_t_initialize; @@ -97,8 +98,6 @@ extern "C" { memcpy(path_file_string, main->path_data_build.string, main->path_data_build.used); memcpy(path_file_string + main->path_data_build.used, setting_file.string, setting_file.used); - path_file_string[main->path_data_build.used + setting_file.used] = 0; - *status = fake_file_buffer(main, path_file, &buffer); } else { @@ -507,14 +506,21 @@ extern "C" { break; } - memcpy(settings_mode_names[j].string, settings_name[j].string, settings_value[j]->used); - settings_mode_names[j].used = settings_value[j]->used; + *status = f_string_dynamic_append(settings_name[j], &settings_mode_names[j]); - memcpy(settings_mode_names[j].string, f_string_ascii_minus_s.string, f_string_ascii_minus_s.used); - settings_mode_names[j].used += f_string_ascii_minus_s.used; + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append(f_string_ascii_minus_s, &settings_mode_names[j]); + } - memcpy(settings_mode_names[j].string + settings_mode_names[j].used, modes->array[i].string, modes->array[i].used); - settings_mode_names[j].used += modes->array[i].used; + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append(modes->array[i], &settings_mode_names[j]); + } + + if (F_status_is_error(*status)) { + function = "f_string_dynamic_increase_by"; + + break; + } } // for if (*status == F_none) { @@ -532,10 +538,11 @@ extern "C" { if (F_status_is_error(*status)) break; } // for - // "build_libraries" is appended after all modes to help assist with static linker file issues (@todo there should likely be more options to have a postfix linker parameter that can be added here instead, such as "build_libraries_last"). + // The string "build_libraries" is appended after all modes to help assist with static linker file issues (@todo there should likely be more options to have a postfix linker parameter that can be added here instead, such as "build_libraries_last"). if (total_build_libraries) { - f_string_dynamic_t temporary[total_build_libraries]; + f_string_static_t temporary[total_build_libraries]; + // Move the original "build_libraries" into a temporary location. for (i = 0; i < total_build_libraries; ++i) { temporary[i].string = setting->build_libraries.array[i].string; @@ -543,6 +550,7 @@ extern "C" { temporary[i].size = setting->build_libraries.array[i].size; } // for + // Move all of the other build library settings to the front of the array. for (i = 0, j = total_build_libraries; j < setting->build_libraries.used; ++i, ++j) { setting->build_libraries.array[i].string = setting->build_libraries.array[j].string; @@ -550,6 +558,7 @@ extern "C" { setting->build_libraries.array[i].size = setting->build_libraries.array[j].size; } // for + // Move back the original "build_libraries" back, but at the end of the array. for (i = setting->build_libraries.used - total_build_libraries, j = 0; j < total_build_libraries; ++i, ++j) { setting->build_libraries.array[i].string = temporary[j].string; diff --git a/level_3/fake/c/private-build-objects.c b/level_3/fake/c/private-build-objects.c index b0b439c..a6adfdd 100644 --- a/level_3/fake/c/private-build-objects.c +++ b/level_3/fake/c/private-build-objects.c @@ -59,10 +59,11 @@ extern "C" { source.used = path_sources->used + sources[i]->array[j].used; char source_string[source.used + 1]; + source.string = source_string; + source_string[source.used] = 0; memcpy(source_string, path_sources->string, path_sources->used); memcpy(source_string + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used); - source_string[source.used] = 0; *status = fake_build_get_file_name_without_extension(main, sources[i]->array[j], &file_name); @@ -162,6 +163,7 @@ extern "C" { char destination_string[destination.used + 1]; destination.string = destination_string; + destination_string[destination.used] = 0; if (destination_path.used) { memcpy(destination_string, destination_path.string, destination_path.used); @@ -174,8 +176,6 @@ extern "C" { memcpy(destination_string + main->path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, fake_build_parameter_object_name_suffix_s.used); } - destination_string[destination.used] = 0; - const f_string_static_t values[] = { source, fake_build_parameter_object_compile_s, diff --git a/level_3/fake/c/private-build-program.c b/level_3/fake/c/private-build-program.c index 8c4b41a..00d9ecd 100644 --- a/level_3/fake/c/private-build-program.c +++ b/level_3/fake/c/private-build-program.c @@ -65,12 +65,11 @@ extern "C" { char source_string[source.used + 1]; source.string = source_string; + source_string[source.used] = 0; memcpy(source_string, path_sources->string, path_sources->used); memcpy(source_string + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used); - source_string[source.used] = 0; - *status = fll_execute_arguments_add(source, &arguments); if (F_status_is_error(*status)) break; } // for @@ -85,12 +84,11 @@ extern "C" { char parameter_file_name_path_string[parameter_file_name_path.used + 1]; parameter_file_name_path.string = parameter_file_name_path_string; + parameter_file_name_path_string[parameter_file_name_path.used] = 0; memcpy(parameter_file_name_path_string, main->path_build_programs_shared.string, main->path_build_programs_shared.used); memcpy(parameter_file_name_path_string + main->path_build_programs_shared.used, data_build.setting.project_name.string, data_build.setting.project_name.used); - parameter_file_name_path_string[parameter_file_name_path.used] = 0; - const f_string_static_t values[] = { fake_build_parameter_library_output_s, parameter_file_name_path, @@ -105,19 +103,18 @@ extern "C" { } // for } - // if project-specific library sources exist, then the -lproject_name needs to be added to the arguments. + // If project-specific library sources exist, then the -lproject_name needs to be added to the arguments. if (F_status_is_error_not(*status) && data_build.setting.build_sources_library.used) { f_string_static_t link_project_library = f_string_static_t_initialize; link_project_library.used = fake_build_parameter_library_link_file_s.used + data_build.setting.project_name.used; char link_project_library_string[link_project_library.used + 1]; link_project_library.string = link_project_library_string; + link_project_library_string[link_project_library.used] = 0; memcpy(link_project_library_string, fake_build_parameter_library_link_file_s.string, fake_build_parameter_library_link_file_s.used); memcpy(link_project_library_string + fake_build_parameter_library_link_file_s.used, data_build.setting.project_name.string, data_build.setting.project_name.used); - link_project_library_string[link_project_library.used] = 0; - *status = fll_execute_arguments_add(link_project_library, &arguments); } @@ -189,12 +186,11 @@ extern "C" { char source_string[source.used + 1]; source.string = source_string; + source_string[source.used] = 0; memcpy(source_string, path_sources->string, path_sources->used); memcpy(source_string + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used); - source_string[source.used] = 0; - *status = fll_execute_arguments_add(source, &arguments); if (F_status_is_error(*status)) break; } // for @@ -209,6 +205,7 @@ extern "C" { char source_library_string[source_library.used + 1]; source_library.string = source_library_string; + source_library_string[source_library.used] = 0; source_library.used = 0; // Only include the library if there are sources that would result in it being built. @@ -226,18 +223,16 @@ extern "C" { source_library.used += fake_build_parameter_library_name_suffix_static_s.used; } - source_library_string[source_library.used] = 0; - f_string_static_t parameter_file_name_path = f_string_static_t_initialize; parameter_file_name_path.used = main->path_build_programs_static.used + data_build.setting.project_name.used; char parameter_file_name_path_string[parameter_file_name_path.used + 1]; + parameter_file_name_path.string = parameter_file_name_path_string; + parameter_file_name_path_string[parameter_file_name_path.used] = 0; memcpy(parameter_file_name_path_string, main->path_build_programs_static.string, main->path_build_programs_static.used); memcpy(parameter_file_name_path_string + main->path_build_programs_static.used, data_build.setting.project_name.string, data_build.setting.project_name.used); - parameter_file_name_path_string[parameter_file_name_path.used] = 0; - const f_string_static_t values[] = { source_library, fake_build_parameter_library_static_s, diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 3052e52..b578399 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -62,19 +62,19 @@ extern "C" { if (F_status_is_error(*status)) break; } // for - if (main->path_work.used) { + if (main->path_work.used && F_status_is_error_not(*status)) { f_string_static_t buffer = f_string_static_t_initialize; if (F_status_is_error_not(*status)) { buffer.used = fake_build_parameter_library_include_s.used + main->path_work_includes.used; char buffer_string[buffer.used + 1]; + buffer.string = buffer_string; + buffer_string[buffer.used] = 0; memcpy(buffer_string, fake_build_parameter_library_include_s.string, fake_build_parameter_library_include_s.used); memcpy(buffer_string + fake_build_parameter_library_include_s.used, main->path_work_includes.string, main->path_work_includes.used); - buffer_string[buffer.used] = 0; - *status = fll_execute_arguments_add(buffer, arguments); } @@ -82,12 +82,12 @@ extern "C" { buffer.used = fake_build_parameter_library_link_path_s.used + main->path_work_libraries_shared.used; char buffer_string[buffer.used + 1]; + buffer.string = buffer_string; + buffer_string[buffer.used] = 0; memcpy(buffer_string, fake_build_parameter_library_link_path_s.string, fake_build_parameter_library_link_path_s.used); memcpy(buffer_string + fake_build_parameter_library_link_path_s.used, main->path_work_libraries_shared.string, main->path_work_libraries_shared.used); - buffer_string[buffer.used] = 0; - *status = fll_execute_arguments_add(buffer, arguments); } @@ -95,12 +95,12 @@ extern "C" { buffer.used = fake_build_parameter_library_link_path_s.used + main->path_work_libraries_static.used; char buffer_string[buffer.used + 1]; + buffer.string = buffer_string; + buffer_string[buffer.used] = 0; memcpy(buffer_string, fake_build_parameter_library_link_path_s.string, fake_build_parameter_library_link_path_s.used); memcpy(buffer_string + fake_build_parameter_library_link_path_s.used, main->path_work_libraries_static.string, main->path_work_libraries_static.used); - buffer_string[buffer.used] = 0; - *status = fll_execute_arguments_add(buffer, arguments); } } @@ -537,6 +537,7 @@ extern "C" { argument.used = f_console_symbol_short_disable_s.used + f_console_standard_short_dark_s.used; char argument_string[argument.used + 1]; + argument.string = argument_string; argument_string[argument.used] = 0; memcpy(argument_string, f_console_symbol_short_disable_s.string, f_console_symbol_short_disable_s.used); @@ -560,6 +561,7 @@ extern "C" { argument.used = f_console_symbol_short_disable_s.used + f_console_standard_short_quiet_s.used; char argument_string[argument.used + 1]; + argument.string = argument_string; argument_string[argument.used] = 0; memcpy(argument_string, f_console_symbol_short_disable_s.string, f_console_symbol_short_disable_s.used); diff --git a/level_3/fake/c/private-make-load_fakefile.c b/level_3/fake/c/private-make-load_fakefile.c index 2443a33..d329a24 100644 --- a/level_3/fake/c/private-make-load_fakefile.c +++ b/level_3/fake/c/private-make-load_fakefile.c @@ -291,9 +291,7 @@ extern "C" { } if (F_status_is_error_not(*status) && data_make->setting_make.load_build) { - f_string_static_t stub = f_string_static_t_initialize; - - fake_build_load_setting(data_make->main, stub, &data_make->setting_build, status); + fake_build_load_setting(data_make->main, f_string_empty_s, &data_make->setting_build, status); if (F_status_is_error(*status) && *status != F_status_set_error(F_interrupt)) { fll_error_print(data_make->main->error, F_status_set_fine(*status), "fake_build_load_setting", F_true); diff --git a/level_3/fake/c/private-make-operate_process.c b/level_3/fake/c/private-make-operate_process.c index e42db4f..b2e234f 100644 --- a/level_3/fake/c/private-make-operate_process.c +++ b/level_3/fake/c/private-make-operate_process.c @@ -99,9 +99,7 @@ extern "C" { } if (state_process->operation == fake_make_operation_type_build_e) { - f_string_static_t stub = f_string_static_t_initialize; - - *status = fake_build_operate(arguments.used ? arguments.array[0] : stub, data_make->main); + *status = fake_build_operate(arguments.used ? arguments.array[0] : f_string_empty_s, data_make->main); if (F_status_set_fine(*status) == F_interrupt) { return 0; diff --git a/level_3/fake/c/private-make-operate_process_type.c b/level_3/fake/c/private-make-operate_process_type.c index d6867cb..54657e1 100644 --- a/level_3/fake/c/private-make-operate_process_type.c +++ b/level_3/fake/c/private-make-operate_process_type.c @@ -67,6 +67,7 @@ extern "C" { char destination_string[destination.used + 1]; destination.string = destination_string; + destination_string[destination.used] = 0; memcpy(destination_string, arguments.array[total].string, arguments.array[total].used); @@ -75,8 +76,6 @@ extern "C" { destination_string[arguments.array[total].used] = f_path_separator_s.string[0]; } - destination_string[destination.used] = 0; - status_file = f_directory_is(arguments.array[i]); if (status_file == F_true) { @@ -1059,6 +1058,7 @@ extern "C" { char destination_string[destination.used + 1]; destination.string = destination_string; + destination_string[destination.used] = 0; memcpy(destination_string, arguments.array[total].string, arguments.array[total].used); @@ -1067,8 +1067,6 @@ extern "C" { destination_string[arguments.array[total].used] = f_path_separator_s.string[0]; } - destination_string[destination.used] = 0; - status_file = fll_file_move(arguments.array[i], destination, recurse); if (F_status_is_error(status_file)) { diff --git a/level_3/fake/c/private-make-operate_validate.c b/level_3/fake/c/private-make-operate_validate.c index 467c62c..e48a696 100644 --- a/level_3/fake/c/private-make-operate_validate.c +++ b/level_3/fake/c/private-make-operate_validate.c @@ -84,12 +84,11 @@ extern "C" { char path_file_string[path_file.used + 1]; path_file.string = path_file_string; + path_file_string[path_file.used] = 0; memcpy(path_file_string, data_make->main->path_data_build.string, data_make->main->path_data_build.used); memcpy(path_file_string + data_make->main->path_data_build.used, arguments.array[0].string, arguments.array[0].used); - path_file_string[path_file.used] = 0; - f_status_t status_file = f_file_is(path_file, F_file_type_regular_d, F_false); if (status_file == F_file_found_not) { diff --git a/level_3/firewall/c/common.c b/level_3/firewall/c/common.c new file mode 100644 index 0000000..7d03c1d --- /dev/null +++ b/level_3/firewall/c/common.c @@ -0,0 +1,123 @@ +#include "firewall.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_program_name_ + +#ifndef _di_firewall_program_help_parameters_ + const f_string_static_t firewall_program_help_parameters_s = macro_f_string_static_t_initialize(FIREWALL_program_help_parameters_s, 0, FIREWALL_program_help_parameters_s_length); +#endif // _di_firewall_program_help_parameters_ + +#ifndef _di_firewall_paths_ + const f_string_static_t firewall_file_first_s = macro_f_string_static_t_initialize(FIREWALL_file_first_s, 0, FIREWALL_file_first_s_length); + const f_string_static_t firewall_file_last_s = macro_f_string_static_t_initialize(FIREWALL_file_last_s, 0, FIREWALL_file_last_s_length); + const f_string_static_t firewall_file_other_s = macro_f_string_static_t_initialize(FIREWALL_file_other_s, 0, FIREWALL_file_other_s_length); + const f_string_static_t firewall_file_suffix_s = macro_f_string_static_t_initialize(FIREWALL_file_suffix_s, 0, FIREWALL_file_suffix_s_length); + + const f_string_static_t firewall_network_path_s = macro_f_string_static_t_initialize(FIREWALL_network_path_s, 0, FIREWALL_network_path_s_length); + const f_string_static_t firewall_network_devices_s = macro_f_string_static_t_initialize(FIREWALL_network_devices_s, 0, FIREWALL_network_devices_s_length); +#endif // _di_firewall_paths_ + +#ifndef _di_firewall_defines_ + const f_string_static_t firewall_action_s = macro_f_string_static_t_initialize(FIREWALL_action_s, 0, FIREWALL_action_s_length); + const f_string_static_t firewall_action_append_s = macro_f_string_static_t_initialize(FIREWALL_action_append_s, 0, FIREWALL_action_append_s_length); + const f_string_static_t firewall_action_insert_s = macro_f_string_static_t_initialize(FIREWALL_action_insert_s, 0, FIREWALL_action_insert_s_length); + const f_string_static_t firewall_action_policy_s = macro_f_string_static_t_initialize(FIREWALL_action_policy_s, 0, FIREWALL_action_policy_s_length); + const f_string_static_t firewall_action_none_s = macro_f_string_static_t_initialize(FIREWALL_action_none_s, 0, FIREWALL_action_none_s_length); + + const f_string_static_t firewall_action_append_command_s = macro_f_string_static_t_initialize(FIREWALL_action_append_command_s, 0, FIREWALL_action_append_command_s_length); + const f_string_static_t firewall_action_insert_command_s = macro_f_string_static_t_initialize(FIREWALL_action_insert_command_s, 0, FIREWALL_action_insert_command_s_length); + const f_string_static_t firewall_action_policy_command_s = macro_f_string_static_t_initialize(FIREWALL_action_policy_command_s, 0, FIREWALL_action_policy_command_s_length); + + const f_string_static_t firewall_chain_s = macro_f_string_static_t_initialize(FIREWALL_chain_s, 0, FIREWALL_chain_s_length); + const f_string_static_t firewall_chain_forward_s = macro_f_string_static_t_initialize(FIREWALL_chain_forward_s, 0, FIREWALL_chain_forward_s_length); + const f_string_static_t firewall_chain_drop_s = macro_f_string_static_t_initialize(FIREWALL_chain_drop_s, 0, FIREWALL_chain_drop_s_length); + const f_string_static_t firewall_chain_input_s = macro_f_string_static_t_initialize(FIREWALL_chain_input_s, 0, FIREWALL_chain_input_s_length); + const f_string_static_t firewall_chain_none_s = macro_f_string_static_t_initialize(FIREWALL_chain_none_s, 0, FIREWALL_chain_none_s_length); + const f_string_static_t firewall_chain_output_s = macro_f_string_static_t_initialize(FIREWALL_chain_output_s, 0, FIREWALL_chain_output_s_length); + const f_string_static_t firewall_chain_postrouting_s = macro_f_string_static_t_initialize(FIREWALL_chain_postrouting_s, 0, FIREWALL_chain_postrouting_s_length); + const f_string_static_t firewall_chain_prerouting_s = macro_f_string_static_t_initialize(FIREWALL_chain_prerouting_s, 0, FIREWALL_chain_prerouting_s_length); + + const f_string_static_t firewall_chain_create_command_s = macro_f_string_static_t_initialize(FIREWALL_chain_create_command_s, 0, FIREWALL_chain_create_command_s_length); + const f_string_static_t firewall_chain_delete_command_s = macro_f_string_static_t_initialize(FIREWALL_chain_delete_command_s, 0, FIREWALL_chain_delete_command_s_length); + const f_string_static_t firewall_chain_flush_command_s = macro_f_string_static_t_initialize(FIREWALL_chain_flush_command_s, 0, FIREWALL_chain_flush_command_s_length); + + const f_string_static_t firewall_command_start_s = macro_f_string_static_t_initialize(FIREWALL_command_start_s, 0, FIREWALL_command_start_s_length); + const f_string_static_t firewall_command_stop_s = macro_f_string_static_t_initialize(FIREWALL_command_stop_s, 0, FIREWALL_command_stop_s_length); + const f_string_static_t firewall_command_restart_s = macro_f_string_static_t_initialize(FIREWALL_command_restart_s, 0, FIREWALL_command_restart_s_length); + const f_string_static_t firewall_command_lock_s = macro_f_string_static_t_initialize(FIREWALL_command_lock_s, 0, FIREWALL_command_lock_s_length); + const f_string_static_t firewall_command_show_s = macro_f_string_static_t_initialize(FIREWALL_command_show_s, 0, FIREWALL_command_show_s_length); + + const f_string_static_t firewall_device_s = macro_f_string_static_t_initialize(FIREWALL_device_s, 0, FIREWALL_device_s_length); + const f_string_static_t firewall_device_all_s = macro_f_string_static_t_initialize(FIREWALL_device_all_s, 0, FIREWALL_device_all_s_length); + const f_string_static_t firewall_device_this_s = macro_f_string_static_t_initialize(FIREWALL_device_this_s, 0, FIREWALL_device_this_s_length); + const f_string_static_t firewall_device_loop_s = macro_f_string_static_t_initialize(FIREWALL_device_loop_s, 0, FIREWALL_device_loop_s_length); + + const f_string_static_t firewall_device_input_command_s = macro_f_string_static_t_initialize(FIREWALL_device_input_command_s, 0, FIREWALL_device_input_command_s_length); + const f_string_static_t firewall_device_output_command_s = macro_f_string_static_t_initialize(FIREWALL_device_output_command_s, 0, FIREWALL_device_output_command_s_length); + + const f_string_static_t firewall_direction_s = macro_f_string_static_t_initialize(FIREWALL_direction_s, 0, FIREWALL_direction_s_length); + const f_string_static_t firewall_direction_input_s = macro_f_string_static_t_initialize(FIREWALL_direction_input_s, 0, FIREWALL_direction_input_s_length); + const f_string_static_t firewall_direction_output_s = macro_f_string_static_t_initialize(FIREWALL_direction_output_s, 0, FIREWALL_direction_output_s_length); + const f_string_static_t firewall_direction_none_s = macro_f_string_static_t_initialize(FIREWALL_direction_none_s, 0, FIREWALL_direction_none_s_length); + + const f_string_static_t firewall_group_stop_s = macro_f_string_static_t_initialize(FIREWALL_group_stop_s, 0, FIREWALL_group_stop_s_length); + const f_string_static_t firewall_group_lock_s = macro_f_string_static_t_initialize(FIREWALL_group_lock_s, 0, FIREWALL_group_lock_s_length); + const f_string_static_t firewall_group_main_s = macro_f_string_static_t_initialize(FIREWALL_group_main_s, 0, FIREWALL_group_main_s_length); + + const f_string_static_t firewall_ip_list = macro_f_string_static_t_initialize(FIREWALL_ip_list, 0, FIREWALL_ip_list_length); + const f_string_static_t firewall_ip_list_source_s = macro_f_string_static_t_initialize(FIREWALL_ip_list_source_s, 0, FIREWALL_ip_list_source_s_length); + const f_string_static_t firewall_ip_list_source_action_s = macro_f_string_static_t_initialize(FIREWALL_ip_list_source_action_s, 0, FIREWALL_ip_list_source_action_s_length); + const f_string_static_t firewall_ip_list_destination_s = macro_f_string_static_t_initialize(FIREWALL_ip_list_destination_s, 0, FIREWALL_ip_list_destination_s_length); + const f_string_static_t firewall_ip_list_destination_action_s = macro_f_string_static_t_initialize(FIREWALL_ip_list_destination_action_s, 0, FIREWALL_ip_list_destination_action_s_length); + + const f_string_static_t firewall_protocol_s = macro_f_string_static_t_initialize(FIREWALL_protocol_s, 0, FIREWALL_protocol_s_length); + const f_string_static_t firewall_protocol_command_s = macro_f_string_static_t_initialize(FIREWALL_protocol_command_s, 0, FIREWALL_protocol_command_s_length); + const f_string_static_t firewall_protocol_none_s = macro_f_string_static_t_initialize(FIREWALL_protocol_none_s, 0, FIREWALL_protocol_none_s_length); + + const f_string_static_t firewall_rule_s = macro_f_string_static_t_initialize(FIREWALL_rule_s, 0, FIREWALL_rule_s_length); + + const f_string_static_t firewall_show_mangle_s = macro_f_string_static_t_initialize(FIREWALL_show_mangle_s, 0, FIREWALL_show_mangle_s_length); + const f_string_static_t firewall_show_nat_s = macro_f_string_static_t_initialize(FIREWALL_show_nat_s, 0, FIREWALL_show_nat_s_length); + const f_string_static_t firewall_show_ports_s = macro_f_string_static_t_initialize(FIREWALL_show_ports_s, 0, FIREWALL_show_ports_s_length); + + const f_string_static_t firewall_show_parameter_exact_s = macro_f_string_static_t_initialize(FIREWALL_show_parameter_exact_s, 0, FIREWALL_show_parameter_exact_s_length); + const f_string_static_t firewall_show_parameter_verbose_s = macro_f_string_static_t_initialize(FIREWALL_show_parameter_verbose_s, 0, FIREWALL_show_parameter_verbose_s_length); + const f_string_static_t firewall_show_parameter_table_s = macro_f_string_static_t_initialize(FIREWALL_show_parameter_table_s, 0, FIREWALL_show_parameter_table_s_length); + const f_string_static_t firewall_show_parameter_numeric_s = macro_f_string_static_t_initialize(FIREWALL_show_parameter_numeric_s, 0, FIREWALL_show_parameter_numeric_s_length); + const f_string_static_t firewall_show_parameter_list_s = macro_f_string_static_t_initialize(FIREWALL_show_parameter_list_s, 0, FIREWALL_show_parameter_list_s_length); + + const f_string_static_t firewall_tool_s = macro_f_string_static_t_initialize(FIREWALL_tool_s, 0, FIREWALL_tool_s_length); + const f_string_static_t firewall_tool_iptables_s = macro_f_string_static_t_initialize(FIREWALL_tool_iptables_s, 0, FIREWALL_tool_iptables_s_length); + const f_string_static_t firewall_tool_ip6tables_s = macro_f_string_static_t_initialize(FIREWALL_tool_ip6tables_s, 0, FIREWALL_tool_ip6tables_s_length); + const f_string_static_t firewall_tool_ip46tables_s = macro_f_string_static_t_initialize(FIREWALL_tool_ip46tables_s, 0, FIREWALL_tool_ip46tables_s_length); + const f_string_static_t firewall_tool_ipset_s = macro_f_string_static_t_initialize(FIREWALL_tool_ipset_s, 0, FIREWALL_tool_ipset_s_length); +#endif // _di_firewall_defines_ + +#ifndef _di_firewall_main_delete_ + f_status_t firewall_main_delete(firewall_main_t * const main) { + + 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); + + return F_none; + } +#endif // _di_firewall_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/firewall/c/common.h b/level_3/firewall/c/common.h new file mode 100644 index 0000000..35ab6e7 --- /dev/null +++ b/level_3/firewall/c/common.h @@ -0,0 +1,441 @@ +/** + * FLL - Level 3 + * + * Project: Firewall + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _firewall_common_h +#define _firewall_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + #define FIREWALL_program_version_major_s F_string_ascii_0_s + #define FIREWALL_program_version_minor_s F_string_ascii_5_s + #define FIREWALL_program_version_micro_s F_string_ascii_8_s + + #define FIREWALL_program_version_major_s_length F_string_ascii_0_s_length + #define FIREWALL_program_version_minor_s_length F_string_ascii_5_s_length + #define FIREWALL_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FIREWALL_program_version_nano_prefix_s) && defined(FIREWALL_program_version_nano_prefix_s_length)) + #define FIREWALL_program_version_nano_prefix_s + #define FIREWALL_program_version_nano_prefix_s_length 0 + #endif // !(defined(FIREWALL_program_version_nano_prefix_s) && defined(FIREWALL_program_version_nano_prefix_s_length)) + + #if !(defined(FIREWALL_program_version_nano_s) && defined(FIREWALL_program_version_nano_s_length)) + #define FIREWALL_program_version_nano_s + #define FIREWALL_program_version_nano_s_length 0 + #endif // !(defined(FIREWALL_program_version_nano_s) && defined(FIREWALL_program_version_nano_s_length)) + + #define FIREWALL_program_version_s FIREWALL_program_version_major_s F_string_ascii_period_s FIREWALL_program_version_minor_s F_string_ascii_period_s FIREWALL_program_version_micro_s FIREWALL_program_version_nano_prefix_s FIREWALL_program_version_nano_s + + #define FIREWALL_program_version_s_length FIREWALL_program_version_major_s_length + F_string_ascii_period_s_length + FIREWALL_program_version_minor_s_length + F_string_ascii_period_s_length + FIREWALL_program_version_micro_s_length + FIREWALL_program_version_nano_prefix_s_length + FIREWALL_program_version_nano_s_length + + extern const f_string_static_t firewall_program_version_s; +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + #define FIREWALL_program_name_s "firewall" + #define FIREWALL_program_name_long_s "Kevux Firewall Manager" + + #define FIREWALL_program_name_s_length 8 + #define FIREWALL_program_name_long_s_length 22 + + extern const f_string_static_t firewall_program_name_s; + extern const f_string_static_t firewall_program_name_long_s; +#endif // _di_firewall_program_name_ + +#ifndef _di_firewall_program_help_parameters_ + #define FIREWALL_program_help_parameters_s "command" + #define FIREWALL_program_help_parameters_s_length 7 + + extern const f_string_static_t firewall_program_help_parameters_s; +#endif // _di_firewall_program_help_parameters_ + +#ifndef _di_firewall_paths_ + #define FIREWALL_file_first_s "firewall-first" + #define FIREWALL_file_last_s "firewall-last" + #define FIREWALL_file_other_s "firewall-other" + #define FIREWALL_file_suffix_s "-firewall" + + #define FIREWALL_network_path_s "/etc/network/" + #define FIREWALL_network_devices_s "/sys/class/net/" + + #define FIREWALL_file_first_s_length 14 + #define FIREWALL_file_last_s_length 13 + #define FIREWALL_file_other_s_length 14 + #define FIREWALL_file_suffix_s_length 9 + + #define FIREWALL_network_path_s_length 13 + #define FIREWALL_network_devices_s_length 15 + + extern const f_string_static_t firewall_file_first_s; + extern const f_string_static_t firewall_file_last_s; + extern const f_string_static_t firewall_file_other_s; + extern const f_string_static_t firewall_file_suffix_s; + + extern const f_string_static_t firewall_network_path_s; + extern const f_string_static_t firewall_network_devices_s; +#endif // _di_firewall_paths_ + +#ifndef _di_firewall_default_allocation_step_ + #define firewall_default_allocation_step_d F_memory_default_allocation_small_d +#endif // _di_firewall_default_allocation_step_ + +#ifndef _di_firewall_defines_ + #define firewall_signal_check_d 10000 + + #define FIREWALL_action_s "action" + #define FIREWALL_action_append_s "append" + #define FIREWALL_action_insert_s "insert" + #define FIREWALL_action_policy_s "policy" + #define FIREWALL_action_none_s "none" + + #define FIREWALL_action_append_command_s "-A" + #define FIREWALL_action_insert_command_s "-I" + #define FIREWALL_action_policy_command_s "-P" + + #define FIREWALL_chain_s "chain" + #define FIREWALL_chain_forward_s "FORWARD" + #define FIREWALL_chain_drop_s "DROP" + #define FIREWALL_chain_input_s "INPUT" + #define FIREWALL_chain_none_s "none" + #define FIREWALL_chain_output_s "OUTPUT" + #define FIREWALL_chain_postrouting_s "POSTROUTING" + #define FIREWALL_chain_prerouting_s "PREROUTING" + + #define FIREWALL_chain_create_command_s "-N" + #define FIREWALL_chain_delete_command_s "-X" + #define FIREWALL_chain_flush_command_s "-F" + + #define FIREWALL_command_start_s "start" + #define FIREWALL_command_stop_s "stop" + #define FIREWALL_command_restart_s "restart" + #define FIREWALL_command_lock_s "lock" + #define FIREWALL_command_show_s "show" + + #define FIREWALL_device_s "device" + #define FIREWALL_device_all_s "all" + #define FIREWALL_device_this_s "this" + #define FIREWALL_device_loop_s "lo" + + #define FIREWALL_device_input_command_s "-i" + #define FIREWALL_device_output_command_s "-o" + + #define FIREWALL_direction_s "direction" + #define FIREWALL_direction_input_s "input" + #define FIREWALL_direction_output_s "output" + #define FIREWALL_direction_none_s "none" + + #define FIREWALL_group_stop_s "stop" + #define FIREWALL_group_lock_s "lock" + #define FIREWALL_group_main_s "main" + + #define FIREWALL_ip_list "ip_list" + #define FIREWALL_ip_list_source_s "source" + #define FIREWALL_ip_list_source_action_s "-s" + #define FIREWALL_ip_list_destination_s "destination" + #define FIREWALL_ip_list_destination_action_s "-d" + + #define FIREWALL_protocol_s "protocol" + #define FIREWALL_protocol_command_s "-p" + #define FIREWALL_protocol_none_s "none" + + #define FIREWALL_rule_s "rule" + + #define FIREWALL_show_mangle_s "mangle" + #define FIREWALL_show_nat_s "nat" + #define FIREWALL_show_ports_s "ports" + + #define FIREWALL_show_parameter_exact_s "-x" + #define FIREWALL_show_parameter_verbose_s "-v" + #define FIREWALL_show_parameter_table_s "-t" + #define FIREWALL_show_parameter_numeric_s "--numeric" + #define FIREWALL_show_parameter_list_s "--list" + + #define FIREWALL_tool_s "tool" + #define FIREWALL_tool_iptables_s "iptables" + #define FIREWALL_tool_ip6tables_s "ip6tables" + #define FIREWALL_tool_ip46tables_s "ip46tables" + #define FIREWALL_tool_ipset_s "ipset" + + #define FIREWALL_action_length_s 6 + #define FIREWALL_action_append_s_length 6 + #define FIREWALL_action_insert_s_length 6 + #define FIREWALL_action_policy_s_length 6 + #define FIREWALL_action_none_s_length 4 + + #define FIREWALL_action_append_command_s_length 2 + #define FIREWALL_action_insert_command_s_length 2 + #define FIREWALL_action_policy_command_s_length 2 + + #define FIREWALL_chain_s_length 5 + #define FIREWALL_chain_forward_s_length 7 + #define FIREWALL_chain_drop_s_length 4 + #define FIREWALL_chain_input_s_length 5 + #define FIREWALL_chain_none_s_length 4 + #define FIREWALL_chain_output_s_length 6 + #define FIREWALL_chain_postrouting_s_length 12 + #define FIREWALL_chain_prerouting_s_length 11 + + #define FIREWALL_chain_create_command_s_length 2 + #define FIREWALL_chain_delete_command_s_length 2 + #define FIREWALL_chain_flush_command_s_length 2 + + #define FIREWALL_command_start_s_length 5 + #define FIREWALL_command_stop_s_length 4 + #define FIREWALL_command_restart_s_length 7 + #define FIREWALL_command_lock_s_length 4 + #define FIREWALL_command_show_s_length 4 + + #define FIREWALL_device_s_length 6 + #define FIREWALL_device_all_s_length 3 + #define FIREWALL_device_this_s_length 4 + #define FIREWALL_device_loop_s_length 2 + + #define FIREWALL_device_input_command_length_s 2 + #define FIREWALL_device_output_command_length_s 2 + + #define FIREWALL_direction_s_length 9 + #define FIREWALL_direction_input_s_length 5 + #define FIREWALL_direction_output_s_length 6 + #define FIREWALL_direction_none_s_length 4 + + #define FIREWALL_group_stop_s_length 4 + #define FIREWALL_group_lock_s_length 4 + #define FIREWALL_group_main_s_length 4 + + #define FIREWALL_ip_list_length_s 7 + #define FIREWALL_ip_list_source_s_length 6 + #define FIREWALL_ip_list_source_action_s_length 2 + #define FIREWALL_ip_list_destination_s_length 11 + #define FIREWALL_ip_list_destination_action_s_length 2 + + #define FIREWALL_protocol_s_length 8 + #define FIREWALL_protocol_command_s_length 2 + #define FIREWALL_protocol_none_s_length 4 + + #define FIREWALL_rule_s_length 4 + + #define FIREWALL_show_mangle_s_length 6 + #define FIREWALL_show_nat_s_length 3 + #define FIREWALL_show_ports_s_length 5 + + #define FIREWALL_show_parameter_exact_s_length 2 + #define FIREWALL_show_parameter_verbose_s_length 2 + #define FIREWALL_show_parameter_table_s_length 2 + #define FIREWALL_show_parameter_numeric_s_length 9 + #define FIREWALL_show_parameter_list_s_length 6 + + #define FIREWALL_tool_s_length 4 + #define FIREWALL_tool_iptables_s_length 8 + #define FIREWALL_tool_ip6tables_s_length 9 + #define FIREWALL_tool_ip46tables_s_length 10 + #define FIREWALL_tool_ipset_s_length 5 + + extern const f_string_static_t firewall_action_s; + extern const f_string_static_t firewall_action_append_s; + extern const f_string_static_t firewall_action_insert_s; + extern const f_string_static_t firewall_action_policy_s; + extern const f_string_static_t firewall_action_none_s; + + extern const f_string_static_t firewall_action_append_command_s; + extern const f_string_static_t firewall_action_insert_command_s; + extern const f_string_static_t firewall_action_policy_command_s; + + extern const f_string_static_t firewall_chain_s; + extern const f_string_static_t firewall_chain_forward_s; + extern const f_string_static_t firewall_chain_drop_s; + extern const f_string_static_t firewall_chain_input_s; + extern const f_string_static_t firewall_chain_none_s; + extern const f_string_static_t firewall_chain_output_s; + extern const f_string_static_t firewall_chain_postrouting_s; + extern const f_string_static_t firewall_chain_prerouting_s; + + extern const f_string_static_t firewall_chain_create_command_s; + extern const f_string_static_t firewall_chain_delete_command_s; + extern const f_string_static_t firewall_chain_flush_command_s; + + extern const f_string_static_t firewall_command_start_s; + extern const f_string_static_t firewall_command_stop_s; + extern const f_string_static_t firewall_command_restart_s; + extern const f_string_static_t firewall_command_lock_s; + extern const f_string_static_t firewall_command_show_s; + + extern const f_string_static_t firewall_device_s; + extern const f_string_static_t firewall_device_all_s; + extern const f_string_static_t firewall_device_this_s; + extern const f_string_static_t firewall_device_loop_s; + + extern const f_string_static_t firewall_device_input_command_s; + extern const f_string_static_t firewall_device_output_command_s; + + extern const f_string_static_t firewall_direction_s; + extern const f_string_static_t firewall_direction_input_s; + extern const f_string_static_t firewall_direction_output_s; + extern const f_string_static_t firewall_direction_none_s; + + extern const f_string_static_t firewall_group_stop_s; + extern const f_string_static_t firewall_group_lock_s; + extern const f_string_static_t firewall_group_main_s; + + extern const f_string_static_t firewall_ip_list; + extern const f_string_static_t firewall_ip_list_source_s; + extern const f_string_static_t firewall_ip_list_source_action_s; + extern const f_string_static_t firewall_ip_list_destination_s; + extern const f_string_static_t firewall_ip_list_destination_action_s; + + extern const f_string_static_t firewall_protocol_s; + extern const f_string_static_t firewall_protocol_command_s; + extern const f_string_static_t firewall_protocol_none_s; + + extern const f_string_static_t firewall_rule_s; + + extern const f_string_static_t firewall_show_mangle_s; + extern const f_string_static_t firewall_show_nat_s; + extern const f_string_static_t firewall_show_ports_s; + + extern const f_string_static_t firewall_show_parameter_exact_s; + extern const f_string_static_t firewall_show_parameter_verbose_s; + extern const f_string_static_t firewall_show_parameter_table_s; + extern const f_string_static_t firewall_show_parameter_numeric_s; + extern const f_string_static_t firewall_show_parameter_list_s; + + extern const f_string_static_t firewall_tool_s; + extern const f_string_static_t firewall_tool_iptables_s; + extern const f_string_static_t firewall_tool_ip6tables_s; + extern const f_string_static_t firewall_tool_ip46tables_s; + extern const f_string_static_t firewall_tool_ipset_s; + + enum { + firewall_program_none_e = 1, + firewall_program_iptables_e, + firewall_program_ip6tables_e, + firewall_program_ip46tables_e, + firewall_program_ipset_e, + }; + + enum { + firewall_parameter_help_e, + firewall_parameter_light_e, + firewall_parameter_dark_e, + firewall_parameter_no_color_e, + firewall_parameter_verbosity_quiet_e, + firewall_parameter_verbosity_normal_e, + firewall_parameter_verbosity_verbose_e, + firewall_parameter_verbosity_debug_e, + firewall_parameter_version_e, + + firewall_parameter_command_start_e, + firewall_parameter_command_stop_e, + firewall_parameter_command_restart_e, + firewall_parameter_command_lock_e, + firewall_parameter_command_show_e, + + firewall_direction_input_id_e, + firewall_direction_output_id_e, + firewall_direction_none_id_e, + + firewall_chain_forward_id_e, + firewall_chain_custom_id_e, + firewall_chain_input_id_e, + firewall_chain_none_id_e, + firewall_chain_output_id_e, + firewall_chain_postrouting_id_e, + firewall_chain_prerouting_id_e, + + firewall_action_append_id_e, + firewall_action_insert_id_e, + firewall_action_policy_id_e, + firewall_action_none_id_e, + }; + + #define firewall_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(0, 0, firewall_command_start_s.string, F_false, f_console_type_other_e), \ + macro_f_console_parameter_t_initialize(0, 0, firewall_command_stop_s.string, F_false, f_console_type_other_e), \ + macro_f_console_parameter_t_initialize(0, 0, firewall_command_restart_s.string, F_false, f_console_type_other_e), \ + macro_f_console_parameter_t_initialize(0, 0, firewall_command_lock_s.string, F_false, f_console_type_other_e), \ + macro_f_console_parameter_t_initialize(0, 0, firewall_command_show_s.string, F_false, f_console_type_other_e), \ + } + + #define firewall_total_parameters_d 14 +#endif // _di_firewall_defines_ + +#ifndef _di_firewall_main_t_ + typedef struct { + f_console_parameters_t parameters; + + f_array_lengths_t remaining; + bool process_pipe; + int child; + + fl_print_t output; + fl_print_t error; + fl_print_t warning; + + f_signal_t signal; + + f_string_dynamics_t chains; + f_string_dynamics_t devices; + + f_color_context_t context; + } firewall_main_t; + + #define firewall_main_t_initialize \ + { \ + f_console_parameters_t_initialize, \ + f_array_lengths_t_initialize, \ + F_false, \ + 0, \ + fl_print_t_initialize, \ + macro_fl_print_t_initialize_error(), \ + macro_fl_print_t_initialize_warning(), \ + f_signal_t_initialize, \ + f_string_dynamics_t_initialize, \ + f_string_dynamics_t_initialize, \ + f_color_context_t_initialize, \ + } +#endif // _di_firewall_main_t_ + +/** + * De-allocate data. + * + * Be sure to call this after executing firewall_main(). + * + * @param data + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @see firewall_main() + */ +#ifndef _di_firewall_main_delete_ + extern f_status_t firewall_main_delete(firewall_main_t * const data); +#endif // _di_firewall_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _firewall_common_h diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 0a077b7..3176330 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -26,7 +26,7 @@ extern "C" { flockfile(file.stream); - fll_program_print_help_header(file, context, firewall_program_name_long_s, firewall_version_s); + fll_program_print_help_header(file, context, firewall_program_name_long_s, firewall_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."); @@ -45,7 +45,7 @@ extern "C" { fl_print_format("%r %[%s%] Prevent all communication.", file.stream, f_string_eol_s, context.set.standout, firewall_command_lock_s, context.set.standout); fl_print_format("%r %[%s%] Show active firewall settings.", file.stream, f_string_eol_s, context.set.standout, firewall_command_show_s, context.set.standout); - fll_program_print_help_usage(file, context, firewall_program_name_s, "command"); + fll_program_print_help_usage(file, context, firewall_program_name_s, firewall_program_help_parameters_s); funlockfile(file.stream); @@ -58,6 +58,8 @@ extern "C" { f_status_t status = F_none; + main->child = 0; + f_console_parameter_t parameters[] = firewall_console_parameter_t_initialize; main->parameters.array = parameters; main->parameters.used = firewall_total_parameters_d; @@ -144,7 +146,7 @@ extern "C" { } if (main->parameters.array[firewall_parameter_version_e].result == f_console_result_found_e) { - fll_program_print_version(main->output.to, firewall_version_s); + fll_program_print_version(main->output.to, firewall_program_version_s); firewall_main_delete(main); @@ -215,12 +217,11 @@ extern "C" { if (command == firewall_parameter_command_show_e) { - // Warning: these are hardcoded print commands (I am not certain how I am going to implement external 'show' rules as the default-firewall setting file is the wrong place to put this) + // Warning: these are hardcoded print commands. bool show_nat = F_true; bool show_mangle = F_true; bool show_ports = F_true; - f_string_dynamics_t parameters = f_string_dynamics_t_initialize; int return_code = 0; if (main->remaining.used > 0) { @@ -228,72 +229,64 @@ extern "C" { show_mangle = F_false; show_ports = F_false; - f_array_length_t counter = 0; + f_array_length_t index = 0; + + for (f_array_length_t i = 0; i < main->remaining.used; ++i) { - for (; counter < main->remaining.used; ++counter) { + index = main->remaining.array[i]; - if (strncmp("nat", arguments->argv[main->remaining.array[counter]], 4) != 0) { - if (strncmp("mangle", arguments->argv[main->remaining.array[counter]], 7) != 0) { - if (strncmp("ports", arguments->argv[main->remaining.array[counter]], 6) != 0) { + if (fl_string_dynamic_compare(firewall_show_nat_s, argv[index]) == F_equal_to) { + show_nat = F_true; + } + else { + if (fl_string_dynamic_compare(firewall_show_mangle_s, argv[index]) == F_equal_to) { + show_mangle = F_true; + } + else { + if (fl_string_dynamic_compare(firewall_show_ports_s, argv[index]) == F_equal_to) { + show_ports = F_true; + } + else { flockfile(main->warning.to.stream); fl_print_format("%r%[%Q'%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context); - fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, arguments->argv[main->remaining.array[counter]], main->warning.notable); + fl_print_format("%[%Q%]", main->warning.to.stream, main->warning.notable, argv[index], main->warning.notable); fl_print_format("%[' is not a valid show option.%]%r", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s); funlockfile(main->warning.to.stream); fflush(main->warning.to.stream); } - else { - show_ports = F_true; - } } - else { - show_mangle = F_true; - } - } - else { - show_nat = F_true; } } // for } - macro_f_string_dynamics_t_resize(status, parameters, 7); + f_string_statics_t parameters = f_string_statics_t_initialize; + parameters.used = 6; - if (F_status_is_error(status)) { - firewall_print_error_on_allocation_failure(main->error); + f_string_static_t parameters_array[parameters.used]; + parameters.array = parameters_array; - firewall_delete_local_data(&local); - firewall_main_delete(main); - - return status; - } + parameters_array[0] = firewall_show_parameter_exact_s; + parameters_array[1] = firewall_show_parameter_verbose_s; + parameters_array[2] = firewall_show_parameter_table_s; + parameters_array[3] = firewall_show_nat_s; + parameters_array[4] = firewall_show_parameter_numeric_s; + parameters_array[5] = firewall_show_parameter_list_s; if (show_nat) { fll_print_format("%[===========================%] %[NAT%] %[============================%]%r", main->output.to.stream, main->context.set.standout, main->context.set.standout, main->context.set.title, main->context.set.title, main->context.set.standout, main->context.set.standout, f_string_eol_s); fflush(main->output.to.stream); - parameters.used = 6; - - parameters.array[0].string = (f_string_t) "-x"; - parameters.array[1].string = (f_string_t) "-v"; - parameters.array[2].string = (f_string_t) "-t"; - parameters.array[3].string = (f_string_t) "nat"; - parameters.array[4].string = (f_string_t) "--numeric"; - parameters.array[5].string = (f_string_t) "--list"; - - parameters.array[0].used = 2; - parameters.array[1].used = 2; - parameters.array[2].used = 2; - parameters.array[3].used = 3; - parameters.array[4].used = 9; - parameters.array[5].used = 6; - status = fll_execute_program(firewall_tool_iptables_s, parameters, 0, 0, (void *) &return_code); - // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { - exit(return_code); + main->child = return_code; + + firewall_delete_local_data(&local); + firewall_main_delete(main); + + return status; } fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream); @@ -304,27 +297,17 @@ extern "C" { fll_print_format("%[==========================%] %[MANGLE%] %[==========================%]%r", main->output.to.stream, main->context.set.standout, main->context.set.standout, main->context.set.title, main->context.set.title, main->context.set.standout, main->context.set.standout, f_string_eol_s); fflush(main->output.to.stream); - parameters.used = 6; - - parameters.array[0].string = (f_string_t) "-x"; - parameters.array[1].string = (f_string_t) "-v"; - parameters.array[2].string = (f_string_t) "-t"; - parameters.array[3].string = (f_string_t) "mangle"; - parameters.array[4].string = (f_string_t) "--numeric"; - parameters.array[5].string = (f_string_t) "--list"; - - parameters.array[0].used = 2; - parameters.array[1].used = 2; - parameters.array[2].used = 2; - parameters.array[3].used = 6; - parameters.array[4].used = 9; - parameters.array[5].used = 6; + parameters_array[3] = firewall_show_mangle_s; status = fll_execute_program(firewall_tool_iptables_s, parameters, 0, 0, (void *) &return_code); - // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { - exit(return_code); + main->child = return_code; + + firewall_delete_local_data(&local); + firewall_main_delete(main); + + return status; } fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream); @@ -335,23 +318,21 @@ extern "C" { fll_print_format("%[==========================%] %[FILTER%] %[==========================%]%r", main->output.to.stream, main->context.set.standout, main->context.set.standout, main->context.set.title, main->context.set.title, main->context.set.standout, main->context.set.standout, f_string_eol_s); fflush(main->output.to.stream); + parameters_array[0] = firewall_show_parameter_exact_s; + parameters_array[1] = firewall_show_parameter_verbose_s; + parameters_array[2] = firewall_show_parameter_numeric_s; + parameters_array[3] = firewall_show_parameter_list_s; parameters.used = 4; - parameters.array[0].string = (f_string_t) "-x"; - parameters.array[1].string = (f_string_t) "-v"; - parameters.array[2].string = (f_string_t) "--numeric"; - parameters.array[3].string = (f_string_t) "--list"; - - parameters.array[0].used = 2; - parameters.array[1].used = 2; - parameters.array[2].used = 9; - parameters.array[3].used = 6; - status = fll_execute_program(firewall_tool_iptables_s, parameters, 0, 0, (void *) &return_code); - // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { - exit(return_code); + main->child = return_code; + + firewall_delete_local_data(&local); + firewall_main_delete(main); + + return status; } fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream); @@ -371,30 +352,14 @@ extern "C" { status = F_status_set_error(status); } - parameters.array[0].string = 0; - parameters.array[1].string = 0; - parameters.array[2].string = 0; - parameters.array[3].string = 0; - parameters.array[4].string = 0; - parameters.array[5].string = 0; - parameters.array[6].string = 0; - parameters.array[0].used = 0; - parameters.array[1].used = 0; - parameters.array[2].used = 0; - parameters.array[3].used = 0; - parameters.array[4].used = 0; - parameters.array[5].used = 0; - parameters.array[6].used = 0; - - f_string_dynamics_resize(0, & parameters); firewall_delete_local_data(&local); firewall_main_delete(main); return status; } - // load all network devices - status = f_directory_list((f_string_t) network_devices_s, 0, alphasort, &main->devices); + // Load all network devices. + status = f_directory_list(firewall_network_devices_s, 0, alphasort, &main->devices); if (F_status_is_error(status)) { status = F_status_set_fine(status); @@ -407,7 +372,7 @@ extern "C" { fll_print_format("%r%[%QCould not find any network devices.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } else if (status == F_failure) { - fll_print_format("%r%[%QFailed to read the device directory '%s'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, network_devices_s, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QFailed to read the device directory '%r'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, firewall_network_devices_s, main->error.context, f_string_eol_s); } } @@ -417,19 +382,19 @@ extern "C" { return F_status_set_error(status); } - // remove "lo" (loopback) from the device listing + // Remove "lo" (loopback) from the device listing. { f_array_length_t i = 0; for (; i < main->devices.used; ++i) { - if (fl_string_compare((f_string_t) firewall_device_loop_s, main->devices.array[i].string, firewall_device_loop_s_length + 1, main->devices.array[i].used) == F_equal_to) { - f_string_dynamic_t swap_string = main->devices.array[i]; + if (fl_string_dynamic_compare(firewall_device_loop_s, main->devices.array[i]) == F_equal_to) { + f_string_static_t swap_string = main->devices.array[i]; --main->devices.used; for (; i < main->devices.used; ++i) { - main->devices.array[i] = main->devices.array[i+1]; + main->devices.array[i] = main->devices.array[i + 1]; } // for main->devices.array[main->devices.used] = swap_string; @@ -438,42 +403,46 @@ extern "C" { } if (command == firewall_parameter_command_stop_e || command == firewall_parameter_command_restart_e || command == firewall_parameter_command_lock_e) { - status = firewall_buffer_rules(main, network_path_s firewall_file_other_s, F_false, &local); + f_string_static_t path_file_other = f_string_static_t_initialize; + path_file_other.used = firewall_network_path_s.used + firewall_file_other_s.used; - if (F_status_is_error(status)) { + char path_file_other_string[path_file_other.used + 1]; + path_file_other.string = path_file_other_string; + path_file_other[path_file_other.used] = 0; + + memcpy(path_file_other_string, firewall_network_path_s.string, firewall_network_path_s.used); + memcpy(path_file_other_string + firewall_network_path_s.used, firewall_file_other_s.string, firewall_file_other_s.used); + + status = firewall_buffer_rules(main, path_file_other, F_false, &local); + + if (F_status_is_error(status) || status == F_child) { firewall_delete_local_data(&local); firewall_main_delete(main); return status; } - { - f_array_length_t i = 0; - f_array_length_t length = 0; - - for (; i < local.chain_objects.used; ++i) { - length = local.chain_objects.array[i].stop - local.chain_objects.array[i].start + 1; + for (f_array_length_t i = 0; i < local.chain_objects.used; ++i) { - if (!reserved.has_stop && fl_string_compare((f_string_t) firewall_group_stop_s, local.buffer.string + local.chain_objects.array[i].start, firewall_group_stop_s_length, length) == F_equal_to) { - reserved.stop_at = i; - reserved.has_stop = F_true; - } - else if (!reserved.has_lock && fl_string_compare((f_string_t) firewall_group_lock_s, local.buffer.string + local.chain_objects.array[i].start, firewall_group_lock_s_length, length) == F_equal_to) { - reserved.lock_at = i; - reserved.has_lock = F_true; - } - } // for - } + if (!reserved.has_stop && fl_string_dynamic_partial_compare_string(firewall_group_stop_s.string, local.buffer, firewall_group_stop_s.used, local.chain_objects.array[i]) == F_equal_to) { + reserved.stop_at = i; + reserved.has_stop = F_true; + } + else if (!reserved.has_lock && fl_string_dynamic_partial_compare_string(firewall_group_lock_s.string, local.buffer, firewall_group_lock_s.used, local.chain_objects.array[i]) == F_equal_to) { + reserved.lock_at = i; + reserved.has_lock = F_true; + } + } // for if (command == firewall_parameter_command_lock_e) { if (reserved.has_lock) { status = firewall_delete_chains(main); - if (F_status_is_error_not(status)) { + if (F_status_is_error_not(status) && status != F_child) { status = firewall_default_lock(main); } - if (F_status_is_error(status)) { + if (F_status_is_error(status) || status == F_child) { firewall_delete_local_data(&local); firewall_main_delete(main); @@ -495,27 +464,26 @@ extern "C" { return status; } - else { - if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%r%[%QFailed to perform lock request because the lock instructions are missing from: %s.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, network_path_s firewall_file_other_s, main->error.context, f_string_eol_s); - } - firewall_delete_local_data(&local); - firewall_main_delete(main); - - return F_status_set_error(F_data); + if (main->error.verbosity != f_console_verbosity_quiet_e) { + fll_print_format("%r%[%QFailed to perform lock request because the lock instructions are missing from: %r.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, path_file_other, main->error.context, f_string_eol_s); } + + firewall_delete_local_data(&local); + firewall_main_delete(main); + + return F_status_set_error(F_data); } if (command == firewall_parameter_command_stop_e || command == firewall_parameter_command_restart_e) { if (reserved.has_stop) { status = firewall_delete_chains(main); - if (F_status_is_error_not(status)) { + if (F_status_is_error_not(status) && status != F_child) { status = firewall_default_lock(main); } - if (F_status_is_error(status)) { + if (F_status_is_error(status) || status == F_child) { firewall_delete_local_data(&local); firewall_main_delete(main); @@ -533,7 +501,7 @@ extern "C" { status = firewall_process_rules(main, &input, &local); - if (F_status_is_error(status) || command == firewall_parameter_command_stop_e) { + if (F_status_is_error(status) || command == firewall_parameter_command_stop_e || status == F_child) { firewall_delete_local_data(&local); firewall_main_delete(main); @@ -542,7 +510,7 @@ extern "C" { } else { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%r%[%QFailed to perform stop request because the lock instructions are missing from: %s.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, network_path_s firewall_file_other_s, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QFailed to perform stop request because the lock instructions are missing from: %r.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, path_file_other, main->error.context, f_string_eol_s); } firewall_delete_local_data(&local); @@ -556,9 +524,19 @@ extern "C" { } if (command == firewall_parameter_command_start_e || command == firewall_parameter_command_restart_e) { - status = firewall_buffer_rules(main, network_path_s firewall_file_first_s, F_false, &local); + f_string_static_t path_file_first = f_string_static_t_initialize; + path_file_first.used = firewall_network_path_s.used + firewall_file_first_s.used; - if (F_status_is_error(status)) { + char path_file_first_string[path_file_first.used + 1]; + path_file_first.string = path_file_first_string; + path_file_first[path_file_first.used] = 0; + + memcpy(path_file_first_string, firewall_network_path_s.string, firewall_network_path_s.used); + memcpy(path_file_first_string + firewall_network_path_s.used, firewall_file_first_s.string, firewall_file_first_s.used); + + status = firewall_buffer_rules(main, path_file_first, F_false, &local); + + if (F_status_is_error(status) || status == F_child) { firewall_delete_local_data(&local); firewall_main_delete(main); @@ -568,11 +546,11 @@ extern "C" { if (command == firewall_parameter_command_start_e) { status = firewall_delete_chains(main); - if (F_status_is_error_not(status)) { + if (F_status_is_error_not(status) && status != F_child) { status = firewall_default_lock(main); } - if (F_status_is_error(status)) { + if (F_status_is_error(status) || status == F_child) { firewall_delete_local_data(&local); firewall_main_delete(main); @@ -582,7 +560,7 @@ extern "C" { status = firewall_create_custom_chains(main, &reserved, &local); - if (F_status_is_error(status)) { + if (F_status_is_error(status) || status == F_child) { firewall_delete_local_data(&local); firewall_main_delete(main); @@ -605,7 +583,7 @@ extern "C" { status = firewall_process_rules(main, &input, &local); - if (F_status_is_error(status) || command == firewall_parameter_command_stop_e) { + if (F_status_is_error(status) || command == firewall_parameter_command_stop_e || status == F_child) { firewall_delete_local_data(&local); firewall_main_delete(main); @@ -617,13 +595,32 @@ extern "C" { firewall_delete_local_data(&local); - for (i = 0; i < main->devices.used; ++i) { - local.device = i; + { + f_string_dynamic_t file_path = f_string_dynamic_t_initialize; + f_array_length_t j = 0; + + for (i = 0; i < main->devices.used; ++i) { + + file_path.used = 0; + local.device = i; + + status = f_string_dynamic_increase_by(firewall_network_path_s.used + main->devices.array[i].used + firewall_file_suffix_s_length + 1, &file_path); + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_append(firewall_network_path_s, &file_path); + } + + if (F_status_is_error_not(status)) { + status = f_string_dynamic_append(main->devices.array[i], &file_path); + } - { - f_string_dynamic_t file_path = f_string_dynamic_t_initialize; + if (F_status_is_error_not(status)) { + status = f_string_dynamic_append(firewall_file_suffix_s, &file_path); + } - macro_f_string_dynamic_t_resize(status, file_path, network_path_s_length + main->devices.array[i].used + firewall_file_suffix_s_length + 1); + if (F_status_is_error_not(status)) { + status = f_string_dynamic_terminate_after(&file_path); + } if (F_status_is_error(status)) { firewall_print_error_on_allocation_failure(main->error); @@ -634,72 +631,76 @@ extern "C" { return status; } - memcpy((void *)file_path.string, network_path_s, network_path_s_length); - memcpy((void *)(file_path.string + network_path_s_length), main->devices.array[i].string, main->devices.array[i].used); - memcpy((void *)(file_path.string + network_path_s_length + main->devices.array[i].used), firewall_file_suffix_s, firewall_file_suffix_s_length); - - file_path.used = network_path_s_length + main->devices.array[i].used + firewall_file_suffix_s_length; - file_path.string[file_path.used] = 0; + status = firewall_buffer_rules(main, file_path, F_true, &local); - status = firewall_buffer_rules(main, file_path.string, F_true, &local); - - f_string_dynamic_resize(0, &file_path); - } + if (status == F_child) { + firewall_delete_local_data(&local); - if (F_status_is_error(status)) { - status = F_status_set_fine(status); + f_string_dynamic_resize(0, &file_path); - firewall_delete_local_data(&local); + firewall_main_delete(main); - if (status == F_file_found_not || status == F_file_open || status == F_file_descriptor || status == F_fss_found_object_content_not) { - status = F_status_set_error(status); - continue; + return status; } - firewall_main_delete(main); - - return F_status_set_error(status); - } - - status = firewall_create_custom_chains(main, &reserved, &local); - - if (F_status_is_error(status)) { - firewall_delete_local_data(&local); - firewall_main_delete(main); + if (F_status_is_error(status)) { + status = F_status_set_fine(status); - return status; - } + firewall_delete_local_data(&local); - f_array_length_t j = 0; + if (status == F_file_found_not || status == F_file_open || status == F_file_descriptor || status == F_fss_found_object_content_not) { + status = F_status_set_error(status); - local.is_global = F_false; - local.is_stop = F_false; - local.is_lock = F_false; + continue; + } - for (; j < local.chain_contents.used; ++j) { + f_string_dynamic_resize(0, &file_path); - input.start = local.chain_contents.array[j].array[0].start; - input.stop = local.chain_contents.array[j].array[0].stop; + firewall_main_delete(main); - local.is_main = reserved.has_main && j == reserved.main_at ? F_true : F_false; - local.chain = j; + return F_status_set_error(status); + } - status = firewall_process_rules(main, &input, &local); + status = firewall_create_custom_chains(main, &reserved, &local); - if (F_status_is_error(status) || command == firewall_parameter_command_stop_e) { + if (F_status_is_error(status) || status == F_child) { firewall_delete_local_data(&local); firewall_main_delete(main); return status; } + + local.is_global = F_false; + local.is_stop = F_false; + local.is_lock = F_false; + + for (j = 0; j < local.chain_contents.used; ++j) { + + input.start = local.chain_contents.array[j].array[0].start; + input.stop = local.chain_contents.array[j].array[0].stop; + + local.is_main = reserved.has_main && j == reserved.main_at ? F_true : F_false; + local.chain = j; + + status = firewall_process_rules(main, &input, &local); + + if (F_status_is_error(status) || command == firewall_parameter_command_stop_e || status == F_child) { + firewall_delete_local_data(&local); + firewall_main_delete(main); + + return status; + } + } // for + + firewall_delete_local_data(&local); } // for - firewall_delete_local_data(&local); - } // for + f_string_dynamic_resize(0, &file_path); + } status = firewall_buffer_rules(main, network_path_s firewall_file_last_s, F_false, &local); - if (F_status_is_error(status)) { + if (F_status_is_error(status) || status == F_child) { firewall_delete_local_data(&local); firewall_main_delete(main); @@ -708,7 +709,7 @@ extern "C" { status = firewall_create_custom_chains(main, &reserved, &local); - if (F_status_is_error(status)) { + if (F_status_is_error(status) || status == F_child) { f_status_t status2 = F_none; macro_firewall_delete_fss_buffers(status2, local.buffer, local.chain_objects, local.chain_contents) @@ -733,7 +734,7 @@ extern "C" { status = firewall_process_rules(main, &input, &local); - if (F_status_is_error(status) || command == firewall_parameter_command_stop_e) { + if (F_status_is_error(status) || command == firewall_parameter_command_stop_e || status == F_child) { firewall_delete_local_data(&local); firewall_main_delete(main); @@ -744,12 +745,11 @@ extern "C" { } // while } - // cleanup firewall_delete_local_data(&local); } else { if (main->error.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%r%[%QYou did not pass a command.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QNo command given.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); } status = F_status_set_error(F_parameter); @@ -769,21 +769,6 @@ extern "C" { } #endif // _di_firewall_main_ -#ifndef _di_firewall_main_delete_ - f_status_t firewall_main_delete(firewall_main_t * const main) { - - 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); - - return F_none; - } -#endif // _di_firewall_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/firewall/c/firewall.h b/level_3/firewall/c/firewall.h index ef58c8c..ea5279c 100644 --- a/level_3/firewall/c/firewall.h +++ b/level_3/firewall/c/firewall.h @@ -48,292 +48,13 @@ #include #include +// Firewall includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_firewall_program_version_ - #define FIREWALL_program_version_major_s F_string_ascii_0_s - #define FIREWALL_program_version_minor_s F_string_ascii_5_s - #define FIREWALL_program_version_micro_s F_string_ascii_8_s - - #define FIREWALL_program_version_major_s_length F_string_ascii_0_s_length - #define FIREWALL_program_version_minor_s_length F_string_ascii_5_s_length - #define FIREWALL_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FIREWALL_program_version_nano_prefix_s) && defined(FIREWALL_program_version_nano_prefix_s_length)) - #define FIREWALL_program_version_nano_prefix_s - #define FIREWALL_program_version_nano_prefix_s_length 0 - #endif // !(defined(FIREWALL_program_version_nano_prefix_s) && defined(FIREWALL_program_version_nano_prefix_s_length)) - - #if !(defined(FIREWALL_program_version_nano_s) && defined(FIREWALL_program_version_nano_s_length)) - #define FIREWALL_program_version_nano_s - #define FIREWALL_program_version_nano_s_length 0 - #endif // !(defined(FIREWALL_program_version_nano_s) && defined(FIREWALL_program_version_nano_s_length)) - - #define FIREWALL_version_s FIREWALL_program_version_major_s F_string_ascii_period_s FIREWALL_program_version_minor_s F_string_ascii_period_s FIREWALL_program_version_micro_s FIREWALL_program_version_nano_prefix_s FIREWALL_program_version_nano_s - - #define FIREWALL_version_s_length FIREWALL_program_version_major_s_length + F_string_ascii_period_s_length + FIREWALL_program_version_minor_s_length + F_string_ascii_period_s_length + FIREWALL_program_version_micro_s_length + FIREWALL_program_version_nano_prefix_s_length + FIREWALL_program_version_nano_s_length - - extern const f_string_static_t firewall_program_version_s; -#endif // _di_firewall_program_version_ - -#ifndef _di_firewall_program_name_ - #define FIREWALL_program_name_s "firewall" - #define FIREWALL_program_name_long_s "Kevux Firewall Manager" - - #define FIREWALL_program_name_s_length 8 - #define FIREWALL_program_name_long_s_length 22 - - extern const f_string_static_t firewall_program_name_s; - extern const f_string_static_t firewall_program_name_long_s; -#endif // _di_firewall_program_name_ - -#ifndef _di_firewall_paths_ - #define network_path_s "/etc/network/" // TODO: this should be moved to a network project library, possibly the Paths project in fot the network project - #define network_devices_s "/sys/class/net/" // TODO: this should also be moved to a network project library - #define firewall_file_first_s "firewall-first" - #define firewall_file_last_s "firewall-last" - #define firewall_file_other_s "firewall-other" - #define firewall_file_suffix_s "-firewall" - - #define network_path_s_length 13 - #define network_devices_s_length 15 - #define firewall_file_first_s_length 14 - #define firewall_file_last_s_length 13 - #define firewall_file_other_s_length 14 - #define firewall_file_suffix_s_length 9 -#endif // _di_firewall_paths_ - -#ifndef _di_firewall_default_allocation_step_ - #define firewall_default_allocation_step_d F_memory_default_allocation_small_d -#endif // _di_firewall_default_allocation_step_ - -#ifndef _di_firewall_defines_ - #define firewall_signal_check_d 10000 - - #define firewall_tool_s "tool" - #define firewall_tool_iptables_s "iptables" - #define firewall_tool_ip6tables_s "ip6tables" - #define firewall_tool_ip46tables_s "ip46tables" - #define firewall_tool_ipset_s "ipset" - - #define firewall_tool_s_length 4 - #define firewall_tool_iptables_s_length 8 - #define firewall_tool_ip6tables_s_length 9 - #define firewall_tool_ip46tables_s_length 10 - #define firewall_tool_ipset_s_length 5 - - #define firewall_group_stop_s "stop" - #define firewall_group_lock_s "lock" - #define firewall_group_main_s "main" - - #define firewall_group_stop_s_length 4 - #define firewall_group_lock_s_length 4 - #define firewall_group_main_s_length 4 - - #define firewall_command_start_s "start" - #define firewall_command_stop_s "stop" - #define firewall_command_restart_s "restart" - #define firewall_command_lock_s "lock" - #define firewall_command_show_s "show" - - #define firewall_command_start_s_length 5 - #define firewall_command_stop_s_length 4 - #define firewall_command_restart_s_length 7 - #define firewall_command_lock_s_length 4 - #define firewall_command_show_s_length 4 - - #define firewall_ip_list "ip_list" - #define firewall_ip_list_source_s "source" - #define firewall_ip_list_source_action_s "-s" - #define firewall_ip_list_destination_s "destination" - #define firewall_ip_list_destination_action_s "-d" - - #define firewall_ip_list_length_s 7 - #define firewall_ip_list_source_s_length 6 - #define firewall_ip_list_source_action_s_length 2 - #define firewall_ip_list_destination_s_length 11 - #define firewall_ip_list_destination_action_s_length 2 - - #define firewall_rule_s "rule" - #define firewall_rule_s_length 4 - - #define firewall_chain_s "chain" - #define firewall_chain_forward_s "FORWARD" - #define firewall_chain_input_s "INPUT" - #define firewall_chain_none_s "none" - #define firewall_chain_output_s "OUTPUT" - #define firewall_chain_postrouting_s "POSTROUTING" - #define firewall_chain_prerouting_s "PREROUTING" - - #define firewall_chain_s_length 5 - #define firewall_chain_forward_s_length 7 - #define firewall_chain_input_s_length 5 - #define firewall_chain_none_s_length 4 - #define firewall_chain_output_s_length 6 - #define firewall_chain_postrouting_s_length 12 - #define firewall_chain_prerouting_s_length 11 - - #define firewall_direction_s "direction" - #define firewall_direction_input_s "input" - #define firewall_direction_output_s "output" - #define firewall_direction_none_s "none" - - #define firewall_direction_s_length 9 - #define firewall_direction_input_s_length 5 - #define firewall_direction_output_s_length 6 - #define firewall_direction_none_s_length 4 - - #define firewall_action_s "action" - #define firewall_action_append_s "append" - #define firewall_action_insert_s "insert" - #define firewall_action_policy_s "policy" - #define firewall_action_none_s "none" - - #define firewall_action_length_s 6 - #define firewall_action_append_s_length 6 - #define firewall_action_insert_s_length 6 - #define firewall_action_policy_s_length 6 - #define firewall_action_none_s_length 4 - - #define firewall_action_append_command_s "-A" - #define firewall_action_insert_command_s "-I" - #define firewall_action_policy_command_s "-P" - - #define firewall_action_append_command_s_length 2 - #define firewall_action_insert_command_s_length 2 - #define firewall_action_policy_command_s_length 2 - - #define firewall_device_s "device" - #define firewall_device_all_s "all" - #define firewall_device_this_s "this" - #define firewall_device_loop_s "lo" - - #define firewall_device_s_length 6 - #define firewall_device_all_s_length 3 - #define firewall_device_this_s_length 4 - #define firewall_device_loop_s_length 2 - - #define firewall_device_input_command_s "-i" - #define firewall_device_output_command_s "-o" - - #define firewall_device_input_command_length_s 2 - #define firewall_device_output_command_length_s 2 - - #define firewall_protocol_s "protocol" - #define firewall_protocol_none_s "none" - - #define firewall_protocol_s_length 8 - #define firewall_protocol_none_s_length 4 - - #define firewall_protocol_command_s "-p" - #define firewall_protocol_command_s_length 2 - - #define firewall_chain_create_command_s "-N" - #define firewall_chain_delete_command_s "-X" - - #define firewall_chain_create_command_s_length 2 - #define firewall_chain_delete_command_s_length 2 - - enum { - firewall_program_none_e = 1, - firewall_program_iptables_e, - firewall_program_ip6tables_e, - firewall_program_ip46tables_e, - firewall_program_ipset_e, - }; - - enum { - firewall_parameter_help_e, - firewall_parameter_light_e, - firewall_parameter_dark_e, - firewall_parameter_no_color_e, - firewall_parameter_verbosity_quiet_e, - firewall_parameter_verbosity_normal_e, - firewall_parameter_verbosity_verbose_e, - firewall_parameter_verbosity_debug_e, - firewall_parameter_version_e, - - firewall_parameter_command_start_e, - firewall_parameter_command_stop_e, - firewall_parameter_command_restart_e, - firewall_parameter_command_lock_e, - firewall_parameter_command_show_e, - - firewall_direction_input_id_e, - firewall_direction_output_id_e, - firewall_direction_none_id_e, - - firewall_chain_forward_id_e, - firewall_chain_custom_id_e, - firewall_chain_input_id_e, - firewall_chain_none_id_e, - firewall_chain_output_id_e, - firewall_chain_postrouting_id_e, - firewall_chain_prerouting_id_e, - - firewall_action_append_id_e, - firewall_action_insert_id_e, - firewall_action_policy_id_e, - firewall_action_none_id_e, - }; - - #define firewall_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(0, 0, firewall_command_start_s, F_false, f_console_type_other_e), \ - macro_f_console_parameter_t_initialize(0, 0, firewall_command_stop_s, F_false, f_console_type_other_e), \ - macro_f_console_parameter_t_initialize(0, 0, firewall_command_restart_s, F_false, f_console_type_other_e), \ - macro_f_console_parameter_t_initialize(0, 0, firewall_command_lock_s, F_false, f_console_type_other_e), \ - macro_f_console_parameter_t_initialize(0, 0, firewall_command_show_s, F_false, f_console_type_other_e), \ - } - - #define firewall_total_parameters_d 14 -#endif // _di_firewall_defines_ - -#ifndef _di_firewall_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_dynamics_t chains; - f_string_dynamics_t devices; - - f_color_context_t context; - } firewall_main_t; - - #define firewall_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_dynamics_t_initialize, \ - f_string_dynamics_t_initialize, \ - f_color_context_t_initialize, \ - } -#endif // _di_firewall_main_t_ - /** * Print help. * @@ -380,25 +101,6 @@ extern "C" { extern f_status_t firewall_main(firewall_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_firewall_main_ -/** - * De-allocate data. - * - * Be sure to call this after executing firewall_main(). - * - * @param data - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see firewall_main() - */ -#ifndef _di_firewall_main_delete_ - extern f_status_t firewall_main_delete(firewall_main_t * const data); -#endif // _di_firewall_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/firewall/c/main.c b/level_3/firewall/c/main.c index 464a128..66f7f8d 100644 --- a/level_3/firewall/c/main.c +++ b/level_3/firewall/c/main.c @@ -15,6 +15,10 @@ int main(const int argc, const f_string_t *argv) { fll_program_standard_setdown(&data.signal); + if (status == F_child) { + exit(data.child); + } + if (F_status_is_error(status)) return 1; return 0; diff --git a/level_3/firewall/c/private-common.c b/level_3/firewall/c/private-common.c index efd7280..3383065 100644 --- a/level_3/firewall/c/private-common.c +++ b/level_3/firewall/c/private-common.c @@ -5,13 +5,13 @@ extern "C" { #endif -void firewall_print_debug_tool(const fl_print_t output, const f_string_t tool, const f_string_dynamics_t arguments) { +void firewall_print_debug_tool(const fl_print_t output, const f_string_static_t tool, const f_string_statics_t arguments) { if (output.verbosity != f_console_verbosity_debug_e) return; flockfile(output.to.stream); - fl_print_format("%[%s", output.to.stream, output.context, tool); + fl_print_format("%[%r", output.to.stream, output.context, tool); for (f_array_length_t i = 0; i < arguments.used; ++i) { fl_print_format(" %Q", output.to.stream, arguments.array[i]); @@ -26,31 +26,31 @@ void firewall_print_error_on_allocation_failure(const fl_print_t output) { if (output.verbosity == f_console_verbosity_quiet_e) return; - fll_print_format("%r%[%sUnable to allocate memory.%]%r", output.to.stream, f_string_eol_s, output.context, output.prefix, output.context, f_string_eol_s); + fll_print_format("%r%[%QUnable to allocate memory.%]%r", output.to.stream, f_string_eol_s, output.context, output.prefix, output.context, f_string_eol_s); } void firewall_print_error_on_invalid_parameter(const fl_print_t output, const f_string_t function) { if (output.verbosity == f_console_verbosity_quiet_e) return; - fll_print_format("%r%[%sInvalid parameter when calling %S().%]%r", output.to.stream, f_string_eol_s, output.context, output.prefix, function, output.context, f_string_eol_s); + fll_print_format("%r%[%QInvalid parameter when calling %s().%]%r", output.to.stream, f_string_eol_s, output.context, output.prefix, function, output.context, f_string_eol_s); } -void firewall_print_error_on_invalid_parameter_for_file(const fl_print_t output, const f_string_t function, const f_string_t filename) { +void firewall_print_error_on_invalid_parameter_for_file(const fl_print_t output, const f_string_t function, const f_string_static_t filename) { if (output.verbosity == f_console_verbosity_quiet_e) return; - fll_print_format("%r%[%sInvalid parameter when calling %S() for the file '%S'.%]%r", output.to.stream, f_string_eol_s, output.context, output.prefix, function, filename, output.context, f_string_eol_s); + fll_print_format("%r%[%QInvalid parameter when calling %s() for the file '%Q'.%]%r", output.to.stream, f_string_eol_s, output.context, output.prefix, function, filename, output.context, f_string_eol_s); } -void firewall_print_error_on_operation(const fl_print_t output, const f_string_t tool, const f_string_dynamics_t arguments) { +void firewall_print_error_on_operation(const fl_print_t output, const f_string_static_t tool, const f_string_statics_t arguments) { if (output.verbosity == f_console_verbosity_quiet_e) return; flockfile(output.to.stream); - fl_print_format("%r%[%sFailed to perform requested %s operation:%]", output.to.stream, f_string_eol_s, output.context, output.prefix, tool, output.context); - fl_print_format("%r %[%s", output.to.stream, f_string_eol_s, output.context, tool); + fl_print_format("%r%[%QFailed to perform requested %r operation:%]", output.to.stream, f_string_eol_s, output.context, output.prefix, tool, output.context); + fl_print_format("%r %[%r", output.to.stream, f_string_eol_s, output.context, tool); for (f_array_length_t i = 0; i < arguments.used; ++i) { fl_print_format(" %Q", output.to.stream, arguments.array[i]); @@ -65,14 +65,14 @@ void firewall_print_error_on_unhandled(const fl_print_t output, const f_string_t if (output.verbosity == f_console_verbosity_quiet_e) return; - fll_print_format("%r%[%sAn unhandled error (%ui) has occurred while calling %S().%]%r", output.to.stream, f_string_eol_s, output.context, output.prefix, status, function, output.context, f_string_eol_s); + fll_print_format("%r%[%QAn unhandled error (%ui) has occurred while calling %s().%]%r", output.to.stream, f_string_eol_s, output.context, output.prefix, status, function, output.context, f_string_eol_s); } -void firewall_print_error_on_unhandled_for_file(const fl_print_t output, const f_string_t function, const f_status_t status, const f_string_t filename) { +void firewall_print_error_on_unhandled_for_file(const fl_print_t output, const f_string_t function, const f_status_t status, const f_string_static_t filename) { if (output.verbosity == f_console_verbosity_quiet_e) return; - fll_print_format("%r%[%sAn unhandled error (%ui) has occurred while calling %S() for the file '%S'.%]%r", output.to.stream, f_string_eol_s, output.context, output.prefix, status, function, filename, output.context, f_string_eol_s); + fll_print_format("%r%[%QAn unhandled error (%ui) has occurred while calling %s() for the file '%Q'.%]%r", output.to.stream, f_string_eol_s, output.context, output.prefix, status, function, filename, output.context, f_string_eol_s); } #ifndef _di_firewall_print_signal_received_ diff --git a/level_3/firewall/c/private-common.h b/level_3/firewall/c/private-common.h index 677f757..2503bf8 100644 --- a/level_3/firewall/c/private-common.h +++ b/level_3/firewall/c/private-common.h @@ -108,7 +108,7 @@ typedef struct { * @param arguments * The arguments passed to the tool. */ -extern void firewall_print_debug_tool(const fl_print_t output, const f_string_t tool, const f_string_dynamics_t arguments) F_attribute_visibility_internal_d; +extern void firewall_print_debug_tool(const fl_print_t output, const f_string_static_t tool, const f_string_statics_t arguments) F_attribute_visibility_internal_d; /** * Print an memory allocation error. @@ -138,7 +138,7 @@ extern void firewall_print_error_on_invalid_parameter(const fl_print_t output, c * @param filename * The name of the file. */ -extern void firewall_print_error_on_invalid_parameter_for_file(const fl_print_t output, const f_string_t function, const f_string_t filename) F_attribute_visibility_internal_d; +extern void firewall_print_error_on_invalid_parameter_for_file(const fl_print_t output, const f_string_t function, const f_string_static_t filename) F_attribute_visibility_internal_d; /** * Print an error about the given operation failed. @@ -150,7 +150,7 @@ extern void firewall_print_error_on_invalid_parameter_for_file(const fl_print_t * @param arguments * The arguments passed to the tool. */ -extern void firewall_print_error_on_operation(const fl_print_t output, const f_string_t tool, const f_string_dynamics_t arguments) F_attribute_visibility_internal_d; +extern void firewall_print_error_on_operation(const fl_print_t output, const f_string_static_t tool, const f_string_statics_t arguments) F_attribute_visibility_internal_d; /** * Print an unhandled error for the given function. @@ -176,7 +176,7 @@ extern void firewall_print_error_on_unhandled(const fl_print_t output, const f_s * @param filename * The name of the file. */ -extern void firewall_print_error_on_unhandled_for_file(const fl_print_t output, const f_string_t function, const f_status_t status, const f_string_t filename) F_attribute_visibility_internal_d; +extern void firewall_print_error_on_unhandled_for_file(const fl_print_t output, const f_string_t function, const f_status_t status, const f_string_static_t filename) F_attribute_visibility_internal_d; /** * Print a message about a process signal being recieved, such as an interrupt signal. diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index 1374922..e9ede71 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -20,7 +20,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal bool is_ip_list = F_false; f_string_dynamic_t ip_list = f_string_dynamic_t_initialize; - // iptables command arguments + // Iptables command arguments bool device_all = F_false; bool ip_list_direction = F_false; // false = source, true = destination bool use_protocol = F_false; @@ -56,7 +56,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } } - // for custom chains, the chain command may not be specified. + // For custom chains, the chain command may not be specified. if (!(local.is_main || local.is_stop || local.is_lock)) { chain = firewall_chain_custom_id_e; } @@ -85,12 +85,13 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal f_string_dynamic_resize(0, &ip_list); - // process chain rule + // Process chain rule if (length >= firewall_chain_s_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_chain_s, length, firewall_chain_s_length) == F_equal_to) { if (chain == firewall_chain_custom_id_e) { - // custom chains can only apply to themselves, so silently ignore chain commands specified within a custom chain. + // Custom chains can only apply to themselves, so silently ignore chain commands specified within a custom chain. fll_print_format("%r%[%QAt line %ul, the chain option is meaningless inside of a custom chain.%]%r", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, i, main->warning.context, f_string_eol_s); + continue; } @@ -123,7 +124,8 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (!invalid) continue; } - // process direction rule + + // Process direction rule else if (length >= firewall_direction_s_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_direction_s, length, firewall_direction_s_length) == F_equal_to) { length = macro_firewall_structure_size(local.rule_contents.array[i], 0); @@ -140,13 +142,15 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal direction = firewall_direction_none_id_e; } else { - // direction must be specified, and no custom directions are allowed. + + // Direction must be specified, and no custom directions are allowed. invalid = F_true; } if (!invalid) continue; } - // process device rule. + + // Process device rule. else if (length >= firewall_device_s_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_device_s, length, firewall_device_s_length) == F_equal_to) { length = macro_firewall_structure_size(local.rule_contents.array[i], 0); @@ -200,7 +204,8 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal continue; } } - // process action rule. + + // Process action rule. else if (length >= firewall_action_length_s && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_action_s, length, firewall_action_length_s) == F_equal_to) { length = macro_firewall_structure_size(local.rule_contents.array[i], 0); @@ -225,7 +230,8 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (!invalid) continue; } - // process ip_list rule. + + // Process ip_list rule. else if (length >= firewall_ip_list_length_s && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_ip_list, length, firewall_ip_list_length_s) == F_equal_to) { length = macro_firewall_structure_size(local.rule_contents.array[i], 0); is_ip_list = F_true; @@ -266,7 +272,8 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal continue; } } - // process tool rule. + + // Process tool rule. else if (length >= firewall_tool_s_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_tool_s, length, firewall_tool_s_length) == F_equal_to) { length = macro_firewall_structure_size(local.rule_contents.array[i], 0); @@ -299,7 +306,8 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (!invalid) continue; } } - // process rule rule, if the remaining rule does not match as firewall_rule_s, then it is an invalid rule. + + // Process rule rule, if the remaining rule does not match as firewall_rule_s, then it is an invalid rule. else if (length < firewall_rule_s_length || fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_rule_s, length, firewall_rule_s_length) == F_equal_to_not) { if (length) { flockfile(main->warning.to.stream); @@ -340,7 +348,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal for (r = repeat; r > 0; --r) { - // first add the program name + // First add the program name f_string_dynamics_resize(0, &arguments); status = f_string_dynamics_increase(F_memory_default_allocation_small_d, &arguments); @@ -361,7 +369,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (F_status_is_error(status)) break; - // process the action when a non-none chain is specified. + // Process the action when a non-none chain is specified. if (chain != firewall_chain_none_id_e && action != firewall_action_none_id_e) { if (action == firewall_action_append_id_e) { macro_f_string_dynamic_t_resize(status, argument, firewall_action_append_command_s_length); @@ -396,7 +404,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal break; } - // process the chain, which is required by the action. + // Process the chain, which is required by the action. if (chain == firewall_chain_custom_id_e) { if (main->chains.array[local.chain_ids.array[local.chain]].used > 0) { macro_f_string_dynamic_t_resize(status, argument, main->chains.array[local.chain_ids.array[local.chain]].used); @@ -457,7 +465,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } } - // add the device if and only if a non-none direction is specified. + // Add the device if and only if a non-none direction is specified. if (device.used > 0 && (direction == firewall_direction_input_id_e || direction == firewall_direction_output_id_e)) { if (length < firewall_device_all_s_length || fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_device_all_s, length, firewall_device_all_s_length) == F_equal_to_not) { if (direction == firewall_direction_input_id_e) { @@ -483,7 +491,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } } - // add the device. + // Add the device. if (device.used > 0) { macro_f_string_dynamic_t_resize(status, argument, device.used); @@ -527,13 +535,13 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } } - // last up is the "rule" + // Last up is the "rule" if ((!is_ip_list && local.rule_contents.array[i].used > 0) || (is_ip_list && local.rule_contents.array[i].used > 1)) { f_array_length_t subcounter = 0; if (is_ip_list) { - // skip past the chain + // Skip past the chain ++subcounter; length = macro_firewall_structure_size(local.rule_contents.array[i], subcounter); @@ -542,7 +550,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal macro_f_string_dynamic_t_resize(status, ip_list, length); if (F_status_is_error(status)) { - // prevent the loop below from being processed. + // Prevent the loop below from being processed. subcounter = local.rule_contents.array[i].used; } else { @@ -587,7 +595,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal break; } - // now execute the generated commands. + // Now execute the generated commands. if (arguments.used > 1) { if (is_ip_list) { f_file_t file = f_file_t_initialize; @@ -618,7 +626,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal } else if (status == F_file_found_not) { - // the file does not have to exist + // The file does not have to exist if (main->error.verbosity != f_console_verbosity_verbose_e || main->error.verbosity == f_console_verbosity_debug_e) { fll_print_format("%r%[%QCannot find the file '%Q'.%]%r", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, file_path, main->warning.context, f_string_eol_s); } @@ -699,7 +707,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal firewall_print_error_on_invalid_parameter_for_file(main->error, "fll_fss_basic_read", file_path.used ? file_path.string : ""); } else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) { - // empty files are to be silently ignored + // Empty files are to be silently ignored } else if (status == F_memory_not) { firewall_print_error_on_allocation_failure(main->error); @@ -784,7 +792,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = fll_execute_program(current_tool, arguments, 0, 0, (void *) &return_code); - // Immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { f_string_dynamic_resize(0, &ip_list); f_string_dynamic_resize(0, &argument); @@ -792,7 +799,9 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal f_string_dynamic_resize(0, &device); f_string_dynamic_resize(0, &protocol); - exit(return_code); + main->child = return_code; + + return status; } if (F_status_is_error(status)) { @@ -839,7 +848,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = fll_execute_program(current_tool, arguments, 0, 0, (void *) &return_code); - // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { f_string_dynamic_resize(0, &ip_list); f_string_dynamic_resize(0, &argument); @@ -847,7 +855,9 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal f_string_dynamic_resize(0, &device); f_string_dynamic_resize(0, &protocol); - exit(return_code); + main->child = return_code; + + return status; } if (F_status_is_error(status)) { @@ -946,7 +956,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ } } - // skip globally reserved chain name: main + // Skip globally reserved chain name: main range.start = 0; range.stop = firewall_group_main_s_length - 1; fixed_string.string = firewall_group_main_s; @@ -957,7 +967,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ reserved->main_at = i; } - // skip globally reserved chain name: stop + // Skip globally reserved chain name: stop range.start = 0; range.stop = firewall_group_stop_s_length - 1; fixed_string.string = firewall_group_stop_s; @@ -968,7 +978,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ reserved->stop_at = i; } - // skip globally reserved chain name: lock + // Skip globally reserved chain name: lock range.start = 0; range.stop = firewall_group_lock_s_length - 1; fixed_string.string = firewall_group_lock_s; @@ -979,7 +989,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ reserved->lock_at = i; } - // skip globally reserved chain name: none + // Skip globally reserved chain name: none range.start = 0; range.stop = firewall_group_lock_s_length - 1; fixed_string.string = firewall_chain_none_s; @@ -1082,11 +1092,12 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ tool = firewall_program_iptables_e; status = fll_execute_program(firewall_tool_iptables_s, arguments, 0, 0, (void *) &return_code); - // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { f_string_dynamics_resize(0, &arguments); - exit(return_code); + main->child = return_code; + + return status; } if (F_status_is_error_not(status)) { @@ -1103,11 +1114,12 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ tool = firewall_program_ip6tables_e; status = fll_execute_program((f_string_t) firewall_tool_ip6tables_s, arguments, 0, 0, (void *) &return_code); - // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { f_string_dynamics_resize(0, &arguments); - exit(return_code); + main->child = return_code; + + return status; } } @@ -1151,25 +1163,23 @@ f_status_t firewall_delete_chains(firewall_main_t * const main) { return F_status_set_error(F_interrupt); } - f_string_dynamics_t arguments = f_string_dynamics_t_initialize; - f_string_dynamic_t argument[1] = f_string_dynamic_t_initialize; - int return_code = 0; + f_string_statics_t arguments = f_string_statics_t_initialize; + arguments.used = 1; - argument[0].string = "-F"; - argument[0].size = 2; - argument[0].used = 2; + f_string_static_t arguments_array[arguments.used]; + arguments_array[0] = firewall_chain_forward_s; + arguments.array = arguments_array; - arguments.array = argument; - arguments.size = 1; - arguments.used = 1; + int return_code = 0; firewall_print_debug_tool(main->warning, tools[i], arguments); status = fll_execute_program(tools[i], arguments, 0, 0, (void *) &return_code); - // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { - exit(return_code); + main->child = return_code; + + return status; } if (F_status_is_error(status)) { @@ -1211,9 +1221,10 @@ f_status_t firewall_delete_chains(firewall_main_t * const main) { status = fll_execute_program(tools[i], arguments, 0, 0, (void *) &return_code); - // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { - exit(return_code); + main->child = return_code; + + return status; } if (F_status_is_error(status)) { @@ -1238,10 +1249,8 @@ f_status_t firewall_delete_chains(firewall_main_t * const main) { f_status_t firewall_default_lock(firewall_main_t * const main) { - const f_string_t chains[3] = { firewall_chain_input_s, firewall_chain_output_s, firewall_chain_forward_s }; - const f_string_t tools[2] = { firewall_tool_iptables_s, firewall_tool_ip6tables_s }; - - const f_array_length_t lengths[3] = { firewall_chain_input_s_length, firewall_chain_output_s_length, firewall_chain_forward_s_length }; + const f_string_static_t chains[3] = { firewall_chain_input_s, firewall_chain_output_s, firewall_chain_forward_s }; + const f_string_static_t tools[2] = { firewall_tool_iptables_s, firewall_tool_ip6tables_s }; f_status_t status = F_none; @@ -1249,23 +1258,19 @@ f_status_t firewall_default_lock(firewall_main_t * const main) { for (f_array_length_t i = 0; i < 3; ++i) { - f_string_dynamics_t arguments = f_string_dynamics_t_initialize; - f_string_dynamic_t argument[3]; + f_string_statics_t arguments = f_string_statics_t_initialize; + f_string_static_t argument[3]; arguments.array = argument; arguments.used = 3; arguments.size = arguments.used; - arguments.array[0].string = firewall_action_policy_command_s; - arguments.array[1].string = chains[i]; + arguments.array[0] = firewall_action_policy_command_s; + arguments.array[1] = chains[i]; arguments.array[2].string = "DROP"; - arguments.array[0].used = firewall_action_append_command_s_length; - arguments.array[1].used = lengths[i]; arguments.array[2].used = 4; - arguments.array[0].size = arguments.array[0].used; - arguments.array[1].size = arguments.array[1].used; arguments.array[2].size = arguments.array[2].used; for (f_array_length_t j = 0; j < 2; ++j) { @@ -1276,9 +1281,10 @@ f_status_t firewall_default_lock(firewall_main_t * const main) { status = fll_execute_program(tools[j], arguments, 0, 0, (void *) &return_code); - // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { - exit(return_code); + main->child = return_code; + + return status; } if (firewall_signal_received(main)) { @@ -1306,7 +1312,7 @@ f_status_t firewall_default_lock(firewall_main_t * const main) { return status; } -f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_t filename, const bool optional, firewall_local_data_t *local) { +f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_static_t filename, const bool optional, firewall_local_data_t *local) { f_file_t file = f_file_t_initialize; @@ -1328,13 +1334,13 @@ f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_t firewall_print_error_on_invalid_parameter(main->error, "f_file_open"); } else if (status == F_file_found_not) { - fll_print_format("%r%[%QUnable to find the file '%S'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QUnable to find the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_file_open) { - fll_print_format("%r%[%QUnable to open the file '%S'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QUnable to open the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_file_descriptor) { - fll_print_format("%r%[%QFile descriptor error while trying to open the file '%S'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QFile descriptor error while trying to open the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else { firewall_print_error_on_unhandled(main->error, "f_file_open", status); @@ -1357,16 +1363,16 @@ f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_t firewall_print_error_on_invalid_parameter(main->error, "f_file_read"); } else if (status == F_number_overflow) { - fll_print_format("%r%[%QInteger overflow while trying to buffer the file '%S'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QInteger overflow while trying to buffer the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_file_closed) { - fll_print_format("%r%[%QThe file '%S' is no longer open.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QThe file '%Q' is no longer open.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_file_seek) { - fll_print_format("%r%[%QA seek error occurred while accessing the file '%S'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QA seek error occurred while accessing the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_file_read) { - fll_print_format("%r%[%QA read error occurred while accessing the file '%S'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QA read error occurred while accessing the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_memory_not) { firewall_print_error_on_allocation_failure(main->error); @@ -1397,7 +1403,7 @@ f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_t firewall_print_error_on_invalid_parameter_for_file(main->error, "fll_fss_basic_list_read", filename); } else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) { - fll_print_format("%r%[%QNo relevant main was found within the file '%s'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); + fll_print_format("%r%[%QNo relevant main was found within the file '%Q'.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s); } else if (status == F_memory_not) { firewall_print_error_on_allocation_failure(main->error); @@ -1445,6 +1451,13 @@ f_status_t firewall_process_rules(firewall_main_t * const main, f_string_range_t if (F_status_is_error_not(status)) { status = firewall_perform_commands(main, *local); + if (status == F_child) { + macro_f_fss_objects_t_delete_simple(local->rule_objects); + macro_f_fss_contents_t_delete_simple(local->rule_contents); + + return status; + } + if (F_status_is_error(status)) { status = F_status_set_fine(status); @@ -1452,7 +1465,7 @@ f_status_t firewall_process_rules(firewall_main_t * const main, f_string_range_t firewall_print_error_on_allocation_failure(main->error); } else if (status == F_failure) { - // the error message has already been displayed. + // The error message has already been displayed. } else { firewall_print_error_on_unhandled(main->error, "firewall_perform_commands", status); @@ -1460,6 +1473,7 @@ f_status_t firewall_process_rules(firewall_main_t * const main, f_string_range_t macro_f_fss_objects_t_delete_simple(local->rule_objects); macro_f_fss_contents_t_delete_simple(local->rule_contents); + return status; } } diff --git a/level_3/firewall/c/private-firewall.h b/level_3/firewall/c/private-firewall.h index a1fd7cd..fdb0c68 100644 --- a/level_3/firewall/c/private-firewall.h +++ b/level_3/firewall/c/private-firewall.h @@ -22,6 +22,7 @@ extern "C" { * * @return * F_none on success. + * F_child on child process exiting. * * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. * @@ -41,6 +42,7 @@ extern f_status_t firewall_perform_commands(firewall_main_t * const main, const * * @return * F_none on success. + * F_child on child process exiting. * * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. * @@ -56,6 +58,7 @@ extern f_status_t firewall_create_custom_chains(firewall_main_t * const main, fi * * @return * F_none on success. + * F_child on child process exiting. * * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. * @@ -71,6 +74,7 @@ extern f_status_t firewall_delete_chains(firewall_main_t * const main) F_attribu * * @return * F_none on success. + * F_child on child process exiting. * * Status codes (with error bit) are returned on any problem. */ @@ -91,10 +95,11 @@ extern f_status_t firewall_default_lock(firewall_main_t * const main) F_attribut * * @return * F_none on success. + * F_child on child process exiting. * * Status codes (with error bit) are returned on any problem. */ -extern f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_t filename, const bool optional, firewall_local_data_t *local) F_attribute_visibility_internal_d; +extern f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_string_static_t filename, const bool optional, firewall_local_data_t *local) F_attribute_visibility_internal_d; /** * Process buffered rules. @@ -108,6 +113,7 @@ extern f_status_t firewall_buffer_rules(firewall_main_t * const main, const f_st * * @return * F_none on success. + * F_child on child process exiting. * * Status codes (with error bit) are returned on any problem. */ diff --git a/level_3/firewall/data/build/settings b/level_3/firewall/data/build/settings index 73dd9d5..fee492d 100644 --- a/level_3/firewall/data/build/settings +++ b/level_3/firewall/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library firewall.c private-common.c private-firewall.c +build_sources_library firewall.c common.c private-common.c private-firewall.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers firewall.h +build_sources_headers firewall.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_basic_list_read/c/common.c b/level_3/fss_basic_list_read/c/common.c new file mode 100644 index 0000000..afa5e52 --- /dev/null +++ b/level_3/fss_basic_list_read/c/common.c @@ -0,0 +1,30 @@ +#include "fss_basic_list_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_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); + + f_type_array_lengths_resize(0, &main->remaining); + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_fss_basic_list_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_basic_list_read/c/common.h b/level_3/fss_basic_list_read/c/common.h new file mode 100644 index 0000000..8aa5e49 --- /dev/null +++ b/level_3/fss_basic_list_read/c/common.h @@ -0,0 +1,241 @@ +/** + * FLL - Level 3 + * + * Project: FSS Basic List Read + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_basic_list_read_common_h +#define _fss_basic_list_read_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#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 + #define FSS_BASIC_LIST_READ_program_version_micro_s F_string_ascii_8_s + + #define FSS_BASIC_LIST_READ_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_BASIC_LIST_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_BASIC_LIST_READ_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s_length)) + #define FSS_BASIC_LIST_READ_program_version_nano_prefix_s + #define FSS_BASIC_LIST_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_BASIC_LIST_READ_program_version_nano_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_s_length)) + #define FSS_BASIC_LIST_READ_program_version_nano_s + #define FSS_BASIC_LIST_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_BASIC_LIST_READ_program_version_nano_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_s_length)) + + #define FSS_BASIC_LIST_READ_program_version_s FSS_BASIC_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_BASIC_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_BASIC_LIST_READ_program_version_micro_s fss_basic_list_program_version_nano_prefix_s FSS_BASIC_LIST_READ_program_version_nano_s + + #define FSS_BASIC_LIST_READ_program_version_s_length FSS_BASIC_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_READ_program_version_micro_s_length + fss_basic_list_program_version_nano_prefix_s_length + FSS_BASIC_LIST_READ_program_version_nano_s_length + + extern const f_string_static_t fss_basic_list_program_version_s; +#endif // _di_fss_basic_list_read_program_version_ + +#ifndef _di_fss_basic_list_read_program_name_ + #define FSS_BASIC_LIST_READ_program_name_s "fss_basic_list_read" + #define FSS_BASIC_LIST_READ_program_name_long_s "FSS Basic List Read" + + #define FSS_BASIC_LIST_READ_program_name_s_length 19 + #define FSS_BASIC_LIST_READ_program_name_long_s_length 19 + + extern const f_string_static_t fss_basic_list_program_name_s; + extern const f_string_static_t fss_basic_list_program_name_long_s; +#endif // _di_fss_basic_list_read_program_name_ + +#ifndef _di_fss_basic_list_read_defines_ + #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" + + enum { + fss_basic_list_read_parameter_help_e, + fss_basic_list_read_parameter_light_e, + fss_basic_list_read_parameter_dark_e, + fss_basic_list_read_parameter_no_color_e, + fss_basic_list_read_parameter_verbosity_quiet_e, + fss_basic_list_read_parameter_verbosity_normal_e, + fss_basic_list_read_parameter_verbosity_verbose_e, + fss_basic_list_read_parameter_verbosity_debug_e, + fss_basic_list_read_parameter_version_e, + + fss_basic_list_read_parameter_at_e, + fss_basic_list_read_parameter_content_e, + fss_basic_list_read_parameter_columns_e, + fss_basic_list_read_parameter_delimit_e, + fss_basic_list_read_parameter_depth_e, + fss_basic_list_read_parameter_empty_e, + fss_basic_list_read_parameter_line_e, + fss_basic_list_read_parameter_name_e, + fss_basic_list_read_parameter_object_e, + fss_basic_list_read_parameter_pipe_e, + fss_basic_list_read_parameter_raw_e, + fss_basic_list_read_parameter_select_e, + fss_basic_list_read_parameter_total_e, + fss_basic_list_read_parameter_trim_e, + }; + + #define fss_basic_list_read_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #define fss_basic_list_total_parameters_d 23 +#endif // _di_fss_basic_list_read_defines_ + +/** + * FSS Delimit Parameter data. + * + * fss_basic_list_read_delimit_mode_*: + * - all: All delimits are to be aplied. + * - content: Content are to have delimits applied. + * - content_greater: Content at this number or higher are to have delimits applied. + * - content_greater_object: Objects and Content at this number or higher are to have delimits applied. + * - content_lesser: Content at this number or lower are to have delimits applied. + * - content_lesser_object: Objects and Content at this number or lower are to have delimits applied. + * - content_object: Objects and Content are to have delimits applied + * - object: Objects arre to have delimits applied. + */ +#ifndef _di_fss_basic_list_read_delimit_mode_ + #define fss_basic_list_read_delimit_mode_name_none_s "none" + #define fss_basic_list_read_delimit_mode_name_all_s "all" + #define fss_basic_list_read_delimit_mode_name_object_s "object" + #define fss_basic_list_read_delimit_mode_name_greater_s "+" + #define fss_basic_list_read_delimit_mode_name_lesser_s "-" + + #define fss_basic_list_read_delimit_mode_name_none_s_length 4 + #define fss_basic_list_read_delimit_mode_name_all_s_length 3 + #define fss_basic_list_read_delimit_mode_name_object_s_length 6 + #define fss_basic_list_read_delimit_mode_name_greater_s_length 1 + #define fss_basic_list_read_delimit_mode_name_lesser_s_length 1 + + enum { + fss_basic_list_read_delimit_mode_none_e = 1, + fss_basic_list_read_delimit_mode_all_e, + fss_basic_list_read_delimit_mode_content_e, + fss_basic_list_read_delimit_mode_content_greater_e, + fss_basic_list_read_delimit_mode_content_greater_object_e, + fss_basic_list_read_delimit_mode_content_lesser_e, + fss_basic_list_read_delimit_mode_content_lesser_object_e, + fss_basic_list_read_delimit_mode_content_object_e, + fss_basic_list_read_delimit_mode_object_e, + }; +#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. + * + * Be sure to call this after executing fss_basic_list_read_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_basic_list_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_basic_list_read_common_h 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 fa9730c..2e013c0 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 @@ -669,18 +669,6 @@ extern "C" { } #endif // _di_fss_basic_list_read_main_ -#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); - - f_type_array_lengths_resize(0, &main->remaining); - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_fss_basic_list_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 d6de141..cc3b30e 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 @@ -48,209 +48,13 @@ #include #include +// FSS Basic List Read includes. +#include + #ifdef __cplusplus extern "C" { #endif -#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 - #define FSS_BASIC_LIST_READ_program_version_micro_s F_string_ascii_8_s - - #define FSS_BASIC_LIST_READ_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_BASIC_LIST_READ_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_BASIC_LIST_READ_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s_length)) - #define FSS_BASIC_LIST_READ_program_version_nano_prefix_s - #define FSS_BASIC_LIST_READ_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_BASIC_LIST_READ_program_version_nano_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_s_length)) - #define FSS_BASIC_LIST_READ_program_version_nano_s - #define FSS_BASIC_LIST_READ_program_version_nano_s_length 0 - #endif // !(defined(FSS_BASIC_LIST_READ_program_version_nano_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_s_length)) - - #define FSS_BASIC_LIST_READ_program_version_s FSS_BASIC_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_BASIC_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_BASIC_LIST_READ_program_version_micro_s fss_basic_list_program_version_nano_prefix_s FSS_BASIC_LIST_READ_program_version_nano_s - - #define FSS_BASIC_LIST_READ_program_version_s_length FSS_BASIC_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_READ_program_version_micro_s_length + fss_basic_list_program_version_nano_prefix_s_length + FSS_BASIC_LIST_READ_program_version_nano_s_length - - extern const f_string_static_t fss_basic_list_program_version_s; -#endif // _di_fss_basic_list_read_program_version_ - -#ifndef _di_fss_basic_list_read_program_name_ - #define FSS_BASIC_LIST_READ_program_name_s "fss_basic_list_read" - #define FSS_BASIC_LIST_READ_program_name_long_s "FSS Basic List Read" - - #define FSS_BASIC_LIST_READ_program_name_s_length 19 - #define FSS_BASIC_LIST_READ_program_name_long_s_length 19 - - extern const f_string_static_t fss_basic_list_program_name_s; - extern const f_string_static_t fss_basic_list_program_name_long_s; -#endif // _di_fss_basic_list_read_program_name_ - -#ifndef _di_fss_basic_list_read_defines_ - #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" - - enum { - fss_basic_list_read_parameter_help_e, - fss_basic_list_read_parameter_light_e, - fss_basic_list_read_parameter_dark_e, - fss_basic_list_read_parameter_no_color_e, - fss_basic_list_read_parameter_verbosity_quiet_e, - fss_basic_list_read_parameter_verbosity_normal_e, - fss_basic_list_read_parameter_verbosity_verbose_e, - fss_basic_list_read_parameter_verbosity_debug_e, - fss_basic_list_read_parameter_version_e, - - fss_basic_list_read_parameter_at_e, - fss_basic_list_read_parameter_content_e, - fss_basic_list_read_parameter_columns_e, - fss_basic_list_read_parameter_delimit_e, - fss_basic_list_read_parameter_depth_e, - fss_basic_list_read_parameter_empty_e, - fss_basic_list_read_parameter_line_e, - fss_basic_list_read_parameter_name_e, - fss_basic_list_read_parameter_object_e, - fss_basic_list_read_parameter_pipe_e, - fss_basic_list_read_parameter_raw_e, - fss_basic_list_read_parameter_select_e, - fss_basic_list_read_parameter_total_e, - fss_basic_list_read_parameter_trim_e, - }; - - #define fss_basic_list_read_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #define fss_basic_list_total_parameters_d 23 -#endif // _di_fss_basic_list_read_defines_ - -/** - * FSS Delimit Parameter data. - * - * fss_basic_list_read_delimit_mode_*: - * - all: All delimits are to be aplied. - * - content: Content are to have delimits applied. - * - content_greater: Content at this number or higher are to have delimits applied. - * - content_greater_object: Objects and Content at this number or higher are to have delimits applied. - * - content_lesser: Content at this number or lower are to have delimits applied. - * - content_lesser_object: Objects and Content at this number or lower are to have delimits applied. - * - content_object: Objects and Content are to have delimits applied - * - object: Objects arre to have delimits applied. - */ -#ifndef _di_fss_basic_list_read_delimit_mode_ - #define fss_basic_list_read_delimit_mode_name_none_s "none" - #define fss_basic_list_read_delimit_mode_name_all_s "all" - #define fss_basic_list_read_delimit_mode_name_object_s "object" - #define fss_basic_list_read_delimit_mode_name_greater_s "+" - #define fss_basic_list_read_delimit_mode_name_lesser_s "-" - - #define fss_basic_list_read_delimit_mode_name_none_s_length 4 - #define fss_basic_list_read_delimit_mode_name_all_s_length 3 - #define fss_basic_list_read_delimit_mode_name_object_s_length 6 - #define fss_basic_list_read_delimit_mode_name_greater_s_length 1 - #define fss_basic_list_read_delimit_mode_name_lesser_s_length 1 - - enum { - fss_basic_list_read_delimit_mode_none_e = 1, - fss_basic_list_read_delimit_mode_all_e, - fss_basic_list_read_delimit_mode_content_e, - fss_basic_list_read_delimit_mode_content_greater_e, - fss_basic_list_read_delimit_mode_content_greater_object_e, - fss_basic_list_read_delimit_mode_content_lesser_e, - fss_basic_list_read_delimit_mode_content_lesser_object_e, - fss_basic_list_read_delimit_mode_content_object_e, - fss_basic_list_read_delimit_mode_object_e, - }; -#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_ - /** * Print help. * @@ -295,25 +99,6 @@ extern "C" { extern f_status_t fss_basic_list_read_main(fss_basic_list_read_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_basic_list_read_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_basic_list_read_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_basic_list_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_basic_list_read/data/build/settings b/level_3/fss_basic_list_read/data/build/settings index 69aede5..e4e42f7 100644 --- a/level_3/fss_basic_list_read/data/build/settings +++ b/level_3/fss_basic_list_read/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_basic_list_read.c private-common.c private-print.c private-read.c +build_sources_library fss_basic_list_read.c common.c private-common.c private-print.c private-read.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_basic_list_read.h +build_sources_headers fss_basic_list_read.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_basic_list_write/c/common.c b/level_3/fss_basic_list_write/c/common.c new file mode 100644 index 0000000..dec052c --- /dev/null +++ b/level_3/fss_basic_list_write/c/common.c @@ -0,0 +1,31 @@ +#include "fss_basic_list_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_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); + + f_type_array_lengths_resize(0, &main->remaining); + + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_fss_basic_list_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_basic_list_write/c/common.h b/level_3/fss_basic_list_write/c/common.h new file mode 100644 index 0000000..816d71d --- /dev/null +++ b/level_3/fss_basic_list_write/c/common.h @@ -0,0 +1,185 @@ +/** + * FLL - Level 3 + * + * Project: FSS Basic List Write + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_basic_list_write_common_h +#define _fss_basic_list_write_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_basic_list_write_program_version_ + #define FSS_BASIC_LIST_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_BASIC_LIST_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_BASIC_LIST_WRITE_program_version_micro_s F_string_ascii_8_s + + #define FSS_BASIC_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_BASIC_LIST_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_BASIC_LIST_WRITE_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length)) + #define FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s + #define FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_s_length)) + #define FSS_BASIC_LIST_WRITE_program_version_nano_s + #define FSS_BASIC_LIST_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_s_length)) + + #define FSS_BASIC_LIST_WRITE_program_version_s FSS_BASIC_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_BASIC_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_BASIC_LIST_WRITE_program_version_micro_s FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s FSS_BASIC_LIST_WRITE_program_version_nano_s + + #define FSS_BASIC_LIST_WRITE_program_version_s_length FSS_BASIC_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_WRITE_program_version_micro_s_length + FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length + FSS_BASIC_LIST_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_basic_list_write_program_version_s; +#endif // _di_fss_basic_list_write_program_version_ + +#ifndef _di_fss_basic_list_write_program_name_ + #define FSS_BASIC_LIST_WRITE_program_name_s "fss_basic_list_write" + #define FSS_BASIC_LIST_WRITE_program_name_long_s "FSS Basic List Write" + + #define FSS_BASIC_LIST_WRITE_program_name_s_length 20 + #define FSS_BASIC_LIST_WRITE_program_name_long_s_length 20 + + extern const f_string_static_t fss_basic_list_write_program_name_s; + extern const f_string_static_t fss_basic_list_write_program_name_long_s; +#endif // _di_fss_basic_list_write_program_name_ + +#ifndef _di_fss_basic_list_write_defines_ + #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" + + enum { + fss_basic_list_write_parameter_help_e, + fss_basic_list_write_parameter_light_e, + fss_basic_list_write_parameter_dark_e, + fss_basic_list_write_parameter_no_color_e, + fss_basic_list_write_parameter_verbosity_quiet_e, + fss_basic_list_write_parameter_verbosity_normal_e, + fss_basic_list_write_parameter_verbosity_verbose_e, + fss_basic_list_write_parameter_verbosity_debug_e, + fss_basic_list_write_parameter_version_e, + + fss_basic_list_write_parameter_file_e, + fss_basic_list_write_parameter_content_e, + fss_basic_list_write_parameter_double_e, + fss_basic_list_write_parameter_ignore_e, + fss_basic_list_write_parameter_object_e, + fss_basic_list_write_parameter_partial_e, + fss_basic_list_write_parameter_prepend_e, + fss_basic_list_write_parameter_single_e, + fss_basic_list_write_parameter_trim_e, + }; + + #define fss_basic_list_write_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #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_ + +/** + * Deallocate main. + * + * Be sure to call this after executing fss_basic_list_write_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_basic_list_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_basic_list_write_common_h 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 a8ec3e3..2203649 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 @@ -560,19 +560,6 @@ extern "C" { } #endif // _di_fss_basic_list_write_main_ -#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); - - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_fss_basic_list_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 0e04219..dc1b8fb 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 @@ -40,153 +40,13 @@ #include #include +// FSS Basic List Write includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_basic_list_write_program_version_ - #define FSS_BASIC_LIST_WRITE_program_version_major_s F_string_ascii_0_s - #define FSS_BASIC_LIST_WRITE_program_version_minor_s F_string_ascii_5_s - #define FSS_BASIC_LIST_WRITE_program_version_micro_s F_string_ascii_8_s - - #define FSS_BASIC_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_BASIC_LIST_WRITE_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_BASIC_LIST_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length)) - #define FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s - #define FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_s_length)) - #define FSS_BASIC_LIST_WRITE_program_version_nano_s - #define FSS_BASIC_LIST_WRITE_program_version_nano_s_length 0 - #endif // !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_s_length)) - - #define FSS_BASIC_LIST_WRITE_program_version_s FSS_BASIC_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_BASIC_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_BASIC_LIST_WRITE_program_version_micro_s FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s FSS_BASIC_LIST_WRITE_program_version_nano_s - - #define FSS_BASIC_LIST_WRITE_program_version_s_length FSS_BASIC_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_WRITE_program_version_micro_s_length + FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length + FSS_BASIC_LIST_WRITE_program_version_nano_s_length - - extern const f_string_static_t fss_basic_list_write_program_version_s; -#endif // _di_fss_basic_list_write_program_version_ - -#ifndef _di_fss_basic_list_write_program_name_ - #define FSS_BASIC_LIST_WRITE_program_name_s "fss_basic_list_write" - #define FSS_BASIC_LIST_WRITE_program_name_long_s "FSS Basic List Write" - - #define FSS_BASIC_LIST_WRITE_program_name_s_length 20 - #define FSS_BASIC_LIST_WRITE_program_name_long_s_length 20 - - extern const f_string_static_t fss_basic_list_write_program_name_s; - extern const f_string_static_t fss_basic_list_write_program_name_long_s; -#endif // _di_fss_basic_list_write_program_name_ - -#ifndef _di_fss_basic_list_write_defines_ - #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" - - enum { - fss_basic_list_write_parameter_help_e, - fss_basic_list_write_parameter_light_e, - fss_basic_list_write_parameter_dark_e, - fss_basic_list_write_parameter_no_color_e, - fss_basic_list_write_parameter_verbosity_quiet_e, - fss_basic_list_write_parameter_verbosity_normal_e, - fss_basic_list_write_parameter_verbosity_verbose_e, - fss_basic_list_write_parameter_verbosity_debug_e, - fss_basic_list_write_parameter_version_e, - - fss_basic_list_write_parameter_file_e, - fss_basic_list_write_parameter_content_e, - fss_basic_list_write_parameter_double_e, - fss_basic_list_write_parameter_ignore_e, - fss_basic_list_write_parameter_object_e, - fss_basic_list_write_parameter_partial_e, - fss_basic_list_write_parameter_prepend_e, - fss_basic_list_write_parameter_single_e, - fss_basic_list_write_parameter_trim_e, - }; - - #define fss_basic_list_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #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_ - /** * Print help. * @@ -231,25 +91,6 @@ extern "C" { extern f_status_t fss_basic_list_write_main(fss_basic_list_write_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_basic_list_write_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_basic_list_write_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_basic_list_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_basic_list_write/data/build/settings b/level_3/fss_basic_list_write/data/build/settings index a118cf7..63dd3e9 100644 --- a/level_3/fss_basic_list_write/data/build/settings +++ b/level_3/fss_basic_list_write/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_basic_list_write.c private-common.c private-write.c +build_sources_library fss_basic_list_write.c common.c private-common.c private-write.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_basic_list_write.h +build_sources_headers fss_basic_list_write.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_basic_read/c/common.c b/level_3/fss_basic_read/c/common.c new file mode 100644 index 0000000..6393649 --- /dev/null +++ b/level_3/fss_basic_read/c/common.c @@ -0,0 +1,30 @@ +#include "fss_basic_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_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); + + f_type_array_lengths_resize(0, &main->remaining); + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_fss_basic_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_basic_read/c/common.h b/level_3/fss_basic_read/c/common.h new file mode 100644 index 0000000..a157de5 --- /dev/null +++ b/level_3/fss_basic_read/c/common.h @@ -0,0 +1,241 @@ +/** + * FLL - Level 3 + * + * Project: FSS Basic Read + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_basic_read_common_h +#define _fss_basic_read_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_basic_read_program_version_ + #define FSS_BASIC_READ_program_version_major_s F_string_ascii_0_s + #define FSS_BASIC_READ_program_version_minor_s F_string_ascii_5_s + #define FSS_BASIC_READ_program_version_micro_s F_string_ascii_8_s + + #define FSS_BASIC_READ_program_version_major_s F_string_ascii_0_s_length + #define FSS_BASIC_READ_program_version_minor_s F_string_ascii_5_s_length + #define FSS_BASIC_READ_program_version_micro_s F_string_ascii_8_s_length + + #if !(defined(FSS_BASIC_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_READ_program_version_nano_prefix_s_length)) + #define FSS_BASIC_READ_program_version_nano_prefix_s + #define FSS_BASIC_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_BASIC_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_READ_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_BASIC_READ_program_version_nano_s) && defined(FSS_BASIC_READ_program_version_nano_s_length)) + #define FSS_BASIC_READ_program_version_nano_s + #define FSS_BASIC_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_BASIC_READ_program_version_nano_s) && defined(FSS_BASIC_READ_program_version_nano_s_length)) + + #define FSS_BASIC_READ_program_version_s FSS_BASIC_READ_program_version_major_s F_string_ascii_period_s FSS_BASIC_READ_program_version_minor_s F_string_ascii_period_s FSS_BASIC_READ_program_version_micro_s FSS_BASIC_READ_program_version_nano_prefix_s FSS_BASIC_READ_program_version_nano_s + + #define FSS_BASIC_READ_program_version_s_length FSS_BASIC_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_READ_program_version_micro_s_length + FSS_BASIC_READ_program_version_nano_prefix_s_length + FSS_BASIC_READ_program_version_nano_s_length + + extern const f_string_static_t fss_basic_read_program_version_s; +#endif // _di_fss_basic_read_program_version_ + +#ifndef _di_fss_basic_read_program_name_ + #define FSS_BASIC_READ_program_name_s "fss_basic_read" + #define FSS_BASIC_READ_program_name_long_s "FSS Basic Read" + + #define FSS_BASIC_READ_program_name_s_length 14 + #define FSS_BASIC_READ_program_name_long_s_length 14 + + extern const f_string_static_t fss_basic_read_program_name_s; + extern const f_string_static_t fss_basic_read_program_name_long_s; +#endif // _di_fss_basic_read_program_name_ + +#ifndef _di_fss_basic_read_defines_ + #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" + + enum { + fss_basic_read_parameter_help_e, + fss_basic_read_parameter_light_e, + fss_basic_read_parameter_dark_e, + fss_basic_read_parameter_no_color_e, + fss_basic_read_parameter_verbosity_quiet_e, + fss_basic_read_parameter_verbosity_normal_e, + fss_basic_read_parameter_verbosity_verbose_e, + fss_basic_read_parameter_verbosity_debug_e, + fss_basic_read_parameter_version_e, + + fss_basic_read_parameter_at_e, + fss_basic_read_parameter_content_e, + fss_basic_read_parameter_columns_e, + fss_basic_read_parameter_delimit_e, + fss_basic_read_parameter_depth_e, + fss_basic_read_parameter_empty_e, + fss_basic_read_parameter_line_e, + fss_basic_read_parameter_name_e, + fss_basic_read_parameter_object_e, + fss_basic_read_parameter_pipe_e, + fss_basic_read_parameter_raw_e, + fss_basic_read_parameter_select_e, + fss_basic_read_parameter_total_e, + fss_basic_read_parameter_trim_e, + }; + + #define fss_basic_read_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #define fss_basic_read_total_parameters_d 23 +#endif // _di_fss_basic_read_defines_ + +/** + * FSS Delimit Parameter data. + * + * fss_basic_read_delimit_mode_*: + * - all: All delimits are to be aplied. + * - content: Content are to have delimits applied. + * - content_greater: Content at this number or higher are to have delimits applied. + * - content_greater_object: Objects and Content at this number or higher are to have delimits applied. + * - content_lesser: Content at this number or lower are to have delimits applied. + * - content_lesser_object: Objects and Content at this number or lower are to have delimits applied. + * - content_object: Objects and Content are to have delimits applied + * - object: Objects arre to have delimits applied. + */ +#ifndef _di_fss_basic_read_delimit_mode_ + #define fss_basic_read_delimit_mode_name_none_s "none" + #define fss_basic_read_delimit_mode_name_all_s "all" + #define fss_basic_read_delimit_mode_name_object_s "object" + #define fss_basic_read_delimit_mode_name_greater_s "+" + #define fss_basic_read_delimit_mode_name_lesser_s "-" + + #define fss_basic_read_delimit_mode_name_none_s_length 4 + #define fss_basic_read_delimit_mode_name_all_s_length 3 + #define fss_basic_read_delimit_mode_name_object_s_length 6 + #define fss_basic_read_delimit_mode_name_greater_s_length 1 + #define fss_basic_read_delimit_mode_name_lesser_s_length 1 + + enum { + fss_basic_read_delimit_mode_none_e = 1, + fss_basic_read_delimit_mode_all_e, + fss_basic_read_delimit_mode_content_e, + fss_basic_read_delimit_mode_content_greater_e, + fss_basic_read_delimit_mode_content_greater_object_e, + fss_basic_read_delimit_mode_content_lesser_e, + fss_basic_read_delimit_mode_content_lesser_object_e, + fss_basic_read_delimit_mode_content_object_e, + fss_basic_read_delimit_mode_object_e, + }; +#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. + * + * Be sure to call this after executing fss_basic_read_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_basic_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_basic_read_common_h 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 d597454..a6ab074 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -659,18 +659,6 @@ extern "C" { } #endif // _di_fss_basic_read_main_ -#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); - - f_type_array_lengths_resize(0, &main->remaining); - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_fss_basic_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 56e2397..fb2b822 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.h +++ b/level_3/fss_basic_read/c/fss_basic_read.h @@ -48,209 +48,13 @@ #include #include +// FSS Basic Read includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_basic_read_program_version_ - #define FSS_BASIC_READ_program_version_major_s F_string_ascii_0_s - #define FSS_BASIC_READ_program_version_minor_s F_string_ascii_5_s - #define FSS_BASIC_READ_program_version_micro_s F_string_ascii_8_s - - #define FSS_BASIC_READ_program_version_major_s F_string_ascii_0_s_length - #define FSS_BASIC_READ_program_version_minor_s F_string_ascii_5_s_length - #define FSS_BASIC_READ_program_version_micro_s F_string_ascii_8_s_length - - #if !(defined(FSS_BASIC_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_READ_program_version_nano_prefix_s_length)) - #define FSS_BASIC_READ_program_version_nano_prefix_s - #define FSS_BASIC_READ_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_BASIC_READ_program_version_nano_prefix_s) && defined(FSS_BASIC_READ_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_BASIC_READ_program_version_nano_s) && defined(FSS_BASIC_READ_program_version_nano_s_length)) - #define FSS_BASIC_READ_program_version_nano_s - #define FSS_BASIC_READ_program_version_nano_s_length 0 - #endif // !(defined(FSS_BASIC_READ_program_version_nano_s) && defined(FSS_BASIC_READ_program_version_nano_s_length)) - - #define FSS_BASIC_READ_program_version_s FSS_BASIC_READ_program_version_major_s F_string_ascii_period_s FSS_BASIC_READ_program_version_minor_s F_string_ascii_period_s FSS_BASIC_READ_program_version_micro_s FSS_BASIC_READ_program_version_nano_prefix_s FSS_BASIC_READ_program_version_nano_s - - #define FSS_BASIC_READ_program_version_s_length FSS_BASIC_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_READ_program_version_micro_s_length + FSS_BASIC_READ_program_version_nano_prefix_s_length + FSS_BASIC_READ_program_version_nano_s_length - - extern const f_string_static_t fss_basic_read_program_version_s; -#endif // _di_fss_basic_read_program_version_ - -#ifndef _di_fss_basic_read_program_name_ - #define FSS_BASIC_READ_program_name_s "fss_basic_read" - #define FSS_BASIC_READ_program_name_long_s "FSS Basic Read" - - #define FSS_BASIC_READ_program_name_s_length 14 - #define FSS_BASIC_READ_program_name_long_s_length 14 - - extern const f_string_static_t fss_basic_read_program_name_s; - extern const f_string_static_t fss_basic_read_program_name_long_s; -#endif // _di_fss_basic_read_program_name_ - -#ifndef _di_fss_basic_read_defines_ - #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" - - enum { - fss_basic_read_parameter_help_e, - fss_basic_read_parameter_light_e, - fss_basic_read_parameter_dark_e, - fss_basic_read_parameter_no_color_e, - fss_basic_read_parameter_verbosity_quiet_e, - fss_basic_read_parameter_verbosity_normal_e, - fss_basic_read_parameter_verbosity_verbose_e, - fss_basic_read_parameter_verbosity_debug_e, - fss_basic_read_parameter_version_e, - - fss_basic_read_parameter_at_e, - fss_basic_read_parameter_content_e, - fss_basic_read_parameter_columns_e, - fss_basic_read_parameter_delimit_e, - fss_basic_read_parameter_depth_e, - fss_basic_read_parameter_empty_e, - fss_basic_read_parameter_line_e, - fss_basic_read_parameter_name_e, - fss_basic_read_parameter_object_e, - fss_basic_read_parameter_pipe_e, - fss_basic_read_parameter_raw_e, - fss_basic_read_parameter_select_e, - fss_basic_read_parameter_total_e, - fss_basic_read_parameter_trim_e, - }; - - #define fss_basic_read_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #define fss_basic_read_total_parameters_d 23 -#endif // _di_fss_basic_read_defines_ - -/** - * FSS Delimit Parameter data. - * - * fss_basic_read_delimit_mode_*: - * - all: All delimits are to be aplied. - * - content: Content are to have delimits applied. - * - content_greater: Content at this number or higher are to have delimits applied. - * - content_greater_object: Objects and Content at this number or higher are to have delimits applied. - * - content_lesser: Content at this number or lower are to have delimits applied. - * - content_lesser_object: Objects and Content at this number or lower are to have delimits applied. - * - content_object: Objects and Content are to have delimits applied - * - object: Objects arre to have delimits applied. - */ -#ifndef _di_fss_basic_read_delimit_mode_ - #define fss_basic_read_delimit_mode_name_none_s "none" - #define fss_basic_read_delimit_mode_name_all_s "all" - #define fss_basic_read_delimit_mode_name_object_s "object" - #define fss_basic_read_delimit_mode_name_greater_s "+" - #define fss_basic_read_delimit_mode_name_lesser_s "-" - - #define fss_basic_read_delimit_mode_name_none_s_length 4 - #define fss_basic_read_delimit_mode_name_all_s_length 3 - #define fss_basic_read_delimit_mode_name_object_s_length 6 - #define fss_basic_read_delimit_mode_name_greater_s_length 1 - #define fss_basic_read_delimit_mode_name_lesser_s_length 1 - - enum { - fss_basic_read_delimit_mode_none_e = 1, - fss_basic_read_delimit_mode_all_e, - fss_basic_read_delimit_mode_content_e, - fss_basic_read_delimit_mode_content_greater_e, - fss_basic_read_delimit_mode_content_greater_object_e, - fss_basic_read_delimit_mode_content_lesser_e, - fss_basic_read_delimit_mode_content_lesser_object_e, - fss_basic_read_delimit_mode_content_object_e, - fss_basic_read_delimit_mode_object_e, - }; -#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_ - /** * Print help. * @@ -295,25 +99,6 @@ extern "C" { extern f_status_t fss_basic_read_main(fss_basic_read_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_basic_read_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_basic_read_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_basic_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_basic_read/data/build/settings b/level_3/fss_basic_read/data/build/settings index 6555cb5..b16256e 100644 --- a/level_3/fss_basic_read/data/build/settings +++ b/level_3/fss_basic_read/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_basic_read.c private-common.c private-print.c private-read.c +build_sources_library fss_basic_read.c common.c private-common.c private-print.c private-read.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_basic_read.h +build_sources_headers fss_basic_read.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_basic_write/c/common.c b/level_3/fss_basic_write/c/common.c new file mode 100644 index 0000000..2b16896 --- /dev/null +++ b/level_3/fss_basic_write/c/common.c @@ -0,0 +1,31 @@ +#include "fss_basic_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_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); + + f_type_array_lengths_resize(0, &main->remaining); + + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_fss_basic_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_basic_write/c/common.h b/level_3/fss_basic_write/c/common.h new file mode 100644 index 0000000..1704a32 --- /dev/null +++ b/level_3/fss_basic_write/c/common.h @@ -0,0 +1,181 @@ +/** + * FLL - Level 3 + * + * Project: FSS Basic Write + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_basic_write_common_h +#define _fss_basic_write_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_basic_write_program_version_ + #define FSS_BASIC_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_BASIC_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_BASIC_WRITE_program_version_micro_s F_string_ascii_8_s + + #define FSS_BASIC_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_BASIC_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_BASIC_WRITE_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_BASIC_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_WRITE_program_version_nano_prefix_s_length)) + #define FSS_BASIC_WRITE_program_version_nano_prefix_s + #define FSS_BASIC_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_BASIC_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_WRITE_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_BASIC_WRITE_program_version_nano_s) && defined(FSS_BASIC_WRITE_program_version_nano_s_length)) + #define FSS_BASIC_WRITE_program_version_nano_s + #define FSS_BASIC_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_BASIC_WRITE_program_version_nano_s) && defined(FSS_BASIC_WRITE_program_version_nano_s_length)) + + #define FSS_BASIC_WRITE_program_version_s FSS_BASIC_WRITE_program_version_major_s F_string_ascii_period_s FSS_BASIC_WRITE_program_version_minor_s F_string_ascii_period_s FSS_BASIC_WRITE_program_version_micro_s FSS_BASIC_WRITE_program_version_nano_prefix_s FSS_BASIC_WRITE_program_version_nano_s + + #define FSS_BASIC_WRITE_program_version_s_length FSS_BASIC_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_WRITE_program_version_micro_s_length + FSS_BASIC_WRITE_program_version_nano_prefix_s_length + FSS_BASIC_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_basic_write_program_version_s; +#endif // _di_fss_basic_write_program_version_ + +#ifndef _di_fss_basic_write_program_name_ + #define FSS_BASIC_WRITE_program_name_s "fss_basic_write" + #define FSS_BASIC_WRITE_program_name_long_s "FSS Basic Write" + + #define FSS_BASIC_WRITE_program_name_s_length 15 + #define FSS_BASIC_WRITE_program_name_long_s_length 15 + + extern const f_string_static_t fss_basic_write_program_name_s; + extern const f_string_static_t fss_basic_write_program_name_long_s; +#endif // _di_fss_basic_write_program_name_ + +#ifndef _di_fss_basic_write_defines_ + #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" + + enum { + fss_basic_write_parameter_help_e, + fss_basic_write_parameter_light_e, + fss_basic_write_parameter_dark_e, + fss_basic_write_parameter_no_color_e, + fss_basic_write_parameter_verbosity_quiet_e, + fss_basic_write_parameter_verbosity_normal_e, + fss_basic_write_parameter_verbosity_verbose_e, + fss_basic_write_parameter_verbosity_debug_e, + fss_basic_write_parameter_version_e, + + fss_basic_write_parameter_file_e, + fss_basic_write_parameter_content_e, + fss_basic_write_parameter_double_e, + fss_basic_write_parameter_ignore_e, + fss_basic_write_parameter_object_e, + fss_basic_write_parameter_partial_e, + fss_basic_write_parameter_prepend_e, + fss_basic_write_parameter_single_e, + fss_basic_write_parameter_trim_e, + }; + + #define fss_basic_write_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #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_ + +/** + * Deallocate main. + * + * Be sure to call this after executing fss_basic_write_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_basic_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_basic_write_common_h 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 b17246d..36236b6 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -558,19 +558,6 @@ extern "C" { } #endif // _di_fss_basic_write_main_ -#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); - - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_fss_basic_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 a869d87..ed2fe64 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.h +++ b/level_3/fss_basic_write/c/fss_basic_write.h @@ -41,150 +41,13 @@ #include #include +// FSS Basic Write includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_basic_write_program_version_ - #define FSS_BASIC_WRITE_program_version_major_s F_string_ascii_0_s - #define FSS_BASIC_WRITE_program_version_minor_s F_string_ascii_5_s - #define FSS_BASIC_WRITE_program_version_micro_s F_string_ascii_8_s - - #define FSS_BASIC_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_BASIC_WRITE_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_BASIC_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_BASIC_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_WRITE_program_version_nano_prefix_s_length)) - #define FSS_BASIC_WRITE_program_version_nano_prefix_s - #define FSS_BASIC_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_BASIC_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_BASIC_WRITE_program_version_nano_s) && defined(FSS_BASIC_WRITE_program_version_nano_s_length)) - #define FSS_BASIC_WRITE_program_version_nano_s - #define FSS_BASIC_WRITE_program_version_nano_s_length 0 - #endif // !(defined(FSS_BASIC_WRITE_program_version_nano_s) && defined(FSS_BASIC_WRITE_program_version_nano_s_length)) - - #define FSS_BASIC_WRITE_program_version_s FSS_BASIC_WRITE_program_version_major_s F_string_ascii_period_s FSS_BASIC_WRITE_program_version_minor_s F_string_ascii_period_s FSS_BASIC_WRITE_program_version_micro_s FSS_BASIC_WRITE_program_version_nano_prefix_s FSS_BASIC_WRITE_program_version_nano_s - - #define FSS_BASIC_WRITE_program_version_s_length FSS_BASIC_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_WRITE_program_version_micro_s_length + FSS_BASIC_WRITE_program_version_nano_prefix_s_length + FSS_BASIC_WRITE_program_version_nano_s_length - - extern const f_string_static_t fss_basic_write_program_version_s; -#endif // _di_fss_basic_write_program_version_ - -#ifndef _di_fss_basic_write_program_name_ - #define FSS_BASIC_WRITE_program_name_s "fss_basic_write" - #define FSS_BASIC_WRITE_program_name_long_s "FSS Basic Write" - - #define FSS_BASIC_WRITE_program_name_s_length 15 - #define FSS_BASIC_WRITE_program_name_long_s_length 15 - - extern const f_string_static_t fss_basic_write_program_name_s; - extern const f_string_static_t fss_basic_write_program_name_long_s; -#endif // _di_fss_basic_write_program_name_ - -#ifndef _di_fss_basic_write_defines_ - #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" - - enum { - fss_basic_write_parameter_help_e, - fss_basic_write_parameter_light_e, - fss_basic_write_parameter_dark_e, - fss_basic_write_parameter_no_color_e, - fss_basic_write_parameter_verbosity_quiet_e, - fss_basic_write_parameter_verbosity_normal_e, - fss_basic_write_parameter_verbosity_verbose_e, - fss_basic_write_parameter_verbosity_debug_e, - fss_basic_write_parameter_version_e, - - fss_basic_write_parameter_file_e, - fss_basic_write_parameter_content_e, - fss_basic_write_parameter_double_e, - fss_basic_write_parameter_ignore_e, - fss_basic_write_parameter_object_e, - fss_basic_write_parameter_partial_e, - fss_basic_write_parameter_prepend_e, - fss_basic_write_parameter_single_e, - fss_basic_write_parameter_trim_e, - }; - - #define fss_basic_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #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_ - /** * Print help. * @@ -228,24 +91,6 @@ extern "C" { extern f_status_t fss_basic_write_main(fss_basic_write_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_basic_write_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_basic_write_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_basic_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_basic_write/data/build/settings b/level_3/fss_basic_write/data/build/settings index 74e288e..5d149cc 100644 --- a/level_3/fss_basic_write/data/build/settings +++ b/level_3/fss_basic_write/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_basic_write.c private-common.c private-write.c +build_sources_library fss_basic_write.c common.c private-common.c private-write.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_basic_write.h +build_sources_headers fss_basic_write.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c new file mode 100644 index 0000000..99fec5e --- /dev/null +++ b/level_3/fss_embedded_list_read/c/common.c @@ -0,0 +1,34 @@ +#include "fss_embedded_list_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_program_name_ + +#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) { + + f_console_parameters_delete(&main->parameters); + + 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); + + return F_none; + } +#endif // _di_fss_embedded_list_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_embedded_list_read/c/common.h b/level_3/fss_embedded_list_read/c/common.h new file mode 100644 index 0000000..c6e4307 --- /dev/null +++ b/level_3/fss_embedded_list_read/c/common.h @@ -0,0 +1,234 @@ +/** + * FLL - Level 3 + * + * Project: FSS Embedded List Read + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_embedded_list_read_common_h +#define _fss_embedded_list_read_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_embedded_list_read_program_version_ + #define FSS_EMBEDDED_LIST_READ_program_version_major_s F_string_ascii_0_s + #define FSS_EMBEDDED_LIST_READ_program_version_minor_s F_string_ascii_5_s + #define FSS_EMBEDDED_LIST_READ_program_version_micro_s F_string_ascii_8_s + + #define FSS_EMBEDDED_LIST_READ_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EMBEDDED_LIST_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EMBEDDED_LIST_READ_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length)) + #define FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s + #define FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s_length)) + #define FSS_EMBEDDED_LIST_READ_program_version_nano_s + #define FSS_EMBEDDED_LIST_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s_length)) + + #define FSS_EMBEDDED_LIST_READ_program_version_s FSS_EMBEDDED_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_EMBEDDED_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_EMBEDDED_LIST_READ_program_version_micro_s FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s FSS_EMBEDDED_LIST_READ_program_version_nano_s + + #define FSS_EMBEDDED_LIST_READ_program_version_s_length FSS_EMBEDDED_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_READ_program_version_micro_s_length + FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length + FSS_EMBEDDED_LIST_READ_program_version_nano_s_length + + extern const f_string_static_t fss_embedded_list_read_program_version_s; +#endif // _di_fss_embedded_list_read_program_version_ + +#ifndef _di_fss_embedded_list_read_program_name_ + #define FSS_EMBEDDED_LIST_READ_program_name_s "fss_embedded_list_read" + #define FSS_EMBEDDED_LIST_READ_program_name_long_s "FSS Embedded List Read" + + #define FSS_EMBEDDED_LIST_READ_program_name_s_length 22 + #define FSS_EMBEDDED_LIST_READ_program_name_long_s_length 22 + + extern const f_string_static_t fss_embedded_list_read_program_name_s; + extern const f_string_static_t fss_embedded_list_read_program_name_long_s; +#endif // _di_fss_embedded_list_read_program_name_ + +#ifndef _di_fss_embedded_list_read_defines_ + #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" + + enum { + fss_embedded_list_read_parameter_help_e, + fss_embedded_list_read_parameter_light_e, + fss_embedded_list_read_parameter_dark_e, + fss_embedded_list_read_parameter_no_color_e, + fss_embedded_list_read_parameter_verbosity_quiet_e, + fss_embedded_list_read_parameter_verbosity_normal_e, + fss_embedded_list_read_parameter_verbosity_verbose_e, + fss_embedded_list_read_parameter_verbosity_debug_e, + fss_embedded_list_read_parameter_version_e, + + fss_embedded_list_read_parameter_at_e, + fss_embedded_list_read_parameter_content_e, + fss_embedded_list_read_parameter_columns_e, + fss_embedded_list_read_parameter_delimit_e, + fss_embedded_list_read_parameter_depth_e, + fss_embedded_list_read_parameter_empty_e, + fss_embedded_list_read_parameter_line_e, + fss_embedded_list_read_parameter_name_e, + fss_embedded_list_read_parameter_object_e, + fss_embedded_list_read_parameter_pipe_e, + fss_embedded_list_read_parameter_raw_e, + fss_embedded_list_read_parameter_select_e, + fss_embedded_list_read_parameter_total_e, + fss_embedded_list_read_parameter_trim_e, + }; + + #define fss_embedded_list_read_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #define fss_embedded_list_read_total_parameters_d 23 +#endif // _di_fss_embedded_list_read_defines_ + +#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" + #define fss_embedded_list_read_delimit_mode_name_greater_s "+" + #define fss_embedded_list_read_delimit_mode_name_lesser_s "-" + + #define fss_embedded_list_read_delimit_mode_name_none_s_length 4 + #define fss_embedded_list_read_delimit_mode_name_all_s_length 3 + #define fss_embedded_list_read_delimit_mode_name_greater_s_length 1 + #define fss_embedded_list_read_delimit_mode_name_lesser_s_length 1 + + enum { + fss_embedded_list_read_delimit_mode_none_e = 1, + fss_embedded_list_read_delimit_mode_all_e, + fss_embedded_list_read_delimit_mode_depth_e, + fss_embedded_list_read_delimit_mode_depth_greater_e, + fss_embedded_list_read_delimit_mode_depth_lesser_e, + }; +#endif // _di_fss_embedded_list_read_delimit_modes_ + +#ifndef _di_fss_embedded_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_string_dynamic_t buffer; + f_fss_nest_t nest; + f_string_quantity_t quantity; + + uint8_t delimit_mode; + f_array_length_t delimit_depth; + + f_color_context_t context; + } fss_embedded_list_read_main_t; + + #define fss_embedded_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_string_dynamic_t_initialize, \ + f_fss_nest_t_initialize, \ + f_string_quantity_t_initialize, \ + fss_embedded_list_read_delimit_mode_all_e, \ + 0, \ + f_color_context_t_initialize, \ + } +#endif // _di_fss_embedded_list_read_main_t_ + +/** + * Deallocate main. + * + * Be sure to call this after executing fss_embedded_list_read_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @see fss_embedded_list_read_main() + */ +#ifndef _di_fss_embedded_list_read_main_delete_ + extern f_status_t fss_embedded_list_read_main_delete(fss_embedded_list_read_main_t * const main); +#endif // _di_fss_embedded_list_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_embedded_list_read_common_h 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 52e4b1e..f7d2f18 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 @@ -372,19 +372,19 @@ extern "C" { if (arguments->argv[location][length - 1] == fss_embedded_list_read_delimit_mode_name_greater_s.string[0]) { main->delimit_mode = fss_embedded_list_read_delimit_mode_depth_greater_e; - // shorten the length to better convert the remainder to a number. + // Shorten the length to better convert the remainder to a number. --length; } else if (arguments->argv[location][length - 1] == fss_embedded_list_read_delimit_mode_name_lesser_s.string[0]) { main->delimit_mode = fss_embedded_list_read_delimit_mode_depth_lesser_e; - // shorten the length to better convert the remainder to a number. + // Shorten the length to better convert the remainder to a number. --length; } f_string_range_t range = macro_f_string_range_t_initialize(length); - // ignore leading plus sign. + // Ignore leading plus sign. if (arguments->argv[location][0] == '+') { ++range.start; } @@ -544,22 +544,6 @@ extern "C" { } #endif // _di_fss_embedded_list_read_main_ -#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) { - - f_console_parameters_delete(&main->parameters); - - 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); - - return F_none; - } -#endif // _di_fss_embedded_list_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h index 8ca572e..05b454f 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h @@ -48,202 +48,13 @@ #include #include +// FSS Embedded List Read includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_embedded_list_read_program_version_ - #define FSS_EMBEDDED_LIST_READ_program_version_major_s F_string_ascii_0_s - #define FSS_EMBEDDED_LIST_READ_program_version_minor_s F_string_ascii_5_s - #define FSS_EMBEDDED_LIST_READ_program_version_micro_s F_string_ascii_8_s - - #define FSS_EMBEDDED_LIST_READ_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_EMBEDDED_LIST_READ_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_EMBEDDED_LIST_READ_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length)) - #define FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s - #define FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s_length)) - #define FSS_EMBEDDED_LIST_READ_program_version_nano_s - #define FSS_EMBEDDED_LIST_READ_program_version_nano_s_length 0 - #endif // !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s_length)) - - #define FSS_EMBEDDED_LIST_READ_program_version_s FSS_EMBEDDED_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_EMBEDDED_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_EMBEDDED_LIST_READ_program_version_micro_s FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s FSS_EMBEDDED_LIST_READ_program_version_nano_s - - #define FSS_EMBEDDED_LIST_READ_program_version_s_length FSS_EMBEDDED_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_READ_program_version_micro_s_length + FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length + FSS_EMBEDDED_LIST_READ_program_version_nano_s_length - - extern const f_string_static_t fss_embedded_list_read_program_version_s; -#endif // _di_fss_embedded_list_read_program_version_ - -#ifndef _di_fss_embedded_list_read_program_name_ - #define FSS_EMBEDDED_LIST_READ_program_name_s "fss_embedded_list_read" - #define FSS_EMBEDDED_LIST_READ_program_name_long_s "FSS Embedded List Read" - - #define FSS_EMBEDDED_LIST_READ_program_name_s_length 22 - #define FSS_EMBEDDED_LIST_READ_program_name_long_s_length 22 - - extern const f_string_static_t fss_embedded_list_read_program_name_s; - extern const f_string_static_t fss_embedded_list_read_program_name_long_s; -#endif // _di_fss_embedded_list_read_program_name_ - -#ifndef _di_fss_embedded_list_read_defines_ - #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" - - enum { - fss_embedded_list_read_parameter_help_e, - fss_embedded_list_read_parameter_light_e, - fss_embedded_list_read_parameter_dark_e, - fss_embedded_list_read_parameter_no_color_e, - fss_embedded_list_read_parameter_verbosity_quiet_e, - fss_embedded_list_read_parameter_verbosity_normal_e, - fss_embedded_list_read_parameter_verbosity_verbose_e, - fss_embedded_list_read_parameter_verbosity_debug_e, - fss_embedded_list_read_parameter_version_e, - - fss_embedded_list_read_parameter_at_e, - fss_embedded_list_read_parameter_content_e, - fss_embedded_list_read_parameter_columns_e, - fss_embedded_list_read_parameter_delimit_e, - fss_embedded_list_read_parameter_depth_e, - fss_embedded_list_read_parameter_empty_e, - fss_embedded_list_read_parameter_line_e, - fss_embedded_list_read_parameter_name_e, - fss_embedded_list_read_parameter_object_e, - fss_embedded_list_read_parameter_pipe_e, - fss_embedded_list_read_parameter_raw_e, - fss_embedded_list_read_parameter_select_e, - fss_embedded_list_read_parameter_total_e, - fss_embedded_list_read_parameter_trim_e, - }; - - #define fss_embedded_list_read_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #define fss_embedded_list_read_total_parameters_d 23 -#endif // _di_fss_embedded_list_read_defines_ - -#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" - #define fss_embedded_list_read_delimit_mode_name_greater_s "+" - #define fss_embedded_list_read_delimit_mode_name_lesser_s "-" - - #define fss_embedded_list_read_delimit_mode_name_none_s_length 4 - #define fss_embedded_list_read_delimit_mode_name_all_s_length 3 - #define fss_embedded_list_read_delimit_mode_name_greater_s_length 1 - #define fss_embedded_list_read_delimit_mode_name_lesser_s_length 1 - - enum { - fss_embedded_list_read_delimit_mode_none_e = 1, - fss_embedded_list_read_delimit_mode_all_e, - fss_embedded_list_read_delimit_mode_depth_e, - fss_embedded_list_read_delimit_mode_depth_greater_e, - fss_embedded_list_read_delimit_mode_depth_lesser_e, - }; -#endif // _di_fss_embedded_list_read_delimit_modes_ - -#ifndef _di_fss_embedded_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_string_dynamic_t buffer; - f_fss_nest_t nest; - f_string_quantity_t quantity; - - uint8_t delimit_mode; - f_array_length_t delimit_depth; - - f_color_context_t context; - } fss_embedded_list_read_main_t; - - #define fss_embedded_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_string_dynamic_t_initialize, \ - f_fss_nest_t_initialize, \ - f_string_quantity_t_initialize, \ - fss_embedded_list_read_delimit_mode_all_e, \ - 0, \ - f_color_context_t_initialize, \ - } -#endif // _di_fss_embedded_list_read_main_t_ - /** * Print help. * @@ -288,25 +99,6 @@ extern "C" { extern f_status_t fss_embedded_list_read_main(fss_embedded_list_read_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_embedded_list_read_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_embedded_list_read_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see fss_embedded_list_read_main() - */ -#ifndef _di_fss_embedded_list_read_main_delete_ - extern f_status_t fss_embedded_list_read_main_delete(fss_embedded_list_read_main_t * const main); -#endif // _di_fss_embedded_list_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_embedded_list_read/data/build/settings b/level_3/fss_embedded_list_read/data/build/settings index 8a0b67c..d22a180 100644 --- a/level_3/fss_embedded_list_read/data/build/settings +++ b/level_3/fss_embedded_list_read/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_embedded_list_read.c private-common.c private-print.c private-read.c +build_sources_library fss_embedded_list_read.c common.c private-common.c private-print.c private-read.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_embedded_list_read.h +build_sources_headers fss_embedded_list_read.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_embedded_list_write/c/common.c b/level_3/fss_embedded_list_write/c/common.c new file mode 100644 index 0000000..28fdc85 --- /dev/null +++ b/level_3/fss_embedded_list_write/c/common.c @@ -0,0 +1,31 @@ +#include "fss_embedded_list_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_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); + + f_type_array_lengths_resize(0, &main->remaining); + + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_fss_embedded_list_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_embedded_list_write/c/common.h b/level_3/fss_embedded_list_write/c/common.h new file mode 100644 index 0000000..4d09ff3 --- /dev/null +++ b/level_3/fss_embedded_list_write/c/common.h @@ -0,0 +1,185 @@ +/** + * FLL - Level 3 + * + * Project: FSS Embedded List Write + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_embedded_list_write_common_h +#define _fss_embedded_list_write_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_embedded_list_write_program_version_ + #define FSS_EMBEDDED_LIST_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_EMBEDDED_LIST_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_EMBEDDED_LIST_WRITE_program_version_micro_s F_string_ascii_8_s + + #define FSS_EMBEDDED_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EMBEDDED_LIST_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EMBEDDED_LIST_WRITE_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length)) + #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s + #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length)) + #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_s + #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length)) + + #define FSS_EMBEDDED_LIST_WRITE_program_version_s FSS_EMBEDDED_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_EMBEDDED_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EMBEDDED_LIST_WRITE_program_version_micro_s FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s FSS_EMBEDDED_LIST_WRITE_program_version_nano_s + + #define FSS_EMBEDDED_LIST_WRITE_program_version_s_length FSS_EMBEDDED_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_micro_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_embedded_list_write_program_version_s; +#endif // _di_fss_embedded_list_write_program_version_ + +#ifndef _di_fss_embedded_list_write_program_name_ + #define FSS_EMBEDDED_LIST_WRITE_program_name_s "fss_embedded_list_write" + #define FSS_EMBEDDED_LIST_WRITE_program_name_long_s "FSS Embedded List Write" + + #define FSS_EMBEDDED_LIST_WRITE_program_name_s_length 23 + #define FSS_EMBEDDED_LIST_WRITE_program_name_long_s_length 23 + + extern const f_string_static_t fss_embedded_list_write_program_name_s; + extern const f_string_static_t fss_embedded_list_write_program_name_long_s; +#endif // _di_fss_embedded_list_write_program_name_ + +#ifndef _di_fss_embedded_list_write_defines_ + #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" + + enum { + fss_embedded_list_write_parameter_help_e, + fss_embedded_list_write_parameter_light_e, + fss_embedded_list_write_parameter_dark_e, + fss_embedded_list_write_parameter_no_color_e, + fss_embedded_list_write_parameter_verbosity_quiet_e, + fss_embedded_list_write_parameter_verbosity_normal_e, + fss_embedded_list_write_parameter_verbosity_verbose_e, + fss_embedded_list_write_parameter_verbosity_debug_e, + fss_embedded_list_write_parameter_version_e, + + fss_embedded_list_write_parameter_file_e, + fss_embedded_list_write_parameter_content_e, + fss_embedded_list_write_parameter_double_e, + fss_embedded_list_write_parameter_ignore_e, + fss_embedded_list_write_parameter_object_e, + fss_embedded_list_write_parameter_partial_e, + fss_embedded_list_write_parameter_prepend_e, + fss_embedded_list_write_parameter_single_e, + fss_embedded_list_write_parameter_trim_e, + }; + + #define fss_embedded_list_write_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #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_ + +/** + * Deallocate main. + * + * Be sure to call this after executing fss_embedded_list_write_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_embedded_list_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_embedded_list_write_common_h 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 33beebe..7cccab6 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 @@ -571,19 +571,6 @@ extern "C" { } #endif // _di_fss_embedded_list_write_main_ -#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); - - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_fss_embedded_list_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 8e24dc7..e595656 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 @@ -41,153 +41,13 @@ #include #include +// FSS Embedded List Write includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_embedded_list_write_program_version_ - #define FSS_EMBEDDED_LIST_WRITE_program_version_major_s F_string_ascii_0_s - #define FSS_EMBEDDED_LIST_WRITE_program_version_minor_s F_string_ascii_5_s - #define FSS_EMBEDDED_LIST_WRITE_program_version_micro_s F_string_ascii_8_s - - #define FSS_EMBEDDED_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_EMBEDDED_LIST_WRITE_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_EMBEDDED_LIST_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length)) - #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s - #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length)) - #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_s - #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length 0 - #endif // !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length)) - - #define FSS_EMBEDDED_LIST_WRITE_program_version_s FSS_EMBEDDED_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_EMBEDDED_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EMBEDDED_LIST_WRITE_program_version_micro_s FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s FSS_EMBEDDED_LIST_WRITE_program_version_nano_s - - #define FSS_EMBEDDED_LIST_WRITE_program_version_s_length FSS_EMBEDDED_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_micro_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length - - extern const f_string_static_t fss_embedded_list_write_program_version_s; -#endif // _di_fss_embedded_list_write_program_version_ - -#ifndef _di_fss_embedded_list_write_program_name_ - #define FSS_EMBEDDED_LIST_WRITE_program_name_s "fss_embedded_list_write" - #define FSS_EMBEDDED_LIST_WRITE_program_name_long_s "FSS Embedded List Write" - - #define FSS_EMBEDDED_LIST_WRITE_program_name_s_length 23 - #define FSS_EMBEDDED_LIST_WRITE_program_name_long_s_length 23 - - extern const f_string_static_t fss_embedded_list_write_program_name_s; - extern const f_string_static_t fss_embedded_list_write_program_name_long_s; -#endif // _di_fss_embedded_list_write_program_name_ - -#ifndef _di_fss_embedded_list_write_defines_ - #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" - - enum { - fss_embedded_list_write_parameter_help_e, - fss_embedded_list_write_parameter_light_e, - fss_embedded_list_write_parameter_dark_e, - fss_embedded_list_write_parameter_no_color_e, - fss_embedded_list_write_parameter_verbosity_quiet_e, - fss_embedded_list_write_parameter_verbosity_normal_e, - fss_embedded_list_write_parameter_verbosity_verbose_e, - fss_embedded_list_write_parameter_verbosity_debug_e, - fss_embedded_list_write_parameter_version_e, - - fss_embedded_list_write_parameter_file_e, - fss_embedded_list_write_parameter_content_e, - fss_embedded_list_write_parameter_double_e, - fss_embedded_list_write_parameter_ignore_e, - fss_embedded_list_write_parameter_object_e, - fss_embedded_list_write_parameter_partial_e, - fss_embedded_list_write_parameter_prepend_e, - fss_embedded_list_write_parameter_single_e, - fss_embedded_list_write_parameter_trim_e, - }; - - #define fss_embedded_list_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #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_ - /** * Print help. * @@ -232,25 +92,6 @@ extern "C" { extern f_status_t fss_embedded_list_write_main(fss_embedded_list_write_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_embedded_list_write_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_embedded_list_write_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_embedded_list_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_embedded_list_write/data/build/settings b/level_3/fss_embedded_list_write/data/build/settings index c953bdd..d9d7347 100644 --- a/level_3/fss_embedded_list_write/data/build/settings +++ b/level_3/fss_embedded_list_write/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_embedded_list_write.c private-common.c private-write.c +build_sources_library fss_embedded_list_write.c common.c private-common.c private-write.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_embedded_list_write.h +build_sources_headers fss_embedded_list_write.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_extended_list_read/c/common.c b/level_3/fss_extended_list_read/c/common.c new file mode 100644 index 0000000..55823ac --- /dev/null +++ b/level_3/fss_extended_list_read/c/common.c @@ -0,0 +1,30 @@ +#include "fss_extended_list_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_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); + + f_type_array_lengths_resize(0, &main->remaining); + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_fss_extended_list_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_extended_list_read/c/common.h b/level_3/fss_extended_list_read/c/common.h new file mode 100644 index 0000000..f14c7ae --- /dev/null +++ b/level_3/fss_extended_list_read/c/common.h @@ -0,0 +1,241 @@ +/** + * FLL - Level 3 + * + * Project: FSS Extended List Read + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_extended_list_read_common_h +#define _fss_extended_list_read_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_extended_list_read_program_version_ + #define FSS_EXTENDED_LIST_READ_program_version_major_s F_string_ascii_0_s + #define FSS_EXTENDED_LIST_READ_program_version_minor_s F_string_ascii_5_s + #define FSS_EXTENDED_LIST_READ_program_version_micro_s F_string_ascii_8_s + + #define FSS_EXTENDED_LIST_READ_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EXTENDED_LIST_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EXTENDED_LIST_READ_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s_length)) + #define FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s + #define FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_s_length)) + #define FSS_EXTENDED_LIST_READ_program_version_nano_s + #define FSS_EXTENDED_LIST_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_s_length)) + + #define FSS_EXTENDED_LIST_READ_program_version_s FSS_EXTENDED_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_LIST_READ_program_version_micro_s FSS_EXTENDED_LIST_READ_version_nano_prefix_s FSS_EXTENDED_LIST_READ_version_nano_s + + #define FSS_EXTENDED_LIST_READ_program_version_s_length FSS_EXTENDED_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_READ_program_version_micro_s_length + FSS_EXTENDED_LIST_READ_version_nano_prefix_s_length + FSS_EXTENDED_LIST_READ_version_nano_s_length + + extern const f_string_static_t fss_extended_list_read_program_version_s; +#endif // _di_fss_extended_list_read_program_version_ + +#ifndef _di_fss_extended_list_read_program_name_ + #define FSS_EXTENDED_LIST_READ_program_name_s "fss_extended_list_read" + #define FSS_EXTENDED_LIST_READ_program_name_long_s "FSS Extended List Read" + + #define FSS_EXTENDED_LIST_READ_program_name_s_length 22 + #define FSS_EXTENDED_LIST_READ_program_name_long_s_length 22 + + extern const f_string_static_t fss_extended_list_read_program_name_s; + extern const f_string_static_t fss_extended_list_read_program_name_long_s; +#endif // _di_fss_extended_list_read_program_name_ + +#ifndef _di_fss_extended_list_read_defines_ + #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" + + enum { + fss_extended_list_read_parameter_help_e, + fss_extended_list_read_parameter_light_e, + fss_extended_list_read_parameter_dark_e, + fss_extended_list_read_parameter_no_color_e, + fss_extended_list_read_parameter_verbosity_quiet_e, + fss_extended_list_read_parameter_verbosity_normal_e, + fss_extended_list_read_parameter_verbosity_verbose_e, + fss_extended_list_read_parameter_verbosity_debug_e, + fss_extended_list_read_parameter_version_e, + + fss_extended_list_read_parameter_at_e, + fss_extended_list_read_parameter_content_e, + fss_extended_list_read_parameter_columns_e, + fss_extended_list_read_parameter_delimit_e, + fss_extended_list_read_parameter_depth_e, + fss_extended_list_read_parameter_empty_e, + fss_extended_list_read_parameter_line_e, + fss_extended_list_read_parameter_name_e, + fss_extended_list_read_parameter_object_e, + fss_extended_list_read_parameter_pipe_e, + fss_extended_list_read_parameter_raw_e, + fss_extended_list_read_parameter_select_e, + fss_extended_list_read_parameter_total_e, + fss_extended_list_read_parameter_trim_e, + }; + + #define fss_extended_list_read_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #define fss_extended_list_read_total_parameters_d 23 +#endif // _di_fss_extended_list_read_defines_ + +/** + * FSS Delimit Parameter data. + * + * fss_extended_list_read_delimit_mode_*: + * - all: All delimits are to be aplied. + * - content: Content are to have delimits applied. + * - content_greater: Content at this number or higher are to have delimits applied. + * - content_greater_object: Objects and Content at this number or higher are to have delimits applied. + * - content_lesser: Content at this number or lower are to have delimits applied. + * - content_lesser_object: Objects and Content at this number or lower are to have delimits applied. + * - content_object: Objects and Content are to have delimits applied + * - object: Objects arre to have delimits applied. + */ +#ifndef _di_fss_extended_list_read_delimit_mode_ + #define fss_extended_list_read_delimit_mode_name_none_s "none" + #define fss_extended_list_read_delimit_mode_name_all_s "all" + #define fss_extended_list_read_delimit_mode_name_object_s "object" + #define fss_extended_list_read_delimit_mode_name_greater_s "+" + #define fss_extended_list_read_delimit_mode_name_lesser_s "-" + + #define fss_extended_list_read_delimit_mode_name_none_s_length 4 + #define fss_extended_list_read_delimit_mode_name_all_s_length 3 + #define fss_extended_list_read_delimit_mode_name_object_s_length 6 + #define fss_extended_list_read_delimit_mode_name_greater_s_length 1 + #define fss_extended_list_read_delimit_mode_name_lesser_s_length 1 + + enum { + fss_extended_list_read_delimit_mode_none_e = 1, + fss_extended_list_read_delimit_mode_all_e, + fss_extended_list_read_delimit_mode_content_e, + fss_extended_list_read_delimit_mode_content_greater_e, + fss_extended_list_read_delimit_mode_content_greater_object_e, + fss_extended_list_read_delimit_mode_content_lesser_e, + fss_extended_list_read_delimit_mode_content_lesser_object_e, + fss_extended_list_read_delimit_mode_content_object_e, + fss_extended_list_read_delimit_mode_object_e, + }; +#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. + * + * Be sure to call this after executing fss_extended_list_read_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_extended_list_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_extended_list_read_common_h 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 83c8af5..18cb5ca 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 @@ -659,18 +659,6 @@ extern "C" { } #endif // _di_fss_extended_list_read_main_ -#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); - - f_type_array_lengths_resize(0, &main->remaining); - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_fss_extended_list_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 0b02f34..cbfef7e 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 @@ -48,209 +48,13 @@ #include #include +// FSS Extended List Read includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_extended_list_read_program_version_ - #define FSS_EXTENDED_LIST_READ_program_version_major_s F_string_ascii_0_s - #define FSS_EXTENDED_LIST_READ_program_version_minor_s F_string_ascii_5_s - #define FSS_EXTENDED_LIST_READ_program_version_micro_s F_string_ascii_8_s - - #define FSS_EXTENDED_LIST_READ_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_EXTENDED_LIST_READ_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_EXTENDED_LIST_READ_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s_length)) - #define FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s - #define FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_s_length)) - #define FSS_EXTENDED_LIST_READ_program_version_nano_s - #define FSS_EXTENDED_LIST_READ_program_version_nano_s_length 0 - #endif // !(defined(FSS_EXTENDED_LIST_READ_program_version_nano_s) && defined(FSS_EXTENDED_LIST_READ_program_version_nano_s_length)) - - #define FSS_EXTENDED_LIST_READ_program_version_s FSS_EXTENDED_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_LIST_READ_program_version_micro_s FSS_EXTENDED_LIST_READ_version_nano_prefix_s FSS_EXTENDED_LIST_READ_version_nano_s - - #define FSS_EXTENDED_LIST_READ_program_version_s_length FSS_EXTENDED_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_READ_program_version_micro_s_length + FSS_EXTENDED_LIST_READ_version_nano_prefix_s_length + FSS_EXTENDED_LIST_READ_version_nano_s_length - - extern const f_string_static_t fss_extended_list_read_program_version_s; -#endif // _di_fss_extended_list_read_program_version_ - -#ifndef _di_fss_extended_list_read_program_name_ - #define FSS_EXTENDED_LIST_READ_program_name_s "fss_extended_list_read" - #define FSS_EXTENDED_LIST_READ_program_name_long_s "FSS Extended List Read" - - #define FSS_EXTENDED_LIST_READ_program_name_s_length 22 - #define FSS_EXTENDED_LIST_READ_program_name_long_s_length 22 - - extern const f_string_static_t fss_extended_list_read_program_name_s; - extern const f_string_static_t fss_extended_list_read_program_name_long_s; -#endif // _di_fss_extended_list_read_program_name_ - -#ifndef _di_fss_extended_list_read_defines_ - #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" - - enum { - fss_extended_list_read_parameter_help_e, - fss_extended_list_read_parameter_light_e, - fss_extended_list_read_parameter_dark_e, - fss_extended_list_read_parameter_no_color_e, - fss_extended_list_read_parameter_verbosity_quiet_e, - fss_extended_list_read_parameter_verbosity_normal_e, - fss_extended_list_read_parameter_verbosity_verbose_e, - fss_extended_list_read_parameter_verbosity_debug_e, - fss_extended_list_read_parameter_version_e, - - fss_extended_list_read_parameter_at_e, - fss_extended_list_read_parameter_content_e, - fss_extended_list_read_parameter_columns_e, - fss_extended_list_read_parameter_delimit_e, - fss_extended_list_read_parameter_depth_e, - fss_extended_list_read_parameter_empty_e, - fss_extended_list_read_parameter_line_e, - fss_extended_list_read_parameter_name_e, - fss_extended_list_read_parameter_object_e, - fss_extended_list_read_parameter_pipe_e, - fss_extended_list_read_parameter_raw_e, - fss_extended_list_read_parameter_select_e, - fss_extended_list_read_parameter_total_e, - fss_extended_list_read_parameter_trim_e, - }; - - #define fss_extended_list_read_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #define fss_extended_list_read_total_parameters_d 23 -#endif // _di_fss_extended_list_read_defines_ - -/** - * FSS Delimit Parameter data. - * - * fss_extended_list_read_delimit_mode_*: - * - all: All delimits are to be aplied. - * - content: Content are to have delimits applied. - * - content_greater: Content at this number or higher are to have delimits applied. - * - content_greater_object: Objects and Content at this number or higher are to have delimits applied. - * - content_lesser: Content at this number or lower are to have delimits applied. - * - content_lesser_object: Objects and Content at this number or lower are to have delimits applied. - * - content_object: Objects and Content are to have delimits applied - * - object: Objects arre to have delimits applied. - */ -#ifndef _di_fss_extended_list_read_delimit_mode_ - #define fss_extended_list_read_delimit_mode_name_none_s "none" - #define fss_extended_list_read_delimit_mode_name_all_s "all" - #define fss_extended_list_read_delimit_mode_name_object_s "object" - #define fss_extended_list_read_delimit_mode_name_greater_s "+" - #define fss_extended_list_read_delimit_mode_name_lesser_s "-" - - #define fss_extended_list_read_delimit_mode_name_none_s_length 4 - #define fss_extended_list_read_delimit_mode_name_all_s_length 3 - #define fss_extended_list_read_delimit_mode_name_object_s_length 6 - #define fss_extended_list_read_delimit_mode_name_greater_s_length 1 - #define fss_extended_list_read_delimit_mode_name_lesser_s_length 1 - - enum { - fss_extended_list_read_delimit_mode_none_e = 1, - fss_extended_list_read_delimit_mode_all_e, - fss_extended_list_read_delimit_mode_content_e, - fss_extended_list_read_delimit_mode_content_greater_e, - fss_extended_list_read_delimit_mode_content_greater_object_e, - fss_extended_list_read_delimit_mode_content_lesser_e, - fss_extended_list_read_delimit_mode_content_lesser_object_e, - fss_extended_list_read_delimit_mode_content_object_e, - fss_extended_list_read_delimit_mode_object_e, - }; -#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_ - /** * Print help. * @@ -295,25 +99,6 @@ extern "C" { extern f_status_t fss_extended_list_read_main(fss_extended_list_read_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_extended_list_read_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_extended_list_read_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_extended_list_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_extended_list_read/data/build/settings b/level_3/fss_extended_list_read/data/build/settings index 1c22e56..f0d57e7 100644 --- a/level_3/fss_extended_list_read/data/build/settings +++ b/level_3/fss_extended_list_read/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_extended_list_read.c private-common.c private-print.c private-read.c +build_sources_library fss_extended_list_read.c common.c private-common.c private-print.c private-read.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_extended_list_read.h +build_sources_headers fss_extended_list_read.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_extended_list_write/c/common.c b/level_3/fss_extended_list_write/c/common.c new file mode 100644 index 0000000..453756d --- /dev/null +++ b/level_3/fss_extended_list_write/c/common.c @@ -0,0 +1,31 @@ +#include "fss_extended_list_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_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); + + f_type_array_lengths_resize(0, &main->remaining); + + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_fss_extended_list_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_extended_list_write/c/common.h b/level_3/fss_extended_list_write/c/common.h new file mode 100644 index 0000000..3352294 --- /dev/null +++ b/level_3/fss_extended_list_write/c/common.h @@ -0,0 +1,185 @@ +/** + * FLL - Level 3 + * + * Project: FSS Extended List Write + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_extended_list_write_common_h +#define _fss_extended_list_write_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_extended_list_write_program_version_ + #define FSS_EXTENDED_LIST_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_EXTENDED_LIST_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_EXTENDED_LIST_WRITE_program_version_micro_s F_string_ascii_8_s + + #define FSS_EXTENDED_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EXTENDED_LIST_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EXTENDED_LIST_WRITE_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length)) + #define FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s + #define FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length)) + #define FSS_EXTENDED_LIST_WRITE_program_version_nano_s + #define FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length)) + + #define FSS_EXTENDED_LIST_WRITE_program_version_s FSS_EXTENDED_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_LIST_WRITE_program_version_micro_s FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s FSS_EXTENDED_LIST_WRITE_program_version_nano_s + + #define FSS_EXTENDED_LIST_WRITE_program_version_s_length FSS_EXTENDED_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_WRITE_program_version_micro_s_length + FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length + FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_extended_list_write_program_version_s; +#endif // _di_fss_extended_list_write_program_version_ + +#ifndef _di_fss_extended_list_write_program_name_ + #define FSS_EXTENDED_LIST_WRITE_program_name_s "fss_extended_list_write" + #define FSS_EXTENDED_LIST_WRITE_program_name_long_s "FSS Extended List Write" + + #define FSS_EXTENDED_LIST_WRITE_program_name_s_length 23 + #define FSS_EXTENDED_LIST_WRITE_program_name_long_s_length 23 + + extern const f_string_static_t fss_extended_list_write_program_name_s; + extern const f_string_static_t fss_extended_list_write_program_name_long_s; +#endif // _di_fss_extended_list_write_program_name_ + +#ifndef _di_fss_extended_list_write_defines_ + #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" + + enum { + fss_extended_list_write_parameter_help_e, + fss_extended_list_write_parameter_light_e, + fss_extended_list_write_parameter_dark_e, + fss_extended_list_write_parameter_no_color_e, + fss_extended_list_write_parameter_verbosity_quiet_e, + fss_extended_list_write_parameter_verbosity_normal_e, + fss_extended_list_write_parameter_verbosity_verbose_e, + fss_extended_list_write_parameter_verbosity_debug_e, + fss_extended_list_write_parameter_version_e, + + fss_extended_list_write_parameter_file_e, + fss_extended_list_write_parameter_content_e, + fss_extended_list_write_parameter_double_e, + fss_extended_list_write_parameter_ignore_e, + fss_extended_list_write_parameter_object_e, + fss_extended_list_write_parameter_partial_e, + fss_extended_list_write_parameter_prepend_e, + fss_extended_list_write_parameter_single_e, + fss_extended_list_write_parameter_trim_e, + }; + + #define fss_extended_list_write_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #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_ + +/** + * Deallocate main. + * + * Be sure to call this after executing fss_extended_list_write_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_extended_list_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_extended_list_write_common_h 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 f08d312..1f7ff57 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 @@ -570,19 +570,6 @@ extern "C" { } #endif // _di_fss_extended_list_write_main_ -#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); - - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_fss_extended_list_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 dc8f067..c6d34bc 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 @@ -41,153 +41,13 @@ #include #include +// FSS Extended List Write includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_extended_list_write_program_version_ - #define FSS_EXTENDED_LIST_WRITE_program_version_major_s F_string_ascii_0_s - #define FSS_EXTENDED_LIST_WRITE_program_version_minor_s F_string_ascii_5_s - #define FSS_EXTENDED_LIST_WRITE_program_version_micro_s F_string_ascii_8_s - - #define FSS_EXTENDED_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_EXTENDED_LIST_WRITE_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_EXTENDED_LIST_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length)) - #define FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s - #define FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length)) - #define FSS_EXTENDED_LIST_WRITE_program_version_nano_s - #define FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length 0 - #endif // !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length)) - - #define FSS_EXTENDED_LIST_WRITE_program_version_s FSS_EXTENDED_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_LIST_WRITE_program_version_micro_s FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s FSS_EXTENDED_LIST_WRITE_program_version_nano_s - - #define FSS_EXTENDED_LIST_WRITE_program_version_s_length FSS_EXTENDED_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_WRITE_program_version_micro_s_length + FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length + FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length - - extern const f_string_static_t fss_extended_list_write_program_version_s; -#endif // _di_fss_extended_list_write_program_version_ - -#ifndef _di_fss_extended_list_write_program_name_ - #define FSS_EXTENDED_LIST_WRITE_program_name_s "fss_extended_list_write" - #define FSS_EXTENDED_LIST_WRITE_program_name_long_s "FSS Extended List Write" - - #define FSS_EXTENDED_LIST_WRITE_program_name_s_length 23 - #define FSS_EXTENDED_LIST_WRITE_program_name_long_s_length 23 - - extern const f_string_static_t fss_extended_list_write_program_name_s; - extern const f_string_static_t fss_extended_list_write_program_name_long_s; -#endif // _di_fss_extended_list_write_program_name_ - -#ifndef _di_fss_extended_list_write_defines_ - #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" - - enum { - fss_extended_list_write_parameter_help_e, - fss_extended_list_write_parameter_light_e, - fss_extended_list_write_parameter_dark_e, - fss_extended_list_write_parameter_no_color_e, - fss_extended_list_write_parameter_verbosity_quiet_e, - fss_extended_list_write_parameter_verbosity_normal_e, - fss_extended_list_write_parameter_verbosity_verbose_e, - fss_extended_list_write_parameter_verbosity_debug_e, - fss_extended_list_write_parameter_version_e, - - fss_extended_list_write_parameter_file_e, - fss_extended_list_write_parameter_content_e, - fss_extended_list_write_parameter_double_e, - fss_extended_list_write_parameter_ignore_e, - fss_extended_list_write_parameter_object_e, - fss_extended_list_write_parameter_partial_e, - fss_extended_list_write_parameter_prepend_e, - fss_extended_list_write_parameter_single_e, - fss_extended_list_write_parameter_trim_e, - }; - - #define fss_extended_list_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #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_ - /** * Print help. * @@ -232,25 +92,6 @@ extern "C" { extern f_status_t fss_extended_list_write_main(fss_extended_list_write_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_extended_list_write_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_extended_list_write_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_extended_list_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_extended_list_write/data/build/settings b/level_3/fss_extended_list_write/data/build/settings index 27b3a09..7f70935 100644 --- a/level_3/fss_extended_list_write/data/build/settings +++ b/level_3/fss_extended_list_write/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_extended_list_write.c private-common.c private-write.c +build_sources_library fss_extended_list_write.c common.c private-common.c private-write.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_extended_list_write.h +build_sources_headers fss_extended_list_write.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_extended_read/c/common.c b/level_3/fss_extended_read/c/common.c new file mode 100644 index 0000000..5721f09 --- /dev/null +++ b/level_3/fss_extended_read/c/common.c @@ -0,0 +1,30 @@ +#include "fss_extended_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_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); + + f_type_array_lengths_resize(0, &main->remaining); + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_fss_extended_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_extended_read/c/common.h b/level_3/fss_extended_read/c/common.h new file mode 100644 index 0000000..d20dcda --- /dev/null +++ b/level_3/fss_extended_read/c/common.h @@ -0,0 +1,242 @@ +/** + * FLL - Level 3 + * + * Project: FSS Extended Read + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_extended_read_common_h +#define _fss_extended_read_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_extended_read_program_version_ + #define FSS_EXTENDED_READ_program_version_major_s F_string_ascii_0_s + #define FSS_EXTENDED_READ_program_version_minor_s F_string_ascii_5_s + #define FSS_EXTENDED_READ_program_version_micro_s F_string_ascii_8_s + + #define FSS_EXTENDED_READ_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EXTENDED_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EXTENDED_READ_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_EXTENDED_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_READ_program_version_nano_prefix_s_length)) + #define FSS_EXTENDED_READ_program_version_nano_prefix_s + #define FSS_EXTENDED_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EXTENDED_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_READ_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_EXTENDED_READ_program_version_nano_s) && defined(FSS_EXTENDED_READ_program_version_nano_s_length)) + #define FSS_EXTENDED_READ_program_version_nano_s + #define FSS_EXTENDED_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_EXTENDED_READ_program_version_nano_s) && defined(FSS_EXTENDED_READ_program_version_nano_s_length)) + + #define FSS_EXTENDED_READ_program_version_s FSS_EXTENDED_READ_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_READ_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_READ_program_version_micro_s FSS_EXTENDED_READ_program_version_nano_prefix_s FSS_EXTENDED_READ_program_version_nano_s + + #define FSS_EXTENDED_READ_program_version_s_length FSS_EXTENDED_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_READ_program_version_micro_s_length + FSS_EXTENDED_READ_program_version_nano_prefix_s_length + FSS_EXTENDED_READ_program_version_nano_s_length + + extern const f_string_static_t fss_extended_read_program_version_s; +#endif // _di_fss_extended_read_program_version_ + +#ifndef _di_fss_extended_read_program_name_ + #define FSS_EXTENDED_READ_program_name_s "fss_extended_read" + #define FSS_EXTENDED_READ_program_name_long_s "FSS Extended Read" + + #define FSS_EXTENDED_READ_program_name_s_length 17 + #define FSS_EXTENDED_READ_program_name_long_s_length 17 + + extern const f_string_static_t fss_extended_read_program_name_s; + extern const f_string_static_t fss_extended_read_program_name_long_s; +#endif // _di_fss_extended_read_program_name_ + +#ifndef _di_fss_extended_read_defines_ + #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" + + enum { + fss_extended_read_parameter_help_e, + fss_extended_read_parameter_light_e, + fss_extended_read_parameter_dark_e, + fss_extended_read_parameter_no_color_e, + fss_extended_read_parameter_verbosity_quiet_e, + fss_extended_read_parameter_verbosity_normal_e, + fss_extended_read_parameter_verbosity_verbose_e, + fss_extended_read_parameter_verbosity_debug_e, + fss_extended_read_parameter_version_e, + + fss_extended_read_parameter_at_e, + fss_extended_read_parameter_content_e, + fss_extended_read_parameter_columns_e, + fss_extended_read_parameter_delimit_e, + fss_extended_read_parameter_depth_e, + fss_extended_read_parameter_empty_e, + fss_extended_read_parameter_line_e, + fss_extended_read_parameter_name_e, + fss_extended_read_parameter_object_e, + fss_extended_read_parameter_pipe_e, + fss_extended_read_parameter_raw_e, + fss_extended_read_parameter_select_e, + fss_extended_read_parameter_total_e, + fss_extended_read_parameter_trim_e, + }; + + #define fss_extended_read_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #define fss_extended_read_total_parameters_d 23 +#endif // _di_fss_extended_read_defines_ + +/** + * FSS Delimit Parameter data. + * + * fss_extended_read_delimit_mode_*: + * - all: All delimits are to be aplied. + * - content: Content are to have delimits applied. + * - content_greater: Content at this number or higher are to have delimits applied. + * - content_greater_object: Objects and Content at this number or higher are to have delimits applied. + * - content_lesser: Content at this number or lower are to have delimits applied. + * - content_lesser_object: Objects and Content at this number or lower are to have delimits applied. + * - content_object: Objects and Content are to have delimits applied + * - object: Objects arre to have delimits applied. + */ +#ifndef _di_fss_extended_read_delimit_mode_ + #define fss_extended_read_delimit_mode_name_none "none" + #define fss_extended_read_delimit_mode_name_all "all" + #define fss_extended_read_delimit_mode_name_object "object" + #define fss_extended_read_delimit_mode_name_greater "+" + #define fss_extended_read_delimit_mode_name_lesser "-" + + #define fss_extended_read_delimit_mode_name_none_length 4 + #define fss_extended_read_delimit_mode_name_all_length 3 + #define fss_extended_read_delimit_mode_name_object_length 6 + #define fss_extended_read_delimit_mode_name_greater_length 1 + #define fss_extended_read_delimit_mode_name_lesser_length 1 + + enum { + fss_extended_read_delimit_mode_none_e = 1, + fss_extended_read_delimit_mode_all_e, + fss_extended_read_delimit_mode_content_e, + fss_extended_read_delimit_mode_content_greater_e, + fss_extended_read_delimit_mode_content_greater_object_e, + fss_extended_read_delimit_mode_content_lesser_e, + fss_extended_read_delimit_mode_content_lesser_object_e, + fss_extended_read_delimit_mode_content_object_e, + fss_extended_read_delimit_mode_object_e, + }; +#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. + * + * Be sure to call this after executing fss_extended_read_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_extended_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_extended_read_common_h 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 dba541f..30eb18f 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -666,18 +666,6 @@ extern "C" { } #endif // _di_fss_extended_read_main_ -#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); - - f_type_array_lengths_resize(0, &main->remaining); - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_fss_extended_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 406d946..aea06f9 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.h +++ b/level_3/fss_extended_read/c/fss_extended_read.h @@ -48,210 +48,13 @@ #include #include +// FSS Extended Read includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_extended_read_program_version_ - #define FSS_EXTENDED_READ_program_version_major_s F_string_ascii_0_s - #define FSS_EXTENDED_READ_program_version_minor_s F_string_ascii_5_s - #define FSS_EXTENDED_READ_program_version_micro_s F_string_ascii_8_s - - #define FSS_EXTENDED_READ_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_EXTENDED_READ_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_EXTENDED_READ_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_EXTENDED_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_READ_program_version_nano_prefix_s_length)) - #define FSS_EXTENDED_READ_program_version_nano_prefix_s - #define FSS_EXTENDED_READ_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_EXTENDED_READ_program_version_nano_prefix_s) && defined(FSS_EXTENDED_READ_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_EXTENDED_READ_program_version_nano_s) && defined(FSS_EXTENDED_READ_program_version_nano_s_length)) - #define FSS_EXTENDED_READ_program_version_nano_s - #define FSS_EXTENDED_READ_program_version_nano_s_length 0 - #endif // !(defined(FSS_EXTENDED_READ_program_version_nano_s) && defined(FSS_EXTENDED_READ_program_version_nano_s_length)) - - #define FSS_EXTENDED_READ_program_version_s FSS_EXTENDED_READ_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_READ_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_READ_program_version_micro_s FSS_EXTENDED_READ_program_version_nano_prefix_s FSS_EXTENDED_READ_program_version_nano_s - - #define FSS_EXTENDED_READ_program_version_s_length FSS_EXTENDED_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_READ_program_version_micro_s_length + FSS_EXTENDED_READ_program_version_nano_prefix_s_length + FSS_EXTENDED_READ_program_version_nano_s_length - - extern const f_string_static_t fss_extended_read_program_version_s; -#endif // _di_fss_extended_read_program_version_ - -#ifndef _di_fss_extended_read_program_name_ - #define FSS_EXTENDED_READ_program_name_s "fss_extended_read" - #define FSS_EXTENDED_READ_program_name_long_s "FSS Extended Read" - - #define FSS_EXTENDED_READ_program_name_s_length 17 - #define FSS_EXTENDED_READ_program_name_long_s_length 17 - - extern const f_string_static_t fss_extended_read_program_name_s; - extern const f_string_static_t fss_extended_read_program_name_long_s; -#endif // _di_fss_extended_read_program_name_ - -#ifndef _di_fss_extended_read_defines_ - #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" - - enum { - fss_extended_read_parameter_help_e, - fss_extended_read_parameter_light_e, - fss_extended_read_parameter_dark_e, - fss_extended_read_parameter_no_color_e, - fss_extended_read_parameter_verbosity_quiet_e, - fss_extended_read_parameter_verbosity_normal_e, - fss_extended_read_parameter_verbosity_verbose_e, - fss_extended_read_parameter_verbosity_debug_e, - fss_extended_read_parameter_version_e, - - fss_extended_read_parameter_at_e, - fss_extended_read_parameter_content_e, - fss_extended_read_parameter_columns_e, - fss_extended_read_parameter_delimit_e, - fss_extended_read_parameter_depth_e, - fss_extended_read_parameter_empty_e, - fss_extended_read_parameter_line_e, - fss_extended_read_parameter_name_e, - fss_extended_read_parameter_object_e, - fss_extended_read_parameter_pipe_e, - fss_extended_read_parameter_raw_e, - fss_extended_read_parameter_select_e, - fss_extended_read_parameter_total_e, - fss_extended_read_parameter_trim_e, - }; - - #define fss_extended_read_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #define fss_extended_read_total_parameters_d 23 -#endif // _di_fss_extended_read_defines_ - -/** - * FSS Delimit Parameter data. - * - * fss_extended_read_delimit_mode_*: - * - all: All delimits are to be aplied. - * - content: Content are to have delimits applied. - * - content_greater: Content at this number or higher are to have delimits applied. - * - content_greater_object: Objects and Content at this number or higher are to have delimits applied. - * - content_lesser: Content at this number or lower are to have delimits applied. - * - content_lesser_object: Objects and Content at this number or lower are to have delimits applied. - * - content_object: Objects and Content are to have delimits applied - * - object: Objects arre to have delimits applied. - */ -#ifndef _di_fss_extended_read_delimit_mode_ - #define fss_extended_read_delimit_mode_name_none "none" - #define fss_extended_read_delimit_mode_name_all "all" - #define fss_extended_read_delimit_mode_name_object "object" - #define fss_extended_read_delimit_mode_name_greater "+" - #define fss_extended_read_delimit_mode_name_lesser "-" - - #define fss_extended_read_delimit_mode_name_none_length 4 - #define fss_extended_read_delimit_mode_name_all_length 3 - #define fss_extended_read_delimit_mode_name_object_length 6 - #define fss_extended_read_delimit_mode_name_greater_length 1 - #define fss_extended_read_delimit_mode_name_lesser_length 1 - - enum { - fss_extended_read_delimit_mode_none_e = 1, - fss_extended_read_delimit_mode_all_e, - fss_extended_read_delimit_mode_content_e, - fss_extended_read_delimit_mode_content_greater_e, - fss_extended_read_delimit_mode_content_greater_object_e, - fss_extended_read_delimit_mode_content_lesser_e, - fss_extended_read_delimit_mode_content_lesser_object_e, - fss_extended_read_delimit_mode_content_object_e, - fss_extended_read_delimit_mode_object_e, - }; -#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_ - /** * Print help. * @@ -296,25 +99,6 @@ extern "C" { extern f_status_t fss_extended_read_main(fss_extended_read_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_extended_read_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_extended_read_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_extended_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_extended_read/data/build/settings b/level_3/fss_extended_read/data/build/settings index f82ea34..88b2ec0 100644 --- a/level_3/fss_extended_read/data/build/settings +++ b/level_3/fss_extended_read/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_extended_read.c private-common.c private-print.c private-read.c +build_sources_library fss_extended_read.c common.c private-common.c private-print.c private-read.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_extended_read.h +build_sources_headers fss_extended_read.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_extended_write/c/common.c b/level_3/fss_extended_write/c/common.c new file mode 100644 index 0000000..1150784 --- /dev/null +++ b/level_3/fss_extended_write/c/common.c @@ -0,0 +1,31 @@ +#include "fss_extended_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_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); + + f_type_array_lengths_resize(0, &main->remaining); + + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_fss_extended_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_extended_write/c/common.h b/level_3/fss_extended_write/c/common.h new file mode 100644 index 0000000..1d5480c --- /dev/null +++ b/level_3/fss_extended_write/c/common.h @@ -0,0 +1,185 @@ +/** + * FLL - Level 3 + * + * Project: FSS Extended Write + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_extended_write_common_h +#define _fss_extended_write_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_extended_write_program_version_ + #define FSS_EXTENDED_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_EXTENDED_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_EXTENDED_WRITE_program_version_micro_s F_string_ascii_8_s + + #define FSS_EXTENDED_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_EXTENDED_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_EXTENDED_WRITE_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length)) + #define FSS_EXTENDED_WRITE_program_version_nano_prefix_s + #define FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_EXTENDED_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_s_length)) + #define FSS_EXTENDED_WRITE_program_version_nano_s + #define FSS_EXTENDED_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_EXTENDED_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_s_length)) + + #define FSS_EXTENDED_WRITE_program_version_s FSS_EXTENDED_WRITE_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_WRITE_program_version_micro_s FSS_EXTENDED_WRITE_program_version_nano_prefix_s FSS_EXTENDED_WRITE_program_version_nano_s + + #define FSS_EXTENDED_WRITE_program_version_s_length FSS_EXTENDED_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_WRITE_program_version_micro_s_length + FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length + FSS_EXTENDED_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_extended_write_program_version_s; +#endif // _di_fss_extended_write_program_version_ + +#ifndef _di_fss_extended_write_program_name_ + #define FSS_EXTENDED_WRITE_program_name_s "fss_extended_write" + #define FSS_EXTENDED_WRITE_program_name_long_s "FSS Extended Write" + + #define FSS_EXTENDED_WRITE_program_name_s_length 18 + #define FSS_EXTENDED_WRITE_program_name_long_s_length 18 + + extern const f_string_static_t fss_extended_write_program_name_s; + extern const f_string_static_t fss_extended_write_program_name_long_s; +#endif // _di_fss_extended_write_program_name_ + +#ifndef _di_fss_extended_write_defines_ + #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" + + enum { + fss_extended_write_parameter_help_e, + fss_extended_write_parameter_light_e, + fss_extended_write_parameter_dark_e, + fss_extended_write_parameter_no_color_e, + fss_extended_write_parameter_verbosity_quiet_e, + fss_extended_write_parameter_verbosity_normal_e, + fss_extended_write_parameter_verbosity_verbose_e, + fss_extended_write_parameter_verbosity_debug_e, + fss_extended_write_parameter_version_e, + + fss_extended_write_parameter_file_e, + fss_extended_write_parameter_content_e, + fss_extended_write_parameter_double_e, + fss_extended_write_parameter_ignore_e, + fss_extended_write_parameter_object_e, + fss_extended_write_parameter_partial_e, + fss_extended_write_parameter_prepend_e, + fss_extended_write_parameter_single_e, + fss_extended_write_parameter_trim_e, + }; + + #define fss_extended_write_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 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), \ + } + + #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_ + +/** + * Deallocate main. + * + * Be sure to call this after executing fss_extended_write_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_extended_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_extended_write_common_h 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 9ddb4be..d898e2e 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -642,19 +642,6 @@ extern "C" { } #endif // _di_fss_extended_write_main_ -#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); - - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_fss_extended_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 e15e9da..d60aea7 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.h +++ b/level_3/fss_extended_write/c/fss_extended_write.h @@ -40,153 +40,13 @@ #include #include +// FSS Extended Write includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_extended_write_program_version_ - #define FSS_EXTENDED_WRITE_program_version_major_s F_string_ascii_0_s - #define FSS_EXTENDED_WRITE_program_version_minor_s F_string_ascii_5_s - #define FSS_EXTENDED_WRITE_program_version_micro_s F_string_ascii_8_s - - #define FSS_EXTENDED_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_EXTENDED_WRITE_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_EXTENDED_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length)) - #define FSS_EXTENDED_WRITE_program_version_nano_prefix_s - #define FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_EXTENDED_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_s_length)) - #define FSS_EXTENDED_WRITE_program_version_nano_s - #define FSS_EXTENDED_WRITE_program_version_nano_s_length 0 - #endif // !(defined(FSS_EXTENDED_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_s_length)) - - #define FSS_EXTENDED_WRITE_program_version_s FSS_EXTENDED_WRITE_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_WRITE_program_version_micro_s FSS_EXTENDED_WRITE_program_version_nano_prefix_s FSS_EXTENDED_WRITE_program_version_nano_s - - #define FSS_EXTENDED_WRITE_program_version_s_length FSS_EXTENDED_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_WRITE_program_version_micro_s_length + FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length + FSS_EXTENDED_WRITE_program_version_nano_s_length - - extern const f_string_static_t fss_extended_write_program_version_s; -#endif // _di_fss_extended_write_program_version_ - -#ifndef _di_fss_extended_write_program_name_ - #define FSS_EXTENDED_WRITE_program_name_s "fss_extended_write" - #define FSS_EXTENDED_WRITE_program_name_long_s "FSS Extended Write" - - #define FSS_EXTENDED_WRITE_program_name_s_length 18 - #define FSS_EXTENDED_WRITE_program_name_long_s_length 18 - - extern const f_string_static_t fss_extended_write_program_name_s; - extern const f_string_static_t fss_extended_write_program_name_long_s; -#endif // _di_fss_extended_write_program_name_ - -#ifndef _di_fss_extended_write_defines_ - #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" - - enum { - fss_extended_write_parameter_help_e, - fss_extended_write_parameter_light_e, - fss_extended_write_parameter_dark_e, - fss_extended_write_parameter_no_color_e, - fss_extended_write_parameter_verbosity_quiet_e, - fss_extended_write_parameter_verbosity_normal_e, - fss_extended_write_parameter_verbosity_verbose_e, - fss_extended_write_parameter_verbosity_debug_e, - fss_extended_write_parameter_version_e, - - fss_extended_write_parameter_file_e, - fss_extended_write_parameter_content_e, - fss_extended_write_parameter_double_e, - fss_extended_write_parameter_ignore_e, - fss_extended_write_parameter_object_e, - fss_extended_write_parameter_partial_e, - fss_extended_write_parameter_prepend_e, - fss_extended_write_parameter_single_e, - fss_extended_write_parameter_trim_e, - }; - - #define fss_extended_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 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), \ - } - - #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_ - /** * Print help. * @@ -231,25 +91,6 @@ extern "C" { extern f_status_t fss_extended_write_main(fss_extended_write_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_extended_write_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_extended_write_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_extended_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_extended_write/data/build/settings b/level_3/fss_extended_write/data/build/settings index d512262..80c4c3e 100644 --- a/level_3/fss_extended_write/data/build/settings +++ b/level_3/fss_extended_write/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_extended_write.c private-common.c private-write.c +build_sources_library fss_extended_write.c common.c private-common.c private-write.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_extended_write.h +build_sources_headers fss_extended_write.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_identify/c/common.c b/level_3/fss_identify/c/common.c new file mode 100644 index 0000000..c55c2cb --- /dev/null +++ b/level_3/fss_identify/c/common.c @@ -0,0 +1,31 @@ +#include "fss_identify.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_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); + + f_type_array_lengths_resize(0, &main->remaining); + + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_fss_identify_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_identify/c/common.h b/level_3/fss_identify/c/common.h new file mode 100644 index 0000000..6e2786e --- /dev/null +++ b/level_3/fss_identify/c/common.h @@ -0,0 +1,162 @@ +/** + * FLL - Level 3 + * + * Project: FSS Identify + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_identify_common_h +#define _fss_identify_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_identify_program_version_ + #define FSS_IDENTIFY_program_version_major_s F_string_ascii_0_s + #define FSS_IDENTIFY_program_version_minor_s F_string_ascii_5_s + #define FSS_IDENTIFY_program_version_micro_s F_string_ascii_8_s + + #define FSS_IDENTIFY_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_IDENTIFY_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_IDENTIFY_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_IDENTIFY_program_version_nano_prefix_s) && defined(FSS_IDENTIFY_program_version_nano_prefix_s_length)) + #define FSS_IDENTIFY_program_version_nano_prefix_s + #define FSS_IDENTIFY_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_IDENTIFY_program_version_nano_prefix_s) && defined(FSS_IDENTIFY_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_IDENTIFY_program_version_nano_s) && defined(FSS_IDENTIFY_program_version_nano_s_length)) + #define FSS_IDENTIFY_program_version_nano_s + #define FSS_IDENTIFY_program_version_nano_s_length 0 + #endif // !(defined(FSS_IDENTIFY_program_version_nano_s) && defined(FSS_IDENTIFY_program_version_nano_s_length)) + + #define FSS_IDENTIFY_program_version_s FSS_IDENTIFY_program_version_major_s F_string_ascii_period_s FSS_IDENTIFY_program_version_minor_s F_string_ascii_period_s FSS_IDENTIFY_program_version_micro_s FSS_IDENTIFY_program_version_nano_prefix_s FSS_IDENTIFY_program_version_nano_s + + #define FSS_IDENTIFY_program_version_s_length FSS_IDENTIFY_program_version_major_s_length + F_string_ascii_period_s_length + FSS_IDENTIFY_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_IDENTIFY_program_version_micro_s_length + FSS_IDENTIFY_program_version_nano_prefix_s_length + FSS_IDENTIFY_program_version_nano_s_length + + const f_string_static_t fss_identify_program_version_s; +#endif // _di_fss_identify_program_version_ + +#ifndef _di_fss_identify_program_name_ + #define FSS_IDENTIFY_program_name_s "fss_identify" + #define FSS_IDENTIFY_program_name_long_s "FSS Identify" + + #define FSS_IDENTIFY_program_name_s_length 12 + #define FSS_IDENTIFY_program_name_long_s_length 12 + + const f_string_static_t fss_identify_program_name_s; + const f_string_static_t fss_identify_program_name_long_s; +#endif // _di_fss_identify_program_name_ + +#ifndef _di_fss_identify_defines_ + #define fss_identify_signal_check_d 10000 + + #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" + + enum { + fss_identify_parameter_help_e, + fss_identify_parameter_light_e, + fss_identify_parameter_dark_e, + fss_identify_parameter_no_color_e, + fss_identify_parameter_verbosity_quiet_e, + fss_identify_parameter_verbosity_normal_e, + fss_identify_parameter_verbosity_verbose_e, + fss_identify_parameter_verbosity_debug_e, + fss_identify_parameter_version_e, + + fss_identify_parameter_content_e, + fss_identify_parameter_line_e, + fss_identify_parameter_name_e, + fss_identify_parameter_object_e, + fss_identify_parameter_total_e, + }; + + #define fss_identify_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #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_ + +/** + * Deallocate main. + * + * Be sure to call this after executing fss_identify_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @see fss_identify_main() + */ +#ifndef _di_fss_identify_main_delete_ + extern f_status_t fss_identify_main_delete(fss_identify_main_t * const main); +#endif // _di_fss_identify_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_identify_common_h diff --git a/level_3/fss_identify/c/fss_identify.c b/level_3/fss_identify/c/fss_identify.c index a2a078f..0ea7f0b 100644 --- a/level_3/fss_identify/c/fss_identify.c +++ b/level_3/fss_identify/c/fss_identify.c @@ -376,19 +376,6 @@ extern "C" { } #endif // _di_fss_identify_main_ -#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); - - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_fss_identify_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_identify/c/fss_identify.h b/level_3/fss_identify/c/fss_identify.h index 78b231c..b1b8d45 100644 --- a/level_3/fss_identify/c/fss_identify.h +++ b/level_3/fss_identify/c/fss_identify.h @@ -46,130 +46,13 @@ #include #include +// FSS Identify includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_identify_program_version_ - #define FSS_IDENTIFY_program_version_major_s F_string_ascii_0_s - #define FSS_IDENTIFY_program_version_minor_s F_string_ascii_5_s - #define FSS_IDENTIFY_program_version_micro_s F_string_ascii_8_s - - #define FSS_IDENTIFY_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_IDENTIFY_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_IDENTIFY_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_IDENTIFY_program_version_nano_prefix_s) && defined(FSS_IDENTIFY_program_version_nano_prefix_s_length)) - #define FSS_IDENTIFY_program_version_nano_prefix_s - #define FSS_IDENTIFY_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_IDENTIFY_program_version_nano_prefix_s) && defined(FSS_IDENTIFY_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_IDENTIFY_program_version_nano_s) && defined(FSS_IDENTIFY_program_version_nano_s_length)) - #define FSS_IDENTIFY_program_version_nano_s - #define FSS_IDENTIFY_program_version_nano_s_length 0 - #endif // !(defined(FSS_IDENTIFY_program_version_nano_s) && defined(FSS_IDENTIFY_program_version_nano_s_length)) - - #define FSS_IDENTIFY_program_version_s FSS_IDENTIFY_program_version_major_s F_string_ascii_period_s FSS_IDENTIFY_program_version_minor_s F_string_ascii_period_s FSS_IDENTIFY_program_version_micro_s FSS_IDENTIFY_program_version_nano_prefix_s FSS_IDENTIFY_program_version_nano_s - - #define FSS_IDENTIFY_program_version_s_length FSS_IDENTIFY_program_version_major_s_length + F_string_ascii_period_s_length + FSS_IDENTIFY_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_IDENTIFY_program_version_micro_s_length + FSS_IDENTIFY_program_version_nano_prefix_s_length + FSS_IDENTIFY_program_version_nano_s_length - - const f_string_static_t fss_identify_program_version_s; -#endif // _di_fss_identify_program_version_ - -#ifndef _di_fss_identify_program_name_ - #define FSS_IDENTIFY_program_name_s "fss_identify" - #define FSS_IDENTIFY_program_name_long_s "FSS Identify" - - #define FSS_IDENTIFY_program_name_s_length 12 - #define FSS_IDENTIFY_program_name_long_s_length 12 - - const f_string_static_t fss_identify_program_name_s; - const f_string_static_t fss_identify_program_name_long_s; -#endif // _di_fss_identify_program_name_ - -#ifndef _di_fss_identify_defines_ - #define fss_identify_signal_check_d 10000 - - #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" - - enum { - fss_identify_parameter_help_e, - fss_identify_parameter_light_e, - fss_identify_parameter_dark_e, - fss_identify_parameter_no_color_e, - fss_identify_parameter_verbosity_quiet_e, - fss_identify_parameter_verbosity_normal_e, - fss_identify_parameter_verbosity_verbose_e, - fss_identify_parameter_verbosity_debug_e, - fss_identify_parameter_version_e, - - fss_identify_parameter_content_e, - fss_identify_parameter_line_e, - fss_identify_parameter_name_e, - fss_identify_parameter_object_e, - fss_identify_parameter_total_e, - }; - - #define fss_identify_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #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_ - /** * Print help. * @@ -214,25 +97,6 @@ extern "C" { extern f_status_t fss_identify_main(fss_identify_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_identify_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_identify_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see fss_identify_main() - */ -#ifndef _di_fss_identify_main_delete_ - extern f_status_t fss_identify_main_delete(fss_identify_main_t * const main); -#endif // _di_fss_identify_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_identify/data/build/settings b/level_3/fss_identify/data/build/settings index 9dd12fa..59fcf5a 100644 --- a/level_3/fss_identify/data/build/settings +++ b/level_3/fss_identify/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_identify.c private-common.c private-identify.c private-print.c +build_sources_library fss_identify.c common.c private-common.c private-identify.c private-print.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_identify.h +build_sources_headers fss_identify.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_payload_read/c/common.c b/level_3/fss_payload_read/c/common.c new file mode 100644 index 0000000..c2ec9b3 --- /dev/null +++ b/level_3/fss_payload_read/c/common.c @@ -0,0 +1,30 @@ +#include "fss_payload_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_program_name_ + +#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); + + return F_none; + } +#endif // _di_fss_payload_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_payload_read/c/common.h b/level_3/fss_payload_read/c/common.h new file mode 100644 index 0000000..375e5f9 --- /dev/null +++ b/level_3/fss_payload_read/c/common.h @@ -0,0 +1,241 @@ +/** + * FLL - Level 3 + * + * Project: FSS Payload Read + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_payload_read_common_h +#define _fss_payload_read_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#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 + #define FSS_PAYLOAD_READ_program_version_micro_s F_string_ascii_8_s + + #define FSS_PAYLOAD_READ_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_PAYLOAD_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_PAYLOAD_READ_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s_length)) + #define FSS_PAYLOAD_READ_program_version_nano_prefix_s + #define FSS_PAYLOAD_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_PAYLOAD_READ_program_version_nano_s) && defined(FSS_PAYLOAD_READ_program_version_nano_s_length)) + #define FSS_PAYLOAD_READ_program_version_nano_s + #define FSS_PAYLOAD_READ_program_version_nano_s_length 0 + #endif // !(defined(FSS_PAYLOAD_READ_program_version_nano_s) && defined(FSS_PAYLOAD_READ_program_version_nano_s_length)) + + #define FSS_PAYLOAD_READ_program_version_s FSS_PAYLOAD_READ_program_version_major_s F_string_ascii_period_s FSS_PAYLOAD_READ_program_version_minor_s F_string_ascii_period_s FSS_PAYLOAD_READ_program_version_micro_s FSS_PAYLOAD_READ_program_version_nano_prefix_s FSS_PAYLOAD_READ_program_version_nano_s + + #define FSS_PAYLOAD_READ_program_version_s_length FSS_PAYLOAD_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_READ_program_version_micro_s_length + FSS_PAYLOAD_READ_program_version_nano_prefix_s_length + FSS_PAYLOAD_READ_program_version_nano_s_length + + extern const f_string_static_t fss_payload_read_program_version_s; +#endif // _di_fss_payload_read_program_version_ + +#ifndef _di_fss_payload_read_program_name_ + #define FSS_PAYLOAD_READ_program_name_s "fss_payload_read" + #define FSS_PAYLOAD_READ_program_name_long_s "FSS Payload Read" + + #define FSS_PAYLOAD_READ_program_name_s_length 16 + #define FSS_PAYLOAD_READ_program_name_long_s_length 16 + + extern const f_string_static_t fss_payload_read_program_name_s; + extern const f_string_static_t fss_payload_read_program_name_long_s; +#endif // _di_fss_payload_read_program_name_ + +#ifndef _di_fss_payload_read_defines_ + #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" + + enum { + fss_payload_read_parameter_help_e, + fss_payload_read_parameter_light_e, + fss_payload_read_parameter_dark_e, + fss_payload_read_parameter_no_color_e, + fss_payload_read_parameter_verbosity_quiet_e, + fss_payload_read_parameter_verbosity_normal_e, + fss_payload_read_parameter_verbosity_verbose_e, + fss_payload_read_parameter_verbosity_debug_e, + fss_payload_read_parameter_version_e, + + fss_payload_read_parameter_at_e, + fss_payload_read_parameter_content_e, + fss_payload_read_parameter_columns_e, + fss_payload_read_parameter_delimit_e, + fss_payload_read_parameter_depth_e, + fss_payload_read_parameter_empty_e, + fss_payload_read_parameter_line_e, + fss_payload_read_parameter_name_e, + fss_payload_read_parameter_object_e, + fss_payload_read_parameter_pipe_e, + fss_payload_read_parameter_raw_e, + fss_payload_read_parameter_select_e, + fss_payload_read_parameter_total_e, + fss_payload_read_parameter_trim_e, + }; + + #define fss_payload_read_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #define fss_payload_total_parameters_d 23 +#endif // _di_fss_payload_read_defines_ + +/** + * FSS Delimit Parameter data. + * + * fss_payload_read_delimit_mode_*: + * - all: All delimits are to be aplied. + * - content: Content are to have delimits applied. + * - content_greater: Content at this number or higher are to have delimits applied. + * - content_greater_object: Objects and Content at this number or higher are to have delimits applied. + * - content_lesser: Content at this number or lower are to have delimits applied. + * - content_lesser_object: Objects and Content at this number or lower are to have delimits applied. + * - content_object: Objects and Content are to have delimits applied + * - object: Objects arre to have delimits applied. + */ +#ifndef _di_fss_payload_read_delimit_mode_ + #define fss_payload_read_delimit_mode_name_none_s "none" + #define fss_payload_read_delimit_mode_name_all_s "all" + #define fss_payload_read_delimit_mode_name_object_s "object" + #define fss_payload_read_delimit_mode_name_greater_s "+" + #define fss_payload_read_delimit_mode_name_lesser_s "-" + + #define fss_payload_read_delimit_mode_name_none_s_length 4 + #define fss_payload_read_delimit_mode_name_all_s_length 3 + #define fss_payload_read_delimit_mode_name_object_s_length 6 + #define fss_payload_read_delimit_mode_name_greater_s_length 1 + #define fss_payload_read_delimit_mode_name_lesser_s_length 1 + + enum { + fss_payload_read_delimit_mode_none_e = 1, + fss_payload_read_delimit_mode_all_e, + fss_payload_read_delimit_mode_content_e, + fss_payload_read_delimit_mode_content_greater_e, + fss_payload_read_delimit_mode_content_greater_object_e, + fss_payload_read_delimit_mode_content_lesser_e, + fss_payload_read_delimit_mode_content_lesser_object_e, + fss_payload_read_delimit_mode_content_object_e, + fss_payload_read_delimit_mode_object_e, + }; +#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. + * + * Be sure to call this after executing fss_payload_read_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_payload_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_payload_read_common_h 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 eec2d70..979c877 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.c +++ b/level_3/fss_payload_read/c/fss_payload_read.c @@ -691,18 +691,6 @@ extern "C" { } #endif // _di_fss_payload_read_main_ -#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); - - return F_none; - } -#endif // _di_fss_payload_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 9fc157b..8dc2e92 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.h +++ b/level_3/fss_payload_read/c/fss_payload_read.h @@ -49,209 +49,13 @@ #include #include +// FSS Payload Read includes. +#include + #ifdef __cplusplus extern "C" { #endif -#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 - #define FSS_PAYLOAD_READ_program_version_micro_s F_string_ascii_8_s - - #define FSS_PAYLOAD_READ_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_PAYLOAD_READ_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_PAYLOAD_READ_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s_length)) - #define FSS_PAYLOAD_READ_program_version_nano_prefix_s - #define FSS_PAYLOAD_READ_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_READ_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_PAYLOAD_READ_program_version_nano_s) && defined(FSS_PAYLOAD_READ_program_version_nano_s_length)) - #define FSS_PAYLOAD_READ_program_version_nano_s - #define FSS_PAYLOAD_READ_program_version_nano_s_length 0 - #endif // !(defined(FSS_PAYLOAD_READ_program_version_nano_s) && defined(FSS_PAYLOAD_READ_program_version_nano_s_length)) - - #define FSS_PAYLOAD_READ_program_version_s FSS_PAYLOAD_READ_program_version_major_s F_string_ascii_period_s FSS_PAYLOAD_READ_program_version_minor_s F_string_ascii_period_s FSS_PAYLOAD_READ_program_version_micro_s FSS_PAYLOAD_READ_program_version_nano_prefix_s FSS_PAYLOAD_READ_program_version_nano_s - - #define FSS_PAYLOAD_READ_program_version_s_length FSS_PAYLOAD_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_READ_program_version_micro_s_length + FSS_PAYLOAD_READ_program_version_nano_prefix_s_length + FSS_PAYLOAD_READ_program_version_nano_s_length - - extern const f_string_static_t fss_payload_read_program_version_s; -#endif // _di_fss_payload_read_program_version_ - -#ifndef _di_fss_payload_read_program_name_ - #define FSS_PAYLOAD_READ_program_name_s "fss_payload_read" - #define FSS_PAYLOAD_READ_program_name_long_s "FSS Payload Read" - - #define FSS_PAYLOAD_READ_program_name_s_length 16 - #define FSS_PAYLOAD_READ_program_name_long_s_length 16 - - extern const f_string_static_t fss_payload_read_program_name_s; - extern const f_string_static_t fss_payload_read_program_name_long_s; -#endif // _di_fss_payload_read_program_name_ - -#ifndef _di_fss_payload_read_defines_ - #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" - - enum { - fss_payload_read_parameter_help_e, - fss_payload_read_parameter_light_e, - fss_payload_read_parameter_dark_e, - fss_payload_read_parameter_no_color_e, - fss_payload_read_parameter_verbosity_quiet_e, - fss_payload_read_parameter_verbosity_normal_e, - fss_payload_read_parameter_verbosity_verbose_e, - fss_payload_read_parameter_verbosity_debug_e, - fss_payload_read_parameter_version_e, - - fss_payload_read_parameter_at_e, - fss_payload_read_parameter_content_e, - fss_payload_read_parameter_columns_e, - fss_payload_read_parameter_delimit_e, - fss_payload_read_parameter_depth_e, - fss_payload_read_parameter_empty_e, - fss_payload_read_parameter_line_e, - fss_payload_read_parameter_name_e, - fss_payload_read_parameter_object_e, - fss_payload_read_parameter_pipe_e, - fss_payload_read_parameter_raw_e, - fss_payload_read_parameter_select_e, - fss_payload_read_parameter_total_e, - fss_payload_read_parameter_trim_e, - }; - - #define fss_payload_read_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #define fss_payload_total_parameters_d 23 -#endif // _di_fss_payload_read_defines_ - -/** - * FSS Delimit Parameter data. - * - * fss_payload_read_delimit_mode_*: - * - all: All delimits are to be aplied. - * - content: Content are to have delimits applied. - * - content_greater: Content at this number or higher are to have delimits applied. - * - content_greater_object: Objects and Content at this number or higher are to have delimits applied. - * - content_lesser: Content at this number or lower are to have delimits applied. - * - content_lesser_object: Objects and Content at this number or lower are to have delimits applied. - * - content_object: Objects and Content are to have delimits applied - * - object: Objects arre to have delimits applied. - */ -#ifndef _di_fss_payload_read_delimit_mode_ - #define fss_payload_read_delimit_mode_name_none_s "none" - #define fss_payload_read_delimit_mode_name_all_s "all" - #define fss_payload_read_delimit_mode_name_object_s "object" - #define fss_payload_read_delimit_mode_name_greater_s "+" - #define fss_payload_read_delimit_mode_name_lesser_s "-" - - #define fss_payload_read_delimit_mode_name_none_s_length 4 - #define fss_payload_read_delimit_mode_name_all_s_length 3 - #define fss_payload_read_delimit_mode_name_object_s_length 6 - #define fss_payload_read_delimit_mode_name_greater_s_length 1 - #define fss_payload_read_delimit_mode_name_lesser_s_length 1 - - enum { - fss_payload_read_delimit_mode_none_e = 1, - fss_payload_read_delimit_mode_all_e, - fss_payload_read_delimit_mode_content_e, - fss_payload_read_delimit_mode_content_greater_e, - fss_payload_read_delimit_mode_content_greater_object_e, - fss_payload_read_delimit_mode_content_lesser_e, - fss_payload_read_delimit_mode_content_lesser_object_e, - fss_payload_read_delimit_mode_content_object_e, - fss_payload_read_delimit_mode_object_e, - }; -#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_ - /** * Print help. * @@ -296,25 +100,6 @@ extern "C" { extern f_status_t fss_payload_read_main(fss_payload_read_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_payload_read_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_payload_read_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_payload_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_payload_read/data/build/settings b/level_3/fss_payload_read/data/build/settings index 32430dc..2745d42 100644 --- a/level_3/fss_payload_read/data/build/settings +++ b/level_3/fss_payload_read/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_payload_read.c private-common.c private-print.c private-read.c +build_sources_library fss_payload_read.c common.c private-common.c private-print.c private-read.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_payload_read.h +build_sources_headers fss_payload_read.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_payload_write/c/common.c b/level_3/fss_payload_write/c/common.c new file mode 100644 index 0000000..580f1d8 --- /dev/null +++ b/level_3/fss_payload_write/c/common.c @@ -0,0 +1,31 @@ +#include "fss_payload_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_program_name_ + +#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); + + return F_none; + } +#endif // _di_fss_payload_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_payload_write/c/common.h b/level_3/fss_payload_write/c/common.h new file mode 100644 index 0000000..d6f079d --- /dev/null +++ b/level_3/fss_payload_write/c/common.h @@ -0,0 +1,185 @@ +/** + * FLL - Level 3 + * + * Project: FSS Payload Write + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_payload_write_common_h +#define _fss_payload_write_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_payload_write_program_version_ + #define FSS_PAYLOAD_WRITE_program_version_major_s F_string_ascii_0_s + #define FSS_PAYLOAD_WRITE_program_version_minor_s F_string_ascii_5_s + #define FSS_PAYLOAD_WRITE_program_version_micro_s F_string_ascii_8_s + + #define FSS_PAYLOAD_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_PAYLOAD_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_PAYLOAD_WRITE_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length)) + #define FSS_PAYLOAD_WRITE_program_version_nano_prefix_s + #define FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_PAYLOAD_WRITE_program_version_nano_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_s_length)) + #define FSS_PAYLOAD_WRITE_program_version_nano_s + #define FSS_PAYLOAD_WRITE_program_version_nano_s_length 0 + #endif // !(defined(FSS_PAYLOAD_WRITE_program_version_nano_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_s_length)) + + #define FSS_PAYLOAD_WRITE_program_version_s FSS_PAYLOAD_WRITE_program_version_major_s F_string_ascii_period_s FSS_PAYLOAD_WRITE_program_version_minor_s F_string_ascii_period_s FSS_PAYLOAD_WRITE_program_version_micro_s FSS_PAYLOAD_WRITE_program_version_nano_prefix_s FSS_PAYLOAD_WRITE_program_version_nano_s + + #define FSS_PAYLOAD_WRITE_program_version_s_length FSS_PAYLOAD_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_WRITE_program_version_micro_s_length + FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length + FSS_PAYLOAD_WRITE_program_version_nano_s_length + + extern const f_string_static_t fss_payload_write_program_version_s; +#endif // _di_fss_payload_write_program_version_ + +#ifndef _di_fss_payload_write_program_name_ + #define FSS_PAYLOAD_WRITE_program_name_s "fss_payload_write" + #define FSS_PAYLOAD_WRITE_program_name_long_s "FSS Payload Write" + + #define FSS_PAYLOAD_WRITE_program_name_s_length 17 + #define FSS_PAYLOAD_WRITE_program_name_long_s_length 17 + + extern const f_string_static_t fss_payload_write_program_name_s; + extern const f_string_static_t fss_payload_write_program_name_long_s; +#endif // _di_fss_payload_write_program_name_ + +#ifndef _di_fss_payload_write_defines_ + #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" + + enum { + fss_payload_write_parameter_help_e, + fss_payload_write_parameter_light_e, + fss_payload_write_parameter_dark_e, + fss_payload_write_parameter_no_color_e, + fss_payload_write_parameter_verbosity_quiet_e, + fss_payload_write_parameter_verbosity_normal_e, + fss_payload_write_parameter_verbosity_verbose_e, + fss_payload_write_parameter_verbosity_debug_e, + fss_payload_write_parameter_version_e, + + fss_payload_write_parameter_file_e, + fss_payload_write_parameter_content_e, + fss_payload_write_parameter_double_e, + fss_payload_write_parameter_ignore_e, + fss_payload_write_parameter_object_e, + fss_payload_write_parameter_partial_e, + fss_payload_write_parameter_prepend_e, + fss_payload_write_parameter_single_e, + fss_payload_write_parameter_trim_e, + }; + + #define fss_payload_write_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #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_ + +/** + * Deallocate main. + * + * Be sure to call this after executing fss_payload_write_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_payload_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_payload_write_common_h 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 ce78e78..0ccf724 100644 --- a/level_3/fss_payload_write/c/fss_payload_write.c +++ b/level_3/fss_payload_write/c/fss_payload_write.c @@ -554,19 +554,6 @@ extern "C" { } #endif // _di_fss_payload_write_main_ -#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); - - return F_none; - } -#endif // _di_fss_payload_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 74a723e..6c9e4ce 100644 --- a/level_3/fss_payload_write/c/fss_payload_write.h +++ b/level_3/fss_payload_write/c/fss_payload_write.h @@ -41,153 +41,13 @@ #include #include +// FSS Payload Write includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_payload_write_program_version_ - #define FSS_PAYLOAD_WRITE_program_version_major_s F_string_ascii_0_s - #define FSS_PAYLOAD_WRITE_program_version_minor_s F_string_ascii_5_s - #define FSS_PAYLOAD_WRITE_program_version_micro_s F_string_ascii_8_s - - #define FSS_PAYLOAD_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_PAYLOAD_WRITE_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_PAYLOAD_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length)) - #define FSS_PAYLOAD_WRITE_program_version_nano_prefix_s - #define FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_PAYLOAD_WRITE_program_version_nano_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_s_length)) - #define FSS_PAYLOAD_WRITE_program_version_nano_s - #define FSS_PAYLOAD_WRITE_program_version_nano_s_length 0 - #endif // !(defined(FSS_PAYLOAD_WRITE_program_version_nano_s) && defined(FSS_PAYLOAD_WRITE_program_version_nano_s_length)) - - #define FSS_PAYLOAD_WRITE_program_version_s FSS_PAYLOAD_WRITE_program_version_major_s F_string_ascii_period_s FSS_PAYLOAD_WRITE_program_version_minor_s F_string_ascii_period_s FSS_PAYLOAD_WRITE_program_version_micro_s FSS_PAYLOAD_WRITE_program_version_nano_prefix_s FSS_PAYLOAD_WRITE_program_version_nano_s - - #define FSS_PAYLOAD_WRITE_program_version_s_length FSS_PAYLOAD_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_PAYLOAD_WRITE_program_version_micro_s_length + FSS_PAYLOAD_WRITE_program_version_nano_prefix_s_length + FSS_PAYLOAD_WRITE_program_version_nano_s_length - - extern const f_string_static_t fss_payload_write_program_version_s; -#endif // _di_fss_payload_write_program_version_ - -#ifndef _di_fss_payload_write_program_name_ - #define FSS_PAYLOAD_WRITE_program_name_s "fss_payload_write" - #define FSS_PAYLOAD_WRITE_program_name_long_s "FSS Payload Write" - - #define FSS_PAYLOAD_WRITE_program_name_s_length 17 - #define FSS_PAYLOAD_WRITE_program_name_long_s_length 17 - - extern const f_string_static_t fss_payload_write_program_name_s; - extern const f_string_static_t fss_payload_write_program_name_long_s; -#endif // _di_fss_payload_write_program_name_ - -#ifndef _di_fss_payload_write_defines_ - #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" - - enum { - fss_payload_write_parameter_help_e, - fss_payload_write_parameter_light_e, - fss_payload_write_parameter_dark_e, - fss_payload_write_parameter_no_color_e, - fss_payload_write_parameter_verbosity_quiet_e, - fss_payload_write_parameter_verbosity_normal_e, - fss_payload_write_parameter_verbosity_verbose_e, - fss_payload_write_parameter_verbosity_debug_e, - fss_payload_write_parameter_version_e, - - fss_payload_write_parameter_file_e, - fss_payload_write_parameter_content_e, - fss_payload_write_parameter_double_e, - fss_payload_write_parameter_ignore_e, - fss_payload_write_parameter_object_e, - fss_payload_write_parameter_partial_e, - fss_payload_write_parameter_prepend_e, - fss_payload_write_parameter_single_e, - fss_payload_write_parameter_trim_e, - }; - - #define fss_payload_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #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_ - /** * Print help. * @@ -232,25 +92,6 @@ extern "C" { extern f_status_t fss_payload_write_main(fss_payload_write_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_payload_write_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_payload_write_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_payload_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_payload_write/data/build/settings b/level_3/fss_payload_write/data/build/settings index 3c8f149..71031c9 100644 --- a/level_3/fss_payload_write/data/build/settings +++ b/level_3/fss_payload_write/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_payload_write.c private-common.c private-write.c +build_sources_library fss_payload_write.c common.c private-common.c private-write.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_payload_write.h +build_sources_headers fss_payload_write.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/fss_status_code/c/common.c b/level_3/fss_status_code/c/common.c new file mode 100644 index 0000000..63ed5a1 --- /dev/null +++ b/level_3/fss_status_code/c/common.c @@ -0,0 +1,31 @@ +#include "fss_status_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_program_name_ + +#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); + + return F_none; + } +#endif // _di_fss_status_code_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fss_status_code/c/common.h b/level_3/fss_status_code/c/common.h new file mode 100644 index 0000000..ef9e3b2 --- /dev/null +++ b/level_3/fss_status_code/c/common.h @@ -0,0 +1,156 @@ +/** + * FLL - Level 3 + * + * Project: FSS Status code + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fss_status_code_common_h +#define _fss_status_code_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fss_status_code_program_version_ + #define FSS_STATUS_code_program_version_major_s F_string_ascii_0_s + #define FSS_STATUS_code_program_version_minor_s F_string_ascii_5_s + #define FSS_STATUS_code_program_version_micro_s F_string_ascii_8_s + + #define FSS_STATUS_code_program_version_major_s_length F_string_ascii_0_s_length + #define FSS_STATUS_code_program_version_minor_s_length F_string_ascii_5_s_length + #define FSS_STATUS_code_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(FSS_STATUS_program_version_nano_prefix_s) && defined(FSS_STATUS_program_version_nano_prefix_s_length)) + #define FSS_STATUS_program_version_nano_prefix_s + #define FSS_STATUS_program_version_nano_prefix_s_length 0 + #endif // !(defined(FSS_STATUS_program_version_nano_prefix_s) && defined(FSS_STATUS_program_version_nano_prefix_s_length)) + + #if !(defined(FSS_STATUS_program_version_nano_s) && defined(FSS_STATUS_program_version_nano_s_length)) + #define FSS_STATUS_program_version_nano_s + #define FSS_STATUS_program_version_nano_s_length 0 + #endif // !(defined(FSS_STATUS_program_version_nano_s) && defined(FSS_STATUS_program_version_nano_s_length)) + + #define FSS_STATUS_code_program_version_length_s FSS_STATUS_code_program_version_major_s F_string_ascii_period_s FSS_STATUS_code_program_version_minor_s F_string_ascii_period_s FSS_STATUS_code_program_version_micro_s FSS_STATUS_code_program_version_nano_prefix_s FSS_STATUS_code_program_version_nano_s + + extern const f_string_static_t fss_status_code_program_version_s; +#endif // _di_fss_status_code_program_version_ + +#ifndef _di_fss_status_code_program_name_ + #define FSS_STATUS_code_program_name_s "FSS_STATUS_code" + #define FSS_STATUS_code_program_name_long_s "FSS Status Code" + + #define FSS_STATUS_CODE_program_name_s_length + #define FSS_STATUS_CODE_program_name_long_s_length + + const f_string_static_t fss_status_code_program_name_s; + const f_string_static_t fss_status_code_program_name_long_s; +#endif // _di_fss_status_code_program_name_ + +#ifndef _di_fss_status_code_defines_ + #define fss_status_code_signal_check_d 10000 + + #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" + + enum { + fss_status_code_parameter_help_e, + fss_status_code_parameter_light_e, + fss_status_code_parameter_dark_e, + fss_status_code_parameter_no_color_e, + fss_status_code_parameter_verbosity_quiet_e, + fss_status_code_parameter_verbosity_normal_e, + fss_status_code_parameter_verbosity_verbose_e, + fss_status_code_parameter_verbosity_debug_e, + fss_status_code_parameter_version_e, + + fss_status_code_parameter_is_fine_e, + fss_status_code_parameter_is_warning_e, + fss_status_code_parameter_is_error_e, + fss_status_code_parameter_number_e, + }; + + #define fss_status_code_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #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. + * + * Be sure to call this after executing fss_status_code_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @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); +#endif // _di_fss_status_code_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fss_status_code_common_h 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 e1384f4..730cd8d 100644 --- a/level_3/fss_status_code/c/fss_status_code.c +++ b/level_3/fss_status_code/c/fss_status_code.c @@ -303,19 +303,6 @@ extern "C" { } #endif // _di_fss_status_code_main_ -#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); - - return F_none; - } -#endif // _di_fss_status_code_main_delete_ - #ifdef __cplusplus } // extern "C" #endif 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 b1d3639..9b4ad8e 100644 --- a/level_3/fss_status_code/c/fss_status_code.h +++ b/level_3/fss_status_code/c/fss_status_code.h @@ -43,124 +43,13 @@ #include #include +// FSS Status Code includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fss_status_code_program_version_ - #define FSS_STATUS_code_program_version_major_s F_string_ascii_0_s - #define FSS_STATUS_code_program_version_minor_s F_string_ascii_5_s - #define FSS_STATUS_code_program_version_micro_s F_string_ascii_8_s - - #define FSS_STATUS_code_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_STATUS_code_program_version_minor_s_length F_string_ascii_5_s_length - #define FSS_STATUS_code_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(FSS_STATUS_program_version_nano_prefix_s) && defined(FSS_STATUS_program_version_nano_prefix_s_length)) - #define FSS_STATUS_program_version_nano_prefix_s - #define FSS_STATUS_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_STATUS_program_version_nano_prefix_s) && defined(FSS_STATUS_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_STATUS_program_version_nano_s) && defined(FSS_STATUS_program_version_nano_s_length)) - #define FSS_STATUS_program_version_nano_s - #define FSS_STATUS_program_version_nano_s_length 0 - #endif // !(defined(FSS_STATUS_program_version_nano_s) && defined(FSS_STATUS_program_version_nano_s_length)) - - #define FSS_STATUS_code_program_version_length_s FSS_STATUS_code_program_version_major_s F_string_ascii_period_s FSS_STATUS_code_program_version_minor_s F_string_ascii_period_s FSS_STATUS_code_program_version_micro_s FSS_STATUS_code_program_version_nano_prefix_s FSS_STATUS_code_program_version_nano_s - - extern const f_string_static_t fss_status_code_program_version_s; -#endif // _di_fss_status_code_program_version_ - -#ifndef _di_fss_status_code_program_name_ - #define FSS_STATUS_code_program_name_s "FSS_STATUS_code" - #define FSS_STATUS_code_program_name_long_s "FSS Status Code" - - #define FSS_STATUS_CODE_program_name_s_length - #define FSS_STATUS_CODE_program_name_long_s_length - - const f_string_static_t fss_status_code_program_name_s; - const f_string_static_t fss_status_code_program_name_long_s; -#endif // _di_fss_status_code_program_name_ - -#ifndef _di_fss_status_code_defines_ - #define fss_status_code_signal_check_d 10000 - - #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" - - enum { - fss_status_code_parameter_help_e, - fss_status_code_parameter_light_e, - fss_status_code_parameter_dark_e, - fss_status_code_parameter_no_color_e, - fss_status_code_parameter_verbosity_quiet_e, - fss_status_code_parameter_verbosity_normal_e, - fss_status_code_parameter_verbosity_verbose_e, - fss_status_code_parameter_verbosity_debug_e, - fss_status_code_parameter_version_e, - - fss_status_code_parameter_is_fine_e, - fss_status_code_parameter_is_warning_e, - fss_status_code_parameter_is_error_e, - fss_status_code_parameter_number_e, - }; - - #define fss_status_code_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #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_ - /** * Print help. * @@ -205,25 +94,6 @@ extern "C" { extern f_status_t fss_status_code_main(fss_status_code_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_fss_status_code_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing fss_status_code_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @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); -#endif // _di_fss_status_code_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_status_code/data/build/settings b/level_3/fss_status_code/data/build/settings index 1060e5c..03273ee 100644 --- a/level_3/fss_status_code/data/build/settings +++ b/level_3/fss_status_code/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library fss_status_code.c private-common.c private-fss_status_code.c +build_sources_library fss_status_code.c common.c private-common.c private-fss_status_code.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers fss_status_code.h +build_sources_headers fss_status_code.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/iki_read/c/common.c b/level_3/iki_read/c/common.c new file mode 100644 index 0000000..8fb3210 --- /dev/null +++ b/level_3/iki_read/c/common.c @@ -0,0 +1,32 @@ +#include "iki_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_program_name_ + +#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); + + return F_none; + } +#endif // _di_iki_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/iki_read/c/common.h b/level_3/iki_read/c/common.h new file mode 100644 index 0000000..a8a2c43 --- /dev/null +++ b/level_3/iki_read/c/common.h @@ -0,0 +1,241 @@ +/** + * FLL - Level 3 + * + * Project: IKI Read + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _iki_read_common_h +#define _iki_read_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_iki_read_program_version_ + #define IKI_READ_program_version_major_s F_string_ascii_0_s + #define IKI_READ_program_version_minor_s F_string_ascii_5_s + #define IKI_READ_program_version_micro_s F_string_ascii_8_s + + #define IKI_READ_program_version_major_s_length F_string_ascii_0_s_length + #define IKI_READ_program_version_minor_s_length F_string_ascii_5_s_length + #define IKI_READ_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(IKI_READ_program_version_nano_prefix_s) && defined(IKI_READ_program_version_nano_prefix_s_length)) + #define IKI_READ_program_version_nano_prefix_s + #define IKI_READ_program_version_nano_prefix_s_length 0 + #endif // !(defined(IKI_READ_program_version_nano_prefix_s) && defined(IKI_READ_program_version_nano_prefix_s_length)) + + #if !(defined(IKI_READ_program_version_nano_s) && defined(IKI_READ_program_version_nano_s_length)) + #define IKI_READ_program_version_nano_s + #define IKI_READ_program_version_nano_s_length 0 + #endif // !(defined(IKI_READ_program_version_nano_s) && defined(IKI_READ_program_version_nano_s_length)) + + #define IKI_READ_program_version_s IKI_READ_program_version_major_s F_string_ascii_period_s IKI_READ_program_version_minor_s F_string_ascii_period_s IKI_READ_program_version_micro_s IKI_READ_program_version_nano_prefix_s IKI_READ_program_version_nano_s + + #define IKI_READ_program_version_s_length iki_read_program_version_major_s_length + F_string_ascii_period_s iki_read_program_version_minor_s_length + F_string_ascii_period_s_length + iki_read_program_version_micro_s_length + iki_read_program_version_nano_prefix_s_length + iki_read_program_version_nano_s_length + + extern const f_string_static_t iki_read_program_version_s; +#endif // _di_iki_read_program_version_ + +#ifndef _di_iki_read_program_name_ + #define IKI_READ_program_name_s "iki_read" + #define IKI_READ_program_name_long_s "IKI Read" + + #define IKI_READ_program_name_s_length 9 + #define IKI_READ_program_name_long_s_length 9 + + extern const f_string_static_t iki_read_program_name_s; + extern const f_string_static_t iki_read_program_name_long_s; +#endif // _di_iki_read_program_name_ + +#ifndef _di_iki_read_defines_ + #define iki_read_signal_check_d 10000 + + enum { + iki_read_mode_content_e = 1, + iki_read_mode_literal_e, + iki_read_mode_object_e, + iki_read_mode_total_e, + }; + + #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" + + enum { + iki_read_parameter_help_e, + iki_read_parameter_light_e, + iki_read_parameter_dark_e, + iki_read_parameter_no_color_e, + iki_read_parameter_verbosity_quiet_e, + iki_read_parameter_verbosity_normal_e, + iki_read_parameter_verbosity_verbose_e, + iki_read_parameter_verbosity_debug_e, + iki_read_parameter_version_e, + + iki_read_parameter_at_e, + iki_read_parameter_content_e, + iki_read_parameter_line_e, + iki_read_parameter_literal_e, + iki_read_parameter_name_e, + iki_read_parameter_object_e, + iki_read_parameter_whole_e, + iki_read_parameter_substitute_e, + iki_read_parameter_total_e, + }; + + #define iki_read_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #define iki_read_total_parameters_d 18 +#endif // _di_iki_read_defines_ + +#ifndef _di_iki_read_substitution_t_ + #define iki_read_substitution_vocabulary_s "vocabulary" + #define iki_read_substitution_replace_s "replace" + #define iki_read_substitution_with_s "with" + + typedef struct { + f_string_static_t replace; + f_string_static_t with; + } iki_read_substitution_t; + + #define iki_read_substitution_t_initialize \ + { \ + f_string_static_t_initialize, \ + f_string_static_t_initialize, \ + } + + #define macro_iki_read_substitution_t_initialize(replace, with) \ + { \ + macro_f_string_static_t_initialize2(replace), \ + macro_f_string_static_t_initialize2(with), \ + } +#endif // _di_iki_read_substitution_t_ + +#ifndef _di_iki_read_substitutions_t_ + typedef struct { + iki_read_substitution_t *array; + + f_array_length_t size; + f_array_length_t used; + } iki_read_substitutions_t; + + #define iki_read_substitutions_t_initialize { 0, 0, 0 } + + #define macro_iki_read_substitutions_t_clear(replacements) macro_f_memory_structure_clear(replacements) + + #define macro_iki_read_substitutions_t_delete_simple(replacements) macro_f_memory_structure_delete_simple(replacements, iki_read_substitution_t) + #define macro_iki_read_substitutions_t_destroy_simple(replacements) macro_f_memory_structure_destroy_simple(replacements, iki_read_substitution_t) + + #define macro_iki_read_substitutions_t_resize(status, replacements, length) macro_f_memory_structure_resize(status, replacements, iki_read_substitution_t, length) + #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_ + +#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; + fl_print_t error; + fl_print_t warning; + + f_signal_t signal; + + uint8_t mode; + + f_number_unsigned_t at; + f_number_unsigned_t line; + + f_string_dynamic_t buffer; + + iki_read_substitutions_t replacements; + + f_color_context_t context; + } iki_read_main_t; + + #define iki_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, \ + 0, \ + 0, \ + 0, \ + f_string_dynamic_t_initialize, \ + iki_read_substitutions_t_initialize, \ + f_color_context_t_initialize, \ + } +#endif // _di_iki_read_main_t_ + +/** + * Deallocate main. + * + * Be sure to call this after executing iki_read_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @see iki_read_main() + */ +#ifndef _di_iki_read_main_delete_ + extern f_status_t iki_read_main_delete(iki_read_main_t * const main); +#endif // _di_iki_read_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _iki_read_common_h diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index a3e8c77..b10e394 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -526,20 +526,6 @@ extern "C" { } #endif // _di_iki_read_main_ -#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); - - return F_none; - } -#endif // _di_iki_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/iki_read/c/iki_read.h b/level_3/iki_read/c/iki_read.h index ca7413a..f848894 100644 --- a/level_3/iki_read/c/iki_read.h +++ b/level_3/iki_read/c/iki_read.h @@ -51,209 +51,13 @@ #include #include +// IKI Read includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_iki_read_program_version_ - #define IKI_READ_program_version_major_s F_string_ascii_0_s - #define IKI_READ_program_version_minor_s F_string_ascii_5_s - #define IKI_READ_program_version_micro_s F_string_ascii_8_s - - #define IKI_READ_program_version_major_s_length F_string_ascii_0_s_length - #define IKI_READ_program_version_minor_s_length F_string_ascii_5_s_length - #define IKI_READ_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(IKI_READ_program_version_nano_prefix_s) && defined(IKI_READ_program_version_nano_prefix_s_length)) - #define IKI_READ_program_version_nano_prefix_s - #define IKI_READ_program_version_nano_prefix_s_length 0 - #endif // !(defined(IKI_READ_program_version_nano_prefix_s) && defined(IKI_READ_program_version_nano_prefix_s_length)) - - #if !(defined(IKI_READ_program_version_nano_s) && defined(IKI_READ_program_version_nano_s_length)) - #define IKI_READ_program_version_nano_s - #define IKI_READ_program_version_nano_s_length 0 - #endif // !(defined(IKI_READ_program_version_nano_s) && defined(IKI_READ_program_version_nano_s_length)) - - #define IKI_READ_program_version_s IKI_READ_program_version_major_s F_string_ascii_period_s IKI_READ_program_version_minor_s F_string_ascii_period_s IKI_READ_program_version_micro_s IKI_READ_program_version_nano_prefix_s IKI_READ_program_version_nano_s - - #define IKI_READ_program_version_s_length iki_read_program_version_major_s_length + F_string_ascii_period_s iki_read_program_version_minor_s_length + F_string_ascii_period_s_length + iki_read_program_version_micro_s_length + iki_read_program_version_nano_prefix_s_length + iki_read_program_version_nano_s_length - - extern const f_string_static_t iki_read_program_version_s; -#endif // _di_iki_read_program_version_ - -#ifndef _di_iki_read_program_name_ - #define IKI_READ_program_name_s "iki_read" - #define IKI_READ_program_name_long_s "IKI Read" - - #define IKI_READ_program_name_s_length 9 - #define IKI_READ_program_name_long_s_length 9 - - extern const f_string_static_t iki_read_program_name_s; - extern const f_string_static_t iki_read_program_name_long_s; -#endif // _di_iki_read_program_name_ - -#ifndef _di_iki_read_defines_ - #define iki_read_signal_check_d 10000 - - enum { - iki_read_mode_content_e = 1, - iki_read_mode_literal_e, - iki_read_mode_object_e, - iki_read_mode_total_e, - }; - - #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" - - enum { - iki_read_parameter_help_e, - iki_read_parameter_light_e, - iki_read_parameter_dark_e, - iki_read_parameter_no_color_e, - iki_read_parameter_verbosity_quiet_e, - iki_read_parameter_verbosity_normal_e, - iki_read_parameter_verbosity_verbose_e, - iki_read_parameter_verbosity_debug_e, - iki_read_parameter_version_e, - - iki_read_parameter_at_e, - iki_read_parameter_content_e, - iki_read_parameter_line_e, - iki_read_parameter_literal_e, - iki_read_parameter_name_e, - iki_read_parameter_object_e, - iki_read_parameter_whole_e, - iki_read_parameter_substitute_e, - iki_read_parameter_total_e, - }; - - #define iki_read_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #define iki_read_total_parameters_d 18 -#endif // _di_iki_read_defines_ - -#ifndef _di_iki_read_substitution_t_ - #define iki_read_substitution_vocabulary_s "vocabulary" - #define iki_read_substitution_replace_s "replace" - #define iki_read_substitution_with_s "with" - - typedef struct { - f_string_static_t replace; - f_string_static_t with; - } iki_read_substitution_t; - - #define iki_read_substitution_t_initialize \ - { \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ - } - - #define macro_iki_read_substitution_t_initialize(replace, with) \ - { \ - macro_f_string_static_t_initialize2(replace), \ - macro_f_string_static_t_initialize2(with), \ - } -#endif // _di_iki_read_substitution_t_ - -#ifndef _di_iki_read_substitutions_t_ - typedef struct { - iki_read_substitution_t *array; - - f_array_length_t size; - f_array_length_t used; - } iki_read_substitutions_t; - - #define iki_read_substitutions_t_initialize { 0, 0, 0 } - - #define macro_iki_read_substitutions_t_clear(replacements) macro_f_memory_structure_clear(replacements) - - #define macro_iki_read_substitutions_t_delete_simple(replacements) macro_f_memory_structure_delete_simple(replacements, iki_read_substitution_t) - #define macro_iki_read_substitutions_t_destroy_simple(replacements) macro_f_memory_structure_destroy_simple(replacements, iki_read_substitution_t) - - #define macro_iki_read_substitutions_t_resize(status, replacements, length) macro_f_memory_structure_resize(status, replacements, iki_read_substitution_t, length) - #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_ - -#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; - fl_print_t error; - fl_print_t warning; - - f_signal_t signal; - - uint8_t mode; - - f_number_unsigned_t at; - f_number_unsigned_t line; - - f_string_dynamic_t buffer; - - iki_read_substitutions_t replacements; - - f_color_context_t context; - } iki_read_main_t; - - #define iki_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, \ - 0, \ - 0, \ - 0, \ - f_string_dynamic_t_initialize, \ - iki_read_substitutions_t_initialize, \ - f_color_context_t_initialize, \ - } -#endif // _di_iki_read_main_t_ - /** * Print help. * @@ -298,25 +102,6 @@ extern "C" { extern f_status_t iki_read_main(iki_read_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_iki_read_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing iki_read_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see iki_read_main() - */ -#ifndef _di_iki_read_main_delete_ - extern f_status_t iki_read_main_delete(iki_read_main_t * const main); -#endif // _di_iki_read_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/iki_read/data/build/settings b/level_3/iki_read/data/build/settings index 731e775..33f27fa 100644 --- a/level_3/iki_read/data/build/settings +++ b/level_3/iki_read/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library iki_read.c private-common.c private-print.c private-read.c +build_sources_library iki_read.c common.c private-common.c private-print.c private-read.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers iki_read.h +build_sources_headers iki_read.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/iki_write/c/common.c b/level_3/iki_write/c/common.c new file mode 100644 index 0000000..1f1ba64 --- /dev/null +++ b/level_3/iki_write/c/common.c @@ -0,0 +1,32 @@ +#include "iki_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_program_name_ + +#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); + + return F_none; + } +#endif // _di_iki_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/iki_write/c/common.h b/level_3/iki_write/c/common.h new file mode 100644 index 0000000..2042e13 --- /dev/null +++ b/level_3/iki_write/c/common.h @@ -0,0 +1,167 @@ +/** + * FLL - Level 3 + * + * Project: IKI Write + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _iki_write_common_h +#define _iki_write_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_iki_write_program_version_ + #define IKI_WRITE_program_version_major_s F_string_ascii_0_s + #define IKI_WRITE_program_version_minor_s F_string_ascii_5_s + #define IKI_WRITE_program_version_micro_s F_string_ascii_8_s + + #define IKI_WRITE_program_version_major_s_length F_string_ascii_0_s_length + #define IKI_WRITE_program_version_minor_s_length F_string_ascii_5_s_length + #define IKI_WRITE_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(IKI_WRITE_program_version_nano_prefix_s) && defined(IKI_WRITE_program_version_nano_prefix_s_length)) + #define IKI_WRITE_program_version_nano_prefix_s + #define IKI_WRITE_program_version_nano_prefix_s_length 0 + #endif // !(defined(IKI_WRITE_program_version_nano_prefix_s) && defined(IKI_WRITE_program_version_nano_prefix_s_length)) + + #if !(defined(IKI_WRITE_program_version_nano_s) && defined(IKI_WRITE_program_version_nano_s_length)) + #define IKI_WRITE_program_version_nano_s + #define IKI_WRITE_program_version_nano_s_length 0 + #endif // !(defined(IKI_WRITE_program_version_nano_s) && defined(IKI_WRITE_program_version_nano_s_length)) + + #define IKI_WRITE_program_version_s IKI_WRITE_program_version_major_s F_string_ascii_period_s IKI_WRITE_program_version_minor_s F_string_ascii_period_s IKI_WRITE_program_version_micro_s IKI_WRITE_program_version_nano_prefix_s IKI_WRITE_program_version_nano_s + + #define IKI_WRITE_program_version_s_length IKI_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + IKI_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + IKI_WRITE_program_version_micro_s_length + IKI_WRITE_program_version_nano_prefix_s_length + IKI_WRITE_program_version_nano_s_length + + extern const f_string_static_t iki_write_program_version_s; +#endif // _di_iki_write_program_version_ + +#ifndef _di_iki_write_program_name_ + #define iki_write_program_name_s "iki_write" + #define iki_write_program_name_long_s "IKI Write" + + #define IKI_WRITE_program_name_s_length 9 + #define IKI_WRITE_program_name_long_s_length 9 + + extern const f_string_static_t iki_write_program_name_s; + extern const f_string_static_t iki_write_program_name_long_s; +#endif // _di_iki_write_program_name_ + +#ifndef _di_iki_write_defines_ + #define iki_write_signal_check_d 10000 + + #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" + + enum { + iki_write_parameter_help_e, + iki_write_parameter_light_e, + iki_write_parameter_dark_e, + iki_write_parameter_no_color_e, + iki_write_parameter_verbosity_quiet_e, + iki_write_parameter_verbosity_normal_e, + iki_write_parameter_verbosity_verbose_e, + iki_write_parameter_verbosity_debug_e, + iki_write_parameter_version_e, + + iki_write_parameter_file_e, + iki_write_parameter_content_e, + iki_write_parameter_double_e, + iki_write_parameter_object_e, + iki_write_parameter_single_e, + }; + + #define iki_write_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #define iki_write_total_parameters_d 14 +#endif // _di_iki_write_defines_ + +#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; + fl_print_t error; + fl_print_t warning; + + f_signal_t signal; + + f_string_static_t quote; + f_string_dynamic_t buffer; + + f_color_context_t context; + } iki_write_main_t; + + #define iki_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_string_dynamic_t_initialize, \ + f_color_context_t_initialize, \ + } +#endif // _di_iki_write_main_t_ + +/** + * Deallocate main. + * + * Be sure to call this after executing iki_write_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @see iki_write_main() + */ +#ifndef _di_iki_write_main_delete_ + extern f_status_t iki_write_main_delete(iki_write_main_t * const main); +#endif // _di_iki_write_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _iki_write_common_h diff --git a/level_3/iki_write/c/iki_write.c b/level_3/iki_write/c/iki_write.c index 2ef52b5..fa14b47 100644 --- a/level_3/iki_write/c/iki_write.c +++ b/level_3/iki_write/c/iki_write.c @@ -496,20 +496,6 @@ extern "C" { } #endif // _di_iki_write_main_ -#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); - - return F_none; - } -#endif // _di_iki_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/iki_write/c/iki_write.h b/level_3/iki_write/c/iki_write.h index 64f9aeb..e9ed402 100644 --- a/level_3/iki_write/c/iki_write.h +++ b/level_3/iki_write/c/iki_write.h @@ -51,135 +51,13 @@ #include #include +// IKI Write includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_iki_write_program_version_ - #define IKI_WRITE_program_version_major_s F_string_ascii_0_s - #define IKI_WRITE_program_version_minor_s F_string_ascii_5_s - #define IKI_WRITE_program_version_micro_s F_string_ascii_8_s - - #define IKI_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define IKI_WRITE_program_version_minor_s_length F_string_ascii_5_s_length - #define IKI_WRITE_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(IKI_WRITE_program_version_nano_prefix_s) && defined(IKI_WRITE_program_version_nano_prefix_s_length)) - #define IKI_WRITE_program_version_nano_prefix_s - #define IKI_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(IKI_WRITE_program_version_nano_prefix_s) && defined(IKI_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(IKI_WRITE_program_version_nano_s) && defined(IKI_WRITE_program_version_nano_s_length)) - #define IKI_WRITE_program_version_nano_s - #define IKI_WRITE_program_version_nano_s_length 0 - #endif // !(defined(IKI_WRITE_program_version_nano_s) && defined(IKI_WRITE_program_version_nano_s_length)) - - #define IKI_WRITE_program_version_s IKI_WRITE_program_version_major_s F_string_ascii_period_s IKI_WRITE_program_version_minor_s F_string_ascii_period_s IKI_WRITE_program_version_micro_s IKI_WRITE_program_version_nano_prefix_s IKI_WRITE_program_version_nano_s - - #define IKI_WRITE_program_version_s_length IKI_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + IKI_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + IKI_WRITE_program_version_micro_s_length + IKI_WRITE_program_version_nano_prefix_s_length + IKI_WRITE_program_version_nano_s_length - - extern const f_string_static_t iki_write_program_version_s; -#endif // _di_iki_write_program_version_ - -#ifndef _di_iki_write_program_name_ - #define iki_write_program_name_s "iki_write" - #define iki_write_program_name_long_s "IKI Write" - - #define IKI_WRITE_program_name_s_length 9 - #define IKI_WRITE_program_name_long_s_length 9 - - extern const f_string_static_t iki_write_program_name_s; - extern const f_string_static_t iki_write_program_name_long_s; -#endif // _di_iki_write_program_name_ - -#ifndef _di_iki_write_defines_ - #define iki_write_signal_check_d 10000 - - #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" - - enum { - iki_write_parameter_help_e, - iki_write_parameter_light_e, - iki_write_parameter_dark_e, - iki_write_parameter_no_color_e, - iki_write_parameter_verbosity_quiet_e, - iki_write_parameter_verbosity_normal_e, - iki_write_parameter_verbosity_verbose_e, - iki_write_parameter_verbosity_debug_e, - iki_write_parameter_version_e, - - iki_write_parameter_file_e, - iki_write_parameter_content_e, - iki_write_parameter_double_e, - iki_write_parameter_object_e, - iki_write_parameter_single_e, - }; - - #define iki_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #define iki_write_total_parameters_d 14 -#endif // _di_iki_write_defines_ - -#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; - fl_print_t error; - fl_print_t warning; - - f_signal_t signal; - - f_string_static_t quote; - f_string_dynamic_t buffer; - - f_color_context_t context; - } iki_write_main_t; - - #define iki_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_string_dynamic_t_initialize, \ - f_color_context_t_initialize, \ - } -#endif // _di_iki_write_main_t_ - /** * Print help. * @@ -224,25 +102,6 @@ extern "C" { extern f_status_t iki_write_main(iki_write_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_iki_write_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing iki_write_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see iki_write_main() - */ -#ifndef _di_iki_write_main_delete_ - extern f_status_t iki_write_main_delete(iki_write_main_t * const main); -#endif // _di_iki_write_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/iki_write/data/build/settings b/level_3/iki_write/data/build/settings index f9f8e92..8ff5352 100644 --- a/level_3/iki_write/data/build/settings +++ b/level_3/iki_write/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library iki_write.c private-common.c private-write.c +build_sources_library iki_write.c common.c private-common.c private-write.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers iki_write.h +build_sources_headers iki_write.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/status_code/c/common.c b/level_3/status_code/c/common.c new file mode 100644 index 0000000..3bcc73c --- /dev/null +++ b/level_3/status_code/c/common.c @@ -0,0 +1,31 @@ +#include "status_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_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); + + f_type_array_lengths_resize(0, &main->remaining); + + macro_f_color_context_t_delete_simple(main->context); + + return F_none; + } +#endif // _di_status_code_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/status_code/c/common.h b/level_3/status_code/c/common.h new file mode 100644 index 0000000..ba5bd97 --- /dev/null +++ b/level_3/status_code/c/common.h @@ -0,0 +1,158 @@ +/** + * FLL - Level 3 + * + * Project: Status Code + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _status_code_common_h +#define _status_code_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_status_code_program_version_ + #define STATUS_CODE_program_version_major_s F_string_ascii_0_s + #define STATUS_CODE_program_version_minor_s F_string_ascii_5_s + #define STATUS_CODE_program_version_micro_s F_string_ascii_8_s + + #define STATUS_CODE_program_version_major_s_length F_string_ascii_0_s_length + #define STATUS_CODE_program_version_minor_s_length F_string_ascii_5_s_length + #define STATUS_CODE_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(STATUS_CODE_program_version_nano_prefix_s) && defined(STATUS_CODE_program_version_nano_prefix_s_length)) + #define STATUS_CODE_program_version_nano_prefix_s + #define STATUS_CODE_program_version_nano_prefix_s_length 0 + #endif // !(defined(STATUS_CODE_program_version_nano_prefix_s) && defined(STATUS_CODE_program_version_nano_prefix_s_length)) + + #if !(defined(STATUS_CODE_program_version_nano_s) && defined(STATUS_CODE_program_version_nano_s_length)) + #define STATUS_CODE_program_version_nano_s + #define STATUS_CODE_program_version_nano_s_length 0 + #endif // !(defined(STATUS_CODE_program_version_nano_s) && defined(STATUS_CODE_program_version_nano_s_length)) + + #define STATUS_CODE_progam_version_s STATUS_CODE_program_version_major_s F_string_ascii_period_s STATUS_CODE_program_version_minor_s F_string_ascii_period_s STATUS_CODE_program_version_micro_s STATUS_CODE_progam_version_nano_prefix_s STATUS_CODE_progam_version_nano_s + + #define STATUS_CODE_progam_version_s_length STATUS_CODE_program_version_major_s_length + F_string_ascii_period_s_length + STATUS_CODE_program_version_minor_s_length + F_string_ascii_period_s_length + STATUS_CODE_program_version_micro_s_length + STATUS_CODE_progam_version_nano_prefix_s_length + STATUS_CODE_progam_version_nano_s_length + + extern const f_string_static_t status_code_program_version_s; +#endif // _di_status_code_program_version_ + +#ifndef _di_status_code_program_name_ + #define STATUS_CODE_progam_name_s "status_code" + #define STATUS_CODE_progam_name_long_s "FSS Status Code" + + #define STATUS_CODE_program_name_s_length 11 + #define STATUS_CODE_program_name_long_s_length 15 + + extern const f_string_static_t status_code_program_name_s; + extern const f_string_static_t status_code_program_name_long_s; +#endif // _di_status_code_program_name_ + +#ifndef _di_status_code_defines_ + #define status_code_signal_check_d 10000 + + #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" + + enum { + status_code_parameter_help_e, + status_code_parameter_light_e, + status_code_parameter_dark_e, + status_code_parameter_no_color_e, + status_code_parameter_verbosity_quiet_e, + status_code_parameter_verbosity_normal_e, + status_code_parameter_verbosity_verbose_e, + status_code_parameter_verbosity_debug_e, + status_code_parameter_version_e, + + status_code_parameter_is_fine_e, + status_code_parameter_is_warning_e, + status_code_parameter_is_error_e, + status_code_parameter_number_e, + }; + + #define status_code_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #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_ + +/** + * Deallocate main. + * + * Be sure to call this after executing status_code_main(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @see status_code_main() + */ +#ifndef _di_status_code_main_delete_ + extern f_status_t status_code_main_delete(status_code_main_t * const main); +#endif // _di_status_code_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _status_code_common_h diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/status_code.c index f64092c..1ae1f9b 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/status_code.c @@ -310,19 +310,6 @@ extern "C" { } #endif // _di_status_code_main_ -#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); - - f_type_array_lengths_resize(0, &main->remaining); - - macro_f_color_context_t_delete_simple(main->context); - - return F_none; - } -#endif // _di_status_code_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/status_code/c/status_code.h b/level_3/status_code/c/status_code.h index 59741f5..c091bb7 100644 --- a/level_3/status_code/c/status_code.h +++ b/level_3/status_code/c/status_code.h @@ -42,126 +42,13 @@ #include #include +// Status Code includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_status_code_program_version_ - #define STATUS_CODE_program_version_major_s F_string_ascii_0_s - #define STATUS_CODE_program_version_minor_s F_string_ascii_5_s - #define STATUS_CODE_program_version_micro_s F_string_ascii_8_s - - #define STATUS_CODE_program_version_major_s_length F_string_ascii_0_s_length - #define STATUS_CODE_program_version_minor_s_length F_string_ascii_5_s_length - #define STATUS_CODE_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(STATUS_CODE_program_version_nano_prefix_s) && defined(STATUS_CODE_program_version_nano_prefix_s_length)) - #define STATUS_CODE_program_version_nano_prefix_s - #define STATUS_CODE_program_version_nano_prefix_s_length 0 - #endif // !(defined(STATUS_CODE_program_version_nano_prefix_s) && defined(STATUS_CODE_program_version_nano_prefix_s_length)) - - #if !(defined(STATUS_CODE_program_version_nano_s) && defined(STATUS_CODE_program_version_nano_s_length)) - #define STATUS_CODE_program_version_nano_s - #define STATUS_CODE_program_version_nano_s_length 0 - #endif // !(defined(STATUS_CODE_program_version_nano_s) && defined(STATUS_CODE_program_version_nano_s_length)) - - #define STATUS_CODE_progam_version_s STATUS_CODE_program_version_major_s F_string_ascii_period_s STATUS_CODE_program_version_minor_s F_string_ascii_period_s STATUS_CODE_program_version_micro_s STATUS_CODE_progam_version_nano_prefix_s STATUS_CODE_progam_version_nano_s - - #define STATUS_CODE_progam_version_s_length STATUS_CODE_program_version_major_s_length + F_string_ascii_period_s_length + STATUS_CODE_program_version_minor_s_length + F_string_ascii_period_s_length + STATUS_CODE_program_version_micro_s_length + STATUS_CODE_progam_version_nano_prefix_s_length + STATUS_CODE_progam_version_nano_s_length - - extern const f_string_static_t status_code_program_version_s; -#endif // _di_status_code_program_version_ - -#ifndef _di_status_code_program_name_ - #define STATUS_CODE_progam_name_s "status_code" - #define STATUS_CODE_progam_name_long_s "FSS Status Code" - - #define STATUS_CODE_program_name_s_length 11 - #define STATUS_CODE_program_name_long_s_length 15 - - extern const f_string_static_t status_code_program_name_s; - extern const f_string_static_t status_code_program_name_long_s; -#endif // _di_status_code_program_name_ - -#ifndef _di_status_code_defines_ - #define status_code_signal_check_d 10000 - - #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" - - enum { - status_code_parameter_help_e, - status_code_parameter_light_e, - status_code_parameter_dark_e, - status_code_parameter_no_color_e, - status_code_parameter_verbosity_quiet_e, - status_code_parameter_verbosity_normal_e, - status_code_parameter_verbosity_verbose_e, - status_code_parameter_verbosity_debug_e, - status_code_parameter_version_e, - - status_code_parameter_is_fine_e, - status_code_parameter_is_warning_e, - status_code_parameter_is_error_e, - status_code_parameter_number_e, - }; - - #define status_code_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #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_ - /** * Print help. * @@ -206,25 +93,6 @@ extern "C" { extern f_status_t status_code_main(status_code_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_status_code_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing status_code_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see status_code_main() - */ -#ifndef _di_status_code_main_delete_ - extern f_status_t status_code_main_delete(status_code_main_t * const main); -#endif // _di_status_code_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/status_code/data/build/settings b/level_3/status_code/data/build/settings index e1275a9..c9d81d4 100644 --- a/level_3/status_code/data/build/settings +++ b/level_3/status_code/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library status_code.c private-common.c private-status_code.c +build_sources_library status_code.c common.c private-common.c private-status_code.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers status_code.h +build_sources_headers status_code.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script diff --git a/level_3/utf8/c/common.c b/level_3/utf8/c/common.c new file mode 100644 index 0000000..d1a892d --- /dev/null +++ b/level_3/utf8/c/common.c @@ -0,0 +1,31 @@ +#include "utf8.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_firewall_program_version_ + const f_string_static_t firewall_program_version_s = macro_f_string_static_t_initialize(FIREWALL_version_s, 0, FIREWALL_version_s_length); +#endif // _di_firewall_program_version_ + +#ifndef _di_firewall_program_name_ + const f_string_static_t firewall_program_name_s = macro_f_string_static_t_initialize(FIREWALL_program_name_s, 0, FIREWALL_program_name_s_length); + const f_string_static_t firewall_program_name_long_s = macro_f_string_static_t_initialize(FIREWALL_program_name_long_s, 0, FIREWALL_program_name_long_s_length); +#endif // _di_firewall_program_name_ + +#ifndef _di_utf8_main_delete_ + f_status_t utf8_main_delete(utf8_main_t *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; + } +#endif // _di_utf8_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/utf8/c/common.h b/level_3/utf8/c/common.h new file mode 100644 index 0000000..934eb40 --- /dev/null +++ b/level_3/utf8/c/common.h @@ -0,0 +1,268 @@ +/** + * FLL - Level 3 + * + * Project: UTF-8 + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _utf8_common_h +#define _utf8_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_utf8_program_version_ + #define UTF8_program_version_major_s F_string_ascii_0_s + #define UTF8_program_version_minor_s F_string_ascii_5_s + #define UTF8_program_version_micro_s F_string_ascii_8_s + + #define UTF8_program_version_major_s_length F_string_ascii_0_s_length + #define UTF8_program_version_minor_s_length F_string_ascii_5_s_length + #define UTF8_program_version_micro_s_length F_string_ascii_8_s_length + + #if !(defined(UTF8_program_version_nano_prefix_s) && defined(UTF8_program_version_nano_prefix_s_length)) + #define UTF8_program_version_nano_prefix_s + #define UTF8_program_version_nano_prefix_s_length 0 + #endif // !(defined(UTF8_program_version_nano_prefix_s) && defined(UTF8_program_version_nano_prefix_s_length)) + + #if !(defined(UTF8_program_version_nano_s) && defined(UTF8_program_version_nano_s_length)) + #define UTF8_program_version_nano_s + #define UTF8_program_version_nano_s_length 0 + #endif // !(defined(UTF8_program_version_nano_s) && defined(UTF8_program_version_nano_s_length)) + + #define UTF8_program_version_s UTF8_program_version_major_s F_string_ascii_period_s UTF8_program_version_minor_s F_string_ascii_period_s UTF8_program_version_micro_s UTF8_program_version_nano_prefix_s UTF8_program_version_nano_s + + #define UTF8_program_version_s_length UTF8_program_version_major_s_length + F_string_ascii_period_s_length + UTF8_program_version_minor_s_length + F_string_ascii_period_s_length + UTF8_program_version_micro_s_length + UTF8_program_version_nano_prefix_s_length + UTF8_program_version_nano_s_length + + extern const f_string_static_t utf8_program_version_s; +#endif // _di_utf8_program_version_ + +#ifndef _di_utf8_program_name_ + #define UTF8_program_name_s "utf8" + #define UTF8_program_name_long_s "UTF-8" + + #define UTF8_program_name_s_length 4 + #define UTF8_program_name_long_s_length 5 + + extern const f_string_static_t utf8_program_name_s; + extern const f_string_static_t utf8_program_name_long_s; +#endif // _di_utf8_program_name_ + +/** + * 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_ + +#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_verified_valid_s "Verified Valid" + #define utf8_string_verified_valid_not_s "Verified Invalid" + + #define utf8_string_combining_is_s "C" + #define utf8_string_combining_not_s "N" + #define utf8_string_unknown_s "?" + + #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_verified_valid_s_length 14 + #define utf8_string_verified_valid_not_s_length 16 + + #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_width_0_s_length 1 + #define utf8_string_width_1_s_length 1 + #define utf8_string_width_2_s_length 1 + + #define utf8_character_valid_not_s "�" + + #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" + + enum { + utf8_parameter_help_e, + utf8_parameter_light_e, + utf8_parameter_dark_e, + utf8_parameter_no_color_e, + utf8_parameter_verbosity_quiet_e, + utf8_parameter_verbosity_normal_e, + utf8_parameter_verbosity_verbose_e, + utf8_parameter_verbosity_debug_e, + utf8_parameter_version_e, + + utf8_parameter_from_binary_e, + utf8_parameter_from_codepoint_e, + utf8_parameter_from_file_e, + + utf8_parameter_headers_e, + utf8_parameter_separate_e, + utf8_parameter_strip_invalid_e, + + utf8_parameter_to_binary_e, + utf8_parameter_to_codepoint_e, + utf8_parameter_to_combining_e, + utf8_parameter_to_file_e, + utf8_parameter_to_width_e, + + utf8_parameter_verify_e, + }; + + #define utf8_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(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), \ + } + + #define utf8_total_parameters_d 21 +#endif // _di_utf8_defines_ + +/** + * Modes used to designate how to the input and output are to be processed. + * + * utf8_mode_from_*: + * - binary: The input format is binary. + * - codepoint: The input format is codepoint (U+XXXX or U+XXXXXX). + * + * utf8_mode_to_*: + * - binary: The outout format is binary. + * - codepoint: The outout format is codepoint (U+XXXX or U+XXXXXX). + * - combining: The outout format is whether or not character is combining (may be used with "width"). + * - width: The outout format is how wide the character is (may be used with "combining"). + */ +#ifndef _di_utf8_modes_ + #define utf8_mode_from_binary_d 0x1 + #define utf8_mode_from_codepoint_d 0x2 + #define utf8_mode_to_binary_d 0x4 + #define utf8_mode_to_codepoint_d 0x8 + #define utf8_mode_to_combining_d 0x10 + #define utf8_mode_to_width_d 0x20 +#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(). + * + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @see utf8_main() + */ +#ifndef _di_utf8_main_delete_ + extern f_status_t utf8_main_delete(utf8_main_t *main); +#endif // _di_utf8_main_delete_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _utf8_common_h diff --git a/level_3/utf8/c/utf8.c b/level_3/utf8/c/utf8.c index 82c66c7..5f27334 100644 --- a/level_3/utf8/c/utf8.c +++ b/level_3/utf8/c/utf8.c @@ -517,19 +517,6 @@ extern "C" { } #endif // _di_utf8_main_ -#ifndef _di_utf8_main_delete_ - f_status_t utf8_main_delete(utf8_main_t *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; - } -#endif // _di_utf8_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/utf8/c/utf8.h b/level_3/utf8/c/utf8.h index 674caeb..aa1f211 100644 --- a/level_3/utf8/c/utf8.h +++ b/level_3/utf8/c/utf8.h @@ -55,236 +55,13 @@ #include #include +// UTF-8 includes. +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef _di_utf8_program_version_ - #define UTF8_program_version_major_s F_string_ascii_0_s - #define UTF8_program_version_minor_s F_string_ascii_5_s - #define UTF8_program_version_micro_s F_string_ascii_8_s - - #define UTF8_program_version_major_s_length F_string_ascii_0_s_length - #define UTF8_program_version_minor_s_length F_string_ascii_5_s_length - #define UTF8_program_version_micro_s_length F_string_ascii_8_s_length - - #if !(defined(UTF8_program_version_nano_prefix_s) && defined(UTF8_program_version_nano_prefix_s_length)) - #define UTF8_program_version_nano_prefix_s - #define UTF8_program_version_nano_prefix_s_length 0 - #endif // !(defined(UTF8_program_version_nano_prefix_s) && defined(UTF8_program_version_nano_prefix_s_length)) - - #if !(defined(UTF8_program_version_nano_s) && defined(UTF8_program_version_nano_s_length)) - #define UTF8_program_version_nano_s - #define UTF8_program_version_nano_s_length 0 - #endif // !(defined(UTF8_program_version_nano_s) && defined(UTF8_program_version_nano_s_length)) - - #define UTF8_program_version_s UTF8_program_version_major_s F_string_ascii_period_s UTF8_program_version_minor_s F_string_ascii_period_s UTF8_program_version_micro_s UTF8_program_version_nano_prefix_s UTF8_program_version_nano_s - - #define UTF8_program_version_s_length UTF8_program_version_major_s_length + F_string_ascii_period_s_length + UTF8_program_version_minor_s_length + F_string_ascii_period_s_length + UTF8_program_version_micro_s_length + UTF8_program_version_nano_prefix_s_length + UTF8_program_version_nano_s_length - - extern const f_string_static_t utf8_program_version_s; -#endif // _di_utf8_program_version_ - -#ifndef _di_utf8_program_name_ - #define UTF8_program_name_s "utf8" - #define UTF8_program_name_long_s "UTF-8" - - #define UTF8_program_name_s_length 4 - #define UTF8_program_name_long_s_length 5 - - extern const f_string_static_t utf8_program_name_s; - extern const f_string_static_t utf8_program_name_long_s; -#endif // _di_utf8_program_name_ - -/** - * 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_ - -#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_verified_valid_s "Verified Valid" - #define utf8_string_verified_valid_not_s "Verified Invalid" - - #define utf8_string_combining_is_s "C" - #define utf8_string_combining_not_s "N" - #define utf8_string_unknown_s "?" - - #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_verified_valid_s_length 14 - #define utf8_string_verified_valid_not_s_length 16 - - #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_width_0_s_length 1 - #define utf8_string_width_1_s_length 1 - #define utf8_string_width_2_s_length 1 - - #define utf8_character_valid_not_s "�" - - #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" - - enum { - utf8_parameter_help_e, - utf8_parameter_light_e, - utf8_parameter_dark_e, - utf8_parameter_no_color_e, - utf8_parameter_verbosity_quiet_e, - utf8_parameter_verbosity_normal_e, - utf8_parameter_verbosity_verbose_e, - utf8_parameter_verbosity_debug_e, - utf8_parameter_version_e, - - utf8_parameter_from_binary_e, - utf8_parameter_from_codepoint_e, - utf8_parameter_from_file_e, - - utf8_parameter_headers_e, - utf8_parameter_separate_e, - utf8_parameter_strip_invalid_e, - - utf8_parameter_to_binary_e, - utf8_parameter_to_codepoint_e, - utf8_parameter_to_combining_e, - utf8_parameter_to_file_e, - utf8_parameter_to_width_e, - - utf8_parameter_verify_e, - }; - - #define utf8_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(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), \ - } - - #define utf8_total_parameters_d 21 -#endif // _di_utf8_defines_ - -/** - * Modes used to designate how to the input and output are to be processed. - * - * utf8_mode_from_*: - * - binary: The input format is binary. - * - codepoint: The input format is codepoint (U+XXXX or U+XXXXXX). - * - * utf8_mode_to_*: - * - binary: The outout format is binary. - * - codepoint: The outout format is codepoint (U+XXXX or U+XXXXXX). - * - combining: The outout format is whether or not character is combining (may be used with "width"). - * - width: The outout format is how wide the character is (may be used with "combining"). - */ -#ifndef _di_utf8_modes_ - #define utf8_mode_from_binary_d 0x1 - #define utf8_mode_from_codepoint_d 0x2 - #define utf8_mode_to_binary_d 0x4 - #define utf8_mode_to_codepoint_d 0x8 - #define utf8_mode_to_combining_d 0x10 - #define utf8_mode_to_width_d 0x20 -#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_ - /** * Print help. * @@ -332,25 +109,6 @@ extern "C" { extern f_status_t utf8_main(utf8_main_t * const main, const f_console_arguments_t *arguments); #endif // _di_utf8_main_ -/** - * Deallocate main. - * - * Be sure to call this after executing utf8_main(). - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see utf8_main() - */ -#ifndef _di_utf8_main_delete_ - extern f_status_t utf8_main_delete(utf8_main_t *main); -#endif // _di_utf8_main_delete_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/utf8/data/build/settings b/level_3/utf8/data/build/settings index 2b4411f..0686e87 100644 --- a/level_3/utf8/data/build/settings +++ b/level_3/utf8/data/build/settings @@ -26,13 +26,13 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_libraries_shared build_libraries_static -build_sources_library utf8.c private-common.c private-print.c private-utf8.c private-utf8_binary.c private-utf8_codepoint.c +build_sources_library utf8.c common.c private-common.c private-print.c private-utf8.c private-utf8_binary.c private-utf8_codepoint.c build_sources_library_shared build_sources_library_static build_sources_program main.c build_sources_program_shared build_sources_program_static -build_sources_headers utf8.h +build_sources_headers utf8.h common.h build_sources_headers_shared build_sources_headers_static build_sources_script -- 1.8.3.1