From 8d16ee282779b899eb1921e0fa3e3f15cf11695c Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 17 Jul 2023 00:24:37 -0500 Subject: [PATCH] Update: Add FSS Simple Packet related functionality and remove delimit and comment types. The FSS Simple Packet functionality is added, to provide for processing of the FSS Simple Packet. The f_fss_simple_packet_ranges_t represents a set of ranges for designating where/how the packet is defined within some string. The delimit and comment types are just helper type definitions for existing number types. Simplify the design by getting rid of those, replacing them with the type that they effectively represent. A lot of code is updated to reflect this change. --- build/disable/about.txt | 8 +- build/disable/level_0/f_fss.h | 20 +- build/level_0/settings | 5 +- build/monolithic/settings | 5 +- build/stand_alone/fake.config.h | 23 +- build/stand_alone/fake.settings | 3 +- level_0/f_fss/c/fss.c | 5 +- level_0/f_fss/c/fss.h | 11 +- level_0/f_fss/c/fss/comment.h | 94 ---- level_0/f_fss/c/fss/common.h | 102 ---- level_0/f_fss/c/fss/delimit.c | 9 - level_0/f_fss/c/fss/delimit.h | 92 ---- level_0/f_fss/c/fss/item.c | 96 ++++ level_0/f_fss/c/fss/item.h | 253 ++++++++++ level_0/f_fss/c/fss/named.c | 38 +- level_0/f_fss/c/fss/named.h | 14 +- level_0/f_fss/c/fss/nest.c | 135 +----- level_0/f_fss/c/fss/nest.h | 230 --------- level_0/f_fss/c/fss/private-item.c | 58 +++ level_0/f_fss/c/fss/private-item.h | 76 +++ level_0/f_fss/c/fss/private-named.c | 90 ++++ level_0/f_fss/c/fss/private-named.h | 134 ++++++ level_0/f_fss/c/fss/private-nest.c | 107 +++++ level_0/f_fss/c/fss/private-nest.h | 130 ++++++ level_0/f_fss/c/fss/private-set.c | 90 ++++ level_0/f_fss/c/fss/private-set.h | 134 ++++++ level_0/f_fss/c/fss/private-set_quote.c | 114 +++++ level_0/f_fss/c/fss/private-set_quote.h | 150 ++++++ level_0/f_fss/c/fss/private-simple_packet.c | 42 ++ level_0/f_fss/c/fss/private-simple_packet.h | 88 ++++ level_0/f_fss/c/fss/{comment.c => quote.c} | 0 level_0/f_fss/c/fss/set.c | 230 +-------- level_0/f_fss/c/fss/set.h | 346 +------------- level_0/f_fss/c/fss/set_quote.c | 182 ++++++++ level_0/f_fss/c/fss/set_quote.h | 359 ++++++++++++++ level_0/f_fss/c/fss/simple_packet.c | 148 ++++++ level_0/f_fss/c/fss/simple_packet.h | 255 ++++++++++ level_0/f_fss/c/private-fss.c | 438 ------------------ level_0/f_fss/c/private-fss.h | 514 --------------------- level_0/f_fss/data/build/settings | 5 +- level_0/f_fss/data/build/settings-mocks | 5 +- level_0/f_fss/data/build/settings-tests | 1 + .../f_fss/tests/unit/c/test-fss-apply_delimit.c | 68 +-- .../tests/unit/c/test-fss-apply_delimit_range.c | 68 +-- .../unit/c/test-fss-simple_packet_ranges_adjust.c | 42 ++ .../unit/c/test-fss-simple_packet_ranges_adjust.h | 27 ++ .../c/test-fss-simple_packet_ranges_decimate_by.c | 73 +++ .../c/test-fss-simple_packet_ranges_decimate_by.h | 34 ++ .../c/test-fss-simple_packet_ranges_decrease_by.c | 73 +++ .../c/test-fss-simple_packet_ranges_decrease_by.h | 34 ++ .../c/test-fss-simple_packet_ranges_increase.c | 75 +++ .../c/test-fss-simple_packet_ranges_increase.h | 34 ++ .../c/test-fss-simple_packet_ranges_increase_by.c | 76 +++ .../c/test-fss-simple_packet_ranges_increase_by.h | 34 ++ .../unit/c/test-fss-simple_packet_ranges_resize.c | 42 ++ .../unit/c/test-fss-simple_packet_ranges_resize.h | 27 ++ level_0/f_fss/tests/unit/c/test-fss.c | 12 + level_0/f_fss/tests/unit/c/test-fss.h | 6 + level_0/f_status/c/status.h | 2 + level_0/f_status_string/c/status_string.c | 12 + level_0/f_status_string/c/status_string.h | 6 + .../tests/unit/c/test-status_string-to.c | 6 +- level_1/fl_fss/c/fss/basic.c | 4 +- level_1/fl_fss/c/fss/basic.h | 4 +- level_1/fl_fss/c/fss/basic_list.c | 4 +- level_1/fl_fss/c/fss/basic_list.h | 4 +- level_1/fl_fss/c/fss/embedded_list.c | 6 +- level_1/fl_fss/c/fss/embedded_list.h | 4 +- level_1/fl_fss/c/fss/extended.c | 4 +- level_1/fl_fss/c/fss/extended.h | 4 +- level_1/fl_fss/c/fss/extended_list.c | 4 +- level_1/fl_fss/c/fss/extended_list.h | 4 +- level_1/fl_fss/c/private-fss.c | 2 +- level_1/fl_fss/c/private-fss.h | 2 +- level_1/fl_status_string/c/status_string.c | 12 + .../tests/unit/c/test-status_string-from.c | 6 +- level_2/fll_fss/c/fss.c | 22 +- level_2/fll_fss/c/fss.h | 20 +- level_2/fll_fss/c/fss/basic.c | 2 +- level_2/fll_fss/c/fss/basic.h | 2 +- level_2/fll_fss/c/fss/basic_list.c | 2 +- level_2/fll_fss/c/fss/basic_list.h | 2 +- level_2/fll_fss/c/fss/embedded_list.c | 2 +- level_2/fll_fss/c/fss/embedded_list.h | 2 +- level_2/fll_fss/c/fss/extended.c | 2 +- level_2/fll_fss/c/fss/extended.h | 2 +- level_2/fll_fss/c/fss/extended_list.c | 2 +- level_2/fll_fss/c/fss/extended_list.h | 2 +- level_2/fll_fss/c/fss/payload.c | 2 +- level_2/fll_fss/c/fss/payload.h | 2 +- level_3/control/c/private-common.h | 20 +- level_3/control/c/private-control.c | 6 +- level_3/controller/c/common/private-cache.h | 30 +- level_3/controller/c/rule/private-rule.c | 2 +- level_3/controller/c/rule/private-rule.h | 2 +- level_3/fake/c/main/build/load.c | 14 +- level_3/fake/c/main/build/load.h | 2 +- level_3/fake/c/main/make/load_fakefile.c | 20 +- level_3/fake/c/main/make/load_fakefile.h | 12 +- level_3/fake/c/main/make/operate.c | 2 +- level_3/fake/c/main/make/operate.h | 2 +- level_3/firewall/c/private-common.h | 16 +- level_3/firewall/c/private-firewall.c | 18 +- .../c/fss_embedded_list_read.c | 6 +- level_3/fss_embedded_list_read/c/private-read.c | 12 +- level_3/fss_embedded_list_read/c/private-read.h | 10 +- level_3/fss_read/c/main/common/type.h | 28 +- level_3/fss_read/c/main/print/data.c | 6 +- level_3/fss_read/c/main/print/data.h | 6 +- level_3/fss_read/c/main/process_normal.h | 2 +- 110 files changed, 3457 insertions(+), 2479 deletions(-) delete mode 100644 level_0/f_fss/c/fss/comment.h delete mode 100644 level_0/f_fss/c/fss/delimit.c delete mode 100644 level_0/f_fss/c/fss/delimit.h create mode 100644 level_0/f_fss/c/fss/item.c create mode 100644 level_0/f_fss/c/fss/item.h create mode 100644 level_0/f_fss/c/fss/private-item.c create mode 100644 level_0/f_fss/c/fss/private-item.h create mode 100644 level_0/f_fss/c/fss/private-named.c create mode 100644 level_0/f_fss/c/fss/private-named.h create mode 100644 level_0/f_fss/c/fss/private-nest.c create mode 100644 level_0/f_fss/c/fss/private-nest.h create mode 100644 level_0/f_fss/c/fss/private-set.c create mode 100644 level_0/f_fss/c/fss/private-set.h create mode 100644 level_0/f_fss/c/fss/private-set_quote.c create mode 100644 level_0/f_fss/c/fss/private-set_quote.h create mode 100644 level_0/f_fss/c/fss/private-simple_packet.c create mode 100644 level_0/f_fss/c/fss/private-simple_packet.h rename level_0/f_fss/c/fss/{comment.c => quote.c} (100%) create mode 100644 level_0/f_fss/c/fss/set_quote.c create mode 100644 level_0/f_fss/c/fss/set_quote.h create mode 100644 level_0/f_fss/c/fss/simple_packet.c create mode 100644 level_0/f_fss/c/fss/simple_packet.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.h diff --git a/build/disable/about.txt b/build/disable/about.txt index 4600eb9..79cd64e 100644 --- a/build/disable/about.txt +++ b/build/disable/about.txt @@ -33,18 +33,18 @@ Consider the following example using the fake dependencies for the stand alone b # echo $(cat level_3/fake/data/build/dependencies) Which prints: - # fss-0000 f_type f_status f_memory f_type_array f_string f_utf f_account f_capability f_color f_console f_control_group f_conversion f_directory f_environment f_execute f_file f_fss f_iki f_limit f_network f_path f_pipe f_print f_signal fl_control_group fl_conversion fl_directory fl_environment fl_execute fl_fss fl_iki fl_print fl_string fll_error fll_execute fll_file fll_fss fll_path fll_print fll_program + # fss-0000 f_type f_status f_memory f_type_array f_string f_utf f_account f_capability f_color f_compare f_console f_control_group f_conversion f_directory f_environment f_execute f_file f_fss f_iki f_limit f_parse f_path f_pipe f_print f_rip f_signal f_thread fl_control_group fl_conversion fl_directory fl_environment fl_execute fl_fss fl_iki fl_path fl_print fll_error fll_execute fll_file fll_fss fll_print fll_program From this list, build the level_0: -# for i in f_type f_status f_memory f_type_array f_string f_utf f_account f_capability f_color f_console f_control_group f_conversion f_directory f_environment f_execute f_file f_fss f_iki f_limit f_network f_path f_pipe f_print f_signal ; do if [[ -f build/disable/level_0/$i.h ]] ; then echo >> build/stand_alone/fake.config.h && cat build/disable/level_0/$i.h >> build/stand_alone/fake.config.h ; fi ; done +# for i in f_type f_status f_memory f_type_array f_string f_utf f_account f_capability f_color f_compare f_console f_control_group f_conversion f_directory f_environment f_execute f_file f_fss f_iki f_limit f_parse f_path f_pipe f_print f_rip f_signal f_thread ; do if [[ -f build/disable/level_0/$i.h ]] ; then echo >> build/stand_alone/fake.config.h && cat build/disable/level_0/$i.h >> build/stand_alone/fake.config.h ; fi ; done From the list, build the level_1: -# for i in fl_control_group fl_conversion fl_directory fl_environment fl_execute fl_fss fl_iki fl_print fl_string ; do if [[ -f build/disable/level_1/$i.h ]] ; then echo >> build/stand_alone/fake.config.h && cat build/disable/level_1/$i.h >> build/stand_alone/fake.config.h ; fi ; done +# for i in fl_control_group fl_conversion fl_directory fl_environment fl_execute fl_fss fl_iki fl_path fl_print ; do if [[ -f build/disable/level_1/$i.h ]] ; then echo >> build/stand_alone/fake.config.h && cat build/disable/level_1/$i.h >> build/stand_alone/fake.config.h ; fi ; done From the list, build the level_2: -# for i in fll_error fll_execute fll_file fll_fss fll_path fll_print fll_program ; do if [[ -f build/disable/level_2/$i.h ]] ; then echo >> build/stand_alone/fake.config.h && cat build/disable/level_2/$i.h >> build/stand_alone/fake.config.h ; fi ; done +# for i in fll_error fll_execute fll_file fll_fss fll_print fll_program ; do if [[ -f build/disable/level_2/$i.h ]] ; then echo >> build/stand_alone/fake.config.h && cat build/disable/level_2/$i.h >> build/stand_alone/fake.config.h ; fi ; done Then compile the stand alone build and comment out each disable causing a compile failure until compilation succeeds. diff --git a/build/disable/level_0/f_fss.h b/build/disable/level_0/f_fss.h index 9b3ed8f..d1c2f97 100644 --- a/build/disable/level_0/f_fss.h +++ b/build/disable/level_0/f_fss.h @@ -1,17 +1,9 @@ #define _di_f_fss_apply_delimit_ #define _di_f_fss_apply_delimit_range_ -#define _di_f_fss_commentss_t_ -#define _di_f_fss_comments_t_ -#define _di_f_fss_comment_t_ #define _di_f_fss_complete_e_ -#define _di_f_fss_contents_t_ -#define _di_f_fss_content_t_ #define _di_f_fss_count_lines_ #define _di_f_fss_count_lines_range_ #define _di_f_fss_default_d_ -#define _di_f_fss_delimitss_t_ -#define _di_f_fss_delimits_t_ -#define _di_f_fss_delimit_t_ #define _di_f_fss_e_ #define _di_f_fss_fail_utf_ #define _di_f_fss_fail_utf_to_false_ @@ -56,8 +48,6 @@ #define _di_f_fss_nests_resize_ #define _di_f_fss_nests_t_ #define _di_f_fss_nest_t_ -#define _di_f_fss_objects_t_ -#define _di_f_fss_object_t_ #define _di_f_fss_payload_s_ #define _di_f_fss_placeholder_s_ #define _di_f_fss_quote_type_e_ @@ -91,6 +81,16 @@ #define _di_f_fss_sets_resize_ #define _di_f_fss_sets_t_ #define _di_f_fss_set_t_ +#define _di_f_fss_simple_packet_d_ +#define _di_f_fss_simple_packet_identify_ +#define _di_f_fss_simple_packet_ranges_adjust_ +#define _di_f_fss_simple_packet_ranges_decimate_by_ +#define _di_f_fss_simple_packet_ranges_decrease_by_ +#define _di_f_fss_simple_packet_ranges_increase_ +#define _di_f_fss_simple_packet_ranges_increase_by_ +#define _di_f_fss_simple_packet_ranges_resize_ +#define _di_f_fss_simple_packet_ranges_t_ +#define _di_f_fss_simple_packet_range_t_ #define _di_f_fss_skip_past_delimit_ #define _di_f_fss_skip_past_space_ #define _di_f_fss_state_flag_e_ diff --git a/build/level_0/settings b/build/level_0/settings index a7cfcc9..2125c29 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -44,7 +44,8 @@ build_sources_library directory.c directory/common.c directory/type.c private-di build_sources_library environment.c build_sources_library execute.c build_sources_library file.c private-file.c file/common.c file/stream.c -build_sources_library fss.c private-fss.c fss/common.c fss/named.c fss/nest.c fss/set.c +build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c +build_sources_library fss/private-item.c fss/private-named.c fss/private-nest.c fss/private-set.c fss/private-set_quote.c fss/private-simple_packet.c build_sources_library iki.c iki/common.c iki/data.c private-iki.c iki/private-data.c build_sources_library limit.c limit/set.c limit/value.c limit/private-set.c limit/private-value.c build_sources_library memory.c private-memory.c memory/structure.c @@ -102,7 +103,7 @@ build_sources_headers directory.h directory/common.h directory/type.h build_sources_headers environment.h environment/common.h build_sources_headers execute.h execute/common.h build_sources_headers file.h file/common.h file/stream.h -build_sources_headers fss.h fss/comment.h fss/common.h fss/delimit.h fss/named.h fss/nest.h fss/quote.h fss/set.h +build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h build_sources_headers iki.h iki/common.h iki/data.h build_sources_headers limit.h limit/set.h limit/value.h build_sources_headers memory.h memory/structure.h memory/common.h diff --git a/build/monolithic/settings b/build/monolithic/settings index 905ebaf..01034ce 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -44,7 +44,8 @@ build_sources_library level_0/directory.c level_0/directory/common.c level_0/dir build_sources_library level_0/environment.c build_sources_library level_0/execute.c build_sources_library level_0/file.c level_0/private-file.c level_0/file/common.c level_0/file/stream.c -build_sources_library level_0/fss.c level_0/private-fss.c level_0/fss/common.c level_0/fss/named.c level_0/fss/nest.c level_0/fss/set.c +build_sources_library level_0/fss.c level_0/fss/common.c level_0/fss/item.c level_0/fss/named.c level_0/fss/nest.c level_0/fss/quote.c level_0/fss/set.c level_0/fss/set_quote.c level_0/fss/simple_packet.c +build_sources_library level_0/fss/private-item.c level_0/fss/private-named.c level_0/fss/private-nest.c level_0/fss/private-set.c level_0/fss/private-set_quote.c level_0/fss/private-simple_packet.c build_sources_library level_0/iki.c level_0/iki/common.c level_0/iki/data.c level_0/private-iki.c level_0/iki/private-data.c build_sources_library level_0/limit.c level_0/limit/set.c level_0/limit/value.c level_0/limit/private-set.c level_0/limit/private-value.c build_sources_library level_0/memory.c level_0/private-memory.c level_0/memory/structure.c @@ -124,7 +125,7 @@ build_sources_headers level_0/directory.h level_0/directory/common.h level_0/dir build_sources_headers level_0/environment.h level_0/environment/common.h build_sources_headers level_0/execute.h level_0/execute/common.h build_sources_headers level_0/file.h level_0/file/common.h level_0/file/stream.h -build_sources_headers level_0/fss.h level_0/fss/comment.h level_0/fss/common.h level_0/fss/delimit.h level_0/fss/named.h level_0/fss/nest.h level_0/fss/quote.h level_0/fss/set.h +build_sources_headers level_0/fss.h level_0/fss/common.h level_0/fss/item.h level_0/fss/named.h level_0/fss/nest.h level_0/fss/quote.h level_0/fss/set.h level_0/fss/set_quote.h level_0/fss/simple_packet.h build_sources_headers level_0/iki.h level_0/iki/common.h level_0/iki/data.h build_sources_headers level_0/limit.h level_0/limit/set.h level_0/limit/value.h build_sources_headers level_0/memory.h level_0/memory/structure.h level_0/memory/common.h diff --git a/build/stand_alone/fake.config.h b/build/stand_alone/fake.config.h index ecc942a..3143057 100644 --- a/build/stand_alone/fake.config.h +++ b/build/stand_alone/fake.config.h @@ -555,18 +555,10 @@ //#define _di_f_fss_apply_delimit_ #define _di_f_fss_apply_delimit_range_ -#define _di_f_fss_commentss_t_ -//#define _di_f_fss_comments_t_ -//#define _di_f_fss_comment_t_ #define _di_f_fss_complete_e_ -//#define _di_f_fss_contents_t_ -//#define _di_f_fss_content_t_ //#define _di_f_fss_count_lines_ #define _di_f_fss_count_lines_range_ //#define _di_f_fss_default_d_ -#define _di_f_fss_delimitss_t_ -//#define _di_f_fss_delimits_t_ -//#define _di_f_fss_delimit_t_ #define _di_f_fss_e_ //#define _di_f_fss_fail_utf_ //#define _di_f_fss_fail_utf_to_false_ @@ -611,8 +603,6 @@ #define _di_f_fss_nests_resize_ #define _di_f_fss_nests_t_ #define _di_f_fss_nest_t_ -//#define _di_f_fss_objects_t_ -//#define _di_f_fss_object_t_ #define _di_f_fss_payload_s_ //#define _di_f_fss_placeholder_s_ //#define _di_f_fss_quote_type_e_ @@ -646,6 +636,16 @@ #define _di_f_fss_sets_resize_ #define _di_f_fss_sets_t_ //#define _di_f_fss_set_t_ +#define _di_f_fss_simple_packet_d_ +#define _di_f_fss_simple_packet_identify_ +#define _di_f_fss_simple_packet_ranges_adjust_ +#define _di_f_fss_simple_packet_ranges_decimate_by_ +#define _di_f_fss_simple_packet_ranges_decrease_by_ +#define _di_f_fss_simple_packet_ranges_increase_ +#define _di_f_fss_simple_packet_ranges_increase_by_ +#define _di_f_fss_simple_packet_ranges_resize_ +#define _di_f_fss_simple_packet_ranges_t_ +#define _di_f_fss_simple_packet_range_t_ //#define _di_f_fss_skip_past_delimit_ //#define _di_f_fss_skip_past_space_ //#define _di_f_fss_state_flag_e_ @@ -1302,6 +1302,7 @@ //#define _di_f_pipe_input_exists_ #define _di_f_pipe_output_exists_ +//#define _di_f_poll_e_ #define _di_f_polls_adjust_ #define _di_f_polls_append_ #define _di_f_polls_append_all_ @@ -1320,7 +1321,6 @@ #define _di_f_pollss_resize_ #define _di_f_pollss_t_ #define _di_f_polls_t_ -//#define _di_f_poll_e_ //#define _di_f_poll_t_ //#define _di_f_print_ #define _di_f_print_character_ @@ -1342,7 +1342,6 @@ #define _di_f_print_dynamic_to_raw_ #define _di_f_print_except_ #define _di_f_print_except_dynamic_ -#define _di_f_print_except_dynamic_in_safely_ #define _di_f_print_except_dynamic_partial_ #define _di_f_print_except_dynamic_partial_raw_ #define _di_f_print_except_dynamic_partial_raw_safely_ diff --git a/build/stand_alone/fake.settings b/build/stand_alone/fake.settings index 56fa4e4..972b5a5 100644 --- a/build/stand_alone/fake.settings +++ b/build/stand_alone/fake.settings @@ -42,7 +42,8 @@ build_sources_program fll/level_0/directory.c fll/level_0/directory/common.c fll build_sources_program fll/level_0/environment.c build_sources_program fll/level_0/execute.c build_sources_program fll/level_0/file.c fll/level_0/private-file.c fll/level_0/file/common.c fll/level_0/file/stream.c -build_sources_program fll/level_0/fss.c fll/level_0/private-fss.c fll/level_0/fss/common.c fll/level_0/fss/named.c fll/level_0/fss/nest.c fll/level_0/fss/set.c +build_sources_program fll/level_0/fss.c fll/level_0/fss/common.c fll/level_0/fss/item.c fll/level_0/fss/named.c fll/level_0/fss/nest.c fll/level_0/fss/quote.c fll/level_0/fss/set.c fll/level_0/fss/set_quote.c fll/level_0/fss/simple_packet.c +build_sources_program fll/level_0/fss/private-item.c fll/level_0/fss/private-named.c fll/level_0/fss/private-nest.c fll/level_0/fss/private-set.c fll/level_0/fss/private-set_quote.c fll/level_0/fss/private-simple_packet.c build_sources_program fll/level_0/iki.c fll/level_0/private-iki.c fll/level_0/iki/common.c fll/level_0/iki/private-data.c fll/level_0/iki/data.c build_sources_program fll/level_0/limit.c fll/level_0/limit/set.c fll/level_0/limit/value.c fll/level_0/limit/private-set.c fll/level_0/limit/private-value.c build_sources_program fll/level_0/memory.c fll/level_0/private-memory.c fll/level_0/memory/structure.c diff --git a/level_0/f_fss/c/fss.c b/level_0/f_fss/c/fss.c index b6e31fc..cf861c6 100644 --- a/level_0/f_fss/c/fss.c +++ b/level_0/f_fss/c/fss.c @@ -1,12 +1,11 @@ #include "fss.h" -#include "private-fss.h" #ifdef __cplusplus extern "C" { #endif #ifndef _di_f_fss_apply_delimit_ - void f_fss_apply_delimit(const f_fss_delimits_t delimits, f_string_static_t * const buffer, f_state_t * const state) { + void f_fss_apply_delimit(const f_number_unsigneds_t delimits, f_string_static_t * const buffer, f_state_t * const state) { #ifndef _di_level_0_parameter_checking_ if (!state) return; @@ -35,7 +34,7 @@ extern "C" { #endif // _di_f_fss_apply_delimit_ #ifndef _di_f_fss_apply_delimit_range_ - void f_fss_apply_delimit_range(const f_fss_delimits_t delimits, const f_string_range_t range, f_string_static_t * const buffer, f_state_t * const state) { + void f_fss_apply_delimit_range(const f_number_unsigneds_t delimits, const f_string_range_t range, f_string_static_t * const buffer, f_state_t * const state) { #ifndef _di_level_0_parameter_checking_ if (!state) return; diff --git a/level_0/f_fss/c/fss.h b/level_0/f_fss/c/fss.h index 18424a4..1ac6cd3 100644 --- a/level_0/f_fss/c/fss.h +++ b/level_0/f_fss/c/fss.h @@ -22,13 +22,14 @@ #include // FLL-0 fss includes. -#include #include -#include -#include +#include #include #include +#include #include +#include +#include #ifdef __cplusplus extern "C" { @@ -53,7 +54,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_fss_apply_delimit_ - extern void f_fss_apply_delimit(const f_fss_delimits_t delimits, f_string_static_t * const buffer, f_state_t * const state); + extern void f_fss_apply_delimit(const f_number_unsigneds_t delimits, f_string_static_t * const buffer, f_state_t * const state); #endif // _di_f_fss_apply_delimit_ /** @@ -77,7 +78,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_fss_apply_delimit_range_ - extern void f_fss_apply_delimit_range(const f_fss_delimits_t delimits, const f_string_range_t range, f_string_static_t * const buffer, f_state_t * const state); + extern void f_fss_apply_delimit_range(const f_number_unsigneds_t delimits, const f_string_range_t range, f_string_static_t * const buffer, f_state_t * const state); #endif // _di_f_fss_apply_delimit_range_ /** diff --git a/level_0/f_fss/c/fss/comment.h b/level_0/f_fss/c/fss/comment.h deleted file mode 100644 index 794716c..0000000 --- a/level_0/f_fss/c/fss/comment.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Defines set data to be used for/by project fss. - * - * This is auto-included by fss.h and should not need to be explicitly included. - */ -#ifndef _F_fss_comment_h -#define _F_fss_comment_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Designate an fss comment location. - */ -#ifndef _di_f_fss_comment_t_ - typedef f_string_range_t f_fss_comment_t; - - #define f_fss_comment_t_initialize f_string_range_t_initialize - - #define macro_f_fss_comment_t_initialize_1(length) macro_f_string_range_t_initialize_2(length) - - #define macro_f_fss_comment_t_clear(comment) macro_f_string_range_t_clear(comment) -#endif // _di_f_fss_comment_t_ - -/** - * An array of f_fss_comment_t. - * - * array: The array of fss quote. - * size: Total amount of allocated space. - * used: Total number of allocated spaces used. - */ -#ifndef _di_f_fss_comments_t_ - typedef f_string_ranges_t f_fss_comments_t; - - #define f_fss_comments_t_initialize f_string_ranges_t_initialize - - #define macro_f_fss_comments_t_initialize_1(array, size, used) macro_f_string_ranges_t_initialize_1(array, size, used) - #define macro_f_fss_comments_t_initialize_2(array, length) macro_f_string_ranges_t_initialize_2(array, length) - - #define f_fss_comments_t_clear(comments) macro_f_string_ranges_t_clear(comments) - - #define macro_f_fss_comments_t_resize(status, comments, length) macro_f_string_ranges_t_resize(status, comments, length) - #define macro_f_fss_comments_t_adjust(status, comments, length) macro_f_string_ranges_t_adjust(status, comments, length) - - #define macro_f_fss_comments_t_delete_simple(comments) macro_f_string_ranges_t_delete_simple(comments) - #define macro_f_fss_comments_t_destroy_simple(comments) macro_f_string_ranges_t_destroy_simple(comments) - - #define macro_f_fss_comments_t_increase(status, step, comments) macro_f_string_ranges_t_increase(status, step, comments) - #define macro_f_fss_comments_t_increase_by(status, comments, amount) macro_f_string_ranges_t_increase_by(status, comments, amount) - #define macro_f_fss_comments_t_decrease_by(status, comments, amount) macro_f_string_ranges_t_decrease_by(status, comments, amount) - #define macro_f_fss_comments_t_decimate_by(status, comments, amount) macro_f_string_ranges_t_decimate_by(status, comments, amount) -#endif // _di_f_fss_comments_t_ - -/** - * An array of f_fss_comments_t. - * - * array: The array of fss quotes. - * size: Total amount of allocated space. - * used: Total number of allocated spaces used. - */ -#ifndef _di_f_fss_commentss_t_ - typedef f_string_rangess_t f_fss_commentss_t; - - #define f_fss_commentss_t_initialize f_string_rangess_t_initialize - - #define macro_f_fss_commentss_t_initialize_1(array, size, used) macro_f_string_rangess_t_initialize_1(array, size, used) - #define macro_f_fss_commentss_t_initialize_2(array, length) macro_f_string_rangess_t_initialize_2(array, length) - - #define macro_f_fss_commentss_t_clear(commentss) macro_f_string_rangess_t_clear(commentss) - - #define macro_f_fss_commentss_t_resize(status, commentss, length) macro_f_string_rangess_t_resize(status, commentss, length) - #define macro_f_fss_commentss_t_adjust(status, commentss, length) macro_f_string_rangess_t_adjust(status, commentss, length) - - #define macro_f_fss_commentss_t_delete_simple(commentss) macro_f_string_rangess_t_delete_simple(commentss) - #define macro_f_fss_commentss_t_destroy_simple(commentss) macro_f_string_rangess_t_destroy_simple(commentss) - - #define macro_f_fss_commentss_t_increase(status, step, commentss) macro_f_string_rangess_t_increase(status, step, commentss) - #define macro_f_fss_commentss_t_increase_by(status, commentss, amount) macro_f_string_rangess_t_increase_by(status, commentss, amount) - #define macro_f_fss_commentss_t_decrease_by(status, commentss, amount) macro_f_string_rangess_t_decrease_by(status, commentss, amount) - #define macro_f_fss_commentss_t_decimate_by(status, commentss, amount) macro_f_string_rangess_t_decimate_by(status, commentss, amount) -#endif // _di_f_fss_commentss_t_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _F_fss_comment_h diff --git a/level_0/f_fss/c/fss/common.h b/level_0/f_fss/c/fss/common.h index 604b658..f212755 100644 --- a/level_0/f_fss/c/fss/common.h +++ b/level_0/f_fss/c/fss/common.h @@ -257,108 +257,6 @@ enum { #endif // _di_f_fss_default_d_ /** - * This is a range that represents an object. - */ -#ifndef _di_f_fss_object_t_ - typedef f_string_range_t f_fss_object_t; - - #define f_fss_object_t_initialize f_string_range_t_initialize - - #define macro_f_fss_object_t_initialize_1(length) macro_f_string_range_t_initialize_2(length) - - #define macro_f_fss_object_t_clear(object) macro_f_string_range_t_clear(object) -#endif // _di_f_fss_object_t_ - -/** - * This holds an array of fss_object. - * - * array: The array of objects. - * size: Total amount of allocated space. - * used: Total number of allocated spaces used. - */ -#ifndef _di_f_fss_objects_t_ - typedef f_string_ranges_t f_fss_objects_t; - - #define f_fss_objects_t_initialize f_string_ranges_t_initialize - - #define macro_f_fss_objects_t_initialize_1(array, size, used) macro_f_string_ranges_t_initialize_1(array, size, used) - #define macro_f_fss_objects_t_initialize_2(array, length) macro_f_string_ranges_t_initialize_2(array, length) - - #define macro_f_fss_objects_t_clear(objects) macro_f_string_ranges_t_clear(objects) - - #define macro_f_fss_objects_t_resize(status, objects, length) macro_f_string_ranges_t_resize(status, objects, length) - #define macro_f_fss_objects_t_adjust(status, objects, length) macro_f_string_ranges_t_adjust(status, objects, length) - - #define macro_f_fss_objects_t_delete_simple(objects) macro_f_string_ranges_t_delete_simple(objects) - #define macro_f_fss_objects_t_destroy_simple(objects) macro_f_string_ranges_t_destroy_simple(objects) - - #define macro_f_fss_objects_t_increase(status, step, objects) macro_f_string_ranges_t_increase(status, step, objects) - #define macro_f_fss_objects_t_increase_by(status, objects, amount) macro_f_string_ranges_t_increase_by(status, objects, amount) - #define macro_f_fss_objects_t_decrease_by(status, objects, amount) macro_f_string_ranges_t_decrease_by(status, objects, amount) - #define macro_f_fss_objects_t_decimate_by(status, objects, amount) macro_f_string_ranges_t_decimate_by(status, objects, amount) -#endif // _di_f_fss_objects_t_ - -/** - * This holds an array of string ranges that represent the content. - * - * The very first string range will represent the first content found. - * - * array: The array of content. - * size: Total amount of allocated space. - * used: Total number of allocated spaces used. - */ -#ifndef _di_f_fss_content_t_ - typedef f_string_ranges_t f_fss_content_t; - - #define f_fss_content_t_initialize f_string_ranges_t_initialize - - #define macro_f_fss_content_t_initialize_1(array, size, used) macro_f_string_ranges_t_initialize_1(array, size, used) - #define macro_f_fss_content_t_initialize_2(array, length) macro_f_string_ranges_t_initialize_2(array, length) - - #define macro_f_fss_content_t_clear(content) macro_f_string_ranges_t_clear(content) - - #define macro_f_fss_content_t_resize(status, content, length) macro_f_string_ranges_t_resize(status, content, length) - #define macro_f_fss_content_t_adjust(status, content, length) macro_f_string_ranges_t_adjust(status, content, length) - - #define macro_f_fss_content_t_delete_simple(content) macro_f_string_ranges_t_delete_simple(content) - #define macro_f_fss_content_t_destroy_simple(content) macro_f_string_ranges_t_destroy_simple(content) - - #define macro_f_fss_content_t_increase(status, step, content) macro_f_string_ranges_t_increase(status, step, content) - #define macro_f_fss_content_t_increase_by(status, content, amount) macro_f_string_ranges_t_increase_by(status, content, amount) - #define macro_f_fss_content_t_decrease_by(status, content, amount) macro_f_string_ranges_t_decrease_by(status, content, amount) - #define macro_f_fss_content_t_decimate_by(status, content, amount) macro_f_string_ranges_t_decimate_by(status, content, amount) -#endif // _di_f_fss_content_t_ - -/** - * This holds an array of fss_content. - * - * array: The array of content arrays. - * size: Total amount of allocated space. - * used: Total number of allocated spaces used. - */ -#ifndef _di_f_fss_contents_t_ - typedef f_string_rangess_t f_fss_contents_t; - - #define f_fss_contents_t_initialize f_string_rangess_t_initialize - - #define macro_f_fss_contents_t_initialize_1(array, size, used) macro_f_string_rangess_t_initialize_1(array, size, used) - #define macro_f_fss_contents_t_initialize_2(array, length) macro_f_string_rangess_t_initialize_2(array, length) - - #define macro_f_fss_contents_t_clear(contents) macro_f_string_rangess_t_clear(contents) - - #define macro_f_fss_contents_t_resize(status, contents, length) macro_f_string_rangess_t_resize(status, contents, length) - #define macro_f_fss_contents_t_adjust(status, contents, length) macro_f_string_rangess_t_adjust(status, contents, length) - - #define macro_f_fss_contents_t_delete_simple(contents) macro_f_string_rangess_t_delete_simple(contents) - #define macro_f_fss_contents_t_destroy_simple(contents) macro_f_string_rangess_t_destroy_simple(contents) - - #define macro_f_fss_contents_t_increase(status, step, contents) macro_f_string_rangess_t_increase(status, step, contents) - #define macro_f_fss_contents_t_increase_by(status, contents, amount) macro_f_string_rangess_t_increase_by(status, contents, amount) - #define macro_f_fss_contents_t_decrease_by(status, contents, amount) macro_f_string_rangess_t_decrease_by(status, contents, amount) - #define macro_f_fss_contents_t_decimate_by(status, contents, amount) macro_f_string_rangess_t_decimate_by(status, contents, amount) -#endif // _di_f_fss_contents_t_ - -/** * State flags associated with FSS functions. * * These flags are meant to be bitwise for the 32-bit f_state_t flag property. diff --git a/level_0/f_fss/c/fss/delimit.c b/level_0/f_fss/c/fss/delimit.c deleted file mode 100644 index 6ee9a40..0000000 --- a/level_0/f_fss/c/fss/delimit.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "../fss.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/c/fss/delimit.h b/level_0/f_fss/c/fss/delimit.h deleted file mode 100644 index 455214f..0000000 --- a/level_0/f_fss/c/fss/delimit.h +++ /dev/null @@ -1,92 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Defines set data to be used for/by project fss. - * - * This is auto-included by fss.h and should not need to be explicitly included. - */ -#ifndef _F_fss_delimit_h -#define _F_fss_delimit_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Designate an fss delimit location. - */ -#ifndef _di_f_fss_delimit_t_ - typedef f_number_unsigned_t f_fss_delimit_t; - - #define f_fss_delimit_t_initialize f_number_unsigned_t_initialize - - #define macro_f_fss_delimit_t_initialize_1(delimit) delimit -#endif // _di_f_fss_delimit_t_ - -/** - * An array of f_fss_delimit_t. - * - * array: The array of fss quote. - * size: Total amount of allocated space. - * used: Total number of allocated spaces used. - */ -#ifndef _di_f_fss_delimits_t_ - typedef f_number_unsigneds_t f_fss_delimits_t; - - #define f_fss_delimits_t_initialize f_number_unsigneds_t_initialize - - #define macro_f_fss_delimits_t_initialize_1(array, size, used) macro_f_number_unsigneds_t_initialize_1(array, size, used) - #define macro_f_fss_delimits_t_initialize_2(array, length) macro_f_number_unsigneds_t_initialize_2(array, length) - - #define macro_f_fss_delimits_t_clear(delimits) macro_f_number_unsigneds_t_clear(delimits) - - #define macro_f_fss_delimits_t_resize(status, delimits, length) macro_f_number_unsigneds_t_resize(status, delimits, length) - #define macro_f_fss_delimits_t_adjust(status, delimits, length) macro_f_number_unsigneds_t_adjust(status, delimits, length) - - #define macro_f_fss_delimits_t_delete_simple(delimits) macro_f_number_unsigneds_t_delete_simple(delimits) - #define macro_f_fss_delimits_t_destroy_simple(delimits) macro_f_number_unsigneds_t_destroy_simple(delimits) - - #define macro_f_fss_delimits_t_increase(status, step, delimits) macro_f_number_unsigneds_t_increase(status, step, delimits) - #define macro_f_fss_delimits_t_increase_by(status, delimits, amount) macro_f_number_unsigneds_t_increase_by(status, delimits, amount) - #define macro_f_fss_delimits_t_decrease_by(status, delimits, amount) macro_f_number_unsigneds_t_decrease_by(status, delimits, amount) - #define macro_f_fss_delimits_t_decimate_by(status, delimits, amount) macro_f_number_unsigneds_t_decimate_by(status, delimits, amount) -#endif // _di_f_fss_delimits_t_ - -/** - * An array of f_fss_delimits_t. - * - * array: The array of fss quotes. - * size: Total amount of allocated space. - * used: Total number of allocated spaces used. - */ -#ifndef _di_f_fss_delimitss_t_ - typedef f_number_unsignedss_t f_fss_delimitss_t; - - #define f_fss_delimitss_t_initialize f_number_unsignedss_t_initialize - - #define macro_f_fss_delimitss_t_initialize_1(array, size, used) macro_f_number_unsignedss_t_initialize_1(array, size, used) - #define macro_f_fss_delimitss_t_initialize_2(array, length) macro_f_number_unsignedss_t_initialize_2(array, length) - - #define macro_f_fss_delimitss_t_clear(delimitss) macro_f_number_unsignedss_t_clear(delimitss) - - #define macro_f_fss_delimitss_t_resize(status, delimitss, length) macro_f_number_unsignedss_t_resize(status, delimitss, length) - #define macro_f_fss_delimitss_t_adjust(status, delimitss, length) macro_f_number_unsignedss_t_adjust(status, delimitss, length) - - #define macro_f_fss_delimitss_t_delete_simple(delimitss) macro_f_number_unsignedss_t_delete_simple(delimitss) - #define macro_f_fss_delimitss_t_destroy_simple(delimitss) macro_f_number_unsignedss_t_destroy_simple(delimitss) - - #define macro_f_fss_delimitss_t_increase(status, step, delimitss) macro_f_number_unsignedss_t_increase(status, step, delimitss) - #define macro_f_fss_delimitss_t_increase_by(status, delimitss, amount) macro_f_number_unsignedss_t_increase_by(status, delimitss, amount) - #define macro_f_fss_delimitss_t_decrease_by(status, delimitss, amount) macro_f_number_unsignedss_t_decrease_by(status, delimitss, amount) - #define macro_f_fss_delimitss_t_decimate_by(status, delimitss, amount) macro_f_number_unsignedss_t_decimate_by(status, delimitss, amount) -#endif // _di_f_fss_delimitss_t_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _F_fss_delimit_h diff --git a/level_0/f_fss/c/fss/item.c b/level_0/f_fss/c/fss/item.c new file mode 100644 index 0000000..ef6325c --- /dev/null +++ b/level_0/f_fss/c/fss/item.c @@ -0,0 +1,96 @@ +#include "../fss.h" +#include "private-item.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_fss_items_adjust_ + f_status_t f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items) { + #ifndef _di_level_0_parameter_checking_ + if (!items) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_items_adjust(length, items); + } +#endif // _di_f_fss_items_adjust_ + +#ifndef _di_f_fss_items_decimate_by_ + f_status_t f_fss_items_decimate_by(const f_number_unsigned_t amount, f_fss_items_t * const items) { + #ifndef _di_level_0_parameter_checking_ + if (!items) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + if (items->size > amount) return private_f_fss_items_adjust(items->size - amount, items); + + return private_f_fss_items_adjust(0, items); + } +#endif // _di_f_fss_items_decimate_by_ + +#ifndef _di_f_fss_items_decrease_by_ + f_status_t f_fss_items_decrease_by(const f_number_unsigned_t amount, f_fss_items_t * const items) { + #ifndef _di_level_0_parameter_checking_ + if (!items) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + if (items->size > amount) return private_f_fss_items_resize(items->size - amount, items); + + return private_f_fss_items_resize(0, items); + } +#endif // _di_f_fss_items_decrease_by_ + +#ifndef _di_f_fss_items_increase_ + f_status_t f_fss_items_increase(const f_number_unsigned_t step, f_fss_items_t * const items) { + #ifndef _di_level_0_parameter_checking_ + if (!items) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (step && items->used + 1 > items->size) { + f_number_unsigned_t size = items->used + step; + + if (size > F_number_t_size_unsigned_d) { + if (items->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + size = F_number_t_size_unsigned_d; + } + + return private_f_fss_items_resize(size, items); + } + + return F_data_not; + } +#endif // _di_f_fss_items_increase_ + +#ifndef _di_f_fss_items_increase_by_ + f_status_t f_fss_items_increase_by(const f_number_unsigned_t amount, f_fss_items_t * const items) { + #ifndef _di_level_0_parameter_checking_ + if (!items) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + + if (items->used + amount > items->size) { + if (items->used + amount > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + return private_f_fss_items_resize(items->used + amount, items); + } + + return F_data_not; + } +#endif // _di_f_fss_items_increase_by_ + +#ifndef _di_f_fss_items_resize_ + f_status_t f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items) { + #ifndef _di_level_0_parameter_checking_ + if (!items) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_items_resize(length, items); + } +#endif // _di_f_fss_items_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss/item.h b/level_0/f_fss/c/fss/item.h new file mode 100644 index 0000000..9f4b58c --- /dev/null +++ b/level_0/f_fss/c/fss/item.h @@ -0,0 +1,253 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines nest data to be used for/by project fss. + * + * This is auto-included by fss.h and should not need to be explicitly included. + */ +#ifndef _F_fss_item_h +#define _F_fss_item_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * This holds a item object and its associated content. + * + * Child content represents content nested within some other content and never represents the top-most content. + * + * To designate that either object or content is non-existent, set start position greater than stop position. + * In particular, set start to 1 and stop to 0. + * + * This does not have resize/adjust macros due to multiple things to potentially resize. + * Any resizing must be manually performed on each applicable property. + * + * Properties: + * - object: The object. + * - content: The content associated with the object. + * - parent: A location referencing a parrent object or content that this object content is nested under. + */ +#ifndef _di_f_fss_item_t_ + typedef struct { + f_string_range_t object; + f_string_ranges_t content; + + f_number_unsigned_t parent; + } f_fss_item_t; + + #define f_fss_item_t_initialize { f_string_range_t_initialize, f_string_ranges_t_initialize, 0 } + + #define macro_f_fss_item_t_initialize_1(object, content, parent) macro_f_number_unsigneds_t_initialize_1(object, content, parent) + + #define macro_f_fss_item_t_clear(item) \ + macro_f_string_range_t_clear(item.object); \ + macro_f_string_ranges_t_clear(item.content); \ + item.parent = 0; + + #define macro_f_fss_item_t_resize(status, item, length) macro_f_string_ranges_t_resize(status, item.content, length) + #define macro_f_fss_item_t_adjust(status, item, length) macro_f_string_ranges_t_adjust(status, item.content, length) + + #define macro_f_fss_item_t_delete_simple(item) macro_f_string_ranges_t_delete_simple(item.content) + #define macro_f_fss_item_t_destroy_simple(item) macro_f_string_ranges_t_destroy_simple(item.content) + + #define macro_f_fss_item_t_increase(status, step, item) macro_f_string_ranges_t_increase(status, step, item.content) + #define macro_f_fss_item_t_increase_by(status, item, amount) macro_f_string_ranges_t_increase_by(status, item.content, amount) + #define macro_f_fss_item_t_decrease_by(status, item, amount) macro_f_string_ranges_t_decrease_by(status, item.content, amount) + #define macro_f_fss_item_t_decimate_by(status, item, amount) macro_f_string_ranges_t_decimate_by(status, item.content, amount) +#endif // _di_f_fss_item_t_ + +/** + * This holds an array of fss_item. + * + * This is designed to be used as a part of f_fss_nest_t. + * + * For example: + * object { + * fss_basic_content before nested content. + * nested_1 { + * Nested content one. + * } + * + * More content in between. + * + * nested_2 { + * Nested content two. + * nested_3 { + * Nested content three. + * } + * } + * + * More content after. + * } + * + * Properties: + * - array: The array of object, their associated content, and their associated parent. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_fss_items_t_ + typedef struct { + f_fss_item_t *array; + + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_fss_items_t; + + #define f_fss_items_t_initialize { 0, 0, 0 } + + #define macro_f_fss_items_t_initialize_1(array, size, used) { array, size, used } + #define macro_f_fss_items_t_initialize_2(array, length) { array, length, length } + + #define macro_f_fss_items_t_clear(items) macro_f_memory_structure_clear(items) + + #define macro_f_fss_items_t_resize(status, items, length) status = f_fss_items_resize(length, &items); + #define macro_f_fss_items_t_adjust(status, items, length) status = f_fss_items_adjust(length, &items); + + #define macro_f_fss_items_t_delete_simple(items) f_fss_items_resize(0, &items); + #define macro_f_fss_items_t_destroy_simple(items) f_fss_items_adjust(0, &items); + + #define macro_f_fss_items_t_increase(status, step, items) status = f_fss_items_increase(step, &items); + #define macro_f_fss_items_t_increase_by(status, items, amount) status = f_fss_items_increase_by(amount, &items); + #define macro_f_fss_items_t_decrease_by(status, items, amount) status = f_fss_items_decrease_by(amount, &items); + #define macro_f_fss_items_t_decimate_by(status, items, amount) status = f_fss_items_decimate_by(amount, &items); +#endif // _di_f_fss_items_t_ + +/** + * Resize the nest array. + * + * @param length + * The new size to use. + * @param items + * The items array to resize. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_items_adjust_ + extern f_status_t f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items); +#endif // _di_f_fss_items_adjust_ + +/** + * Resize the nest array to a smaller size. + * + * This will resize making the array smaller based on (size - given length). + * If the given length is too small, then the resize will fail. + * This will not shrink the size to less than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param items + * The items array to resize. + * + * @return + * F_none on success. + * F_data_not if amount is 0. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_items_decimate_by_ + extern f_status_t f_fss_items_decimate_by(const f_number_unsigned_t amount, f_fss_items_t * const items); +#endif // _di_f_fss_items_decimate_by_ + +/** + * Resize the nest array to a smaller size. + * + * This will resize making the array smaller based on (size - given length). + * If the given length is too small, then the resize will fail. + * This will not shrink the size to less than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param items + * The items array to resize. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_items_decrease_by_ + extern f_status_t f_fss_items_decrease_by(const f_number_unsigned_t amount, f_fss_items_t * const items); +#endif // _di_f_fss_items_decrease_by_ + +/** + * Increase the size of the items array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param items + * The items array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_items_increase_ + extern f_status_t f_fss_items_increase(const f_number_unsigned_t step, f_fss_items_t * const items); +#endif // _di_f_fss_items_increase_ + +/** + * Resize the items array to a larger size. + * + * This will resize making the array larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param items + * The items array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * F_array_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_f_fss_items_increase_by_ + extern f_status_t f_fss_items_increase_by(const f_number_unsigned_t amount, f_fss_items_t * const items); +#endif // _di_f_fss_items_increase_by_ + +/** + * Resize the items array. + * + * @param length + * The new size to use. + * @param items + * The items array to adjust. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_items_resize_ + extern f_status_t f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items); +#endif // _di_f_fss_items_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_fss_item_h diff --git a/level_0/f_fss/c/fss/named.c b/level_0/f_fss/c/fss/named.c index e13eee9..86f81a3 100644 --- a/level_0/f_fss/c/fss/named.c +++ b/level_0/f_fss/c/fss/named.c @@ -1,5 +1,5 @@ #include "../fss.h" -#include "../private-fss.h" +#include "private-named.h" #ifdef __cplusplus extern "C" { @@ -22,10 +22,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (named->objects.size - amount > 0) { - return private_f_fss_named_adjust(named->objects.size - amount, named); - } + if (named->objects.size - amount > 0) return private_f_fss_named_adjust(named->objects.size - amount, named); return private_f_fss_named_adjust(0, named); } @@ -38,10 +35,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (named->objects.size - amount > 0) { - return private_f_fss_named_resize(named->objects.size - amount, named); - } + if (named->objects.size - amount > 0) return private_f_fss_named_resize(named->objects.size - amount, named); return private_f_fss_named_resize(0, named); } @@ -57,9 +51,7 @@ extern "C" { f_number_unsigned_t size = named->objects.used + step; if (size > F_number_t_size_unsigned_d) { - if (named->objects.used + 1 > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (named->objects.used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); size = F_number_t_size_unsigned_d; } @@ -80,9 +72,7 @@ extern "C" { if (!amount) return F_data_not; if (named->objects.used + amount > named->objects.size) { - if (named->objects.used + amount > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (named->objects.used + amount > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); return private_f_fss_named_resize(named->objects.used + amount, named); } @@ -118,10 +108,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (nameds->size > amount) { - return private_f_fss_nameds_adjust(nameds->size - amount, nameds); - } + if (nameds->size > amount) return private_f_fss_nameds_adjust(nameds->size - amount, nameds); return private_f_fss_nameds_adjust(0, nameds); } @@ -134,10 +121,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (nameds->size > amount) { - return private_f_fss_nameds_resize(nameds->size - amount, nameds); - } + if (nameds->size > amount) return private_f_fss_nameds_resize(nameds->size - amount, nameds); return private_f_fss_nameds_resize(0, nameds); } @@ -153,9 +137,7 @@ extern "C" { f_number_unsigned_t size = nameds->used + step; if (size > F_number_t_size_unsigned_d) { - if (nameds->used + 1 > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (nameds->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); size = F_number_t_size_unsigned_d; } @@ -176,9 +158,7 @@ extern "C" { if (!amount) return F_data_not; if (nameds->used + amount > nameds->size) { - if (nameds->used + amount > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (nameds->used + amount > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); return private_f_fss_nameds_resize(nameds->used + amount, nameds); } diff --git a/level_0/f_fss/c/fss/named.h b/level_0/f_fss/c/fss/named.h index 4a94597..fbd9da6 100644 --- a/level_0/f_fss/c/fss/named.h +++ b/level_0/f_fss/c/fss/named.h @@ -30,21 +30,21 @@ extern "C" { */ #ifndef _di_f_fss_named_t_ typedef struct { - f_fss_object_t name; + f_string_range_t name; - f_fss_objects_t objects; - f_fss_contents_t contents; + f_string_ranges_t objects; + f_string_rangess_t contents; f_uint8ss_t quotess; } f_fss_named_t; - #define f_fss_named_t_initialize { f_fss_object_t_initialize, f_fss_objects_t_initialize, f_fss_contents_t_initialize, f_uint8ss_t_initialize } + #define f_fss_named_t_initialize { f_string_range_t_initialize, f_string_ranges_t_initialize, f_string_rangess_t_initialize, f_uint8ss_t_initialize } #define macro_f_fss_named_t_initialize_1(name, objects, contents, quotess) macro_f_number_unsigneds_t_initialize_1(name, objects, contents, quotess) #define macro_f_fss_named_t_clear(named) \ - macro_f_fss_object_t_clear(named.name) \ - macro_f_fss_objects_t_clear(named.objects) \ - macro_f_fss_contents_t_clear(named.contents) \ + macro_f_string_range_t_clear(named.name) \ + macro_f_string_ranges_t_clear(named.objects) \ + macro_f_string_rangess_t_clear(named.contents) \ macro_f_uint8ss_t_clear(named.quotess) #define macro_f_fss_named_t_resize(status, named, length) status = f_fss_named_resize(length, &named); diff --git a/level_0/f_fss/c/fss/nest.c b/level_0/f_fss/c/fss/nest.c index eebc1d9..973e122 100644 --- a/level_0/f_fss/c/fss/nest.c +++ b/level_0/f_fss/c/fss/nest.c @@ -1,106 +1,11 @@ #include "../fss.h" -#include "../private-fss.h" +#include "private-item.h" +#include "private-nest.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_fss_items_adjust_ - f_status_t f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items) { - #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_items_adjust(length, items); - } -#endif // _di_f_fss_items_adjust_ - -#ifndef _di_f_fss_items_decimate_by_ - f_status_t f_fss_items_decimate_by(const f_number_unsigned_t amount, f_fss_items_t * const items) { - #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - if (items->size > amount) { - return private_f_fss_items_adjust(items->size - amount, items); - } - - return private_f_fss_items_adjust(0, items); - } -#endif // _di_f_fss_items_decimate_by_ - -#ifndef _di_f_fss_items_decrease_by_ - f_status_t f_fss_items_decrease_by(const f_number_unsigned_t amount, f_fss_items_t * const items) { - #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - if (items->size > amount) { - return private_f_fss_items_resize(items->size - amount, items); - } - - return private_f_fss_items_resize(0, items); - } -#endif // _di_f_fss_items_decrease_by_ - -#ifndef _di_f_fss_items_increase_ - f_status_t f_fss_items_increase(const f_number_unsigned_t step, f_fss_items_t * const items) { - #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && items->used + 1 > items->size) { - f_number_unsigned_t size = items->used + step; - - if (size > F_number_t_size_unsigned_d) { - if (items->used + 1 > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_number_t_size_unsigned_d; - } - - return private_f_fss_items_resize(size, items); - } - - return F_data_not; - } -#endif // _di_f_fss_items_increase_ - -#ifndef _di_f_fss_items_increase_by_ - f_status_t f_fss_items_increase_by(const f_number_unsigned_t amount, f_fss_items_t * const items) { - #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - if (items->used + amount > items->size) { - if (items->used + amount > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_fss_items_resize(items->used + amount, items); - } - - return F_data_not; - } -#endif // _di_f_fss_items_increase_by_ - -#ifndef _di_f_fss_items_resize_ - f_status_t f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items) { - #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_items_resize(length, items); - } -#endif // _di_f_fss_items_resize_ - #ifndef _di_f_fss_nest_adjust_ f_status_t f_fss_nest_adjust(const f_number_unsigned_t length, f_fss_nest_t * const nest) { #ifndef _di_level_0_parameter_checking_ @@ -118,10 +23,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (nest->size > amount) { - return private_f_fss_nest_adjust(nest->size - amount, nest); - } + if (nest->size > amount) return private_f_fss_nest_adjust(nest->size - amount, nest); return private_f_fss_nest_adjust(0, nest); } @@ -134,10 +36,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (nest->size > amount) { - return private_f_fss_nest_resize(nest->size - amount, nest); - } + if (nest->size > amount) return private_f_fss_nest_resize(nest->size - amount, nest); return private_f_fss_nest_resize(0, nest); } @@ -153,9 +52,7 @@ extern "C" { f_number_unsigned_t size = nest->used + step; if (size > F_number_t_size_unsigned_d) { - if (nest->used + 1 > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (nest->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); size = F_number_t_size_unsigned_d; } @@ -176,9 +73,7 @@ extern "C" { if (!amount) return F_data_not; if (nest->used + amount > nest->size) { - if (nest->used + amount > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (nest->used + amount > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); return private_f_fss_nest_resize(nest->used + amount, nest); } @@ -214,10 +109,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (nests->size > amount) { - return private_f_fss_nests_adjust(nests->size - amount, nests); - } + if (nests->size > amount) return private_f_fss_nests_adjust(nests->size - amount, nests); return private_f_fss_nests_adjust(0, nests); } @@ -230,10 +122,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (nests->size > amount) { - return private_f_fss_nests_resize(nests->size - amount, nests); - } + if (nests->size > amount) return private_f_fss_nests_resize(nests->size - amount, nests); return private_f_fss_nests_resize(0, nests); } @@ -249,9 +138,7 @@ extern "C" { f_number_unsigned_t size = nests->used + step; if (size > F_number_t_size_unsigned_d) { - if (nests->used + 1 > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (nests->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); size = F_number_t_size_unsigned_d; } @@ -272,9 +159,7 @@ extern "C" { if (!amount) return F_data_not; if (nests->used + amount > nests->size) { - if (nests->used + amount > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (nests->used + amount > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); return private_f_fss_nests_resize(nests->used + amount, nests); } diff --git a/level_0/f_fss/c/fss/nest.h b/level_0/f_fss/c/fss/nest.h index bff95e0..497fd8f 100644 --- a/level_0/f_fss/c/fss/nest.h +++ b/level_0/f_fss/c/fss/nest.h @@ -17,107 +17,6 @@ extern "C" { #endif /** - * This holds a item object and its associated content. - * - * Child content represents content nested within some other content and never represents the top-most content. - * - * To designate that either object or content is non-existent, set start position greater than stop position. - * In particular, set start to 1 and stop to 0. - * - * This does not have resize/adjust macros due to multiple things to potentially resize. - * Any resizing must be manually performed on each applicable property. - * - * Properties: - * - object: The object. - * - content: The content associated with the object. - * - parent: A location referencing a parrent object or content that this object content is nested under. - */ -#ifndef _di_f_fss_item_t_ - typedef struct { - f_fss_object_t object; - f_fss_content_t content; - - f_number_unsigned_t parent; - } f_fss_item_t; - - #define f_fss_item_t_initialize { f_fss_object_t_initialize, f_fss_content_t_initialize, 0 } - - #define macro_f_fss_item_t_initialize_1(object, content, parent) macro_f_number_unsigneds_t_initialize_1(object, content, parent) - - #define macro_f_fss_item_t_clear(item) \ - macro_f_fss_object_t_clear(item.object); \ - macro_f_fss_content_t_clear(item.content); \ - item.parent = 0; - - #define macro_f_fss_item_t_resize(status, item, length) macro_f_fss_content_t_resize(status, item.content, length) - #define macro_f_fss_item_t_adjust(status, item, length) macro_f_fss_content_t_adjust(status, item.content, length) - - #define macro_f_fss_item_t_delete_simple(item) macro_f_fss_content_t_delete_simple(item.content) - #define macro_f_fss_item_t_destroy_simple(item) macro_f_fss_content_t_destroy_simple(item.content) - - #define macro_f_fss_item_t_increase(status, step, item) macro_f_fss_content_t_increase(status, step, item.content) - #define macro_f_fss_item_t_increase_by(status, item, amount) macro_f_fss_content_t_increase_by(status, item.content, amount) - #define macro_f_fss_item_t_decrease_by(status, item, amount) macro_f_fss_content_t_decrease_by(status, item.content, amount) - #define macro_f_fss_item_t_decimate_by(status, item, amount) macro_f_fss_content_t_decimate_by(status, item.content, amount) -#endif // _di_f_fss_item_t_ - -/** - * This holds an array of fss_item. - * - * This is designed to be used as a part of f_fss_nest_t. - * - * For example: - * object { - * fss_basic_content before nested content. - * nested_1 { - * Nested content one. - * } - * - * More content in between. - * - * nested_2 { - * Nested content two. - * nested_3 { - * Nested content three. - * } - * } - * - * More content after. - * } - * - * Properties: - * - array: The array of object, their associated content, and their associated parent. - * - size: Total amount of allocated space. - * - used: Total number of allocated spaces used. - */ -#ifndef _di_f_fss_items_t_ - typedef struct { - f_fss_item_t *array; - - f_number_unsigned_t size; - f_number_unsigned_t used; - } f_fss_items_t; - - #define f_fss_items_t_initialize { 0, 0, 0 } - - #define macro_f_fss_items_t_initialize_1(array, size, used) { array, size, used } - #define macro_f_fss_items_t_initialize_2(array, length) { array, length, length } - - #define macro_f_fss_items_t_clear(items) macro_f_memory_structure_clear(items) - - #define macro_f_fss_items_t_resize(status, items, length) status = f_fss_items_resize(length, &items); - #define macro_f_fss_items_t_adjust(status, items, length) status = f_fss_items_adjust(length, &items); - - #define macro_f_fss_items_t_delete_simple(items) f_fss_items_resize(0, &items); - #define macro_f_fss_items_t_destroy_simple(items) f_fss_items_adjust(0, &items); - - #define macro_f_fss_items_t_increase(status, step, items) status = f_fss_items_increase(step, &items); - #define macro_f_fss_items_t_increase_by(status, items, amount) status = f_fss_items_increase_by(amount, &items); - #define macro_f_fss_items_t_decrease_by(status, items, amount) status = f_fss_items_decrease_by(amount, &items); - #define macro_f_fss_items_t_decimate_by(status, items, amount) status = f_fss_items_decimate_by(amount, &items); -#endif // _di_f_fss_items_t_ - -/** * This holds an array of f_fss_items_t. * * Each array row represents the nesting depth. @@ -196,135 +95,6 @@ extern "C" { * * @param length * The new size to use. - * @param items - * The items array to resize. - * - * @return - * F_none on success. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_items_adjust_ - extern f_status_t f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items); -#endif // _di_f_fss_items_adjust_ - -/** - * Resize the nest array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param items - * The items array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_items_decimate_by_ - extern f_status_t f_fss_items_decimate_by(const f_number_unsigned_t amount, f_fss_items_t * const items); -#endif // _di_f_fss_items_decimate_by_ - -/** - * Resize the nest array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param items - * The items array to resize. - * - * @return - * F_none on success. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_items_decrease_by_ - extern f_status_t f_fss_items_decrease_by(const f_number_unsigned_t amount, f_fss_items_t * const items); -#endif // _di_f_fss_items_decrease_by_ - -/** - * Increase the size of the items array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param items - * The items array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_items_increase_ - extern f_status_t f_fss_items_increase(const f_number_unsigned_t step, f_fss_items_t * const items); -#endif // _di_f_fss_items_increase_ - -/** - * Resize the items array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param items - * The items array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_array_too_large (with error bit) if the new array length is too large. - */ -#ifndef _di_f_fss_items_increase_by_ - extern f_status_t f_fss_items_increase_by(const f_number_unsigned_t amount, f_fss_items_t * const items); -#endif // _di_f_fss_items_increase_by_ - -/** - * Resize the items array. - * - * @param length - * The new size to use. - * @param items - * The items array to adjust. - * - * @return - * F_none on success. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_items_resize_ - extern f_status_t f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items); -#endif // _di_f_fss_items_resize_ - -/** - * Resize the nest array. - * - * @param length - * The new size to use. * @param nest * The nest array to resize. * diff --git a/level_0/f_fss/c/fss/private-item.c b/level_0/f_fss/c/fss/private-item.c new file mode 100644 index 0000000..39c8e39 --- /dev/null +++ b/level_0/f_fss/c/fss/private-item.c @@ -0,0 +1,58 @@ +#include "../fss.h" +#include "private-item.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) + f_status_t private_f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < items->size; ++i) { + + status = f_string_ranges_adjust(0, &items->array[i].content); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_adjust(items->size, length, sizeof(f_fss_item_t), (void **) & items->array); + if (F_status_is_error(status)) return status; + + items->size = length; + + if (items->used > items->size) { + items->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) + +#if !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_) + f_status_t private_f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < items->size; ++i) { + + status = f_string_ranges_resize(0, &items->array[i].content); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_resize(items->size, length, sizeof(f_fss_item_t), (void **) & items->array); + if (F_status_is_error(status)) return status; + + items->size = length; + + if (items->used > items->size) { + items->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss/private-item.h b/level_0/f_fss/c/fss/private-item.h new file mode 100644 index 0000000..1e6b7cf --- /dev/null +++ b/level_0/f_fss/c/fss/private-item.h @@ -0,0 +1,76 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_fss_item_h +#define _PRIVATE_F_fss_item_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param items + * The items to adjust. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_fss_item_t_adjust(). + * Errors (with error bit) from: f_memory_adjust(). + * + * @see macro_f_fss_item_t_adjust() + * + * @see f_fss_items_adjust() + * @see f_fss_items_decimate_by() + * @see f_memory_adjust() + */ +#if !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) + extern f_status_t private_f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param items + * The items to resize. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_fss_item_t_resize(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see macro_f_fss_item_t_resize() + * + * @see f_fss_items_decrease_by() + * @see f_fss_items_increase() + * @see f_fss_items_increase_by() + * @see f_fss_items_resize() + * @see f_memory_resize() + */ +#if !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_) + extern f_status_t private_f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_fss_item_h diff --git a/level_0/f_fss/c/fss/private-named.c b/level_0/f_fss/c/fss/private-named.c new file mode 100644 index 0000000..1c3dddb --- /dev/null +++ b/level_0/f_fss/c/fss/private-named.c @@ -0,0 +1,90 @@ +#include "../fss.h" +#include "private-named.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) + f_status_t private_f_fss_named_adjust(const f_number_unsigned_t length, f_fss_named_t * const named) { + + f_status_t status = f_string_ranges_adjust(length, &named->objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_adjust(length, &named->contents); + if (F_status_is_error(status)) return status; + + status = f_uint8ss_adjust(length, &named->quotess); + if (F_status_is_error(status)) return status; + + return F_none; + } +#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) + +#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) + f_status_t private_f_fss_named_resize(const f_number_unsigned_t length, f_fss_named_t * const named) { + + f_status_t status = f_string_ranges_resize(length, &named->objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_resize(length, &named->contents); + if (F_status_is_error(status)) return status; + + status = f_uint8ss_resize(length, &named->quotess); + if (F_status_is_error(status)) return status; + + return F_none; + } +#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) + +#if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) + f_status_t private_f_fss_nameds_adjust(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < nameds->size; ++i) { + + status = private_f_fss_named_adjust(0, &nameds->array[i]); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_adjust(nameds->size, length, sizeof(f_fss_named_t), (void **) & nameds->array); + if (F_status_is_error(status)) return status; + + nameds->size = length; + + if (nameds->used > nameds->size) { + nameds->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) + +#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) + f_status_t private_f_fss_nameds_resize(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < nameds->size; ++i) { + + status = private_f_fss_named_resize(0, &nameds->array[i]); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_resize(nameds->size, length, sizeof(f_fss_named_t), (void **) & nameds->array); + if (F_status_is_error(status)) return status; + + nameds->size = length; + + if (nameds->used > nameds->size) { + nameds->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss/private-named.h b/level_0/f_fss/c/fss/private-named.h new file mode 100644 index 0000000..aab003f --- /dev/null +++ b/level_0/f_fss/c/fss/private-named.h @@ -0,0 +1,134 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_fss_named_h +#define _PRIVATE_F_fss_named_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param named + * The named to adjust. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_ranges_t_adjust(). + * Errors (with error bit) from: macro_f_string_rangess_t_adjust(). + * Errors (with error bit) from: macro_f_uint8ss_t_adjust(). + * + * @see macro_f_string_ranges_t_adjust() + * @see macro_f_string_rangess_t_adjust() + * @see macro_f_uint8ss_t_adjust() + * + * @see f_fss_nameds_adjust() + * @see f_fss_nameds_decimate_by() + */ +#if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) + extern f_status_t private_f_fss_named_adjust(const f_number_unsigned_t length, f_fss_named_t * const named) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param named + * The named to resize. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_ranges_t_resize(). + * Errors (with error bit) from: macro_f_string_rangess_t_resize(). + * Errors (with error bit) from: macro_f_uint8ss_t_resize(). + * + * @see macro_f_string_ranges_t_resize() + * @see macro_f_string_rangess_t_resize() + * @see macro_f_uint8ss_t_resize() + * + * @see f_fss_nameds_decrease_by() + * @see f_fss_nameds_incease() + * @see f_fss_nameds_incease_by() + * @see f_fss_nameds_resize() + */ +#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) + extern f_status_t private_f_fss_named_resize(const f_number_unsigned_t length, f_fss_named_t * const named) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param nameds + * The nameds to adjust. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: private_f_fss_named_adjust(). + * + * @see private_f_fss_named_adjust() + * + * @see f_fss_nameds_adjust() + * @see f_fss_nameds_decimate_by() + * @see f_memory_adjust() + */ +#if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) + extern f_status_t private_f_fss_nameds_adjust(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param nameds + * The nameds to resize. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * Errors (with error bit) from: private_f_fss_named_resize(). + * + * @see private_f_fss_named_resize() + * + * @see f_fss_nameds_decrease_by() + * @see f_fss_nameds_increase() + * @see f_fss_nameds_increase_by() + * @see f_fss_nameds_resize() + * @see f_memory_resize() + */ +#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) + extern f_status_t private_f_fss_nameds_resize(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_fss_named_h diff --git a/level_0/f_fss/c/fss/private-nest.c b/level_0/f_fss/c/fss/private-nest.c new file mode 100644 index 0000000..ce719a1 --- /dev/null +++ b/level_0/f_fss/c/fss/private-nest.c @@ -0,0 +1,107 @@ +#include "../fss.h" +#include "private-item.h" +#include "private-nest.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) + f_status_t private_f_fss_nest_adjust(const f_number_unsigned_t length, f_fss_nest_t * const nest) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < nest->size; ++i) { + + status = private_f_fss_items_adjust(0, &nest->depth[i]); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_adjust(nest->size, length, sizeof(f_fss_items_t), (void **) & nest->depth); + if (F_status_is_error(status)) return status; + + nest->size = length; + + if (nest->used > nest->size) { + nest->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) + +#if !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_increase_) || !defined(_di_f_fss_nest_increase_by_) || !defined(_di_f_fss_nest_resize_) + f_status_t private_f_fss_nest_resize(const f_number_unsigned_t length, f_fss_nest_t * const nest) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < nest->size; ++i) { + + status = private_f_fss_items_resize(0, &nest->depth[i]); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_resize(nest->size, length, sizeof(f_fss_items_t), (void **) & nest->depth); + if (F_status_is_error(status)) return status; + + nest->size = length; + + if (nest->used > nest->size) { + nest->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_increase_) || !defined(_di_f_fss_nest_increase_by_) || !defined(_di_f_fss_nest_resize_) + +#if !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) + f_status_t private_f_fss_nests_adjust(const f_number_unsigned_t length, f_fss_nests_t *nests) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < nests->size; ++i) { + + status = private_f_fss_nest_adjust(0, &nests->array[i]); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_adjust(nests->size, length, sizeof(f_fss_nest_t), (void **) & nests->array); + if (F_status_is_error(status)) return status; + + nests->size = length; + + if (nests->used > nests->size) { + nests->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) + +#if !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_) + f_status_t private_f_fss_nests_resize(const f_number_unsigned_t length, f_fss_nests_t * const nests) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < nests->size; ++i) { + + status = private_f_fss_nest_resize(0, &nests->array[i]); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_resize(nests->size, length, sizeof(f_fss_nest_t), (void **) & nests->array); + if (F_status_is_error(status)) return status; + + nests->size = length; + + if (nests->used > nests->size) { + nests->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss/private-nest.h b/level_0/f_fss/c/fss/private-nest.h new file mode 100644 index 0000000..c38577e --- /dev/null +++ b/level_0/f_fss/c/fss/private-nest.h @@ -0,0 +1,130 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_fss_nest_h +#define _PRIVATE_F_fss_nest_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param nest + * The nest to adjust. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: macro_f_fss_nest_t_adjust(). + * + * @see macro_f_fss_nest_t_adjust() + * + * @see f_fss_nest_adjust() + * @see f_fss_nest_decimate_by() + * @see f_memory_adjust() + */ +#if !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) + extern f_status_t private_f_fss_nest_adjust(const f_number_unsigned_t length, f_fss_nest_t * const nest) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param nest + * The nest to resize. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * Errors (with error bit) from: macro_f_fss_nest_t_resize(). + * + * @see macro_f_fss_nest_t_resize() + * + * @see f_fss_nest_decrease_by() + * @see f_fss_nest_increase() + * @see f_fss_nest_increase_by() + * @see f_fss_nest_resize() + * @see f_memory_resize() + */ +#if !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_increase_) || !defined(_di_f_fss_nest_increase_by_) || !defined(_di_f_fss_nest_resize_) + extern f_status_t private_f_fss_nest_resize(const f_number_unsigned_t length, f_fss_nest_t * const nest) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_increase_) || !defined(_di_f_fss_nest_increase_by_) || !defined(_di_f_fss_nest_resize_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param nests + * The nests to adjust. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: macro_f_fss_nest_t_adjust(). + * + * @see macro_f_fss_nest_t_adjust() + * + * @see f_fss_nests_adjust() + * @see f_fss_nests_decimate_by() + * @see f_memory_adjust() + */ +#if !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) + extern f_status_t private_f_fss_nests_adjust(const f_number_unsigned_t length, f_fss_nests_t * const nests) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param nests + * The nests to resize. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * Errors (with error bit) from: macro_f_fss_nest_t_resize(). + * + * @see macro_f_fss_nest_t_resize() + * + * @see f_fss_nests_decrease_by() + * @see f_fss_nests_increase() + * @see f_fss_nests_increase_by() + * @see f_fss_nests_resize() + * @see f_memory_resize() + */ +#if !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_) + extern f_status_t private_f_fss_nests_resize(const f_number_unsigned_t length, f_fss_nests_t * const nests) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_fss_nest_h diff --git a/level_0/f_fss/c/fss/private-set.c b/level_0/f_fss/c/fss/private-set.c new file mode 100644 index 0000000..e0472e1 --- /dev/null +++ b/level_0/f_fss/c/fss/private-set.c @@ -0,0 +1,90 @@ +#include "../fss.h" +#include "private-set.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) + f_status_t private_f_fss_set_adjust(const f_number_unsigned_t length, f_fss_set_t * const set) { + + f_status_t status = f_string_ranges_adjust(length, &set->objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_adjust(length, &set->contents); + if (F_status_is_error(status)) return status; + + return F_none; + } +#endif // !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) + +#if !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_) + f_status_t private_f_fss_set_resize(const f_number_unsigned_t length, f_fss_set_t *set) { + + f_status_t status = f_string_ranges_resize(length, &set->objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_resize(length, &set->contents); + if (F_status_is_error(status)) return status; + + return F_none; + } +#endif // !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_) + +#if !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) + f_status_t private_f_fss_sets_adjust(const f_number_unsigned_t length, f_fss_sets_t * const sets) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < sets->size; ++i) { + + status = f_string_ranges_adjust(0, &sets->array[i].objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_adjust(0, &sets->array[i].contents); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_adjust(sets->size, length, sizeof(f_fss_set_t), (void **) & sets->array); + if (F_status_is_error(status)) return status; + + sets->size = length; + + if (sets->used > sets->size) { + sets->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) + +#if !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_increase_) || !defined(_di_f_fss_sets_increase_by_) || !defined(_di_f_fss_sets_resize_) + f_status_t private_f_fss_sets_resize(const f_number_unsigned_t length, f_fss_sets_t * const sets) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < sets->size; ++i) { + + status = f_string_ranges_resize(0, &sets->array[i].objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_resize(0, &sets->array[i].contents); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_resize(sets->size, length, sizeof(f_fss_set_t), (void **) & sets->array); + if (F_status_is_error(status)) return status; + + sets->size = length; + + if (sets->used > sets->size) { + sets->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_increase_) || !defined(_di_f_fss_sets_increase_by_) || !defined(_di_f_fss_sets_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss/private-set.h b/level_0/f_fss/c/fss/private-set.h new file mode 100644 index 0000000..6c67ed3 --- /dev/null +++ b/level_0/f_fss/c/fss/private-set.h @@ -0,0 +1,134 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_fss_set_h +#define _PRIVATE_F_fss_set_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param set + * The set to adjust. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_rangess_t_adjust(). + * Errors (with error bit) from: macro_f_string_ranges_t_adjust(). + * + * @see macro_f_string_rangess_t_adjust() + * @see macro_f_string_ranges_t_adjust() + * + * @see f_fss_set_adjust() + * @see f_fss_set_decimate_by() + */ +#if !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) + extern f_status_t private_f_fss_set_adjust(const f_number_unsigned_t length, f_fss_set_t * const set) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param set + * The set to resize. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_rangess_t_resize(). + * Errors (with error bit) from: macro_f_string_ranges_t_resize(). + * + * @see macro_f_string_rangess_t_resize() + * @see macro_f_string_ranges_t_resize() + * + * @see f_fss_set_decrease_by() + * @see f_fss_set_increase() + * @see f_fss_set_increase_by() + * @see f_fss_set_resize() + */ +#if !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_) + extern f_status_t private_f_fss_set_resize(const f_number_unsigned_t length, f_fss_set_t * const set) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param sets + * The sets to adjust. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_rangess_t_adjust(). + * Errors (with error bit) from: macro_f_string_ranges_t_adjust(). + * Errors (with error bit) from: f_memory_adjust(). + * + * @see macro_f_string_rangess_t_adjust() + * @see macro_f_string_ranges_t_adjust() + * + * @see f_fss_sets_adjust() + * @see f_fss_sets_decimate_by() + * @see f_memory_adjust() + */ +#if !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) + extern f_status_t private_f_fss_sets_adjust(const f_number_unsigned_t length, f_fss_sets_t * const sets) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param sets + * The sets to resize. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_rangess_t_resize(). + * Errors (with error bit) from: macro_f_string_ranges_t_resize(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see macro_f_string_rangess_t_resize() + * @see macro_f_string_ranges_t_resize() + * + * @see f_fss_sets_decrease_by() + * @see f_fss_sets_increase() + * @see f_fss_sets_increase_by() + * @see f_fss_sets_resize() + * @see f_memory_resize() + */ +#if !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_increase_) || !defined(_di_f_fss_sets_increase_by_) || !defined(_di_f_fss_sets_resize_) + extern f_status_t private_f_fss_sets_resize(const f_number_unsigned_t length, f_fss_sets_t * const sets) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_increase_) || !defined(_di_f_fss_sets_increase_by_) || !defined(_di_f_fss_sets_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_fss_set_h diff --git a/level_0/f_fss/c/fss/private-set_quote.c b/level_0/f_fss/c/fss/private-set_quote.c new file mode 100644 index 0000000..ee93a96 --- /dev/null +++ b/level_0/f_fss/c/fss/private-set_quote.c @@ -0,0 +1,114 @@ +#include "../fss.h" +#include "private-set_quote.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) + f_status_t private_f_fss_set_quote_adjust(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) { + + f_status_t status = f_string_ranges_adjust(length, &set_quote->objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_adjust(length, &set_quote->contents); + if (F_status_is_error(status)) return status; + + status = f_uint8s_adjust(length, &set_quote->objects_quote); + if (F_status_is_error(status)) return status; + + status = f_uint8ss_adjust(length, &set_quote->contents_quote); + if (F_status_is_error(status)) return status; + + return F_none; + } +#endif // !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) + +#if !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_) + f_status_t private_f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) { + + f_status_t status = f_string_ranges_resize(length, &set_quote->objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_resize(length, &set_quote->contents); + if (F_status_is_error(status)) return status; + + status = f_uint8s_resize(length, &set_quote->objects_quote); + if (F_status_is_error(status)) return status; + + status = f_uint8ss_resize(length, &set_quote->contents_quote); + if (F_status_is_error(status)) return status; + + return F_none; + } +#endif // !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_) + +#if !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) + f_status_t private_f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < set_quotes->size; ++i) { + + status = f_string_ranges_adjust(0, &set_quotes->array[i].objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_adjust(0, &set_quotes->array[i].contents); + if (F_status_is_error(status)) return status; + + status = f_uint8s_adjust(0, &set_quotes->array[i].objects_quote); + if (F_status_is_error(status)) return status; + + status = f_uint8ss_adjust(0, &set_quotes->array[i].contents_quote); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_adjust(set_quotes->size, length, sizeof(f_fss_set_quote_t), (void **) & set_quotes->array); + if (F_status_is_error(status)) return status; + + set_quotes->size = length; + + if (set_quotes->used > set_quotes->size) { + set_quotes->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) + +#if !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_increase_) || !defined(_di_f_fss_set_quotes_increase_by_) || !defined(_di_f_fss_set_quotes_resize_) + f_status_t private_f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) { + + f_status_t status = F_none; + + for (f_number_unsigned_t i = length; i < set_quotes->size; ++i) { + + status = f_string_ranges_resize(0, &set_quotes->array[i].objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_resize(0, &set_quotes->array[i].contents); + if (F_status_is_error(status)) return status; + + status = f_uint8s_resize(0, &set_quotes->array[i].objects_quote); + if (F_status_is_error(status)) return status; + + status = f_uint8ss_resize(0, &set_quotes->array[i].contents_quote); + if (F_status_is_error(status)) return status; + } // for + + status = f_memory_resize(set_quotes->size, length, sizeof(f_fss_set_quote_t), (void **) & set_quotes->array); + if (F_status_is_error(status)) return status; + + set_quotes->size = length; + + if (set_quotes->used > set_quotes->size) { + set_quotes->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_increase_) || !defined(_di_f_fss_set_quotes_increase_by_) || !defined(_di_f_fss_set_quotes_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss/private-set_quote.h b/level_0/f_fss/c/fss/private-set_quote.h new file mode 100644 index 0000000..2e285ec --- /dev/null +++ b/level_0/f_fss/c/fss/private-set_quote.h @@ -0,0 +1,150 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_fss_set_quote_h +#define _PRIVATE_F_fss_set_quote_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param set_quote + * The set_quote to adjust. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_rangess_t_adjust(). + * Errors (with error bit) from: macro_f_string_ranges_t_adjust(). + * Errors (with error bit) from: macro_f_uint8s_t_adjust(). + * Errors (with error bit) from: macro_f_uint8ss_t_adjust(). + * + * @see macro_f_string_rangess_t_adjust() + * @see macro_f_string_ranges_t_adjust() + * @see macro_f_uint8s_t_adjust() + * @see macro_f_uint8ss_t_adjust() + * + * @see f_fss_set_quote_adjust() + * @see f_fss_set_quote_decimate_by() + */ +#if !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) + extern f_status_t private_f_fss_set_quote_adjust(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param set_quote + * The set_quote to resize. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_rangess_t_resize(). + * Errors (with error bit) from: macro_f_string_ranges_t_resize(). + * Errors (with error bit) from: macro_f_uint8s_t_resize(). + * Errors (with error bit) from: macro_f_uint8ss_t_resize(). + * + * @see macro_f_string_rangess_t_resize() + * @see macro_f_string_ranges_t_resize() + * @see macro_f_uint8s_t_resize() + * @see macro_f_uint8ss_t_resize() + * + * @see f_fss_set_quote_decrease_by() + * @see f_fss_set_quote_increase() + * @see f_fss_set_quote_increase_by() + * @see f_fss_set_quote_resize() + */ +#if !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_) + extern f_status_t private_f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param set_quotes + * The set_quotes to adjust. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_rangess_t_adjust(). + * Errors (with error bit) from: macro_f_string_ranges_t_adjust(). + * Errors (with error bit) from: macro_f_uint8s_t_adjust(). + * Errors (with error bit) from: macro_f_uint8ss_t_adjust(). + * Errors (with error bit) from: f_memory_adjust(). + * + * @see macro_f_string_rangess_t_adjust() + * @see macro_f_string_ranges_t_adjust() + * @see macro_f_uint8s_t_adjust() + * @see macro_f_uint8ss_t_adjust() + * + * @see f_fss_set_quotes_adjust() + * @see f_fss_set_quotes_decimate_by() + * @see f_memory_adjust() + */ +#if !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) + extern f_status_t private_f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param set_quotes + * The set_quotes to resize. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_rangess_t_resize(). + * Errors (with error bit) from: macro_f_string_ranges_t_resize(). + * Errors (with error bit) from: macro_f_uint8s_t_resize(). + * Errors (with error bit) from: macro_f_uint8ss_t_resize(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see macro_f_string_rangess_t_resize() + * @see macro_f_string_ranges_t_resize() + * @see macro_f_uint8s_t_resize() + * @see macro_f_uint8ss_t_resize() + * + * @see f_fss_set_quotes_decrease_by() + * @see f_fss_set_quotes_increase() + * @see f_fss_set_quotes_increase_by() + * @see f_fss_set_quotes_resize() + * @see f_memory_resize() + */ +#if !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_increase_) || !defined(_di_f_fss_set_quotes_increase_by_) || !defined(_di_f_fss_set_quotes_resize_) + extern f_status_t private_f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_increase_) || !defined(_di_f_fss_set_quotes_increase_by_) || !defined(_di_f_fss_set_quotes_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_fss_set_quote_h diff --git a/level_0/f_fss/c/fss/private-simple_packet.c b/level_0/f_fss/c/fss/private-simple_packet.c new file mode 100644 index 0000000..348d5e1 --- /dev/null +++ b/level_0/f_fss/c/fss/private-simple_packet.c @@ -0,0 +1,42 @@ +#include "../fss.h" +#include "private-simple_packet.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_fss_simple_packet_ranges_adjust_) || !defined(_di_f_fss_simple_packet_ranges_decimate_by_) + f_status_t private_f_fss_simple_packet_ranges_adjust(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t * const simple_packet_ranges) { + + const f_status_t status = f_memory_adjust(simple_packet_ranges->size, length, sizeof(f_fss_simple_packet_range_t), (void **) & simple_packet_ranges->array); + if (F_status_is_error(status)) return status; + + simple_packet_ranges->size = length; + + if (simple_packet_ranges->used > simple_packet_ranges->size) { + simple_packet_ranges->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_simple_packet_ranges_adjust_) || !defined(_di_f_fss_simple_packet_ranges_decimate_by_) + +#if !defined(_di_f_fss_simple_packet_ranges_decrease_by_) || !defined(_di_f_fss_simple_packet_ranges_increase_) || !defined(_di_f_fss_simple_packet_ranges_increase_by_) || !defined(_di_f_fss_simple_packet_ranges_resize_) + f_status_t private_f_fss_simple_packet_ranges_resize(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t * const simple_packet_ranges) { + + const f_status_t status = f_memory_resize(simple_packet_ranges->size, length, sizeof(f_fss_simple_packet_range_t), (void **) & simple_packet_ranges->array); + if (F_status_is_error(status)) return status; + + simple_packet_ranges->size = length; + + if (simple_packet_ranges->used > simple_packet_ranges->size) { + simple_packet_ranges->used = length; + } + + return F_none; + } +#endif // !defined(_di_f_fss_simple_packet_ranges_decrease_by_) || !defined(_di_f_fss_simple_packet_ranges_increase_) || !defined(_di_f_fss_simple_packet_ranges_increase_by_) || !defined(_di_f_fss_simple_packet_ranges_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss/private-simple_packet.h b/level_0/f_fss/c/fss/private-simple_packet.h new file mode 100644 index 0000000..e41e417 --- /dev/null +++ b/level_0/f_fss/c/fss/private-simple_packet.h @@ -0,0 +1,88 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_fss_simple_packet_h +#define _PRIVATE_F_fss_simple_packet_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param simple_packet_ranges + * The simple_packet_ranges to adjust. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_rangess_t_adjust(). + * Errors (with error bit) from: macro_f_string_ranges_t_adjust(). + * Errors (with error bit) from: macro_f_uint8s_t_adjust(). + * Errors (with error bit) from: macro_f_uint8ss_t_adjust(). + * Errors (with error bit) from: f_memory_adjust(). + * + * @see macro_f_string_rangess_t_adjust() + * @see macro_f_string_ranges_t_adjust() + * @see macro_f_uint8s_t_adjust() + * @see macro_f_uint8ss_t_adjust() + * + * @see f_fss_simple_packet_ranges_adjust() + * @see f_fss_simple_packet_ranges_decimate_by() + * @see f_memory_adjust() + */ +#if !defined(_di_f_fss_simple_packet_ranges_adjust_) || !defined(_di_f_fss_simple_packet_ranges_decimate_by_) + extern f_status_t private_f_fss_simple_packet_ranges_adjust(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t * const simple_packet_ranges) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_simple_packet_ranges_adjust_) || !defined(_di_f_fss_simple_packet_ranges_decimate_by_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param simple_packet_ranges + * The simple_packet_ranges to resize. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: macro_f_string_rangess_t_resize(). + * Errors (with error bit) from: macro_f_string_ranges_t_resize(). + * Errors (with error bit) from: macro_f_uint8s_t_resize(). + * Errors (with error bit) from: macro_f_uint8ss_t_resize(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see macro_f_string_rangess_t_resize() + * @see macro_f_string_ranges_t_resize() + * @see macro_f_uint8s_t_resize() + * @see macro_f_uint8ss_t_resize() + * + * @see f_fss_simple_packet_ranges_decrease_by() + * @see f_fss_simple_packet_ranges_increase() + * @see f_fss_simple_packet_ranges_increase_by() + * @see f_fss_simple_packet_ranges_resize() + * @see f_memory_resize() + */ +#if !defined(_di_f_fss_simple_packet_ranges_decrease_by_) || !defined(_di_f_fss_simple_packet_ranges_increase_) || !defined(_di_f_fss_simple_packet_ranges_increase_by_) || !defined(_di_f_fss_simple_packet_ranges_resize_) + extern f_status_t private_f_fss_simple_packet_ranges_resize(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t * const simple_packet_ranges) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_fss_simple_packet_ranges_decrease_by_) || !defined(_di_f_fss_simple_packet_ranges_increase_) || !defined(_di_f_fss_simple_packet_ranges_increase_by_) || !defined(_di_f_fss_simple_packet_ranges_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_fss_simple_packet_h diff --git a/level_0/f_fss/c/fss/comment.c b/level_0/f_fss/c/fss/quote.c similarity index 100% rename from level_0/f_fss/c/fss/comment.c rename to level_0/f_fss/c/fss/quote.c diff --git a/level_0/f_fss/c/fss/set.c b/level_0/f_fss/c/fss/set.c index 2cdac5d..3f4b59f 100644 --- a/level_0/f_fss/c/fss/set.c +++ b/level_0/f_fss/c/fss/set.c @@ -1,5 +1,5 @@ #include "../fss.h" -#include "../private-fss.h" +#include "private-set.h" #ifdef __cplusplus extern "C" { @@ -22,10 +22,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (set->objects.size - amount > 0) { - return private_f_fss_set_adjust(set->objects.size - amount, set); - } + if (set->objects.size - amount > 0) return private_f_fss_set_adjust(set->objects.size - amount, set); return private_f_fss_set_adjust(0, set); } @@ -38,10 +35,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (set->objects.size - amount > 0) { - return private_f_fss_set_resize(set->objects.size - amount, set); - } + if (set->objects.size - amount > 0) return private_f_fss_set_resize(set->objects.size - amount, set); return private_f_fss_set_resize(0, set); } @@ -57,9 +51,7 @@ extern "C" { f_number_unsigned_t size = set->objects.used + step; if (size > F_number_t_size_unsigned_d) { - if (set->objects.used + 1 > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (set->objects.used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); size = F_number_t_size_unsigned_d; } @@ -80,9 +72,7 @@ extern "C" { if (!amount) return F_data_not; if (set->objects.used + amount > set->objects.size) { - if (set->objects.used + amount > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (set->objects.used + amount > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); return private_f_fss_set_resize(set->objects.used + amount, set); } @@ -101,198 +91,6 @@ extern "C" { } #endif // _di_f_fss_set_resize_ -#ifndef _di_f_fss_set_quote_adjust_ - f_status_t f_fss_set_quote_adjust(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quote) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_set_quote_adjust(length, set_quote); - } -#endif // _di_f_fss_set_quote_adjust_ - -#ifndef _di_f_fss_set_quote_decimate_by_ - f_status_t f_fss_set_quote_decimate_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quote) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - if (set_quote->objects.size - amount > 0) { - return private_f_fss_set_quote_adjust(set_quote->objects.size - amount, set_quote); - } - - return private_f_fss_set_quote_adjust(0, set_quote); - } -#endif // _di_f_fss_set_quote_decimate_by_ - -#ifndef _di_f_fss_set_quote_decrease_by_ - f_status_t f_fss_set_quote_decrease_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quote) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - if (set_quote->objects.size - amount > 0) { - return private_f_fss_set_quote_resize(set_quote->objects.size - amount, set_quote); - } - - return private_f_fss_set_quote_resize(0, set_quote); - } -#endif // _di_f_fss_set_quote_decrease_by_ - -#ifndef _di_f_fss_set_quote_increase_ - f_status_t f_fss_set_quote_increase(const f_number_unsigned_t step, f_fss_set_quote_t * const set_quote) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quote) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && set_quote->objects.used + 1 > set_quote->objects.size) { - f_number_unsigned_t size = set_quote->objects.used + step; - - if (size > F_number_t_size_unsigned_d) { - if (set_quote->objects.used + 1 > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_number_t_size_unsigned_d; - } - - return private_f_fss_set_quote_resize(size, set_quote); - } - - return F_data_not; - } -#endif // _di_f_fss_set_quote_increase_ - -#ifndef _di_f_fss_set_quote_increase_by_ - f_status_t f_fss_set_quote_increase_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quote) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - if (set_quote->objects.used + amount > set_quote->objects.size) { - if (set_quote->objects.used + amount > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_fss_set_quote_resize(set_quote->objects.used + amount, set_quote); - } - - return F_data_not; - } -#endif // _di_f_fss_set_quote_increase_by_ - -#ifndef _di_f_fss_set_quote_resize_ - f_status_t f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quote) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_set_quote_resize(length, set_quote); - } -#endif // _di_f_fss_set_quote_resize_ - -#ifndef _di_f_fss_set_quotes_adjust_ - f_status_t f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_set_quotes_adjust(length, set_quotes); - } -#endif // _di_f_fss_set_quotes_adjust_ - -#ifndef _di_f_fss_set_quotes_decimate_by_ - f_status_t f_fss_set_quotes_decimate_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - if (set_quotes->size - amount > 0) { - return private_f_fss_set_quotes_adjust(set_quotes->size - amount, set_quotes); - } - - return private_f_fss_set_quotes_adjust(0, set_quotes); - } -#endif // _di_f_fss_set_quotes_decimate_by_ - -#ifndef _di_f_fss_set_quotes_decrease_by_ - f_status_t f_fss_set_quotes_decrease_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - if (set_quotes->size - amount > 0) { - return private_f_fss_set_quotes_resize(set_quotes->size - amount, set_quotes); - } - - return private_f_fss_set_quotes_resize(0, set_quotes); - } -#endif // _di_f_fss_set_quotes_decrease_by_ - -#ifndef _di_f_fss_set_quotes_increase_ - f_status_t f_fss_set_quotes_increase(const f_number_unsigned_t step, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && set_quotes->used + 1 > set_quotes->size) { - f_number_unsigned_t size = set_quotes->used + step; - - if (size > F_number_t_size_unsigned_d) { - if (set_quotes->used + 1 > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_number_t_size_unsigned_d; - } - - return private_f_fss_set_quotes_resize(size, set_quotes); - } - - return F_data_not; - } -#endif // _di_f_fss_set_quotes_increase_ - -#ifndef _di_f_fss_set_quotes_increase_by_ - f_status_t f_fss_set_quotes_increase_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - if (set_quotes->used + amount > set_quotes->size) { - if (set_quotes->used + amount > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_fss_set_quotes_resize(set_quotes->used + amount, set_quotes); - } - - return F_data_not; - } -#endif // _di_f_fss_set_quotes_increase_by_ - -#ifndef _di_f_fss_set_quotes_resize_ - f_status_t f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_set_quotes_resize(length, set_quotes); - } -#endif // _di_f_fss_set_quotes_resize_ - #ifndef _di_f_fss_sets_adjust_ f_status_t f_fss_sets_adjust(const f_number_unsigned_t length, f_fss_sets_t *sets) { #ifndef _di_level_0_parameter_checking_ @@ -310,10 +108,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (sets->size - amount > 0) { - return private_f_fss_sets_adjust(sets->size - amount, sets); - } + if (sets->size - amount > 0) return private_f_fss_sets_adjust(sets->size - amount, sets); return private_f_fss_sets_adjust(0, sets); } @@ -326,10 +121,7 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (!amount) return F_data_not; - - if (sets->size - amount > 0) { - return private_f_fss_sets_resize(sets->size - amount, sets); - } + if (sets->size - amount > 0) return private_f_fss_sets_resize(sets->size - amount, sets); return private_f_fss_sets_resize(0, sets); } @@ -345,9 +137,7 @@ extern "C" { f_number_unsigned_t size = sets->used + step; if (size > F_number_t_size_unsigned_d) { - if (sets->used + 1 > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (sets->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); size = F_number_t_size_unsigned_d; } @@ -368,9 +158,7 @@ extern "C" { if (!amount) return F_data_not; if (sets->used + amount > sets->size) { - if (sets->used + amount > F_number_t_size_unsigned_d) { - return F_status_set_error(F_array_too_large); - } + if (sets->used + amount > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); return private_f_fss_sets_resize(sets->used + amount, sets); } diff --git a/level_0/f_fss/c/fss/set.h b/level_0/f_fss/c/fss/set.h index 5343e6f..cd834fc 100644 --- a/level_0/f_fss/c/fss/set.h +++ b/level_0/f_fss/c/fss/set.h @@ -28,17 +28,17 @@ extern "C" { */ #ifndef _di_f_fss_set_t_ typedef struct { - f_fss_objects_t objects; - f_fss_contents_t contents; + f_string_ranges_t objects; + f_string_rangess_t contents; } f_fss_set_t; - #define f_fss_set_t_initialize { f_fss_objects_t_initialize, f_fss_contents_t_initialize } + #define f_fss_set_t_initialize { f_string_ranges_t_initialize, f_string_rangess_t_initialize } #define macro_f_fss_set_t_initialize_1(objects, contents) { objects, contents } #define macro_f_fss_set_t_clear(set) \ - macro_f_fss_objects_t_clear(set.objects) \ - macro_f_fss_contents_t_clear(set.contents) + macro_f_string_ranges_t_clear(set.objects) \ + macro_f_string_rangess_t_clear(set.contents) #define macro_f_fss_set_t_resize(status, set, length) status = f_fss_set_resize(length, &set); #define macro_f_fss_set_t_adjust(status, set, length) status = f_fss_set_adjust(length, &set); @@ -88,84 +88,6 @@ extern "C" { #endif // _di_f_fss_sets_t_ /** - * This holds an fss object with a set of fss content, along with their quote types. - * - * The objects, contents, and quotes should each be of the same used and size. - * Any deviation to this would require implementing custom equivelents to the standard management macros. - * - * Properties: - * - objects: The array of objects. - * - contents: The array of contents. - * - objects_quote: The array of objects quote types. - * - contents_quote: The array of contents quote types. - */ -#ifndef _di_f_fss_set_quote_t_ - typedef struct { - f_fss_objects_t objects; - f_fss_contents_t contents; - - f_uint8s_t objects_quote; - f_uint8ss_t contents_quote; - } f_fss_set_quote_t; - - #define f_fss_set_quote_t_initialize { f_fss_objects_t_initialize, f_fss_contents_t_initialize, f_uint8s_t_initialize, f_uint8ss_t_initialize } - - #define macro_f_fss_set_quote_t_initialize_1(objects, contents, objects_quote, contents_quote) { objects, contents, objects_quote, contents_quote } - - #define macro_f_fss_set_quote_t_clear(set) \ - macro_f_fss_objects_t_clear(set.objects) \ - macro_f_fss_contents_t_clear(set.contents) \ - macro_f_uint8s_t_clear(set.objects_quote) \ - macro_f_uint8ss_t_clear(set.contents_quote) - - #define macro_f_fss_set_quote_t_resize(status, set_quote, length) status = f_fss_set_quote_resize(length, &set_quote); - #define macro_f_fss_set_quote_t_adjust(status, set_quote, length) status = f_fss_set_quote_adjust(length, &set_quote); - - #define macro_f_fss_set_quote_t_delete_simple(set_quote) f_fss_set_quote_resize(0, &set_quote); - #define macro_f_fss_set_quote_t_destroy_simple(set_quote) f_fss_set_quote_adjust(0, &set_quote); - - #define macro_f_fss_set_quote_t_increase(status, step, set_quote) status = f_fss_set_quote_increase(step, &set_quote); - #define macro_f_fss_set_quote_t_increase_by(status, set_quote, amount) status = f_fss_set_quote_increase_by(amount, &set_quote); - #define macro_f_fss_set_quote_t_decrease_by(status, set_quote, amount) status = f_fss_set_quote_decrease_by(amount, &set_quote); - #define macro_f_fss_set_quote_t_decimate_by(status, set_quote, amount) status = f_fss_set_quote_decimate_by(amount, &set_quote); -#endif // _di_f_fss_set_quote_t_ - -/** - * This holds an array of f_fss_set_quote_t. - * - * Properties: - * - array: An array of f_fss_set_quote_t. - * - size: Total amount of allocated space. - * - used: Total number of allocated spaces used. - */ -#ifndef _di_f_fss_set_quotes_t_ - typedef struct { - f_fss_set_quote_t *array; - - f_number_unsigned_t size; - f_number_unsigned_t used; - } f_fss_set_quotes_t; - - #define f_fss_set_quotes_t_initialize { 0, 0, 0 } - - #define macro_f_fss_set_quotes_t_initialize_1(array, size, used) { array, size, used } - #define macro_f_fss_set_quotes_t_initialize_2(array, length) { array, length, length } - - #define macro_f_fss_set_quotes_t_clear(nameds) macro_f_memory_structure_clear(nameds) - - #define macro_f_fss_set_quotes_t_resize(status, set_quotes, length) status = f_fss_set_quotes_resize(length, &set_quotes); - #define macro_f_fss_set_quotes_t_adjust(status, set_quotes, length) status = f_fss_set_quotes_adjust(length, &set_quotes); - - #define macro_f_fss_set_quotes_t_delete_simple(set_quotes) f_fss_set_quotes_resize(0, &set_quotes); - #define macro_f_fss_set_quotes_t_destroy_simple(set_quotes) f_fss_set_quotes_adjust(0, &set_quotes); - - #define macro_f_fss_set_quotes_t_increase(status, step, set_quotes) status = f_fss_set_quotes_increase(step, &set_quotes); - #define macro_f_fss_set_quotes_t_increase_by(status, set_quotes, amount) status = f_fss_set_quotes_increase_by(amount, &set_quotes); - #define macro_f_fss_set_quotes_t_decrease_by(status, set_quotes, amount) status = f_fss_set_quotes_decrease_by(amount, &set_quotes); - #define macro_f_fss_set_quotes_t_decimate_by(status, set_quotes, amount) status = f_fss_set_quotes_decimate_by(amount, &set_quotes); -#endif // _di_f_fss_set_quotes_t_ - -/** * Resize the set array. * * @param length @@ -295,264 +217,6 @@ extern "C" { #endif // _di_f_fss_set_resize_ /** - * Resize the set_quote array. - * - * @param length - * The new size to use. - * @param set_quote - * The set_quote array to resize. - * - * @return - * F_none on success. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_set_quote_adjust_ - extern f_status_t f_fss_set_quote_adjust(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_adjust_ - -/** - * Resize the set_quote array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param set_quote - * The set_quote array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_set_quote_decimate_by_ - extern f_status_t f_fss_set_quote_decimate_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_decimate_by_ - -/** - * Resize the set_quote array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param set_quote - * The set_quote array to resize. - * - * @return - * F_none on success. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_set_quote_decrease_by_ - extern f_status_t f_fss_set_quote_decrease_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_decrease_by_ - -/** - * Increase the size of the set_quote array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set_quote max buffer size (F_number_t_size_unsigned_d). - * If already set_quote to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param set_quote - * The set_quote array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_set_quote_increase_ - extern f_status_t f_fss_set_quote_increase(const f_number_unsigned_t step, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_increase_ - -/** - * Resize the set_quote array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set_quote max buffer size (F_number_t_size_unsigned_d). - * If already set_quote to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param set_quote - * The set_quote array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_array_too_large (with error bit) if the new array length is too large. - */ -#ifndef _di_f_fss_set_quote_increase_by_ - extern f_status_t f_fss_set_quote_increase_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_increase_by_ - -/** - * Resize the set_quote array. - * - * @param length - * The new size to use. - * @param set_quote - * The set_quote array to adjust. - * - * @return - * F_none on success. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_set_quote_resize_ - extern f_status_t f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_resize_ - -/** - * Resize the set_quote array. - * - * @param length - * The new size to use. - * @param set_quotes - * The set_quotes array to resize. - * - * @return - * F_none on success. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_set_quotes_adjust_ - extern f_status_t f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_adjust_ - -/** - * Resize the set_quote array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param set_quotes - * The set_quotes array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_set_quotes_decimate_by_ - extern f_status_t f_fss_set_quotes_decimate_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_decimate_by_ - -/** - * Resize the set_quote array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param set_quotes - * The set_quotes array to resize. - * - * @return - * F_none on success. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_set_quotes_decrease_by_ - extern f_status_t f_fss_set_quotes_decrease_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_decrease_by_ - -/** - * Increase the size of the set_quotes array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param set_quotes - * The set_quotes array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_set_quotes_increase_ - extern f_status_t f_fss_set_quotes_increase(const f_number_unsigned_t step, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_increase_ - -/** - * Resize the set_quotes array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param set_quotes - * The set_quotes array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_array_too_large (with error bit) if the new array length is too large. - */ -#ifndef _di_f_fss_set_quotes_increase_by_ - extern f_status_t f_fss_set_quotes_increase_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_increase_by_ - -/** - * Resize the set_quotes array. - * - * @param length - * The new size to use. - * @param set_quotes - * The set_quotes array to adjust. - * - * @return - * F_none on success. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_set_quotes_resize_ - extern f_status_t f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_resize_ - -/** * Resize the set array. * * @param length diff --git a/level_0/f_fss/c/fss/set_quote.c b/level_0/f_fss/c/fss/set_quote.c new file mode 100644 index 0000000..29b74be --- /dev/null +++ b/level_0/f_fss/c/fss/set_quote.c @@ -0,0 +1,182 @@ +#include "../fss.h" +#include "private-set_quote.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_fss_set_quote_adjust_ + f_status_t f_fss_set_quote_adjust(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quote) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_set_quote_adjust(length, set_quote); + } +#endif // _di_f_fss_set_quote_adjust_ + +#ifndef _di_f_fss_set_quote_decimate_by_ + f_status_t f_fss_set_quote_decimate_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quote) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + if (set_quote->objects.size - amount > 0) return private_f_fss_set_quote_adjust(set_quote->objects.size - amount, set_quote); + + return private_f_fss_set_quote_adjust(0, set_quote); + } +#endif // _di_f_fss_set_quote_decimate_by_ + +#ifndef _di_f_fss_set_quote_decrease_by_ + f_status_t f_fss_set_quote_decrease_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quote) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + if (set_quote->objects.size - amount > 0) return private_f_fss_set_quote_resize(set_quote->objects.size - amount, set_quote); + + return private_f_fss_set_quote_resize(0, set_quote); + } +#endif // _di_f_fss_set_quote_decrease_by_ + +#ifndef _di_f_fss_set_quote_increase_ + f_status_t f_fss_set_quote_increase(const f_number_unsigned_t step, f_fss_set_quote_t * const set_quote) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quote) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (step && set_quote->objects.used + 1 > set_quote->objects.size) { + f_number_unsigned_t size = set_quote->objects.used + step; + + if (size > F_number_t_size_unsigned_d) { + if (set_quote->objects.used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + size = F_number_t_size_unsigned_d; + } + + return private_f_fss_set_quote_resize(size, set_quote); + } + + return F_data_not; + } +#endif // _di_f_fss_set_quote_increase_ + +#ifndef _di_f_fss_set_quote_increase_by_ + f_status_t f_fss_set_quote_increase_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quote) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + + if (set_quote->objects.used + amount > set_quote->objects.size) { + if (set_quote->objects.used + amount > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + return private_f_fss_set_quote_resize(set_quote->objects.used + amount, set_quote); + } + + return F_data_not; + } +#endif // _di_f_fss_set_quote_increase_by_ + +#ifndef _di_f_fss_set_quote_resize_ + f_status_t f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quote) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_set_quote_resize(length, set_quote); + } +#endif // _di_f_fss_set_quote_resize_ + +#ifndef _di_f_fss_set_quotes_adjust_ + f_status_t f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quotes) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_set_quotes_adjust(length, set_quotes); + } +#endif // _di_f_fss_set_quotes_adjust_ + +#ifndef _di_f_fss_set_quotes_decimate_by_ + f_status_t f_fss_set_quotes_decimate_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quotes) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + if (set_quotes->size - amount > 0) return private_f_fss_set_quotes_adjust(set_quotes->size - amount, set_quotes); + + return private_f_fss_set_quotes_adjust(0, set_quotes); + } +#endif // _di_f_fss_set_quotes_decimate_by_ + +#ifndef _di_f_fss_set_quotes_decrease_by_ + f_status_t f_fss_set_quotes_decrease_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quotes) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + if (set_quotes->size - amount > 0) return private_f_fss_set_quotes_resize(set_quotes->size - amount, set_quotes); + + return private_f_fss_set_quotes_resize(0, set_quotes); + } +#endif // _di_f_fss_set_quotes_decrease_by_ + +#ifndef _di_f_fss_set_quotes_increase_ + f_status_t f_fss_set_quotes_increase(const f_number_unsigned_t step, f_fss_set_quotes_t * const set_quotes) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quotes) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (step && set_quotes->used + 1 > set_quotes->size) { + f_number_unsigned_t size = set_quotes->used + step; + + if (size > F_number_t_size_unsigned_d) { + if (set_quotes->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + size = F_number_t_size_unsigned_d; + } + + return private_f_fss_set_quotes_resize(size, set_quotes); + } + + return F_data_not; + } +#endif // _di_f_fss_set_quotes_increase_ + +#ifndef _di_f_fss_set_quotes_increase_by_ + f_status_t f_fss_set_quotes_increase_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quotes) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + + if (set_quotes->used + amount > set_quotes->size) { + if (set_quotes->used + amount > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + return private_f_fss_set_quotes_resize(set_quotes->used + amount, set_quotes); + } + + return F_data_not; + } +#endif // _di_f_fss_set_quotes_increase_by_ + +#ifndef _di_f_fss_set_quotes_resize_ + f_status_t f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) { + #ifndef _di_level_0_parameter_checking_ + if (!set_quotes) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_set_quotes_resize(length, set_quotes); + } +#endif // _di_f_fss_set_quotes_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss/set_quote.h b/level_0/f_fss/c/fss/set_quote.h new file mode 100644 index 0000000..cf9480d --- /dev/null +++ b/level_0/f_fss/c/fss/set_quote.h @@ -0,0 +1,359 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines set data to be used for/by project fss. + * + * This is auto-included by fss.h and should not need to be explicitly included. + */ +#ifndef _F_fss_set_quote_h +#define _F_fss_set_quote_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * This holds an fss object with a set of fss content, along with their quote types. + * + * The objects, contents, and quotes should each be of the same used and size. + * Any deviation to this would require implementing custom equivelents to the standard management macros. + * + * Properties: + * - objects: The array of objects. + * - contents: The array of contents. + * - objects_quote: The array of objects quote types. + * - contents_quote: The array of contents quote types. + */ +#ifndef _di_f_fss_set_quote_t_ + typedef struct { + f_string_ranges_t objects; + f_string_rangess_t contents; + + f_uint8s_t objects_quote; + f_uint8ss_t contents_quote; + } f_fss_set_quote_t; + + #define f_fss_set_quote_t_initialize { f_string_ranges_t_initialize, f_string_rangess_t_initialize, f_uint8s_t_initialize, f_uint8ss_t_initialize } + + #define macro_f_fss_set_quote_t_initialize_1(objects, contents, objects_quote, contents_quote) { objects, contents, objects_quote, contents_quote } + + #define macro_f_fss_set_quote_t_clear(set) \ + macro_f_string_ranges_t_clear(set.objects) \ + macro_f_string_rangess_t_clear(set.contents) \ + macro_f_uint8s_t_clear(set.objects_quote) \ + macro_f_uint8ss_t_clear(set.contents_quote) + + #define macro_f_fss_set_quote_t_resize(status, set_quote, length) status = f_fss_set_quote_resize(length, &set_quote); + #define macro_f_fss_set_quote_t_adjust(status, set_quote, length) status = f_fss_set_quote_adjust(length, &set_quote); + + #define macro_f_fss_set_quote_t_delete_simple(set_quote) f_fss_set_quote_resize(0, &set_quote); + #define macro_f_fss_set_quote_t_destroy_simple(set_quote) f_fss_set_quote_adjust(0, &set_quote); + + #define macro_f_fss_set_quote_t_increase(status, step, set_quote) status = f_fss_set_quote_increase(step, &set_quote); + #define macro_f_fss_set_quote_t_increase_by(status, set_quote, amount) status = f_fss_set_quote_increase_by(amount, &set_quote); + #define macro_f_fss_set_quote_t_decrease_by(status, set_quote, amount) status = f_fss_set_quote_decrease_by(amount, &set_quote); + #define macro_f_fss_set_quote_t_decimate_by(status, set_quote, amount) status = f_fss_set_quote_decimate_by(amount, &set_quote); +#endif // _di_f_fss_set_quote_t_ + +/** + * This holds an array of f_fss_set_quote_t. + * + * Properties: + * - array: An array of f_fss_set_quote_t. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_fss_set_quotes_t_ + typedef struct { + f_fss_set_quote_t *array; + + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_fss_set_quotes_t; + + #define f_fss_set_quotes_t_initialize { 0, 0, 0 } + + #define macro_f_fss_set_quotes_t_initialize_1(array, size, used) { array, size, used } + #define macro_f_fss_set_quotes_t_initialize_2(array, length) { array, length, length } + + #define macro_f_fss_set_quotes_t_clear(nameds) macro_f_memory_structure_clear(nameds) + + #define macro_f_fss_set_quotes_t_resize(status, set_quotes, length) status = f_fss_set_quotes_resize(length, &set_quotes); + #define macro_f_fss_set_quotes_t_adjust(status, set_quotes, length) status = f_fss_set_quotes_adjust(length, &set_quotes); + + #define macro_f_fss_set_quotes_t_delete_simple(set_quotes) f_fss_set_quotes_resize(0, &set_quotes); + #define macro_f_fss_set_quotes_t_destroy_simple(set_quotes) f_fss_set_quotes_adjust(0, &set_quotes); + + #define macro_f_fss_set_quotes_t_increase(status, step, set_quotes) status = f_fss_set_quotes_increase(step, &set_quotes); + #define macro_f_fss_set_quotes_t_increase_by(status, set_quotes, amount) status = f_fss_set_quotes_increase_by(amount, &set_quotes); + #define macro_f_fss_set_quotes_t_decrease_by(status, set_quotes, amount) status = f_fss_set_quotes_decrease_by(amount, &set_quotes); + #define macro_f_fss_set_quotes_t_decimate_by(status, set_quotes, amount) status = f_fss_set_quotes_decimate_by(amount, &set_quotes); +#endif // _di_f_fss_set_quotes_t_ + +/** + * Resize the set_quote array. + * + * @param length + * The new size to use. + * @param set_quote + * The set_quote array to resize. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quote_adjust_ + extern f_status_t f_fss_set_quote_adjust(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote); +#endif // _di_f_fss_set_quote_adjust_ + +/** + * Resize the set_quote array to a smaller size. + * + * This will resize making the array smaller based on (size - given length). + * If the given length is too small, then the resize will fail. + * This will not shrink the size to less than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param set_quote + * The set_quote array to resize. + * + * @return + * F_none on success. + * F_data_not if amount is 0. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quote_decimate_by_ + extern f_status_t f_fss_set_quote_decimate_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); +#endif // _di_f_fss_set_quote_decimate_by_ + +/** + * Resize the set_quote array to a smaller size. + * + * This will resize making the array smaller based on (size - given length). + * If the given length is too small, then the resize will fail. + * This will not shrink the size to less than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param set_quote + * The set_quote array to resize. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quote_decrease_by_ + extern f_status_t f_fss_set_quote_decrease_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); +#endif // _di_f_fss_set_quote_decrease_by_ + +/** + * Increase the size of the set_quote array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set_quote max buffer size (F_number_t_size_unsigned_d). + * If already set_quote to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param set_quote + * The set_quote array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quote_increase_ + extern f_status_t f_fss_set_quote_increase(const f_number_unsigned_t step, f_fss_set_quote_t * const set_quote); +#endif // _di_f_fss_set_quote_increase_ + +/** + * Resize the set_quote array to a larger size. + * + * This will resize making the array larger based on the given length. + * If the given length is too large for the buffer, then attempt to set_quote max buffer size (F_number_t_size_unsigned_d). + * If already set_quote to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param set_quote + * The set_quote array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * F_array_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_f_fss_set_quote_increase_by_ + extern f_status_t f_fss_set_quote_increase_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); +#endif // _di_f_fss_set_quote_increase_by_ + +/** + * Resize the set_quote array. + * + * @param length + * The new size to use. + * @param set_quote + * The set_quote array to adjust. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quote_resize_ + extern f_status_t f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote); +#endif // _di_f_fss_set_quote_resize_ + +/** + * Resize the set_quote array. + * + * @param length + * The new size to use. + * @param set_quotes + * The set_quotes array to resize. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quotes_adjust_ + extern f_status_t f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes); +#endif // _di_f_fss_set_quotes_adjust_ + +/** + * Resize the set_quote array to a smaller size. + * + * This will resize making the array smaller based on (size - given length). + * If the given length is too small, then the resize will fail. + * This will not shrink the size to less than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param set_quotes + * The set_quotes array to resize. + * + * @return + * F_none on success. + * F_data_not if amount is 0. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quotes_decimate_by_ + extern f_status_t f_fss_set_quotes_decimate_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); +#endif // _di_f_fss_set_quotes_decimate_by_ + +/** + * Resize the set_quote array to a smaller size. + * + * This will resize making the array smaller based on (size - given length). + * If the given length is too small, then the resize will fail. + * This will not shrink the size to less than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param set_quotes + * The set_quotes array to resize. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quotes_decrease_by_ + extern f_status_t f_fss_set_quotes_decrease_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); +#endif // _di_f_fss_set_quotes_decrease_by_ + +/** + * Increase the size of the set_quotes array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param set_quotes + * The set_quotes array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quotes_increase_ + extern f_status_t f_fss_set_quotes_increase(const f_number_unsigned_t step, f_fss_set_quotes_t * const set_quotes); +#endif // _di_f_fss_set_quotes_increase_ + +/** + * Resize the set_quotes array to a larger size. + * + * This will resize making the array larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param set_quotes + * The set_quotes array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * F_array_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_f_fss_set_quotes_increase_by_ + extern f_status_t f_fss_set_quotes_increase_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); +#endif // _di_f_fss_set_quotes_increase_by_ + +/** + * Resize the set_quotes array. + * + * @param length + * The new size to use. + * @param set_quotes + * The set_quotes array to adjust. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quotes_resize_ + extern f_status_t f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes); +#endif // _di_f_fss_set_quotes_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_fss_set_quote_h diff --git a/level_0/f_fss/c/fss/simple_packet.c b/level_0/f_fss/c/fss/simple_packet.c new file mode 100644 index 0000000..39c8c20 --- /dev/null +++ b/level_0/f_fss/c/fss/simple_packet.c @@ -0,0 +1,148 @@ +#include "../fss.h" +#include "private-simple_packet.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_fss_simple_packet_identify_ + f_status_t f_fss_simple_packet_identify(const f_string_static_t buffer, f_fss_simple_packet_range_t * const range) { + #ifndef _di_level_0_parameter_checking_ + if (!range) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!buffer.used) return F_data_not; + + range->control.start = 1; + range->control.stop = 0; + + range->size.start = 1; + range->size.stop = 0; + + range->payload.start = 1; + range->payload.stop = 0; + + if (buffer.used < F_fss_simple_packet_block_control_size_d) return F_partial; + + range->control.start = 0; + range->control.stop = 0; + + if (buffer.used < F_fss_simple_packet_block_header_size_d) return F_partial; + + range->size.start = 1; + range->size.stop = F_fss_simple_packet_block_size_size_d; + + // The Payload Block can be NULL and if it is, then all values of the Size Block must be of size F_fss_simple_packet_block_header_size_d. + if (buffer.used == F_fss_simple_packet_block_size_size_d) { + + // Big endian. + if (buffer.string[0] & F_fss_simple_packet_endian_d) { + if (buffer.string[2] || buffer.string[3] || !buffer.string[4]) return F_partial; + if (buffer.string[1] < F_fss_simple_packet_block_header_size_d) return F_status_set_error(F_valid_not); + + return (buffer.string[1] == F_fss_simple_packet_block_header_size_d) ? F_none : F_partial; + } + + // Little endian. + if (!buffer.string[1] || buffer.string[2] || buffer.string[3]) return F_partial; + if (buffer.string[4] < F_fss_simple_packet_block_header_size_d) return F_status_set_error(F_valid_not); + + return (buffer.string[4] == F_fss_simple_packet_block_header_size_d) ? F_none : F_partial; + } + + range->payload.start = F_fss_simple_packet_block_header_size_d; + range->payload.stop = (buffer.used - F_fss_simple_packet_block_header_size_d < F_fss_simple_packet_block_payload_size_d) ? buffer.used - 1 : F_fss_simple_packet_block_payload_size_d - 1; + + return F_none; + } +#endif // _di_f_fss_simple_packet_identify_ + +#ifndef _di_f_fss_simple_packet_ranges_adjust_ + f_status_t f_fss_simple_packet_ranges_adjust(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t * const simple_packet_ranges) { + #ifndef _di_level_0_parameter_checking_ + if (!simple_packet_ranges) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_simple_packet_ranges_adjust(length, simple_packet_ranges); + } +#endif // _di_f_fss_simple_packet_ranges_adjust_ + +#ifndef _di_f_fss_simple_packet_ranges_decimate_by_ + f_status_t f_fss_simple_packet_ranges_decimate_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t * const simple_packet_ranges) { + #ifndef _di_level_0_parameter_checking_ + if (!simple_packet_ranges) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + if (simple_packet_ranges->size > amount) return private_f_fss_simple_packet_ranges_adjust(simple_packet_ranges->size - amount, simple_packet_ranges); + + return private_f_fss_simple_packet_ranges_adjust(0, simple_packet_ranges); + } +#endif // _di_f_fss_simple_packet_ranges_decimate_by_ + +#ifndef _di_f_fss_simple_packet_ranges_decrease_by_ + f_status_t f_fss_simple_packet_ranges_decrease_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t * const simple_packet_ranges) { + #ifndef _di_level_0_parameter_checking_ + if (!simple_packet_ranges) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + if (simple_packet_ranges->size > amount) return private_f_fss_simple_packet_ranges_resize(simple_packet_ranges->size - amount, simple_packet_ranges); + + return private_f_fss_simple_packet_ranges_resize(0, simple_packet_ranges); + } +#endif // _di_f_fss_simple_packet_ranges_decrease_by_ + +#ifndef _di_f_fss_simple_packet_ranges_increase_ + f_status_t f_fss_simple_packet_ranges_increase(const f_number_unsigned_t step, f_fss_simple_packet_ranges_t * const simple_packet_ranges) { + #ifndef _di_level_0_parameter_checking_ + if (!simple_packet_ranges) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (step && simple_packet_ranges->used + 1 > simple_packet_ranges->size) { + f_number_unsigned_t size = simple_packet_ranges->used + step; + + if (size > F_number_t_size_unsigned_d) { + if (simple_packet_ranges->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + size = F_number_t_size_unsigned_d; + } + + return private_f_fss_simple_packet_ranges_resize(size, simple_packet_ranges); + } + + return F_data_not; + } +#endif // _di_f_fss_simple_packet_ranges_increase_ + +#ifndef _di_f_fss_simple_packet_ranges_increase_by_ + f_status_t f_fss_simple_packet_ranges_increase_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t * const simple_packet_ranges) { + #ifndef _di_level_0_parameter_checking_ + if (!simple_packet_ranges) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!amount) return F_data_not; + + if (simple_packet_ranges->used + amount > simple_packet_ranges->size) { + if (simple_packet_ranges->used + amount > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + return private_f_fss_simple_packet_ranges_resize(simple_packet_ranges->used + amount, simple_packet_ranges); + } + + return F_data_not; + } +#endif // _di_f_fss_simple_packet_ranges_increase_by_ + +#ifndef _di_f_fss_simple_packet_ranges_resize_ + f_status_t f_fss_simple_packet_ranges_resize(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t * const simple_packet_ranges) { + #ifndef _di_level_0_parameter_checking_ + if (!simple_packet_ranges) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_simple_packet_ranges_resize(length, simple_packet_ranges); + } +#endif // _di_f_fss_simple_packet_ranges_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss/simple_packet.h b/level_0/f_fss/c/fss/simple_packet.h new file mode 100644 index 0000000..787d950 --- /dev/null +++ b/level_0/f_fss/c/fss/simple_packet.h @@ -0,0 +1,255 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines set data to be used for/by project fss. + * + * This is auto-included by fss.h and should not need to be explicitly included. + */ +#ifndef _F_fss_simple_packet_h +#define _F_fss_simple_packet_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * FSS-000F (Simple Packet) specific defines. + * + * F_fss_simple_packet_*_d: + * - endian: The endian bit for a 8-bit type, generally a character, that when set to 1 is big endian and when set to 0 is little endian. + * - block_control_size: The size of the Control Block in bytes. + * - block_size_size: The size of the Size Block in bytes. + * - block_header_size: The size of both the Control Block and the Size Block in bytes. + * - block_payload_size: The maximum block size of the Payload Block in bytes, which is (2^32)-6. + */ +#ifndef _di_f_fss_simple_packet_d_ + #define F_fss_simple_packet_endian_d 0x80 + + #define F_fss_simple_packet_block_control_size_d 1 + #define F_fss_simple_packet_block_size_size_d 4 + #define F_fss_simple_packet_block_header_size_d 5 + #define F_fss_simple_packet_block_payload_size_d 4294967290 +#endif // _di_f_fss_simple_packet_d_ + +/** + * A set of string ranges intending to designate the different ranges for a Simple Packet representing each Block. + * + * Properties: + * - control: The Control Block, which is 1 byte long. + * - size: The Size Block, which is 4 bytes long. + * - payload: The Payload Block, which is inclusively between 0 and (2^32)-6 bytes long. + */ +#ifndef _di_f_fss_simple_packet_range_t_ + typedef struct { + f_string_range_t control; + f_string_range_t size; + f_string_range_t payload; + } f_fss_simple_packet_range_t; + + #define f_fss_simple_packet_range_t_initialize { \ + f_string_range_t_initialize, \ + f_string_range_t_initialize, \ + f_string_range_t_initialize, \ + } + + #define macro_f_fss_simple_packet_range_t_initialize_1(control, size, payload) { \ + control, \ + size, \ + payload, \ + } +#endif // _di_f_fss_simple_packet_range_t_ + +/** + * This holds an array of f_fss_simple_packet_range_t. + * + * Properties: + * - array: An array of f_fss_simple_packet_range_t. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_fss_simple_packet_ranges_t_ + typedef struct { + f_fss_simple_packet_range_t *array; + + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_fss_simple_packet_ranges_t; + + #define f_fss_simple_packet_ranges_t_initialize { 0, 0, 0 } + + #define macro_f_fss_simple_packet_ranges_t_initialize_1(array, size, used) { array, size, used } + #define macro_f_fss_simple_packet_ranges_t_initialize_2(array, length) { array, length, length } + + #define macro_f_fss_simple_packet_ranges_t_clear(simple_packet_ranges) macro_f_memory_structure_t_clear(simple_packet_range.objects) + + #define macro_f_fss_simple_packet_ranges_t_resize(status, simple_packet_ranges, length) status = f_fss_simple_packet_ranges_resize(length, &simple_packet_ranges); + #define macro_f_fss_simple_packet_ranges_t_adjust(status, simple_packet_ranges, length) status = f_fss_simple_packet_ranges_adjust(length, &simple_packet_ranges); + + #define macro_f_fss_simple_packet_ranges_t_delete_simple(simple_packet_ranges) f_fss_simple_packet_ranges_resize(0, &simple_packet_ranges); + #define macro_f_fss_simple_packet_ranges_t_destroy_simple(simple_packet_ranges) f_fss_simple_packet_ranges_adjust(0, &simple_packet_ranges); + + #define macro_f_fss_simple_packet_ranges_t_increase(status, step, simple_packet_ranges) status = f_fss_simple_packet_ranges_increase(step, &simple_packet_ranges); + #define macro_f_fss_simple_packet_ranges_t_increase_by(status, simple_packet_ranges, amount) status = f_fss_simple_packet_ranges_increase_by(amount, &simple_packet_ranges); + #define macro_f_fss_simple_packet_ranges_t_decrease_by(status, simple_packet_ranges, amount) status = f_fss_simple_packet_ranges_decrease_by(amount, &simple_packet_ranges); + #define macro_f_fss_simple_packet_ranges_t_decimate_by(status, simple_packet_ranges, amount) status = f_fss_simple_packet_ranges_decimate_by(amount, &simple_packet_ranges); +#endif // _di_f_fss_simple_packet_ranges_t_ + +/** + * Identify the ranges representing the different parts of the FSS-000F (Simple Packet). + * + * @param buffer + * The string buffer to identify the packet ranges of. + * This buffer is considered binary data and so any NULL found within is treated as a valid part of the buffer. + * @param range + * The set of blocks, each representing a range within the buffer. + * If the buffer is too small (including when F_data_not is returned), then the ranges are all set to the out of range values as appropriate. + * + * @return + * F_none on success (The end of the Payload Block is assumed to be the remainder of the buffer or F_fss_simple_packet_block_payload_size_d, whichever is smaller). + * F_partial on success but not all blocks are identified. + * F_data_not if buffer.used is 0. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_valid_not (with error bit) if the data is invalid, which generally only happens when the value of the Size block is less than 5 (and when not returning F_partial). + */ +#ifndef _di_f_fss_simple_packet_identify_ + extern f_status_t f_fss_simple_packet_identify(const f_string_static_t buffer, f_fss_simple_packet_range_t * const range); +#endif // _di_f_fss_simple_packet_identify_ + +/** + * Resize the simple_packet_range array. + * + * @param length + * The new size to use. + * @param simple_packet_ranges + * The simple_packet_ranges array to resize. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_simple_packet_ranges_adjust_ + extern f_status_t f_fss_simple_packet_ranges_adjust(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t * const simple_packet_ranges); +#endif // _di_f_fss_simple_packet_ranges_adjust_ + +/** + * Resize the simple_packet_range array to a smaller size. + * + * This will resize making the array smaller based on (size - given length). + * If the given length is too small, then the resize will fail. + * This will not shrink the size to less than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param simple_packet_ranges + * The simple_packet_ranges array to resize. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_simple_packet_ranges_decimate_by_ + extern f_status_t f_fss_simple_packet_ranges_decimate_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t * const simple_packet_ranges); +#endif // _di_f_fss_simple_packet_ranges_decimate_by_ + +/** + * Resize the simple_packet_range array to a smaller size. + * + * This will resize making the array smaller based on (size - given length). + * If the given length is too small, then the resize will fail. + * This will not shrink the size to less than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param simple_packet_ranges + * The simple_packet_ranges array to resize. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_simple_packet_ranges_decrease_by_ + extern f_status_t f_fss_simple_packet_ranges_decrease_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t * const simple_packet_ranges); +#endif // _di_f_fss_simple_packet_ranges_decrease_by_ + +/** + * Increase the size of the simple_packet_ranges array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param simple_packet_ranges + * The simple_packet_ranges array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_simple_packet_ranges_increase_ + extern f_status_t f_fss_simple_packet_ranges_increase(const f_number_unsigned_t step, f_fss_simple_packet_ranges_t * const simple_packet_ranges); +#endif // _di_f_fss_simple_packet_ranges_increase_ + +/** + * Resize the simple_packet_ranges array to a larger size. + * + * This will resize making the array larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param simple_packet_ranges + * The simple_packet_ranges array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * F_array_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_f_fss_simple_packet_ranges_increase_by_ + extern f_status_t f_fss_simple_packet_ranges_increase_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t * const simple_packet_ranges); +#endif // _di_f_fss_simple_packet_ranges_increase_by_ + +/** + * Resize the simple_packet_ranges array. + * + * @param length + * The new size to use. + * @param simple_packet_ranges + * The simple_packet_ranges array to adjust. + * + * @return + * F_none on success. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_simple_packet_ranges_resize_ + extern f_status_t f_fss_simple_packet_ranges_resize(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t * const simple_packet_ranges); +#endif // _di_f_fss_simple_packet_ranges_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_fss_simple_packet_h diff --git a/level_0/f_fss/c/private-fss.c b/level_0/f_fss/c/private-fss.c index 71493b2..be126fd 100644 --- a/level_0/f_fss/c/private-fss.c +++ b/level_0/f_fss/c/private-fss.c @@ -5,444 +5,6 @@ extern "C" { #endif -#if !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) - f_status_t private_f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < items->size; ++i) { - - status = f_string_ranges_adjust(0, &items->array[i].content); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_adjust(items->size, length, sizeof(f_fss_item_t), (void **) & items->array); - - if (F_status_is_error_not(status)) { - items->size = length; - - if (items->used > items->size) { - items->used = length; - } - } - - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) - -#if !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_) - f_status_t private_f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < items->size; ++i) { - - status = f_string_ranges_resize(0, &items->array[i].content); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_resize(items->size, length, sizeof(f_fss_item_t), (void **) & items->array); - if (F_status_is_error(status)) return status; - - items->size = length; - - if (items->used > items->size) { - items->used = length; - } - - return F_none; - } -#endif // !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_) - -#if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) - f_status_t private_f_fss_named_adjust(const f_number_unsigned_t length, f_fss_named_t * const named) { - - f_status_t status = F_none; - - status = f_string_ranges_adjust(length, &named->objects); - if (F_status_is_error(status)) return status; - - status = f_string_rangess_adjust(length, &named->contents); - if (F_status_is_error(status)) return status; - - status = f_uint8ss_adjust(length, &named->quotess); - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) - -#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) - f_status_t private_f_fss_named_resize(const f_number_unsigned_t length, f_fss_named_t * const named) { - - f_status_t status = F_none; - - status = f_string_ranges_resize(length, &named->objects); - if (F_status_is_error(status)) return status; - - status = f_string_rangess_resize(length, &named->contents); - if (F_status_is_error(status)) return status; - - status = f_uint8ss_resize(length, &named->quotess); - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) - -#if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) - f_status_t private_f_fss_nameds_adjust(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < nameds->size; ++i) { - - status = private_f_fss_named_adjust(0, &nameds->array[i]); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_adjust(nameds->size, length, sizeof(f_fss_named_t), (void **) & nameds->array); - - if (F_status_is_error_not(status)) { - nameds->size = length; - - if (nameds->used > nameds->size) { - nameds->used = length; - } - } - - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) - -#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) - f_status_t private_f_fss_nameds_resize(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < nameds->size; ++i) { - - status = private_f_fss_named_resize(0, &nameds->array[i]); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_resize(nameds->size, length, sizeof(f_fss_named_t), (void **) & nameds->array); - if (F_status_is_error(status)) return status; - - nameds->size = length; - - if (nameds->used > nameds->size) { - nameds->used = length; - } - - return F_none; - } -#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) - -#if !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) - f_status_t private_f_fss_nest_adjust(const f_number_unsigned_t length, f_fss_nest_t * const nest) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < nest->size; ++i) { - - status = private_f_fss_items_adjust(0, &nest->depth[i]); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_adjust(nest->size, length, sizeof(f_fss_items_t), (void **) & nest->depth); - - if (F_status_is_error_not(status)) { - nest->size = length; - - if (nest->used > nest->size) { - nest->used = length; - } - } - - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) - -#if !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_increase_) || !defined(_di_f_fss_nest_increase_by_) || !defined(_di_f_fss_nest_resize_) - f_status_t private_f_fss_nest_resize(const f_number_unsigned_t length, f_fss_nest_t * const nest) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < nest->size; ++i) { - - status = private_f_fss_items_resize(0, &nest->depth[i]); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_resize(nest->size, length, sizeof(f_fss_items_t), (void **) & nest->depth); - if (F_status_is_error(status)) return status; - - nest->size = length; - - if (nest->used > nest->size) { - nest->used = length; - } - - return F_none; - } -#endif // !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_increase_) || !defined(_di_f_fss_nest_increase_by_) || !defined(_di_f_fss_nest_resize_) - -#if !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) - f_status_t private_f_fss_nests_adjust(const f_number_unsigned_t length, f_fss_nests_t *nests) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < nests->size; ++i) { - - status = private_f_fss_nest_adjust(0, &nests->array[i]); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_adjust(nests->size, length, sizeof(f_fss_nest_t), (void **) & nests->array); - - if (F_status_is_error_not(status)) { - nests->size = length; - - if (nests->used > nests->size) { - nests->used = length; - } - } - - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) - -#if !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_) - f_status_t private_f_fss_nests_resize(const f_number_unsigned_t length, f_fss_nests_t * const nests) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < nests->size; ++i) { - - status = private_f_fss_nest_resize(0, &nests->array[i]); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_resize(nests->size, length, sizeof(f_fss_nest_t), (void **) & nests->array); - if (F_status_is_error(status)) return status; - - nests->size = length; - - if (nests->used > nests->size) { - nests->used = length; - } - - return F_none; - } -#endif // !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_) - -#if !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) - f_status_t private_f_fss_set_adjust(const f_number_unsigned_t length, f_fss_set_t * const set) { - - f_status_t status = F_none; - - status = f_string_ranges_adjust(length, &set->objects); - if (F_status_is_error(status)) return status; - - status = f_string_rangess_adjust(length, &set->contents); - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) - -#if !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_) - f_status_t private_f_fss_set_resize(const f_number_unsigned_t length, f_fss_set_t *set) { - - f_status_t status = F_none; - - status = f_string_ranges_resize(length, &set->objects); - if (F_status_is_error(status)) return status; - - status = f_string_rangess_resize(length, &set->contents); - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_) - -#if !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) - f_status_t private_f_fss_set_quote_adjust(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) { - - f_status_t status = F_none; - - status = f_string_ranges_adjust(length, &set_quote->objects); - if (F_status_is_error(status)) return status; - - status = f_string_rangess_adjust(length, &set_quote->contents); - if (F_status_is_error(status)) return status; - - status = f_uint8s_adjust(length, &set_quote->objects_quote); - if (F_status_is_error(status)) return status; - - status = f_uint8ss_adjust(length, &set_quote->contents_quote); - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) - -#if !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_) - f_status_t private_f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) { - - f_status_t status = F_none; - - status = f_string_ranges_resize(length, &set_quote->objects); - if (F_status_is_error(status)) return status; - - status = f_string_rangess_resize(length, &set_quote->contents); - if (F_status_is_error(status)) return status; - - status = f_uint8s_resize(length, &set_quote->objects_quote); - if (F_status_is_error(status)) return status; - - status = f_uint8ss_resize(length, &set_quote->contents_quote); - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_) - -#if !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) - f_status_t private_f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < set_quotes->size; ++i) { - - status = f_string_ranges_adjust(0, &set_quotes->array[i].objects); - if (F_status_is_error(status)) return status; - - status = f_string_rangess_adjust(0, &set_quotes->array[i].contents); - if (F_status_is_error(status)) return status; - - status = f_uint8s_adjust(0, &set_quotes->array[i].objects_quote); - if (F_status_is_error(status)) return status; - - status = f_uint8ss_adjust(0, &set_quotes->array[i].contents_quote); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_adjust(set_quotes->size, length, sizeof(f_fss_set_quote_t), (void **) & set_quotes->array); - - if (F_status_is_error_not(status)) { - set_quotes->size = length; - - if (set_quotes->used > set_quotes->size) { - set_quotes->used = length; - } - } - - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) - -#if !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_increase_) || !defined(_di_f_fss_set_quotes_increase_by_) || !defined(_di_f_fss_set_quotes_resize_) - f_status_t private_f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < set_quotes->size; ++i) { - - status = f_string_ranges_resize(0, &set_quotes->array[i].objects); - if (F_status_is_error(status)) return status; - - status = f_string_rangess_resize(0, &set_quotes->array[i].contents); - if (F_status_is_error(status)) return status; - - status = f_uint8s_resize(0, &set_quotes->array[i].objects_quote); - if (F_status_is_error(status)) return status; - - status = f_uint8ss_resize(0, &set_quotes->array[i].contents_quote); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_resize(set_quotes->size, length, sizeof(f_fss_set_quote_t), (void **) & set_quotes->array); - if (F_status_is_error(status)) return status; - - set_quotes->size = length; - - if (set_quotes->used > set_quotes->size) { - set_quotes->used = length; - } - - return F_none; - } -#endif // !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_increase_) || !defined(_di_f_fss_set_quotes_increase_by_) || !defined(_di_f_fss_set_quotes_resize_) - -#if !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) - f_status_t private_f_fss_sets_adjust(const f_number_unsigned_t length, f_fss_sets_t * const sets) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < sets->size; ++i) { - - status = f_string_ranges_adjust(0, &sets->array[i].objects); - if (F_status_is_error(status)) return status; - - status = f_string_rangess_adjust(0, &sets->array[i].contents); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_adjust(sets->size, length, sizeof(f_fss_set_t), (void **) & sets->array); - - if (F_status_is_error_not(status)) { - sets->size = length; - - if (sets->used > sets->size) { - sets->used = length; - } - } - - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) - -#if !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_increase_) || !defined(_di_f_fss_sets_increase_by_) || !defined(_di_f_fss_sets_resize_) - f_status_t private_f_fss_sets_resize(const f_number_unsigned_t length, f_fss_sets_t * const sets) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < sets->size; ++i) { - - status = f_string_ranges_resize(0, &sets->array[i].objects); - if (F_status_is_error(status)) return status; - - status = f_string_rangess_resize(0, &sets->array[i].contents); - if (F_status_is_error(status)) return status; - } // for - - status = f_memory_resize(sets->size, length, sizeof(f_fss_set_t), (void **) & sets->array); - if (F_status_is_error(status)) return status; - - sets->size = length; - - if (sets->used > sets->size) { - sets->used = length; - } - - return F_none; - } -#endif // !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_increase_) || !defined(_di_f_fss_sets_increase_by_) || !defined(_di_f_fss_sets_resize_) - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_fss/c/private-fss.h b/level_0/f_fss/c/private-fss.h index 5761ef0..97fad1e 100644 --- a/level_0/f_fss/c/private-fss.h +++ b/level_0/f_fss/c/private-fss.h @@ -15,520 +15,6 @@ extern "C" { #endif -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param items - * The items to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_fss_item_t_adjust(). - * Errors (with error bit) from: f_memory_adjust(). - * - * @see macro_f_fss_item_t_adjust() - * - * @see f_fss_items_adjust() - * @see f_fss_items_decimate_by() - * @see f_memory_adjust() - */ -#if !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) - extern f_status_t private_f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param items - * The items to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_fss_item_t_resize(). - * Errors (with error bit) from: f_memory_resize(). - * - * @see macro_f_fss_item_t_resize() - * - * @see f_fss_items_decrease_by() - * @see f_fss_items_increase() - * @see f_fss_items_increase_by() - * @see f_fss_items_resize() - * @see f_memory_resize() - */ -#if !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_) - extern f_status_t private_f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param named - * The named to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_string_ranges_t_adjust(). - * Errors (with error bit) from: macro_f_string_rangess_t_adjust(). - * Errors (with error bit) from: macro_f_uint8ss_t_adjust(). - * - * @see macro_f_string_ranges_t_adjust() - * @see macro_f_string_rangess_t_adjust() - * @see macro_f_uint8ss_t_adjust() - * - * @see f_fss_nameds_adjust() - * @see f_fss_nameds_decimate_by() - */ -#if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) - extern f_status_t private_f_fss_named_adjust(const f_number_unsigned_t length, f_fss_named_t * const named) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param named - * The named to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_string_ranges_t_resize(). - * Errors (with error bit) from: macro_f_string_rangess_t_resize(). - * Errors (with error bit) from: macro_f_uint8ss_t_resize(). - * - * @see macro_f_string_ranges_t_resize() - * @see macro_f_string_rangess_t_resize() - * @see macro_f_uint8ss_t_resize() - * - * @see f_fss_nameds_decrease_by() - * @see f_fss_nameds_incease() - * @see f_fss_nameds_incease_by() - * @see f_fss_nameds_resize() - */ -#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) - extern f_status_t private_f_fss_named_resize(const f_number_unsigned_t length, f_fss_named_t * const named) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param nameds - * The nameds to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: private_f_fss_named_adjust(). - * - * @see private_f_fss_named_adjust() - * - * @see f_fss_nameds_adjust() - * @see f_fss_nameds_decimate_by() - * @see f_memory_adjust() - */ -#if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) - extern f_status_t private_f_fss_nameds_adjust(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param nameds - * The nameds to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: private_f_fss_named_resize(). - * - * @see private_f_fss_named_resize() - * - * @see f_fss_nameds_decrease_by() - * @see f_fss_nameds_increase() - * @see f_fss_nameds_increase_by() - * @see f_fss_nameds_resize() - * @see f_memory_resize() - */ -#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) - extern f_status_t private_f_fss_nameds_resize(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param nest - * The nest to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: macro_f_fss_nest_t_adjust(). - * - * @see macro_f_fss_nest_t_adjust() - * - * @see f_fss_nest_adjust() - * @see f_fss_nest_decimate_by() - * @see f_memory_adjust() - */ -#if !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) - extern f_status_t private_f_fss_nest_adjust(const f_number_unsigned_t length, f_fss_nest_t * const nest) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param nest - * The nest to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: macro_f_fss_nest_t_resize(). - * - * @see macro_f_fss_nest_t_resize() - * - * @see f_fss_nest_decrease_by() - * @see f_fss_nest_increase() - * @see f_fss_nest_increase_by() - * @see f_fss_nest_resize() - * @see f_memory_resize() - */ -#if !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_increase_) || !defined(_di_f_fss_nest_increase_by_) || !defined(_di_f_fss_nest_resize_) - extern f_status_t private_f_fss_nest_resize(const f_number_unsigned_t length, f_fss_nest_t * const nest) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_increase_) || !defined(_di_f_fss_nest_increase_by_) || !defined(_di_f_fss_nest_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param nests - * The nests to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: macro_f_fss_nest_t_adjust(). - * - * @see macro_f_fss_nest_t_adjust() - * - * @see f_fss_nests_adjust() - * @see f_fss_nests_decimate_by() - * @see f_memory_adjust() - */ -#if !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) - extern f_status_t private_f_fss_nests_adjust(const f_number_unsigned_t length, f_fss_nests_t * const nests) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param nests - * The nests to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: macro_f_fss_nest_t_resize(). - * - * @see macro_f_fss_nest_t_resize() - * - * @see f_fss_nests_decrease_by() - * @see f_fss_nests_increase() - * @see f_fss_nests_increase_by() - * @see f_fss_nests_resize() - * @see f_memory_resize() - */ -#if !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_) - extern f_status_t private_f_fss_nests_resize(const f_number_unsigned_t length, f_fss_nests_t * const nests) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param set - * The set to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_fss_contents_t_adjust(). - * Errors (with error bit) from: macro_f_fss_objects_t_adjust(). - * - * @see macro_f_fss_contents_t_adjust() - * @see macro_f_fss_objects_t_adjust() - * - * @see f_fss_set_adjust() - * @see f_fss_set_decimate_by() - */ -#if !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) - extern f_status_t private_f_fss_set_adjust(const f_number_unsigned_t length, f_fss_set_t * const set) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param set - * The set to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_fss_contents_t_resize(). - * Errors (with error bit) from: macro_f_fss_objects_t_resize(). - * - * @see macro_f_fss_contents_t_resize() - * @see macro_f_fss_objects_t_resize() - * - * @see f_fss_set_decrease_by() - * @see f_fss_set_increase() - * @see f_fss_set_increase_by() - * @see f_fss_set_resize() - */ -#if !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_) - extern f_status_t private_f_fss_set_resize(const f_number_unsigned_t length, f_fss_set_t * const set) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param set_quote - * The set_quote to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_fss_contents_t_adjust(). - * Errors (with error bit) from: macro_f_fss_objects_t_adjust(). - * Errors (with error bit) from: macro_f_uint8s_t_adjust(). - * Errors (with error bit) from: macro_f_uint8ss_t_adjust(). - * - * @see macro_f_fss_contents_t_adjust() - * @see macro_f_fss_objects_t_adjust() - * @see macro_f_uint8s_t_adjust() - * @see macro_f_uint8ss_t_adjust() - * - * @see f_fss_set_quote_adjust() - * @see f_fss_set_quote_decimate_by() - */ -#if !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) - extern f_status_t private_f_fss_set_quote_adjust(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param set_quote - * The set_quote to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_fss_contents_t_resize(). - * Errors (with error bit) from: macro_f_fss_objects_t_resize(). - * Errors (with error bit) from: macro_f_uint8s_t_resize(). - * Errors (with error bit) from: macro_f_uint8ss_t_resize(). - * - * @see macro_f_fss_contents_t_resize() - * @see macro_f_fss_objects_t_resize() - * @see macro_f_uint8s_t_resize() - * @see macro_f_uint8ss_t_resize() - * - * @see f_fss_set_quote_decrease_by() - * @see f_fss_set_quote_increase() - * @see f_fss_set_quote_increase_by() - * @see f_fss_set_quote_resize() - */ -#if !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_) - extern f_status_t private_f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param set_quotes - * The set_quotes to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_fss_contents_t_adjust(). - * Errors (with error bit) from: macro_f_fss_objects_t_adjust(). - * Errors (with error bit) from: macro_f_uint8s_t_adjust(). - * Errors (with error bit) from: macro_f_uint8ss_t_adjust(). - * Errors (with error bit) from: f_memory_adjust(). - * - * @see macro_f_fss_contents_t_adjust() - * @see macro_f_fss_objects_t_adjust() - * @see macro_f_uint8s_t_adjust() - * @see macro_f_uint8ss_t_adjust() - * - * @see f_fss_set_quotes_adjust() - * @see f_fss_set_quotes_decimate_by() - * @see f_memory_adjust() - */ -#if !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) - extern f_status_t private_f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param set_quotes - * The set_quotes to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_fss_contents_t_resize(). - * Errors (with error bit) from: macro_f_fss_objects_t_resize(). - * Errors (with error bit) from: macro_f_uint8s_t_resize(). - * Errors (with error bit) from: macro_f_uint8ss_t_resize(). - * Errors (with error bit) from: f_memory_resize(). - * - * @see macro_f_fss_contents_t_resize() - * @see macro_f_fss_objects_t_resize() - * @see macro_f_uint8s_t_resize() - * @see macro_f_uint8ss_t_resize() - * - * @see f_fss_set_quotes_decrease_by() - * @see f_fss_set_quotes_increase() - * @see f_fss_set_quotes_increase_by() - * @see f_fss_set_quotes_resize() - * @see f_memory_resize() - */ -#if !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_increase_) || !defined(_di_f_fss_set_quotes_increase_by_) || !defined(_di_f_fss_set_quotes_resize_) - extern f_status_t private_f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_increase_) || !defined(_di_f_fss_set_quotes_increase_by_) || !defined(_di_f_fss_set_quotes_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param sets - * The sets to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_fss_contents_t_adjust(). - * Errors (with error bit) from: macro_f_fss_objects_t_adjust(). - * Errors (with error bit) from: f_memory_adjust(). - * - * @see macro_f_fss_contents_t_adjust() - * @see macro_f_fss_objects_t_adjust() - * - * @see f_fss_sets_adjust() - * @see f_fss_sets_decimate_by() - * @see f_memory_adjust() - */ -#if !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) - extern f_status_t private_f_fss_sets_adjust(const f_number_unsigned_t length, f_fss_sets_t * const sets) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param sets - * The sets to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: macro_f_fss_contents_t_resize(). - * Errors (with error bit) from: macro_f_fss_objects_t_resize(). - * Errors (with error bit) from: f_memory_resize(). - * - * @see macro_f_fss_contents_t_resize() - * @see macro_f_fss_objects_t_resize() - * - * @see f_fss_sets_decrease_by() - * @see f_fss_sets_increase() - * @see f_fss_sets_increase_by() - * @see f_fss_sets_resize() - * @see f_memory_resize() - */ -#if !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_increase_) || !defined(_di_f_fss_sets_increase_by_) || !defined(_di_f_fss_sets_resize_) - extern f_status_t private_f_fss_sets_resize(const f_number_unsigned_t length, f_fss_sets_t * const sets) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_increase_) || !defined(_di_f_fss_sets_increase_by_) || !defined(_di_f_fss_sets_resize_) - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_fss/data/build/settings b/level_0/f_fss/data/build/settings index a70d27e..1ca3d78 100644 --- a/level_0/f_fss/data/build/settings +++ b/level_0/f_fss/data/build/settings @@ -31,9 +31,10 @@ build_language c build_libraries -lc build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -build_sources_library fss.c private-fss.c fss/common.c fss/named.c fss/nest.c fss/set.c +build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c +build_sources_library fss/private-item.c fss/private-named.c fss/private-nest.c fss/private-set.c fss/private-set_quote.c fss/private-simple_packet.c -build_sources_headers fss.h fss/comment.h fss/common.h fss/delimit.h fss/named.h fss/nest.h fss/quote.h fss/set.h +build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h build_script yes build_shared yes diff --git a/level_0/f_fss/data/build/settings-mocks b/level_0/f_fss/data/build/settings-mocks index 00aef12..5ceaed3 100644 --- a/level_0/f_fss/data/build/settings-mocks +++ b/level_0/f_fss/data/build/settings-mocks @@ -30,9 +30,10 @@ build_language c build_libraries -lc build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -build_sources_library fss.c private-fss.c fss/common.c fss/named.c fss/nest.c fss/set.c ../../tests/unit/c/mock-fss.c +build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c ../../tests/unit/c/mock-fss.c +build_sources_library fss/private-item.c fss/private-named.c fss/private-nest.c fss/private-set.c fss/private-set_quote.c fss/private-simple_packet.c -build_sources_headers fss.h fss/comment.h fss/common.h fss/delimit.h fss/named.h fss/nest.h fss/quote.h fss/set.h +build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h build_script yes build_shared yes diff --git a/level_0/f_fss/data/build/settings-tests b/level_0/f_fss/data/build/settings-tests index 4784595..fc55b4d 100644 --- a/level_0/f_fss/data/build/settings-tests +++ b/level_0/f_fss/data/build/settings-tests @@ -36,6 +36,7 @@ build_sources_program test-fss-set_adjust.c test-fss-set_decimate_by.c test-fss- build_sources_program test-fss-set_quote_adjust.c test-fss-set_quote_decimate_by.c test-fss-set_quote_decrease_by.c test-fss-set_quote_increase.c test-fss-set_quote_increase_by.c test-fss-set_quote_resize.c build_sources_program test-fss-set_quotes_adjust.c test-fss-set_quotes_decimate_by.c test-fss-set_quotes_decrease_by.c test-fss-set_quotes_increase.c test-fss-set_quotes_increase_by.c test-fss-set_quotes_resize.c build_sources_program test-fss-sets_adjust.c test-fss-sets_decimate_by.c test-fss-sets_decrease_by.c test-fss-sets_increase.c test-fss-sets_increase_by.c test-fss-sets_resize.c +build_sources_program test-fss-simple_packet_ranges_adjust.c test-fss-simple_packet_ranges_decimate_by.c test-fss-simple_packet_ranges_decrease_by.c test-fss-simple_packet_ranges_increase.c test-fss-simple_packet_ranges_increase_by.c test-fss-simple_packet_ranges_resize.c build_sources_program test-fss.c diff --git a/level_0/f_fss/tests/unit/c/test-fss-apply_delimit.c b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit.c index d82d1ce..b5c88ad 100644 --- a/level_0/f_fss/tests/unit/c/test-fss-apply_delimit.c +++ b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit.c @@ -7,7 +7,7 @@ extern "C" { void test__f_fss_apply_delimit__parameter_checking(void **state) { - const f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + const f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; f_state_t state_data = f_state_t_initialize; { @@ -19,7 +19,7 @@ void test__f_fss_apply_delimit__parameter_checking(void **state) { void test__f_fss_apply_delimit__returns_data_not(void **state) { - const f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + const f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; f_state_t state_data = f_state_t_initialize; { @@ -63,52 +63,52 @@ void test__f_fss_apply_delimit__works(void **state) { macro_f_string_static_t_initialize_1("\0\0\0test全\0est", 0, 14), }; - f_fss_delimit_t delimits_0[] = { - macro_f_fss_delimit_t_initialize_1(tests[0].used + 2), + f_number_unsigned_t delimits_0[] = { + tests[0].used + 2, }; - f_fss_delimit_t delimits_1[] = { - macro_f_fss_delimit_t_initialize_1(1), + f_number_unsigned_t delimits_1[] = { + 1, }; - f_fss_delimit_t delimits_2[] = { - macro_f_fss_delimit_t_initialize_1(1), - macro_f_fss_delimit_t_initialize_1(2), + f_number_unsigned_t delimits_2[] = { + 1, + 2, }; - f_fss_delimit_t delimits_3[] = { - macro_f_fss_delimit_t_initialize_1(1), - macro_f_fss_delimit_t_initialize_1(3), + f_number_unsigned_t delimits_3[] = { + 1, + 3, }; - f_fss_delimit_t delimits_4[] = { - macro_f_fss_delimit_t_initialize_1(0), - macro_f_fss_delimit_t_initialize_1(1), - macro_f_fss_delimit_t_initialize_1(3), + f_number_unsigned_t delimits_4[] = { + 0, + 1, + 3, }; - f_fss_delimit_t delimits_5[] = { - macro_f_fss_delimit_t_initialize_1(0), - macro_f_fss_delimit_t_initialize_1(1), - macro_f_fss_delimit_t_initialize_1(2), - macro_f_fss_delimit_t_initialize_1(3), + f_number_unsigned_t delimits_5[] = { + 0, + 1, + 2, + 3, }; - f_fss_delimit_t delimits_6[] = { - macro_f_fss_delimit_t_initialize_1(0), - macro_f_fss_delimit_t_initialize_1(1), - macro_f_fss_delimit_t_initialize_1(2), - macro_f_fss_delimit_t_initialize_1(10), + f_number_unsigned_t delimits_6[] = { + 0, + 1, + 2, + 10, }; - const f_fss_delimits_t delimitss[] = { - macro_f_fss_delimits_t_initialize_1(delimits_0, 0, 1), - macro_f_fss_delimits_t_initialize_1(delimits_1, 0, 1), - macro_f_fss_delimits_t_initialize_1(delimits_2, 0, 2), - macro_f_fss_delimits_t_initialize_1(delimits_3, 0, 2), - macro_f_fss_delimits_t_initialize_1(delimits_4, 0, 3), - macro_f_fss_delimits_t_initialize_1(delimits_5, 0, 4), - macro_f_fss_delimits_t_initialize_1(delimits_6, 0, 4), + const f_number_unsigneds_t delimitss[] = { + macro_f_number_unsigneds_t_initialize_1(delimits_0, 0, 1), + macro_f_number_unsigneds_t_initialize_1(delimits_1, 0, 1), + macro_f_number_unsigneds_t_initialize_1(delimits_2, 0, 2), + macro_f_number_unsigneds_t_initialize_1(delimits_3, 0, 2), + macro_f_number_unsigneds_t_initialize_1(delimits_4, 0, 3), + macro_f_number_unsigneds_t_initialize_1(delimits_5, 0, 4), + macro_f_number_unsigneds_t_initialize_1(delimits_6, 0, 4), }; for (uint8_t i = 0; i < 7; ++i) { diff --git a/level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.c b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.c index 1e3760f..4150754 100644 --- a/level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.c +++ b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.c @@ -7,7 +7,7 @@ extern "C" { void test__f_fss_apply_delimit_range__parameter_checking(void **state) { - const f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + const f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; f_state_t state_data = f_state_t_initialize; const f_string_range_t range = f_string_range_t_initialize; @@ -21,7 +21,7 @@ void test__f_fss_apply_delimit_range__parameter_checking(void **state) { void test__f_fss_apply_delimit_range__returns_data_not(void **state) { f_string_static_t test = macro_f_string_static_t_initialize_1("test", 0, 4); - const f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + const f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; f_state_t state_data = f_state_t_initialize; { @@ -83,52 +83,52 @@ void test__f_fss_apply_delimit_range__works(void **state) { macro_f_string_static_t_initialize_1("\0\0\0test全\0est", 0, 14), }; - f_fss_delimit_t delimits_0[] = { - macro_f_fss_delimit_t_initialize_1(tests[0].used + 2), + f_number_unsigned_t delimits_0[] = { + tests[0].used + 2, }; - f_fss_delimit_t delimits_1[] = { - macro_f_fss_delimit_t_initialize_1(1), + f_number_unsigned_t delimits_1[] = { + 1, }; - f_fss_delimit_t delimits_2[] = { - macro_f_fss_delimit_t_initialize_1(1), - macro_f_fss_delimit_t_initialize_1(2), + f_number_unsigned_t delimits_2[] = { + 1, + 2, }; - f_fss_delimit_t delimits_3[] = { - macro_f_fss_delimit_t_initialize_1(1), - macro_f_fss_delimit_t_initialize_1(3), + f_number_unsigned_t delimits_3[] = { + 1, + 3, }; - f_fss_delimit_t delimits_4[] = { - macro_f_fss_delimit_t_initialize_1(0), - macro_f_fss_delimit_t_initialize_1(1), - macro_f_fss_delimit_t_initialize_1(3), + f_number_unsigned_t delimits_4[] = { + 0, + 1, + 3, }; - f_fss_delimit_t delimits_5[] = { - macro_f_fss_delimit_t_initialize_1(0), - macro_f_fss_delimit_t_initialize_1(1), - macro_f_fss_delimit_t_initialize_1(2), - macro_f_fss_delimit_t_initialize_1(3), + f_number_unsigned_t delimits_5[] = { + 0, + 1, + 2, + 3, }; - f_fss_delimit_t delimits_6[] = { - macro_f_fss_delimit_t_initialize_1(0), - macro_f_fss_delimit_t_initialize_1(1), - macro_f_fss_delimit_t_initialize_1(2), - macro_f_fss_delimit_t_initialize_1(10), + f_number_unsigned_t delimits_6[] = { + 0, + 1, + 2, + 10, }; - const f_fss_delimits_t delimitss[] = { - macro_f_fss_delimits_t_initialize_1(delimits_0, 0, 1), - macro_f_fss_delimits_t_initialize_1(delimits_1, 0, 1), - macro_f_fss_delimits_t_initialize_1(delimits_2, 0, 2), - macro_f_fss_delimits_t_initialize_1(delimits_3, 0, 2), - macro_f_fss_delimits_t_initialize_1(delimits_4, 0, 3), - macro_f_fss_delimits_t_initialize_1(delimits_5, 0, 4), - macro_f_fss_delimits_t_initialize_1(delimits_6, 0, 4), + const f_number_unsigneds_t delimitss[] = { + macro_f_number_unsigneds_t_initialize_1(delimits_0, 0, 1), + macro_f_number_unsigneds_t_initialize_1(delimits_1, 0, 1), + macro_f_number_unsigneds_t_initialize_1(delimits_2, 0, 2), + macro_f_number_unsigneds_t_initialize_1(delimits_3, 0, 2), + macro_f_number_unsigneds_t_initialize_1(delimits_4, 0, 3), + macro_f_number_unsigneds_t_initialize_1(delimits_5, 0, 4), + macro_f_number_unsigneds_t_initialize_1(delimits_6, 0, 4), }; for (uint8_t i = 0; i < 7; ++i) { diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.c new file mode 100644 index 0000000..1c6e876 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-simple_packet_ranges_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_simple_packet_ranges_adjust__parameter_checking(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_simple_packet_ranges_adjust__works(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.h new file mode 100644 index 0000000..82c3ee0 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test set quote adjust in the fss project. + */ +#ifndef _TEST__F_fss__simple_packet_range_adjust +#define _TEST__F_fss__simple_packet_range_adjust + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_simple_packet_ranges_adjust() + */ +extern void test__f_fss_simple_packet_ranges_adjust__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_simple_packet_ranges_adjust() + */ +extern void test__f_fss_simple_packet_ranges_adjust__works(void **state); + +#endif // _TEST__F_fss__simple_packet_range_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.c new file mode 100644 index 0000000..e057b15 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.c @@ -0,0 +1,73 @@ +#include "test-fss.h" +#include "test-fss-simple_packet_ranges_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_simple_packet_ranges_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_simple_packet_ranges_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_fss_simple_packet_ranges_decimate_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_fss_simple_packet_ranges_decimate_by__works(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_fss_simple_packet_ranges_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.h new file mode 100644 index 0000000..adda67e --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test set quote decimate by in the fss project. + */ +#ifndef _TEST__F_fss__simple_packet_range_decimate_by +#define _TEST__F_fss__simple_packet_range_decimate_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_simple_packet_ranges_decimate_by() + */ +extern void test__f_fss_simple_packet_ranges_decimate_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_simple_packet_ranges_decimate_by() + */ +extern void test__f_fss_simple_packet_ranges_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_simple_packet_ranges_decimate_by() + */ +extern void test__f_fss_simple_packet_ranges_decimate_by__works(void **state); + +#endif // _TEST__F_fss__simple_packet_range_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.c new file mode 100644 index 0000000..7e64850 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.c @@ -0,0 +1,73 @@ +#include "test-fss.h" +#include "test-fss-simple_packet_ranges_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_simple_packet_ranges_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_simple_packet_ranges_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_fss_simple_packet_ranges_decrease_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_fss_simple_packet_ranges_decrease_by__works(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_fss_simple_packet_ranges_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.h new file mode 100644 index 0000000..dcc9acf --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test set quote decrease by in the fss project. + */ +#ifndef _TEST__F_fss__simple_packet_range_decrease_by +#define _TEST__F_fss__simple_packet_range_decrease_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_simple_packet_ranges_decrease_by() + */ +extern void test__f_fss_simple_packet_ranges_decrease_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_simple_packet_ranges_decrease_by() + */ +extern void test__f_fss_simple_packet_ranges_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_simple_packet_ranges_decrease_by() + */ +extern void test__f_fss_simple_packet_ranges_decrease_by__works(void **state); + +#endif // _TEST__F_fss__simple_packet_range_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.c new file mode 100644 index 0000000..119f1f8 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.c @@ -0,0 +1,75 @@ +#include "test-fss.h" +#include "test-fss-simple_packet_ranges_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_simple_packet_ranges_increase__parameter_checking(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_simple_packet_ranges_increase__returns_data_not(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_fss_simple_packet_ranges_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_fss_simple_packet_ranges_increase__works(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_simple_packet_ranges_increase(1, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length + 1); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.h new file mode 100644 index 0000000..c2f8e03 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test set quote increase in the fss project. + */ +#ifndef _TEST__F_fss__simple_packet_range_increase +#define _TEST__F_fss__simple_packet_range_increase + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_simple_packet_ranges_increase() + */ +extern void test__f_fss_simple_packet_ranges_increase__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_simple_packet_ranges_increase() + */ +extern void test__f_fss_simple_packet_ranges_increase__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_simple_packet_ranges_increase() + */ +extern void test__f_fss_simple_packet_ranges_increase__works(void **state); + +#endif // _TEST__F_fss__simple_packet_range_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.c new file mode 100644 index 0000000..82d4da6 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-simple_packet_ranges_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_simple_packet_ranges_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_simple_packet_ranges_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_fss_simple_packet_ranges_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_fss_simple_packet_ranges_increase_by__works(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_simple_packet_ranges_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.h new file mode 100644 index 0000000..0398704 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test set quote increase by in the fss project. + */ +#ifndef _TEST__F_fss__simple_packet_range_increase_by +#define _TEST__F_fss__simple_packet_range_increase_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_simple_packet_ranges_increase_by() + */ +extern void test__f_fss_simple_packet_ranges_increase_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_simple_packet_ranges_increase_by() + */ +extern void test__f_fss_simple_packet_ranges_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_simple_packet_ranges_increase_by() + */ +extern void test__f_fss_simple_packet_ranges_increase_by__works(void **state); + +#endif // _TEST__F_fss__simple_packet_range_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.c new file mode 100644 index 0000000..74c7833 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-simple_packet_ranges_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_simple_packet_ranges_resize__parameter_checking(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_simple_packet_ranges_resize__works(void **state) { + + const int length = 5; + f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; + + { + const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.h new file mode 100644 index 0000000..9de1e1c --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test set quote resize in the fss project. + */ +#ifndef _TEST__F_fss__simple_packet_range_resize +#define _TEST__F_fss__simple_packet_range_resize + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_simple_packet_ranges_resize() + */ +extern void test__f_fss_simple_packet_ranges_resize__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_simple_packet_ranges_resize() + */ +extern void test__f_fss_simple_packet_ranges_resize__works(void **state); + +#endif // _TEST__F_fss__simple_packet_range_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss.c b/level_0/f_fss/tests/unit/c/test-fss.c index 70c1057..96f2817 100644 --- a/level_0/f_fss/tests/unit/c/test-fss.c +++ b/level_0/f_fss/tests/unit/c/test-fss.c @@ -90,6 +90,11 @@ int main(void) { cmocka_unit_test(test__f_fss_sets_increase__returns_data_not), cmocka_unit_test(test__f_fss_sets_increase_by__returns_data_not), + cmocka_unit_test(test__f_fss_simple_packet_ranges_decimate_by__returns_data_not), + cmocka_unit_test(test__f_fss_simple_packet_ranges_decrease_by__returns_data_not), + cmocka_unit_test(test__f_fss_simple_packet_ranges_increase__returns_data_not), + cmocka_unit_test(test__f_fss_simple_packet_ranges_increase_by__returns_data_not), + #ifndef _di_level_0_parameter_checking_ cmocka_unit_test(test__f_fss_apply_delimit__parameter_checking), cmocka_unit_test(test__f_fss_apply_delimit_range__parameter_checking), @@ -167,6 +172,13 @@ int main(void) { cmocka_unit_test(test__f_fss_sets_increase__parameter_checking), cmocka_unit_test(test__f_fss_sets_increase_by__parameter_checking), cmocka_unit_test(test__f_fss_sets_resize__parameter_checking), + + cmocka_unit_test(test__f_fss_simple_packet_ranges_adjust__parameter_checking), + cmocka_unit_test(test__f_fss_simple_packet_ranges_decimate_by__parameter_checking), + cmocka_unit_test(test__f_fss_simple_packet_ranges_decrease_by__parameter_checking), + cmocka_unit_test(test__f_fss_simple_packet_ranges_increase__parameter_checking), + cmocka_unit_test(test__f_fss_simple_packet_ranges_increase_by__parameter_checking), + cmocka_unit_test(test__f_fss_simple_packet_ranges_resize__parameter_checking), #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_fss/tests/unit/c/test-fss.h b/level_0/f_fss/tests/unit/c/test-fss.h index 8bba342..4943df7 100644 --- a/level_0/f_fss/tests/unit/c/test-fss.h +++ b/level_0/f_fss/tests/unit/c/test-fss.h @@ -91,6 +91,12 @@ #include "test-fss-sets_increase.h" #include "test-fss-sets_increase_by.h" #include "test-fss-sets_resize.h" +#include "test-fss-simple_packet_ranges_adjust.h" +#include "test-fss-simple_packet_ranges_decimate_by.h" +#include "test-fss-simple_packet_ranges_decrease_by.h" +#include "test-fss-simple_packet_ranges_increase.h" +#include "test-fss-simple_packet_ranges_increase_by.h" +#include "test-fss-simple_packet_ranges_resize.h" #include "test-fss-skip_past_delimit.h" #include "test-fss-skip_past_space.h" diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index dccfa64..59c12c6 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -396,6 +396,8 @@ extern "C" { F_parameter_not, F_parent, F_parent_not, + F_partial, + F_partial_not, F_payload, F_payload_not, F_pipe, diff --git a/level_0/f_status_string/c/status_string.c b/level_0/f_status_string/c/status_string.c index 6ee1e08..778f449 100644 --- a/level_0/f_status_string/c/status_string.c +++ b/level_0/f_status_string/c/status_string.c @@ -270,6 +270,8 @@ extern "C" { const f_string_static_t f_status_parameter_not_s = macro_f_string_static_t_initialize_1(F_status_parameter_not_s, 0, F_status_parameter_not_s_length); const f_string_static_t f_status_parent_s = macro_f_string_static_t_initialize_1(F_status_parent_s, 0, F_status_parent_s_length); const f_string_static_t f_status_parent_not_s = macro_f_string_static_t_initialize_1(F_status_parent_not_s, 0, F_status_parent_not_s_length); + const f_string_static_t f_status_partial_s = macro_f_string_static_t_initialize_1(F_status_partial_s, 0, F_status_partial_s_length); + const f_string_static_t f_status_partial_not_s = macro_f_string_static_t_initialize_1(F_status_partial_not_s, 0, F_status_partial_not_s_length); const f_string_static_t f_status_payload_s = macro_f_string_static_t_initialize_1(F_status_payload_s, 0, F_status_payload_s_length); const f_string_static_t f_status_payload_not_s = macro_f_string_static_t_initialize_1(F_status_payload_not_s, 0, F_status_payload_not_s_length); const f_string_static_t f_status_pipe_s = macro_f_string_static_t_initialize_1(F_status_pipe_s, 0, F_status_pipe_s_length); @@ -1971,6 +1973,16 @@ extern "C" { break; + case F_partial: + *name = f_status_partial_s; + + break; + + case F_partial_not: + *name = f_status_partial_not_s; + + break; + case F_payload: *name = f_status_payload_s; diff --git a/level_0/f_status_string/c/status_string.h b/level_0/f_status_string/c/status_string.h index 5be2fe1..b4c6bd5 100644 --- a/level_0/f_status_string/c/status_string.h +++ b/level_0/f_status_string/c/status_string.h @@ -423,6 +423,8 @@ extern "C" { #define F_status_parameter_not_s "F_parameter_not" #define F_status_parent_s "F_parent" #define F_status_parent_not_s "F_parent_not" + #define F_status_partial_s "F_partial" + #define F_status_partial_not_s "F_partial_not" #define F_status_payload_s "F_payload" #define F_status_payload_not_s "F_payload_not" #define F_status_pipe_s "F_pipe" @@ -735,6 +737,8 @@ extern "C" { #define F_status_parameter_not_s_length 15 #define F_status_parent_s_length 8 #define F_status_parent_not_s_length 12 + #define F_status_partial_s_length 9 + #define F_status_partial_not_s_length 13 #define F_status_payload_s_length 9 #define F_status_payload_not_s_length 13 #define F_status_pipe_s_length 6 @@ -1049,6 +1053,8 @@ extern "C" { extern const f_string_static_t f_status_parameter_not_s; extern const f_string_static_t f_status_parent_s; extern const f_string_static_t f_status_parent_not_s; + extern const f_string_static_t f_status_partial_s; + extern const f_string_static_t f_status_partial_not_s; extern const f_string_static_t f_status_payload_s; extern const f_string_static_t f_status_payload_not_s; extern const f_string_static_t f_status_previous_s; diff --git a/level_0/f_status_string/tests/unit/c/test-status_string-to.c b/level_0/f_status_string/tests/unit/c/test-status_string-to.c index 6d7da00..9ea094a 100644 --- a/level_0/f_status_string/tests/unit/c/test-status_string-to.c +++ b/level_0/f_status_string/tests/unit/c/test-status_string-to.c @@ -288,6 +288,8 @@ void test__f_status_string_to__works(void **state) { F_parameter_not, F_parent, F_parent_not, + F_partial, + F_partial_not, F_payload, F_payload_not, F_pipe, @@ -908,6 +910,8 @@ void test__f_status_string_to__works(void **state) { f_status_parameter_not_s, f_status_parent_s, f_status_parent_not_s, + f_status_partial_s, + f_status_partial_not_s, f_status_payload_s, f_status_payload_not_s, f_status_pipe_s, @@ -1269,7 +1273,7 @@ void test__f_status_string_to__works(void **state) { f_status_status_code_last_s, }; - for (uint16_t i = 0; i < 617; ++i) { + for (uint16_t i = 0; i < 619; ++i) { f_string_static_t result = f_string_static_t_initialize; diff --git a/level_1/fl_fss/c/fss/basic.c b/level_1/fl_fss/c/fss/basic.c index 76999e6..9bc7ac4 100644 --- a/level_1/fl_fss/c/fss/basic.c +++ b/level_1/fl_fss/c/fss/basic.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fl_fss_basic_content_read_ - void fl_fss_basic_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_content_t * const found, f_fss_delimits_t * const delimits, f_state_t * const state) { + void fl_fss_basic_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const found, f_number_unsigneds_t * const delimits, f_state_t * const state) { #ifndef _di_level_1_parameter_checking_ if (!state) return; @@ -150,7 +150,7 @@ extern "C" { #endif // _di_fl_fss_basic_content_write_ #ifndef _di_fl_fss_basic_object_read_ - void fl_fss_basic_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_object_t * const found, uint8_t * const quote, f_fss_delimits_t * const delimits, f_state_t * const state) { + void fl_fss_basic_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_range_t * const found, uint8_t * const quote, f_number_unsigneds_t * const delimits, f_state_t * const state) { #ifndef _di_level_1_parameter_checking_ if (!state) return; diff --git a/level_1/fl_fss/c/fss/basic.h b/level_1/fl_fss/c/fss/basic.h index d94d5a4..0108c7a 100644 --- a/level_1/fl_fss/c/fss/basic.h +++ b/level_1/fl_fss/c/fss/basic.h @@ -80,7 +80,7 @@ extern "C" { * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_basic_content_read_ - extern void fl_fss_basic_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_content_t * const found, f_fss_delimits_t * const delimits, f_state_t * const state); + extern void fl_fss_basic_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const found, f_number_unsigneds_t * const delimits, f_state_t * const state); #endif // _di_fl_fss_basic_content_read_ /** @@ -201,7 +201,7 @@ extern "C" { * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_basic_object_read_ - extern void fl_fss_basic_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_object_t * const found, uint8_t * const quote, f_fss_delimits_t * const delimits, f_state_t * const state); + extern void fl_fss_basic_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_range_t * const found, uint8_t * const quote, f_number_unsigneds_t * const delimits, f_state_t * const state); #endif // _di_fl_fss_basic_object_read_ /** diff --git a/level_1/fl_fss/c/fss/basic_list.c b/level_1/fl_fss/c/fss/basic_list.c index a3c0c84..c4604ed 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fl_fss_basic_list_content_read_ - void fl_fss_basic_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_content_t * const found, f_fss_delimits_t * const delimits, f_fss_comments_t * const comments, f_state_t * const state) { + void fl_fss_basic_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const found, f_number_unsigneds_t * const delimits, f_string_ranges_t * const comments, f_state_t * const state) { #ifndef _di_level_1_parameter_checking_ if (!state) return; @@ -540,7 +540,7 @@ extern "C" { #endif // _di_fl_fss_basic_list_content_write_ #ifndef _di_fl_fss_basic_list_object_read_ - void fl_fss_basic_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_object_t * const found, f_fss_delimits_t * const delimits, f_state_t * const state) { + void fl_fss_basic_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_range_t * const found, f_number_unsigneds_t * const delimits, f_state_t * const state) { #ifndef _di_level_1_parameter_checking_ if (!state) return; diff --git a/level_1/fl_fss/c/fss/basic_list.h b/level_1/fl_fss/c/fss/basic_list.h index 51722cd..74fb431 100644 --- a/level_1/fl_fss/c/fss/basic_list.h +++ b/level_1/fl_fss/c/fss/basic_list.h @@ -91,7 +91,7 @@ extern "C" { * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_basic_list_content_read_ - extern void fl_fss_basic_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_content_t * const found, f_fss_delimits_t * const delimits, f_fss_comments_t * const comments, f_state_t * const state); + extern void fl_fss_basic_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const found, f_number_unsigneds_t * const delimits, f_string_ranges_t * const comments, f_state_t * const state); #endif // _di_fl_fss_basic_list_content_read_ /** @@ -219,7 +219,7 @@ extern "C" { * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_basic_list_object_read_ - extern void fl_fss_basic_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_object_t * const found, f_fss_delimits_t * const delimits, f_state_t * const state); + extern void fl_fss_basic_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_range_t * const found, f_number_unsigneds_t * const delimits, f_state_t * const state); #endif // _di_fl_fss_basic_list_object_read_ /** diff --git a/level_1/fl_fss/c/fss/embedded_list.c b/level_1/fl_fss/c/fss/embedded_list.c index fb5f78d..0e3f2d4 100644 --- a/level_1/fl_fss/c/fss/embedded_list.c +++ b/level_1/fl_fss/c/fss/embedded_list.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fl_fss_embedded_list_content_read_ - void fl_fss_embedded_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_nest_t * const found, f_fss_delimits_t * const delimits, f_fss_comments_t * const comments, f_state_t * const state) { + void fl_fss_embedded_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_nest_t * const found, f_number_unsigneds_t * const delimits, f_string_ranges_t * const comments, f_state_t * const state) { #ifndef _di_level_1_parameter_checking_ if (!state) return; @@ -30,7 +30,7 @@ extern "C" { state->status = f_number_unsigneds_increase(state->step_small, &positions_start); if (F_status_is_error(state->status)) return; - f_fss_objects_t objects = f_fss_objects_t_initialize; + f_string_ranges_t objects = f_string_ranges_t_initialize; state->status = f_string_ranges_increase(state->step_small, &objects); @@ -1087,7 +1087,7 @@ extern "C" { #endif // _di_fl_fss_embedded_list_content_write_ #ifndef _di_fl_fss_embedded_list_object_read_ - void fl_fss_embedded_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_object_t * const found, f_fss_delimits_t * const delimits, f_state_t * const state) { + void fl_fss_embedded_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_range_t * const found, f_number_unsigneds_t * const delimits, f_state_t * const state) { #ifndef _di_level_1_parameter_checking_ if (!state) return; diff --git a/level_1/fl_fss/c/fss/embedded_list.h b/level_1/fl_fss/c/fss/embedded_list.h index 68cf785..1254c50 100644 --- a/level_1/fl_fss/c/fss/embedded_list.h +++ b/level_1/fl_fss/c/fss/embedded_list.h @@ -97,7 +97,7 @@ extern "C" { * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_embedded_list_content_read_ - extern void fl_fss_embedded_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_nest_t * const found, f_fss_delimits_t * const delimits, f_fss_comments_t * const comments, f_state_t * const state); + extern void fl_fss_embedded_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_nest_t * const found, f_number_unsigneds_t * const delimits, f_string_ranges_t * const comments, f_state_t * const state); #endif // _di_fl_fss_embedded_list_content_read_ /** @@ -229,7 +229,7 @@ extern "C" { * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_embedded_list_object_read_ - extern void fl_fss_embedded_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_object_t * const found, f_fss_delimits_t * const delimits, f_state_t * const state); + extern void fl_fss_embedded_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_range_t * const found, f_number_unsigneds_t * const delimits, f_state_t * const state); #endif // _di_fl_fss_embedded_list_object_read_ /** diff --git a/level_1/fl_fss/c/fss/extended.c b/level_1/fl_fss/c/fss/extended.c index 6813e72..dea677f 100644 --- a/level_1/fl_fss/c/fss/extended.c +++ b/level_1/fl_fss/c/fss/extended.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fl_fss_extended_content_read_ - void fl_fss_extended_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_content_t * const found, f_uint8s_t * const quotes, f_fss_delimits_t * const delimits, f_state_t * const state) { + void fl_fss_extended_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const found, f_uint8s_t * const quotes, f_number_unsigneds_t * const delimits, f_state_t * const state) { #ifndef _di_level_1_parameter_checking_ if (!state) return; @@ -208,7 +208,7 @@ extern "C" { #endif // _di_fl_fss_extended_content_write_ #ifndef _di_fl_fss_extended_object_read_ - void fl_fss_extended_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_object_t * const found, uint8_t * const quote, f_fss_delimits_t * const delimits, f_state_t * const state) { + void fl_fss_extended_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_range_t * const found, uint8_t * const quote, f_number_unsigneds_t * const delimits, f_state_t * const state) { #ifndef _di_level_1_parameter_checking_ if (!state) return; diff --git a/level_1/fl_fss/c/fss/extended.h b/level_1/fl_fss/c/fss/extended.h index 22bbe8f..9f047c8 100644 --- a/level_1/fl_fss/c/fss/extended.h +++ b/level_1/fl_fss/c/fss/extended.h @@ -94,7 +94,7 @@ extern "C" { * @see fl_fss_extended_content_read() */ #ifndef _di_fl_fss_extended_content_read_ - extern void fl_fss_extended_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_content_t * const found, f_uint8s_t * const quotes, f_fss_delimits_t * const delimits, f_state_t * const state); + extern void fl_fss_extended_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const found, f_uint8s_t * const quotes, f_number_unsigneds_t * const delimits, f_state_t * const state); #endif // _di_fl_fss_extended_content_read_ /** @@ -233,7 +233,7 @@ extern "C" { * @see fl_fss_extended_content_read() */ #ifndef _di_fl_fss_extended_object_read_ - extern void fl_fss_extended_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_object_t * const found, uint8_t * const quote, f_fss_delimits_t * const delimits, f_state_t * const state); + extern void fl_fss_extended_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_range_t * const found, uint8_t * const quote, f_number_unsigneds_t * const delimits, f_state_t * const state); #endif // _di_fl_fss_extended_object_read_ /** diff --git a/level_1/fl_fss/c/fss/extended_list.c b/level_1/fl_fss/c/fss/extended_list.c index 5c112bf..aa5dc2d 100644 --- a/level_1/fl_fss/c/fss/extended_list.c +++ b/level_1/fl_fss/c/fss/extended_list.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fl_fss_extended_list_content_read_ - void fl_fss_extended_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_content_t * const found, f_fss_delimits_t * const delimits, f_fss_comments_t * const comments, f_state_t * const state) { + void fl_fss_extended_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const found, f_number_unsigneds_t * const delimits, f_string_ranges_t * const comments, f_state_t * const state) { #ifndef _di_level_1_parameter_checking_ if (!state) return; @@ -527,7 +527,7 @@ extern "C" { #endif // _di_fl_fss_extended_list_content_write_ #ifndef _di_fl_fss_extended_list_object_read_ - void fl_fss_extended_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_object_t * const found, f_fss_delimits_t * const delimits, f_state_t * const state) { + void fl_fss_extended_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_range_t * const found, f_number_unsigneds_t * const delimits, f_state_t * const state) { #ifndef _di_level_1_parameter_checking_ if (!state) return; diff --git a/level_1/fl_fss/c/fss/extended_list.h b/level_1/fl_fss/c/fss/extended_list.h index 051c605..f03eb81 100644 --- a/level_1/fl_fss/c/fss/extended_list.h +++ b/level_1/fl_fss/c/fss/extended_list.h @@ -93,7 +93,7 @@ extern "C" { * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_extended_list_content_read_ - extern void fl_fss_extended_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_content_t * const found, f_fss_delimits_t * const delimits, f_fss_comments_t * const comments, f_state_t * const state); + extern void fl_fss_extended_list_content_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const found, f_number_unsigneds_t * const delimits, f_string_ranges_t * const comments, f_state_t * const state); #endif // _di_fl_fss_extended_list_content_read_ /** @@ -225,7 +225,7 @@ extern "C" { * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_extended_list_object_read_ - extern void fl_fss_extended_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_object_t * const found, f_fss_delimits_t * const delimits, f_state_t * const state); + extern void fl_fss_extended_list_object_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_range_t * const found, f_number_unsigneds_t * const delimits, f_state_t * const state); #endif // _di_fl_fss_extended_list_object_read_ /** diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index a60e44c..883c278 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -111,7 +111,7 @@ extern "C" { #endif // !defined(_di_fl_fss_basic_list_object_write_) || !defined(_di_fl_fss_extended_list_object_write_) #if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) - void private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_string_range_t * const range, f_fss_object_t * const found, uint8_t * const quote, f_fss_delimits_t * const delimits, f_state_t * const state) { + void private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_string_range_t * const range, f_string_range_t * const found, uint8_t * const quote, f_number_unsigneds_t * const delimits, f_state_t * const state) { f_fss_skip_past_space(buffer, range, state); if (F_status_is_error(state->status)) return; diff --git a/level_1/fl_fss/c/private-fss.h b/level_1/fl_fss/c/private-fss.h index 3c5b1e8..7578c2e 100644 --- a/level_1/fl_fss/c/private-fss.h +++ b/level_1/fl_fss/c/private-fss.h @@ -156,7 +156,7 @@ extern "C" { * @see fl_fss_extended_content_read() */ #if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) - extern void private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_string_range_t * const range, f_fss_object_t * const found, uint8_t * const quote, f_fss_delimits_t * const delimits, f_state_t * const state) F_attribute_visibility_internal_d; + extern void private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_string_range_t * const range, f_string_range_t * const found, uint8_t * const quote, f_number_unsigneds_t * const delimits, f_state_t * const state) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) /** diff --git a/level_1/fl_status_string/c/status_string.c b/level_1/fl_status_string/c/status_string.c index 9485b26..48b9bd4 100644 --- a/level_1/fl_status_string/c/status_string.c +++ b/level_1/fl_status_string/c/status_string.c @@ -1571,6 +1571,18 @@ extern "C" { return F_none; } + if (f_compare_dynamic(name, f_status_partial_s) == F_equal_to) { + *code = F_partial; + + return F_none; + } + + if (f_compare_dynamic(name, f_status_partial_not_s) == F_equal_to) { + *code = F_partial_not; + + return F_none; + } + if (f_compare_dynamic(name, f_status_payload_s) == F_equal_to) { *code = F_payload; diff --git a/level_1/fl_status_string/tests/unit/c/test-status_string-from.c b/level_1/fl_status_string/tests/unit/c/test-status_string-from.c index 8e4f1fb..9feaef6 100644 --- a/level_1/fl_status_string/tests/unit/c/test-status_string-from.c +++ b/level_1/fl_status_string/tests/unit/c/test-status_string-from.c @@ -304,6 +304,8 @@ void test__fl_status_string_from__works(void **state) { F_parameter_not, F_parent, F_parent_not, + F_partial, + F_partial_not, F_payload, F_payload_not, F_pipe, @@ -924,6 +926,8 @@ void test__fl_status_string_from__works(void **state) { f_status_parameter_not_s, f_status_parent_s, f_status_parent_not_s, + f_status_partial_s, + f_status_partial_not_s, f_status_payload_s, f_status_payload_not_s, f_status_pipe_s, @@ -1285,7 +1289,7 @@ void test__fl_status_string_from__works(void **state) { f_status_status_code_last_s, }; - for (uint16_t i = 0; i < 617; ++i) { + for (uint16_t i = 0; i < 619; ++i) { f_status_t result = F_none; diff --git a/level_2/fll_fss/c/fss.c b/level_2/fll_fss/c/fss.c index e440234..1cb75a2 100644 --- a/level_2/fll_fss/c/fss.c +++ b/level_2/fll_fss/c/fss.c @@ -165,7 +165,7 @@ extern "C" { #endif // _di_fll_fss_identify_ #ifndef _di_fll_fss_snatch_ - f_status_t fll_fss_snatch(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]) { + f_status_t fll_fss_snatch(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -218,7 +218,7 @@ extern "C" { #endif // _di_fll_fss_snatch_ #ifndef _di_fll_fss_snatch_apart_ - f_status_t fll_fss_snatch_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_dynamics_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { + f_status_t fll_fss_snatch_apart(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_dynamics_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -230,7 +230,7 @@ extern "C" { if (!contents.used) return F_data_not; f_status_t status = F_none; - f_fss_content_t *content = 0; + f_string_ranges_t *content = 0; f_number_unsigned_t i = 0; f_number_unsigned_t j = 0; @@ -284,7 +284,7 @@ extern "C" { #endif // _di_fll_fss_snatch_apart_ #ifndef _di_fll_fss_snatch_map_ - f_status_t fll_fss_snatch_map(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { + f_status_t fll_fss_snatch_map(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -427,7 +427,7 @@ extern "C" { #endif // _di_fll_fss_snatch_map_ #ifndef _di_fll_fss_snatch_map_apart_ - f_status_t fll_fss_snatch_map_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_map_multis_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { + f_status_t fll_fss_snatch_map_apart(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_map_multis_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -501,7 +501,7 @@ extern "C" { #endif // _di_fll_fss_snatch_map_apart_ #ifndef _di_fll_fss_snatch_map_mash_ - f_status_t fll_fss_snatch_map_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { + f_status_t fll_fss_snatch_map_mash(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -570,7 +570,7 @@ extern "C" { #endif // _di_fll_fss_snatch_map_mash_ #ifndef _di_fll_fss_snatch_map_mash_apart_ - f_status_t fll_fss_snatch_map_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_map_multis_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { + f_status_t fll_fss_snatch_map_mash_apart(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_map_multis_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -687,7 +687,7 @@ extern "C" { #endif // _di_fll_fss_snatch_map_mash_apart_ #ifndef _di_fll_fss_snatch_map_together_ - f_status_t fll_fss_snatch_map_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { + f_status_t fll_fss_snatch_map_together(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -801,7 +801,7 @@ extern "C" { #endif // _di_fll_fss_snatch_map_together_ #ifndef _di_fll_fss_snatch_mash_ - f_status_t fll_fss_snatch_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]) { + f_status_t fll_fss_snatch_mash(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -856,7 +856,7 @@ extern "C" { #endif // _di_fll_fss_snatch_mash_ #ifndef _di_fll_fss_snatch_mash_apart_ - f_status_t fll_fss_snatch_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamics_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { + f_status_t fll_fss_snatch_mash_apart(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamics_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); @@ -914,7 +914,7 @@ extern "C" { #endif // _di_fll_fss_snatch_mash_apart_ #ifndef _di_fll_fss_snatch_together_ - f_status_t fll_fss_snatch_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]) { + f_status_t fll_fss_snatch_together(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]) { #ifndef _di_level_2_parameter_checking_ if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); diff --git a/level_2/fll_fss/c/fss.h b/level_2/fll_fss/c/fss.h index 77c02c3..6f5a033 100644 --- a/level_2/fll_fss/c/fss.h +++ b/level_2/fll_fss/c/fss.h @@ -119,7 +119,7 @@ extern "C" { * @see f_compare_trim() */ #ifndef _di_fll_fss_snatch_ - extern f_status_t fll_fss_snatch(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]); + extern f_status_t fll_fss_snatch(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]); #endif // _di_fll_fss_snatch_ /** @@ -167,7 +167,7 @@ extern "C" { * @see f_compare_trim() */ #ifndef _di_fll_fss_snatch_apart_ - extern f_status_t fll_fss_snatch_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_dynamics_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); + extern f_status_t fll_fss_snatch_apart(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_dynamics_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); #endif // _di_fll_fss_snatch_apart_ /** @@ -217,7 +217,7 @@ extern "C" { * @see f_compare_trim() */ #ifndef _di_fll_fss_snatch_map_ - extern f_status_t fll_fss_snatch_map(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); + extern f_status_t fll_fss_snatch_map(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); #endif // _di_fll_fss_snatch_map_ /** @@ -269,7 +269,7 @@ extern "C" { * @see f_compare_trim() */ #ifndef _di_fll_fss_snatch_map_apart_ - extern f_status_t fll_fss_snatch_map_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_map_multis_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); + extern f_status_t fll_fss_snatch_map_apart(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_map_multis_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); #endif // _di_fll_fss_snatch_map_apart_ /** @@ -319,7 +319,7 @@ extern "C" { * Errors (with error bit) from: f_compare_dynamic_partial_trim_string(). */ #ifndef _di_fll_fss_snatch_map_mash_ - extern f_status_t fll_fss_snatch_map_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); + extern f_status_t fll_fss_snatch_map_mash(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); #endif // _di_fll_fss_snatch_map_mash_ /** @@ -373,7 +373,7 @@ extern "C" { * @see f_compare_trim() */ #ifndef _di_fll_fss_snatch_map_mash_apart_ - extern f_status_t fll_fss_snatch_map_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_map_multis_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); + extern f_status_t fll_fss_snatch_map_mash_apart(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_map_multis_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); #endif // _di_fll_fss_snatch_map_mash_apart_ /** @@ -426,7 +426,7 @@ extern "C" { * @see f_compare_trim() */ #ifndef _di_fll_fss_snatch_map_together_ - extern f_status_t fll_fss_snatch_map_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); + extern f_status_t fll_fss_snatch_map_together(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_maps_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); #endif // _di_fll_fss_snatch_map_together_ /** @@ -473,7 +473,7 @@ extern "C" { * Errors (with error bit) from: f_compare_dynamic_partial_trim_string(). */ #ifndef _di_fll_fss_snatch_mash_ - extern f_status_t fll_fss_snatch_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]); + extern f_status_t fll_fss_snatch_mash(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]); #endif // _di_fll_fss_snatch_mash_ /** @@ -524,7 +524,7 @@ extern "C" { * @see f_compare_trim() */ #ifndef _di_fll_fss_snatch_mash_apart_ - extern f_status_t fll_fss_snatch_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamics_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); + extern f_status_t fll_fss_snatch_mash_apart(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamics_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); #endif // _di_fll_fss_snatch_mash_apart_ /** @@ -572,7 +572,7 @@ extern "C" { * @see f_compare_trim() */ #ifndef _di_fll_fss_snatch_together_ - extern f_status_t fll_fss_snatch_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]); + extern f_status_t fll_fss_snatch_together(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, const f_string_static_t glue, f_string_dynamic_t * const values[], bool matches[], f_number_unsigned_t * const indexs[]); #endif // _di_fll_fss_snatch_together_ #ifdef __cplusplus diff --git a/level_2/fll_fss/c/fss/basic.c b/level_2/fll_fss/c/fss/basic.c index bddd2bc..d20caba 100644 --- a/level_2/fll_fss/c/fss/basic.c +++ b/level_2/fll_fss/c/fss/basic.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_fll_fss_basic_read_ - void fll_fss_basic_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_objects_t * const objects, f_fss_contents_t * const contents, f_uint8s_t * const objects_quoted, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_state_t * const state) { + void fll_fss_basic_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const objects, f_string_rangess_t * const contents, f_uint8s_t * const objects_quoted, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_state_t * const state) { #ifndef _di_level_2_parameter_checking_ if (!state) return; diff --git a/level_2/fll_fss/c/fss/basic.h b/level_2/fll_fss/c/fss/basic.h index efca827..2df31bf 100644 --- a/level_2/fll_fss/c/fss/basic.h +++ b/level_2/fll_fss/c/fss/basic.h @@ -82,7 +82,7 @@ extern "C" { * @see fl_fss_basic_object_read() */ #ifndef _di_fll_fss_basic_read_ - extern void fll_fss_basic_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_objects_t * const objects, f_fss_contents_t * const contents, f_uint8s_t * const objects_quoted, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_state_t * const state); + extern void fll_fss_basic_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const objects, f_string_rangess_t * const contents, f_uint8s_t * const objects_quoted, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_state_t * const state); #endif // _di_fll_fss_basic_read_ /** diff --git a/level_2/fll_fss/c/fss/basic_list.c b/level_2/fll_fss/c/fss/basic_list.c index db37735..b42f65d 100644 --- a/level_2/fll_fss/c/fss/basic_list.c +++ b/level_2/fll_fss/c/fss/basic_list.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_fll_fss_basic_list_read_ - void fll_fss_basic_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_objects_t * const objects, f_fss_contents_t * const contents, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_fss_comments_t * const comments, f_state_t * const state) { + void fll_fss_basic_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const objects, f_string_rangess_t * const contents, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_string_ranges_t * const comments, f_state_t * const state) { #ifndef _di_level_2_parameter_checking_ if (!state) return; diff --git a/level_2/fll_fss/c/fss/basic_list.h b/level_2/fll_fss/c/fss/basic_list.h index 1cecc29..7f6fc53 100644 --- a/level_2/fll_fss/c/fss/basic_list.h +++ b/level_2/fll_fss/c/fss/basic_list.h @@ -81,7 +81,7 @@ extern "C" { * @see fl_fss_basic_list_object_read() */ #ifndef _di_fll_fss_basic_list_read_ - extern void fll_fss_basic_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_objects_t * const objects, f_fss_contents_t * const contents, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_fss_comments_t * const comments, f_state_t * const state); + extern void fll_fss_basic_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const objects, f_string_rangess_t * const contents, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_string_ranges_t * const comments, f_state_t * const state); #endif // _di_fll_fss_basic_list_read_ /** diff --git a/level_2/fll_fss/c/fss/embedded_list.c b/level_2/fll_fss/c/fss/embedded_list.c index fcde9b1..b956751 100644 --- a/level_2/fll_fss/c/fss/embedded_list.c +++ b/level_2/fll_fss/c/fss/embedded_list.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_fll_fss_embedded_list_read_ - void fll_fss_embedded_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_nest_t * const nest, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_fss_comments_t * const comments, f_state_t * const state) { + void fll_fss_embedded_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_nest_t * const nest, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_string_ranges_t * const comments, f_state_t * const state) { #ifndef _di_level_2_parameter_checking_ if (!state) return; diff --git a/level_2/fll_fss/c/fss/embedded_list.h b/level_2/fll_fss/c/fss/embedded_list.h index 5f8f6f0..0dd2cb5 100644 --- a/level_2/fll_fss/c/fss/embedded_list.h +++ b/level_2/fll_fss/c/fss/embedded_list.h @@ -81,7 +81,7 @@ extern "C" { * @see fl_fss_embedded_list_object_read() */ #ifndef _di_fll_fss_embedded_list_read_ - extern void fll_fss_embedded_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_nest_t * const nest, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_fss_comments_t * const comments, f_state_t * const state); + extern void fll_fss_embedded_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_nest_t * const nest, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_string_ranges_t * const comments, f_state_t * const state); #endif // _di_fll_fss_embedded_list_read_ /** diff --git a/level_2/fll_fss/c/fss/extended.c b/level_2/fll_fss/c/fss/extended.c index 3749296..c058482 100644 --- a/level_2/fll_fss/c/fss/extended.c +++ b/level_2/fll_fss/c/fss/extended.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_fll_fss_extended_read_ - void fll_fss_extended_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_objects_t * const objects, f_fss_contents_t * const contents, f_uint8s_t * const objects_quoted, f_uint8ss_t * const contents_quoted, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_state_t * const state) { + void fll_fss_extended_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const objects, f_string_rangess_t * const contents, f_uint8s_t * const objects_quoted, f_uint8ss_t * const contents_quoted, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_state_t * const state) { #ifndef _di_level_2_parameter_checking_ if (!state) return; diff --git a/level_2/fll_fss/c/fss/extended.h b/level_2/fll_fss/c/fss/extended.h index 6df690e..7fb7030 100644 --- a/level_2/fll_fss/c/fss/extended.h +++ b/level_2/fll_fss/c/fss/extended.h @@ -85,7 +85,7 @@ extern "C" { * @see fl_fss_extended_object_read() */ #ifndef _di_fll_fss_extended_read_ - extern void fll_fss_extended_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_objects_t * const objects, f_fss_contents_t * const contents, f_uint8s_t * const objects_quoted, f_uint8ss_t * const contents_quoted, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_state_t * const state); + extern void fll_fss_extended_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const objects, f_string_rangess_t * const contents, f_uint8s_t * const objects_quoted, f_uint8ss_t * const contents_quoted, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_state_t * const state); #endif // _di_fll_fss_extended_read_ /** diff --git a/level_2/fll_fss/c/fss/extended_list.c b/level_2/fll_fss/c/fss/extended_list.c index 0589b83..08ae998 100644 --- a/level_2/fll_fss/c/fss/extended_list.c +++ b/level_2/fll_fss/c/fss/extended_list.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_fll_fss_extended_list_read_ - void fll_fss_extended_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_objects_t * const objects, f_fss_contents_t * const contents, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_fss_comments_t * const comments, f_state_t * const state) { + void fll_fss_extended_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const objects, f_string_rangess_t * const contents, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_string_ranges_t * const comments, f_state_t * const state) { #ifndef _di_level_2_parameter_checking_ if (!state) return; diff --git a/level_2/fll_fss/c/fss/extended_list.h b/level_2/fll_fss/c/fss/extended_list.h index 0c3767c..371b61d 100644 --- a/level_2/fll_fss/c/fss/extended_list.h +++ b/level_2/fll_fss/c/fss/extended_list.h @@ -85,7 +85,7 @@ extern "C" { * @see fl_fss_extended_list_object_read() */ #ifndef _di_fll_fss_extended_list_read_ - extern void fll_fss_extended_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_objects_t * const objects, f_fss_contents_t * const contents, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_fss_comments_t * const comments, f_state_t * const state); + extern void fll_fss_extended_list_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const objects, f_string_rangess_t * const contents, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_string_ranges_t * const comments, f_state_t * const state); #endif // _di_fll_fss_extended_list_read_ /** diff --git a/level_2/fll_fss/c/fss/payload.c b/level_2/fll_fss/c/fss/payload.c index 1246931..a601f02 100644 --- a/level_2/fll_fss/c/fss/payload.c +++ b/level_2/fll_fss/c/fss/payload.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_fll_fss_payload_read_ - void fll_fss_payload_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_objects_t * const objects, f_fss_contents_t * const contents, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_fss_comments_t * const comments, f_state_t * const state) { + void fll_fss_payload_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const objects, f_string_rangess_t * const contents, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_string_ranges_t * const comments, f_state_t * const state) { #ifndef _di_level_2_parameter_checking_ if (!state) return; diff --git a/level_2/fll_fss/c/fss/payload.h b/level_2/fll_fss/c/fss/payload.h index c5d51e3..cfc5cdc 100644 --- a/level_2/fll_fss/c/fss/payload.h +++ b/level_2/fll_fss/c/fss/payload.h @@ -98,7 +98,7 @@ extern "C" { * @see fl_fss_basic_list_object_read() */ #ifndef _di_fll_fss_payload_read_ - extern void fll_fss_payload_read(const f_string_static_t buffer, f_string_range_t * const range, f_fss_objects_t * const objects, f_fss_contents_t * const contents, f_fss_delimits_t * const objects_delimits, f_fss_delimits_t * const contents_delimits, f_fss_comments_t * const comments, f_state_t * const state); + extern void fll_fss_payload_read(const f_string_static_t buffer, f_string_range_t * const range, f_string_ranges_t * const objects, f_string_rangess_t * const contents, f_number_unsigneds_t * const objects_delimits, f_number_unsigneds_t * const contents_delimits, f_string_ranges_t * const comments, f_state_t * const state); #endif // _di_fll_fss_payload_read_ /** diff --git a/level_3/control/c/private-common.h b/level_3/control/c/private-common.h index 8dc883c..89505dd 100644 --- a/level_3/control/c/private-common.h +++ b/level_3/control/c/private-common.h @@ -241,13 +241,13 @@ extern "C" { f_string_dynamic_t small; f_string_dynamic_t packet; - f_fss_objects_t packet_objects; - f_fss_contents_t packet_contents; + f_string_ranges_t packet_objects; + f_string_rangess_t packet_contents; - f_fss_objects_t header_objects; - f_fss_contents_t header_contents; + f_string_ranges_t header_objects; + f_string_rangess_t header_contents; - f_fss_delimits_t delimits; + f_number_unsigneds_t delimits; } control_cache_t; #define control_cache_initialize \ @@ -255,11 +255,11 @@ extern "C" { f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ - f_fss_objects_t_initialize, \ - f_fss_contents_t_initialize, \ - f_fss_objects_t_initialize, \ - f_fss_contents_t_initialize, \ - f_fss_delimits_t_initialize, \ + f_string_ranges_t_initialize, \ + f_string_rangess_t_initialize, \ + f_string_ranges_t_initialize, \ + f_string_rangess_t_initialize, \ + f_number_unsigneds_t_initialize, \ } #endif // _di_control_cache_t_ diff --git a/level_3/control/c/private-control.c b/level_3/control/c/private-control.c index 20a480c..43868e3 100644 --- a/level_3/control/c/private-control.c +++ b/level_3/control/c/private-control.c @@ -654,9 +654,9 @@ extern "C" { f_state_t state = f_state_t_initialize; f_string_range_t range = f_string_range_t_initialize; - f_fss_objects_t objects = f_fss_objects_t_initialize; - f_fss_contents_t contents = f_fss_contents_t_initialize; - f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + f_string_ranges_t objects = f_string_ranges_t_initialize; + f_string_rangess_t contents = f_string_rangess_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; status = fll_fss_extended_read(data->cache.large, state, &range, &objects, &contents, 0, 0, &delimits, 0); diff --git a/level_3/controller/c/common/private-cache.h b/level_3/controller/c/common/private-cache.h index 6e221bb..7df5c5e 100644 --- a/level_3/controller/c/common/private-cache.h +++ b/level_3/controller/c/common/private-cache.h @@ -81,14 +81,14 @@ extern "C" { f_number_unsigneds_t ats; f_number_unsigneds_t stack; - f_fss_comments_t comments; - f_fss_delimits_t delimits; + f_string_ranges_t comments; + f_number_unsigneds_t delimits; - f_fss_content_t content_action; - f_fss_contents_t content_actions; - f_fss_contents_t content_items; - f_fss_objects_t object_actions; - f_fss_objects_t object_items; + f_string_ranges_t content_action; + f_string_rangess_t content_actions; + f_string_rangess_t content_items; + f_string_ranges_t object_actions; + f_string_ranges_t object_items; f_string_dynamic_t buffer_file; f_string_dynamic_t buffer_item; @@ -104,13 +104,13 @@ extern "C" { f_string_range_t_initialize, \ f_number_unsigneds_t_initialize, \ f_number_unsigneds_t_initialize, \ - f_fss_comments_t_initialize, \ - f_fss_delimits_t_initialize, \ - f_fss_content_t_initialize, \ - f_fss_contents_t_initialize, \ - f_fss_contents_t_initialize, \ - f_fss_objects_t_initialize, \ - f_fss_objects_t_initialize, \ + f_string_ranges_t_initialize, \ + f_number_unsigneds_t_initialize, \ + f_string_ranges_t_initialize, \ + f_string_rangess_t_initialize, \ + f_string_rangess_t_initialize, \ + f_string_ranges_t_initialize, \ + f_string_ranges_t_initialize, \ f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ @@ -138,7 +138,7 @@ extern "C" { * The cache to deallocate. * * @see macro_f_number_unsigneds_t_delete_simple() - * @see macro_f_fss_delimits_t_delete_simple() + * @see macro_f_number_unsigneds_t_delete_simple() * * @see controller_cache_action_delete_simple() * @see f_string_dynamic_resize() diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index ed521db..66a5019 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -60,7 +60,7 @@ extern "C" { #endif // _di_controller_rule_find_ #ifndef _di_controller_rule_parameters_read_ - f_status_t controller_rule_parameters_read(const controller_global_t global, const f_string_static_t buffer, f_fss_object_t * const object, f_fss_content_t * const content, controller_rule_action_t * const action, f_state_t * const state) { + f_status_t controller_rule_parameters_read(const controller_global_t global, const f_string_static_t buffer, f_string_range_t * const object, f_string_ranges_t * const content, controller_rule_action_t * const action, f_state_t * const state) { f_status_t status = F_none; diff --git a/level_3/controller/c/rule/private-rule.h b/level_3/controller/c/rule/private-rule.h index abc4d8e..eba8634 100644 --- a/level_3/controller/c/rule/private-rule.h +++ b/level_3/controller/c/rule/private-rule.h @@ -101,7 +101,7 @@ extern "C" { * @see fl_iki_read() */ #ifndef _di_controller_rule_parameters_read_ - extern f_status_t controller_rule_parameters_read(const controller_global_t global, const f_string_static_t buffer, f_fss_object_t * const object, f_fss_content_t * const content, controller_rule_action_t * const action, f_state_t * const state) F_attribute_visibility_internal_d; + extern f_status_t controller_rule_parameters_read(const controller_global_t global, const f_string_static_t buffer, f_string_range_t * const object, f_string_ranges_t * const content, controller_rule_action_t * const action, f_state_t * const state) F_attribute_visibility_internal_d; #endif // _di_controller_rule_parameters_read_ /** diff --git a/level_3/fake/c/main/build/load.c b/level_3/fake/c/main/build/load.c index 25fdd07..37f3a2c 100644 --- a/level_3/fake/c/main/build/load.c +++ b/level_3/fake/c/main/build/load.c @@ -129,8 +129,8 @@ extern "C" { { f_string_dynamic_t buffer = f_string_dynamic_t_initialize; - f_fss_objects_t objects = f_fss_objects_t_initialize; - f_fss_contents_t contents = f_fss_contents_t_initialize; + f_string_ranges_t objects = f_string_ranges_t_initialize; + f_string_rangess_t contents = f_string_rangess_t_initialize; if (process_pipe) { fake_pipe_buffer(data, &buffer); @@ -151,7 +151,7 @@ extern "C" { if (F_status_is_error_not(main->setting.state.status)) { f_string_range_t range = macro_f_string_range_t_initialize_2(buffer.used); - f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; fll_fss_extended_read(buffer, &range, &objects, &contents, 0, 0, &delimits, 0, &main->setting.state); @@ -169,13 +169,13 @@ extern "C" { } } - macro_f_fss_delimits_t_delete_simple(delimits); + macro_f_number_unsigneds_t_delete_simple(delimits); } f_string_dynamic_resize(0, &buffer); - macro_f_fss_objects_t_delete_simple(objects); - macro_f_fss_contents_t_delete_simple(contents); + macro_f_string_ranges_t_delete_simple(objects); + macro_f_string_rangess_t_delete_simple(contents); } // Error when required settings are not specified. @@ -213,7 +213,7 @@ extern "C" { #endif // _di_fake_build_load_setting_ #ifndef _di_fake_build_load_setting_process_ - void fake_build_load_setting_process(fake_data_t * const data, const bool checks, const f_string_static_t path_file, const f_string_statics_t * const modes_custom, const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, fake_build_setting_t * const setting) { + void fake_build_load_setting_process(fake_data_t * const data, const bool checks, const f_string_static_t path_file, const f_string_statics_t * const modes_custom, const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, fake_build_setting_t * const setting) { if (!data || !data->main || !setting) return; if (F_status_is_error(data->main->setting.state.status) && buffer.used) return; diff --git a/level_3/fake/c/main/build/load.h b/level_3/fake/c/main/build/load.h index a8a6488..40de6a4 100644 --- a/level_3/fake/c/main/build/load.h +++ b/level_3/fake/c/main/build/load.h @@ -156,7 +156,7 @@ extern "C" { * @see fll_fss_snatch_apart() */ #ifndef _di_fake_build_load_setting_process_ - extern void fake_build_load_setting_process(fake_data_t * const data, const bool checks, const f_string_static_t path_file, const f_string_statics_t * const modes_custom, const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, fake_build_setting_t * const setting); + extern void fake_build_load_setting_process(fake_data_t * const data, const bool checks, const f_string_static_t path_file, const f_string_statics_t * const modes_custom, const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, fake_build_setting_t * const setting); #endif // _di_fake_build_load_setting_process_ /** diff --git a/level_3/fake/c/main/make/load_fakefile.c b/level_3/fake/c/main/make/load_fakefile.c index 319a162..d959540 100644 --- a/level_3/fake/c/main/make/load_fakefile.c +++ b/level_3/fake/c/main/make/load_fakefile.c @@ -36,13 +36,13 @@ extern "C" { return; } - f_fss_objects_t list_objects = f_fss_objects_t_initialize; - f_fss_contents_t list_contents = f_fss_contents_t_initialize; - f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + f_string_ranges_t list_objects = f_string_ranges_t_initialize; + f_string_rangess_t list_contents = f_string_rangess_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; { f_string_range_t range = macro_f_string_range_t_initialize_2(data_make->main->buffer.used); - f_fss_comments_t comments = f_fss_comments_t_initialize; + f_string_ranges_t comments = f_string_ranges_t_initialize; fll_fss_basic_list_read(data_make->main->buffer, &range, &list_objects, &list_contents, &delimits, 0, &comments, &data_make->main->setting.state); @@ -298,7 +298,7 @@ extern "C" { #endif // _di_fake_make_load_fakefile_ #ifndef _di_fake_make_load_fakefile_setting_build_ - void fake_make_load_fakefile_setting_build(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) { + void fake_make_load_fakefile_setting_build(fake_make_data_t * const data_make, f_string_range_t * const object, f_string_ranges_t * const content) { if (!data_make || !data_make->data || !data_make->main || !object || !content) return; @@ -324,7 +324,7 @@ extern "C" { #endif // _di_fake_make_load_fakefile_setting_build_ #ifndef _di_fake_make_load_fakefile_setting_compiler_ - void fake_make_load_fakefile_setting_compiler(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_compiler) { + void fake_make_load_fakefile_setting_compiler(fake_make_data_t * const data_make, f_string_range_t * const object, f_string_ranges_t * const content, f_string_range_t **range_compiler) { if (!data_make || !data_make->data || !data_make->main || !object || !content || !range_compiler) return; @@ -426,7 +426,7 @@ extern "C" { #endif // _di_fake_make_load_fakefile_setting_define_and_parameter_ #ifndef _di_fake_make_load_fakefile_setting_environment_ - void fake_make_load_fakefile_setting_environment(fake_make_data_t * const data_make, f_fss_content_t * const content) { + void fake_make_load_fakefile_setting_environment(fake_make_data_t * const data_make, f_string_ranges_t * const content) { if (!data_make || !data_make->data || !data_make->data || !data_make->main || !content) return; @@ -512,7 +512,7 @@ extern "C" { #endif // _di_fake_make_load_fakefile_setting_environment_ #ifndef _di_fake_make_load_fakefile_setting_fail_ - void fake_make_load_fakefile_setting_fail(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) { + void fake_make_load_fakefile_setting_fail(fake_make_data_t * const data_make, f_string_range_t * const object, f_string_ranges_t * const content) { if (!data_make || !data_make->data || !data_make->data || !data_make->main || !object || !content) return; @@ -541,7 +541,7 @@ extern "C" { #endif // _di_fake_make_load_fakefile_setting_fail_ #ifndef _di_fake_make_load_fakefile_setting_indexer_ - void fake_make_load_fakefile_setting_indexer(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_indexer) { + void fake_make_load_fakefile_setting_indexer(fake_make_data_t * const data_make, f_string_range_t * const object, f_string_ranges_t * const content, f_string_range_t **range_indexer) { if (!data_make || !data_make->data || !data_make->data || !data_make->main || !object || !content || !range_indexer) return; @@ -559,7 +559,7 @@ extern "C" { #endif // _di_fake_make_load_fakefile_setting_indexer_ #ifndef _di_fake_make_load_fakefile_setting_parameter_ - void fake_make_load_fakefile_setting_parameter(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) { + void fake_make_load_fakefile_setting_parameter(fake_make_data_t * const data_make, f_string_range_t * const object, f_string_ranges_t * const content) { if (!data_make || !data_make->data || !data_make->data || !data_make->main || !object || !content) return; diff --git a/level_3/fake/c/main/make/load_fakefile.h b/level_3/fake/c/main/make/load_fakefile.h index 080051f..6a5c141 100644 --- a/level_3/fake/c/main/make/load_fakefile.h +++ b/level_3/fake/c/main/make/load_fakefile.h @@ -89,7 +89,7 @@ extern "C" { * The setting content. */ #ifndef _di_fake_make_load_fakefile_setting_build_ - extern void fake_make_load_fakefile_setting_build(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content); + extern void fake_make_load_fakefile_setting_build(fake_make_data_t * const data_make, f_string_range_t * const object, f_string_ranges_t * const content); #endif // _di_fake_make_load_fakefile_setting_build_ /** @@ -107,7 +107,7 @@ extern "C" { * A pointer to the range that representing the compiler setting within the buffer. */ #ifndef _di_fake_make_load_fakefile_setting_compiler_ - extern void fake_make_load_fakefile_setting_compiler(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_compiler); + extern void fake_make_load_fakefile_setting_compiler(fake_make_data_t * const data_make, f_string_range_t * const object, f_string_ranges_t * const content, f_string_range_t **range_compiler); #endif // _di_fake_make_load_fakefile_setting_compiler_ /** @@ -165,7 +165,7 @@ extern "C" { * @see f_string_dynamics_increase() */ #ifndef _di_fake_make_load_fakefile_setting_environment_ - extern void fake_make_load_fakefile_setting_environment(fake_make_data_t * const data_make, f_fss_content_t * const content); + extern void fake_make_load_fakefile_setting_environment(fake_make_data_t * const data_make, f_string_ranges_t * const content); #endif // _di_fake_make_load_fakefile_setting_environment_ /** @@ -181,7 +181,7 @@ extern "C" { * The setting content. */ #ifndef _di_fake_make_load_fakefile_setting_fail_ - extern void fake_make_load_fakefile_setting_fail(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content); + extern void fake_make_load_fakefile_setting_fail(fake_make_data_t * const data_make, f_string_range_t * const object, f_string_ranges_t * const content); #endif // _di_fake_make_load_fakefile_setting_fail_ /** @@ -199,7 +199,7 @@ extern "C" { * A pointer to the range that representing the indexer setting within the buffer. */ #ifndef _di_fake_make_load_fakefile_setting_indexer_ - extern void fake_make_load_fakefile_setting_indexer(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_indexer); + extern void fake_make_load_fakefile_setting_indexer(fake_make_data_t * const data_make, f_string_range_t * const object, f_string_ranges_t * const content, f_string_range_t **range_indexer); #endif // _di_fake_make_load_fakefile_setting_indexer_ /** @@ -230,7 +230,7 @@ extern "C" { * @see fake_make_load_fakefile_setting_define_and_parameter() */ #ifndef _di_fake_make_load_fakefile_setting_parameter_ - extern void fake_make_load_fakefile_setting_parameter(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content); + extern void fake_make_load_fakefile_setting_parameter(fake_make_data_t * const data_make, f_string_range_t * const object, f_string_ranges_t * const content); #endif // _di_fake_make_load_fakefile_setting_parameter_ #ifdef __cplusplus diff --git a/level_3/fake/c/main/make/operate.c b/level_3/fake/c/main/make/operate.c index ea9b77f..8f5421f 100644 --- a/level_3/fake/c/main/make/operate.c +++ b/level_3/fake/c/main/make/operate.c @@ -217,7 +217,7 @@ extern "C" { #endif // _di_fake_make_operate_ #ifndef _di_fake_make_operate_expand_ - void fake_make_operate_expand(fake_make_data_t * const data_make, const f_string_range_t section_name, const f_fss_content_t content, const f_uint8s_t quotes) { + void fake_make_operate_expand(fake_make_data_t * const data_make, const f_string_range_t section_name, const f_string_ranges_t content, const f_uint8s_t quotes) { if (!data_make || !data_make->main) return; if (F_status_is_error(data_make->main->setting.state.status)) return; diff --git a/level_3/fake/c/main/make/operate.h b/level_3/fake/c/main/make/operate.h index ba30739..4eab836 100644 --- a/level_3/fake/c/main/make/operate.h +++ b/level_3/fake/c/main/make/operate.h @@ -103,7 +103,7 @@ extern "C" { * @see fake_make_operate_expand_environment() */ #ifndef _di_fake_make_operate_expand_ - extern void fake_make_operate_expand(fake_make_data_t * const data_make, const f_string_range_t section_name, const f_fss_content_t content, const f_uint8s_t quotes); + extern void fake_make_operate_expand(fake_make_data_t * const data_make, const f_string_range_t section_name, const f_string_ranges_t content, const f_uint8s_t quotes); #endif // _di_fake_make_operate_expand_ /** diff --git a/level_3/firewall/c/private-common.h b/level_3/firewall/c/private-common.h index 6a9aba8..9252930 100644 --- a/level_3/firewall/c/private-common.h +++ b/level_3/firewall/c/private-common.h @@ -23,10 +23,10 @@ typedef struct { f_string_dynamic_t buffer; f_number_unsigned_t chain; f_number_unsigneds_t chain_ids; - f_fss_objects_t chain_objects; - f_fss_contents_t chain_contents; - f_fss_objects_t rule_objects; - f_fss_contents_t rule_contents; + f_string_ranges_t chain_objects; + f_string_rangess_t chain_contents; + f_string_ranges_t rule_objects; + f_string_rangess_t rule_contents; } firewall_local_data_t; #define firewall_local_data_t_initialize \ @@ -39,10 +39,10 @@ typedef struct { f_string_dynamic_t_initialize, \ 0, \ f_number_unsigneds_t_initialize, \ - f_fss_objects_t_initialize, \ - f_fss_contents_t_initialize, \ - f_fss_objects_t_initialize, \ - f_fss_contents_t_initialize, \ + f_string_ranges_t_initialize, \ + f_string_rangess_t_initialize, \ + f_string_ranges_t_initialize, \ + f_string_rangess_t_initialize, \ } typedef struct { diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index b293b06..64e9815 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -535,8 +535,8 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca f_string_dynamic_t path_file = f_string_dynamic_t_initialize; f_string_dynamic_t local_buffer = f_string_dynamic_t_initialize; - f_fss_objects_t basic_objects = f_fss_objects_t_initialize; - f_fss_contents_t basic_contents = f_fss_objects_t_initialize; + f_string_ranges_t basic_objects = f_string_ranges_t_initialize; + f_string_rangess_t basic_contents = f_string_ranges_t_initialize; status = f_string_dynamic_append(firewall_network_path_s, &path_file); @@ -612,7 +612,7 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca } } else { - f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; { f_state_t state = f_state_t_initialize; @@ -1201,8 +1201,8 @@ f_status_t firewall_buffer_rules(firewall_data_t * const data, const f_string_st return status; } - f_fss_delimits_t delimits = f_fss_delimits_t_initialize; - f_fss_comments_t comments = f_fss_comments_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + f_string_range_t comments = f_string_range_t_initialize; f_state_t state = f_state_t_initialize; { @@ -1237,8 +1237,8 @@ f_status_t firewall_buffer_rules(firewall_data_t * const data, const f_string_st } } - macro_f_fss_delimits_t_delete_simple(delimits); - macro_f_fss_comments_t_delete_simple(comments); + macro_f_number_unsigneds_t_delete_simple(delimits); + macro_f_string_range_t_delete_simple(comments); return status; } @@ -1248,7 +1248,7 @@ f_status_t firewall_process_rules(firewall_data_t * const data, f_string_range_t if (!data || !range || !local) return F_status_set_error(F_parameter); f_status_t status = F_none; - f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; f_state_t state = f_state_t_initialize; status = fll_fss_extended_read(local->buffer, state, range, &local->rule_objects, &local->rule_contents, 0, 0, &delimits, 0); @@ -1261,7 +1261,7 @@ f_status_t firewall_process_rules(firewall_data_t * const data, f_string_range_t } } - macro_f_fss_delimits_t_delete_simple(delimits); + macro_f_number_unsigneds_t_delete_simple(delimits); if (F_status_is_error_not(status)) { status = firewall_perform_commands(data, local); 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 4d72367..b01be29 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 @@ -249,9 +249,9 @@ extern "C" { fss_embedded_list_read_depths_t depths = fss_embedded_list_read_depths_t_initialize; - f_fss_delimits_t objects_delimits = f_fss_delimits_t_initialize; - f_fss_delimits_t contents_delimits = f_fss_delimits_t_initialize; - f_fss_comments_t comments = f_fss_comments_t_initialize; + f_number_unsigneds_t objects_delimits = f_number_unsigneds_t_initialize; + f_number_unsigneds_t contents_delimits = f_number_unsigneds_t_initialize; + f_string_range_t comments = f_string_range_t_initialize; if (F_status_is_error_not(status)) { status = fss_embedded_list_read_main_preprocess_depth(&data, &depths); diff --git a/level_3/fss_embedded_list_read/c/private-read.c b/level_3/fss_embedded_list_read/c/private-read.c index 393e3c8..cd29e46 100644 --- a/level_3/fss_embedded_list_read/c/private-read.c +++ b/level_3/fss_embedded_list_read/c/private-read.c @@ -240,7 +240,7 @@ extern "C" { #endif // _di_fss_embedded_list_read_main_preprocess_depth_ #ifndef _di_fss_embedded_list_read_main_process_file_ - f_status_t fss_embedded_list_read_main_process_file(fss_embedded_list_read_data_t * const data, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) { + f_status_t fss_embedded_list_read_main_process_file(fss_embedded_list_read_data_t * const data, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits, f_string_range_t *comments) { f_status_t status = F_none; @@ -336,7 +336,7 @@ extern "C" { if (data->main->parameters.array[fss_embedded_list_read_parameter_original_e].result & f_console_result_found_e) { - f_fss_delimits_t except_none = f_fss_delimits_t_initialize; + f_number_unsigneds_t except_none = f_number_unsigneds_t_initialize; return fss_embedded_list_read_main_process_for_depth(data, filename, depths, 0, line, parents, &except_none, &except_none); } @@ -346,7 +346,7 @@ extern "C" { #endif // _di_fss_embedded_list_read_main_process_file_ #ifndef _di_fss_embedded_list_read_main_process_for_depth_ - f_status_t fss_embedded_list_read_main_process_for_depth(fss_embedded_list_read_data_t * const data, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, const f_number_unsigned_t depths_index, const f_number_unsigned_t line, const fss_embedded_list_read_skip_t parents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { + f_status_t fss_embedded_list_read_main_process_for_depth(fss_embedded_list_read_data_t * const data, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, const f_number_unsigned_t depths_index, const f_number_unsigned_t line, const fss_embedded_list_read_skip_t parents, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits) { f_fss_items_t *items = &data->nest.depth[depths.array[depths_index].depth]; @@ -680,7 +680,7 @@ extern "C" { #endif // _di_fss_embedded_list_read_main_process_for_depth_ #ifndef _di_fss_embedded_list_read_process_delimits_ - void fss_embedded_list_read_process_delimits(fss_embedded_list_read_data_t * const data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { + void fss_embedded_list_read_process_delimits(fss_embedded_list_read_data_t * const data, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits) { if (!data->nest.used) return; @@ -754,7 +754,7 @@ extern "C" { #endif // _di_fss_embedded_list_read_process_delimits_ #ifndef _di_fss_embedded_list_read_process_delimits_contents_ - void fss_embedded_list_read_process_delimits_contents(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_fss_delimits_t *delimits) { + void fss_embedded_list_read_process_delimits_contents(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_number_unsigneds_t *delimits) { if (!original_used) return; @@ -807,7 +807,7 @@ extern "C" { #endif // _di_fss_embedded_list_read_process_delimits_contents_ #ifndef _di_fss_embedded_list_read_process_delimits_objects_ - void fss_embedded_list_read_process_delimits_objects(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_fss_delimits_t *delimits) { + void fss_embedded_list_read_process_delimits_objects(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_number_unsigneds_t *delimits) { if (!original_used) return; diff --git a/level_3/fss_embedded_list_read/c/private-read.h b/level_3/fss_embedded_list_read/c/private-read.h index ea0d0ad..e8a9354 100644 --- a/level_3/fss_embedded_list_read/c/private-read.h +++ b/level_3/fss_embedded_list_read/c/private-read.h @@ -57,7 +57,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fss_embedded_list_read_main_process_file_ - extern f_status_t fss_embedded_list_read_main_process_file(fss_embedded_list_read_data_t * const data, const f_string_static_t file_name, const fss_embedded_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) F_attribute_visibility_internal_d; + extern f_status_t fss_embedded_list_read_main_process_file(fss_embedded_list_read_data_t * const data, const f_string_static_t file_name, const fss_embedded_list_read_depths_t depths, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits, f_string_range_t *comments) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_read_main_process_file_ /** @@ -91,7 +91,7 @@ extern "C" { * @see fss_embedded_list_read_main_process_file() */ #ifndef _di_fss_embedded_list_read_main_process_for_depth_ - extern f_status_t fss_embedded_list_read_main_process_for_depth(fss_embedded_list_read_data_t * const data, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, const f_number_unsigned_t depths_index, const f_number_unsigned_t line, const fss_embedded_list_read_skip_t parents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) F_attribute_visibility_internal_d; + extern f_status_t fss_embedded_list_read_main_process_for_depth(fss_embedded_list_read_data_t * const data, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, const f_number_unsigned_t depths_index, const f_number_unsigned_t line, const fss_embedded_list_read_skip_t parents, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_read_main_process_for_depth_ /** @@ -107,7 +107,7 @@ extern "C" { * @see fss_embedded_list_read_main_process_file() */ #ifndef _di_fss_embedded_list_read_process_delimits_ - extern void fss_embedded_list_read_process_delimits(fss_embedded_list_read_data_t * const data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) F_attribute_visibility_internal_d; + extern void fss_embedded_list_read_process_delimits(fss_embedded_list_read_data_t * const data, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_read_process_delimits_ /** @@ -127,7 +127,7 @@ extern "C" { * @see fss_embedded_list_read_process_delimits() */ #ifndef _di_fss_embedded_list_read_process_delimits_contents_ - extern void fss_embedded_list_read_process_delimits_contents(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_fss_delimits_t *delimits) F_attribute_visibility_internal_d; + extern void fss_embedded_list_read_process_delimits_contents(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_number_unsigneds_t *delimits) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_read_process_delimits_contents_ /** @@ -147,7 +147,7 @@ extern "C" { * @see fss_embedded_list_read_process_delimits() */ #ifndef _di_fss_embedded_list_read_process_delimits_objects_ - extern void fss_embedded_list_read_process_delimits_objects(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_fss_delimits_t *delimits) F_attribute_visibility_internal_d; + extern void fss_embedded_list_read_process_delimits_objects(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_number_unsigneds_t *delimits) F_attribute_visibility_internal_d; #endif // _di_fss_embedded_list_read_process_delimits_objects_ /** diff --git a/level_3/fss_read/c/main/common/type.h b/level_3/fss_read/c/main/common/type.h index d0d97b9..6548de7 100644 --- a/level_3/fss_read/c/main/common/type.h +++ b/level_3/fss_read/c/main/common/type.h @@ -144,16 +144,16 @@ extern "C" { void (*process_last_line)(void * const main); void (*process_normal)(void * const main); - void (*process_at)(void * const main, const bool names[], const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content); + void (*process_at)(void * const main, const bool names[], const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); void (*process_at_line)(void * const void_main, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content, f_number_unsigned_t * const line); void (*process_columns)(void * const main, const bool names[]); void (*process_load)(void * const main); void (*process_name)(void * const main, bool names[]); void (*process_total)(void * const main, const bool names[]); - f_status_t (*print_at)(fl_print_t * const print, const f_number_unsigned_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content); - f_status_t (*print_object)(fl_print_t * const print, const f_number_unsigned_t at, const f_fss_delimits_t delimits); - f_status_t (*print_content)(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_fss_delimits_t delimits); + f_status_t (*print_at)(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); + f_status_t (*print_object)(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits); + f_status_t (*print_content)(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); f_status_t (*print_content_ignore)(fl_print_t * const print); f_status_t (*print_content_next)(fl_print_t * const print); f_status_t (*print_object_end)(fl_print_t * const print); @@ -236,12 +236,12 @@ extern "C" { f_string_static_t standard; f_string_dynamic_t buffer; - f_fss_comments_t comments; - f_fss_contents_t contents; - f_fss_delimits_t delimits_object; - f_fss_delimits_t delimits_content; + f_string_ranges_t comments; + f_string_rangess_t contents; + f_number_unsigneds_t delimits_object; + f_number_unsigneds_t delimits_content; f_fss_nest_t nest; - f_fss_objects_t objects; + f_string_ranges_t objects; f_uint8s_t quotes_object; f_uint8ss_t quotes_content; @@ -261,12 +261,12 @@ extern "C" { fss_read_depths_t_initialize, \ f_string_static_t_initialize, \ f_string_dynamic_t_initialize, \ - f_fss_comments_t_initialize, \ - f_fss_contents_t_initialize, \ - f_fss_delimits_t_initialize, \ - f_fss_delimits_t_initialize, \ + f_string_ranges_t_initialize, \ + f_string_rangess_t_initialize, \ + f_number_unsigneds_t_initialize, \ + f_number_unsigneds_t_initialize, \ f_fss_nest_t_initialize, \ - f_fss_objects_t_initialize, \ + f_string_ranges_t_initialize, \ f_uint8s_t_initialize, \ f_uint8ss_t_initialize, \ } diff --git a/level_3/fss_read/c/main/print/data.c b/level_3/fss_read/c/main/print/data.c index 5efc827..648f011 100644 --- a/level_3/fss_read/c/main/print/data.c +++ b/level_3/fss_read/c/main/print/data.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_fss_read_print_at_ - f_status_t fss_read_print_at(fl_print_t * const print, const f_number_unsigned_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content) { + f_status_t fss_read_print_at(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content) { if (!print || !print->custom) return F_status_set_error(F_output_not); @@ -64,7 +64,7 @@ extern "C" { #endif // _di_fss_read_print_at_ #ifndef _di_fss_read_print_content_ - f_status_t fss_read_print_content(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_fss_delimits_t delimits) { + f_status_t fss_read_print_content(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits) { if (!print || !print->custom) return F_status_set_error(F_output_not); @@ -123,7 +123,7 @@ extern "C" { #endif // _di_fss_read_print_number_ #ifndef _di_fss_read_print_object_ - f_status_t fss_read_print_object(fl_print_t * const print, const f_number_unsigned_t at, const f_fss_delimits_t delimits) { + f_status_t fss_read_print_object(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits) { if (!print || !print->custom) return F_status_set_error(F_output_not); diff --git a/level_3/fss_read/c/main/print/data.h b/level_3/fss_read/c/main/print/data.h index 80ce133..96c857c 100644 --- a/level_3/fss_read/c/main/print/data.h +++ b/level_3/fss_read/c/main/print/data.h @@ -55,7 +55,7 @@ extern "C" { * @see main.callback.print_set_end() */ #ifndef _di_fss_read_print_at_ - extern f_status_t fss_read_print_at(fl_print_t * const print, const f_number_unsigned_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content); + extern f_status_t fss_read_print_at(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); #endif // _di_fss_read_print_at_ /** @@ -91,7 +91,7 @@ extern "C" { * @see main.callback.print_set_end() */ #ifndef _di_fss_read_print_content_ - extern f_status_t fss_read_print_content(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_fss_delimits_t delimits); + extern f_status_t fss_read_print_content(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); #endif // _di_fss_read_print_content_ /** @@ -177,7 +177,7 @@ extern "C" { * @see fss_read_print_quote() */ #ifndef _di_fss_read_print_object_ - extern f_status_t fss_read_print_object(fl_print_t * const print, const f_number_unsigned_t at, const f_fss_delimits_t delimits); + extern f_status_t fss_read_print_object(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits); #endif // _di_fss_read_print_object_ /** diff --git a/level_3/fss_read/c/main/process_normal.h b/level_3/fss_read/c/main/process_normal.h index 44c7273..7774c24 100644 --- a/level_3/fss_read/c/main/process_normal.h +++ b/level_3/fss_read/c/main/process_normal.h @@ -73,7 +73,7 @@ extern "C" { * @see fss_read_signal_check() */ #ifndef _di_fss_read_process_normal_at_ - extern void fss_read_process_normal_at(void * const main, const bool names[], const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content); + extern void fss_read_process_normal_at(void * const main, const bool names[], const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); #endif // _di_fss_read_process_normal_at_ /** -- 1.8.3.1