From 70291b2d37e5f9a69645778dfdea637d0d0cbe70 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 10 Jan 2021 00:25:19 -0600 Subject: [PATCH] Progess: FLL cleanup and consistency. --- build/level_0/settings | 4 +- build/monolithic/settings | 4 +- level_0/f_fss/c/fss-common.h | 40 +- level_0/f_fss/c/fss.c | 1 + level_0/f_fss/c/fss_comment.c | 10 + level_0/f_fss/c/fss_comment.h | 5 + level_0/f_fss/c/fss_delimit.c | 10 + level_0/f_fss/c/fss_delimit.h | 5 + level_0/f_fss/c/fss_named.c | 123 ++++ level_0/f_fss/c/fss_named.h | 355 ++++++----- level_0/f_fss/c/fss_nest.c | 478 +++++++++++++++ level_0/f_fss/c/fss_nest.h | 1115 ++++++++++++++++++++-------------- level_0/f_fss/c/fss_quote.h | 21 +- level_0/f_fss/c/fss_set.c | 462 ++++++++++++++ level_0/f_fss/c/fss_set.h | 1022 +++++++++++++++++++------------ level_0/f_fss/c/private-fss.c | 678 +++++++++++++++++++++ level_0/f_fss/c/private-fss.h | 542 +++++++++++++++++ level_0/f_fss/data/build/settings | 4 +- level_1/fl_fss/c/fss_basic.c | 8 +- level_1/fl_fss/c/fss_basic_list.c | 30 +- level_1/fl_fss/c/fss_embedded_list.c | 32 +- level_1/fl_fss/c/fss_extended.c | 8 +- level_1/fl_fss/c/fss_extended_list.c | 32 +- level_1/fl_fss/c/private-fss.c | 90 +-- level_1/fl_fss/c/private-fss.h | 58 +- 25 files changed, 3926 insertions(+), 1211 deletions(-) create mode 100644 level_0/f_fss/c/fss_comment.c create mode 100644 level_0/f_fss/c/fss_delimit.c create mode 100644 level_0/f_fss/c/fss_named.c create mode 100644 level_0/f_fss/c/fss_nest.c create mode 100644 level_0/f_fss/c/fss_set.c create mode 100644 level_0/f_fss/c/private-fss.c create mode 100644 level_0/f_fss/c/private-fss.h diff --git a/build/level_0/settings b/build/level_0/settings index 071a55c..a08adf2 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -21,10 +21,10 @@ build_language c build_libraries -lc -lcap build_libraries-level build_libraries-level_threadless -build_sources_library account.c private-account.c capability.c color.c color-common.c console.c console-common.c control_group.c control_group-common.c conversion.c directory.c private-directory.c environment.c private-environment.c file.c file-common.c private-file.c fss.c iki.c iki-common.c private-iki.c limit.c memory.c memory_structure.c private-memory.c path.c path-common.c private-path.c pipe.c print.c private-print.c serialize.c serialize-common.c private-serialize.c signal.c socket.c string.c string-common.c private-string.c string_dynamic.c string_map.c string_quantity.c string_range.c string_triple.c utf.c private-utf.c +build_sources_library account.c private-account.c capability.c color.c color-common.c console.c console-common.c control_group.c control_group-common.c conversion.c directory.c private-directory.c environment.c private-environment.c file.c file-common.c private-file.c fss.c private-fss.c fss_named.c fss_nest.c fss_set.c iki.c iki-common.c private-iki.c limit.c memory.c memory_structure.c private-memory.c path.c path-common.c private-path.c pipe.c print.c private-print.c serialize.c serialize-common.c private-serialize.c signal.c socket.c string.c string-common.c private-string.c string_dynamic.c string_map.c string_quantity.c string_range.c string_triple.c utf.c private-utf.c build_sources_library-level thread.c build_sources_program -build_sources_headers account.h account-common.h capability.h capability-common.h color.h color-common.h console.h console-common.h control_group.h control_group-common.h conversion.h conversion-common.h directory.h directory_type.h directory-common.h environment.h environment-common.h execute.h execute-common.h file.h file-common.h fss.h fss-common.h fss_comment.h fss_delimit.h fss_named.h fss_nest.h fss_quote.h fss_set.h iki.h iki-common.h limit.h limit-common.h memory.h memory_structure.h memory-common.h path.h path-common.h pipe.h print.h serialize.h serialize-common.h signal.h signal-common.h socket.h socket-common.h status.h status_array.h string.h string-common.h private-string.h string_dynamic.h string_map.h string_quantity.h string_range.h string_triple.h type.h type_array.h utf.h utf-common.h +build_sources_headers account.h account-common.h capability.h capability-common.h color.h color-common.h console.h console-common.h control_group.h control_group-common.h conversion.h conversion-common.h directory.h directory_type.h directory-common.h environment.h environment-common.h execute.h execute-common.h file.h file-common.h fss.h private-fss.h fss-common.h fss_comment.h fss_delimit.h fss_named.h fss_nest.h fss_quote.h fss_set.h iki.h iki-common.h limit.h limit-common.h memory.h memory_structure.h memory-common.h path.h path-common.h pipe.h print.h serialize.h serialize-common.h signal.h signal-common.h socket.h socket-common.h status.h status_array.h string.h string-common.h private-string.h string_dynamic.h string_map.h string_quantity.h string_range.h string_triple.h type.h type_array.h utf.h utf-common.h build_sources_headers-level thread.h thread-common.h build_sources_script build_sources_setting diff --git a/build/monolithic/settings b/build/monolithic/settings index e8ff855..8d48001 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -21,10 +21,10 @@ build_language c build_libraries -lc -lcap build_libraries-monolithic build_libraries-monolithic_threadless -build_sources_library level_0/account.c level_0/private-account.c level_0/capability.c level_0/color.c level_0/color-common.c level_0/console.c level_0/console-common.c level_0/control_group.c level_0/control_group-common.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/file-common.c level_0/private-file.c level_0/fss.c level_0/iki.c level_0/iki-common.c level_0/private-iki.c level_0/limit.c level_0/memory.c level_0/memory_structure.c level_0/private-memory.c level_0/path.c level_0/path-common.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/private-print.c level_0/serialize.c level_0/serialize-common.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/string.c level_0/string-common.c level_0/private-string.c level_0/string_dynamic.c level_0/string_map.c level_0/string_quantity.c level_0/string_range.c level_0/string_triple.c level_0/utf.c level_0/private-utf.c level_1/color.c level_1/console.c level_1/control_group.c level_1/conversion.c level_1/directory.c level_1/private-directory.c level_1/environment.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_embedded_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/private-print.c level_1/status.c level_1/string.c level_1/private-string.c level_1/type.c level_1/private-type.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/control_group.c level_2/error.c level_2/error-common.c level_2/private-error.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_embedded_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/program.c level_2/status.c +build_sources_library level_0/account.c level_0/private-account.c level_0/capability.c level_0/color.c level_0/color-common.c level_0/console.c level_0/console-common.c level_0/control_group.c level_0/control_group-common.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/file-common.c level_0/private-file.c level_0/fss.c level_0/private-fss.c level_0/fss_named.c level_0/fss_nest.c level_0/fss_set.c level_0/iki.c level_0/iki-common.c level_0/private-iki.c level_0/limit.c level_0/memory.c level_0/memory_structure.c level_0/private-memory.c level_0/path.c level_0/path-common.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/private-print.c level_0/serialize.c level_0/serialize-common.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/string.c level_0/string-common.c level_0/private-string.c level_0/string_dynamic.c level_0/string_map.c level_0/string_quantity.c level_0/string_range.c level_0/string_triple.c level_0/utf.c level_0/private-utf.c level_1/color.c level_1/console.c level_1/control_group.c level_1/conversion.c level_1/directory.c level_1/private-directory.c level_1/environment.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_embedded_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/private-print.c level_1/status.c level_1/string.c level_1/private-string.c level_1/type.c level_1/private-type.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/control_group.c level_2/error.c level_2/error-common.c level_2/private-error.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_embedded_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/program.c level_2/status.c build_sources_library-monolithic level_0/thread.c build_sources_program -build_sources_headers level_0/account.h level_0/account-common.h level_0/capability.h level_0/capability-common.h level_0/color.h level_0/color-common.h level_0/console.h level_0/console-common.h level_0/control_group.h level_0/control_group-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/execute.h level_0/execute-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/fss-common.h level_0/fss_comment.h level_0/fss_delimit.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quote.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/limit.h level_0/limit-common.h level_0/memory.h level_0/memory_structure.h level_0/memory-common.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/status_array.h level_0/string.h level_0/string-common.h level_0/private-string.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/string_triple.h level_0/type.h level_0/type_array.h level_0/utf.h level_0/utf-common.h level_1/color.h level_1/console.h level_1/control_group.h level_1/conversion.h level_1/directory.h level_1/environment.h level_1/execute.h level_1/execute-common.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_embedded_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_status.h level_1/iki.h level_1/print.h level_1/status.h level_1/string.h level_1/type.h level_1/utf.h level_1/utf_file.h level_2/control_group.h level_2/error.h level_2/error-common.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_embedded_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/iki.h level_2/path.h level_2/program.h level_2/status.h +build_sources_headers level_0/account.h level_0/account-common.h level_0/capability.h level_0/capability-common.h level_0/color.h level_0/color-common.h level_0/console.h level_0/console-common.h level_0/control_group.h level_0/control_group-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/execute.h level_0/execute-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/private-fss.h level_0/fss-common.h level_0/fss_comment.h level_0/fss_delimit.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quote.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/limit.h level_0/limit-common.h level_0/memory.h level_0/memory_structure.h level_0/memory-common.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/status_array.h level_0/string.h level_0/string-common.h level_0/private-string.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/string_triple.h level_0/type.h level_0/type_array.h level_0/utf.h level_0/utf-common.h level_1/color.h level_1/console.h level_1/control_group.h level_1/conversion.h level_1/directory.h level_1/environment.h level_1/execute.h level_1/execute-common.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_embedded_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_status.h level_1/iki.h level_1/print.h level_1/status.h level_1/string.h level_1/type.h level_1/utf.h level_1/utf_file.h level_2/control_group.h level_2/error.h level_2/error-common.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_embedded_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/iki.h level_2/path.h level_2/program.h level_2/status.h build_sources_headers-monolithic level_0/thread.h level_0/thread-common.h build_sources_script build_sources_setting diff --git a/level_0/f_fss/c/fss-common.h b/level_0/f_fss/c/fss-common.h index b3e4d03..3444d2b 100644 --- a/level_0/f_fss/c/fss-common.h +++ b/level_0/f_fss/c/fss-common.h @@ -180,20 +180,25 @@ extern "C" { f_string_length_t used; } f_fss_headers_t; - #define f_fss_headers_initialize { 0, 0, 0 } + #define f_fss_headers_t_initialize { 0, 0, 0 } - #define f_macro_fss_headers_clear(headers) f_macro_memory_structure_clear(headers) + #define f_macro_fss_headers_t_clear(headers) f_macro_memory_structure_clear(headers) - #define f_macro_fss_headers_new(status, headers, length) f_macro_memory_structure_new(status, headers, f_fss_header_t, length); + #define f_macro_fss_headers_t_new(status, headers, length) f_macro_memory_structure_new(status, headers, f_fss_header_t, length); - #define f_macro_fss_headers_resize(status, headers, length) f_macro_memory_structure_resize(status, headers, f_fss_header_t, length); - #define f_macro_fss_headers_adjust(status, headers, length) f_macro_memory_structure_adjust(status, headers, f_fss_header_t, length); + #define f_macro_fss_headers_t_resize(status, headers, length) f_macro_memory_structure_resize(status, headers, f_fss_header_t, length); + #define f_macro_fss_headers_t_adjust(status, headers, length) f_macro_memory_structure_adjust(status, headers, f_fss_header_t, length); - #define f_macro_fss_headers_delete(status, headers) f_macro_memory_structure_delete(status, headers, f_fss_header_t); - #define f_macro_fss_headers_destroy(status, headers) f_macro_memory_structure_destroy(status, headers, f_fss_header_t); + #define f_macro_fss_headers_t_delete(status, headers) f_macro_memory_structure_delete(status, headers, f_fss_header_t); + #define f_macro_fss_headers_t_destroy(status, headers) f_macro_memory_structure_destroy(status, headers, f_fss_header_t); - #define f_macro_fss_headers_delete_simple(headers) f_macro_memory_structure_delete_simple(headers, f_fss_header_t); - #define f_macro_fss_headers_destroy_simple(headers) f_macro_memory_structure_destroy_simple(headers, f_fss_header_t); + #define f_macro_fss_headers_t_delete_simple(headers) f_macro_memory_structure_delete_simple(headers, f_fss_header_t); + #define f_macro_fss_headers_t_destroy_simple(headers) f_macro_memory_structure_destroy_simple(headers, f_fss_header_t); + + #define f_macro_fss_headers_t_increase(status, headers) f_macro_memory_structure_increase(status, headers, f_fss_header_t); + #define f_macro_fss_headers_t_increase_by(status, headers, amount) f_macro_memory_structure_increase_by(status, headers, f_fss_header_t, amount); + #define f_macro_fss_headers_t_decrease_by(status, headers, amount) f_macro_memory_structure_decrease_by(status, headers, f_fss_header_t, amount); + #define f_macro_fss_headers_t_decimate_by(status, headers, amount) f_macro_memory_structure_decimate_by(status, headers, f_fss_header_t, amount); #endif // _di_f_fss_headers_t_ /** @@ -224,13 +229,18 @@ extern "C" { #define f_macro_fss_objects_t_new(status, objects, length) f_macro_string_ranges_t_new(status, objects, length); #define f_macro_fss_objects_t_resize(status, objects, length) f_macro_string_ranges_t_resize(status, objects, length); - #define f_macro_fss_objects_t_adjust(status, objects, length) f_macro_string_ranges_t_destroy(status, objects, length); + #define f_macro_fss_objects_t_adjust(status, objects, length) f_macro_string_ranges_t_adjust(status, objects, length); #define f_macro_fss_objects_t_delete(status, objects) f_macro_string_ranges_t_delete(status, objects); #define f_macro_fss_objects_t_destroy(status, objects) f_macro_string_ranges_t_destroy(status, objects); #define f_macro_fss_objects_t_delete_simple(objects) f_macro_string_ranges_t_delete_simple(objects); #define f_macro_fss_objects_t_destroy_simple(objects) f_macro_string_ranges_t_destroy_simple(objects); + + #define f_macro_fss_objects_t_increase(status, objects) f_macro_string_ranges_t_increase(status, objects); + #define f_macro_fss_objects_t_increase_by(status, objects, amount) f_macro_string_ranges_t_increase_by(status, objects, amount); + #define f_macro_fss_objects_t_decrease_by(status, objects, amount) f_macro_string_ranges_t_decrease_by(status, objects, amount); + #define f_macro_fss_objects_t_decimate_by(status, objects, amount) f_macro_string_ranges_t_decimate_by(status, objects, amount); #endif // _di_fss_objects_t_ /** @@ -259,6 +269,11 @@ extern "C" { #define f_macro_fss_content_t_delete_simple(content) f_macro_string_ranges_t_delete_simple(content); #define f_macro_fss_content_t_destroy_simple(content) f_macro_string_ranges_t_destroy_simple(content); + + #define f_macro_fss_content_t_increase(status, content) f_macro_string_ranges_t_increase(status, content); + #define f_macro_fss_content_t_increase_by(status, content, amount) f_macro_string_ranges_t_increase_by(status, content, amount); + #define f_macro_fss_content_t_decrease_by(status, content, amount) f_macro_string_ranges_t_decrease_by(status, content, amount); + #define f_macro_fss_content_t_decimate_by(status, content, amount) f_macro_string_ranges_t_decimate_by(status, content, amount); #endif // _di_fss_content_ /** @@ -285,6 +300,11 @@ extern "C" { #define f_macro_fss_contents_t_delete_simple(contents) f_macro_string_rangess_t_delete_simple(contents); #define f_macro_fss_contents_t_destroy_simple(contents) f_macro_string_rangess_t_destroy_simple(contents); + + #define f_macro_fss_contents_t_increase(status, contents) f_macro_string_rangess_t_increase(status, contents); + #define f_macro_fss_contents_t_increase_by(status, contents, amount) f_macro_string_rangess_t_increase_by(status, contents, amount); + #define f_macro_fss_contents_t_decrease_by(status, contents, amount) f_macro_string_rangess_t_decrease_by(status, contents, amount); + #define f_macro_fss_contents_t_decimate_by(status, contents, amount) f_macro_string_rangess_t_decimate_by(status, contents, amount); #endif // _di_f_fss_contents_t_ #ifdef __cplusplus diff --git a/level_0/f_fss/c/fss.c b/level_0/f_fss/c/fss.c index 24f85c4..0dde80a 100644 --- a/level_0/f_fss/c/fss.c +++ b/level_0/f_fss/c/fss.c @@ -1,4 +1,5 @@ #include "fss.h" +#include "private-fss.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_fss/c/fss_comment.c b/level_0/f_fss/c/fss_comment.c new file mode 100644 index 0000000..be126fd --- /dev/null +++ b/level_0/f_fss/c/fss_comment.c @@ -0,0 +1,10 @@ +#include "fss.h" +#include "private-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss_comment.h b/level_0/f_fss/c/fss_comment.h index 1938d11..e36af56 100644 --- a/level_0/f_fss/c/fss_comment.h +++ b/level_0/f_fss/c/fss_comment.h @@ -76,6 +76,11 @@ extern "C" { #define f_macro_fss_commentss_t_delete_simple(quotess) f_macro_string_rangess_t_delete_simple(quotess); #define f_macro_fss_commentss_t_destroy_simple(quotess) f_macro_string_rangess_t_destroy_simple(quotess); + + #define f_macro_fss_commentss_t_increase(status, rangess) f_macro_string_rangess_t_increase(status, rangess); + #define f_macro_fss_commentss_t_increase_by(status, rangess, amount) f_macro_string_rangess_t_increase_by(status, rangess, amount); + #define f_macro_fss_commentss_t_decrease_by(status, rangess, amount) f_macro_string_rangess_t_decrease_by(status, rangess, amount); + #define f_macro_fss_commentss_t_decimate_by(status, rangess, amount) f_macro_string_rangess_t_decimate_by(status, rangess, amount); #endif // _di_f_fss_commentss_t_ #ifdef __cplusplus diff --git a/level_0/f_fss/c/fss_delimit.c b/level_0/f_fss/c/fss_delimit.c new file mode 100644 index 0000000..be126fd --- /dev/null +++ b/level_0/f_fss/c/fss_delimit.c @@ -0,0 +1,10 @@ +#include "fss.h" +#include "private-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 index 191bc93..f68a24d 100644 --- a/level_0/f_fss/c/fss_delimit.h +++ b/level_0/f_fss/c/fss_delimit.h @@ -76,6 +76,11 @@ extern "C" { #define f_macro_fss_delimitss_t_delete_simple(delimitss) f_macro_string_lengthss_t_delete_simple(delimitss); #define f_macro_fss_delimitss_t_destroy_simple(delimitss) f_macro_string_lengthss_t_destroy_simple(delimitss); + + #define f_macro_fss_delimitss_t_increase(status, lengthss) f_macro_string_lengthss_t_increase(status, lengthss); + #define f_macro_fss_delimitss_t_increase_by(status, lengthss, amount) f_macro_string_lengthss_t_increase_by(status, lengthss, amount); + #define f_macro_fss_delimitss_t_decrease_by(status, lengthss, amount) f_macro_string_lengthss_t_decrease_by(status, lengthss, amount); + #define f_macro_fss_delimitss_t_decimate_by(status, lengthss, amount) f_macro_string_lengthss_t_decimate_by(status, lengthss, amount); #endif // _di_f_fss_delimitss_t_ #ifdef __cplusplus diff --git a/level_0/f_fss/c/fss_named.c b/level_0/f_fss/c/fss_named.c new file mode 100644 index 0000000..b6a96e2 --- /dev/null +++ b/level_0/f_fss/c/fss_named.c @@ -0,0 +1,123 @@ +#include "fss.h" +#include "private-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_fss_nameds_adjust_ + f_status_t f_fss_nameds_adjust(const f_string_length_t length, f_fss_nameds_t *nameds) { + #ifndef _di_level_0_parameter_checking_ + if (!nameds) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nameds_adjust(length, nameds); + } +#endif // _di_f_fss_nameds_adjust_ + +#ifndef _di_f_fss_nameds_decimate_by_ + f_status_t f_fss_nameds_decimate_by(const f_array_length_t amount, f_fss_nameds_t *nameds) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!nameds) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nameds->size - amount > 0) { + return private_f_fss_nameds_adjust(nameds->size - amount, nameds); + } + + return private_f_fss_nameds_adjust(0, nameds); + } +#endif // _di_f_fss_nameds_decimate_by_ + +#ifndef _di_f_fss_nameds_decrease_by_ + f_status_t f_fss_nameds_decrease_by(const f_array_length_t amount, f_fss_nameds_t *nameds) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!nameds) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nameds->size - amount > 0) { + return private_f_fss_nameds_resize(nameds->size - amount, nameds); + } + + return private_f_fss_nameds_resize(0, nameds); + } +#endif // _di_f_fss_nameds_decrease_by_ + +#ifndef _di_f_fss_nameds_delete_ + f_status_t f_fss_nameds_delete(f_fss_nameds_t *nameds) { + #ifndef _di_level_0_parameter_checking_ + if (!nameds) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nameds_resize(0, nameds); + } +#endif // _di_f_fss_nameds_delete_ + +#ifndef _di_f_fss_nameds_destroy_ + f_status_t f_fss_nameds_destroy(f_fss_nameds_t *nameds) { + #ifndef _di_level_0_parameter_checking_ + if (!nameds) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nameds_adjust(0, nameds); + } +#endif // _di_f_fss_nameds_destroy_ + +#ifndef _di_f_fss_nameds_increase_ + f_status_t f_fss_nameds_increase(f_fss_nameds_t *nameds) { + #ifndef _di_level_0_parameter_checking_ + if (!nameds) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nameds->used + 1 > nameds->size) { + f_array_length_t size = nameds->used + f_memory_default_allocation_step; + + if (size > f_array_length_t_size) { + if (nameds->used + 1 > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + size = f_array_length_t_size; + } + + return private_f_fss_nameds_resize(size, nameds); + } + + return F_none; + } +#endif // _di_f_fss_nameds_increase_ + +#ifndef _di_f_fss_nameds_increase_by_ + f_status_t f_fss_nameds_increase_by(const f_array_length_t amount, f_fss_nameds_t *nameds) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!nameds) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nameds->used + amount > nameds->size) { + if (nameds->used + amount > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + return private_f_fss_nameds_resize(nameds->used + amount, nameds); + } + + return F_none; + } +#endif // _di_f_fss_nameds_increase_by_ + +#ifndef _di_f_fss_nameds_resize_ + f_status_t f_fss_nameds_resize(const f_string_length_t length, f_fss_nameds_t *nameds) { + #ifndef _di_level_0_parameter_checking_ + if (!nameds) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nameds_resize(length, nameds); + } +#endif // _di_f_fss_nameds_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss_named.h b/level_0/f_fss/c/fss_named.h index 670ad40..ae767d8 100644 --- a/level_0/f_fss/c/fss_named.h +++ b/level_0/f_fss/c/fss_named.h @@ -38,66 +38,27 @@ extern "C" { #define f_fss_named_t_initialize { f_fss_object_t_initialize, f_fss_objects_t_initialize, f_fss_contents_t_initialize, f_fss_quotess_t_initialize } - #define f_macro_fss_named_t_clear(set) \ - f_macro_fss_object_t_clear(set.object) \ - f_macro_fss_objects_t_clear(set.objects) \ - f_macro_fss_contents_t_clear(set.contents) \ - f_macro_fss_quotess_t_clear(set.quotess) + #define f_macro_fss_named_t_clear(named) \ + f_macro_fss_object_t_clear(named.object) \ + f_macro_fss_objects_t_clear(named.objects) \ + f_macro_fss_contents_t_clear(named.contents) \ + f_macro_fss_quotess_t_clear(named.quotess) - #define f_macro_fss_named_t_new(status, set, length) \ - f_macro_fss_objects_t_new(status, set.objects, length) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_new(status, set.contents, length) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotess_t_new(status, set.quotess, length) \ - } + #define f_macro_fss_named_t_new(status, named, length) f_macro_memory_structure_new(status, named, f_fss_named_t, length); - #define f_macro_fss_named_t_resize(status, set, new_length) \ - f_macro_fss_objects_t_resize(status, set.objects, new_length) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_resize(status, set.contents, new_length) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotess_t_resize(status, set.quotess, new_length) \ - } + #define f_macro_fss_named_t_resize(status, named, length) status = f_fss_named_resize(length, &named); + #define f_macro_fss_named_t_adjust(status, named, length) status = f_fss_named_adjust(length, &named); - #define f_macro_fss_named_t_adjust(status, set, new_length) \ - f_macro_fss_objects_t_adjust(status, set.objects, new_length) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_adjust(status, set.contents, new_length) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotess_t_adjust(status, set.quotess, new_length) \ - } + #define f_macro_fss_named_t_delete(status, named) status = f_fss_named_delete(&named); + #define f_macro_fss_named_t_destroy(status, named) status = f_fss_named_destroy(&named); - #define f_macro_fss_named_t_delete(status, set) \ - f_macro_fss_objects_t_delete(status, set.objects) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_delete(status, set.contents) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotess_t_delete(status, set.quotess) \ - } + #define f_macro_fss_named_t_delete_simple(named) f_fss_named_delete(&named); + #define f_macro_fss_named_t_destroy_simple(named) f_fss_named_destroy(&named); - #define f_macro_fss_named_t_destroy(status, set) \ - f_macro_fss_objects_t_destroy(status, set.objects) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_destroy(status, set.contents) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotess_t_destroy(status, set.quotess) \ - } - - #define f_macro_fss_named_t_delete_simple(set) \ - f_macro_fss_objects_t_delete_simple(set.objects) \ - f_macro_fss_contents_t_delete_simple(set.contents) \ - f_macro_fss_quotess_t_delete_simple(set.quotess) - - #define f_macro_fss_named_t_destroy_simple(set) \ - f_macro_fss_objects_t_destroy_simple(set.objects) \ - f_macro_fss_contents_t_destroy_simple(set.contents) \ - f_macro_fss_quotess_t_destroy_simple(set.quotess) + #define f_macro_fss_named_t_increase(status, named) status = f_fss_named_increase(&named); + #define f_macro_fss_named_t_increase_by(status, named, amount) status = f_fss_named_increase_by(amount, &named); + #define f_macro_fss_named_t_decrease_by(status, named, amount) status = f_fss_named_decrease_by(amount, &named); + #define f_macro_fss_named_t_decimate_by(status, named, amount) status = f_fss_named_decimate_by(amount, &named); #endif // _di_f_fss_named_t_ /** @@ -118,140 +79,178 @@ extern "C" { #define f_fss_nameds_t_initialize { 0, 0, 0 } /** - * Reset a fss content sets to 0 (clear all values). + * Reset a fss content nameds to 0 (clear all values). * * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. * - * sets: the f_fss_nameds_t structure to operate on. + * nameds: the f_fss_nameds_t structure to operate on. */ - #define f_macro_fss_nameds_t_clear(sets) \ - sets.array = 0; \ - sets.size = 0; \ - sets.used = 0; + #define f_macro_fss_nameds_t_clear(nameds) \ + nameds.array = 0; \ + nameds.size = 0; \ + nameds.used = 0; - /** - * Create a new fss content sets. - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * status: the status to return. - * sets: the f_fss_nameds_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_nameds_t_new(status, sets, length) \ - sets.array = 0; \ - sets.size = 0; \ - sets.used = 0; \ - status = f_memory_new((void **) & sets.array, sizeof(f_fss_named_t), length); \ - if (status == F_none) { \ - sets.size = length; \ - sets.used = 0; \ - } + #define f_macro_fss_nameds_t_new(status, nameds, length) f_macro_memory_structure_new(status, nameds, f_fss_named_t, length); - /** - * Resize a fss content sets. - * - * status: the status to return. - * sets: the f_fss_nameds_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_nameds_t_resize(status, sets, new_length) \ - status = F_none; \ - if (new_length < sets.size) { \ - for (register f_array_length_t _macro__i = sets.size - new_length; _macro__i < sets.size; ++_macro__i) { \ - f_macro_fss_named_t_delete(status, sets.array[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_resize((void **) & sets.array, sizeof(f_fss_named_t), sets.size, new_length); \ - if (status == F_none) { \ - sets.size = new_length; \ - if (sets.used > sets.size) sets.used = new_length; \ - } + #define f_macro_fss_nameds_t_resize(status, nameds, length) status = f_fss_nameds_resize(length, &nameds); + #define f_macro_fss_nameds_t_adjust(status, nameds, length) status = f_fss_nameds_adjust(length, &nameds); - /** - * Adjust a fss content sets. - * - * status: the status to return. - * sets: the f_fss_nameds_t structure to operate on. - * new_length: he new size of the array. - */ - #define f_macro_fss_nameds_t_adjust(status, sets, new_length) \ - status = F_none; \ - if (new_length < sets.size) { \ - for (register f_array_length_t _macro__i = sets.size - new_length; _macro__i < sets.size; ++_macro__i) { \ - f_macro_fss_named_t_destroy(status, sets.array[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_adjust((void **) & sets.array, sizeof(f_fss_named_t), sets.size, new_length); \ - if (status == F_none) { \ - sets.size = new_length; \ - if (sets.used > sets.size) sets.used = new_length; \ - } + #define f_macro_fss_nameds_t_delete(status, nameds) status = f_fss_nameds_delete(&nameds); + #define f_macro_fss_nameds_t_destroy(status, nameds) status = f_fss_nameds_destroy(&nameds); - /** - * Delete a fss content sets. - * - * status: the status to return. - * sets: the f_fss_nameds_t structure to operate on. - */ - #define f_macro_fss_nameds_t_delete(status, sets) \ - status = F_none; \ - sets.used = sets.size; \ - while (sets.used) { \ - sets.used--; \ - f_macro_fss_named_t_delete(status, sets.array[sets.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_delete((void **) & sets.array, sizeof(f_fss_named_t), sets.size); \ - if (status == F_none) sets.size = 0; + #define f_macro_fss_nameds_t_delete_simple(nameds) f_fss_nameds_delete(&nameds); + #define f_macro_fss_nameds_t_destroy_simple(nameds) f_fss_nameds_destroy(&nameds); - /** - * Destroy a fss content sets. - * - * status: the status to return. - * sets: the f_fss_nameds_t structure to operate on. - */ - #define f_macro_fss_nameds_t_destroy(status, sets) \ - status = F_none; \ - sets.used = sets.size; \ - while (sets.used) { \ - sets.used--; \ - f_macro_fss_named_t_destroy(status, sets.array[sets.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_destroy((void **) & sets.array, sizeof(f_fss_named_t), sets.size); \ - if (status == F_none) sets.size = 0; + #define f_macro_fss_nameds_t_increase(status, nameds) status = f_fss_nameds_increase(&nameds); + #define f_macro_fss_nameds_t_increase_by(status, nameds, amount) status = f_fss_nameds_increase_by(amount, &nameds); + #define f_macro_fss_nameds_t_decrease_by(status, nameds, amount) status = f_fss_nameds_decrease_by(amount, &nameds); + #define f_macro_fss_nameds_t_decimate_by(status, nameds, amount) status = f_fss_nameds_decimate_by(amount, &nameds); +#endif // _di_fss_nameds_t_ - /** - * Delete a fss content sets. - * - * sets: the f_fss_nameds_t structure to operate on. - */ - #define f_macro_fss_nameds_t_delete_simple(sets) \ - sets.used = sets.size; \ - while (sets.used > 0) { \ - sets.used--; \ - f_macro_fss_named_t_delete_simple(sets.array[sets.used]); \ - } \ - f_memory_delete((void **) & sets.array, sizeof(f_fss_named_t), sets.size); \ - sets.size = 0; +/** + * Resize the named array. + * + * @param length + * The new size to use. + * @param nameds + * The nameds 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_nameds_adjust_ + extern f_status_t f_fss_nameds_adjust(const f_array_length_t length, f_fss_nameds_t *nameds); +#endif // _di_f_fss_nameds_adjust_ - /** - * Destroy a fss content sets. - * - * sets: the f_fss_nameds_t structure to operate on. - */ - #define f_macro_fss_nameds_t_destroy_simple(sets) \ - sets.used = sets.size; \ - while (sets.used > 0) { \ - sets.used--; \ - f_macro_fss_named_t_destroy_simple(sets.array[sets.used]); \ - } \ - f_memory_destroy((void **) & sets.array, sizeof(f_fss_named_t), sets.size); \ - sets.size = 0; -#endif // _di_fss_nameds_t_ +/** + * Resize the named 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 nameds + * The nameds 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_nameds_decimate_by_ + extern f_status_t f_fss_nameds_decimate_by(const f_array_length_t amount, f_fss_nameds_t *nameds); +#endif // _di_f_fss_nameds_decimate_by_ + +/** + * Resize the named 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 nameds + * The nameds 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_nameds_decrease_by_ + extern f_status_t f_fss_nameds_decrease_by(const f_array_length_t amount, f_fss_nameds_t *nameds); +#endif // _di_f_fss_nameds_decrease_by_ + +/** + * Delete the array of named. + * + * @param ranges + * The ranges to delete. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_nameds_delete_ + extern f_status_t f_fss_nameds_delete(f_fss_nameds_t *ranges); +#endif // _di_f_fss_nameds_delete_ + +/** + * Delete the array of named. + * + * @param nameds + * The nameds to destroy. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_nameds_destroy_ + extern f_status_t f_fss_nameds_destroy(f_fss_nameds_t *nameds); +#endif // _di_f_fss_nameds_destroy_ + +/** + * Increase the size of the nameds array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param nameds + * The nameds array to resize. + * + * @return + * F_none on success. + * 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_nameds_increase_ + extern f_status_t f_fss_nameds_increase(f_fss_nameds_t *nameds); +#endif // _di_f_fss_nameds_increase_ + +/** + * Resize the nameds array to a larger size. + * + * This will resize making the string larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * 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 nameds + * The nameds 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. + * F_array_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_f_fss_nameds_increase_by_ + extern f_status_t f_fss_nameds_increase_by(const f_array_length_t amount, f_fss_nameds_t *nameds); +#endif // _di_f_fss_nameds_increase_by_ + +/** + * Resize the nameds array. + * + * @param length + * The new size to use. + * @param nameds + * The nameds 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_nameds_resize_ + extern f_status_t f_fss_nameds_resize(const f_array_length_t length, f_fss_nameds_t *nameds); +#endif // _di_f_fss_nameds_resize_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss_nest.c b/level_0/f_fss/c/fss_nest.c new file mode 100644 index 0000000..a254435 --- /dev/null +++ b/level_0/f_fss/c/fss_nest.c @@ -0,0 +1,478 @@ +#include "fss.h" +#include "private-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_fss_item_adjust_ + f_status_t f_fss_item_adjust(const f_string_length_t length, f_fss_item_t *item) { + #ifndef _di_level_0_parameter_checking_ + if (!item) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_item_adjust(length, item); + } +#endif // _di_f_fss_item_adjust_ + +#ifndef _di_f_fss_item_decimate_by_ + f_status_t f_fss_item_decimate_by(const f_array_length_t amount, f_fss_item_t *item) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!item) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (item->content.size - amount > 0) { + return private_f_fss_item_adjust(item->content.size - amount, item); + } + + return private_f_fss_item_adjust(0, item); + } +#endif // _di_f_fss_item_decimate_by_ + +#ifndef _di_f_fss_item_decrease_by_ + f_status_t f_fss_item_decrease_by(const f_array_length_t amount, f_fss_item_t *item) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!item) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (item->content.size - amount > 0) { + return private_f_fss_item_resize(item->content.size - amount, item); + } + + return private_f_fss_item_resize(0, item); + } +#endif // _di_f_fss_item_decrease_by_ + +#ifndef _di_f_fss_item_delete_ + f_status_t f_fss_item_delete(f_fss_item_t *item) { + #ifndef _di_level_0_parameter_checking_ + if (!item) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_item_resize(0, item); + } +#endif // _di_f_fss_item_delete_ + +#ifndef _di_f_fss_item_destroy_ + f_status_t f_fss_item_destroy(f_fss_item_t *item) { + #ifndef _di_level_0_parameter_checking_ + if (!item) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_item_adjust(0, item); + } +#endif // _di_f_fss_item_destroy_ + +#ifndef _di_f_fss_item_increase_ + f_status_t f_fss_item_increase(f_fss_item_t *item) { + #ifndef _di_level_0_parameter_checking_ + if (!item) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (item->content.used + 1 > item->content.size) { + f_array_length_t size = item->content.used + f_memory_default_allocation_step; + + if (size > f_array_length_t_size) { + if (item->content.used + 1 > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + size = f_array_length_t_size; + } + + return private_f_fss_item_resize(size, item); + } + + return F_none; + } +#endif // _di_f_fss_item_increase_ + +#ifndef _di_f_fss_item_increase_by_ + f_status_t f_fss_item_increase_by(const f_array_length_t amount, f_fss_item_t *item) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!item) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (item->content.used + amount > item->content.size) { + if (item->content.used + amount > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + return private_f_fss_item_resize(item->content.used + amount, item); + } + + return F_none; + } +#endif // _di_f_fss_item_increase_by_ + +#ifndef _di_f_fss_item_new_ + f_status_t f_fss_item_new(const f_string_length_t length, f_fss_item_t *item) { + #ifndef _di_level_0_parameter_checking_ + if (!item) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + f_macro_fss_item_t_clear((*item)); + + f_status_t status = F_none; + + f_macro_memory_structure_new(status, item->content, f_fss_content_t, length); + + return status; + } +#endif // _di_f_fss_item_new_ + +#ifndef _di_f_fss_item_resize_ + f_status_t f_fss_item_resize(const f_string_length_t length, f_fss_item_t *item) { + #ifndef _di_level_0_parameter_checking_ + if (!item) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_item_resize(length, item); + } +#endif // _di_f_fss_item_resize_ + +#ifndef _di_f_fss_items_adjust_ + f_status_t f_fss_items_adjust(const f_string_length_t length, f_fss_items_t *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_array_length_t amount, f_fss_items_t *items) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!items) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (items->size - amount > 0) { + 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_array_length_t amount, f_fss_items_t *items) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!items) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (items->size - amount > 0) { + 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_delete_ + f_status_t f_fss_items_delete(f_fss_items_t *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(0, items); + } +#endif // _di_f_fss_items_delete_ + +#ifndef _di_f_fss_items_destroy_ + f_status_t f_fss_items_destroy(f_fss_items_t *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(0, items); + } +#endif // _di_f_fss_items_destroy_ + +#ifndef _di_f_fss_items_increase_ + f_status_t f_fss_items_increase(f_fss_items_t *items) { + #ifndef _di_level_0_parameter_checking_ + if (!items) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (items->used + 1 > items->size) { + f_array_length_t size = items->used + f_memory_default_allocation_step; + + if (size > f_array_length_t_size) { + if (items->used + 1 > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + size = f_array_length_t_size; + } + + return private_f_fss_items_resize(size, items); + } + + return F_none; + } +#endif // _di_f_fss_items_increase_ + +#ifndef _di_f_fss_items_increase_by_ + f_status_t f_fss_items_increase_by(const f_array_length_t amount, f_fss_items_t *items) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!items) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (items->used + amount > items->size) { + if (items->used + amount > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + return private_f_fss_items_resize(items->used + amount, items); + } + + return F_none; + } +#endif // _di_f_fss_items_increase_by_ + +#ifndef _di_f_fss_items_resize_ + f_status_t f_fss_items_resize(const f_string_length_t length, f_fss_items_t *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_string_length_t length, f_fss_nest_t *nest) { + #ifndef _di_level_0_parameter_checking_ + if (!nest) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nest_adjust(length, nest); + } +#endif // _di_f_fss_nest_adjust_ + +#ifndef _di_f_fss_nest_decimate_by_ + f_status_t f_fss_nest_decimate_by(const f_array_length_t amount, f_fss_nest_t *nest) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!nest) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nest->size - amount > 0) { + return private_f_fss_nest_adjust(nest->size - amount, nest); + } + + return private_f_fss_nest_adjust(0, nest); + } +#endif // _di_f_fss_nest_decimate_by_ + +#ifndef _di_f_fss_nest_decrease_by_ + f_status_t f_fss_nest_decrease_by(const f_array_length_t amount, f_fss_nest_t *nest) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!nest) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nest->size - amount > 0) { + return private_f_fss_nest_resize(nest->size - amount, nest); + } + + return private_f_fss_nest_resize(0, nest); + } +#endif // _di_f_fss_nest_decrease_by_ + +#ifndef _di_f_fss_nest_delete_ + f_status_t f_fss_nest_delete(f_fss_nest_t *nest) { + #ifndef _di_level_0_parameter_checking_ + if (!nest) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nest_resize(0, nest); + } +#endif // _di_f_fss_nest_delete_ + +#ifndef _di_f_fss_nest_destroy_ + f_status_t f_fss_nest_destroy(f_fss_nest_t *nest) { + #ifndef _di_level_0_parameter_checking_ + if (!nest) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nest_adjust(0, nest); + } +#endif // _di_f_fss_nest_destroy_ + +#ifndef _di_f_fss_nest_increase_ + f_status_t f_fss_nest_increase(f_fss_nest_t *nest) { + #ifndef _di_level_0_parameter_checking_ + if (!nest) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nest->used + 1 > nest->size) { + f_array_length_t size = nest->used + f_memory_default_allocation_step; + + if (size > f_array_length_t_size) { + if (nest->used + 1 > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + size = f_array_length_t_size; + } + + return private_f_fss_nest_resize(size, nest); + } + + return F_none; + } +#endif // _di_f_fss_nest_increase_ + +#ifndef _di_f_fss_nest_increase_by_ + f_status_t f_fss_nest_increase_by(const f_array_length_t amount, f_fss_nest_t *nest) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!nest) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nest->used + amount > nest->size) { + if (nest->used + amount > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + return private_f_fss_nest_resize(nest->used + amount, nest); + } + + return F_none; + } +#endif // _di_f_fss_nest_increase_by_ + +#ifndef _di_f_fss_nest_resize_ + f_status_t f_fss_nest_resize(const f_string_length_t length, f_fss_nest_t *nest) { + #ifndef _di_level_0_parameter_checking_ + if (!nest) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nest_resize(length, nest); + } +#endif // _di_f_fss_nest_resize_ + +#ifndef _di_f_fss_nests_adjust_ + f_status_t f_fss_nests_adjust(const f_string_length_t length, f_fss_nests_t *nests) { + #ifndef _di_level_0_parameter_checking_ + if (!nests) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nests_adjust(length, nests); + } +#endif // _di_f_fss_nests_adjust_ + +#ifndef _di_f_fss_nests_decimate_by_ + f_status_t f_fss_nests_decimate_by(const f_array_length_t amount, f_fss_nests_t *nests) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!nests) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nests->size - amount > 0) { + return private_f_fss_nests_adjust(nests->size - amount, nests); + } + + return private_f_fss_nests_adjust(0, nests); + } +#endif // _di_f_fss_nests_decimate_by_ + +#ifndef _di_f_fss_nests_decrease_by_ + f_status_t f_fss_nests_decrease_by(const f_array_length_t amount, f_fss_nests_t *nests) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!nests) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nests->size - amount > 0) { + return private_f_fss_nests_resize(nests->size - amount, nests); + } + + return private_f_fss_nests_resize(0, nests); + } +#endif // _di_f_fss_nests_decrease_by_ + +#ifndef _di_f_fss_nests_delete_ + f_status_t f_fss_nests_delete(f_fss_nests_t *nests) { + #ifndef _di_level_0_parameter_checking_ + if (!nests) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nests_resize(0, nests); + } +#endif // _di_f_fss_nests_delete_ + +#ifndef _di_f_fss_nests_destroy_ + f_status_t f_fss_nests_destroy(f_fss_nests_t *nests) { + #ifndef _di_level_0_parameter_checking_ + if (!nests) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nests_adjust(0, nests); + } +#endif // _di_f_fss_nests_destroy_ + +#ifndef _di_f_fss_nests_increase_ + f_status_t f_fss_nests_increase(f_fss_nests_t *nests) { + #ifndef _di_level_0_parameter_checking_ + if (!nests) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nests->used + 1 > nests->size) { + f_array_length_t size = nests->used + f_memory_default_allocation_step; + + if (size > f_array_length_t_size) { + if (nests->used + 1 > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + size = f_array_length_t_size; + } + + return private_f_fss_nests_resize(size, nests); + } + + return F_none; + } +#endif // _di_f_fss_nests_increase_ + +#ifndef _di_f_fss_nests_increase_by_ + f_status_t f_fss_nests_increase_by(const f_array_length_t amount, f_fss_nests_t *nests) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!nests) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (nests->used + amount > nests->size) { + if (nests->used + amount > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + return private_f_fss_nests_resize(nests->used + amount, nests); + } + + return F_none; + } +#endif // _di_f_fss_nests_increase_by_ + +#ifndef _di_f_fss_nests_resize_ + f_status_t f_fss_nests_resize(const f_string_length_t length, f_fss_nests_t *nests) { + #ifndef _di_level_0_parameter_checking_ + if (!nests) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_nests_resize(length, nests); + } +#endif // _di_f_fss_nests_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss_nest.h b/level_0/f_fss/c/fss_nest.h index ad94c90..83ac3af 100644 --- a/level_0/f_fss/c/fss_nest.h +++ b/level_0/f_fss/c/fss_nest.h @@ -41,85 +41,27 @@ extern "C" { #define f_fss_item_t_initialize { f_fss_object_t_initialize, f_fss_content_t_initialize, 0 } - /** - * Reset a fss item stucture to 0 (clear all values). - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * item: the f_fss_item_t structure to operate on. - */ #define f_macro_fss_item_t_clear(item) \ item.object.start = 1; \ item.object.stop = 0; \ f_macro_fss_content_t_clear(item.content); \ item.parent = 0; - /** - * Create a new fss item structure. - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * This does not allocate to item.delimits, allocation must be performed separately. - * - * status: the status to return. - * structure: the structure to operate on. - * type: the structure type. - * length: the new size of the array. - */ - #define f_macro_fss_item_t_new(status, item, length) \ - item.object.start = 1; \ - item.object.stop = 0; \ - f_macro_fss_content_t_new(status, item.content, length) \ - item.parent = 0; + #define f_macro_fss_item_t_new(status, item, length) status = f_fss_item_new(length, &item); - /** - * Delete a fss item. - * - * status: the status to return. - * item: the f_fss_item_t structure to operate on. - */ - #define f_macro_fss_item_t_delete(status, item) \ - f_macro_fss_content_t_delete(status, item.content) \ - if (status == F_none) { \ - item.object.start = 1; \ - item.object.stop = 0; \ - item.parent = 0; \ - } - - /** - * Destroy a fss item. - * - * status: the status to return. - * item: the f_fss_item_t structure to operate on. - */ - #define f_macro_fss_item_t_destroy(status, item) \ - f_macro_fss_content_t_destroy(status, item.content) \ - if (status == F_none) { \ - item.object.start = 1; \ - item.object.stop = 0; \ - item.parent = 0; \ - } - - /** - * Delete a fss item. - * - * item: the f_fss_item_t structure to operate on. - */ - #define f_macro_fss_item_t_delete_simple(item) \ - f_macro_fss_content_t_delete_simple(item.content); \ - item.object.start = 1; \ - item.object.stop = 0; \ - item.parent = 0; + #define f_macro_fss_item_t_resize(status, item, length) status = f_fss_item_resize(length, &item); + #define f_macro_fss_item_t_adjust(status, item, length) status = f_fss_item_adjust(length, &item); - /** - * Destroy a fss item. - * - * item: the f_fss_item_t structure to operate on. - */ - #define f_macro_fss_item_t_destroy_simple(item) \ - f_macro_fss_content_t_destroy_simple(item.content); \ - item.object.start = 1; \ - item.object.stop = 0; \ - item.parent = 0; + #define f_macro_fss_item_t_delete(status, item) status = f_fss_item_delete(&item); + #define f_macro_fss_item_t_destroy(status, item) status = f_fss_item_destroy(&item); + + #define f_macro_fss_item_t_delete_simple(item) f_fss_item_delete(&item); + #define f_macro_fss_item_t_destroy_simple(item) f_fss_item_destroy(&item); + + #define f_macro_fss_item_t_increase(status, item) status = f_fss_item_increase(&item); + #define f_macro_fss_item_t_increase_by(status, item, amount) status = f_fss_item_increase_by(amount, &item); + #define f_macro_fss_item_t_decrease_by(status, item, amount) status = f_fss_item_decrease_by(amount, &item); + #define f_macro_fss_item_t_decimate_by(status, item, amount) status = f_fss_item_decimate_by(amount, &item); #endif // _di_fss_item_t_ /** @@ -160,140 +102,26 @@ extern "C" { #define f_fss_items_t_initialize { 0, 0, 0 } - /** - * Reset a fss items to 0 (clear all values). - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * items: the f_fss_items_t structure to operate on. - */ #define f_macro_fss_items_t_clear(items) \ items.array = 0; \ items.size = 0; \ items.used = 0; - /** - * Create a new fss items. - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * status: the status to return. - * items: the f_fss_items_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_items_t_new(status, items, length) \ - items.array = 0; \ - items.size = 0; \ - items.used = 0; \ - status = f_memory_new((void **) & items.array, sizeof(f_fss_item_t), length); \ - if (status == F_none) { \ - items.size = length; \ - items.used = 0; \ - } - - /** - * Resize a fss items. - * - * status: the status to return. - * items: the f_fss_items_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_items_t_resize(status, items, new_length) \ - status = F_none; \ - if (new_length < items.size) { \ - for (register f_array_length_t _macro__i = items.size - new_length; _macro__i < items.size; ++_macro__i) { \ - f_macro_fss_item_t_delete(status, items.array[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_resize((void **) & items.array, sizeof(f_fss_item_t), items.size, new_length); \ - if (status == F_none) { \ - items.size = new_length; \ - if (items.used > items.size) items.used = new_length; \ - } - - /** - * Adjust a fss items. - * - * status: the status to return. - * items: the f_fss_items_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_items_t_adjust(status, items, new_length) \ - status = F_none; \ - if (new_length < items.size) { \ - for (length_variable _macro__i = items.size - new_length; _macro__i < items.size; ++_macro__i) { \ - f_macro_fss_item_t_destroy(status, items.array[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_adjust((void **) & items.array, sizeof(f_fss_item_t), items.size, new_length); \ - if (status == F_none) { \ - items.size = new_length; \ - if (items.used > items.size) items.used = new_length; \ - } - - /** - * Delete a fss items. - * - * status: the status to return. - * items: the f_fss_items_t structure to operate on. - */ - #define f_macro_fss_items_t_delete(status, items) \ - status = F_none; \ - items.used = items.size; \ - while (items.used) { \ - items.used--; \ - f_macro_fss_item_t_delete(status, items.array[items.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_delete((void **) & items.array, sizeof(f_fss_item_t), items.size); \ - if (status == F_none) items.size = 0; - - /** - * Destroy a fss items. - * - * status: the status to return. - * items: the f_fss_items_t structure to operate on. - */ - #define f_macro_fss_items_t_destroy(status, items) \ - status = F_none; \ - items.used = items.size; \ - while (items.used) { \ - items.used--; \ - f_macro_fss_item_t_destroy(status, items.array[items.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_delete((void **) & items.array, sizeof(f_fss_item_t), items.size); \ - if (status == F_none) items.size = 0; - - /** - * Delete a fss items. - * - * items: the f_fss_items_t structure to operate on. - */ - #define f_macro_fss_items_t_delete_simple(items) \ - items.used = items.size; \ - while (items.used) { \ - items.used--; \ - f_macro_fss_item_t_delete_simple(items.array[items.used]); \ - } \ - f_memory_delete((void **) & items.array, sizeof(f_fss_item_t), items.size); \ - items.size = 0; - - /** - * Destroy a fss items. - * - * items: the f_fss_items_t structure to operate on. - */ - #define f_macro_fss_items_t_destroy_simple(items) \ - items.used = items.size; \ - while (items.used > 0) { \ - items.used--; \ - f_macro_fss_item_t_destroy_simple(status, items.array[items.used]); \ - } \ - f_memory_destroy((void **) & items.array, sizeof(f_fss_item_t), items.size); \ - items.size = 0; + #define f_macro_fss_items_t_new(status, items, length) f_macro_memory_structure_new(status, items, f_fss_items_t, length); + + #define f_macro_fss_items_t_resize(status, items, length) status = f_fss_items_resize(length, &items); + #define f_macro_fss_items_t_adjust(status, items, length) status = f_fss_items_adjust(length, &items); + + #define f_macro_fss_items_t_delete(status, items) status = f_fss_items_delete(&items); + #define f_macro_fss_items_t_destroy(status, items) status = f_fss_items_destroy(&items); + + #define f_macro_fss_items_t_delete_simple(items) f_fss_items_delete(&items); + #define f_macro_fss_items_t_destroy_simple(items) f_fss_items_destroy(&items); + + #define f_macro_fss_items_t_increase(status, items) status = f_fss_items_increase(&items); + #define f_macro_fss_items_t_increase_by(status, items, amount) status = f_fss_items_increase_by(amount, &items); + #define f_macro_fss_items_t_decrease_by(status, items, amount) status = f_fss_items_decrease_by(amount, &items); + #define f_macro_fss_items_t_decimate_by(status, items, amount) status = f_fss_items_decimate_by(amount, &items); #endif // _di_fss_items_t_ /** @@ -318,140 +146,26 @@ extern "C" { #define f_fss_nest_t_initialize { 0, 0, 0 } - /** - * Reset a fss content nest to 0 (clear all values). - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * nest: the f_fss_nest_t structure to operate on. - */ #define f_macro_fss_nest_t_clear(nest) \ nest.depth = 0; \ nest.size = 0; \ nest.used = 0; - /** - * Create a new fss content nest. - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * status: the status to return. - * nest: the f_fss_nest_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_nest_t_new(status, nest, length) \ - nest.depth = 0; \ - nest.size = 0; \ - nest.used = 0; \ - status = f_memory_new((void **) & nest.depth, sizeof(f_fss_items_t), length); \ - if (status == F_none) { \ - nest.size = length; \ - nest.used = 0; \ - } - - /** - * Resize a fss content nest. - * - * status: the status to return. - * nest: the f_fss_nest_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_nest_t_resize(status, nest, new_length) \ - status = F_none; \ - if (new_length < nest.size) { \ - for (register f_array_length_t _macro__i = nest.size - new_length; _macro__i < nest.size; ++_macro__i) { \ - f_macro_fss_items_t_delete(status, nest.depth[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_resize((void **) & nest.depth, sizeof(f_fss_items_t), nest.size, new_length); \ - if (status == F_none) { \ - nest.size = new_length; \ - if (nest.used > nest.size) nest.used = new_length; \ - } - - /** - * Adjust a fss content nest. - * - * status: the status to return. - * nest: the f_fss_nest_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_nest_t_adjust(status, nest, new_length) \ - status = F_none; \ - if (new_length < nest.size) { \ - for (register f_array_length_t _macro__i = nest.size - new_length; _macro__i < nest.size; ++_macro__i) { \ - f_macro_fss_items_t_destroy(status, nest.depth[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_adjust((void **) & nest.depth, sizeof(f_fss_item_t), nest.size, new_length); \ - if (status == F_none) { \ - nest.size = new_length; \ - if (nest.used > nest.size) nest.used = new_length; \ - } - - /** - * Delete a fss content nest. - * - * status: the status to return. - * nest: the f_fss_nest_t structure to operate on. - */ - #define f_macro_fss_nest_t_delete(status, nest) \ - status = F_none; \ - nest.used = nest.size; \ - while (nest.used) { \ - nest.used--; \ - f_macro_fss_items_t_delete(status, nest.depth[nest.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_delete((void **) & nest.depth, sizeof(f_fss_items_t), nest.size); \ - if (status == F_none) nest.size = 0; - - /** - * Destroy a fss content nest. - * - * status: the status to return. - * nest: the f_fss_nest_t structure to operate on. - */ - #define f_macro_fss_nest_t_destroy(status, nest) \ - status = F_none; \ - nest.used = nest.size; \ - while (nest.used) { \ - nest.used--; \ - f_macro_fss_items_t_destroy(status, nest.depth[nest.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_delete((void **) & nest.depth, sizeof(f_fss_items_t), nest.size); \ - if (status == F_none) nest.size = 0; - - /** - * Delete a fss content nest. - * - * nest: the f_fss_nest_t structure to operate on. - */ - #define f_macro_fss_nest_t_delete_simple(nest) \ - nest.used = nest.size; \ - while (nest.used) { \ - nest.used--; \ - f_macro_fss_items_t_delete_simple(nest.depth[nest.used]); \ - } \ - f_memory_delete((void **) & nest.depth, sizeof(f_fss_items_t), nest.size); \ - nest.size = 0; - - /** - * Destroy a fss content nest. - * - * nest: the f_fss_nest_t structure to operate on. - */ - #define f_macro_fss_nest_t_destroy_simple(nest) \ - nest.used = nest.size; \ - while (nest.used > 0) { \ - nest.used--; \ - f_macro_fss_items_t_destroy_simple(nest.depth[nest.used]); \ - } \ - f_memory_destroy((void **) & nest.depth, sizeof(f_fss_items_t), nest.size); \ - nest.size = 0; + #define f_macro_fss_nest_t_new(status, nest, length) f_macro_memory_structure_new(status, nest, f_fss_nest_t, length); + + #define f_macro_fss_nest_t_resize(status, nest, length) status = f_fss_nest_resize(length, &nest); + #define f_macro_fss_nest_t_adjust(status, nest, length) status = f_fss_nest_adjust(length, &nest); + + #define f_macro_fss_nest_t_delete(status, nest) status = f_fss_nest_delete(&nest); + #define f_macro_fss_nest_t_destroy(status, nest) status = f_fss_nest_destroy(&nest); + + #define f_macro_fss_nest_t_delete_simple(nest) f_fss_nest_delete(&nest); + #define f_macro_fss_nest_t_destroy_simple(nest) f_fss_nest_destroy(&nest); + + #define f_macro_fss_nest_t_increase(status, nest) status = f_fss_nest_increase(&nest); + #define f_macro_fss_nest_t_increase_by(status, nest, amount) status = f_fss_nest_increase_by(amount, &nest); + #define f_macro_fss_nest_t_decrease_by(status, nest, amount) status = f_fss_nest_decrease_by(amount, &nest); + #define f_macro_fss_nest_t_decimate_by(status, nest, amount) status = f_fss_nest_decimate_by(amount, &nest); #endif // _di_fss_nest_t_ /** @@ -471,142 +185,627 @@ extern "C" { #define f_fss_nests_t_initialize { 0, 0, 0 } - /** - * Reset a fss content nests to 0 (clear all values). - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * nests: the f_fss_nests_t structure to operate on. - */ #define f_macro_fss_nests_t_clear(nests) \ nests.array = 0; \ nests.size = 0; \ nests.used = 0; - /** - * Create a new fss content nests. - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * status: the status to return. - * nests: the f_fss_nests_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_nests_t_new(status, nests, length) \ - nests.array = 0; \ - nests.size = 0; \ - nests.used = 0; \ - status = f_memory_new((void **) & nests.array, sizeof(f_fss_nest_t), length); \ - if (status == F_none) { \ - nests.size = length; \ - nests.used = 0; \ - } - - /** - * Resize a fss content nests. - * - * status: the status to return. - * nests: the f_fss_nests_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_nests_t_resize(status, nests, new_length) \ - status = F_none; \ - if (new_length < nests.size) { \ - for (register f_array_length_t _macro__i = nests.size - new_length; _macro__i < nests.size; ++_macro__i) { \ - f_macro_fss_nest_t_delete(status, nests.array[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_resize((void **) & nests.array, sizeof(f_fss_nest_t), nests.size, new_length); \ - if (status == F_none) { \ - nests.size = new_length; \ - if (nests.used > nests.size) nests.used = new_length; \ - } - - /** - * Adjust a fss content nests. - * - * status: the status to return. - * nests: the f_fss_nests_t structure to operate on. - * new_length: he new size of the array. - */ - #define f_macro_fss_nests_t_adjust(status, nests, new_length) \ - status = F_none; \ - if (new_length < nests.size) { \ - for (register f_array_length_t _macro__i = nests.size - new_length; _macro__i < nests.size; ++_macro__i) { \ - f_macro_fss_nest_t_destroy(status, nests.array[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_adjust((void **) & nests.array, sizeof(f_fss_nest_t), nests.size, new_length); \ - if (status == F_none) { \ - nests.size = new_length; \ - if (nests.used > nests.size) nests.used = new_length; \ - } - - /** - * Delete a fss content nests. - * - * status: the status to return. - * nests: the f_fss_nests_t structure to operate on. - */ - #define f_macro_fss_nests_t_delete(nests) \ - status = F_none; \ - nests.used = nests.size; \ - while (nests.used) { \ - nests.used--; \ - f_macro_fss_nest_t_delete(status, nests.array[nests.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_delete((void **) & nests.array, sizeof(f_fss_nest_t), nests.size); \ - if (status == F_none) nests.size = 0; - - /** - * Destroy a fss content nests. - * - * status: the status to return. - * nests: the f_fss_nests_t structure to operate on. - */ - #define f_macro_fss_nests_t_destroy(nests) \ - status = F_none; \ - nests.used = nests.size; \ - while (nests.used) { \ - nests.used--; \ - f_macro_fss_nest_t_destroy(status, nests.array[nests.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_destroy((void **) & nests.array, sizeof(f_fss_nest_t), nests.size); \ - if (status == F_none) nests.size = 0; - - /** - * Delete a fss content nests. - * - * nests: the f_fss_nests_t structure to operate on. - */ - #define f_macro_fss_nests_t_delete_simple(nests) \ - nests.used = nests.size; \ - while (nests.used) { \ - nests.used--; \ - f_macro_fss_nest_t_delete_simple(nests.array[nests.used]); \ - } \ - f_memory_delete((void **) & nests.array, sizeof(f_fss_nest_t), nests.size); \ - nests.size = 0; - - /** - * Destroy a fss content nests. - * - * nests: the f_fss_nests_t structure to operate on. - */ - #define f_macro_fss_nests_t_destroy_simple(nests) \ - nests.used = nests.size; \ - while (nests.used) { \ - nests.used--; \ - f_macro_fss_nest_t_destroy_simple(nests.array[nests.used]); \ - } \ - f_memory_destroy((void **) & nests.array, sizeof(f_fss_nest_t), nests.size); \ - nests.size = 0; + #define f_macro_fss_nests_t_new(status, nests, length) f_macro_memory_structure_new(status, nests, f_fss_nests_t, length); + + #define f_macro_fss_nests_t_resize(status, nests, length) status = f_fss_nests_resize(length, &nests); + #define f_macro_fss_nests_t_adjust(status, nests, length) status = f_fss_nests_adjust(length, &nests); + + #define f_macro_fss_nests_t_delete(status, nests) status = f_fss_nests_delete(&nests); + #define f_macro_fss_nests_t_destroy(status, nests) status = f_fss_nests_destroy(&nests); + + #define f_macro_fss_nests_t_delete_simple(nests) f_fss_nests_delete(&nests); + #define f_macro_fss_nests_t_destroy_simple(nests) f_fss_nests_destroy(&nests); + + #define f_macro_fss_nests_t_increase(status, nests) status = f_fss_nests_increase(&nests); + #define f_macro_fss_nests_t_increase_by(status, nests, amount) status = f_fss_nests_increase_by(amount, &nests); + #define f_macro_fss_nests_t_decrease_by(status, nests, amount) status = f_fss_nests_decrease_by(amount, &nests); + #define f_macro_fss_nests_t_decimate_by(status, nests, amount) status = f_fss_nests_decimate_by(amount, &nests); #endif // _di_fss_nests_t_ +/** + * Resize the nest array. + * + * @param length + * The new size to use. + * @param item + * The item 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_item_adjust_ + extern f_status_t f_fss_item_adjust(const f_array_length_t length, f_fss_item_t *item); +#endif // _di_f_fss_item_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 item + * The item 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_item_decimate_by_ + extern f_status_t f_fss_item_decimate_by(const f_array_length_t amount, f_fss_item_t *item); +#endif // _di_f_fss_item_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 item + * The item 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_item_decrease_by_ + extern f_status_t f_fss_item_decrease_by(const f_array_length_t amount, f_fss_item_t *item); +#endif // _di_f_fss_item_decrease_by_ + +/** + * Delete the array of nest. + * + * @param ranges + * The ranges to delete. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_item_delete_ + extern f_status_t f_fss_item_delete(f_fss_item_t *ranges); +#endif // _di_f_fss_item_delete_ + +/** + * Delete the array of nest. + * + * @param item + * The item to destroy. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_item_destroy_ + extern f_status_t f_fss_item_destroy(f_fss_item_t *item); +#endif // _di_f_fss_item_destroy_ + +/** + * Increase the size of the item array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param item + * The item array to resize. + * + * @return + * F_none on success. + * 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_item_increase_ + extern f_status_t f_fss_item_increase(f_fss_item_t *item); +#endif // _di_f_fss_item_increase_ + +/** + * Resize the item array to a larger size. + * + * This will resize making the string larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * 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 item + * The item 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. + * F_array_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_f_fss_item_increase_by_ + extern f_status_t f_fss_item_increase_by(const f_array_length_t amount, f_fss_item_t *item); +#endif // _di_f_fss_item_increase_by_ + +/** + * Create a new item array. + * + * This clears all pointers, so be sure the structure is no longer allocated. + * + * @param length + * The new size to use. + * @param item + * The item 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_item_new_ + extern f_status_t f_fss_item_new(const f_array_length_t length, f_fss_item_t *item); +#endif // _di_f_fss_item_new_ + +/** + * Resize the item array. + * + * @param length + * The new size to use. + * @param item + * The item 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_item_resize_ + extern f_status_t f_fss_item_resize(const f_array_length_t length, f_fss_item_t *item); +#endif // _di_f_fss_item_resize_ + +/** + * 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_array_length_t length, f_fss_items_t *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_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_array_length_t amount, f_fss_items_t *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_array_length_t amount, f_fss_items_t *items); +#endif // _di_f_fss_items_decrease_by_ + +/** + * Delete the array of nest. + * + * @param ranges + * The ranges to delete. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_items_delete_ + extern f_status_t f_fss_items_delete(f_fss_items_t *ranges); +#endif // _di_f_fss_items_delete_ + +/** + * Delete the array of nest. + * + * @param items + * The items to destroy. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_items_destroy_ + extern f_status_t f_fss_items_destroy(f_fss_items_t *items); +#endif // _di_f_fss_items_destroy_ + +/** + * 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_array_length_t_size). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param items + * The items array to resize. + * + * @return + * F_none on success. + * 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(f_fss_items_t *items); +#endif // _di_f_fss_items_increase_ + +/** + * Resize the items array to a larger size. + * + * This will resize making the string larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * 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_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_array_length_t amount, f_fss_items_t *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_array_length_t length, f_fss_items_t *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. + * + * @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_nest_adjust_ + extern f_status_t f_fss_nest_adjust(const f_array_length_t length, f_fss_nest_t *nest); +#endif // _di_f_fss_nest_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 nest + * The nest 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_nest_decimate_by_ + extern f_status_t f_fss_nest_decimate_by(const f_array_length_t amount, f_fss_nest_t *nest); +#endif // _di_f_fss_nest_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 nest + * The nest 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_nest_decrease_by_ + extern f_status_t f_fss_nest_decrease_by(const f_array_length_t amount, f_fss_nest_t *nest); +#endif // _di_f_fss_nest_decrease_by_ + +/** + * Delete the array of nest. + * + * @param ranges + * The ranges to delete. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_nest_delete_ + extern f_status_t f_fss_nest_delete(f_fss_nest_t *ranges); +#endif // _di_f_fss_nest_delete_ + +/** + * Delete the array of nest. + * + * @param nest + * The nest to destroy. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_nest_destroy_ + extern f_status_t f_fss_nest_destroy(f_fss_nest_t *nest); +#endif // _di_f_fss_nest_destroy_ + +/** + * Increase the size of the nest array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param nest + * The nest array to resize. + * + * @return + * F_none on success. + * 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_nest_increase_ + extern f_status_t f_fss_nest_increase(f_fss_nest_t *nest); +#endif // _di_f_fss_nest_increase_ + +/** + * Resize the nest array to a larger size. + * + * This will resize making the string larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * 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 nest + * The nest 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. + * F_array_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_f_fss_nest_increase_by_ + extern f_status_t f_fss_nest_increase_by(const f_array_length_t amount, f_fss_nest_t *nest); +#endif // _di_f_fss_nest_increase_by_ + +/** + * Resize the nest array. + * + * @param length + * The new size to use. + * @param nest + * The nest 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_nest_resize_ + extern f_status_t f_fss_nest_resize(const f_array_length_t length, f_fss_nest_t *nest); +#endif // _di_f_fss_nest_resize_ + +/** + * Resize the nest array. + * + * @param length + * The new size to use. + * @param nests + * The nests 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_nests_adjust_ + extern f_status_t f_fss_nests_adjust(const f_array_length_t length, f_fss_nests_t *nests); +#endif // _di_f_fss_nests_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 nests + * The nests 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_nests_decimate_by_ + extern f_status_t f_fss_nests_decimate_by(const f_array_length_t amount, f_fss_nests_t *nests); +#endif // _di_f_fss_nests_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 nests + * The nests 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_nests_decrease_by_ + extern f_status_t f_fss_nests_decrease_by(const f_array_length_t amount, f_fss_nests_t *nests); +#endif // _di_f_fss_nests_decrease_by_ + +/** + * Delete the array of nest. + * + * @param ranges + * The ranges to delete. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_nests_delete_ + extern f_status_t f_fss_nests_delete(f_fss_nests_t *ranges); +#endif // _di_f_fss_nests_delete_ + +/** + * Delete the array of nest. + * + * @param nests + * The nests to destroy. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_nests_destroy_ + extern f_status_t f_fss_nests_destroy(f_fss_nests_t *nests); +#endif // _di_f_fss_nests_destroy_ + +/** + * Increase the size of the nests array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param nests + * The nests array to resize. + * + * @return + * F_none on success. + * 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_nests_increase_ + extern f_status_t f_fss_nests_increase(f_fss_nests_t *nests); +#endif // _di_f_fss_nests_increase_ + +/** + * Resize the nests array to a larger size. + * + * This will resize making the string larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * 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 nests + * The nests 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. + * F_array_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_f_fss_nests_increase_by_ + extern f_status_t f_fss_nests_increase_by(const f_array_length_t amount, f_fss_nests_t *nests); +#endif // _di_f_fss_nests_increase_by_ + +/** + * Resize the nests array. + * + * @param length + * The new size to use. + * @param nests + * The nests 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_nests_resize_ + extern f_status_t f_fss_nests_resize(const f_array_length_t length, f_fss_nests_t *nests); +#endif // _di_f_fss_nests_resize_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_fss/c/fss_quote.h b/level_0/f_fss/c/fss_quote.h index 8321438..86df9fa 100644 --- a/level_0/f_fss/c/fss_quote.h +++ b/level_0/f_fss/c/fss_quote.h @@ -76,18 +76,23 @@ extern "C" { #define f_fss_quotess_t_initialize f_uint8ss_t_initialize - #define f_macro_fss_quotess_t_clear(quotess) f_macro_uint8ss_t_clear(quotess) + #define f_macro_fss_quotess_t_clear(quotess) f_macro_uint8ss_t_clear(quotess); - #define f_macro_fss_quotess_t_new(status, quotess, length) f_macro_uint8ss_t_new(status, quotess, length) + #define f_macro_fss_quotess_t_new(status, quotess, length) f_macro_uint8ss_t_new(status, quotess, length); - #define f_macro_fss_quotess_t_resize(status, quotess, length) f_macro_uint8ss_t_resize(status, quotess, length) - #define f_macro_fss_quotess_t_adjust(status, quotess, length) f_macro_uint8ss_t_adjust(status, quotess, length) + #define f_macro_fss_quotess_t_resize(status, quotess, length) f_macro_uint8ss_t_resize(status, quotess, length); + #define f_macro_fss_quotess_t_adjust(status, quotess, length) f_macro_uint8ss_t_adjust(status, quotess, length); - #define f_macro_fss_quotess_t_delete(status, quotess) f_macro_uint8ss_t_delete(status, quotess) - #define f_macro_fss_quotess_t_destroy(status, quotess) f_macro_uint8ss_t_destroy(status, quotess) + #define f_macro_fss_quotess_t_delete(status, quotess) f_macro_uint8ss_t_delete(status, quotess); + #define f_macro_fss_quotess_t_destroy(status, quotess) f_macro_uint8ss_t_destroy(status, quotess); - #define f_macro_fss_quotess_t_delete_simple(quotess) f_macro_uint8ss_t_delete_simple(quotess) - #define f_macro_fss_quotess_t_destroy_simple(quotess) f_macro_uint8ss_t_destroy_simple(quotess) + #define f_macro_fss_quotess_t_delete_simple(quotess) f_macro_uint8ss_t_delete_simple(quotess); + #define f_macro_fss_quotess_t_destroy_simple(quotess) f_macro_uint8ss_t_destroy_simple(quotess); + + #define f_macro_fss_quotess_t_increase(status, quotess) f_macro_uint8ss_t_increase(status, quotess); + #define f_macro_fss_quotess_t_increase_by(status, quotess, amount) f_macro_uint8ss_t_increase_by(status, quotess, amount); + #define f_macro_fss_quotess_t_decrease_by(status, quotess, amount) f_macro_uint8ss_t_decrease_by(status, quotess, amount); + #define f_macro_fss_quotess_t_decimate_by(status, quotess, amount) f_macro_uint8ss_t_decimate_by(status, quotess, amount); #endif // _di_f_fss_quotess_t_ #ifdef __cplusplus diff --git a/level_0/f_fss/c/fss_set.c b/level_0/f_fss/c/fss_set.c new file mode 100644 index 0000000..382ea26 --- /dev/null +++ b/level_0/f_fss/c/fss_set.c @@ -0,0 +1,462 @@ +#include "fss.h" +#include "private-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_fss_set_adjust_ + f_status_t f_fss_set_adjust(const f_string_length_t length, f_fss_set_t *set) { + #ifndef _di_level_0_parameter_checking_ + if (!set) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_set_adjust(length, set); + } +#endif // _di_f_fss_set_adjust_ + +#ifndef _di_f_fss_set_decimate_by_ + f_status_t f_fss_set_decimate_by(const f_array_length_t amount, f_fss_set_t *set) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!set) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + 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); + } +#endif // _di_f_fss_set_decimate_by_ + +#ifndef _di_f_fss_set_decrease_by_ + f_status_t f_fss_set_decrease_by(const f_array_length_t amount, f_fss_set_t *set) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!set) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + 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); + } +#endif // _di_f_fss_set_decrease_by_ + +#ifndef _di_f_fss_set_delete_ + f_status_t f_fss_set_delete(f_fss_set_t *set) { + #ifndef _di_level_0_parameter_checking_ + if (!set) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_set_resize(0, set); + } +#endif // _di_f_fss_set_delete_ + +#ifndef _di_f_fss_set_destroy_ + f_status_t f_fss_set_destroy(f_fss_set_t *set) { + #ifndef _di_level_0_parameter_checking_ + if (!set) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_set_adjust(0, set); + } +#endif // _di_f_fss_set_destroy_ + +#ifndef _di_f_fss_set_increase_ + f_status_t f_fss_set_increase(f_fss_set_t *set) { + #ifndef _di_level_0_parameter_checking_ + if (!set) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (set->objects.used + 1 > set->objects.size) { + f_array_length_t size = set->objects.used + f_memory_default_allocation_step; + + if (size > f_array_length_t_size) { + if (set->objects.used + 1 > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + size = f_array_length_t_size; + } + + return private_f_fss_set_resize(size, set); + } + + return F_none; + } +#endif // _di_f_fss_set_increase_ + +#ifndef _di_f_fss_set_increase_by_ + f_status_t f_fss_set_increase_by(const f_array_length_t amount, f_fss_set_t *set) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!set) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (set->objects.used + amount > set->objects.size) { + if (set->objects.used + amount > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + return private_f_fss_set_resize(set->objects.used + amount, set); + } + + return F_none; + } +#endif // _di_f_fss_set_increase_by_ + +#ifndef _di_f_fss_set_resize_ + f_status_t f_fss_set_resize(const f_string_length_t length, f_fss_set_t *set) { + #ifndef _di_level_0_parameter_checking_ + if (!set) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_set_resize(length, set); + } +#endif // _di_f_fss_set_resize_ + +#ifndef _di_f_fss_set_quote_adjust_ + f_status_t f_fss_set_quote_adjust(const f_string_length_t length, f_fss_set_quote_t *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_array_length_t amount, f_fss_set_quote_t *set_quote) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!set_quote) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + 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_array_length_t amount, f_fss_set_quote_t *set_quote) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!set_quote) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + 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_delete_ + f_status_t f_fss_set_quote_delete(f_fss_set_quote_t *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(0, set_quote); + } +#endif // _di_f_fss_set_quote_delete_ + +#ifndef _di_f_fss_set_quote_destroy_ + f_status_t f_fss_set_quote_destroy(f_fss_set_quote_t *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(0, set_quote); + } +#endif // _di_f_fss_set_quote_destroy_ + +#ifndef _di_f_fss_set_quote_increase_ + f_status_t f_fss_set_quote_increase(f_fss_set_quote_t *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 (set_quote->objects.used + 1 > set_quote->objects.size) { + f_array_length_t size = set_quote->objects.used + f_memory_default_allocation_step; + + if (size > f_array_length_t_size) { + if (set_quote->objects.used + 1 > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + size = f_array_length_t_size; + } + + return private_f_fss_set_quote_resize(size, set_quote); + } + + return F_none; + } +#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_array_length_t amount, f_fss_set_quote_t *set_quote) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!set_quote) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (set_quote->objects.used + amount > set_quote->objects.size) { + if (set_quote->objects.used + amount > f_array_length_t_size) { + 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_none; + } +#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_string_length_t length, f_fss_set_quote_t *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_string_length_t length, f_fss_set_quotes_t *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_array_length_t amount, f_fss_set_quotes_t *set_quotes) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!set_quotes) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + 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_array_length_t amount, f_fss_set_quotes_t *set_quotes) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!set_quotes) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + 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_delete_ + f_status_t f_fss_set_quotes_delete(f_fss_set_quotes_t *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(0, set_quotes); + } +#endif // _di_f_fss_set_quotes_delete_ + +#ifndef _di_f_fss_set_quotes_destroy_ + f_status_t f_fss_set_quotes_destroy(f_fss_set_quotes_t *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(0, set_quotes); + } +#endif // _di_f_fss_set_quotes_destroy_ + +#ifndef _di_f_fss_set_quotes_increase_ + f_status_t f_fss_set_quotes_increase(f_fss_set_quotes_t *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 (set_quotes->used + 1 > set_quotes->size) { + f_array_length_t size = set_quotes->used + f_memory_default_allocation_step; + + if (size > f_array_length_t_size) { + if (set_quotes->used + 1 > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + size = f_array_length_t_size; + } + + return private_f_fss_set_quotes_resize(size, set_quotes); + } + + return F_none; + } +#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_array_length_t amount, f_fss_set_quotes_t *set_quotes) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!set_quotes) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (set_quotes->used + amount > set_quotes->size) { + if (set_quotes->used + amount > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + return private_f_fss_set_quotes_resize(set_quotes->used + amount, set_quotes); + } + + return F_none; + } +#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_string_length_t length, f_fss_set_quotes_t *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_string_length_t length, f_fss_sets_t *sets) { + #ifndef _di_level_0_parameter_checking_ + if (!sets) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_sets_adjust(length, sets); + } +#endif // _di_f_fss_sets_adjust_ + +#ifndef _di_f_fss_sets_decimate_by_ + f_status_t f_fss_sets_decimate_by(const f_array_length_t amount, f_fss_sets_t *sets) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!sets) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (sets->size - amount > 0) { + return private_f_fss_sets_adjust(sets->size - amount, sets); + } + + return private_f_fss_sets_adjust(0, sets); + } +#endif // _di_f_fss_sets_decimate_by_ + +#ifndef _di_f_fss_sets_decrease_by_ + f_status_t f_fss_sets_decrease_by(const f_array_length_t amount, f_fss_sets_t *sets) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!sets) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (sets->size - amount > 0) { + return private_f_fss_sets_resize(sets->size - amount, sets); + } + + return private_f_fss_sets_resize(0, sets); + } +#endif // _di_f_fss_sets_decrease_by_ + +#ifndef _di_f_fss_sets_delete_ + f_status_t f_fss_sets_delete(f_fss_sets_t *sets) { + #ifndef _di_level_0_parameter_checking_ + if (!sets) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_sets_resize(0, sets); + } +#endif // _di_f_fss_sets_delete_ + +#ifndef _di_f_fss_sets_destroy_ + f_status_t f_fss_sets_destroy(f_fss_sets_t *sets) { + #ifndef _di_level_0_parameter_checking_ + if (!sets) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_sets_adjust(0, sets); + } +#endif // _di_f_fss_sets_destroy_ + +#ifndef _di_f_fss_sets_increase_ + f_status_t f_fss_sets_increase(f_fss_sets_t *sets) { + #ifndef _di_level_0_parameter_checking_ + if (!sets) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (sets->used + 1 > sets->size) { + f_array_length_t size = sets->used + f_memory_default_allocation_step; + + if (size > f_array_length_t_size) { + if (sets->used + 1 > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + size = f_array_length_t_size; + } + + return private_f_fss_sets_resize(size, sets); + } + + return F_none; + } +#endif // _di_f_fss_sets_increase_ + +#ifndef _di_f_fss_sets_increase_by_ + f_status_t f_fss_sets_increase_by(const f_array_length_t amount, f_fss_sets_t *sets) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!sets) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (sets->used + amount > sets->size) { + if (sets->used + amount > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + + return private_f_fss_sets_resize(sets->used + amount, sets); + } + + return F_none; + } +#endif // _di_f_fss_sets_increase_by_ + +#ifndef _di_f_fss_sets_resize_ + f_status_t f_fss_sets_resize(const f_string_length_t length, f_fss_sets_t *sets) { + #ifndef _di_level_0_parameter_checking_ + if (!sets) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_fss_sets_resize(length, sets); + } +#endif // _di_f_fss_sets_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss_set.h b/level_0/f_fss/c/fss_set.h index 5d34c41..e2c4a5a 100644 --- a/level_0/f_fss/c/fss_set.h +++ b/level_0/f_fss/c/fss_set.h @@ -34,46 +34,24 @@ extern "C" { #define f_fss_set_t_initialize { f_fss_objects_t_initialize, f_fss_contents_t_initialize } #define f_macro_fss_set_t_clear(set) \ - f_macro_fss_objects_t_clear(set.objects) \ - f_macro_fss_contents_t_clear(set.contents) - - #define f_macro_fss_set_t_new(status, set, length) \ - f_macro_fss_objects_t_new(status, set.objects, length) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_new(status, set.contents, length) \ - } - - #define f_macro_fss_set_t_delete(status, set) \ - f_macro_fss_objects_t_delete(status, set.objects) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_delete(status, set.contents) \ - } - - #define f_macro_fss_set_t_destroy(status, set) \ - f_macro_fss_objects_t_destroy(status, set.objects) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_destroy(status, set.contents) \ - } - - #define f_macro_fss_set_t_delete_simple(set) \ - f_macro_fss_objects_t_delete_simple(set.objects) \ - f_macro_fss_contents_t_delete_simple(set.contents) - - #define f_macro_fss_set_t_destroy_simple(set) \ - f_macro_fss_objects_t_destroy_simple(set.objects) \ - f_macro_fss_contents_t_destroy_simple(set.contents) - - #define f_macro_fss_set_t_resize(status, set, new_length) \ - f_macro_fss_objects_t_resize(status, set.objects, new_length) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_resize(status, set.contents, new_length) \ - } - - #define f_macro_fss_set_t_adjust(status, set, new_length) \ - f_macro_fss_objects_t_resize(status, set.objects, new_length) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_resize(status, set.contents, new_length) \ - } + f_macro_fss_objects_t_clear(set.objects); \ + f_macro_fss_contents_t_clear(set.contents); + + #define f_macro_fss_set_t_new(status, set, length) f_macro_memory_structure_new(status, set, f_fss_set_t, length); + + #define f_macro_fss_set_t_resize(status, set, length) status = f_fss_set_resize(length, &set); + #define f_macro_fss_set_t_adjust(status, set, length) status = f_fss_set_adjust(length, &set); + + #define f_macro_fss_set_t_delete(status, set) status = f_fss_set_delete(&set); + #define f_macro_fss_set_t_destroy(status, set) status = f_fss_set_destroy(&set); + + #define f_macro_fss_set_t_delete_simple(set) f_fss_set_delete(&set); + #define f_macro_fss_set_t_destroy_simple(set) f_fss_set_destroy(&set); + + #define f_macro_fss_set_t_increase(status, set) status = f_fss_set_increase(&set); + #define f_macro_fss_set_t_increase_by(status, set, amount) status = f_fss_set_increase_by(amount, &set); + #define f_macro_fss_set_t_decrease_by(status, set, amount) status = f_fss_set_decrease_by(amount, &set); + #define f_macro_fss_set_t_decimate_by(status, set, amount) status = f_fss_set_decimate_by(amount, &set); #endif // _di_f_fss_set_t_ /** @@ -93,140 +71,26 @@ extern "C" { #define f_fss_sets_t_initialize { 0, 0, 0 } - /** - * Reset a fss content sets to 0 (clear all values). - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * sets: the f_fss_sets_t structure to operate on. - */ #define f_macro_fss_sets_t_clear(sets) \ sets.array = 0; \ sets.size = 0; \ sets.used = 0; - /** - * Create a new fss content sets. - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * status: the status to return. - * sets: the f_fss_sets_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_sets_t_new(status, sets, length) \ - sets.array = 0; \ - sets.size = 0; \ - sets.used = 0; \ - status = f_memory_new((void **) & sets.array, sizeof(f_fss_set_t), length); \ - if (status == F_none) { \ - sets.size = length; \ - sets.used = 0; \ - } - - /** - * Delete a fss content sets. - * - * status: the status to return. - * sets: the f_fss_sets_t structure to operate on. - */ - #define f_macro_fss_sets_t_delete(status, sets) \ - status = F_none; \ - sets.used = sets.size; \ - while (sets.used) { \ - sets.used--; \ - f_macro_fss_set_t_delete(status, sets.array[sets.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_delete((void **) & sets.array, sizeof(f_fss_set_t), sets.size); \ - if (status == F_none) sets.size = 0; - - /** - * Destroy a fss content sets. - * - * status: the status to return. - * sets: the f_fss_sets_t structure to operate on. - */ - #define f_macro_fss_sets_t_destroy(status, sets) \ - status = F_none; \ - sets.used = sets.size; \ - while (sets.used) { \ - sets.used--; \ - f_macro_fss_set_t_destroy(status, sets.array[sets.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_destroy((void **) & sets.array, sizeof(f_fss_set_t), sets.size); \ - if (status == F_none) sets.size = 0; - - /** - * Delete a fss content sets. - * - * sets: the f_fss_sets_t structure to operate on. - */ - #define f_macro_fss_sets_t_delete_simple(sets) \ - sets.used = sets.size; \ - while (sets.used) { \ - sets.used--; \ - f_macro_fss_set_t_delete_simple(sets.array[sets.used]); \ - } \ - f_memory_delete((void **) & sets.array, sizeof(f_fss_set_t), sets.size); \ - sets.size = 0; - - /** - * Destroy a fss content sets. - * - * sets: the f_fss_sets_t structure to operate on. - */ - #define f_macro_fss_sets_t_destroy_simple(sets) \ - sets.used = sets.size; \ - while (sets.used > 0) { \ - sets.used--; \ - f_macro_fss_set_t_destroy_simple(sets.array[sets.used]); \ - } \ - f_memory_destroy((void **) & sets.array, sizeof(f_fss_set_t), sets.size); \ - sets.size = 0; - - /** - * Resize a fss content sets. - * - * status: the status to return. - * sets: the f_fss_sets_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_sets_t_resize(status, sets, new_length) \ - status = F_none; \ - if (new_length < sets.size) { \ - for (register f_array_length_t _macro__i = sets.size - new_length; _macro__i < sets.size; ++_macro__i) { \ - f_macro_fss_set_t_delete(status, sets.array[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_resize((void **) & sets.array, sizeof(f_fss_set_t), sets.size, new_length); \ - if (status == F_none) { \ - sets.size = new_length; \ - if (sets.used > sets.size) sets.used = new_length; \ - } - - /** - * Adjust a fss content sets. - * - * status: the status to return. - * sets: the f_fss_sets_t structure to operate on. - * new_length: he new size of the array. - */ - #define f_macro_fss_sets_t_adjust(status, sets, new_length) \ - status = F_none; \ - if (new_length < sets.size) { \ - for (register f_array_length_t _macro__i = sets.size - new_length; _macro__i < sets.size; ++_macro__i) { \ - f_macro_fss_set_t_destroy(status, sets.array[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_adjust((void **) & sets.array, sizeof(f_fss_set_t), sets.size, new_length); \ - if (status == F_none) { \ - sets.size = new_length; \ - if (sets.used > sets.size) sets.used = new_length; \ - } + #define f_macro_fss_sets_t_new(status, sets, length) f_macro_memory_structure_new(status, sets, f_fss_set_t, length); + + #define f_macro_fss_sets_t_resize(status, sets, length) status = f_fss_sets_resize(length, &sets); + #define f_macro_fss_sets_t_adjust(status, sets, length) status = f_fss_sets_adjust(length, &sets); + + #define f_macro_fss_sets_t_delete(status, sets) status = f_fss_sets_delete(&sets); + #define f_macro_fss_sets_t_destroy(status, sets) status = f_fss_sets_destroy(&sets); + + #define f_macro_fss_sets_t_delete_simple(sets) f_fss_sets_delete(&sets); + #define f_macro_fss_sets_t_destroy_simple(sets) f_fss_sets_destroy(&sets); + + #define f_macro_fss_sets_t_increase(status, sets) status = f_fss_sets_increase(&sets); + #define f_macro_fss_sets_t_increase_by(status, sets, amount) status = f_fss_sets_increase_by(amount, &sets); + #define f_macro_fss_sets_t_decrease_by(status, sets, amount) status = f_fss_sets_decrease_by(amount, &sets); + #define f_macro_fss_sets_t_decimate_by(status, sets, amount) status = f_fss_sets_decimate_by(amount, &sets); #endif // _di_f_fss_sets_t_ /** @@ -252,82 +116,26 @@ extern "C" { #define f_fss_set_quote_t_initialize { f_fss_objects_t_initialize, f_fss_contents_t_initialize, f_fss_quotes_t_initialize, f_fss_quotess_t_initialize } #define f_macro_fss_set_quote_t_clear(set) \ - f_macro_fss_objects_t_clear(set.objects) \ - f_macro_fss_contents_t_clear(set.contents) \ - f_macro_fss_quotes_t_clear(set.objects_quote) \ - f_macro_fss_quotess_t_clear(set.contents_quote) - - #define f_macro_fss_set_quote_t_new(status, set, length) \ - f_macro_fss_objects_t_new(status, set.objects, length) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_new(status, set.contents, length) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotes_t_new(status, set.objects_quote, length) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotess_t_new(status, set.contents_quote, length) \ - } - - #define f_macro_fss_set_quote_t_delete(status, set) \ - f_macro_fss_objects_t_delete(status, set.objects) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_delete(status, set.contents) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotes_t_delete(status, set.objects_quote) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotess_t_delete(status, set.contents_quote) \ - } - - #define f_macro_fss_set_quote_t_destroy(status, set) \ - f_macro_fss_objects_t_destroy(status, set.objects) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_destroy(status, set.contents) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotes_t_destroy(status, set.objects_quote) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotess_t_destroy(status, set.contents_quote) \ - } - - #define f_macro_fss_set_quote_t_delete_simple(set) \ - f_macro_fss_objects_t_delete_simple(set.objects) \ - f_macro_fss_contents_t_delete_simple(set.contents) \ - f_macro_fss_quotes_t_delete_simple(set.objects_quote) \ - f_macro_fss_quotess_t_delete_simple(set.contents_quote) - - #define f_macro_fss_set_quote_t_destroy_simple(set) \ - f_macro_fss_objects_t_destroy_simple(set.objects) \ - f_macro_fss_contents_t_destroy_simple(set.contents) \ - f_macro_fss_quotes_t_destroy_simple(set.objects_quote) \ - f_macro_fss_quotess_t_destroy_simple(set.contents_quote) - - #define f_macro_fss_set_quote_t_resize(status, set, new_length) \ - f_macro_fss_objects_t_resize(status, set.objects, new_length) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_resize(status, set.contents, new_length) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotes_t_resize(status, set.objects_quote, new_length) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotess_t_resize(status, set.contents_quote, new_length) \ - } - - #define f_macro_fss_set_quote_t_adjust(status, set, new_length) \ - f_macro_fss_objects_t_adjust(status, set.objects, new_length) \ - if (F_status_is_fine(status)) { \ - f_macro_fss_contents_t_adjust(status, set.contents, new_length) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotes_t_adjust(status, set.objects_quote, new_length) \ - } \ - if (F_status_is_fine(status)) { \ - f_macro_fss_quotess_t_adjust(status, set.contents_quote, new_length) \ - } + f_macro_fss_objects_t_clear(set.objects); \ + f_macro_fss_contents_t_clear(set.contents); \ + f_macro_fss_quotes_t_clear(set.objects_quote); \ + f_macro_fss_quotess_t_clear(set.contents_quote); + + #define f_macro_fss_set_quote_t_new(status, set_quote, length) f_macro_memory_structure_new(status, set_quote, f_fss_set_quote_t, length); + + #define f_macro_fss_set_quote_t_resize(status, set_quote, length) status = f_fss_set_quote_resize(length, &set_quote); + #define f_macro_fss_set_quote_t_adjust(status, set_quote, length) status = f_fss_set_quote_adjust(length, &set_quote); + + #define f_macro_fss_set_quote_t_delete(status, set_quote) status = f_fss_set_quote_delete(&set_quote); + #define f_macro_fss_set_quote_t_destroy(status, set_quote) status = f_fss_set_quote_destroy(&set_quote); + + #define f_macro_fss_set_quote_t_delete_simple(set_quote) f_fss_set_quote_delete(&set_quote); + #define f_macro_fss_set_quote_t_destroy_simple(set_quote) f_fss_set_quote_destroy(&set_quote); + + #define f_macro_fss_set_quote_t_increase(status, set_quote) status = f_fss_set_quote_increase(&set_quote); + #define f_macro_fss_set_quote_t_increase_by(status, set_quote, amount) status = f_fss_set_quote_increase_by(amount, &set_quote); + #define f_macro_fss_set_quote_t_decrease_by(status, set_quote, amount) status = f_fss_set_quote_decrease_by(amount, &set_quote); + #define f_macro_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_ /** @@ -347,142 +155,608 @@ extern "C" { #define f_fss_set_quotes_t_initialize { 0, 0, 0 } - /** - * Reset a fss content sets to 0 (clear all values). - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * sets: the f_fss_set_quotes_t structure to operate on. - */ #define f_macro_fss_set_quotes_t_clear(sets) \ sets.array = 0; \ sets.size = 0; \ sets.used = 0; - /** - * Create a new fss content sets. - * - * This does not deallocate memory, be certain that memory is not allocated before calling this to avoid potential memory leaks. - * - * status: the status to return. - * sets: the f_fss_set_quotes_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_set_quotes_t_new(status, sets, length) \ - sets.array = 0; \ - sets.size = 0; \ - sets.used = 0; \ - status = f_memory_new((void **) & sets.array, sizeof(f_fss_set_quote_t), length); \ - if (status == F_none) { \ - sets.size = length; \ - sets.used = 0; \ - } - - /** - * Resize a fss content sets. - * - * status: the status to return. - * sets: the f_fss_set_quotes_t structure to operate on. - * new_length: the new size of the array. - */ - #define f_macro_fss_set_quotes_t_resize(status, sets, new_length) \ - status = F_none; \ - if (new_length < sets.size) { \ - for (register f_array_length_t _macro__i = sets.size - new_length; _macro__i < sets.size; ++_macro__i) { \ - f_macro_fss_set_quote_t_delete(status, sets.array[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_resize((void **) & sets.array, sizeof(f_fss_set_quote_t), sets.size, new_length); \ - if (status == F_none) { \ - sets.size = new_length; \ - if (sets.used > sets.size) sets.used = new_length; \ - } - - /** - * Adjust a fss content sets. - * - * status: the status to return. - * sets: the f_fss_set_quotes_t structure to operate on. - * new_length: he new size of the array. - */ - #define f_macro_fss_set_quotes_t_adjust(status, sets, new_length) \ - status = F_none; \ - if (new_length < sets.size) { \ - for (register f_array_length_t _macro__i = sets.size - new_length; _macro__i < sets.size; ++_macro__i) { \ - f_macro_fss_set_quote_t_destroy(status, sets.array[_macro__i]); \ - if (status != F_none) break; \ - } \ - } \ - if (status == F_none) status = f_memory_adjust((void **) & sets.array, sizeof(f_fss_set_quote_t), sets.size, new_length); \ - if (status == F_none) { \ - sets.size = new_length; \ - if (sets.used > sets.size) sets.used = new_length; \ - } - - /** - * Delete a fss content sets. - * - * status: the status to return. - * sets: the f_fss_set_quotes_t structure to operate on. - */ - #define f_macro_fss_set_quotes_t_delete(status, sets) \ - status = F_none; \ - sets.used = sets.size; \ - while (sets.used) { \ - sets.used--; \ - f_macro_fss_set_quote_t_delete(status, sets.array[sets.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_delete((void **) & sets.array, sizeof(f_fss_set_quote_t), sets.size); \ - if (status == F_none) sets.size = 0; - - /** - * Destroy a fss content sets. - * - * status: the status to return. - * sets: the f_fss_set_quotes_t structure to operate on. - */ - #define f_macro_fss_set_quotes_t_destroy(status, sets) \ - status = F_none; \ - sets.used = sets.size; \ - while (sets.used) { \ - sets.used--; \ - f_macro_fss_set_quote_t_destroy(status, sets.array[sets.used]); \ - if (status != F_none) break; \ - } \ - if (status == F_none) status = f_memory_destroy((void **) & sets.array, sizeof(f_fss_set_quote_t), sets.size); \ - if (status == F_none) sets.size = 0; - - /** - * Delete a fss content sets. - * - * sets: the f_fss_set_quotes_t structure to operate on. - */ - #define f_macro_fss_set_quotes_t_delete_simple(sets) \ - sets.used = sets.size; \ - while (sets.used) { \ - sets.used--; \ - f_macro_fss_set_quote_t_delete_simple(sets.array[sets.used]); \ - } \ - f_memory_delete((void **) & sets.array, sizeof(f_fss_set_quote_t), sets.size); \ - sets.size = 0; - - /** - * Destroy a fss content sets. - * - * sets: the f_fss_set_quotes_t structure to operate on. - */ - #define f_macro_fss_set_quotes_t_destroy_simple(sets) \ - sets.used = sets.size; \ - while (sets.used > 0) { \ - sets.used--; \ - f_macro_fss_set_quote_t_destroy_simple(sets.array[sets.used]); \ - } \ - f_memory_destroy((void **) & sets.array, sizeof(f_fss_set_quote_t), sets.size); \ - sets.size = 0; + #define f_macro_fss_set_quotes_t_new(status, set_quotes, length) f_macro_memory_structure_new(status, set_quotes, f_fss_set_quotes_t, length); + + #define f_macro_fss_set_quotes_t_resize(status, set_quotes, length) status = f_fss_set_quotes_resize(length, &set_quotes); + #define f_macro_fss_set_quotes_t_adjust(status, set_quotes, length) status = f_fss_set_quotes_adjust(length, &set_quotes); + + #define f_macro_fss_set_quotes_t_delete(status, set_quotes) status = f_fss_set_quotes_delete(&set_quotes); + #define f_macro_fss_set_quotes_t_destroy(status, set_quotes) status = f_fss_set_quotes_destroy(&set_quotes); + + #define f_macro_fss_set_quotes_t_delete_simple(set_quotes) f_fss_set_quotes_delete(&set_quotes); + #define f_macro_fss_set_quotes_t_destroy_simple(set_quotes) f_fss_set_quotes_destroy(&set_quotes); + + #define f_macro_fss_set_quotes_t_increase(status, set_quotes) status = f_fss_set_quotes_increase(&set_quotes); + #define f_macro_fss_set_quotes_t_increase_by(status, set_quotes, amount) status = f_fss_set_quotes_increase_by(amount, &set_quotes); + #define f_macro_fss_set_quotes_t_decrease_by(status, set_quotes, amount) status = f_fss_set_quotes_decrease_by(amount, &set_quotes); + #define f_macro_fss_set_quotes_t_decimate_by(status, set_quotes, amount) status = f_fss_set_quotes_decimate_by(amount, &set_quotes); #endif // _di_fss_set_quotes_t_ +/** + * Resize the set array. + * + * @param length + * The new size to use. + * @param set + * The set 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_adjust_ + extern f_status_t f_fss_set_adjust(const f_array_length_t length, f_fss_set_t *set); +#endif // _di_f_fss_set_adjust_ + +/** + * Resize the set 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 + * The set 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_decimate_by_ + extern f_status_t f_fss_set_decimate_by(const f_array_length_t amount, f_fss_set_t *set); +#endif // _di_f_fss_set_decimate_by_ + +/** + * Resize the set 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 + * The set 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_decrease_by_ + extern f_status_t f_fss_set_decrease_by(const f_array_length_t amount, f_fss_set_t *set); +#endif // _di_f_fss_set_decrease_by_ + +/** + * Delete the array of set. + * + * @param ranges + * The ranges to delete. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_delete_ + extern f_status_t f_fss_set_delete(f_fss_set_t *ranges); +#endif // _di_f_fss_set_delete_ + +/** + * Delete the array of set. + * + * @param set + * The set to destroy. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_destroy_ + extern f_status_t f_fss_set_destroy(f_fss_set_t *set); +#endif // _di_f_fss_set_destroy_ + +/** + * Increase the size of the set array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param set + * The set array to resize. + * + * @return + * F_none on success. + * 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_increase_ + extern f_status_t f_fss_set_increase(f_fss_set_t *set); +#endif // _di_f_fss_set_increase_ + +/** + * Resize the set array to a larger size. + * + * This will resize making the string larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * 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 + * The set 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. + * F_array_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_f_fss_set_increase_by_ + extern f_status_t f_fss_set_increase_by(const f_array_length_t amount, f_fss_set_t *set); +#endif // _di_f_fss_set_increase_by_ + +/** + * Resize the set array. + * + * @param length + * The new size to use. + * @param set + * The set 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_resize_ + extern f_status_t f_fss_set_resize(const f_array_length_t length, f_fss_set_t *set); +#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_array_length_t length, f_fss_set_quote_t *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_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_array_length_t amount, f_fss_set_quote_t *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_array_length_t amount, f_fss_set_quote_t *set_quote); +#endif // _di_f_fss_set_quote_decrease_by_ + +/** + * Delete the array of set_quote. + * + * @param ranges + * The ranges to delete. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quote_delete_ + extern f_status_t f_fss_set_quote_delete(f_fss_set_quote_t *ranges); +#endif // _di_f_fss_set_quote_delete_ + +/** + * Delete the array of set_quote. + * + * @param set_quote + * The set_quote to destroy. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quote_destroy_ + extern f_status_t f_fss_set_quote_destroy(f_fss_set_quote_t *set_quote); +#endif // _di_f_fss_set_quote_destroy_ + +/** + * 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_array_length_t_size). + * If already set_quote to the maximum buffer size, then the resize will fail. + * + * @param set_quote + * The set_quote array to resize. + * + * @return + * F_none on success. + * 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(f_fss_set_quote_t *set_quote); +#endif // _di_f_fss_set_quote_increase_ + +/** + * Resize the set_quote array to a larger size. + * + * This will resize making the string 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_array_length_t_size). + * 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_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_array_length_t amount, f_fss_set_quote_t *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_array_length_t length, f_fss_set_quote_t *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_array_length_t length, f_fss_set_quotes_t *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_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_array_length_t amount, f_fss_set_quotes_t *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_array_length_t amount, f_fss_set_quotes_t *set_quotes); +#endif // _di_f_fss_set_quotes_decrease_by_ + +/** + * Delete the array of set_quote. + * + * @param ranges + * The ranges to delete. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quotes_delete_ + extern f_status_t f_fss_set_quotes_delete(f_fss_set_quotes_t *ranges); +#endif // _di_f_fss_set_quotes_delete_ + +/** + * Delete the array of set_quote. + * + * @param set_quotes + * The set_quotes to destroy. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_set_quotes_destroy_ + extern f_status_t f_fss_set_quotes_destroy(f_fss_set_quotes_t *set_quotes); +#endif // _di_f_fss_set_quotes_destroy_ + +/** + * 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_array_length_t_size). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param set_quotes + * The set_quotes array to resize. + * + * @return + * F_none on success. + * 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(f_fss_set_quotes_t *set_quotes); +#endif // _di_f_fss_set_quotes_increase_ + +/** + * Resize the set_quotes array to a larger size. + * + * This will resize making the string larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * 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_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_array_length_t amount, f_fss_set_quotes_t *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_array_length_t length, f_fss_set_quotes_t *set_quotes); +#endif // _di_f_fss_set_quotes_resize_ + +/** + * Resize the set array. + * + * @param length + * The new size to use. + * @param sets + * The sets 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_sets_adjust_ + extern f_status_t f_fss_sets_adjust(const f_array_length_t length, f_fss_sets_t *sets); +#endif // _di_f_fss_sets_adjust_ + +/** + * Resize the set 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 sets + * The sets 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_sets_decimate_by_ + extern f_status_t f_fss_sets_decimate_by(const f_array_length_t amount, f_fss_sets_t *sets); +#endif // _di_f_fss_sets_decimate_by_ + +/** + * Resize the set 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 sets + * The sets 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_sets_decrease_by_ + extern f_status_t f_fss_sets_decrease_by(const f_array_length_t amount, f_fss_sets_t *sets); +#endif // _di_f_fss_sets_decrease_by_ + +/** + * Delete the array of set. + * + * @param ranges + * The ranges to delete. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_sets_delete_ + extern f_status_t f_fss_sets_delete(f_fss_sets_t *ranges); +#endif // _di_f_fss_sets_delete_ + +/** + * Delete the array of set. + * + * @param sets + * The sets to destroy. + * + * @return + * F_none on success. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_fss_sets_destroy_ + extern f_status_t f_fss_sets_destroy(f_fss_sets_t *sets); +#endif // _di_f_fss_sets_destroy_ + +/** + * Increase the size of the sets array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param sets + * The sets array to resize. + * + * @return + * F_none on success. + * 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_sets_increase_ + extern f_status_t f_fss_sets_increase(f_fss_sets_t *sets); +#endif // _di_f_fss_sets_increase_ + +/** + * Resize the sets array to a larger size. + * + * This will resize making the string larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * 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 sets + * The sets 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. + * F_array_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_f_fss_sets_increase_by_ + extern f_status_t f_fss_sets_increase_by(const f_array_length_t amount, f_fss_sets_t *sets); +#endif // _di_f_fss_sets_increase_by_ + +/** + * Resize the sets array. + * + * @param length + * The new size to use. + * @param sets + * The sets 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_sets_resize_ + extern f_status_t f_fss_sets_resize(const f_array_length_t length, f_fss_sets_t *sets); +#endif // _di_f_fss_sets_resize_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_fss/c/private-fss.c b/level_0/f_fss/c/private-fss.c new file mode 100644 index 0000000..dca80d7 --- /dev/null +++ b/level_0/f_fss/c/private-fss.c @@ -0,0 +1,678 @@ +#include "fss.h" +#include "private-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_fss_item_adjust_) || !defined(_di_f_fss_item_decimate_by_) || !defined(_di_f_fss_item_destroy_) + f_status_t private_f_fss_item_adjust(const f_array_length_t length, f_fss_item_t *item) { + f_status_t status = F_none; + + if (length < item->content.size) { + + // item->object has no allocatable child elements. + + for (f_array_length_t i = item->content.size - length; i < item->content.size; ++i) { + f_macro_fss_content_t_destroy(status, item->content); + if (F_status_is_error(status)) return status; + } // for + } + + status = f_memory_adjust((void **) & item->content.array, sizeof(f_fss_content_t), item->content.size, length); + + if (F_status_is_error_not(status)) { + if (!length) { + item->object.start = 1; + item->object.stop = 0; + item->parent = 0; + } + + item->content.size = length; + + if (item->content.used > item->content.size) { + item->content.used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_item_adjust_) || !defined(_di_f_fss_item_decimate_by_) || !defined(_di_f_fss_item_destroy_) + +#if !defined(_di_f_fss_item_decrease_by_) || !defined(_di_f_fss_item_delete_) || !defined(_di_f_fss_item_increase_) || !defined(_di_f_fss_item_increase_by_) || !defined(_di_f_fss_item_resize_) + f_status_t private_f_fss_item_resize(const f_array_length_t length, f_fss_item_t *item) { + f_status_t status = F_none; + + if (length < item->content.size) { + + // item->object has no allocatable child elements. + + for (f_array_length_t i = item->content.size - length; i < item->content.size; ++i) { + f_macro_fss_content_t_delete(status, item->content); + if (F_status_is_error(status)) return status; + } // for + } + + status = f_memory_resize((void **) & item->content.array, sizeof(f_fss_content_t), item->content.size, length); + + if (F_status_is_error_not(status)) { + if (!length) { + item->object.start = 1; + item->object.stop = 0; + item->parent = 0; + } + + item->content.size = length; + + if (item->content.used > item->content.size) { + item->content.used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_item_decrease_by_) || !defined(_di_f_fss_item_delete_) || !defined(_di_f_fss_item_increase_) || !defined(_di_f_fss_item_increase_by_) || !defined(_di_f_fss_item_resize_) + +#if !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) || !defined(_di_f_fss_items_destroy_) + f_status_t private_f_fss_items_adjust(const f_array_length_t length, f_fss_items_t *items) { + f_status_t status = F_none; + + if (length < items->size) { + for (f_array_length_t i = items->size - length; i < items->size; ++i) { + status = private_f_fss_item_adjust(0, &items->array[i]); + if (F_status_is_error(status)) return status; + } // for + } + + status = f_memory_adjust((void **) & items->array, sizeof(f_fss_item_t), items->size, length); + + if (F_status_is_error_not(status)) { + items->size = length; + + if (items->used > items->size) { + items->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) || !defined(_di_f_fss_items_destroy_) + +#if !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_delete_) || !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_array_length_t length, f_fss_items_t *items) { + f_status_t status = F_none; + + if (length < items->size) { + for (f_array_length_t i = items->size - length; i < items->size; ++i) { + status = private_f_fss_item_resize(0, &items->array[i]); + if (F_status_is_error(status)) return status; + } // for + } + + status = f_memory_resize((void **) & items->array, sizeof(f_fss_item_t), items->size, length); + + if (F_status_is_error_not(status)) { + items->size = length; + + if (items->used > items->size) { + items->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_delete_) || !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_destroy_) || !defined(_di_f_fss_nameds_decimate_by_) + f_status_t private_f_fss_named_destroy(f_fss_named_t *named) { + f_status_t status = F_none; + + f_macro_string_ranges_t_destroy(status, named->objects); + if (F_status_is_error(status)) return status; + + named->objects.size = 0; + named->objects.used = 0; + + f_macro_string_rangess_t_destroy(status, named->contents); + if (F_status_is_error(status)) return status; + + named->contents.size = 0; + named->contents.used = 0; + + f_macro_uint8ss_t_destroy(status, named->quotess); + + if (F_status_is_error_not(status)) { + named->quotess.size = 0; + named->quotess.used = 0; + } + + return status; + } +#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_destroy_) || !defined(_di_f_fss_nameds_decimate_by_) + +#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_delete_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) + f_status_t private_f_fss_named_delete(f_fss_named_t *named) { + f_status_t status = F_none; + + f_macro_string_ranges_t_delete(status, named->objects); + if (F_status_is_error(status)) return status; + + named->objects.size = 0; + named->objects.used = 0; + + f_macro_string_rangess_t_delete(status, named->contents); + if (F_status_is_error(status)) return status; + + named->contents.size = 0; + named->contents.used = 0; + + f_macro_uint8ss_t_delete(status, named->quotess); + + if (F_status_is_error_not(status)) { + named->quotess.size = 0; + named->quotess.used = 0; + } + + return status; + } +#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_delete_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) + +#if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) || !defined(_di_f_fss_nameds_destroy_) + f_status_t private_f_fss_nameds_adjust(const f_array_length_t length, f_fss_nameds_t *nameds) { + f_status_t status = F_none; + + if (length < nameds->size) { + for (f_array_length_t i = nameds->size - length; i < nameds->size; ++i) { + status = private_f_fss_named_destroy(&nameds->array[i]); + if (F_status_is_error(status)) return status; + } // for + } + + status = f_memory_adjust((void **) & nameds->array, sizeof(f_fss_named_t), nameds->size, length); + + if (F_status_is_error_not(status)) { + nameds->size = length; + + if (nameds->used > nameds->size) { + nameds->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) || !defined(_di_f_fss_nameds_destroy_) + +#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_delete_) || !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_array_length_t length, f_fss_nameds_t *nameds) { + f_status_t status = F_none; + + if (length < nameds->size) { + for (f_array_length_t i = nameds->size - length; i < nameds->size; ++i) { + status = private_f_fss_named_delete(&nameds->array[i]); + if (F_status_is_error(status)) return status; + } // for + } + + status = f_memory_resize((void **) & nameds->array, sizeof(f_fss_named_t), nameds->size, length); + + if (F_status_is_error_not(status)) { + nameds->size = length; + + if (nameds->used > nameds->size) { + nameds->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_delete_) || !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_) || !defined(_di_f_fss_nest_destroy_) + f_status_t private_f_fss_nest_adjust(const f_array_length_t length, f_fss_nest_t *nest) { + f_status_t status = F_none; + + if (length < nest->size) { + for (f_array_length_t i = nest->size - 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((void **) & nest->depth, sizeof(f_fss_items_t), nest->size, length); + + if (F_status_is_error_not(status)) { + nest->size = length; + + if (nest->used > nest->size) { + nest->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) || !defined(_di_f_fss_nest_destroy_) + +#if !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_delete_) || !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_array_length_t length, f_fss_nest_t *nest) { + f_status_t status = F_none; + + if (length < nest->size) { + if (length) { + for (f_array_length_t i = nest->size - 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((void **) & nest->depth, sizeof(f_fss_items_t), nest->size, length); + + if (F_status_is_error_not(status)) { + nest->size = length; + + if (nest->used > nest->size) { + nest->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_delete_) || !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_) || !defined(_di_f_fss_nests_destroy_) + f_status_t private_f_fss_nests_adjust(const f_array_length_t length, f_fss_nests_t *nests) { + f_status_t status = F_none; + + if (length < nests->size) { + for (f_array_length_t i = nests->size - 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((void **) & nests->array, sizeof(f_fss_nest_t), nests->size, length); + + if (F_status_is_error_not(status)) { + nests->size = length; + + if (nests->used > nests->size) { + nests->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) || !defined(_di_f_fss_nests_destroy_) + +#if !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_delete_) || !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_array_length_t length, f_fss_nests_t *nests) { + f_status_t status = F_none; + + if (length < nests->size) { + for (f_array_length_t i = nests->size - 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((void **) & nests->array, sizeof(f_fss_nest_t), nests->size, length); + + if (F_status_is_error_not(status)) { + nests->size = length; + + if (nests->used > nests->size) { + nests->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_delete_) || !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_) || !defined(_di_f_fss_set_destroy_) + f_status_t private_f_fss_set_adjust(const f_array_length_t length, f_fss_set_t *set) { + f_status_t status = F_none; + + if (length < set->objects.size) { + f_array_length_t i = set->objects.size - length; + + // set->objects has no allocatable child elements. + + if (length < set->contents.size) { + if (length) { + for (i = set->contents.size - length; i < set->contents.size; ++i) { + f_macro_fss_content_t_destroy(status, set->contents.array[i]); + if (F_status_is_error(status)) return status; + } // for + } + else { + f_macro_fss_contents_t_destroy(status, set->contents); + } + } + } + + f_macro_fss_objects_t_adjust(status, set->objects, length); + if (F_status_is_error(status)) return status; + + f_macro_fss_contents_t_adjust(status, set->contents, length); + if (F_status_is_error(status)) return status; + + return status; + } +#endif // !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) || !defined(_di_f_fss_set_destroy_) + +#if !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_delete_) || !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_array_length_t length, f_fss_set_t *set) { + f_status_t status = F_none; + + if (length < set->objects.size) { + f_array_length_t i = set->objects.size - length; + + // set->objects has no allocatable child elements. + + if (length < set->contents.size) { + if (length) { + for (i = set->contents.size - length; i < set->contents.size; ++i) { + f_macro_fss_content_t_delete(status, set->contents.array[i]); + if (F_status_is_error(status)) return status; + } // for + } + else { + f_macro_fss_contents_t_delete(status, set->contents); + } + } + } + + f_macro_fss_objects_t_resize(status, set->objects, length); + if (F_status_is_error(status)) return status; + + f_macro_fss_contents_t_resize(status, set->contents, length); + if (F_status_is_error(status)) return status; + + return status; + } +#endif // !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_delete_) || !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_) || !defined(_di_f_fss_set_quote_destroy_) + f_status_t private_f_fss_set_quote_adjust(const f_array_length_t length, f_fss_set_quote_t *set_quote) { + f_status_t status = F_none; + + if (length < set_quote->objects.size) { + f_array_length_t i = set_quote->contents.size - length; + + // set_quote->objects has no allocatable child elements. + + if (length < set_quote->contents.size) { + if (length) { + for (; i < set_quote->contents.size; ++i) { + f_macro_fss_content_t_destroy(status, set_quote->contents.array[i]); + if (F_status_is_error(status)) return status; + } // for + } + else { + f_macro_fss_contents_t_destroy(status, set_quote->contents); + } + } + + // set_quote->objects_quote has no allocatable child elements. + + if (length < set_quote->contents_quote.size) { + if (length) { + for (i = set_quote->contents_quote.size - length; i < set_quote->contents_quote.size; ++i) { + f_macro_fss_quotes_t_destroy(status, set_quote->contents_quote.array[i]); + if (F_status_is_error(status)) return status; + } // for + } + else { + f_macro_fss_quotess_t_delete(status, set_quote->contents_quote); + } + } + } + + status = f_memory_adjust((void **) & set_quote->objects.array, sizeof(f_fss_objects_t), set_quote->objects.size, length); + if (F_status_is_error(status)) return status; + + set_quote->objects.size = length; + + if (set_quote->objects.used > set_quote->objects.size) { + set_quote->objects.used = length; + } + + status = f_memory_adjust((void **) & set_quote->contents.array, sizeof(f_fss_contents_t), set_quote->contents.size, length); + if (F_status_is_error(status)) return status; + + set_quote->contents.size = length; + + if (set_quote->contents.used > set_quote->contents.size) { + set_quote->contents.used = length; + } + + status = f_memory_adjust((void **) & set_quote->objects_quote.array, sizeof(f_fss_quotes_t), set_quote->objects_quote.size, length); + if (F_status_is_error(status)) return status; + + set_quote->objects_quote.size = length; + + if (set_quote->objects_quote.used > set_quote->objects_quote.size) { + set_quote->objects_quote.used = length; + } + + status = f_memory_adjust((void **) & set_quote->contents_quote.array, sizeof(f_fss_quotess_t), set_quote->contents_quote.size, length); + if (F_status_is_error(status)) return status; + + set_quote->contents_quote.size = length; + + if (set_quote->contents_quote.used > set_quote->contents_quote.size) { + set_quote->contents_quote.used = length; + } + + return status; + } +#endif // !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) || !defined(_di_f_fss_set_quote_destroy_) + +#if !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_delete_) || !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_array_length_t length, f_fss_set_quote_t *set_quote) { + f_status_t status = F_none; + + if (length < set_quote->objects.size) { + f_array_length_t i = set_quote->contents.size - length; + + // set_quote->objects has no allocatable child elements. + + if (length < set_quote->contents.size) { + if (length) { + for (; i < set_quote->contents.size; ++i) { + f_macro_fss_content_t_delete(status, set_quote->contents.array[i]); + if (F_status_is_error(status)) return status; + } // for + } + else { + f_macro_fss_contents_t_delete(status, set_quote->contents); + } + } + + // set_quote->objects_quote has no allocatable child elements. + + if (length < set_quote->contents_quote.size) { + if (length) { + for (i = set_quote->contents_quote.size - length; i < set_quote->contents_quote.size; ++i) { + f_macro_fss_quotes_t_delete(status, set_quote->contents_quote.array[i]); + if (F_status_is_error(status)) return status; + } // for + } + else { + f_macro_fss_quotess_t_delete(status, set_quote->contents_quote); + } + } + } + + status = f_memory_resize((void **) & set_quote->objects.array, sizeof(f_fss_objects_t), set_quote->objects.size, length); + if (F_status_is_error(status)) return status; + + set_quote->objects.size = length; + + if (set_quote->objects.used > set_quote->objects.size) { + set_quote->objects.used = length; + } + + status = f_memory_resize((void **) & set_quote->contents.array, sizeof(f_fss_contents_t), set_quote->contents.size, length); + if (F_status_is_error(status)) return status; + + set_quote->contents.size = length; + + if (set_quote->contents.used > set_quote->contents.size) { + set_quote->contents.used = length; + } + + status = f_memory_resize((void **) & set_quote->objects_quote.array, sizeof(f_fss_quotes_t), set_quote->objects_quote.size, length); + if (F_status_is_error(status)) return status; + + set_quote->objects_quote.size = length; + + if (set_quote->objects_quote.used > set_quote->objects_quote.size) { + set_quote->objects_quote.used = length; + } + + status = f_memory_resize((void **) & set_quote->contents_quote.array, sizeof(f_fss_quotess_t), set_quote->contents_quote.size, length); + if (F_status_is_error(status)) return status; + + set_quote->contents_quote.size = length; + + if (set_quote->contents_quote.used > set_quote->contents_quote.size) { + set_quote->contents_quote.used = length; + } + + return status; + } +#endif // !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_delete_) || !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_) || !defined(_di_f_fss_set_quotes_destroy_) + f_status_t private_f_fss_set_quotes_adjust(const f_array_length_t length, f_fss_set_quotes_t *set_quotes) { + f_status_t status = F_none; + + if (length < set_quotes->size) { + for (f_array_length_t i = set_quotes->size - length; i < set_quotes->size; ++i) { + + f_macro_fss_objects_t_destroy(status, set_quotes->array[i].objects); + if (F_status_is_error(status)) return status; + + f_macro_fss_contents_t_destroy(status, set_quotes->array[i].contents); + if (F_status_is_error(status)) return status; + + f_macro_fss_quotes_t_destroy(status, set_quotes->array[i].objects_quote); + if (F_status_is_error(status)) return status; + + f_macro_fss_quotess_t_destroy(status, set_quotes->array[i].contents_quote); + if (F_status_is_error(status)) return status; + } // for + } + + status = f_memory_adjust((void **) & set_quotes->array, sizeof(f_fss_set_quote_t), set_quotes->size, length); + + if (F_status_is_error_not(status)) { + set_quotes->size = length; + + if (set_quotes->used > set_quotes->size) { + set_quotes->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) || !defined(_di_f_fss_set_quotes_destroy_) + +#if !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_delete_) || !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_array_length_t length, f_fss_set_quotes_t *set_quotes) { + f_status_t status = F_none; + + if (length < set_quotes->size) { + for (f_array_length_t i = set_quotes->size - length; i < set_quotes->size; ++i) { + + f_macro_fss_objects_t_delete(status, set_quotes->array[i].objects); + if (F_status_is_error(status)) return status; + + f_macro_fss_contents_t_delete(status, set_quotes->array[i].contents); + if (F_status_is_error(status)) return status; + + f_macro_fss_quotes_t_delete(status, set_quotes->array[i].objects_quote); + if (F_status_is_error(status)) return status; + + f_macro_fss_quotess_t_delete(status, set_quotes->array[i].contents_quote); + if (F_status_is_error(status)) return status; + } // for + } + + status = f_memory_resize((void **) & set_quotes->array, sizeof(f_fss_set_quote_t), set_quotes->size, length); + + if (F_status_is_error_not(status)) { + set_quotes->size = length; + + if (set_quotes->used > set_quotes->size) { + set_quotes->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_delete_) || !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_) || !defined(_di_f_fss_sets_destroy_) + f_status_t private_f_fss_sets_adjust(const f_array_length_t length, f_fss_sets_t *sets) { + f_status_t status = F_none; + + if (length < sets->size) { + for (f_array_length_t i = sets->size - length; i < sets->size; ++i) { + + f_macro_fss_objects_t_destroy(status, sets->array[i].objects); + if (F_status_is_error(status)) return status; + + f_macro_fss_contents_t_destroy(status, sets->array[i].contents); + if (F_status_is_error(status)) return status; + } // for + } + + f_memory_adjust((void **) & sets->array, sizeof(f_fss_set_t), sets->size, length); + + if (F_status_is_error_not(status)) { + sets->size = length; + + if (sets->used > sets->size) { + sets->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) || !defined(_di_f_fss_sets_destroy_) + +#if !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_delete_) || !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_array_length_t length, f_fss_sets_t *sets) { + f_status_t status = F_none; + + if (length < sets->size) { + for (f_array_length_t i = sets->size - length; i < sets->size; ++i) { + + f_macro_fss_objects_t_delete(status, sets->array[i].objects); + if (F_status_is_error(status)) return status; + + f_macro_fss_contents_t_delete(status, sets->array[i].contents); + if (F_status_is_error(status)) return status; + } // for + } + + status = f_memory_resize((void **) & sets->array, sizeof(f_fss_set_t), sets->size, length); + + if (F_status_is_error_not(status)) { + sets->size = length; + + if (sets->used > sets->size) { + sets->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_delete_) || !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 new file mode 100644 index 0000000..dbf4c2b --- /dev/null +++ b/level_0/f_fss/c/private-fss.h @@ -0,0 +1,542 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgplv2.1 + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_fss_h +#define _PRIVATE_F_fss_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 item + * The item to adjust. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_macro_fss_nest_t_destroy(). + * + * @see f_macro_fss_nest_t_destroy() + * + * @see f_fss_item_adjust() + * @see f_fss_item_decimate_by() + * @see f_fss_item_destroy() + */ +#if !defined(_di_f_fss_item_adjust_) || !defined(_di_f_fss_item_decimate_by_) || !defined(_di_f_fss_item_destroy_) + extern f_status_t private_f_fss_item_adjust(const f_array_length_t length, f_fss_item_t *item) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_item_adjust_) || !defined(_di_f_fss_item_decimate_by_) || !defined(_di_f_fss_item_destroy_) + +/** + * Private implementation for resizing. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The new size to use. + * @param item + * The item to resize. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: private_f_fss_nest_delete(). + * + * @see private_f_fss_nest_delete() + * + * @see f_fss_item_decrease_by() + * @see f_fss_item_delete() + * @see f_fss_item_increase() + * @see f_fss_item_increase_by() + * @see f_fss_item_resize() + */ +#if !defined(_di_f_fss_item_decrease_by_) || !defined(_di_f_fss_item_delete_) || !defined(_di_f_fss_item_increase_) || !defined(_di_f_fss_item_increase_by_) || !defined(_di_f_fss_item_resize_) + extern f_status_t private_f_fss_item_resize(const f_array_length_t length, f_fss_item_t *item) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_item_decrease_by_) || !defined(_di_f_fss_item_delete_) || !defined(_di_f_fss_item_increase_) || !defined(_di_f_fss_item_increase_by_) || !defined(_di_f_fss_item_resize_) + +/** + * 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: f_macro_fss_nest_t_destroy(). + * + * @see f_macro_fss_nest_t_destroy() + * + * @see f_fss_items_adjust() + * @see f_fss_items_decimate_by() + * @see f_fss_items_destroy() + */ +#if !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) || !defined(_di_f_fss_items_destroy_) + extern f_status_t private_f_fss_items_adjust(const f_array_length_t length, f_fss_items_t *items) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) || !defined(_di_f_fss_items_destroy_) + +/** + * 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: private_f_fss_nest_delete(). + * + * @see private_f_fss_nest_delete() + * + * @see f_fss_items_decrease_by() + * @see f_fss_items_delete() + * @see f_fss_items_increase() + * @see f_fss_items_increase_by() + * @see f_fss_items_resize() + */ +#if !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_delete_) || !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_array_length_t length, f_fss_items_t *items) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_delete_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_) + +/** + * Private implementation for destroying. + * + * Intended to be shared to each of the different implementation variations. + * + * @param named + * The named to destroy. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_macro_string_ranges_t_destroy(). + * Errors (with error bit) from: f_macro_string_rangess_t_destroy(). + * Errors (with error bit) from: f_macro_uint8ss_t_destroy(). + * + * @see f_macro_string_ranges_t_destroy() + * @see f_macro_string_rangess_t_destroy() + * @see f_macro_uint8ss_t_destroy() + * + * @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_destroy(f_fss_named_t *named) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) + +/** + * Private implementation for deleting. + * + * Intended to be shared to each of the different implementation variations. + * + * @param named + * The named to delete. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_macro_string_ranges_t_delete(). + * Errors (with error bit) from: f_macro_string_rangess_t_delete(). + * Errors (with error bit) from: f_macro_uint8ss_t_delete(). + * + * @see f_macro_string_ranges_t_delete() + * @see f_macro_string_rangess_t_delete() + * @see f_macro_uint8ss_t_delete() + * + * @see f_fss_nameds_decrease_by() + * @see f_fss_nameds_resize() + */ +#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_resize_) + extern f_status_t private_f_fss_named_delete(f_fss_named_t *named) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_nameds_decrease_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_macro_fss_named_t_destroy(). + * + * @see f_macro_fss_named_t_destroy() + * + * @see f_fss_nameds_adjust() + * @see f_fss_nameds_decimate_by() + * @see f_fss_nameds_destroy() + */ +#if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) || !defined(_di_f_fss_nameds_destroy_) + extern f_status_t private_f_fss_nameds_adjust(const f_array_length_t length, f_fss_nameds_t *nameds) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) || !defined(_di_f_fss_nameds_destroy_) + +/** + * 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: private_f_fss_named_delete(). + * + * @see private_f_fss_named_delete() + * + * @see f_fss_nameds_decrease_by() + * @see f_fss_nameds_delete() + * @see f_fss_nameds_increase() + * @see f_fss_nameds_increase_by() + * @see f_fss_nameds_resize() + */ +#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_delete_) || !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_array_length_t length, f_fss_nameds_t *nameds) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_delete_) || !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_macro_fss_nest_t_destroy(). + * + * @see f_macro_fss_nest_t_destroy() + * + * @see f_fss_nest_adjust() + * @see f_fss_nest_decimate_by() + * @see f_fss_nest_destroy() + */ +#if !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) || !defined(_di_f_fss_nest_destroy_) + extern f_status_t private_f_fss_nest_adjust(const f_array_length_t length, f_fss_nest_t *nest) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) || !defined(_di_f_fss_nest_destroy_) + +/** + * 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: private_f_fss_nest_delete(). + * + * @see private_f_fss_nest_delete() + * + * @see f_fss_nest_decrease_by() + * @see f_fss_nest_delete() + * @see f_fss_nest_increase() + * @see f_fss_nest_increase_by() + * @see f_fss_nest_resize() + */ +#if !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_delete_) || !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_array_length_t length, f_fss_nest_t *nest) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_delete_) || !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_macro_fss_nest_t_destroy(). + * + * @see f_macro_fss_nest_t_destroy() + * + * @see f_fss_nests_adjust() + * @see f_fss_nests_decimate_by() + * @see f_fss_nests_destroy() + */ +#if !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) || !defined(_di_f_fss_nests_destroy_) + extern f_status_t private_f_fss_nests_adjust(const f_array_length_t length, f_fss_nests_t *nests) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) || !defined(_di_f_fss_nests_destroy_) + +/** + * 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: private_f_fss_nest_delete(). + * + * @see private_f_fss_nest_delete() + * + * @see f_fss_nests_decrease_by() + * @see f_fss_nests_delete() + * @see f_fss_nests_increase() + * @see f_fss_nests_increase_by() + * @see f_fss_nests_resize() + */ +#if !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_delete_) || !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_array_length_t length, f_fss_nests_t *nests) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_delete_) || !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: f_macro_fss_set_t_destroy(). + * + * @see f_macro_fss_set_t_destroy() + * + * @see f_fss_set_adjust() + * @see f_fss_set_decimate_by() + * @see f_fss_set_destroy() + */ +#if !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) || !defined(_di_f_fss_set_destroy_) + extern f_status_t private_f_fss_set_adjust(const f_array_length_t length, f_fss_set_t *set) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) || !defined(_di_f_fss_set_destroy_) + +/** + * 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: private_f_fss_set_delete(). + * + * @see private_f_fss_set_delete() + * + * @see f_fss_set_decrease_by() + * @see f_fss_set_delete() + * @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_delete_) || !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_array_length_t length, f_fss_set_t *set) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_delete_) || !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: f_macro_fss_set_quote_t_destroy(). + * + * @see f_macro_fss_set_quote_t_destroy() + * + * @see f_fss_set_quote_adjust() + * @see f_fss_set_quote_decimate_by() + * @see f_fss_set_quote_destroy() + */ +#if !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) || !defined(_di_f_fss_set_quote_destroy_) + extern f_status_t private_f_fss_set_quote_adjust(const f_array_length_t length, f_fss_set_quote_t *set_quote) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) || !defined(_di_f_fss_set_quote_destroy_) + +/** + * 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: private_f_fss_set_quote_delete(). + * + * @see private_f_fss_set_quote_delete() + * + * @see f_fss_set_quote_decrease_by() + * @see f_fss_set_quote_delete() + * @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_delete_) || !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_array_length_t length, f_fss_set_quote_t *set_quote) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_delete_) || !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: f_macro_fss_set_quote_t_destroy(). + * + * @see f_macro_fss_set_quote_t_destroy() + * + * @see f_fss_set_quotes_adjust() + * @see f_fss_set_quotes_decimate_by() + * @see f_fss_set_quotes_destroy() + */ +#if !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) || !defined(_di_f_fss_set_quotes_destroy_) + extern f_status_t private_f_fss_set_quotes_adjust(const f_array_length_t length, f_fss_set_quotes_t *set_quotes) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) || !defined(_di_f_fss_set_quotes_destroy_) + +/** + * 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: private_f_fss_set_quote_delete(). + * + * @see private_f_fss_set_quote_delete() + * + * @see f_fss_set_quotes_decrease_by() + * @see f_fss_set_quotes_delete() + * @see f_fss_set_quotes_increase() + * @see f_fss_set_quotes_increase_by() + * @see f_fss_set_quotes_resize() + */ +#if !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_delete_) || !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_array_length_t length, f_fss_set_quotes_t *set_quotes) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_delete_) || !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: f_macro_fss_set_t_destroy(). + * + * @see f_macro_fss_set_t_destroy() + * + * @see f_fss_sets_adjust() + * @see f_fss_sets_decimate_by() + * @see f_fss_sets_destroy() + */ +#if !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) || !defined(_di_f_fss_sets_destroy_) + extern f_status_t private_f_fss_sets_adjust(const f_array_length_t length, f_fss_sets_t *sets) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) || !defined(_di_f_fss_sets_destroy_) + +/** + * 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: private_f_fss_set_delete(). + * + * @see private_f_fss_set_delete() + * + * @see f_fss_sets_decrease_by() + * @see f_fss_sets_delete() + * @see f_fss_sets_increase() + * @see f_fss_sets_increase_by() + * @see f_fss_sets_resize() + */ +#if !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_delete_) || !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_array_length_t length, f_fss_sets_t *sets) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_delete_) || !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_h diff --git a/level_0/f_fss/data/build/settings b/level_0/f_fss/data/build/settings index 3234ba7d..13c9630 100644 --- a/level_0/f_fss/data/build/settings +++ b/level_0/f_fss/data/build/settings @@ -20,9 +20,9 @@ build_indexer ar build_language c build_libraries -lc build_libraries-individual -lf_memory -lf_string -lf_utf -build_sources_library fss.c +build_sources_library fss.c private-fss.c fss_named.c fss_nest.c fss_set.c build_sources_program -build_sources_headers fss.h fss-common.h fss_comment.h fss_delimit.h fss_named.h fss_nest.h fss_quote.h fss_set.h +build_sources_headers fss.h private-fss.h fss-common.h fss_comment.h fss_delimit.h fss_named.h fss_nest.h fss_quote.h fss_set.h build_sources_script build_sources_setting build_script yes diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index be0ae5e..553ac48 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -91,7 +91,7 @@ extern "C" { if (status == F_data_not_stop || status == F_data_not_eos) { // Objects cannot be empty, so write a quoted empty string. - const f_status_t status_allocation = private_fl_fss_destination_increase_by(2, destination); + const f_status_t status_allocation = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status_allocation)) { destination->used = destination_used; @@ -115,7 +115,7 @@ extern "C" { } } - status2 = private_fl_fss_destination_increase(destination); + status2 = f_string_dynamic_increase(destination); if (F_status_is_error(status2)) { destination->used = destination_used; @@ -150,7 +150,7 @@ extern "C" { // content should be terminated, even if empty. if (complete == f_fss_complete_full || complete == f_fss_complete_full_trim || complete == f_fss_complete_end) { - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) return status; destination->string[destination->used++] = f_fss_basic_close; @@ -164,7 +164,7 @@ extern "C" { } // ensure that there is room for the potential terminating newline. - status = private_fl_fss_destination_increase_by(destination->used + (range->stop - range->start) + 1, destination); + status = f_string_dynamic_increase_by(destination->used + (range->stop - range->start) + 1, destination); if (F_status_is_error(status)) return status; const f_string_length_t destination_used = destination->used; diff --git a/level_1/fl_fss/c/fss_basic_list.c b/level_1/fl_fss/c/fss_basic_list.c index 3a2d7d1..0d2b358 100644 --- a/level_1/fl_fss/c/fss_basic_list.c +++ b/level_1/fl_fss/c/fss_basic_list.c @@ -473,7 +473,7 @@ extern "C" { if (status == F_none_stop || status == F_none_eos) { if (complete == f_fss_complete_partial || complete == f_fss_complete_partial_trim || complete == f_fss_complete_full || complete == f_fss_complete_full_trim) { - const f_status_t status_allocation = private_fl_fss_destination_increase_by(2, destination); + const f_status_t status_allocation = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status_allocation)) return status_allocation; destination->string[destination->used++] = f_fss_basic_list_open; @@ -491,7 +491,7 @@ extern "C" { } // ensure that there is room for a slash delimit, the object open character, and the end of line character. - status = private_fl_fss_destination_increase_by(destination->used + (range->stop - range->start) + 3, destination); + status = f_string_dynamic_increase_by(destination->used + (range->stop - range->start) + 3, destination); if (F_status_is_error(status)) return status; const f_string_length_t input_start = range->start; @@ -510,7 +510,7 @@ extern "C" { if (object.string[range->start] == f_fss_comment) { // when a comment is found, escape it. - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_delimit_slash; @@ -535,7 +535,7 @@ extern "C" { if (status == F_true) { width = f_macro_utf_byte_width(object.string[range->start]); - status = private_fl_fss_destination_increase_by(width, destination); + status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; for (i = 0; i < width; i++) { @@ -577,7 +577,7 @@ extern "C" { slash_count *= 2; } - status = private_fl_fss_destination_increase_by(slash_count, destination); + status = f_string_dynamic_increase_by(slash_count, destination); if (F_status_is_error(status)) break; while (slash_count--) { @@ -597,7 +597,7 @@ extern "C" { width = f_macro_utf_byte_width(object.string[range->start]); - status = private_fl_fss_destination_increase_by(width, destination); + status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; for (i = 0; i < width; i++) { @@ -624,7 +624,7 @@ extern "C" { } } - status = private_fl_fss_destination_increase_by(2, destination); + status = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status)) { destination->used = used_start; @@ -662,7 +662,7 @@ extern "C" { if (status == F_none_stop || status == F_none_eos) { if (complete == f_fss_complete_full || complete == f_fss_complete_full_trim || complete == f_fss_complete_end) { - const f_status_t status_allocation = private_fl_fss_destination_increase(destination); + const f_status_t status_allocation = f_string_dynamic_increase(destination); if (F_status_is_error(status_allocation)) return status_allocation; destination->string[destination->used++] = f_fss_basic_list_close; @@ -676,7 +676,7 @@ extern "C" { } // ensure that there is room for a slash delimit and possibly the end of content character. - status = private_fl_fss_destination_increase_by(destination->used + (range->stop - range->start) + 2, destination); + status = f_string_dynamic_increase_by(destination->used + (range->stop - range->start) + 2, destination); if (F_status_is_error(status)) return status; const f_string_length_t input_start = range->start; @@ -725,7 +725,7 @@ extern "C" { if (content.string[range->start] == f_fss_eol || range->start >= content.used || range->start > range->stop) { // increase by total slashes + 1, along with the basic list open and possible newline. - status = private_fl_fss_destination_increase_by(slash_count + 3, destination); + status = f_string_dynamic_increase_by(slash_count + 3, destination); if (F_status_is_error(status)) break; while (slash_count--) { @@ -743,7 +743,7 @@ extern "C" { continue; } - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_basic_list_open; @@ -769,7 +769,7 @@ extern "C" { if (content.string[range->start] == f_fss_eol || range->start >= content.used || range->start > range->stop) { // increase by slash and basic list open and possible newline. - status = private_fl_fss_destination_increase_by(3, destination); + status = f_string_dynamic_increase_by(3, destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_delimit_slash; @@ -783,7 +783,7 @@ extern "C" { continue; } - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_basic_list_open; @@ -822,7 +822,7 @@ extern "C" { width = f_macro_utf_byte_width(content.string[range->start]); - status = private_fl_fss_destination_increase_by(width, destination); + status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; for (i = 0; i < width; i++) { @@ -840,7 +840,7 @@ extern "C" { } if (complete == f_fss_complete_full || complete == f_fss_complete_full_trim || complete == f_fss_complete_end) { - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) return status; // check to see if a newline exists, at the end. diff --git a/level_1/fl_fss/c/fss_embedded_list.c b/level_1/fl_fss/c/fss_embedded_list.c index 1342592..f0c96db 100644 --- a/level_1/fl_fss/c/fss_embedded_list.c +++ b/level_1/fl_fss/c/fss_embedded_list.c @@ -839,7 +839,7 @@ extern "C" { if (status == F_data_not_stop || status == F_data_not_eos) { if (complete == f_fss_complete_partial || complete == f_fss_complete_partial_trim || complete == f_fss_complete_full || complete == f_fss_complete_full_trim) { - const f_status_t status_allocation = private_fl_fss_destination_increase_by(2, destination); + const f_status_t status_allocation = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status_allocation)) return status_allocation; destination->string[destination->used++] = f_fss_embedded_list_open; @@ -853,7 +853,7 @@ extern "C" { } // ensure that there is room for a slash delimit, the object open character, and the end of line character. - status = private_fl_fss_destination_increase_by(destination->used + (range->stop - range->start) + 3, destination); + status = f_string_dynamic_increase_by(destination->used + (range->stop - range->start) + 3, destination); if (F_status_is_error(status)) return status; const f_string_length_t input_start = range->start; @@ -874,7 +874,7 @@ extern "C" { if (object.string[range->start] == f_fss_comment) { // when a comment is found, escape it. - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_delimit_slash; @@ -899,7 +899,7 @@ extern "C" { if (status == F_true) { width = f_macro_utf_byte_width(object.string[range->start]); - status = private_fl_fss_destination_increase_by(width, destination); + status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; for (i = 0; i < width; i++) { @@ -941,7 +941,7 @@ extern "C" { slash_count *= 2; } - status = private_fl_fss_destination_increase_by(slash_count, destination); + status = f_string_dynamic_increase_by(slash_count, destination); if (F_status_is_error(status)) break; while (slash_count--) { @@ -967,7 +967,7 @@ extern "C" { width = f_macro_utf_byte_width(object.string[range->start]); - status = private_fl_fss_destination_increase_by(width, destination); + status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; for (i = 0; i < width; i++) { @@ -997,7 +997,7 @@ extern "C" { ends_on_space = F_true; } - status = private_fl_fss_destination_increase_by(3, destination); + status = f_string_dynamic_increase_by(3, destination); if (F_status_is_error(status)) { destination->used = used_start; @@ -1046,7 +1046,7 @@ extern "C" { if (range->start > range->stop || range->start >= content.used) { if (complete == f_fss_complete_full || complete == f_fss_complete_full_trim || complete == f_fss_complete_end) { - const f_status_t status_allocation = private_fl_fss_destination_increase_by(2, destination); + const f_status_t status_allocation = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status_allocation)) return status_allocation; destination->string[destination->used++] = f_fss_embedded_list_close; @@ -1057,7 +1057,7 @@ extern "C" { } // ensure that there is room for a slash delimit and possibly the end of content characters. - status = private_fl_fss_destination_increase_by(destination->used + (range->stop - range->start) + 3, destination); + status = f_string_dynamic_increase_by(destination->used + (range->stop - range->start) + 3, destination); if (F_status_is_error(status)) return status; const f_string_length_t input_start = range->start; @@ -1111,7 +1111,7 @@ extern "C" { else if (content.string[range->start] == f_fss_eol || range->start >= content.used || range->start > range->stop) { // increase by total slashes + 1 embedded list open/close. - status = private_fl_fss_destination_increase_by(slash_count + 2, destination); + status = f_string_dynamic_increase_by(slash_count + 2, destination); if (F_status_is_error(status)) break; if (content.string[range->start] == f_fss_embedded_list_open) { @@ -1136,7 +1136,7 @@ extern "C" { } // increase by character at "start" and possible newline. - status = private_fl_fss_destination_increase_by(2, destination); + status = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = content.string[start]; @@ -1185,7 +1185,7 @@ extern "C" { } // for if (r < ignore->used) { - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = content.string[start]; @@ -1195,7 +1195,7 @@ extern "C" { } // increase by slash and extended list open and possible newline. - status = private_fl_fss_destination_increase_by(3, destination); + status = f_string_dynamic_increase_by(3, destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_delimit_slash; @@ -1209,7 +1209,7 @@ extern "C" { continue; } - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = content.string[start]; @@ -1248,7 +1248,7 @@ extern "C" { width = f_macro_utf_byte_width(content.string[range->start]); - status = private_fl_fss_destination_increase_by(width, destination); + status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; for (i = 0; i < width; i++) { @@ -1266,7 +1266,7 @@ extern "C" { } if (complete == f_fss_complete_full || complete == f_fss_complete_full_trim || complete == f_fss_complete_end) { - status = private_fl_fss_destination_increase_by(3, destination); + status = f_string_dynamic_increase_by(3, destination); if (F_status_is_error(status)) return status; if (!ends_on_eol) { diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index 640f0fa..5d59a86 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -153,7 +153,7 @@ f_status_t fl_fss_extended_object_write_string(const f_string_static_t object, c if (status == F_data_not_stop || status == F_data_not_eos) { // Objects cannot be empty, so write a quoted empty string. - const f_status_t status_allocation = private_fl_fss_destination_increase_by(2, destination); + const f_status_t status_allocation = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status_allocation)) return status_allocation; destination->string[destination->used++] = quote ? quote : f_fss_delimit_quote_double; @@ -169,7 +169,7 @@ f_status_t fl_fss_extended_object_write_string(const f_string_static_t object, c if (F_status_is_error(status2)) return status2; } - status2 = private_fl_fss_destination_increase(destination); + status2 = f_string_dynamic_increase(destination); if (F_status_is_error(status2)) return status2; destination->string[destination->used++] = f_fss_extended_open; @@ -193,7 +193,7 @@ f_status_t fl_fss_extended_object_write_string(const f_string_static_t object, c if (status == F_data_not_stop || status == F_data_not_eos) { // content that is empty must be represented by a quoted empty string. - const f_status_t status_allocation = private_fl_fss_destination_increase_by(4, destination); + const f_status_t status_allocation = f_string_dynamic_increase_by(4, destination); if (F_status_is_error(status_allocation)) return status_allocation; destination->string[destination->used++] = quote ? quote : f_fss_delimit_quote_double; @@ -216,7 +216,7 @@ f_status_t fl_fss_extended_object_write_string(const f_string_static_t object, c } if (F_status_is_error_not(status)) { - const f_status_t status_allocation = private_fl_fss_destination_increase_by(2, destination); + const f_status_t status_allocation = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status_allocation)) return status_allocation; if (complete == f_fss_complete_partial || complete == f_fss_complete_partial_trim || complete == f_fss_complete_full || complete == f_fss_complete_full_trim || complete == f_fss_complete_next) { diff --git a/level_1/fl_fss/c/fss_extended_list.c b/level_1/fl_fss/c/fss_extended_list.c index 731571a..7504737 100644 --- a/level_1/fl_fss/c/fss_extended_list.c +++ b/level_1/fl_fss/c/fss_extended_list.c @@ -431,7 +431,7 @@ extern "C" { if (status == F_data_not_stop || status == F_data_not_eos) { if (complete == f_fss_complete_partial || complete == f_fss_complete_partial_trim || complete == f_fss_complete_full || complete == f_fss_complete_full_trim) { - const f_status_t status_allocation = private_fl_fss_destination_increase_by(2, destination); + const f_status_t status_allocation = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status_allocation)) return status_allocation; destination->string[destination->used++] = f_fss_extended_list_open; @@ -445,7 +445,7 @@ extern "C" { } // ensure that there is room for a slash delimit, the object open character, and the end of line character. - status = private_fl_fss_destination_increase_by(destination->used + (range->stop - range->start) + 3, destination); + status = f_string_dynamic_increase_by(destination->used + (range->stop - range->start) + 3, destination); if (F_status_is_error(status)) return status; const f_string_length_t input_start = range->start; @@ -466,7 +466,7 @@ extern "C" { if (object.string[range->start] == f_fss_comment) { // when a comment is found, escape it. - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_delimit_slash; @@ -491,7 +491,7 @@ extern "C" { if (status == F_true) { width = f_macro_utf_byte_width(object.string[range->start]); - status = private_fl_fss_destination_increase_by(width, destination); + status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; for (i = 0; i < width; i++) { @@ -533,7 +533,7 @@ extern "C" { slash_count *= 2; } - status = private_fl_fss_destination_increase_by(slash_count, destination); + status = f_string_dynamic_increase_by(slash_count, destination); if (F_status_is_error(status)) break; while (slash_count--) { @@ -559,7 +559,7 @@ extern "C" { width = f_macro_utf_byte_width(object.string[range->start]); - status = private_fl_fss_destination_increase_by(width, destination); + status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; for (i = 0; i < width; i++) { @@ -589,7 +589,7 @@ extern "C" { ends_on_space = F_true; } - status = private_fl_fss_destination_increase_by(3, destination); + status = f_string_dynamic_increase_by(3, destination); if (F_status_is_error(status)) { destination->used = used_start; @@ -638,7 +638,7 @@ extern "C" { if (range->start > range->stop || range->start >= content.used) { if (complete == f_fss_complete_full || complete == f_fss_complete_full_trim || complete == f_fss_complete_end) { - const f_status_t status_allocation = private_fl_fss_destination_increase_by(2, destination); + const f_status_t status_allocation = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status_allocation)) return status_allocation; destination->string[destination->used++] = f_fss_extended_list_close; @@ -649,7 +649,7 @@ extern "C" { } // ensure that there is room for a slash delimit and possibly the end of content characters. - status = private_fl_fss_destination_increase_by(destination->used + (range->stop - range->start) + 3, destination); + status = f_string_dynamic_increase_by(destination->used + (range->stop - range->start) + 3, destination); if (F_status_is_error(status)) return status; const f_string_length_t input_start = range->start; @@ -703,7 +703,7 @@ extern "C" { else if (content.string[range->start] == f_fss_eol || range->start >= content.used || range->start > range->stop) { // increase by total slashes + 1 and extended list close. - status = private_fl_fss_destination_increase_by(2, destination); + status = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_delimit_slash; @@ -722,7 +722,7 @@ extern "C" { } // increase by character at "start" and possible newline. - status = private_fl_fss_destination_increase_by(2, destination); + status = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = content.string[start]; @@ -771,7 +771,7 @@ extern "C" { } // for if (r < ignore->used) { - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = content.string[start]; @@ -781,7 +781,7 @@ extern "C" { } // increase by slash and extended list close. - status = private_fl_fss_destination_increase_by(2, destination); + status = f_string_dynamic_increase_by(2, destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_delimit_slash; @@ -795,7 +795,7 @@ extern "C" { continue; } - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = content.string[start]; @@ -834,7 +834,7 @@ extern "C" { width = f_macro_utf_byte_width(content.string[range->start]); - status = private_fl_fss_destination_increase_by(width, destination); + status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; for (i = 0; i < width; i++) { @@ -852,7 +852,7 @@ extern "C" { } if (complete == f_fss_complete_full || complete == f_fss_complete_full_trim || complete == f_fss_complete_end) { - status = private_fl_fss_destination_increase_by(3, destination); + status = f_string_dynamic_increase_by(3, destination); if (F_status_is_error(status)) return status; if (!ends_on_eol) { diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index bc71c0c..6e36f41 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" { if (buffer.string[range->start] == f_fss_delimit_placeholder) continue; if (buffer.string[range->start] == f_fss_eol) break; - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = buffer.string[range->start]; @@ -677,7 +677,7 @@ extern "C" { } // ensure that there is room for the potential start and stop quotes, a potential delimit at start, and the potential object open character. - status = private_fl_fss_destination_increase_by(destination->used + (range->stop - range->start) + 4, destination); + status = f_string_dynamic_increase_by(destination->used + (range->stop - range->start) + 4, destination); if (F_status_is_error(status)) return status; const f_string_length_t input_start = range->start; @@ -728,13 +728,13 @@ extern "C" { // if this is the first quote, then only a single delimit slash is needed. if (item_first == input_start) { - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_delimit_slash; } else { - status = private_fl_fss_destination_increase_by(item_total, destination); + status = f_string_dynamic_increase_by(item_total, destination); if (F_status_is_error(status)) break; for (i = 0; i < item_total; i++) { @@ -743,7 +743,7 @@ extern "C" { } } - status = private_fl_fss_destination_increase_by(item_total, destination); + status = f_string_dynamic_increase_by(item_total, destination); if (F_status_is_error(status)) break; for (i = 0; i < item_total; i++) { @@ -766,7 +766,7 @@ extern "C" { if (range->start > range->stop || range->start >= object.used) { - status = private_fl_fss_destination_increase_by(item_total + 1, destination); + status = f_string_dynamic_increase_by(item_total + 1, destination); if (F_status_is_error(status)) break; for (i = 0; i < item_total; i++) { @@ -785,18 +785,18 @@ extern "C" { if (status == F_true) { quoted = F_true; - status = private_fl_fss_destination_increase_by(item_total, destination); + status = f_string_dynamic_increase_by(item_total, destination); if (F_status_is_error(status)) break; // add the slashes that delimit the slashes. if (item_first == input_start) { - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_delimit_slash; } else { - status = private_fl_fss_destination_increase_by(item_total, destination); + status = f_string_dynamic_increase_by(item_total, destination); if (F_status_is_error(status)) break; for (i = 0; i < item_total; i++) { @@ -807,7 +807,7 @@ extern "C" { width = f_macro_utf_byte_width(object.string[range->start]); - status = private_fl_fss_destination_increase_by(item_total + width + 1, destination); + status = f_string_dynamic_increase_by(item_total + width + 1, destination); if (F_status_is_error(status)) break; for (i = 0; i < item_total; i++) { @@ -827,7 +827,7 @@ extern "C" { commented = F_true; } - status = private_fl_fss_destination_increase_by(item_total + 1, destination); + status = f_string_dynamic_increase_by(item_total + 1, destination); if (F_status_is_error(status)) break; for (i = 0; i < item_total; i++) { @@ -850,7 +850,7 @@ extern "C" { width = f_macro_utf_byte_width(object.string[range->start]); - status = private_fl_fss_destination_increase_by(item_total + width, destination); + status = f_string_dynamic_increase_by(item_total + width, destination); if (F_status_is_error(status)) break; // there is nothing to delimit, so all slashes should be printed as is. @@ -858,7 +858,7 @@ extern "C" { destination->string[destination->used++] = f_fss_delimit_slash; } // for - status = private_fl_fss_destination_increase_by(width, destination); + status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; for (i = 0; i < width; i++) { @@ -871,7 +871,7 @@ extern "C" { // the very first quote, must be escaped, when quoting is disabled. if (item_first == input_start) { - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[used_start + 1] = f_fss_delimit_slash; @@ -882,7 +882,7 @@ extern "C" { if (range->start > range->stop || range->start >= object.used) { - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = quote; @@ -890,7 +890,7 @@ extern "C" { } if (object.string[range->start] == quote) { - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = quote; @@ -905,7 +905,7 @@ extern "C" { if (status == F_true) { if (item_first != input_start) { - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = f_fss_delimit_slash; @@ -916,7 +916,7 @@ extern "C" { width = f_macro_utf_byte_width(object.string[range->start]); - status = private_fl_fss_destination_increase_by(1 + width, destination); + status = f_string_dynamic_increase_by(1 + width, destination); if (F_status_is_error(status)) break; destination->string[destination->used++] = quote; @@ -941,7 +941,7 @@ extern "C" { width = f_macro_utf_byte_width(object.string[range->start]); - status = private_fl_fss_destination_increase_by(width, destination); + status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; for (i = 0; i < width; i++) { @@ -959,7 +959,7 @@ extern "C" { } if (quoted) { - status = private_fl_fss_destination_increase(destination); + status = f_string_dynamic_increase(destination); if (F_status_is_error(status)) { destination->used = used_start; @@ -1007,50 +1007,6 @@ extern "C" { } #endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) -#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_) - f_status_t private_fl_fss_destination_increase(f_string_dynamic_t *destination) { - - if (destination->used + 1 > destination->size) { - f_array_length_t size = destination->used + f_fss_default_allocation_step; - - if (size > f_string_length_t_size) { - if (destination->used + 1 > f_string_length_t_size) { - return F_status_set_error(F_string_too_large); - } - - size = f_string_length_t_size; - } - - f_status_t status = F_none; - - f_macro_string_dynamic_t_resize(status, (*destination), size); - - return status; - } - - return F_none; - } -#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_) - -#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_) - f_status_t private_fl_fss_destination_increase_by(const f_string_length_t amount, f_string_dynamic_t *destination) { - - if (destination->used + amount > destination->size) { - if (destination->used + amount > f_string_length_t_size) { - return F_status_set_error(F_string_too_large); - } - - f_status_t status = F_none; - - f_macro_string_dynamic_t_resize(status, (*destination), destination->used + amount); - - return status; - } - - return F_none; - } -#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_) - #if !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) f_status_t private_fl_fss_destination_prepend(const f_string_static_t *prepend, f_string_dynamic_t *destination) { @@ -1058,8 +1014,10 @@ extern "C" { return F_none; } - f_status_t status = private_fl_fss_destination_increase_by(prepend->used, destination); - if (F_status_is_error(status)) return status; + { + const f_status_t status = f_string_dynamic_increase_by(prepend->used, destination); + if (F_status_is_error(status)) return status; + } for (f_string_length_t i = 0; i < prepend->used; i++) { destination->string[destination->used++] = prepend->string[i]; diff --git a/level_1/fl_fss/c/private-fss.h b/level_1/fl_fss/c/private-fss.h index 6a2cbd3..8fae830 100644 --- a/level_1/fl_fss/c/private-fss.h +++ b/level_1/fl_fss/c/private-fss.h @@ -51,12 +51,12 @@ extern "C" { * @return * F_none on success. * - * Errors (with error bit) from: private_fl_fss_destination_increase(). + * Errors (with error bit) from: f_string_dynamic_increase(). * * @see fl_fss_basic_list_content_write_string() * @see fl_fss_embedded_list_content_write_string() * @see fl_fss_extended_list_content_write_string() - * @see private_fl_fss_destination_increase() + * @see f_string_dynamic_increase() */ #if !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_content_write_string_) extern f_status_t private_fl_fss_basic_list_write_add_until_end(const f_string_static_t buffer, f_string_range_t *range, f_string_dynamic_t *destination) f_gcc_attribute_visibility_internal; @@ -188,60 +188,6 @@ extern "C" { #endif // !defined(fl_fss_basic_object_write_string) || !defined(fl_fss_extended_object_write_string) || !defined(_di_fl_fss_extended_content_write_string_) /** - * Increase the size of destination buffer, but only if necessary. - * - * @param destination - * The destination buffer to increment. - * - * @return - * F_none on success. - * F_memory_not (with error bit) on out of memory. - * F_string_too_large (with error bit) if new length is larger than max string length. - * - * @see fl_fss_basic_content_write_string() - * @see fl_fss_basic_object_write_string() - * @see fl_fss_basic_list_content_write_string() - * @see fl_fss_basic_list_object_write_string() - * @see fl_fss_embedded_list_content_read() - * @see fl_fss_embedded_list_object_read() - * @see fl_fss_extended_content_write_string() - * @see fl_fss_extended_list_content_write_string() - * @see fl_fss_extended_list_object_write_string() - * @see fl_fss_extended_object_write_string() - */ -#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_) - extern f_status_t private_fl_fss_destination_increase(f_string_dynamic_t *destination) f_gcc_attribute_visibility_internal; -#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_) - -/** - * Increase the size of destination buffer by the given amount, but only if necessary. - * - * @param amount - * The amount to increase by. - * @param destination - * The destination buffer to increment. - * - * @return - * F_none on success. - * F_memory_not (with error bit) on out of memory. - * F_string_too_large (with error bit) if new length is larger than max string length. - * - * @see fl_fss_basic_content_write_string() - * @see fl_fss_basic_object_write_string() - * @see fl_fss_basic_list_content_write_string() - * @see fl_fss_basic_list_object_write_string() - * @see fl_fss_embedded_list_content_read() - * @see fl_fss_embedded_list_object_read() - * @see fl_fss_extended_content_write_string() - * @see fl_fss_extended_list_content_write_string() - * @see fl_fss_extended_list_object_write_string() - * @see fl_fss_extended_object_write_string() - */ -#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_) - extern f_status_t private_fl_fss_destination_increase_by(const f_string_length_t amount, f_string_dynamic_t *destination) f_gcc_attribute_visibility_internal; -#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_) - -/** * Prepend the given string onto the destination buffer, allocating space as necessary. * * @param prepend -- 1.8.3.1