From: Kevin Day Date: Tue, 15 Feb 2022 00:57:42 +0000 (-0600) Subject: Refactor: Break f_type_array apart into multiple files. X-Git-Tag: 0.5.8~52 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=69fddc4cda62a3550407411d354a9d1098c79825;p=fll Refactor: Break f_type_array apart into multiple files. This cleans up the structure to make the code more manageable. --- diff --git a/build/level_0/settings b/build/level_0/settings index ef3d170..9457746 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -31,7 +31,29 @@ build_objects_library_static build_objects_program build_objects_program_shared build_objects_program_static -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 conversion-common.c private-conversion.c directory.c private-directory.c environment.c private-environment.c execute.c file.c file-common.c private-file.c fss.c private-fss.c fss-common.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 print_to.c print-common.c private-print.c private-print_to.c serialize.c serialize-common.c private-serialize.c signal.c socket.c status_string.c string.c string-common.c private-string.c string_dynamic.c string_map.c string_quantity.c string_range.c string_triple.c type_array.c private-type_array.c utf.c utf-common.c utf_dynamic.c utf_map.c utf_string.c utf_triple.c private-utf.c private-utf-is_unassigned.c private-utf_string.c +build_sources_library account.c private-account.c +build_sources_library capability.c +build_sources_library color.c color-common.c +build_sources_library console.c console-common.c +build_sources_library control_group.c control_group-common.c +build_sources_library conversion.c conversion-common.c private-conversion.c +build_sources_library directory.c private-directory.c +build_sources_library environment.c private-environment.c +build_sources_library execute.c +build_sources_library file.c file-common.c private-file.c +build_sources_library fss.c private-fss.c fss-common.c fss_named.c fss_nest.c fss_set.c +build_sources_library iki.c iki-common.c private-iki.c +build_sources_library limit.c +build_sources_library memory.c memory_structure.c private-memory.c +build_sources_library path.c path-common.c private-path.c +build_sources_library pipe.c print.c print_to.c print-common.c private-print.c private-print_to.c +build_sources_library serialize.c serialize-common.c private-serialize.c +build_sources_library signal.c +build_sources_library socket.c +build_sources_library status_string.c string.c string-common.c private-string.c string_dynamic.c string_map.c string_quantity.c string_range.c string_triple.c +build_sources_library type_array/array_length.c type_array/cell.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/state.c type_array/status.c +build_sources_library type_array/private-array_length.c type_array/private-cell.c type_array/private-fll_id.c type_array/private-int8.c type_array/private-int16.c type_array/private-int32.c type_array/private-int64.c type_array/private-int128.c type_array/private-state.c type_array/private-status.c +build_sources_library utf.c utf-common.c utf_dynamic.c utf_map.c utf_string.c utf_triple.c private-utf.c private-utf-is_unassigned.c private-utf_string.c build_sources_library-level thread.c private-thread.c build_sources_library_shared build_sources_library_static @@ -41,7 +63,32 @@ build_sources_object_static build_sources_program build_sources_program_shared build_sources_program_static -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 print_to.h print-common.h serialize.h serialize-common.h signal.h signal-common.h socket.h socket-common.h status.h status_string.h string.h string-common.h string_dynamic.h string_map.h string_quantity.h string_range.h string_triple.h type.h type_array.h type_array-common.h utf.h utf-common.h utf_dynamic.h utf_map.h utf_string.h utf_triple.h +build_sources_headers account.h account-common.h +build_sources_headers capability.h capability-common.h +build_sources_headers color.h color-common.h +build_sources_headers console.h console-common.h +build_sources_headers control_group.h control_group-common.h +build_sources_headers conversion.h conversion-common.h +build_sources_headers directory.h directory_type.h directory-common.h +build_sources_headers environment.h environment-common.h +build_sources_headers execute.h execute-common.h +build_sources_headers file.h file-common.h +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 iki.h iki-common.h +build_sources_headers limit.h limit-common.h +build_sources_headers memory.h memory_structure.h memory-common.h +build_sources_headers path.h path-common.h +build_sources_headers pipe.h +build_sources_headers print.h print_to.h print-common.h +build_sources_headers serialize.h serialize-common.h +build_sources_headers signal.h signal-common.h +build_sources_headers socket.h socket-common.h +build_sources_headers status.h status_string.h +build_sources_headers string.h string-common.h string_dynamic.h string_map.h string_quantity.h string_range.h string_triple.h +build_sources_headers type.h +build_sources_headers type_array.h type_array-common.h +build_sources_headers type_array/array_length.h type_array/cell.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/state.h type_array/status.h +build_sources_headers utf.h utf-common.h utf_dynamic.h utf_map.h utf_string.h utf_triple.h build_sources_headers-level thread.h thread-common.h build_sources_headers_shared build_sources_headers_static @@ -65,7 +112,7 @@ path_sources path_sources_object has_path_standard yes -preserve_path_headers no +preserve_path_headers yes search_exclusive yes search_shared yes diff --git a/build/level_1/settings b/build/level_1/settings index f646521..0b83f52 100644 --- a/build/level_1/settings +++ b/build/level_1/settings @@ -31,7 +31,17 @@ build_objects_library_static build_objects_program build_objects_program_shared build_objects_program_static -build_sources_library control_group.c conversion.c private-conversion.c directory.c private-directory.c environment.c private-fss.c fss_basic.c fss_basic_list.c fss_embedded_list.c fss_extended.c fss_extended_list.c iki.c print.c print-common.c private-print.c signal.c string.c private-string.c utf.c private-utf.c utf_file.c private-utf_file.c +build_sources_library control_group.c +build_sources_library conversion.c private-conversion.c +build_sources_library directory.c private-directory.c +build_sources_library environment.c +build_sources_library private-fss.c fss_basic.c fss_basic_list.c fss_embedded_list.c fss_extended.c fss_extended_list.c +build_sources_library iki.c +build_sources_library print.c print-common.c private-print.c +build_sources_library signal.c +build_sources_library string.c +build_sources_library private-string.c +build_sources_library utf.c private-utf.c utf_file.c private-utf_file.c build_sources_library-level build_sources_library_shared build_sources_library_static @@ -41,7 +51,17 @@ build_sources_object_static build_sources_program build_sources_program_shared build_sources_program_static -build_sources_headers control_group.h conversion.h directory.h directory-common.h environment.h execute.h execute-common.h fss.h fss_basic.h fss_basic_list.h fss_embedded_list.h fss_extended.h fss_extended_list.h iki.h print.h print-common.h signal.h signal-common.h string.h utf.h utf_file.h +build_sources_headers control_group.h +build_sources_headers conversion.h +build_sources_headers directory.h directory-common.h +build_sources_headers environment.h +build_sources_headers execute.h execute-common.h +build_sources_headers fss.h fss_basic.h fss_basic_list.h fss_embedded_list.h fss_extended.h fss_extended_list.h +build_sources_headers iki.h +build_sources_headers print.h print-common.h +build_sources_headers signal.h signal-common.h +build_sources_headers string.h +build_sources_headers utf.h utf_file.h build_sources_headers-level build_sources_headers_shared build_sources_headers_static @@ -65,7 +85,7 @@ path_sources path_sources_object has_path_standard yes -preserve_path_headers no +preserve_path_headers yes search_exclusive yes search_shared yes diff --git a/build/level_2/settings b/build/level_2/settings index ddc28e6..15f8b26 100644 --- a/build/level_2/settings +++ b/build/level_2/settings @@ -31,7 +31,17 @@ build_objects_library_static build_objects_program build_objects_program_shared build_objects_program_static -build_sources_library control_group.c error.c error-common.c private-error.c execute.c private-execute.c file.c private-file.c fss.c private-fss.c fss_basic.c fss_basic_list.c fss_embedded_list.c fss_extended.c fss_extended_list.c fss_payload.c fss_status_string.c iki.c private-iki.c path.c print.c program.c program-common.c status_string.c +build_sources_library control_group.c +build_sources_library error.c error-common.c private-error.c +build_sources_library execute.c private-execute.c +build_sources_library file.c private-file.c +build_sources_library fss.c private-fss.c fss_basic.c fss_basic_list.c fss_embedded_list.c fss_extended.c fss_extended_list.c fss_payload.c +build_sources_library fss_status_string.c +build_sources_library iki.c private-iki.c +build_sources_library path.c +build_sources_library print.c +build_sources_library program.c program-common.c +build_sources_library status_string.c build_sources_library-level build_sources_library_shared build_sources_library_static @@ -41,7 +51,17 @@ build_sources_object_static build_sources_program build_sources_program_shared build_sources_program_static -build_sources_headers control_group.h error.h error-common.h execute.h file.h fss.h fss_basic.h fss_basic_list.h fss_embedded_list.h fss_extended.h fss_extended_list.h fss_payload.h fss_status_string.h iki.h path.h print.h program.h program-common.h status_string.h +build_sources_headers control_group.h +build_sources_headers error.h error-common.h +build_sources_headers execute.h +build_sources_headers file.h +build_sources_headers fss.h fss_basic.h fss_basic_list.h fss_embedded_list.h fss_extended.h fss_extended_list.h fss_payload.h +build_sources_headers fss_status_string.h +build_sources_headers iki.h +build_sources_headers path.h +build_sources_headers print.h +build_sources_headers program.h program-common.h +build_sources_headers status_string.h build_sources_headers-level build_sources_headers_shared build_sources_headers_static @@ -65,7 +85,7 @@ path_sources path_sources_object has_path_standard yes -preserve_path_headers no +preserve_path_headers yes search_exclusive yes search_shared yes diff --git a/build/monolithic/settings b/build/monolithic/settings index 2d2b283..217b36e 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -31,7 +31,45 @@ build_objects_library_static build_objects_program build_objects_program_shared build_objects_program_static -build_sources_library level_0/account.c level_0/private-account.c level_0/capability.c level_0/color.c level_0/color-common.c level_0/console.c level_0/console-common.c level_0/control_group.c level_0/control_group-common.c level_0/conversion.c level_0/conversion-common.c level_0/private-conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/execute.c level_0/file.c level_0/file-common.c level_0/private-file.c level_0/fss.c level_0/private-fss.c level_0/fss-common.c level_0/fss_named.c level_0/fss_nest.c level_0/fss_set.c level_0/iki.c level_0/iki-common.c level_0/private-iki.c level_0/limit.c level_0/memory.c level_0/memory_structure.c level_0/private-memory.c level_0/path.c level_0/path-common.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/print_to.c level_0/print-common.c level_0/private-print.c level_0/private-print_to.c level_0/serialize.c level_0/serialize-common.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/status_string.c level_0/string.c level_0/string-common.c level_0/private-string.c level_0/string_dynamic.c level_0/string_map.c level_0/string_quantity.c level_0/string_range.c level_0/string_triple.c level_0/type_array.c level_0/private-type_array.c level_0/utf.c level_0/utf-common.c level_0/utf_dynamic.c level_0/utf_map.c level_0/utf_string.c level_0/utf_triple.c level_0/private-utf.c level_0/private-utf-is_unassigned.c level_0/private-utf_string.c level_1/control_group.c level_1/conversion.c level_1/private-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/print-common.c level_1/private-print.c level_1/signal.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/control_group.c level_2/error.c level_2/error-common.c level_2/private-error.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_embedded_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_payload.c level_2/fss_status_string.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/print.c level_2/program.c level_2/program-common.c level_2/status_string.c +build_sources_library level_0/account.c level_0/private-account.c +build_sources_library level_0/capability.c +build_sources_library level_0/color.c level_0/color-common.c +build_sources_library level_0/console.c level_0/console-common.c +build_sources_library level_0/control_group.c level_0/control_group-common.c +build_sources_library level_0/conversion.c level_0/conversion-common.c level_0/private-conversion.c +build_sources_library level_0/directory.c level_0/private-directory.c +build_sources_library level_0/environment.c level_0/private-environment.c +build_sources_library level_0/execute.c level_0/file.c level_0/file-common.c level_0/private-file.c +build_sources_library level_0/fss.c level_0/private-fss.c level_0/fss-common.c level_0/fss_named.c level_0/fss_nest.c level_0/fss_set.c +build_sources_library level_0/iki.c level_0/iki-common.c level_0/private-iki.c +build_sources_library level_0/limit.c +build_sources_library level_0/memory.c level_0/memory_structure.c level_0/private-memory.c +build_sources_library level_0/path.c level_0/path-common.c level_0/private-path.c +build_sources_library level_0/pipe.c +build_sources_library level_0/print.c level_0/print_to.c level_0/print-common.c level_0/private-print.c level_0/private-print_to.c +build_sources_library level_0/serialize.c level_0/serialize-common.c level_0/private-serialize.c +build_sources_library level_0/signal.c +build_sources_library level_0/socket.c +build_sources_library level_0/status_string.c level_0/string.c level_0/string-common.c level_0/private-string.c level_0/string_dynamic.c level_0/string_map.c level_0/string_quantity.c level_0/string_range.c level_0/string_triple.c +build_sources_library level_0/type_array/array_length.c level_0/type_array/cell.c level_0/type_array/fll_id.c level_0/type_array/int8.c level_0/type_array/int16.c level_0/type_array/int32.c level_0/type_array/int64.c level_0/type_array/int128.c level_0/type_array/state.c level_0/type_array/status.c +build_sources_library level_0/type_array/private-array_length.c level_0/type_array/private-cell.c level_0/type_array/private-fll_id.c level_0/type_array/private-int8.c level_0/type_array/private-int16.c level_0/type_array/private-int32.c level_0/type_array/private-int64.c level_0/type_array/private-int128.c level_0/type_array/private-state.c level_0/type_array/private-status.c +build_sources_library level_0/utf.c level_0/utf-common.c level_0/utf_dynamic.c level_0/utf_map.c level_0/utf_string.c level_0/utf_triple.c level_0/private-utf.c level_0/private-utf-is_unassigned.c level_0/private-utf_string.c +build_sources_library level_1/control_group.c level_1/conversion.c level_1/private-conversion.c +build_sources_library level_1/directory.c level_1/private-directory.c +build_sources_library level_1/environment.c +build_sources_library 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 +build_sources_library level_1/iki.c +build_sources_library level_1/print.c level_1/print-common.c level_1/private-print.c level_1/signal.c level_1/string.c level_1/private-string.c +build_sources_library level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c +build_sources_library level_2/control_group.c +build_sources_library level_2/error.c level_2/error-common.c level_2/private-error.c +build_sources_library level_2/execute.c level_2/private-execute.c +build_sources_library level_2/file.c level_2/private-file.c +build_sources_library level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_embedded_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_payload.c level_2/fss_status_string.c +build_sources_library level_2/iki.c level_2/private-iki.c +build_sources_library level_2/path.c level_2/print.c +build_sources_library level_2/program.c level_2/program-common.c +build_sources_library level_2/status_string.c build_sources_library-monolithic level_0/thread.c level_0/private-thread.c build_sources_library_shared build_sources_library_static @@ -41,7 +79,53 @@ build_sources_object_static build_sources_program build_sources_program_shared build_sources_program_static -build_sources_headers level_0/account.h level_0/account-common.h level_0/capability.h level_0/capability-common.h level_0/color.h level_0/color-common.h level_0/console.h level_0/console-common.h level_0/control_group.h level_0/control_group-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/execute.h level_0/execute-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/fss-common.h level_0/fss_comment.h level_0/fss_delimit.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quote.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/limit.h level_0/limit-common.h level_0/memory.h level_0/memory_structure.h level_0/memory-common.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/print_to.h level_0/print-common.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/status_string.h level_0/string.h level_0/string-common.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/string_triple.h level_0/type.h level_0/type_array.h level_0/type_array-common.h level_0/utf.h level_0/utf-common.h level_0/utf_dynamic.h level_0/utf_map.h level_0/utf_string.h level_0/utf_triple.h level_1/control_group.h level_1/conversion.h level_1/directory.h level_1/directory-common.h level_1/environment.h level_1/execute.h level_1/execute-common.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_embedded_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/iki.h level_1/print.h level_1/print-common.h level_1/signal.h level_1/signal-common.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/control_group.h level_2/error.h level_2/error-common.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_embedded_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_payload.h level_2/fss_status_string.h level_2/iki.h level_2/path.h level_2/print.h level_2/program.h level_2/program-common.h level_2/status_string.h +build_sources_headers level_0/account.h level_0/account-common.h +build_sources_headers level_0/capability.h level_0/capability-common.h +build_sources_headers level_0/color.h level_0/color-common.h +build_sources_headers level_0/console.h level_0/console-common.h +build_sources_headers level_0/control_group.h level_0/control_group-common.h +build_sources_headers level_0/conversion.h level_0/conversion-common.h +build_sources_headers level_0/directory.h level_0/directory_type.h level_0/directory-common.h +build_sources_headers level_0/environment.h level_0/environment-common.h +build_sources_headers level_0/execute.h level_0/execute-common.h +build_sources_headers level_0/file.h level_0/file-common.h +build_sources_headers 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 +build_sources_headers level_0/iki.h level_0/iki-common.h +build_sources_headers level_0/limit.h level_0/limit-common.h +build_sources_headers level_0/memory.h level_0/memory_structure.h level_0/memory-common.h +build_sources_headers level_0/path.h level_0/path-common.h +build_sources_headers level_0/pipe.h +build_sources_headers level_0/print.h level_0/print_to.h level_0/print-common.h +build_sources_headers level_0/serialize.h level_0/serialize-common.h +build_sources_headers level_0/signal.h level_0/signal-common.h +build_sources_headers level_0/socket.h level_0/socket-common.h +build_sources_headers level_0/status.h level_0/status_string.h +build_sources_headers level_0/string.h level_0/string-common.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/string_triple.h +build_sources_headers level_0/type.h +build_sources_headers level_0/type_array.h level_0/type_array-common.h +build_sources_headers level_0/type_array/array_length.h level_0/type_array/cell.h level_0/type_array/fll_id.h level_0/type_array/int8.h level_0/type_array/int16.h level_0/type_array/int32.h level_0/type_array/int64.h level_0/type_array/int128.h level_0/type_array/state.h level_0/type_array/status.h +build_sources_headers level_0/utf.h level_0/utf-common.h level_0/utf_dynamic.h level_0/utf_map.h level_0/utf_string.h level_0/utf_triple.h +build_sources_headers level_1/control_group.h +build_sources_headers level_1/conversion.h +build_sources_headers level_1/directory.h level_1/directory-common.h +build_sources_headers level_1/environment.h +build_sources_headers level_1/execute.h level_1/execute-common.h +build_sources_headers 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 +build_sources_headers level_1/iki.h +build_sources_headers level_1/print.h level_1/print-common.h +build_sources_headers level_1/signal.h level_1/signal-common.h +build_sources_headers level_1/string.h +build_sources_headers level_1/utf.h level_1/utf_file.h +build_sources_headers level_2/control_group.h +build_sources_headers level_2/error.h level_2/error-common.h +build_sources_headers level_2/execute.h +build_sources_headers level_2/file.h +build_sources_headers level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_embedded_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_payload.h level_2/fss_status_string.h +build_sources_headers level_2/iki.h +build_sources_headers level_2/path.h +build_sources_headers level_2/print.h +build_sources_headers level_2/program.h level_2/program-common.h +build_sources_headers level_2/status_string.h build_sources_headers-monolithic level_0/thread.h level_0/thread-common.h build_sources_headers_shared build_sources_headers_static diff --git a/level_0/f_type_array/c/private-type_array.c b/level_0/f_type_array/c/private-type_array.c deleted file mode 100644 index 8205a11..0000000 --- a/level_0/f_type_array/c/private-type_array.c +++ /dev/null @@ -1,1630 +0,0 @@ -#include "type_array.h" -#include "private-type_array.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_type_statuss_adjust_) || !defined(_di_f_type_statuss_decimate_by_) - f_status_t private_f_type_statuss_adjust(const f_array_length_t length, f_statuss_t *statuss) { - - const f_status_t status = f_memory_adjust(statuss->size, length, sizeof(f_status_t), (void **) & statuss->array); - - if (F_status_is_error_not(status)) { - statuss->size = length; - - if (statuss->used > statuss->size) { - statuss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_statuss_adjust_) || !defined(_di_f_type_statuss_decimate_by_) - -#if !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statusss_append_) - extern f_status_t private_f_type_statuss_append(const f_statuss_t source, f_statuss_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_statuss_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statusss_append_) - -#if !defined(_di_f_type_statuss_resize_) || !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statuss_decimate_by_) || !defined(_di_f_type_statusss_append_) - f_status_t private_f_type_statuss_resize(const f_array_length_t length, f_statuss_t *statuss) { - - const f_status_t status = f_memory_resize(statuss->size, length, sizeof(f_status_t), (void **) & statuss->array); - - if (F_status_is_error_not(status)) { - statuss->size = length; - - if (statuss->used > statuss->size) { - statuss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_statuss_resize_) || !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statuss_decimate_by_) || !defined(_di_f_type_statusss_append_) - -#if !defined(_di_f_type_statusss_adjust_) || !defined(_di_f_type_statusss_decimate_by_) - f_status_t private_f_type_statusss_adjust(const f_array_length_t length, f_statusss_t *statusss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < statusss->size; ++i) { - - status = f_memory_destroy(statusss->array[i].size, sizeof(f_statuss_t), (void **) & statusss->array[i].array); - if (F_status_is_error(status)) return status; - - statusss->array[i].size = 0; - statusss->array[i].used = 0; - } // for - - status = f_memory_adjust(statusss->size, length, sizeof(f_statuss_t), (void **) & statusss->array); - - if (F_status_is_error_not(status)) { - statusss->size = length; - - if (statusss->used > statusss->size) { - statusss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_statusss_adjust_) || !defined(_di_f_type_statusss_decimate_by_) - -#if !defined(_di_f_type_statusss_decrease_by_) || !defined(_di_f_type_statusss_increase_) || !defined(_di_f_type_statusss_increase_by_) || !defined(_di_f_type_statusss_resize_) - f_status_t private_f_type_statusss_resize(const f_array_length_t length, f_statusss_t *statusss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < statusss->size; ++i) { - - status = f_memory_delete(statusss->array[i].size, sizeof(f_statuss_t), (void **) & statusss->array[i].array); - if (F_status_is_error(status)) return status; - - statusss->array[i].size = 0; - statusss->array[i].used = 0; - } // for - - status = f_memory_resize(statusss->size, length, sizeof(f_statuss_t), (void **) & statusss->array); - - if (F_status_is_error_not(status)) { - statusss->size = length; - - if (statusss->used > statusss->size) { - statusss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_statusss_decrease_by_) || !defined(_di_f_type_statusss_increase_) || !defined(_di_f_type_statusss_increase_by_) || !defined(_di_f_type_statusss_resize_) - -#if !defined(_di_f_type_states_adjust_) || !defined(_di_f_type_states_decimate_by_) - f_status_t private_f_type_states_adjust(const f_array_length_t length, f_states_t *states) { - - const f_status_t status = f_memory_adjust(states->size, length, sizeof(f_state_t), (void **) & states->array); - - if (F_status_is_error_not(status)) { - states->size = length; - - if (states->used > states->size) { - states->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_states_adjust_) || !defined(_di_f_type_states_decimate_by_) - -#if !defined(_di_f_type_states_append_) || !defined(_di_f_type_statess_append_) - extern f_status_t private_f_type_states_append(const f_states_t source, f_states_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_states_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_states_append_) || !defined(_di_f_type_statess_append_) - -#if !defined(_di_f_type_states_resize_) || !defined(_di_f_type_states_append_) || !defined(_di_f_type_states_decimate_by_) || !defined(_di_f_type_statess_append_) - f_status_t private_f_type_states_resize(const f_array_length_t length, f_states_t *states) { - - const f_status_t status = f_memory_resize(states->size, length, sizeof(f_state_t), (void **) & states->array); - - if (F_status_is_error_not(status)) { - states->size = length; - - if (states->used > states->size) { - states->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_states_resize_) || !defined(_di_f_type_states_append_) || !defined(_di_f_type_states_decimate_by_) || !defined(_di_f_type_statess_append_) - -#if !defined(_di_f_type_statess_adjust_) || !defined(_di_f_type_statess_decimate_by_) - f_status_t private_f_type_statess_adjust(const f_array_length_t length, f_statess_t *statess) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < statess->size; ++i) { - - status = f_memory_destroy(statess->array[i].size, sizeof(f_states_t), (void **) & statess->array[i].array); - if (F_status_is_error(status)) return status; - - statess->array[i].size = 0; - statess->array[i].used = 0; - } // for - - status = f_memory_adjust(statess->size, length, sizeof(f_states_t), (void **) & statess->array); - - if (F_status_is_error_not(status)) { - statess->size = length; - - if (statess->used > statess->size) { - statess->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_statess_adjust_) || !defined(_di_f_type_statess_decimate_by_) - -#if !defined(_di_f_type_statess_decrease_by_) || !defined(_di_f_type_statess_increase_) || !defined(_di_f_type_statess_increase_by_) || !defined(_di_f_type_statess_resize_) - f_status_t private_f_type_statess_resize(const f_array_length_t length, f_statess_t *statess) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < statess->size; ++i) { - - status = f_memory_delete(statess->array[i].size, sizeof(f_states_t), (void **) & statess->array[i].array); - if (F_status_is_error(status)) return status; - - statess->array[i].size = 0; - statess->array[i].used = 0; - } // for - - status = f_memory_resize(statess->size, length, sizeof(f_states_t), (void **) & statess->array); - - if (F_status_is_error_not(status)) { - statess->size = length; - - if (statess->used > statess->size) { - statess->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_statess_decrease_by_) || !defined(_di_f_type_statess_increase_) || !defined(_di_f_type_statess_increase_by_) || !defined(_di_f_type_statess_resize_) - -#if !defined(_di_f_type_cells_adjust_) || !defined(_di_f_type_cells_decimate_by_) - f_status_t private_f_type_cells_adjust(const f_array_length_t length, f_cells_t *cells) { - - const f_status_t status = f_memory_adjust(cells->size, length, sizeof(f_cell_t), (void **) & cells->array); - - if (F_status_is_error_not(status)) { - cells->size = length; - - if (cells->used > cells->size) { - cells->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_cells_adjust_) || !defined(_di_f_type_cells_decimate_by_) - -#if !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cellss_append_) - extern f_status_t private_f_type_cells_append(const f_cells_t source, f_cells_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_cells_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cellss_append_) - -#if !defined(_di_f_type_cells_resize_) || !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cells_decimate_by_) || !defined(_di_f_type_cellss_append_) - f_status_t private_f_type_cells_resize(const f_array_length_t length, f_cells_t *cells) { - - const f_status_t status = f_memory_resize(cells->size, length, sizeof(f_cell_t), (void **) & cells->array); - - if (F_status_is_error_not(status)) { - cells->size = length; - - if (cells->used > cells->size) { - cells->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_cells_resize_) || !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cells_decimate_by_) || !defined(_di_f_type_cellss_append_) - -#if !defined(_di_f_type_cellss_adjust_) || !defined(_di_f_type_cellss_decimate_by_) - f_status_t private_f_type_cellss_adjust(const f_array_length_t length, f_cellss_t *cellss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < cellss->size; ++i) { - - status = f_memory_destroy(cellss->array[i].size, sizeof(f_cells_t), (void **) & cellss->array[i].array); - if (F_status_is_error(status)) return status; - - cellss->array[i].size = 0; - cellss->array[i].used = 0; - } // for - - status = f_memory_adjust(cellss->size, length, sizeof(f_cells_t), (void **) & cellss->array); - - if (F_status_is_error_not(status)) { - cellss->size = length; - - if (cellss->used > cellss->size) { - cellss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_cellss_adjust_) || !defined(_di_f_type_cellss_decimate_by_) - -#if !defined(_di_f_type_cellss_decrease_by_) || !defined(_di_f_type_cellss_increase_) || !defined(_di_f_type_cellss_increase_by_) || !defined(_di_f_type_cellss_resize_) - f_status_t private_f_type_cellss_resize(const f_array_length_t length, f_cellss_t *cellss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < cellss->size; ++i) { - - status = f_memory_delete(cellss->array[i].size, sizeof(f_cells_t), (void **) & cellss->array[i].array); - if (F_status_is_error(status)) return status; - - cellss->array[i].size = 0; - cellss->array[i].used = 0; - } // for - - status = f_memory_resize(cellss->size, length, sizeof(f_cells_t), (void **) & cellss->array); - - if (F_status_is_error_not(status)) { - cellss->size = length; - - if (cellss->used > cellss->size) { - cellss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_cellss_decrease_by_) || !defined(_di_f_type_cellss_increase_) || !defined(_di_f_type_cellss_increase_by_) || !defined(_di_f_type_cellss_resize_) - -#if !defined(_di_f_type_fll_ids_adjust_) || !defined(_di_f_type_fll_ids_decimate_by_) - f_status_t private_f_type_fll_ids_adjust(const f_array_length_t length, f_fll_ids_t *ids) { - - const f_status_t status = f_memory_adjust(ids->size, length, sizeof(f_fll_id_t), (void **) & ids->array); - - if (F_status_is_error_not(status)) { - ids->size = length; - - if (ids->used > ids->size) { - ids->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_fll_ids_adjust_) || !defined(_di_f_type_fll_ids_decimate_by_) - -#if !defined(_di_f_type_fll_ids_append_) || !defined(_di_f_type_fll_idss_append_) - extern f_status_t private_f_type_fll_ids_append(const f_fll_ids_t source, f_fll_ids_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_fll_ids_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_fll_ids_append_) || !defined(_di_f_type_fll_idss_append_) - -#if !defined(_di_f_type_fll_ids_resize_) || !defined(_di_f_type_fll_ids_append_) || !defined(_di_f_type_fll_ids_decimate_by_) || !defined(_di_f_type_fll_idss_append_) - f_status_t private_f_type_fll_ids_resize(const f_array_length_t length, f_fll_ids_t *ids) { - - const f_status_t status = f_memory_resize(ids->size, length, sizeof(f_fll_id_t), (void **) & ids->array); - - if (F_status_is_error_not(status)) { - ids->size = length; - - if (ids->used > ids->size) { - ids->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_fll_ids_resize_) || !defined(_di_f_type_fll_ids_append_) || !defined(_di_f_type_fll_ids_decimate_by_) || !defined(_di_f_type_fll_idss_append_) - -#if !defined(_di_f_type_fll_idss_adjust_) || !defined(_di_f_type_fll_idss_decimate_by_) - f_status_t private_f_type_fll_idss_adjust(const f_array_length_t length, f_fll_idss_t *idss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < idss->size; ++i) { - - status = f_memory_destroy(idss->array[i].size, sizeof(f_fll_ids_t), (void **) & idss->array[i].array); - if (F_status_is_error(status)) return status; - - idss->array[i].size = 0; - idss->array[i].used = 0; - } // for - - status = f_memory_adjust(idss->size, length, sizeof(f_fll_ids_t), (void **) & idss->array); - - if (F_status_is_error_not(status)) { - idss->size = length; - - if (idss->used > idss->size) { - idss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_fll_idss_adjust_) || !defined(_di_f_type_fll_idss_decimate_by_) - -#if !defined(_di_f_type_fll_idss_decrease_by_) || !defined(_di_f_type_fll_idss_increase_) || !defined(_di_f_type_fll_idss_increase_by_) || !defined(_di_f_type_fll_idss_resize_) - f_status_t private_f_type_fll_idss_resize(const f_array_length_t length, f_fll_idss_t *idss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < idss->size; ++i) { - - status = f_memory_delete(idss->array[i].size, sizeof(f_fll_ids_t), (void **) & idss->array[i].array); - if (F_status_is_error(status)) return status; - - idss->array[i].size = 0; - idss->array[i].used = 0; - } // for - - status = f_memory_resize(idss->size, length, sizeof(f_fll_ids_t), (void **) & idss->array); - - if (F_status_is_error_not(status)) { - idss->size = length; - - if (idss->used > idss->size) { - idss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_fll_idss_decrease_by_) || !defined(_di_f_type_fll_idss_increase_) || !defined(_di_f_type_fll_idss_increase_by_) || !defined(_di_f_type_fll_idss_resize_) - -#if !defined(_di_f_type_array_lengths_adjust_) || !defined(_di_f_type_array_lengths_decimate_by_) - f_status_t private_f_type_array_lengths_adjust(const f_array_length_t length, f_array_lengths_t *array_lengths) { - - const f_status_t status = f_memory_adjust(array_lengths->size, length, sizeof(f_array_length_t), (void **) & array_lengths->array); - - if (F_status_is_error_not(status)) { - array_lengths->size = length; - - if (array_lengths->used > array_lengths->size) { - array_lengths->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_array_lengths_adjust_) || !defined(_di_f_type_array_lengths_decimate_by_) - -#if !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengthss_append_) - extern f_status_t private_f_type_array_lengths_append(const f_array_lengths_t source, f_array_lengths_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_array_lengths_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengthss_append_) - -#if !defined(_di_f_type_array_lengths_resize_) || !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengths_decimate_by_) || !defined(_di_f_type_array_lengthss_append_) - f_status_t private_f_type_array_lengths_resize(const f_array_length_t length, f_array_lengths_t *lengths) { - - const f_status_t status = f_memory_resize(lengths->size, length, sizeof(f_array_length_t), (void **) & lengths->array); - - if (F_status_is_error_not(status)) { - lengths->size = length; - - if (lengths->used > lengths->size) { - lengths->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_array_lengths_resize_) || !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengths_decimate_by_) || !defined(_di_f_type_array_lengthss_append_) - -#if !defined(_di_f_type_array_lengthss_adjust_) || !defined(_di_f_type_array_lengthss_decimate_by_) - f_status_t private_f_type_array_lengthss_adjust(const f_array_length_t length, f_array_lengthss_t *lengthss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < lengthss->size; ++i) { - - status = f_memory_destroy(lengthss->array[i].size, sizeof(f_array_lengths_t), (void **) & lengthss->array[i].array); - if (F_status_is_error(status)) return status; - - lengthss->array[i].size = 0; - lengthss->array[i].used = 0; - } // for - - status = f_memory_adjust(lengthss->size, length, sizeof(f_array_lengths_t), (void **) & lengthss->array); - - if (F_status_is_error_not(status)) { - lengthss->size = length; - - if (lengthss->used > lengthss->size) { - lengthss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_array_lengthss_adjust_) || !defined(_di_f_type_array_lengthss_decimate_by_) - -#if !defined(_di_f_type_array_lengthss_decrease_by_) || !defined(_di_f_type_array_lengthss_increase_) || !defined(_di_f_type_array_lengthss_increase_by_) || !defined(_di_f_type_array_lengthss_resize_) - f_status_t private_f_type_array_lengthss_resize(const f_array_length_t length, f_array_lengthss_t *lengthss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < lengthss->size; ++i) { - - status = f_memory_delete(lengthss->array[i].size, sizeof(f_array_lengths_t), (void **) & lengthss->array[i].array); - if (F_status_is_error(status)) return status; - - lengthss->array[i].size = 0; - lengthss->array[i].used = 0; - } // for - - status = f_memory_resize(lengthss->size, length, sizeof(f_array_lengths_t), (void **) & lengthss->array); - - if (F_status_is_error_not(status)) { - lengthss->size = length; - - if (lengthss->used > lengthss->size) { - lengthss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_array_lengthss_decrease_by_) || !defined(_di_f_type_array_lengthss_increase_) || !defined(_di_f_type_array_lengthss_increase_by_) || !defined(_di_f_type_array_lengthss_resize_) - -#if !defined(_di_f_type_int8s_adjust_) || !defined(_di_f_type_int8s_decimate_by_) - f_status_t private_f_type_int8s_adjust(const f_array_length_t length, f_int8s_t *int8s) { - - const f_status_t status = f_memory_adjust(int8s->size, length, sizeof(int8_t), (void **) & int8s->array); - - if (F_status_is_error_not(status)) { - int8s->size = length; - - if (int8s->used > int8s->size) { - int8s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int8s_adjust_) || !defined(_di_f_type_int8s_decimate_by_) - -#if !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8ss_append_) - extern f_status_t private_f_type_int8s_append(const f_int8s_t source, f_int8s_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_int8s_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8ss_append_) - -#if !defined(_di_f_type_int8s_resize_) || !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8s_decimate_by_) || !defined(_di_f_type_int8ss_append_) - f_status_t private_f_type_int8s_resize(const f_array_length_t length, f_int8s_t *int8s) { - - const f_status_t status = f_memory_resize(int8s->size, length, sizeof(int8_t), (void **) & int8s->array); - - if (F_status_is_error_not(status)) { - int8s->size = length; - - if (int8s->used > int8s->size) { - int8s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int8s_resize_) || !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8s_decimate_by_) || !defined(_di_f_type_int8ss_append_) - -#if !defined(_di_f_type_int8ss_adjust_) || !defined(_di_f_type_int8ss_decimate_by_) - f_status_t private_f_type_int8ss_adjust(const f_array_length_t length, f_int8ss_t *int8ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < int8ss->size; ++i) { - - status = f_memory_destroy(int8ss->array[i].size, sizeof(f_int8s_t), (void **) & int8ss->array[i].array); - if (F_status_is_error(status)) return status; - - int8ss->array[i].size = 0; - int8ss->array[i].used = 0; - } // for - - status = f_memory_adjust(int8ss->size, length, sizeof(f_int8s_t), (void **) & int8ss->array); - - if (F_status_is_error_not(status)) { - int8ss->size = length; - - if (int8ss->used > int8ss->size) { - int8ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int8ss_adjust_) || !defined(_di_f_type_int8ss_decimate_by_) - -#if !defined(_di_f_type_int8ss_decrease_by_) || !defined(_di_f_type_int8ss_increase_) || !defined(_di_f_type_int8ss_increase_by_) || !defined(_di_f_type_int8ss_resize_) - f_status_t private_f_type_int8ss_resize(const f_array_length_t length, f_int8ss_t *int8ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < int8ss->size; ++i) { - - status = f_memory_delete(int8ss->array[i].size, sizeof(f_int8s_t), (void **) & int8ss->array[i].array); - if (F_status_is_error(status)) return status; - - int8ss->array[i].size = 0; - int8ss->array[i].used = 0; - } // for - - status = f_memory_resize(int8ss->size, length, sizeof(f_int8s_t), (void **) & int8ss->array); - - if (F_status_is_error_not(status)) { - int8ss->size = length; - - if (int8ss->used > int8ss->size) { - int8ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int8ss_decrease_by_) || !defined(_di_f_type_int8ss_increase_) || !defined(_di_f_type_int8ss_increase_by_) || !defined(_di_f_type_int8ss_resize_) - -#if !defined(_di_f_type_uint8s_adjust_) || !defined(_di_f_type_uint8s_decimate_by_) - f_status_t private_f_type_uint8s_adjust(const f_array_length_t length, f_uint8s_t *uint8s) { - - const f_status_t status = f_memory_adjust(uint8s->size, length, sizeof(uint8_t), (void **) & uint8s->array); - - if (F_status_is_error_not(status)) { - uint8s->size = length; - - if (uint8s->used > uint8s->size) { - uint8s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint8s_adjust_) || !defined(_di_f_type_uint8s_decimate_by_) - -#if !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8ss_append_) - extern f_status_t private_f_type_uint8s_append(const f_uint8s_t source, f_uint8s_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_uint8s_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8ss_append_) - -#if !defined(_di_f_type_uint8s_resize_) || !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8s_decimate_by_) || !defined(_di_f_type_uint8ss_append_) - f_status_t private_f_type_uint8s_resize(const f_array_length_t length, f_uint8s_t *uint8s) { - - const f_status_t status = f_memory_resize(uint8s->size, length, sizeof(uint8_t), (void **) & uint8s->array); - - if (F_status_is_error_not(status)) { - uint8s->size = length; - - if (uint8s->used > uint8s->size) { - uint8s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint8s_resize_) || !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8s_decimate_by_) || !defined(_di_f_type_uint8ss_append_) - -#if !defined(_di_f_type_uint8ss_adjust_) || !defined(_di_f_type_uint8ss_decimate_by_) - f_status_t private_f_type_uint8ss_adjust(const f_array_length_t length, f_uint8ss_t *uint8ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < uint8ss->size; ++i) { - - status = f_memory_destroy(uint8ss->array[i].size, sizeof(f_uint8s_t), (void **) & uint8ss->array[i].array); - if (F_status_is_error(status)) return status; - - uint8ss->array[i].size = 0; - uint8ss->array[i].used = 0; - } // for - - status = f_memory_adjust(uint8ss->size, length, sizeof(f_uint8s_t), (void **) & uint8ss->array); - - if (F_status_is_error_not(status)) { - uint8ss->size = length; - - if (uint8ss->used > uint8ss->size) { - uint8ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint8ss_adjust_) || !defined(_di_f_type_uint8ss_decimate_by_) - -#if !defined(_di_f_type_uint8ss_decrease_by_) || !defined(_di_f_type_uint8ss_increase_) || !defined(_di_f_type_uint8ss_increase_by_) || !defined(_di_f_type_uint8ss_resize_) - f_status_t private_f_type_uint8ss_resize(const f_array_length_t length, f_uint8ss_t *uint8ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < uint8ss->size; ++i) { - - status = f_memory_delete(uint8ss->array[i].size, sizeof(f_uint8s_t), (void **) & uint8ss->array[i].array); - if (F_status_is_error(status)) return status; - - uint8ss->array[i].size = 0; - uint8ss->array[i].used = 0; - } // for - - status = f_memory_resize(uint8ss->size, length, sizeof(f_uint8s_t), (void **) & uint8ss->array); - - if (F_status_is_error_not(status)) { - uint8ss->size = length; - - if (uint8ss->used > uint8ss->size) { - uint8ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint8ss_decrease_by_) || !defined(_di_f_type_uint8ss_increase_) || !defined(_di_f_type_uint8ss_increase_by_) || !defined(_di_f_type_uint8ss_resize_) - -#if !defined(_di_f_type_int16s_adjust_) || !defined(_di_f_type_int16s_decimate_by_) - f_status_t private_f_type_int16s_adjust(const f_array_length_t length, f_int16s_t *int16s) { - - const f_status_t status = f_memory_adjust(int16s->size, length, sizeof(int16_t), (void **) & int16s->array); - - if (F_status_is_error_not(status)) { - int16s->size = length; - - if (int16s->used > int16s->size) { - int16s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int16s_adjust_) || !defined(_di_f_type_int16s_decimate_by_) - -#if !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16ss_append_) - extern f_status_t private_f_type_int16s_append(const f_int16s_t source, f_int16s_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_int16s_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16ss_append_) - -#if !defined(_di_f_type_int16s_resize_) || !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16s_decimate_by_) || !defined(_di_f_type_int16ss_append_) - f_status_t private_f_type_int16s_resize(const f_array_length_t length, f_int16s_t *int16s) { - - const f_status_t status = f_memory_resize(int16s->size, length, sizeof(int16_t), (void **) & int16s->array); - - if (F_status_is_error_not(status)) { - int16s->size = length; - - if (int16s->used > int16s->size) { - int16s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int16s_resize_) || !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16s_decimate_by_) || !defined(_di_f_type_int16ss_append_) - -#if !defined(_di_f_type_int16ss_adjust_) || !defined(_di_f_type_int16ss_decimate_by_) - f_status_t private_f_type_int16ss_adjust(const f_array_length_t length, f_int16ss_t *int16ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < int16ss->size; ++i) { - - status = f_memory_destroy(int16ss->array[i].size, sizeof(f_int16s_t), (void **) & int16ss->array[i].array); - if (F_status_is_error(status)) return status; - - int16ss->array[i].size = 0; - int16ss->array[i].used = 0; - } // for - - status = f_memory_adjust(int16ss->size, length, sizeof(f_int16s_t), (void **) & int16ss->array); - - if (F_status_is_error_not(status)) { - int16ss->size = length; - - if (int16ss->used > int16ss->size) { - int16ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int16ss_adjust_) || !defined(_di_f_type_int16ss_decimate_by_) - -#if !defined(_di_f_type_int16ss_decrease_by_) || !defined(_di_f_type_int16ss_increase_) || !defined(_di_f_type_int16ss_increase_by_) || !defined(_di_f_type_int16ss_resize_) - f_status_t private_f_type_int16ss_resize(const f_array_length_t length, f_int16ss_t *int16ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < int16ss->size; ++i) { - - status = f_memory_delete(int16ss->array[i].size, sizeof(f_int16s_t), (void **) & int16ss->array[i].array); - if (F_status_is_error(status)) return status; - - int16ss->array[i].size = 0; - int16ss->array[i].used = 0; - } // for - - status = f_memory_resize(int16ss->size, length, sizeof(f_int16s_t), (void **) & int16ss->array); - - if (F_status_is_error_not(status)) { - int16ss->size = length; - - if (int16ss->used > int16ss->size) { - int16ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int16ss_decrease_by_) || !defined(_di_f_type_int16ss_increase_) || !defined(_di_f_type_int16ss_increase_by_) || !defined(_di_f_type_int16ss_resize_) - -#if !defined(_di_f_type_uint16s_adjust_) || !defined(_di_f_type_uint16s_decimate_by_) - f_status_t private_f_type_uint16s_adjust(const f_array_length_t length, f_uint16s_t *uint16s) { - - const f_status_t status = f_memory_adjust(uint16s->size, length, sizeof(uint16_t), (void **) & uint16s->array); - - if (F_status_is_error_not(status)) { - uint16s->size = length; - - if (uint16s->used > uint16s->size) { - uint16s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint16s_adjust_) || !defined(_di_f_type_uint16s_decimate_by_) - -#if !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16ss_append_) - extern f_status_t private_f_type_uint16s_append(const f_uint16s_t source, f_uint16s_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_uint16s_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16ss_append_) - -#if !defined(_di_f_type_uint16s_resize_) || !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16s_decimate_by_) || !defined(_di_f_type_uint16ss_append_) - f_status_t private_f_type_uint16s_resize(const f_array_length_t length, f_uint16s_t *uint16s) { - - const f_status_t status = f_memory_resize(uint16s->size, length, sizeof(uint16_t), (void **) & uint16s->array); - - if (F_status_is_error_not(status)) { - uint16s->size = length; - - if (uint16s->used > uint16s->size) { - uint16s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint16s_resize_) || !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16s_decimate_by_) || !defined(_di_f_type_uint16ss_append_) - -#if !defined(_di_f_type_uint16ss_adjust_) || !defined(_di_f_type_uint16ss_decimate_by_) - f_status_t private_f_type_uint16ss_adjust(const f_array_length_t length, f_uint16ss_t *uint16ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < uint16ss->size; ++i) { - - status = f_memory_destroy(uint16ss->array[i].size, sizeof(f_uint16s_t), (void **) & uint16ss->array[i].array); - if (F_status_is_error(status)) return status; - - uint16ss->array[i].size = 0; - uint16ss->array[i].used = 0; - } // for - - status = f_memory_adjust(uint16ss->size, length, sizeof(f_uint16s_t), (void **) & uint16ss->array); - - if (F_status_is_error_not(status)) { - uint16ss->size = length; - - if (uint16ss->used > uint16ss->size) { - uint16ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint16ss_adjust_) || !defined(_di_f_type_uint16ss_decimate_by_) - -#if !defined(_di_f_type_uint16ss_decrease_by_) || !defined(_di_f_type_uint16ss_increase_) || !defined(_di_f_type_uint16ss_increase_by_) || !defined(_di_f_type_uint16ss_resize_) - f_status_t private_f_type_uint16ss_resize(const f_array_length_t length, f_uint16ss_t *uint16ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < uint16ss->size; ++i) { - - status = f_memory_delete(uint16ss->array[i].size, sizeof(f_uint16s_t), (void **) & uint16ss->array[i].array); - if (F_status_is_error(status)) return status; - - uint16ss->array[i].size = 0; - uint16ss->array[i].used = 0; - } // for - - status = f_memory_resize(uint16ss->size, length, sizeof(f_uint16s_t), (void **) & uint16ss->array); - - if (F_status_is_error_not(status)) { - uint16ss->size = length; - - if (uint16ss->used > uint16ss->size) { - uint16ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint16ss_decrease_by_) || !defined(_di_f_type_uint16ss_increase_) || !defined(_di_f_type_uint16ss_increase_by_) || !defined(_di_f_type_uint16ss_resize_) - -#if !defined(_di_f_type_int32s_adjust_) || !defined(_di_f_type_int32s_decimate_by_) - f_status_t private_f_type_int32s_adjust(const f_array_length_t length, f_int32s_t *int32s) { - - const f_status_t status = f_memory_adjust(int32s->size, length, sizeof(int32_t), (void **) & int32s->array); - - if (F_status_is_error_not(status)) { - int32s->size = length; - - if (int32s->used > int32s->size) { - int32s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int32s_adjust_) || !defined(_di_f_type_int32s_decimate_by_) - -#if !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32ss_append_) - extern f_status_t private_f_type_int32s_append(const f_int32s_t source, f_int32s_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_int32s_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32ss_append_) - -#if !defined(_di_f_type_int32s_resize_) || !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32s_decimate_by_) || !defined(_di_f_type_int32ss_append_) - f_status_t private_f_type_int32s_resize(const f_array_length_t length, f_int32s_t *int32s) { - - const f_status_t status = f_memory_resize(int32s->size, length, sizeof(int32_t), (void **) & int32s->array); - - if (F_status_is_error_not(status)) { - int32s->size = length; - - if (int32s->used > int32s->size) { - int32s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int32s_resize_) || !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32s_decimate_by_) || !defined(_di_f_type_int32ss_append_) - -#if !defined(_di_f_type_int32ss_adjust_) || !defined(_di_f_type_int32ss_decimate_by_) - f_status_t private_f_type_int32ss_adjust(const f_array_length_t length, f_int32ss_t *int32ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < int32ss->size; ++i) { - - status = f_memory_destroy(int32ss->array[i].size, sizeof(f_int32s_t), (void **) & int32ss->array[i].array); - if (F_status_is_error(status)) return status; - - int32ss->array[i].size = 0; - int32ss->array[i].used = 0; - } // for - - status = f_memory_adjust(int32ss->size, length, sizeof(f_int32s_t), (void **) & int32ss->array); - - if (F_status_is_error_not(status)) { - int32ss->size = length; - - if (int32ss->used > int32ss->size) { - int32ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int32ss_adjust_) || !defined(_di_f_type_int32ss_decimate_by_) - -#if !defined(_di_f_type_int32ss_decrease_by_) || !defined(_di_f_type_int32ss_increase_) || !defined(_di_f_type_int32ss_increase_by_) || !defined(_di_f_type_int32ss_resize_) - f_status_t private_f_type_int32ss_resize(const f_array_length_t length, f_int32ss_t *int32ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < int32ss->size; ++i) { - - status = f_memory_delete(int32ss->array[i].size, sizeof(f_int32s_t), (void **) & int32ss->array[i].array); - if (F_status_is_error(status)) return status; - - int32ss->array[i].size = 0; - int32ss->array[i].used = 0; - } // for - - status = f_memory_resize(int32ss->size, length, sizeof(f_int32s_t), (void **) & int32ss->array); - - if (F_status_is_error_not(status)) { - int32ss->size = length; - - if (int32ss->used > int32ss->size) { - int32ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int32ss_decrease_by_) || !defined(_di_f_type_int32ss_increase_) || !defined(_di_f_type_int32ss_increase_by_) || !defined(_di_f_type_int32ss_resize_) - -#if !defined(_di_f_type_uint32s_adjust_) || !defined(_di_f_type_uint32s_decimate_by_) - f_status_t private_f_type_uint32s_adjust(const f_array_length_t length, f_uint32s_t *uint32s) { - - const f_status_t status = f_memory_adjust(uint32s->size, length, sizeof(uint32_t), (void **) & uint32s->array); - - if (F_status_is_error_not(status)) { - uint32s->size = length; - - if (uint32s->used > uint32s->size) { - uint32s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint32s_adjust_) || !defined(_di_f_type_uint32s_decimate_by_) - -#if !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32ss_append_) - extern f_status_t private_f_type_uint32s_append(const f_uint32s_t source, f_uint32s_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_uint32s_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32ss_append_) - -#if !defined(_di_f_type_uint32s_resize_) || !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32s_decimate_by_) || !defined(_di_f_type_uint32ss_append_) - f_status_t private_f_type_uint32s_resize(const f_array_length_t length, f_uint32s_t *uint32s) { - - const f_status_t status = f_memory_resize(uint32s->size, length, sizeof(uint32_t), (void **) & uint32s->array); - - if (F_status_is_error_not(status)) { - uint32s->size = length; - - if (uint32s->used > uint32s->size) { - uint32s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint32s_resize_) || !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32s_decimate_by_) || !defined(_di_f_type_uint32ss_append_) - -#if !defined(_di_f_type_uint32ss_adjust_) || !defined(_di_f_type_uint32ss_decimate_by_) - f_status_t private_f_type_uint32ss_adjust(const f_array_length_t length, f_uint32ss_t *uint32ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < uint32ss->size; ++i) { - - status = f_memory_destroy(uint32ss->array[i].size, sizeof(f_uint32s_t), (void **) & uint32ss->array[i].array); - if (F_status_is_error(status)) return status; - - uint32ss->array[i].size = 0; - uint32ss->array[i].used = 0; - } // for - - status = f_memory_adjust(uint32ss->size, length, sizeof(f_uint32s_t), (void **) & uint32ss->array); - - if (F_status_is_error_not(status)) { - uint32ss->size = length; - - if (uint32ss->used > uint32ss->size) { - uint32ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint32ss_adjust_) || !defined(_di_f_type_uint32ss_decimate_by_) - -#if !defined(_di_f_type_uint32ss_decrease_by_) || !defined(_di_f_type_uint32ss_increase_) || !defined(_di_f_type_uint32ss_increase_by_) || !defined(_di_f_type_uint32ss_resize_) - f_status_t private_f_type_uint32ss_resize(const f_array_length_t length, f_uint32ss_t *uint32ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < uint32ss->size; ++i) { - - status = f_memory_delete(uint32ss->array[i].size, sizeof(f_uint32s_t), (void **) & uint32ss->array[i].array); - if (F_status_is_error(status)) return status; - - uint32ss->array[i].size = 0; - uint32ss->array[i].used = 0; - } // for - - status = f_memory_resize(uint32ss->size, length, sizeof(f_uint32s_t), (void **) & uint32ss->array); - - if (F_status_is_error_not(status)) { - uint32ss->size = length; - - if (uint32ss->used > uint32ss->size) { - uint32ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint32ss_decrease_by_) || !defined(_di_f_type_uint32ss_increase_) || !defined(_di_f_type_uint32ss_increase_by_) || !defined(_di_f_type_uint32ss_resize_) - -#if !defined(_di_f_type_int64s_adjust_) || !defined(_di_f_type_int64s_decimate_by_) - f_status_t private_f_type_int64s_adjust(const f_array_length_t length, f_int64s_t *int64s) { - - const f_status_t status = f_memory_adjust(int64s->size, length, sizeof(int64_t), (void **) & int64s->array); - - if (F_status_is_error_not(status)) { - int64s->size = length; - - if (int64s->used > int64s->size) { - int64s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int64s_adjust_) || !defined(_di_f_type_int64s_decimate_by_) - -#if !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64ss_append_) - extern f_status_t private_f_type_int64s_append(const f_int64s_t source, f_int64s_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_int64s_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64ss_append_) - -#if !defined(_di_f_type_int64s_resize_) || !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64s_decimate_by_) || !defined(_di_f_type_int64ss_append_) - f_status_t private_f_type_int64s_resize(const f_array_length_t length, f_int64s_t *int64s) { - - const f_status_t status = f_memory_resize(int64s->size, length, sizeof(int64_t), (void **) & int64s->array); - - if (F_status_is_error_not(status)) { - int64s->size = length; - - if (int64s->used > int64s->size) { - int64s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int64s_resize_) || !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64s_decimate_by_) || !defined(_di_f_type_int64ss_append_) - -#if !defined(_di_f_type_int64ss_adjust_) || !defined(_di_f_type_int64ss_decimate_by_) - f_status_t private_f_type_int64ss_adjust(const f_array_length_t length, f_int64ss_t *int64ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < int64ss->size; ++i) { - - status = f_memory_destroy(int64ss->array[i].size, sizeof(f_int64s_t), (void **) & int64ss->array[i].array); - if (F_status_is_error(status)) return status; - - int64ss->array[i].size = 0; - int64ss->array[i].used = 0; - } // for - - status = f_memory_adjust(int64ss->size, length, sizeof(f_int64s_t), (void **) & int64ss->array); - - if (F_status_is_error_not(status)) { - int64ss->size = length; - - if (int64ss->used > int64ss->size) { - int64ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int64ss_adjust_) || !defined(_di_f_type_int64ss_decimate_by_) - -#if !defined(_di_f_type_int64ss_decrease_by_) || !defined(_di_f_type_int64ss_increase_) || !defined(_di_f_type_int64ss_increase_by_) || !defined(_di_f_type_int64ss_resize_) - f_status_t private_f_type_int64ss_resize(const f_array_length_t length, f_int64ss_t *int64ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < int64ss->size; ++i) { - - status = f_memory_delete(int64ss->array[i].size, sizeof(f_int64s_t), (void **) & int64ss->array[i].array); - if (F_status_is_error(status)) return status; - - int64ss->array[i].size = 0; - int64ss->array[i].used = 0; - } // for - - status = f_memory_resize(int64ss->size, length, sizeof(f_int64s_t), (void **) & int64ss->array); - - if (F_status_is_error_not(status)) { - int64ss->size = length; - - if (int64ss->used > int64ss->size) { - int64ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int64ss_decrease_by_) || !defined(_di_f_type_int64ss_increase_) || !defined(_di_f_type_int64ss_increase_by_) || !defined(_di_f_type_int64ss_resize_) - -#if !defined(_di_f_type_uint64s_adjust_) || !defined(_di_f_type_uint64s_decimate_by_) - f_status_t private_f_type_uint64s_adjust(const f_array_length_t length, f_uint64s_t *uint64s) { - - const f_status_t status = f_memory_adjust(uint64s->size, length, sizeof(uint64_t), (void **) & uint64s->array); - - if (F_status_is_error_not(status)) { - uint64s->size = length; - - if (uint64s->used > uint64s->size) { - uint64s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint64s_adjust_) || !defined(_di_f_type_uint64s_decimate_by_) - -#if !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64ss_append_) - extern f_status_t private_f_type_uint64s_append(const f_uint64s_t source, f_uint64s_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_uint64s_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64ss_append_) - -#if !defined(_di_f_type_uint64s_resize_) || !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64s_decimate_by_) || !defined(_di_f_type_uint64ss_append_) - f_status_t private_f_type_uint64s_resize(const f_array_length_t length, f_uint64s_t *uint64s) { - - const f_status_t status = f_memory_resize(uint64s->size, length, sizeof(uint64_t), (void **) & uint64s->array); - - if (F_status_is_error_not(status)) { - uint64s->size = length; - - if (uint64s->used > uint64s->size) { - uint64s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint64s_resize_) || !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64s_decimate_by_) || !defined(_di_f_type_uint64ss_append_) - -#if !defined(_di_f_type_uint64ss_adjust_) || !defined(_di_f_type_uint64ss_decimate_by_) - f_status_t private_f_type_uint64ss_adjust(const f_array_length_t length, f_uint64ss_t *uint64ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < uint64ss->size; ++i) { - - status = f_memory_destroy(uint64ss->array[i].size, sizeof(f_uint64s_t), (void **) & uint64ss->array[i].array); - if (F_status_is_error(status)) return status; - - uint64ss->array[i].size = 0; - uint64ss->array[i].used = 0; - } // for - - status = f_memory_adjust(uint64ss->size, length, sizeof(f_uint64s_t), (void **) & uint64ss->array); - - if (F_status_is_error_not(status)) { - uint64ss->size = length; - - if (uint64ss->used > uint64ss->size) { - uint64ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint64ss_adjust_) || !defined(_di_f_type_uint64ss_decimate_by_) - -#if !defined(_di_f_type_uint64ss_decrease_by_) || !defined(_di_f_type_uint64ss_increase_) || !defined(_di_f_type_uint64ss_increase_by_) || !defined(_di_f_type_uint64ss_resize_) - f_status_t private_f_type_uint64ss_resize(const f_array_length_t length, f_uint64ss_t *uint64ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < uint64ss->size; ++i) { - - status = f_memory_delete(uint64ss->array[i].size, sizeof(f_uint64s_t), (void **) & uint64ss->array[i].array); - if (F_status_is_error(status)) return status; - - uint64ss->array[i].size = 0; - uint64ss->array[i].used = 0; - } // for - - status = f_memory_resize(uint64ss->size, length, sizeof(f_uint64s_t), (void **) & uint64ss->array); - - if (F_status_is_error_not(status)) { - uint64ss->size = length; - - if (uint64ss->used > uint64ss->size) { - uint64ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint64ss_decrease_by_) || !defined(_di_f_type_uint64ss_increase_) || !defined(_di_f_type_uint64ss_increase_by_) || !defined(_di_f_type_uint64ss_resize_) - -#if !defined(_di_f_type_int128s_adjust_) || !defined(_di_f_type_int128s_decimate_by_) - f_status_t private_f_type_int128s_adjust(const f_array_length_t length, f_int128s_t *int128s) { - - const f_status_t status = f_memory_adjust(int128s->size, length, sizeof(f_int128_t), (void **) & int128s->array); - - if (F_status_is_error_not(status)) { - int128s->size = length; - - if (int128s->used > int128s->size) { - int128s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int128s_adjust_) || !defined(_di_f_type_int128s_decimate_by_) - -#if !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128ss_append_) - extern f_status_t private_f_type_int128s_append(const f_int128s_t source, f_int128s_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_int128s_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128ss_append_) - -#if !defined(_di_f_type_int128s_resize_) || !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128s_decimate_by_) || !defined(_di_f_type_int128ss_append_) - f_status_t private_f_type_int128s_resize(const f_array_length_t length, f_int128s_t *int128s) { - - const f_status_t status = f_memory_resize(int128s->size, length, sizeof(f_int128_t), (void **) & int128s->array); - - if (F_status_is_error_not(status)) { - int128s->size = length; - - if (int128s->used > int128s->size) { - int128s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int128s_resize_) || !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128s_decimate_by_) || !defined(_di_f_type_int128ss_append_) - -#if !defined(_di_f_type_int128ss_adjust_) || !defined(_di_f_type_int128ss_decimate_by_) - f_status_t private_f_type_int128ss_adjust(const f_array_length_t length, f_int128ss_t *int128ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < int128ss->size; ++i) { - - status = f_memory_destroy(int128ss->array[i].size, sizeof(f_int128s_t), (void **) & int128ss->array[i].array); - if (F_status_is_error(status)) return status; - - int128ss->array[i].size = 0; - int128ss->array[i].used = 0; - } // for - - status = f_memory_adjust(int128ss->size, length, sizeof(f_int128s_t), (void **) & int128ss->array); - - if (F_status_is_error_not(status)) { - int128ss->size = length; - - if (int128ss->used > int128ss->size) { - int128ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int128ss_adjust_) || !defined(_di_f_type_int128ss_decimate_by_) - -#if !defined(_di_f_type_int128ss_decrease_by_) || !defined(_di_f_type_int128ss_increase_) || !defined(_di_f_type_int128ss_increase_by_) || !defined(_di_f_type_int128ss_resize_) - f_status_t private_f_type_int128ss_resize(const f_array_length_t length, f_int128ss_t *int128ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < int128ss->size; ++i) { - - status = f_memory_delete(int128ss->array[i].size, sizeof(f_int128s_t), (void **) & int128ss->array[i].array); - if (F_status_is_error(status)) return status; - - int128ss->array[i].size = 0; - int128ss->array[i].used = 0; - } // for - - status = f_memory_resize(int128ss->size, length, sizeof(f_int128s_t), (void **) & int128ss->array); - - if (F_status_is_error_not(status)) { - int128ss->size = length; - - if (int128ss->used > int128ss->size) { - int128ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_int128ss_decrease_by_) || !defined(_di_f_type_int128ss_increase_) || !defined(_di_f_type_int128ss_increase_by_) || !defined(_di_f_type_int128ss_resize_) - -#if !defined(_di_f_type_uint128s_adjust_) || !defined(_di_f_type_uint128s_decimate_by_) - f_status_t private_f_type_uint128s_adjust(const f_array_length_t length, f_uint128s_t *uint128s) { - - const f_status_t status = f_memory_adjust(uint128s->size, length, sizeof(f_uint128_t), (void **) & uint128s->array); - - if (F_status_is_error_not(status)) { - uint128s->size = length; - - if (uint128s->used > uint128s->size) { - uint128s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint128s_adjust_) || !defined(_di_f_type_uint128s_decimate_by_) - -#if !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128ss_append_) - extern f_status_t private_f_type_uint128s_append(const f_uint128s_t source, f_uint128s_t *destination) { - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_uint128s_adjust(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - destination->array[destination->used] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128ss_append_) - -#if !defined(_di_f_type_uint128s_resize_) || !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128s_decimate_by_) || !defined(_di_f_type_uint128ss_append_) - f_status_t private_f_type_uint128s_resize(const f_array_length_t length, f_uint128s_t *uint128s) { - - const f_status_t status = f_memory_resize(uint128s->size, length, sizeof(f_uint128_t), (void **) & uint128s->array); - - if (F_status_is_error_not(status)) { - uint128s->size = length; - - if (uint128s->used > uint128s->size) { - uint128s->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint128s_resize_) || !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128s_decimate_by_) || !defined(_di_f_type_uint128ss_append_) - -#if !defined(_di_f_type_uint128ss_adjust_) || !defined(_di_f_type_uint128ss_decimate_by_) - f_status_t private_f_type_uint128ss_adjust(const f_array_length_t length, f_uint128ss_t *uint128ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < uint128ss->size; ++i) { - - status = f_memory_destroy(uint128ss->array[i].size, sizeof(f_uint128s_t), (void **) & uint128ss->array[i].array); - if (F_status_is_error(status)) return status; - - uint128ss->array[i].size = 0; - uint128ss->array[i].used = 0; - } // for - - status = f_memory_adjust(uint128ss->size, length, sizeof(f_uint128s_t), (void **) & uint128ss->array); - - if (F_status_is_error_not(status)) { - uint128ss->size = length; - - if (uint128ss->used > uint128ss->size) { - uint128ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint128ss_adjust_) || !defined(_di_f_type_uint128ss_decimate_by_) - -#if !defined(_di_f_type_uint128ss_decrease_by_) || !defined(_di_f_type_uint128ss_increase_) || !defined(_di_f_type_uint128ss_increase_by_) || !defined(_di_f_type_uint128ss_resize_) - f_status_t private_f_type_uint128ss_resize(const f_array_length_t length, f_uint128ss_t *uint128ss) { - - f_status_t status = F_none; - - for (f_array_length_t i = length; i < uint128ss->size; ++i) { - - status = f_memory_delete(uint128ss->array[i].size, sizeof(f_uint128s_t), (void **) & uint128ss->array[i].array); - if (F_status_is_error(status)) return status; - - uint128ss->array[i].size = 0; - uint128ss->array[i].used = 0; - } // for - - status = f_memory_resize(uint128ss->size, length, sizeof(f_uint128s_t), (void **) & uint128ss->array); - - if (F_status_is_error_not(status)) { - uint128ss->size = length; - - if (uint128ss->used > uint128ss->size) { - uint128ss->used = length; - } - } - - return status; - } -#endif // !defined(_di_f_type_uint128ss_decrease_by_) || !defined(_di_f_type_uint128ss_increase_) || !defined(_di_f_type_uint128ss_increase_by_) || !defined(_di_f_type_uint128ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array.c b/level_0/f_type_array/c/type_array.c deleted file mode 100644 index fe09afb..0000000 --- a/level_0/f_type_array/c/type_array.c +++ /dev/null @@ -1,3370 +0,0 @@ -#include "type_array.h" -#include "private-type_array.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_f_type_statuss_adjust_ - f_status_t f_type_statuss_adjust(const f_array_length_t length, f_statuss_t *statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_statuss_adjust(length, statuss); - } -#endif // _di_f_type_statuss_adjust_ - -#ifndef _di_f_type_statuss_append_ - f_status_t f_type_statuss_append(const f_statuss_t source, f_statuss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_statuss_append(source, destination); - } -#endif // _di_f_type_statuss_append_ - -#ifndef _di_f_type_statuss_decimate_by_ - f_status_t f_type_statuss_decimate_by(const f_array_length_t amount, f_statuss_t *statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statuss->size - amount > 0) { - return private_f_type_statuss_adjust(statuss->size - amount, statuss); - } - - return private_f_type_statuss_adjust(0, statuss); - } -#endif // _di_f_type_statuss_decimate_by_ - -#ifndef _di_f_type_statuss_decrease_by_ - f_status_t f_type_statuss_decrease_by(const f_array_length_t amount, f_statuss_t *statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statuss->size - amount > 0) { - return private_f_type_statuss_resize(statuss->size - amount, statuss); - } - - return private_f_type_statuss_resize(0, statuss); - } -#endif // _di_f_type_statuss_decrease_by_ - -#ifndef _di_f_type_statuss_increase_ - f_status_t f_type_statuss_increase(const uint16_t step, f_statuss_t *statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statuss->used + 1 > statuss->size) { - f_array_length_t size = statuss->used + step; - - if (size > F_array_length_t_size_d) { - if (statuss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_statuss_resize(size, statuss); - } - - return F_data_not; - } -#endif // _di_f_type_statuss_increase_ - -#ifndef _di_f_type_statuss_increase_by_ - f_status_t f_type_statuss_increase_by(const f_array_length_t amount, f_statuss_t *statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statuss->used + amount > statuss->size) { - if (statuss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_statuss_resize(statuss->used + amount, statuss); - } - - return F_data_not; - } -#endif // _di_f_type_statuss_increase_by_ - -#ifndef _di_f_type_statuss_resize_ - f_status_t f_type_statuss_resize(const f_array_length_t length, f_statuss_t *statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_statuss_resize(length, statuss); - } -#endif // _di_f_type_statuss_resize_ - -#ifndef _di_f_type_statusss_adjust_ - f_status_t f_type_statusss_adjust(const f_array_length_t length, f_statusss_t *statusss) { - #ifndef _di_level_0_parameter_checking_ - if (!statusss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_statusss_adjust(length, statusss); - } -#endif // _di_f_type_statusss_adjust_ - -#ifndef _di_f_type_statusss_append_ - f_status_t f_type_statusss_append(const f_statusss_t source, f_statusss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_statusss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_statuss_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_statusss_append_ - -#ifndef _di_f_type_statusss_decimate_by_ - f_status_t f_type_statusss_decimate_by(const f_array_length_t amount, f_statusss_t *statusss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!statusss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statusss->size - amount > 0) { - return private_f_type_statusss_adjust(statusss->size - amount, statusss); - } - - return private_f_type_statusss_adjust(0, statusss); - } -#endif // _di_f_type_statusss_decimate_by_ - -#ifndef _di_f_type_statusss_decrease_by_ - f_status_t f_type_statusss_decrease_by(const f_array_length_t amount, f_statusss_t *statusss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!statusss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statusss->size - amount > 0) { - return private_f_type_statusss_resize(statusss->size - amount, statusss); - } - - return private_f_type_statusss_resize(0, statusss); - } -#endif // _di_f_type_statusss_decrease_by_ - -#ifndef _di_f_type_statusss_increase_ - f_status_t f_type_statusss_increase(const uint16_t step, f_statusss_t *statusss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!statusss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statusss->used + 1 > statusss->size) { - f_array_length_t size = statusss->used + step; - - if (size > F_array_length_t_size_d) { - if (statusss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_statusss_resize(size, statusss); - } - - return F_data_not; - } -#endif // _di_f_type_statusss_increase_ - -#ifndef _di_f_type_statusss_increase_by_ - f_status_t f_type_statusss_increase_by(const f_array_length_t amount, f_statusss_t *statusss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!statusss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statusss->used + amount > statusss->size) { - if (statusss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_statusss_resize(statusss->used + amount, statusss); - } - - return F_data_not; - } -#endif // _di_f_type_statusss_increase_by_ - -#ifndef _di_f_type_statusss_resize_ - f_status_t f_type_statusss_resize(const f_array_length_t length, f_statusss_t *statusss) { - #ifndef _di_level_0_parameter_checking_ - if (!statusss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_statusss_resize(length, statusss); - } -#endif // _di_f_type_statusss_resize_ - -#ifndef _di_f_type_states_adjust_ - f_status_t f_type_states_adjust(const f_array_length_t length, f_states_t *states) { - #ifndef _di_level_0_parameter_checking_ - if (!states) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_states_adjust(length, states); - } -#endif // _di_f_type_states_adjust_ - -#ifndef _di_f_type_states_append_ - f_status_t f_type_states_append(const f_states_t source, f_states_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_states_append(source, destination); - } -#endif // _di_f_type_states_append_ - -#ifndef _di_f_type_states_decimate_by_ - f_status_t f_type_states_decimate_by(const f_array_length_t amount, f_states_t *states) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!states) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (states->size - amount > 0) { - return private_f_type_states_adjust(states->size - amount, states); - } - - return private_f_type_states_adjust(0, states); - } -#endif // _di_f_type_states_decimate_by_ - -#ifndef _di_f_type_states_decrease_by_ - f_status_t f_type_states_decrease_by(const f_array_length_t amount, f_states_t *states) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!states) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (states->size - amount > 0) { - return private_f_type_states_resize(states->size - amount, states); - } - - return private_f_type_states_resize(0, states); - } -#endif // _di_f_type_states_decrease_by_ - -#ifndef _di_f_type_states_increase_ - f_status_t f_type_states_increase(const uint16_t step, f_states_t *states) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!states) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (states->used + 1 > states->size) { - f_array_length_t size = states->used + step; - - if (size > F_array_length_t_size_d) { - if (states->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_states_resize(size, states); - } - - return F_data_not; - } -#endif // _di_f_type_states_increase_ - -#ifndef _di_f_type_states_increase_by_ - f_status_t f_type_states_increase_by(const f_array_length_t amount, f_states_t *states) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!states) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (states->used + amount > states->size) { - if (states->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_states_resize(states->used + amount, states); - } - - return F_data_not; - } -#endif // _di_f_type_states_increase_by_ - -#ifndef _di_f_type_states_resize_ - f_status_t f_type_states_resize(const f_array_length_t length, f_states_t *states) { - #ifndef _di_level_0_parameter_checking_ - if (!states) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_states_resize(length, states); - } -#endif // _di_f_type_states_resize_ - -#ifndef _di_f_type_statess_adjust_ - f_status_t f_type_statess_adjust(const f_array_length_t length, f_statess_t *statess) { - #ifndef _di_level_0_parameter_checking_ - if (!statess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_statess_adjust(length, statess); - } -#endif // _di_f_type_statess_adjust_ - -#ifndef _di_f_type_statess_append_ - f_status_t f_type_statess_append(const f_statess_t source, f_statess_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_statess_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_states_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_statess_append_ - -#ifndef _di_f_type_statess_decimate_by_ - f_status_t f_type_statess_decimate_by(const f_array_length_t amount, f_statess_t *statess) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!statess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statess->size - amount > 0) { - return private_f_type_statess_adjust(statess->size - amount, statess); - } - - return private_f_type_statess_adjust(0, statess); - } -#endif // _di_f_type_statess_decimate_by_ - -#ifndef _di_f_type_statess_decrease_by_ - f_status_t f_type_statess_decrease_by(const f_array_length_t amount, f_statess_t *statess) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!statess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statess->size - amount > 0) { - return private_f_type_statess_resize(statess->size - amount, statess); - } - - return private_f_type_statess_resize(0, statess); - } -#endif // _di_f_type_statess_decrease_by_ - -#ifndef _di_f_type_statess_increase_ - f_status_t f_type_statess_increase(const uint16_t step, f_statess_t *statess) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!statess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statess->used + 1 > statess->size) { - f_array_length_t size = statess->used + step; - - if (size > F_array_length_t_size_d) { - if (statess->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_statess_resize(size, statess); - } - - return F_data_not; - } -#endif // _di_f_type_statess_increase_ - -#ifndef _di_f_type_statess_increase_by_ - f_status_t f_type_statess_increase_by(const f_array_length_t amount, f_statess_t *statess) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!statess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (statess->used + amount > statess->size) { - if (statess->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_statess_resize(statess->used + amount, statess); - } - - return F_data_not; - } -#endif // _di_f_type_statess_increase_by_ - -#ifndef _di_f_type_statess_resize_ - f_status_t f_type_statess_resize(const f_array_length_t length, f_statess_t *statess) { - #ifndef _di_level_0_parameter_checking_ - if (!statess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_statess_resize(length, statess); - } -#endif // _di_f_type_statess_resize_ - -#ifndef _di_f_type_cells_adjust_ - f_status_t f_type_cells_adjust(const f_array_length_t length, f_cells_t *cells) { - #ifndef _di_level_0_parameter_checking_ - if (!cells) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_cells_adjust(length, cells); - } -#endif // _di_f_type_cells_adjust_ - -#ifndef _di_f_type_cells_append_ - f_status_t f_type_cells_append(const f_cells_t source, f_cells_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_cells_append(source, destination); - } -#endif // _di_f_type_cells_append_ - -#ifndef _di_f_type_cells_decimate_by_ - f_status_t f_type_cells_decimate_by(const f_array_length_t amount, f_cells_t *cells) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!cells) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (cells->size - amount > 0) { - return private_f_type_cells_adjust(cells->size - amount, cells); - } - - return private_f_type_cells_adjust(0, cells); - } -#endif // _di_f_type_cells_decimate_by_ - -#ifndef _di_f_type_cells_decrease_by_ - f_status_t f_type_cells_decrease_by(const f_array_length_t amount, f_cells_t *cells) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!cells) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (cells->size - amount > 0) { - return private_f_type_cells_resize(cells->size - amount, cells); - } - - return private_f_type_cells_resize(0, cells); - } -#endif // _di_f_type_cells_decrease_by_ - -#ifndef _di_f_type_cells_increase_ - f_status_t f_type_cells_increase(const uint16_t step, f_cells_t *cells) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!cells) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (cells->used + 1 > cells->size) { - f_array_length_t size = cells->used + step; - - if (size > F_array_length_t_size_d) { - if (cells->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_cells_resize(size, cells); - } - - return F_data_not; - } -#endif // _di_f_type_cells_increase_ - -#ifndef _di_f_type_cells_increase_by_ - f_status_t f_type_cells_increase_by(const f_array_length_t amount, f_cells_t *cells) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!cells) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (cells->used + amount > cells->size) { - if (cells->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_cells_resize(cells->used + amount, cells); - } - - return F_data_not; - } -#endif // _di_f_type_cells_increase_by_ - -#ifndef _di_f_type_cells_resize_ - f_status_t f_type_cells_resize(const f_array_length_t length, f_cells_t *cells) { - #ifndef _di_level_0_parameter_checking_ - if (!cells) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_cells_resize(length, cells); - } -#endif // _di_f_type_cells_resize_ - -#ifndef _di_f_type_cellss_adjust_ - f_status_t f_type_cellss_adjust(const f_array_length_t length, f_cellss_t *cellss) { - #ifndef _di_level_0_parameter_checking_ - if (!cellss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_cellss_adjust(length, cellss); - } -#endif // _di_f_type_cellss_adjust_ - -#ifndef _di_f_type_cellss_append_ - f_status_t f_type_cellss_append(const f_cellss_t source, f_cellss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_cellss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_cells_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_cellss_append_ - -#ifndef _di_f_type_cellss_decimate_by_ - f_status_t f_type_cellss_decimate_by(const f_array_length_t amount, f_cellss_t *cellss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!cellss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (cellss->size - amount > 0) { - return private_f_type_cellss_adjust(cellss->size - amount, cellss); - } - - return private_f_type_cellss_adjust(0, cellss); - } -#endif // _di_f_type_cellss_decimate_by_ - -#ifndef _di_f_type_cellss_decrease_by_ - f_status_t f_type_cellss_decrease_by(const f_array_length_t amount, f_cellss_t *cellss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!cellss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (cellss->size - amount > 0) { - return private_f_type_cellss_resize(cellss->size - amount, cellss); - } - - return private_f_type_cellss_resize(0, cellss); - } -#endif // _di_f_type_cellss_decrease_by_ - -#ifndef _di_f_type_cellss_increase_ - f_status_t f_type_cellss_increase(const uint16_t step, f_cellss_t *cellss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!cellss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (cellss->used + 1 > cellss->size) { - f_array_length_t size = cellss->used + step; - - if (size > F_array_length_t_size_d) { - if (cellss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_cellss_resize(size, cellss); - } - - return F_data_not; - } -#endif // _di_f_type_cellss_increase_ - -#ifndef _di_f_type_cellss_increase_by_ - f_status_t f_type_cellss_increase_by(const f_array_length_t amount, f_cellss_t *cellss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!cellss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (cellss->used + amount > cellss->size) { - if (cellss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_cellss_resize(cellss->used + amount, cellss); - } - - return F_data_not; - } -#endif // _di_f_type_cellss_increase_by_ - -#ifndef _di_f_type_cellss_resize_ - f_status_t f_type_cellss_resize(const f_array_length_t length, f_cellss_t *cellss) { - #ifndef _di_level_0_parameter_checking_ - if (!cellss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_cellss_resize(length, cellss); - } -#endif // _di_f_type_cellss_resize_ - -#ifndef _di_f_type_fll_ids_adjust_ - f_status_t f_type_fll_ids_adjust(const f_array_length_t length, f_fll_ids_t *ids) { - #ifndef _di_level_0_parameter_checking_ - if (!ids) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_fll_ids_adjust(length, ids); - } -#endif // _di_f_type_fll_ids_adjust_ - -#ifndef _di_f_type_fll_ids_append_ - f_status_t f_type_fll_ids_append(const f_fll_ids_t source, f_fll_ids_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_fll_ids_append(source, destination); - } -#endif // _di_f_type_fll_ids_append_ - -#ifndef _di_f_type_fll_ids_decimate_by_ - f_status_t f_type_fll_ids_decimate_by(const f_array_length_t amount, f_fll_ids_t *ids) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!ids) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (ids->size - amount > 0) { - return private_f_type_fll_ids_adjust(ids->size - amount, ids); - } - - return private_f_type_fll_ids_adjust(0, ids); - } -#endif // _di_f_type_fll_ids_decimate_by_ - -#ifndef _di_f_type_fll_ids_decrease_by_ - f_status_t f_type_fll_ids_decrease_by(const f_array_length_t amount, f_fll_ids_t *ids) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!ids) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (ids->size - amount > 0) { - return private_f_type_fll_ids_resize(ids->size - amount, ids); - } - - return private_f_type_fll_ids_resize(0, ids); - } -#endif // _di_f_type_fll_ids_decrease_by_ - -#ifndef _di_f_type_fll_ids_increase_ - f_status_t f_type_fll_ids_increase(const uint16_t step, f_fll_ids_t *ids) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!ids) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (ids->used + 1 > ids->size) { - f_array_length_t size = ids->used + step; - - if (size > F_array_length_t_size_d) { - if (ids->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_fll_ids_resize(size, ids); - } - - return F_data_not; - } -#endif // _di_f_type_fll_ids_increase_ - -#ifndef _di_f_type_fll_ids_increase_by_ - f_status_t f_type_fll_ids_increase_by(const f_array_length_t amount, f_fll_ids_t *ids) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!ids) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (ids->used + amount > ids->size) { - if (ids->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_fll_ids_resize(ids->used + amount, ids); - } - - return F_data_not; - } -#endif // _di_f_type_fll_ids_increase_by_ - -#ifndef _di_f_type_fll_ids_resize_ - f_status_t f_type_fll_ids_resize(const f_array_length_t length, f_fll_ids_t *ids) { - #ifndef _di_level_0_parameter_checking_ - if (!ids) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_fll_ids_resize(length, ids); - } -#endif // _di_f_type_fll_ids_resize_ - -#ifndef _di_f_type_fll_idss_adjust_ - f_status_t f_type_fll_idss_adjust(const f_array_length_t length, f_fll_idss_t *idss) { - #ifndef _di_level_0_parameter_checking_ - if (!idss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_fll_idss_adjust(length, idss); - } -#endif // _di_f_type_fll_idss_adjust_ - -#ifndef _di_f_type_fll_idss_append_ - f_status_t f_type_fll_idss_append(const f_fll_idss_t source, f_fll_idss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_fll_idss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_fll_ids_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_fll_idss_append_ - -#ifndef _di_f_type_fll_idss_decimate_by_ - f_status_t f_type_fll_idss_decimate_by(const f_array_length_t amount, f_fll_idss_t *idss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!idss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (idss->size - amount > 0) { - return private_f_type_fll_idss_adjust(idss->size - amount, idss); - } - - return private_f_type_fll_idss_adjust(0, idss); - } -#endif // _di_f_type_fll_idss_decimate_by_ - -#ifndef _di_f_type_fll_idss_decrease_by_ - f_status_t f_type_fll_idss_decrease_by(const f_array_length_t amount, f_fll_idss_t *idss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!idss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (idss->size - amount > 0) { - return private_f_type_fll_idss_resize(idss->size - amount, idss); - } - - return private_f_type_fll_idss_resize(0, idss); - } -#endif // _di_f_type_fll_idss_decrease_by_ - -#ifndef _di_f_type_fll_idss_increase_ - f_status_t f_type_fll_idss_increase(const uint16_t step, f_fll_idss_t *idss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!idss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (idss->used + 1 > idss->size) { - f_array_length_t size = idss->used + step; - - if (size > F_array_length_t_size_d) { - if (idss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_fll_idss_resize(size, idss); - } - - return F_data_not; - } -#endif // _di_f_type_fll_idss_increase_ - -#ifndef _di_f_type_fll_idss_increase_by_ - f_status_t f_type_fll_idss_increase_by(const f_array_length_t amount, f_fll_idss_t *idss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!idss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (idss->used + amount > idss->size) { - if (idss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_fll_idss_resize(idss->used + amount, idss); - } - - return F_data_not; - } -#endif // _di_f_type_fll_idss_increase_by_ - -#ifndef _di_f_type_fll_idss_resize_ - f_status_t f_type_fll_idss_resize(const f_array_length_t length, f_fll_idss_t *idss) { - #ifndef _di_level_0_parameter_checking_ - if (!idss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_fll_idss_resize(length, idss); - } -#endif // _di_f_type_fll_idss_resize_ - -#ifndef _di_f_type_array_lengths_adjust_ - f_status_t f_type_array_lengths_adjust(const f_array_length_t length, f_array_lengths_t *lengths) { - #ifndef _di_level_0_parameter_checking_ - if (!lengths) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_array_lengths_adjust(length, lengths); - } -#endif // _di_f_type_array_lengths_adjust_ - -#ifndef _di_f_type_array_lengths_append_ - f_status_t f_type_array_lengths_append(const f_array_lengths_t source, f_array_lengths_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_array_lengths_append(source, destination); - } -#endif // _di_f_type_array_lengths_append_ - -#ifndef _di_f_type_array_lengths_decimate_by_ - f_status_t f_type_array_lengths_decimate_by(const f_array_length_t amount, f_array_lengths_t *lengths) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!lengths) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (lengths->size - amount > 0) { - return private_f_type_array_lengths_adjust(lengths->size - amount, lengths); - } - - return private_f_type_array_lengths_adjust(0, lengths); - } -#endif // _di_f_type_array_lengths_decimate_by_ - -#ifndef _di_f_type_array_lengths_decrease_by_ - f_status_t f_type_array_lengths_decrease_by(const f_array_length_t amount, f_array_lengths_t *lengths) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!lengths) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (lengths->size - amount > 0) { - return private_f_type_array_lengths_resize(lengths->size - amount, lengths); - } - - return private_f_type_array_lengths_resize(0, lengths); - } -#endif // _di_f_type_array_lengths_decrease_by_ - -#ifndef _di_f_type_array_lengths_increase_ - f_status_t f_type_array_lengths_increase(const uint16_t step, f_array_lengths_t *lengths) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!lengths) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (lengths->used + 1 > lengths->size) { - f_array_length_t size = lengths->used + step; - - if (size > F_array_length_t_size_d) { - if (lengths->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_array_lengths_resize(size, lengths); - } - - return F_data_not; - } -#endif // _di_f_type_array_lengths_increase_ - -#ifndef _di_f_type_array_lengths_increase_by_ - f_status_t f_type_array_lengths_increase_by(const f_array_length_t amount, f_array_lengths_t *lengths) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!lengths) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (lengths->used + amount > lengths->size) { - if (lengths->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_array_lengths_resize(lengths->used + amount, lengths); - } - - return F_data_not; - } -#endif // _di_f_type_array_lengths_increase_by_ - -#ifndef _di_f_type_array_lengths_resize_ - f_status_t f_type_array_lengths_resize(const f_array_length_t length, f_array_lengths_t *lengths) { - #ifndef _di_level_0_parameter_checking_ - if (!lengths) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_array_lengths_resize(length, lengths); - } -#endif // _di_f_type_array_lengths_resize_ - -#ifndef _di_f_type_array_lengthss_adjust_ - f_status_t f_type_array_lengthss_adjust(const f_array_length_t length, f_array_lengthss_t *lengthss) { - #ifndef _di_level_0_parameter_checking_ - if (!lengthss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_array_lengthss_adjust(length, lengthss); - } -#endif // _di_f_type_array_lengthss_adjust_ - -#ifndef _di_f_type_array_lengthss_append_ - f_status_t f_type_array_lengthss_append(const f_array_lengthss_t source, f_array_lengthss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_array_lengthss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_array_lengths_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_array_lengthss_append_ - -#ifndef _di_f_type_array_lengthss_decimate_by_ - f_status_t f_type_array_lengthss_decimate_by(const f_array_length_t amount, f_array_lengthss_t *lengthss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!lengthss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (lengthss->size - amount > 0) { - return private_f_type_array_lengthss_adjust(lengthss->size - amount, lengthss); - } - - return private_f_type_array_lengthss_adjust(0, lengthss); - } -#endif // _di_f_type_array_lengthss_decimate_by_ - -#ifndef _di_f_type_array_lengthss_decrease_by_ - f_status_t f_type_array_lengthss_decrease_by(const f_array_length_t amount, f_array_lengthss_t *lengthss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!lengthss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (lengthss->size - amount > 0) { - return private_f_type_array_lengthss_resize(lengthss->size - amount, lengthss); - } - - return private_f_type_array_lengthss_resize(0, lengthss); - } -#endif // _di_f_type_array_lengthss_decrease_by_ - -#ifndef _di_f_type_array_lengthss_increase_ - f_status_t f_type_array_lengthss_increase(const uint16_t step, f_array_lengthss_t *lengthss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!lengthss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (lengthss->used + 1 > lengthss->size) { - f_array_length_t size = lengthss->used + step; - - if (size > F_array_length_t_size_d) { - if (lengthss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_array_lengthss_resize(size, lengthss); - } - - return F_data_not; - } -#endif // _di_f_type_array_lengthss_increase_ - -#ifndef _di_f_type_array_lengthss_increase_by_ - f_status_t f_type_array_lengthss_increase_by(const f_array_length_t amount, f_array_lengthss_t *lengthss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!lengthss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (lengthss->used + amount > lengthss->size) { - if (lengthss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_array_lengthss_resize(lengthss->used + amount, lengthss); - } - - return F_data_not; - } -#endif // _di_f_type_array_lengthss_increase_by_ - -#ifndef _di_f_type_array_lengthss_resize_ - f_status_t f_type_array_lengthss_resize(const f_array_length_t length, f_array_lengthss_t *lengthss) { - #ifndef _di_level_0_parameter_checking_ - if (!lengthss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_array_lengthss_resize(length, lengthss); - } -#endif // _di_f_type_array_lengthss_resize_ - -#ifndef _di_f_type_int8s_adjust_ - f_status_t f_type_int8s_adjust(const f_array_length_t length, f_int8s_t *int8s) { - #ifndef _di_level_0_parameter_checking_ - if (!int8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int8s_adjust(length, int8s); - } -#endif // _di_f_type_int8s_adjust_ - -#ifndef _di_f_type_int8s_append_ - f_status_t f_type_int8s_append(const f_int8s_t source, f_int8s_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_int8s_append(source, destination); - } -#endif // _di_f_type_int8s_append_ - -#ifndef _di_f_type_int8s_decimate_by_ - f_status_t f_type_int8s_decimate_by(const f_array_length_t amount, f_int8s_t *int8s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int8s->size - amount > 0) { - return private_f_type_int8s_adjust(int8s->size - amount, int8s); - } - - return private_f_type_int8s_adjust(0, int8s); - } -#endif // _di_f_type_int8s_decimate_by_ - -#ifndef _di_f_type_int8s_decrease_by_ - f_status_t f_type_int8s_decrease_by(const f_array_length_t amount, f_int8s_t *int8s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int8s->size - amount > 0) { - return private_f_type_int8s_resize(int8s->size - amount, int8s); - } - - return private_f_type_int8s_resize(0, int8s); - } -#endif // _di_f_type_int8s_decrease_by_ - -#ifndef _di_f_type_int8s_increase_ - f_status_t f_type_int8s_increase(const uint16_t step, f_int8s_t *int8s) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!int8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int8s->used + 1 > int8s->size) { - f_array_length_t size = int8s->used + step; - - if (size > F_array_length_t_size_d) { - if (int8s->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_int8s_resize(size, int8s); - } - - return F_data_not; - } -#endif // _di_f_type_int8s_increase_ - -#ifndef _di_f_type_int8s_increase_by_ - f_status_t f_type_int8s_increase_by(const f_array_length_t amount, f_int8s_t *int8s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int8s->used + amount > int8s->size) { - if (int8s->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_int8s_resize(int8s->used + amount, int8s); - } - - return F_data_not; - } -#endif // _di_f_type_int8s_increase_by_ - -#ifndef _di_f_type_int8s_resize_ - f_status_t f_type_int8s_resize(const f_array_length_t length, f_int8s_t *int8s) { - #ifndef _di_level_0_parameter_checking_ - if (!int8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int8s_resize(length, int8s); - } -#endif // _di_f_type_int8s_resize_ - -#ifndef _di_f_type_int8ss_adjust_ - f_status_t f_type_int8ss_adjust(const f_array_length_t length, f_int8ss_t *int8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!int8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int8ss_adjust(length, int8ss); - } -#endif // _di_f_type_int8ss_adjust_ - -#ifndef _di_f_type_int8ss_append_ - f_status_t f_type_int8ss_append(const f_int8ss_t source, f_int8ss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_int8ss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_int8s_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_int8ss_append_ - -#ifndef _di_f_type_int8ss_decimate_by_ - f_status_t f_type_int8ss_decimate_by(const f_array_length_t amount, f_int8ss_t *int8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int8ss->size - amount > 0) { - return private_f_type_int8ss_adjust(int8ss->size - amount, int8ss); - } - - return private_f_type_int8ss_adjust(0, int8ss); - } -#endif // _di_f_type_int8ss_decimate_by_ - -#ifndef _di_f_type_int8ss_decrease_by_ - f_status_t f_type_int8ss_decrease_by(const f_array_length_t amount, f_int8ss_t *int8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int8ss->size - amount > 0) { - return private_f_type_int8ss_resize(int8ss->size - amount, int8ss); - } - - return private_f_type_int8ss_resize(0, int8ss); - } -#endif // _di_f_type_int8ss_decrease_by_ - -#ifndef _di_f_type_int8ss_increase_ - f_status_t f_type_int8ss_increase(const uint16_t step, f_int8ss_t *int8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!int8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int8ss->used + 1 > int8ss->size) { - f_array_length_t size = int8ss->used + step; - - if (size > F_array_length_t_size_d) { - if (int8ss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_int8ss_resize(size, int8ss); - } - - return F_data_not; - } -#endif // _di_f_type_int8ss_increase_ - -#ifndef _di_f_type_int8ss_increase_by_ - f_status_t f_type_int8ss_increase_by(const f_array_length_t amount, f_int8ss_t *int8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int8ss->used + amount > int8ss->size) { - if (int8ss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_int8ss_resize(int8ss->used + amount, int8ss); - } - - return F_data_not; - } -#endif // _di_f_type_int8ss_increase_by_ - -#ifndef _di_f_type_int8ss_resize_ - f_status_t f_type_int8ss_resize(const f_array_length_t length, f_int8ss_t *int8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!int8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int8ss_resize(length, int8ss); - } -#endif // _di_f_type_int8ss_resize_ - -#ifndef _di_f_type_uint8s_adjust_ - f_status_t f_type_uint8s_adjust(const f_array_length_t length, f_uint8s_t *uint8s) { - #ifndef _di_level_0_parameter_checking_ - if (!uint8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint8s_adjust(length, uint8s); - } -#endif // _di_f_type_uint8s_adjust_ - -#ifndef _di_f_type_uint8s_append_ - f_status_t f_type_uint8s_append(const f_uint8s_t source, f_uint8s_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_uint8s_append(source, destination); - } -#endif // _di_f_type_uint8s_append_ - -#ifndef _di_f_type_uint8s_decimate_by_ - f_status_t f_type_uint8s_decimate_by(const f_array_length_t amount, f_uint8s_t *uint8s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint8s->size - amount > 0) { - return private_f_type_uint8s_adjust(uint8s->size - amount, uint8s); - } - - return private_f_type_uint8s_adjust(0, uint8s); - } -#endif // _di_f_type_uint8s_decimate_by_ - -#ifndef _di_f_type_uint8s_decrease_by_ - f_status_t f_type_uint8s_decrease_by(const f_array_length_t amount, f_uint8s_t *uint8s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint8s->size - amount > 0) { - return private_f_type_uint8s_resize(uint8s->size - amount, uint8s); - } - - return private_f_type_uint8s_resize(0, uint8s); - } -#endif // _di_f_type_uint8s_decrease_by_ - -#ifndef _di_f_type_uint8s_increase_ - f_status_t f_type_uint8s_increase(const uint16_t step, f_uint8s_t *uint8s) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!uint8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint8s->used + 1 > uint8s->size) { - f_array_length_t size = uint8s->used + step; - - if (size > F_array_length_t_size_d) { - if (uint8s->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_uint8s_resize(size, uint8s); - } - - return F_data_not; - } -#endif // _di_f_type_uint8s_increase_ - -#ifndef _di_f_type_uint8s_increase_by_ - f_status_t f_type_uint8s_increase_by(const f_array_length_t amount, f_uint8s_t *uint8s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint8s->used + amount > uint8s->size) { - if (uint8s->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_uint8s_resize(uint8s->used + amount, uint8s); - } - - return F_data_not; - } -#endif // _di_f_type_uint8s_increase_by_ - -#ifndef _di_f_type_uint8s_resize_ - f_status_t f_type_uint8s_resize(const f_array_length_t length, f_uint8s_t *uint8s) { - #ifndef _di_level_0_parameter_checking_ - if (!uint8s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint8s_resize(length, uint8s); - } -#endif // _di_f_type_uint8s_resize_ - -#ifndef _di_f_type_uint8ss_adjust_ - f_status_t f_type_uint8ss_adjust(const f_array_length_t length, f_uint8ss_t *uint8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!uint8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint8ss_adjust(length, uint8ss); - } -#endif // _di_f_type_uint8ss_adjust_ - -#ifndef _di_f_type_uint8ss_append_ - f_status_t f_type_uint8ss_append(const f_uint8ss_t source, f_uint8ss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_uint8ss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_uint8s_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_uint8ss_append_ - -#ifndef _di_f_type_uint8ss_decimate_by_ - f_status_t f_type_uint8ss_decimate_by(const f_array_length_t amount, f_uint8ss_t *uint8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint8ss->size - amount > 0) { - return private_f_type_uint8ss_adjust(uint8ss->size - amount, uint8ss); - } - - return private_f_type_uint8ss_adjust(0, uint8ss); - } -#endif // _di_f_type_uint8ss_decimate_by_ - -#ifndef _di_f_type_uint8ss_decrease_by_ - f_status_t f_type_uint8ss_decrease_by(const f_array_length_t amount, f_uint8ss_t *uint8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint8ss->size - amount > 0) { - return private_f_type_uint8ss_resize(uint8ss->size - amount, uint8ss); - } - - return private_f_type_uint8ss_resize(0, uint8ss); - } -#endif // _di_f_type_uint8ss_decrease_by_ - -#ifndef _di_f_type_uint8ss_increase_ - f_status_t f_type_uint8ss_increase(const uint16_t step, f_uint8ss_t *uint8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!uint8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint8ss->used + 1 > uint8ss->size) { - f_array_length_t size = uint8ss->used + step; - - if (size > F_array_length_t_size_d) { - if (uint8ss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_uint8ss_resize(size, uint8ss); - } - - return F_data_not; - } -#endif // _di_f_type_uint8ss_increase_ - -#ifndef _di_f_type_uint8ss_increase_by_ - f_status_t f_type_uint8ss_increase_by(const f_array_length_t amount, f_uint8ss_t *uint8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint8ss->used + amount > uint8ss->size) { - if (uint8ss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_uint8ss_resize(uint8ss->used + amount, uint8ss); - } - - return F_data_not; - } -#endif // _di_f_type_uint8ss_increase_by_ - -#ifndef _di_f_type_uint8ss_resize_ - f_status_t f_type_uint8ss_resize(const f_array_length_t length, f_uint8ss_t *uint8ss) { - #ifndef _di_level_0_parameter_checking_ - if (!uint8ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint8ss_resize(length, uint8ss); - } -#endif // _di_f_type_uint8ss_resize_ - -#ifndef _di_f_type_int16s_adjust_ - f_status_t f_type_int16s_adjust(const f_array_length_t length, f_int16s_t *int16s) { - #ifndef _di_level_0_parameter_checking_ - if (!int16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int16s_adjust(length, int16s); - } -#endif // _di_f_type_int16s_adjust_ - -#ifndef _di_f_type_int16s_append_ - f_status_t f_type_int16s_append(const f_int16s_t source, f_int16s_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_int16s_append(source, destination); - } -#endif // _di_f_type_int16s_append_ - -#ifndef _di_f_type_int16s_decimate_by_ - f_status_t f_type_int16s_decimate_by(const f_array_length_t amount, f_int16s_t *int16s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int16s->size - amount > 0) { - return private_f_type_int16s_adjust(int16s->size - amount, int16s); - } - - return private_f_type_int16s_adjust(0, int16s); - } -#endif // _di_f_type_int16s_decimate_by_ - -#ifndef _di_f_type_int16s_decrease_by_ - f_status_t f_type_int16s_decrease_by(const f_array_length_t amount, f_int16s_t *int16s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int16s->size - amount > 0) { - return private_f_type_int16s_resize(int16s->size - amount, int16s); - } - - return private_f_type_int16s_resize(0, int16s); - } -#endif // _di_f_type_int16s_decrease_by_ - -#ifndef _di_f_type_int16s_increase_ - f_status_t f_type_int16s_increase(const uint16_t step, f_int16s_t *int16s) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!int16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int16s->used + 1 > int16s->size) { - f_array_length_t size = int16s->used + step; - - if (size > F_array_length_t_size_d) { - if (int16s->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_int16s_resize(size, int16s); - } - - return F_data_not; - } -#endif // _di_f_type_int16s_increase_ - -#ifndef _di_f_type_int16s_increase_by_ - f_status_t f_type_int16s_increase_by(const f_array_length_t amount, f_int16s_t *int16s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int16s->used + amount > int16s->size) { - if (int16s->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_int16s_resize(int16s->used + amount, int16s); - } - - return F_data_not; - } -#endif // _di_f_type_int16s_increase_by_ - -#ifndef _di_f_type_int16s_resize_ - f_status_t f_type_int16s_resize(const f_array_length_t length, f_int16s_t *int16s) { - #ifndef _di_level_0_parameter_checking_ - if (!int16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int16s_resize(length, int16s); - } -#endif // _di_f_type_int16s_resize_ - -#ifndef _di_f_type_int16ss_adjust_ - f_status_t f_type_int16ss_adjust(const f_array_length_t length, f_int16ss_t *int16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!int16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int16ss_adjust(length, int16ss); - } -#endif // _di_f_type_int16ss_adjust_ - -#ifndef _di_f_type_int16ss_append_ - f_status_t f_type_int16ss_append(const f_int16ss_t source, f_int16ss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_int16ss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_int16s_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_int16ss_append_ - -#ifndef _di_f_type_int16ss_decimate_by_ - f_status_t f_type_int16ss_decimate_by(const f_array_length_t amount, f_int16ss_t *int16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int16ss->size - amount > 0) { - return private_f_type_int16ss_adjust(int16ss->size - amount, int16ss); - } - - return private_f_type_int16ss_adjust(0, int16ss); - } -#endif // _di_f_type_int16ss_decimate_by_ - -#ifndef _di_f_type_int16ss_decrease_by_ - f_status_t f_type_int16ss_decrease_by(const f_array_length_t amount, f_int16ss_t *int16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int16ss->size - amount > 0) { - return private_f_type_int16ss_resize(int16ss->size - amount, int16ss); - } - - return private_f_type_int16ss_resize(0, int16ss); - } -#endif // _di_f_type_int16ss_decrease_by_ - -#ifndef _di_f_type_int16ss_increase_ - f_status_t f_type_int16ss_increase(const uint16_t step, f_int16ss_t *int16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!int16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int16ss->used + 1 > int16ss->size) { - f_array_length_t size = int16ss->used + step; - - if (size > F_array_length_t_size_d) { - if (int16ss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_int16ss_resize(size, int16ss); - } - - return F_data_not; - } -#endif // _di_f_type_int16ss_increase_ - -#ifndef _di_f_type_int16ss_increase_by_ - f_status_t f_type_int16ss_increase_by(const f_array_length_t amount, f_int16ss_t *int16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int16ss->used + amount > int16ss->size) { - if (int16ss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_int16ss_resize(int16ss->used + amount, int16ss); - } - - return F_data_not; - } -#endif // _di_f_type_int16ss_increase_by_ - -#ifndef _di_f_type_int16ss_resize_ - f_status_t f_type_int16ss_resize(const f_array_length_t length, f_int16ss_t *int16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!int16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int16ss_resize(length, int16ss); - } -#endif // _di_f_type_int16ss_resize_ - -#ifndef _di_f_type_uint16s_adjust_ - f_status_t f_type_uint16s_adjust(const f_array_length_t length, f_uint16s_t *uint16s) { - #ifndef _di_level_0_parameter_checking_ - if (!uint16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint16s_adjust(length, uint16s); - } -#endif // _di_f_type_uint16s_adjust_ - -#ifndef _di_f_type_uint16s_append_ - f_status_t f_type_uint16s_append(const f_uint16s_t source, f_uint16s_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_uint16s_append(source, destination); - } -#endif // _di_f_type_uint16s_append_ - -#ifndef _di_f_type_uint16s_decimate_by_ - f_status_t f_type_uint16s_decimate_by(const f_array_length_t amount, f_uint16s_t *uint16s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint16s->size - amount > 0) { - return private_f_type_uint16s_adjust(uint16s->size - amount, uint16s); - } - - return private_f_type_uint16s_adjust(0, uint16s); - } -#endif // _di_f_type_uint16s_decimate_by_ - -#ifndef _di_f_type_uint16s_decrease_by_ - f_status_t f_type_uint16s_decrease_by(const f_array_length_t amount, f_uint16s_t *uint16s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint16s->size - amount > 0) { - return private_f_type_uint16s_resize(uint16s->size - amount, uint16s); - } - - return private_f_type_uint16s_resize(0, uint16s); - } -#endif // _di_f_type_uint16s_decrease_by_ - -#ifndef _di_f_type_uint16s_increase_ - f_status_t f_type_uint16s_increase(const uint16_t step, f_uint16s_t *uint16s) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!uint16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint16s->used + 1 > uint16s->size) { - f_array_length_t size = uint16s->used + step; - - if (size > F_array_length_t_size_d) { - if (uint16s->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_uint16s_resize(size, uint16s); - } - - return F_data_not; - } -#endif // _di_f_type_uint16s_increase_ - -#ifndef _di_f_type_uint16s_increase_by_ - f_status_t f_type_uint16s_increase_by(const f_array_length_t amount, f_uint16s_t *uint16s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint16s->used + amount > uint16s->size) { - if (uint16s->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_uint16s_resize(uint16s->used + amount, uint16s); - } - - return F_data_not; - } -#endif // _di_f_type_uint16s_increase_by_ - -#ifndef _di_f_type_uint16s_resize_ - f_status_t f_type_uint16s_resize(const f_array_length_t length, f_uint16s_t *uint16s) { - #ifndef _di_level_0_parameter_checking_ - if (!uint16s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint16s_resize(length, uint16s); - } -#endif // _di_f_type_uint16s_resize_ - -#ifndef _di_f_type_uint16ss_adjust_ - f_status_t f_type_uint16ss_adjust(const f_array_length_t length, f_uint16ss_t *uint16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!uint16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint16ss_adjust(length, uint16ss); - } -#endif // _di_f_type_uint16ss_adjust_ - -#ifndef _di_f_type_uint16ss_append_ - f_status_t f_type_uint16ss_append(const f_uint16ss_t source, f_uint16ss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_uint16ss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_uint16s_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_uint16ss_append_ - -#ifndef _di_f_type_uint16ss_decimate_by_ - f_status_t f_type_uint16ss_decimate_by(const f_array_length_t amount, f_uint16ss_t *uint16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint16ss->size - amount > 0) { - return private_f_type_uint16ss_adjust(uint16ss->size - amount, uint16ss); - } - - return private_f_type_uint16ss_adjust(0, uint16ss); - } -#endif // _di_f_type_uint16ss_decimate_by_ - -#ifndef _di_f_type_uint16ss_decrease_by_ - f_status_t f_type_uint16ss_decrease_by(const f_array_length_t amount, f_uint16ss_t *uint16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint16ss->size - amount > 0) { - return private_f_type_uint16ss_resize(uint16ss->size - amount, uint16ss); - } - - return private_f_type_uint16ss_resize(0, uint16ss); - } -#endif // _di_f_type_uint16ss_decrease_by_ - -#ifndef _di_f_type_uint16ss_increase_ - f_status_t f_type_uint16ss_increase(const uint16_t step, f_uint16ss_t *uint16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!uint16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint16ss->used + 1 > uint16ss->size) { - f_array_length_t size = uint16ss->used + step; - - if (size > F_array_length_t_size_d) { - if (uint16ss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_uint16ss_resize(size, uint16ss); - } - - return F_data_not; - } -#endif // _di_f_type_uint16ss_increase_ - -#ifndef _di_f_type_uint16ss_increase_by_ - f_status_t f_type_uint16ss_increase_by(const f_array_length_t amount, f_uint16ss_t *uint16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint16ss->used + amount > uint16ss->size) { - if (uint16ss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_uint16ss_resize(uint16ss->used + amount, uint16ss); - } - - return F_data_not; - } -#endif // _di_f_type_uint16ss_increase_by_ - -#ifndef _di_f_type_uint16ss_resize_ - f_status_t f_type_uint16ss_resize(const f_array_length_t length, f_uint16ss_t *uint16ss) { - #ifndef _di_level_0_parameter_checking_ - if (!uint16ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint16ss_resize(length, uint16ss); - } -#endif // _di_f_type_uint16ss_resize_ - -#ifndef _di_f_type_int32s_adjust_ - f_status_t f_type_int32s_adjust(const f_array_length_t length, f_int32s_t *int32s) { - #ifndef _di_level_0_parameter_checking_ - if (!int32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int32s_adjust(length, int32s); - } -#endif // _di_f_type_int32s_adjust_ - -#ifndef _di_f_type_int32s_append_ - f_status_t f_type_int32s_append(const f_int32s_t source, f_int32s_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_int32s_append(source, destination); - } -#endif // _di_f_type_int32s_append_ - -#ifndef _di_f_type_int32s_decimate_by_ - f_status_t f_type_int32s_decimate_by(const f_array_length_t amount, f_int32s_t *int32s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int32s->size - amount > 0) { - return private_f_type_int32s_adjust(int32s->size - amount, int32s); - } - - return private_f_type_int32s_adjust(0, int32s); - } -#endif // _di_f_type_int32s_decimate_by_ - -#ifndef _di_f_type_int32s_decrease_by_ - f_status_t f_type_int32s_decrease_by(const f_array_length_t amount, f_int32s_t *int32s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int32s->size - amount > 0) { - return private_f_type_int32s_resize(int32s->size - amount, int32s); - } - - return private_f_type_int32s_resize(0, int32s); - } -#endif // _di_f_type_int32s_decrease_by_ - -#ifndef _di_f_type_int32s_increase_ - f_status_t f_type_int32s_increase(const uint16_t step, f_int32s_t *int32s) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!int32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int32s->used + 1 > int32s->size) { - f_array_length_t size = int32s->used + step; - - if (size > F_array_length_t_size_d) { - if (int32s->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_int32s_resize(size, int32s); - } - - return F_data_not; - } -#endif // _di_f_type_int32s_increase_ - -#ifndef _di_f_type_int32s_increase_by_ - f_status_t f_type_int32s_increase_by(const f_array_length_t amount, f_int32s_t *int32s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int32s->used + amount > int32s->size) { - if (int32s->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_int32s_resize(int32s->used + amount, int32s); - } - - return F_data_not; - } -#endif // _di_f_type_int32s_increase_by_ - -#ifndef _di_f_type_int32s_resize_ - f_status_t f_type_int32s_resize(const f_array_length_t length, f_int32s_t *int32s) { - #ifndef _di_level_0_parameter_checking_ - if (!int32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int32s_resize(length, int32s); - } -#endif // _di_f_type_int32s_resize_ - -#ifndef _di_f_type_int32ss_adjust_ - f_status_t f_type_int32ss_adjust(const f_array_length_t length, f_int32ss_t *int32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!int32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int32ss_adjust(length, int32ss); - } -#endif // _di_f_type_int32ss_adjust_ - -#ifndef _di_f_type_int32ss_append_ - f_status_t f_type_int32ss_append(const f_int32ss_t source, f_int32ss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_int32ss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_int32s_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_int32ss_append_ - -#ifndef _di_f_type_int32ss_decimate_by_ - f_status_t f_type_int32ss_decimate_by(const f_array_length_t amount, f_int32ss_t *int32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int32ss->size - amount > 0) { - return private_f_type_int32ss_adjust(int32ss->size - amount, int32ss); - } - - return private_f_type_int32ss_adjust(0, int32ss); - } -#endif // _di_f_type_int32ss_decimate_by_ - -#ifndef _di_f_type_int32ss_decrease_by_ - f_status_t f_type_int32ss_decrease_by(const f_array_length_t amount, f_int32ss_t *int32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int32ss->size - amount > 0) { - return private_f_type_int32ss_resize(int32ss->size - amount, int32ss); - } - - return private_f_type_int32ss_resize(0, int32ss); - } -#endif // _di_f_type_int32ss_decrease_by_ - -#ifndef _di_f_type_int32ss_increase_ - f_status_t f_type_int32ss_increase(const uint16_t step, f_int32ss_t *int32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!int32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int32ss->used + 1 > int32ss->size) { - f_array_length_t size = int32ss->used + step; - - if (size > F_array_length_t_size_d) { - if (int32ss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_int32ss_resize(size, int32ss); - } - - return F_data_not; - } -#endif // _di_f_type_int32ss_increase_ - -#ifndef _di_f_type_int32ss_increase_by_ - f_status_t f_type_int32ss_increase_by(const f_array_length_t amount, f_int32ss_t *int32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int32ss->used + amount > int32ss->size) { - if (int32ss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_int32ss_resize(int32ss->used + amount, int32ss); - } - - return F_data_not; - } -#endif // _di_f_type_int32ss_increase_by_ - -#ifndef _di_f_type_int32ss_resize_ - f_status_t f_type_int32ss_resize(const f_array_length_t length, f_int32ss_t *int32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!int32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int32ss_resize(length, int32ss); - } -#endif // _di_f_type_int32ss_resize_ - -#ifndef _di_f_type_uint32s_adjust_ - f_status_t f_type_uint32s_adjust(const f_array_length_t length, f_uint32s_t *uint32s) { - #ifndef _di_level_0_parameter_checking_ - if (!uint32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint32s_adjust(length, uint32s); - } -#endif // _di_f_type_uint32s_adjust_ - -#ifndef _di_f_type_uint32s_append_ - f_status_t f_type_uint32s_append(const f_uint32s_t source, f_uint32s_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_uint32s_append(source, destination); - } -#endif // _di_f_type_uint32s_append_ - -#ifndef _di_f_type_uint32s_decimate_by_ - f_status_t f_type_uint32s_decimate_by(const f_array_length_t amount, f_uint32s_t *uint32s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint32s->size - amount > 0) { - return private_f_type_uint32s_adjust(uint32s->size - amount, uint32s); - } - - return private_f_type_uint32s_adjust(0, uint32s); - } -#endif // _di_f_type_uint32s_decimate_by_ - -#ifndef _di_f_type_uint32s_decrease_by_ - f_status_t f_type_uint32s_decrease_by(const f_array_length_t amount, f_uint32s_t *uint32s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint32s->size - amount > 0) { - return private_f_type_uint32s_resize(uint32s->size - amount, uint32s); - } - - return private_f_type_uint32s_resize(0, uint32s); - } -#endif // _di_f_type_uint32s_decrease_by_ - -#ifndef _di_f_type_uint32s_increase_ - f_status_t f_type_uint32s_increase(const uint16_t step, f_uint32s_t *uint32s) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!uint32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint32s->used + 1 > uint32s->size) { - f_array_length_t size = uint32s->used + step; - - if (size > F_array_length_t_size_d) { - if (uint32s->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_uint32s_resize(size, uint32s); - } - - return F_data_not; - } -#endif // _di_f_type_uint32s_increase_ - -#ifndef _di_f_type_uint32s_increase_by_ - f_status_t f_type_uint32s_increase_by(const f_array_length_t amount, f_uint32s_t *uint32s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint32s->used + amount > uint32s->size) { - if (uint32s->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_uint32s_resize(uint32s->used + amount, uint32s); - } - - return F_data_not; - } -#endif // _di_f_type_uint32s_increase_by_ - -#ifndef _di_f_type_uint32s_resize_ - f_status_t f_type_uint32s_resize(const f_array_length_t length, f_uint32s_t *uint32s) { - #ifndef _di_level_0_parameter_checking_ - if (!uint32s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint32s_resize(length, uint32s); - } -#endif // _di_f_type_uint32s_resize_ - -#ifndef _di_f_type_uint32ss_adjust_ - f_status_t f_type_uint32ss_adjust(const f_array_length_t length, f_uint32ss_t *uint32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!uint32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint32ss_adjust(length, uint32ss); - } -#endif // _di_f_type_uint32ss_adjust_ - -#ifndef _di_f_type_uint32ss_append_ - f_status_t f_type_uint32ss_append(const f_uint32ss_t source, f_uint32ss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_uint32ss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_uint32s_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_uint32ss_append_ - -#ifndef _di_f_type_uint32ss_decimate_by_ - f_status_t f_type_uint32ss_decimate_by(const f_array_length_t amount, f_uint32ss_t *uint32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint32ss->size - amount > 0) { - return private_f_type_uint32ss_adjust(uint32ss->size - amount, uint32ss); - } - - return private_f_type_uint32ss_adjust(0, uint32ss); - } -#endif // _di_f_type_uint32ss_decimate_by_ - -#ifndef _di_f_type_uint32ss_decrease_by_ - f_status_t f_type_uint32ss_decrease_by(const f_array_length_t amount, f_uint32ss_t *uint32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint32ss->size - amount > 0) { - return private_f_type_uint32ss_resize(uint32ss->size - amount, uint32ss); - } - - return private_f_type_uint32ss_resize(0, uint32ss); - } -#endif // _di_f_type_uint32ss_decrease_by_ - -#ifndef _di_f_type_uint32ss_increase_ - f_status_t f_type_uint32ss_increase(const uint16_t step, f_uint32ss_t *uint32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!uint32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint32ss->used + 1 > uint32ss->size) { - f_array_length_t size = uint32ss->used + step; - - if (size > F_array_length_t_size_d) { - if (uint32ss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_uint32ss_resize(size, uint32ss); - } - - return F_data_not; - } -#endif // _di_f_type_uint32ss_increase_ - -#ifndef _di_f_type_uint32ss_increase_by_ - f_status_t f_type_uint32ss_increase_by(const f_array_length_t amount, f_uint32ss_t *uint32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint32ss->used + amount > uint32ss->size) { - if (uint32ss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_uint32ss_resize(uint32ss->used + amount, uint32ss); - } - - return F_data_not; - } -#endif // _di_f_type_uint32ss_increase_by_ - -#ifndef _di_f_type_uint32ss_resize_ - f_status_t f_type_uint32ss_resize(const f_array_length_t length, f_uint32ss_t *uint32ss) { - #ifndef _di_level_0_parameter_checking_ - if (!uint32ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint32ss_resize(length, uint32ss); - } -#endif // _di_f_type_uint32ss_resize_ - -#ifndef _di_f_type_int64s_adjust_ - f_status_t f_type_int64s_adjust(const f_array_length_t length, f_int64s_t *int64s) { - #ifndef _di_level_0_parameter_checking_ - if (!int64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int64s_adjust(length, int64s); - } -#endif // _di_f_type_int64s_adjust_ - -#ifndef _di_f_type_int64s_append_ - f_status_t f_type_int64s_append(const f_int64s_t source, f_int64s_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_int64s_append(source, destination); - } -#endif // _di_f_type_int64s_append_ - -#ifndef _di_f_type_int64s_decimate_by_ - f_status_t f_type_int64s_decimate_by(const f_array_length_t amount, f_int64s_t *int64s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int64s->size - amount > 0) { - return private_f_type_int64s_adjust(int64s->size - amount, int64s); - } - - return private_f_type_int64s_adjust(0, int64s); - } -#endif // _di_f_type_int64s_decimate_by_ - -#ifndef _di_f_type_int64s_decrease_by_ - f_status_t f_type_int64s_decrease_by(const f_array_length_t amount, f_int64s_t *int64s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int64s->size - amount > 0) { - return private_f_type_int64s_resize(int64s->size - amount, int64s); - } - - return private_f_type_int64s_resize(0, int64s); - } -#endif // _di_f_type_int64s_decrease_by_ - -#ifndef _di_f_type_int64s_increase_ - f_status_t f_type_int64s_increase(const uint16_t step, f_int64s_t *int64s) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!int64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int64s->used + 1 > int64s->size) { - f_array_length_t size = int64s->used + step; - - if (size > F_array_length_t_size_d) { - if (int64s->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_int64s_resize(size, int64s); - } - - return F_data_not; - } -#endif // _di_f_type_int64s_increase_ - -#ifndef _di_f_type_int64s_increase_by_ - f_status_t f_type_int64s_increase_by(const f_array_length_t amount, f_int64s_t *int64s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int64s->used + amount > int64s->size) { - if (int64s->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_int64s_resize(int64s->used + amount, int64s); - } - - return F_data_not; - } -#endif // _di_f_type_int64s_increase_by_ - -#ifndef _di_f_type_int64s_resize_ - f_status_t f_type_int64s_resize(const f_array_length_t length, f_int64s_t *int64s) { - #ifndef _di_level_0_parameter_checking_ - if (!int64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int64s_resize(length, int64s); - } -#endif // _di_f_type_int64s_resize_ - -#ifndef _di_f_type_int64ss_adjust_ - f_status_t f_type_int64ss_adjust(const f_array_length_t length, f_int64ss_t *int64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!int64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int64ss_adjust(length, int64ss); - } -#endif // _di_f_type_int64ss_adjust_ - -#ifndef _di_f_type_int64ss_append_ - f_status_t f_type_int64ss_append(const f_int64ss_t source, f_int64ss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_int64ss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_int64s_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_int64ss_append_ - -#ifndef _di_f_type_int64ss_decimate_by_ - f_status_t f_type_int64ss_decimate_by(const f_array_length_t amount, f_int64ss_t *int64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int64ss->size - amount > 0) { - return private_f_type_int64ss_adjust(int64ss->size - amount, int64ss); - } - - return private_f_type_int64ss_adjust(0, int64ss); - } -#endif // _di_f_type_int64ss_decimate_by_ - -#ifndef _di_f_type_int64ss_decrease_by_ - f_status_t f_type_int64ss_decrease_by(const f_array_length_t amount, f_int64ss_t *int64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int64ss->size - amount > 0) { - return private_f_type_int64ss_resize(int64ss->size - amount, int64ss); - } - - return private_f_type_int64ss_resize(0, int64ss); - } -#endif // _di_f_type_int64ss_decrease_by_ - -#ifndef _di_f_type_int64ss_increase_ - f_status_t f_type_int64ss_increase(const uint16_t step, f_int64ss_t *int64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!int64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int64ss->used + 1 > int64ss->size) { - f_array_length_t size = int64ss->used + step; - - if (size > F_array_length_t_size_d) { - if (int64ss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_int64ss_resize(size, int64ss); - } - - return F_data_not; - } -#endif // _di_f_type_int64ss_increase_ - -#ifndef _di_f_type_int64ss_increase_by_ - f_status_t f_type_int64ss_increase_by(const f_array_length_t amount, f_int64ss_t *int64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int64ss->used + amount > int64ss->size) { - if (int64ss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_int64ss_resize(int64ss->used + amount, int64ss); - } - - return F_data_not; - } -#endif // _di_f_type_int64ss_increase_by_ - -#ifndef _di_f_type_int64ss_resize_ - f_status_t f_type_int64ss_resize(const f_array_length_t length, f_int64ss_t *int64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!int64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int64ss_resize(length, int64ss); - } -#endif // _di_f_type_int64ss_resize_ - -#ifndef _di_f_type_uint64s_adjust_ - f_status_t f_type_uint64s_adjust(const f_array_length_t length, f_uint64s_t *uint64s) { - #ifndef _di_level_0_parameter_checking_ - if (!uint64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint64s_adjust(length, uint64s); - } -#endif // _di_f_type_uint64s_adjust_ - -#ifndef _di_f_type_uint64s_append_ - f_status_t f_type_uint64s_append(const f_uint64s_t source, f_uint64s_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_uint64s_append(source, destination); - } -#endif // _di_f_type_uint64s_append_ - -#ifndef _di_f_type_uint64s_decimate_by_ - f_status_t f_type_uint64s_decimate_by(const f_array_length_t amount, f_uint64s_t *uint64s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint64s->size - amount > 0) { - return private_f_type_uint64s_adjust(uint64s->size - amount, uint64s); - } - - return private_f_type_uint64s_adjust(0, uint64s); - } -#endif // _di_f_type_uint64s_decimate_by_ - -#ifndef _di_f_type_uint64s_decrease_by_ - f_status_t f_type_uint64s_decrease_by(const f_array_length_t amount, f_uint64s_t *uint64s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint64s->size - amount > 0) { - return private_f_type_uint64s_resize(uint64s->size - amount, uint64s); - } - - return private_f_type_uint64s_resize(0, uint64s); - } -#endif // _di_f_type_uint64s_decrease_by_ - -#ifndef _di_f_type_uint64s_increase_ - f_status_t f_type_uint64s_increase(const uint16_t step, f_uint64s_t *uint64s) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!uint64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint64s->used + 1 > uint64s->size) { - f_array_length_t size = uint64s->used + step; - - if (size > F_array_length_t_size_d) { - if (uint64s->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_uint64s_resize(size, uint64s); - } - - return F_data_not; - } -#endif // _di_f_type_uint64s_increase_ - -#ifndef _di_f_type_uint64s_increase_by_ - f_status_t f_type_uint64s_increase_by(const f_array_length_t amount, f_uint64s_t *uint64s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint64s->used + amount > uint64s->size) { - if (uint64s->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_uint64s_resize(uint64s->used + amount, uint64s); - } - - return F_data_not; - } -#endif // _di_f_type_uint64s_increase_by_ - -#ifndef _di_f_type_uint64s_resize_ - f_status_t f_type_uint64s_resize(const f_array_length_t length, f_uint64s_t *uint64s) { - #ifndef _di_level_0_parameter_checking_ - if (!uint64s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint64s_resize(length, uint64s); - } -#endif // _di_f_type_uint64s_resize_ - -#ifndef _di_f_type_uint64ss_adjust_ - f_status_t f_type_uint64ss_adjust(const f_array_length_t length, f_uint64ss_t *uint64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!uint64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint64ss_adjust(length, uint64ss); - } -#endif // _di_f_type_uint64ss_adjust_ - -#ifndef _di_f_type_uint64ss_append_ - f_status_t f_type_uint64ss_append(const f_uint64ss_t source, f_uint64ss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_uint64ss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_uint64s_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_uint64ss_append_ - -#ifndef _di_f_type_uint64ss_decimate_by_ - f_status_t f_type_uint64ss_decimate_by(const f_array_length_t amount, f_uint64ss_t *uint64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint64ss->size - amount > 0) { - return private_f_type_uint64ss_adjust(uint64ss->size - amount, uint64ss); - } - - return private_f_type_uint64ss_adjust(0, uint64ss); - } -#endif // _di_f_type_uint64ss_decimate_by_ - -#ifndef _di_f_type_uint64ss_decrease_by_ - f_status_t f_type_uint64ss_decrease_by(const f_array_length_t amount, f_uint64ss_t *uint64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint64ss->size - amount > 0) { - return private_f_type_uint64ss_resize(uint64ss->size - amount, uint64ss); - } - - return private_f_type_uint64ss_resize(0, uint64ss); - } -#endif // _di_f_type_uint64ss_decrease_by_ - -#ifndef _di_f_type_uint64ss_increase_ - f_status_t f_type_uint64ss_increase(const uint16_t step, f_uint64ss_t *uint64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!uint64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint64ss->used + 1 > uint64ss->size) { - f_array_length_t size = uint64ss->used + step; - - if (size > F_array_length_t_size_d) { - if (uint64ss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_uint64ss_resize(size, uint64ss); - } - - return F_data_not; - } -#endif // _di_f_type_uint64ss_increase_ - -#ifndef _di_f_type_uint64ss_increase_by_ - f_status_t f_type_uint64ss_increase_by(const f_array_length_t amount, f_uint64ss_t *uint64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint64ss->used + amount > uint64ss->size) { - if (uint64ss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_uint64ss_resize(uint64ss->used + amount, uint64ss); - } - - return F_data_not; - } -#endif // _di_f_type_uint64ss_increase_by_ - -#ifndef _di_f_type_uint64ss_resize_ - f_status_t f_type_uint64ss_resize(const f_array_length_t length, f_uint64ss_t *uint64ss) { - #ifndef _di_level_0_parameter_checking_ - if (!uint64ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint64ss_resize(length, uint64ss); - } -#endif // _di_f_type_uint64ss_resize_ - -#ifndef _di_f_type_int128s_adjust_ - f_status_t f_type_int128s_adjust(const f_array_length_t length, f_int128s_t *int128s) { - #ifndef _di_level_0_parameter_checking_ - if (!int128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int128s_adjust(length, int128s); - } -#endif // _di_f_type_int128s_adjust_ - -#ifndef _di_f_type_int128s_append_ - f_status_t f_type_int128s_append(const f_int128s_t source, f_int128s_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_int128s_append(source, destination); - } -#endif // _di_f_type_int128s_append_ - -#ifndef _di_f_type_int128s_decimate_by_ - f_status_t f_type_int128s_decimate_by(const f_array_length_t amount, f_int128s_t *int128s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int128s->size - amount > 0) { - return private_f_type_int128s_adjust(int128s->size - amount, int128s); - } - - return private_f_type_int128s_adjust(0, int128s); - } -#endif // _di_f_type_int128s_decimate_by_ - -#ifndef _di_f_type_int128s_decrease_by_ - f_status_t f_type_int128s_decrease_by(const f_array_length_t amount, f_int128s_t *int128s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int128s->size - amount > 0) { - return private_f_type_int128s_resize(int128s->size - amount, int128s); - } - - return private_f_type_int128s_resize(0, int128s); - } -#endif // _di_f_type_int128s_decrease_by_ - -#ifndef _di_f_type_int128s_increase_ - f_status_t f_type_int128s_increase(const uint16_t step, f_int128s_t *int128s) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!int128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int128s->used + 1 > int128s->size) { - f_array_length_t size = int128s->used + step; - - if (size > F_array_length_t_size_d) { - if (int128s->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_int128s_resize(size, int128s); - } - - return F_data_not; - } -#endif // _di_f_type_int128s_increase_ - -#ifndef _di_f_type_int128s_increase_by_ - f_status_t f_type_int128s_increase_by(const f_array_length_t amount, f_int128s_t *int128s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int128s->used + amount > int128s->size) { - if (int128s->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_int128s_resize(int128s->used + amount, int128s); - } - - return F_data_not; - } -#endif // _di_f_type_int128s_increase_by_ - -#ifndef _di_f_type_int128s_resize_ - f_status_t f_type_int128s_resize(const f_array_length_t length, f_int128s_t *int128s) { - #ifndef _di_level_0_parameter_checking_ - if (!int128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int128s_resize(length, int128s); - } -#endif // _di_f_type_int128s_resize_ - -#ifndef _di_f_type_int128ss_adjust_ - f_status_t f_type_int128ss_adjust(const f_array_length_t length, f_int128ss_t *int128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!int128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int128ss_adjust(length, int128ss); - } -#endif // _di_f_type_int128ss_adjust_ - -#ifndef _di_f_type_int128ss_append_ - f_status_t f_type_int128ss_append(const f_int128ss_t source, f_int128ss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_int128ss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_int128s_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_int128ss_append_ - -#ifndef _di_f_type_int128ss_decimate_by_ - f_status_t f_type_int128ss_decimate_by(const f_array_length_t amount, f_int128ss_t *int128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int128ss->size - amount > 0) { - return private_f_type_int128ss_adjust(int128ss->size - amount, int128ss); - } - - return private_f_type_int128ss_adjust(0, int128ss); - } -#endif // _di_f_type_int128ss_decimate_by_ - -#ifndef _di_f_type_int128ss_decrease_by_ - f_status_t f_type_int128ss_decrease_by(const f_array_length_t amount, f_int128ss_t *int128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int128ss->size - amount > 0) { - return private_f_type_int128ss_resize(int128ss->size - amount, int128ss); - } - - return private_f_type_int128ss_resize(0, int128ss); - } -#endif // _di_f_type_int128ss_decrease_by_ - -#ifndef _di_f_type_int128ss_increase_ - f_status_t f_type_int128ss_increase(const uint16_t step, f_int128ss_t *int128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!int128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int128ss->used + 1 > int128ss->size) { - f_array_length_t size = int128ss->used + step; - - if (size > F_array_length_t_size_d) { - if (int128ss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_int128ss_resize(size, int128ss); - } - - return F_data_not; - } -#endif // _di_f_type_int128ss_increase_ - -#ifndef _di_f_type_int128ss_increase_by_ - f_status_t f_type_int128ss_increase_by(const f_array_length_t amount, f_int128ss_t *int128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!int128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (int128ss->used + amount > int128ss->size) { - if (int128ss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_int128ss_resize(int128ss->used + amount, int128ss); - } - - return F_data_not; - } -#endif // _di_f_type_int128ss_increase_by_ - -#ifndef _di_f_type_int128ss_resize_ - f_status_t f_type_int128ss_resize(const f_array_length_t length, f_int128ss_t *int128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!int128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_int128ss_resize(length, int128ss); - } -#endif // _di_f_type_int128ss_resize_ - -#ifndef _di_f_type_uint128s_adjust_ - f_status_t f_type_uint128s_adjust(const f_array_length_t length, f_uint128s_t *uint128s) { - #ifndef _di_level_0_parameter_checking_ - if (!uint128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint128s_adjust(length, uint128s); - } -#endif // _di_f_type_uint128s_adjust_ - -#ifndef _di_f_type_uint128s_append_ - f_status_t f_type_uint128s_append(const f_uint128s_t source, f_uint128s_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_type_uint128s_append(source, destination); - } -#endif // _di_f_type_uint128s_append_ - -#ifndef _di_f_type_uint128s_decimate_by_ - f_status_t f_type_uint128s_decimate_by(const f_array_length_t amount, f_uint128s_t *uint128s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint128s->size - amount > 0) { - return private_f_type_uint128s_adjust(uint128s->size - amount, uint128s); - } - - return private_f_type_uint128s_adjust(0, uint128s); - } -#endif // _di_f_type_uint128s_decimate_by_ - -#ifndef _di_f_type_uint128s_decrease_by_ - f_status_t f_type_uint128s_decrease_by(const f_array_length_t amount, f_uint128s_t *uint128s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint128s->size - amount > 0) { - return private_f_type_uint128s_resize(uint128s->size - amount, uint128s); - } - - return private_f_type_uint128s_resize(0, uint128s); - } -#endif // _di_f_type_uint128s_decrease_by_ - -#ifndef _di_f_type_uint128s_increase_ - f_status_t f_type_uint128s_increase(const uint16_t step, f_uint128s_t *uint128s) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!uint128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint128s->used + 1 > uint128s->size) { - f_array_length_t size = uint128s->used + step; - - if (size > F_array_length_t_size_d) { - if (uint128s->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_uint128s_resize(size, uint128s); - } - - return F_data_not; - } -#endif // _di_f_type_uint128s_increase_ - -#ifndef _di_f_type_uint128s_increase_by_ - f_status_t f_type_uint128s_increase_by(const f_array_length_t amount, f_uint128s_t *uint128s) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint128s->used + amount > uint128s->size) { - if (uint128s->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_uint128s_resize(uint128s->used + amount, uint128s); - } - - return F_data_not; - } -#endif // _di_f_type_uint128s_increase_by_ - -#ifndef _di_f_type_uint128s_resize_ - f_status_t f_type_uint128s_resize(const f_array_length_t length, f_uint128s_t *uint128s) { - #ifndef _di_level_0_parameter_checking_ - if (!uint128s) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint128s_resize(length, uint128s); - } -#endif // _di_f_type_uint128s_resize_ - -#ifndef _di_f_type_uint128ss_adjust_ - f_status_t f_type_uint128ss_adjust(const f_array_length_t length, f_uint128ss_t *uint128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!uint128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint128ss_adjust(length, uint128ss); - } -#endif // _di_f_type_uint128ss_adjust_ - -#ifndef _di_f_type_uint128ss_append_ - f_status_t f_type_uint128ss_append(const f_uint128ss_t source, f_uint128ss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = F_none; - - if (destination->used + source.used > destination->size) { - status = private_f_type_uint128ss_resize(destination->used + source.used, destination); - if (F_status_is_error(status)) return status; - } - - for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { - status = private_f_type_uint128s_append(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } // for - - return F_none; - } -#endif // _di_f_type_uint128ss_append_ - -#ifndef _di_f_type_uint128ss_decimate_by_ - f_status_t f_type_uint128ss_decimate_by(const f_array_length_t amount, f_uint128ss_t *uint128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint128ss->size - amount > 0) { - return private_f_type_uint128ss_adjust(uint128ss->size - amount, uint128ss); - } - - return private_f_type_uint128ss_adjust(0, uint128ss); - } -#endif // _di_f_type_uint128ss_decimate_by_ - -#ifndef _di_f_type_uint128ss_decrease_by_ - f_status_t f_type_uint128ss_decrease_by(const f_array_length_t amount, f_uint128ss_t *uint128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint128ss->size - amount > 0) { - return private_f_type_uint128ss_resize(uint128ss->size - amount, uint128ss); - } - - return private_f_type_uint128ss_resize(0, uint128ss); - } -#endif // _di_f_type_uint128ss_decrease_by_ - -#ifndef _di_f_type_uint128ss_increase_ - f_status_t f_type_uint128ss_increase(const uint16_t step, f_uint128ss_t *uint128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!step) return F_status_set_error(F_parameter); - if (!uint128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint128ss->used + 1 > uint128ss->size) { - f_array_length_t size = uint128ss->used + step; - - if (size > F_array_length_t_size_d) { - if (uint128ss->used + 1 > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - size = F_array_length_t_size_d; - } - - return private_f_type_uint128ss_resize(size, uint128ss); - } - - return F_data_not; - } -#endif // _di_f_type_uint128ss_increase_ - -#ifndef _di_f_type_uint128ss_increase_by_ - f_status_t f_type_uint128ss_increase_by(const f_array_length_t amount, f_uint128ss_t *uint128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!amount) return F_status_set_error(F_parameter); - if (!uint128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (uint128ss->used + amount > uint128ss->size) { - if (uint128ss->used + amount > F_array_length_t_size_d) { - return F_status_set_error(F_array_too_large); - } - - return private_f_type_uint128ss_resize(uint128ss->used + amount, uint128ss); - } - - return F_data_not; - } -#endif // _di_f_type_uint128ss_increase_by_ - -#ifndef _di_f_type_uint128ss_resize_ - f_status_t f_type_uint128ss_resize(const f_array_length_t length, f_uint128ss_t *uint128ss) { - #ifndef _di_level_0_parameter_checking_ - if (!uint128ss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_type_uint128ss_resize(length, uint128ss); - } -#endif // _di_f_type_uint128ss_resize_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array.h b/level_0/f_type_array/c/type_array.h index 0f3a83e..eb2c807 100644 --- a/level_0/f_type_array/c/type_array.h +++ b/level_0/f_type_array/c/type_array.h @@ -17,4994 +17,23 @@ #include #include -// fll-0 type_array includes +// FLL-0 type_array includes. #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef __cplusplus extern "C" { #endif -/** - * Resize the string statuss array. - * - * @param length - * The new size to use. - * @param statuss - * The string statuss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_statuss_adjust_ - extern f_status_t f_type_statuss_adjust(const f_array_length_t length, f_statuss_t *statuss); -#endif // _di_f_type_statuss_adjust_ - -/** - * Append the source statuss onto the destination. - * - * @param source - * The source statuss to append. - * @param destination - * The destination statuss the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statuss_append_ - extern f_status_t f_type_statuss_append(const f_statuss_t source, f_statuss_t *destination); -#endif // _di_f_type_statuss_append_ - -/** - * Resize the string statuss 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param statuss - * The string statuss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_statuss_decimate_by_ - extern f_status_t f_type_statuss_decimate_by(const f_array_length_t amount, f_statuss_t *statuss); -#endif // _di_f_type_statuss_decimate_by_ - -/** - * Resize the string statuss 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param statuss - * The string statuss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statuss_decrease_by_ - extern f_status_t f_type_statuss_decrease_by(const f_array_length_t amount, f_statuss_t *statuss); -#endif // _di_f_type_statuss_decrease_by_ - -/** - * Increase the size of the string statuss array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param statuss - * The string statuss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statuss_increase_ - extern f_status_t f_type_statuss_increase(const uint16_t step, f_statuss_t *statuss); -#endif // _di_f_type_statuss_increase_ - -/** - * Resize the string statuss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param statuss - * The string statuss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statuss_increase_by_ - extern f_status_t f_type_statuss_increase_by(const f_array_length_t amount, f_statuss_t *statuss); -#endif // _di_f_type_statuss_increase_by_ - -/** - * Resize the string statuss array. - * - * @param length - * The new size to use. - * @param statuss - * The string statuss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statuss_resize_ - extern f_status_t f_type_statuss_resize(const f_array_length_t length, f_statuss_t *statuss); -#endif // _di_f_type_statuss_resize_ - -/** - * Resize the string statusss array. - * - * @param length - * The new size to use. - * @param statusss - * The string statusss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_statusss_adjust_ - extern f_status_t f_type_statusss_adjust(const f_array_length_t length, f_statusss_t *statusss); -#endif // _di_f_type_statusss_adjust_ - -/** - * Append the source statusss onto the destination. - * - * @param source - * The source statusss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statusss_append_ - extern f_status_t f_type_statusss_append(const f_statusss_t source, f_statusss_t *destination); -#endif // _di_f_type_statusss_append_ - -/** - * Resize the string statusss array. - * - * @param length - * The new size to use. - * @param statusss - * The string statusss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_statusss_adjust_ - extern f_status_t f_type_statusss_adjust(const f_array_length_t length, f_statusss_t *statusss); -#endif // _di_f_type_statusss_adjust_ - -/** - * Resize the string statusss 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 statusss - * The string statusss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_statusss_decimate_by_ - extern f_status_t f_type_statusss_decimate_by(const f_array_length_t amount, f_statusss_t *statusss); -#endif // _di_f_type_statusss_decimate_by_ - -/** - * Resize the string statusss 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 statusss - * The string statusss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statusss_decrease_by_ - extern f_status_t f_type_statusss_decrease_by(const f_array_length_t amount, f_statusss_t *statusss); -#endif // _di_f_type_statusss_decrease_by_ - -/** - * Increase the size of the string statusss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param statusss - * The string statusss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statusss_increase_ - extern f_status_t f_type_statusss_increase(const uint16_t step, f_statusss_t *statusss); -#endif // _di_f_type_statusss_increase_ - -/** - * Resize the string statusss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param statusss - * The string statusss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statusss_increase_by_ - extern f_status_t f_type_statusss_increase_by(const f_array_length_t amount, f_statusss_t *statusss); -#endif // _di_f_type_statusss_increase_by_ - -/** - * Resize the string statusss array. - * - * @param length - * The new size to use. - * @param statusss - * The string statusss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statusss_resize_ - extern f_status_t f_type_statusss_resize(const f_array_length_t length, f_statusss_t *statusss); -#endif // _di_f_type_statusss_resize_ - -/** - * Resize the string states array. - * - * @param length - * The new size to use. - * @param states - * The string states array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_states_adjust_ - extern f_status_t f_type_states_adjust(const f_array_length_t length, f_states_t *states); -#endif // _di_f_type_states_adjust_ - -/** - * Append the source states onto the destination. - * - * @param source - * The source states to append. - * @param destination - * The destination states the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_states_append_ - extern f_status_t f_type_states_append(const f_states_t source, f_states_t *destination); -#endif // _di_f_type_states_append_ - -/** - * Resize the string states 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param states - * The string states array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_states_decimate_by_ - extern f_status_t f_type_states_decimate_by(const f_array_length_t amount, f_states_t *states); -#endif // _di_f_type_states_decimate_by_ - -/** - * Resize the string states 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param states - * The string states array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_states_decrease_by_ - extern f_status_t f_type_states_decrease_by(const f_array_length_t amount, f_states_t *states); -#endif // _di_f_type_states_decrease_by_ - -/** - * Increase the size of the string states array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param states - * The string states array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_states_increase_ - extern f_status_t f_type_states_increase(const uint16_t step, f_states_t *states); -#endif // _di_f_type_states_increase_ - -/** - * Resize the string states 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param states - * The string states array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_states_increase_by_ - extern f_status_t f_type_states_increase_by(const f_array_length_t amount, f_states_t *states); -#endif // _di_f_type_states_increase_by_ - -/** - * Resize the string states array. - * - * @param length - * The new size to use. - * @param states - * The string states array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_states_resize_ - extern f_status_t f_type_states_resize(const f_array_length_t length, f_states_t *states); -#endif // _di_f_type_states_resize_ - -/** - * Resize the string statess array. - * - * @param length - * The new size to use. - * @param statess - * The string statess array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_statess_adjust_ - extern f_status_t f_type_statess_adjust(const f_array_length_t length, f_statess_t *statess); -#endif // _di_f_type_statess_adjust_ - -/** - * Append the source statess onto the destination. - * - * @param source - * The source statess to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statess_append_ - extern f_status_t f_type_statess_append(const f_statess_t source, f_statess_t *destination); -#endif // _di_f_type_statess_append_ - -/** - * Resize the string statess array. - * - * @param length - * The new size to use. - * @param statess - * The string statess array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_statess_adjust_ - extern f_status_t f_type_statess_adjust(const f_array_length_t length, f_statess_t *statess); -#endif // _di_f_type_statess_adjust_ - -/** - * Resize the string statess 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 statess - * The string statess array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_statess_decimate_by_ - extern f_status_t f_type_statess_decimate_by(const f_array_length_t amount, f_statess_t *statess); -#endif // _di_f_type_statess_decimate_by_ - -/** - * Resize the string statess 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 statess - * The string statess array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statess_decrease_by_ - extern f_status_t f_type_statess_decrease_by(const f_array_length_t amount, f_statess_t *statess); -#endif // _di_f_type_statess_decrease_by_ - -/** - * Increase the size of the string statess 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param statess - * The string statess array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statess_increase_ - extern f_status_t f_type_statess_increase(const uint16_t step, f_statess_t *statess); -#endif // _di_f_type_statess_increase_ - -/** - * Resize the string statess 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param statess - * The string statess array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statess_increase_by_ - extern f_status_t f_type_statess_increase_by(const f_array_length_t amount, f_statess_t *statess); -#endif // _di_f_type_statess_increase_by_ - -/** - * Resize the string statess array. - * - * @param length - * The new size to use. - * @param statess - * The string statess array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_statess_resize_ - extern f_status_t f_type_statess_resize(const f_array_length_t length, f_statess_t *statess); -#endif // _di_f_type_statess_resize_ - -/** - * Resize the string cells array. - * - * @param length - * The new size to use. - * @param cells - * The string cells array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_cells_adjust_ - extern f_status_t f_type_cells_adjust(const f_array_length_t length, f_cells_t *cells); -#endif // _di_f_type_cells_adjust_ - -/** - * Append the source cells onto the destination. - * - * @param source - * The source cells to append. - * @param destination - * The destination cells the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_cells_append_ - extern f_status_t f_type_cells_append(const f_cells_t source, f_cells_t *destination); -#endif // _di_f_type_cells_append_ - -/** - * Resize the string cells 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param cells - * The string cells array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_cells_decimate_by_ - extern f_status_t f_type_cells_decimate_by(const f_array_length_t amount, f_cells_t *cells); -#endif // _di_f_type_cells_decimate_by_ - -/** - * Resize the string cells 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param cells - * The string cells array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_cells_decrease_by_ - extern f_status_t f_type_cells_decrease_by(const f_array_length_t amount, f_cells_t *cells); -#endif // _di_f_type_cells_decrease_by_ - -/** - * Increase the size of the string cells array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param cells - * The string cells array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_cells_increase_ - extern f_status_t f_type_cells_increase(const uint16_t step, f_cells_t *cells); -#endif // _di_f_type_cells_increase_ - -/** - * Resize the string cells 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param cells - * The string cells array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_cells_increase_by_ - extern f_status_t f_type_cells_increase_by(const f_array_length_t amount, f_cells_t *cells); -#endif // _di_f_type_cells_increase_by_ - -/** - * Resize the string cells array. - * - * @param length - * The new size to use. - * @param cells - * The string cells array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_cells_resize_ - extern f_status_t f_type_cells_resize(const f_array_length_t length, f_cells_t *cells); -#endif // _di_f_type_cells_resize_ - -/** - * Resize the string cellss array. - * - * @param length - * The new size to use. - * @param cellss - * The string cellss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_cellss_adjust_ - extern f_status_t f_type_cellss_adjust(const f_array_length_t length, f_cellss_t *cellss); -#endif // _di_f_type_cellss_adjust_ - -/** - * Append the source cellss onto the destination. - * - * @param source - * The source cellss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_cellss_append_ - extern f_status_t f_type_cellss_append(const f_cellss_t source, f_cellss_t *destination); -#endif // _di_f_type_cellss_append_ - -/** - * Resize the string cellss array. - * - * @param length - * The new size to use. - * @param cellss - * The string cellss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_cellss_adjust_ - extern f_status_t f_type_cellss_adjust(const f_array_length_t length, f_cellss_t *cellss); -#endif // _di_f_type_cellss_adjust_ - -/** - * Resize the string cellss 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 cellss - * The string cellss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_cellss_decimate_by_ - extern f_status_t f_type_cellss_decimate_by(const f_array_length_t amount, f_cellss_t *cellss); -#endif // _di_f_type_cellss_decimate_by_ - -/** - * Resize the string cellss 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 cellss - * The string cellss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_cellss_decrease_by_ - extern f_status_t f_type_cellss_decrease_by(const f_array_length_t amount, f_cellss_t *cellss); -#endif // _di_f_type_cellss_decrease_by_ - -/** - * Increase the size of the string cellss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param cellss - * The string cellss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_cellss_increase_ - extern f_status_t f_type_cellss_increase(const uint16_t step, f_cellss_t *cellss); -#endif // _di_f_type_cellss_increase_ - -/** - * Resize the string cellss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param cellss - * The string cellss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_cellss_increase_by_ - extern f_status_t f_type_cellss_increase_by(const f_array_length_t amount, f_cellss_t *cellss); -#endif // _di_f_type_cellss_increase_by_ - -/** - * Resize the string cellss array. - * - * @param length - * The new size to use. - * @param cellss - * The string cellss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_cellss_resize_ - extern f_status_t f_type_cellss_resize(const f_array_length_t length, f_cellss_t *cellss); -#endif // _di_f_type_cellss_resize_ - -/** - * Resize the string ids array. - * - * @param length - * The new size to use. - * @param ids - * The string ids array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_fll_ids_adjust_ - extern f_status_t f_type_fll_ids_adjust(const f_array_length_t length, f_fll_ids_t *ids); -#endif // _di_f_type_fll_ids_adjust_ - -/** - * Append the source ids onto the destination. - * - * @param source - * The source ids to append. - * @param destination - * The destination ids the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_fll_ids_append_ - extern f_status_t f_type_fll_ids_append(const f_fll_ids_t source, f_fll_ids_t *destination); -#endif // _di_f_type_fll_ids_append_ - -/** - * Resize the string ids 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param ids - * The string ids array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_fll_ids_decimate_by_ - extern f_status_t f_type_fll_ids_decimate_by(const f_array_length_t amount, f_fll_ids_t *ids); -#endif // _di_f_type_fll_ids_decimate_by_ - -/** - * Resize the string ids 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param ids - * The string ids array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_fll_ids_decrease_by_ - extern f_status_t f_type_fll_ids_decrease_by(const f_array_length_t amount, f_fll_ids_t *ids); -#endif // _di_f_type_fll_ids_decrease_by_ - -/** - * Increase the size of the string ids array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param ids - * The string ids array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_fll_ids_increase_ - extern f_status_t f_type_fll_ids_increase(const uint16_t step, f_fll_ids_t *ids); -#endif // _di_f_type_fll_ids_increase_ - -/** - * Resize the string ids 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param ids - * The string ids array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_fll_ids_increase_by_ - extern f_status_t f_type_fll_ids_increase_by(const f_array_length_t amount, f_fll_ids_t *ids); -#endif // _di_f_type_fll_ids_increase_by_ - -/** - * Resize the string ids array. - * - * @param length - * The new size to use. - * @param ids - * The string ids array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_fll_ids_resize_ - extern f_status_t f_type_fll_ids_resize(const f_array_length_t length, f_fll_ids_t *ids); -#endif // _di_f_type_fll_ids_resize_ - -/** - * Resize the string idss array. - * - * @param length - * The new size to use. - * @param idss - * The string idss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_fll_idss_adjust_ - extern f_status_t f_type_fll_idss_adjust(const f_array_length_t length, f_fll_idss_t *idss); -#endif // _di_f_type_fll_idss_adjust_ - -/** - * Append the source idss onto the destination. - * - * @param source - * The source idss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_fll_idss_append_ - extern f_status_t f_type_fll_idss_append(const f_fll_idss_t source, f_fll_idss_t *destination); -#endif // _di_f_type_fll_idss_append_ - -/** - * Resize the string idss array. - * - * @param length - * The new size to use. - * @param idss - * The string idss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_fll_idss_adjust_ - extern f_status_t f_type_fll_idss_adjust(const f_array_length_t length, f_fll_idss_t *idss); -#endif // _di_f_type_fll_idss_adjust_ - -/** - * Resize the string idss 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 idss - * The string idss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_fll_idss_decimate_by_ - extern f_status_t f_type_fll_idss_decimate_by(const f_array_length_t amount, f_fll_idss_t *idss); -#endif // _di_f_type_fll_idss_decimate_by_ - -/** - * Resize the string idss 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 idss - * The string idss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_fll_idss_decrease_by_ - extern f_status_t f_type_fll_idss_decrease_by(const f_array_length_t amount, f_fll_idss_t *idss); -#endif // _di_f_type_fll_idss_decrease_by_ - -/** - * Increase the size of the string idss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param idss - * The string idss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_fll_idss_increase_ - extern f_status_t f_type_fll_idss_increase(const uint16_t step, f_fll_idss_t *idss); -#endif // _di_f_type_fll_idss_increase_ - -/** - * Resize the string idss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param idss - * The string idss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_fll_idss_increase_by_ - extern f_status_t f_type_fll_idss_increase_by(const f_array_length_t amount, f_fll_idss_t *idss); -#endif // _di_f_type_fll_idss_increase_by_ - -/** - * Resize the string idss array. - * - * @param length - * The new size to use. - * @param idss - * The string idss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_fll_idss_resize_ - extern f_status_t f_type_fll_idss_resize(const f_array_length_t length, f_fll_idss_t *idss); -#endif // _di_f_type_fll_idss_resize_ - -/** - * Resize the string lengths array. - * - * @param length - * The new size to use. - * @param lengths - * The string lengths array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_array_lengths_adjust_ - extern f_status_t f_type_array_lengths_adjust(const f_array_length_t length, f_array_lengths_t *lengths); -#endif // _di_f_type_array_lengths_adjust_ - -/** - * Append the source lengths onto the destination. - * - * @param source - * The source lengths to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_array_lengths_append_ - extern f_status_t f_type_array_lengths_append(const f_array_lengths_t source, f_array_lengths_t *destination); -#endif // _di_f_type_array_lengths_append_ - -/** - * Resize the string lengths 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param lengths - * The string lengths array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_array_lengths_decimate_by_ - extern f_status_t f_type_array_lengths_decimate_by(const f_array_length_t amount, f_array_lengths_t *lengths); -#endif // _di_f_type_array_lengths_decimate_by_ - -/** - * Resize the string lengths 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param lengths - * The string lengths array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_array_lengths_decrease_by_ - extern f_status_t f_type_array_lengths_decrease_by(const f_array_length_t amount, f_array_lengths_t *lengths); -#endif // _di_f_type_array_lengths_decrease_by_ - -/** - * Increase the size of the string lengths array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param lengths - * The string lengths array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_array_lengths_increase_ - extern f_status_t f_type_array_lengths_increase(const uint16_t step, f_array_lengths_t *lengths); -#endif // _di_f_type_array_lengths_increase_ - -/** - * Resize the string lengths 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param lengths - * The string lengths array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_array_lengths_increase_by_ - extern f_status_t f_type_array_lengths_increase_by(const f_array_length_t amount, f_array_lengths_t *lengths); -#endif // _di_f_type_array_lengths_increase_by_ - -/** - * Resize the string lengths array. - * - * @param length - * The new size to use. - * @param lengths - * The string lengths array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_array_lengths_resize_ - extern f_status_t f_type_array_lengths_resize(const f_array_length_t length, f_array_lengths_t *lengths); -#endif // _di_f_type_array_lengths_resize_ - -/** - * Resize the string lengthss array. - * - * @param length - * The new size to use. - * @param lengthss - * The string lengthss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_array_lengthss_adjust_ - extern f_status_t f_type_array_lengthss_adjust(const f_array_length_t length, f_array_lengthss_t *lengthss); -#endif // _di_f_type_array_lengthss_adjust_ - -/** - * Append the source lengthss onto the destination. - * - * @param source - * The source lengthss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_array_lengthss_append_ - extern f_status_t f_type_array_lengthss_append(const f_array_lengthss_t source, f_array_lengthss_t *destination); -#endif // _di_f_type_array_lengthss_append_ - -/** - * Resize the string lengthss array. - * - * @param length - * The new size to use. - * @param lengthss - * The string lengthss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_array_lengthss_adjust_ - extern f_status_t f_type_array_lengthss_adjust(const f_array_length_t length, f_array_lengthss_t *lengthss); -#endif // _di_f_type_array_lengthss_adjust_ - -/** - * Resize the string lengthss 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 lengthss - * The string lengthss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_array_lengthss_decimate_by_ - extern f_status_t f_type_array_lengthss_decimate_by(const f_array_length_t amount, f_array_lengthss_t *lengthss); -#endif // _di_f_type_array_lengthss_decimate_by_ - -/** - * Resize the string lengthss 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 lengthss - * The string lengthss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_array_lengthss_decrease_by_ - extern f_status_t f_type_array_lengthss_decrease_by(const f_array_length_t amount, f_array_lengthss_t *lengthss); -#endif // _di_f_type_array_lengthss_decrease_by_ - -/** - * Increase the size of the string lengthss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param lengthss - * The string lengthss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_array_lengthss_increase_ - extern f_status_t f_type_array_lengthss_increase(const uint16_t step, f_array_lengthss_t *lengthss); -#endif // _di_f_type_array_lengthss_increase_ - -/** - * Resize the string lengthss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param lengthss - * The string lengthss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_array_lengthss_increase_by_ - extern f_status_t f_type_array_lengthss_increase_by(const f_array_length_t amount, f_array_lengthss_t *lengthss); -#endif // _di_f_type_array_lengthss_increase_by_ - -/** - * Resize the string lengthss array. - * - * @param length - * The new size to use. - * @param lengthss - * The string lengthss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_array_lengthss_resize_ - extern f_status_t f_type_array_lengthss_resize(const f_array_length_t length, f_array_lengthss_t *lengthss); -#endif // _di_f_type_array_lengthss_resize_ - -/** - * Resize the int8s array. - * - * @param length - * The new size to use. - * @param int8s - * The int8s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_int8s_adjust_ - extern f_status_t f_type_int8s_adjust(const f_array_length_t length, f_int8s_t *int8s); -#endif // _di_f_type_int8s_adjust_ - -/** - * Append the source int8s onto the destination. - * - * @param source - * The source int8s to append. - * @param destination - * The destination int8s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int8s_append_ - extern f_status_t f_type_int8s_append(const f_int8s_t source, f_int8s_t *destination); -#endif // _di_f_type_int8s_append_ - -/** - * Resize the int8s 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param int8s - * The int8s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_int8s_decimate_by_ - extern f_status_t f_type_int8s_decimate_by(const f_array_length_t amount, f_int8s_t *int8s); -#endif // _di_f_type_int8s_decimate_by_ - -/** - * Resize the int8s 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param int8s - * The int8s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int8s_decrease_by_ - extern f_status_t f_type_int8s_decrease_by(const f_array_length_t amount, f_int8s_t *int8s); -#endif // _di_f_type_int8s_decrease_by_ - -/** - * Increase the size of the int8s array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param int8s - * The int8s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int8s_increase_ - extern f_status_t f_type_int8s_increase(const uint16_t step, f_int8s_t *int8s); -#endif // _di_f_type_int8s_increase_ - -/** - * Resize the int8s 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param int8s - * The int8s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int8s_increase_by_ - extern f_status_t f_type_int8s_increase_by(const f_array_length_t amount, f_int8s_t *int8s); -#endif // _di_f_type_int8s_increase_by_ - -/** - * Resize the int8s array. - * - * @param length - * The new size to use. - * @param int8s - * The int8s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int8s_resize_ - extern f_status_t f_type_int8s_resize(const f_array_length_t length, f_int8s_t *int8s); -#endif // _di_f_type_int8s_resize_ - -/** - * Resize the int8ss array. - * - * @param length - * The new size to use. - * @param int8ss - * The int8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int8ss_adjust_ - extern f_status_t f_type_int8ss_adjust(const f_array_length_t length, f_int8ss_t *int8ss); -#endif // _di_f_type_int8ss_adjust_ - -/** - * Append the source int8ss onto the destination. - * - * @param source - * The source int8ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int8ss_append_ - extern f_status_t f_type_int8ss_append(const f_int8ss_t source, f_int8ss_t *destination); -#endif // _di_f_type_int8ss_append_ - -/** - * Resize the int8ss array. - * - * @param length - * The new size to use. - * @param int8ss - * The int8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int8ss_adjust_ - extern f_status_t f_type_int8ss_adjust(const f_array_length_t length, f_int8ss_t *int8ss); -#endif // _di_f_type_int8ss_adjust_ - -/** - * Resize the int8ss 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 int8ss - * The int8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int8ss_decimate_by_ - extern f_status_t f_type_int8ss_decimate_by(const f_array_length_t amount, f_int8ss_t *int8ss); -#endif // _di_f_type_int8ss_decimate_by_ - -/** - * Resize the int8ss 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 int8ss - * The int8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int8ss_decrease_by_ - extern f_status_t f_type_int8ss_decrease_by(const f_array_length_t amount, f_int8ss_t *int8ss); -#endif // _di_f_type_int8ss_decrease_by_ - -/** - * Increase the size of the int8ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param int8ss - * The int8ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int8ss_increase_ - extern f_status_t f_type_int8ss_increase(const uint16_t step, f_int8ss_t *int8ss); -#endif // _di_f_type_int8ss_increase_ - -/** - * Resize the int8ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param int8ss - * The int8ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int8ss_increase_by_ - extern f_status_t f_type_int8ss_increase_by(const f_array_length_t amount, f_int8ss_t *int8ss); -#endif // _di_f_type_int8ss_increase_by_ - -/** - * Resize the int8ss array. - * - * @param length - * The new size to use. - * @param int8ss - * The int8ss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int8ss_resize_ - extern f_status_t f_type_int8ss_resize(const f_array_length_t length, f_int8ss_t *int8ss); -#endif // _di_f_type_int8ss_resize_ - -/** - * Resize the string uint8s array. - * - * @param length - * The new size to use. - * @param uint8s - * The string uint8s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_uint8s_adjust_ - extern f_status_t f_type_uint8s_adjust(const f_array_length_t length, f_uint8s_t *uint8s); -#endif // _di_f_type_uint8s_adjust_ - -/** - * Append the source uint8s onto the destination. - * - * @param source - * The source uint8s to append. - * @param destination - * The destination uint8s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint8s_append_ - extern f_status_t f_type_uint8s_append(const f_uint8s_t source, f_uint8s_t *destination); -#endif // _di_f_type_uint8s_append_ - -/** - * Resize the string uint8s 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param uint8s - * The string uint8s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_uint8s_decimate_by_ - extern f_status_t f_type_uint8s_decimate_by(const f_array_length_t amount, f_uint8s_t *uint8s); -#endif // _di_f_type_uint8s_decimate_by_ - -/** - * Resize the string uint8s 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param uint8s - * The string uint8s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint8s_decrease_by_ - extern f_status_t f_type_uint8s_decrease_by(const f_array_length_t amount, f_uint8s_t *uint8s); -#endif // _di_f_type_uint8s_decrease_by_ - -/** - * Increase the size of the string uint8s array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param uint8s - * The string uint8s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint8s_increase_ - extern f_status_t f_type_uint8s_increase(const uint16_t step, f_uint8s_t *uint8s); -#endif // _di_f_type_uint8s_increase_ - -/** - * Resize the string uint8s 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param uint8s - * The string uint8s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint8s_increase_by_ - extern f_status_t f_type_uint8s_increase_by(const f_array_length_t amount, f_uint8s_t *uint8s); -#endif // _di_f_type_uint8s_increase_by_ - -/** - * Resize the string uint8s array. - * - * @param length - * The new size to use. - * @param uint8s - * The string uint8s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint8s_resize_ - extern f_status_t f_type_uint8s_resize(const f_array_length_t length, f_uint8s_t *uint8s); -#endif // _di_f_type_uint8s_resize_ - -/** - * Resize the string uint8ss array. - * - * @param length - * The new size to use. - * @param uint8ss - * The string uint8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint8ss_adjust_ - extern f_status_t f_type_uint8ss_adjust(const f_array_length_t length, f_uint8ss_t *uint8ss); -#endif // _di_f_type_uint8ss_adjust_ - -/** - * Append the source uint8ss onto the destination. - * - * @param source - * The source uint8ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint8ss_append_ - extern f_status_t f_type_uint8ss_append(const f_uint8ss_t source, f_uint8ss_t *destination); -#endif // _di_f_type_uint8ss_append_ - -/** - * Resize the string uint8ss array. - * - * @param length - * The new size to use. - * @param uint8ss - * The string uint8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint8ss_adjust_ - extern f_status_t f_type_uint8ss_adjust(const f_array_length_t length, f_uint8ss_t *uint8ss); -#endif // _di_f_type_uint8ss_adjust_ - -/** - * Resize the string uint8ss 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 uint8ss - * The string uint8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint8ss_decimate_by_ - extern f_status_t f_type_uint8ss_decimate_by(const f_array_length_t amount, f_uint8ss_t *uint8ss); -#endif // _di_f_type_uint8ss_decimate_by_ - -/** - * Resize the string uint8ss 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 uint8ss - * The string uint8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint8ss_decrease_by_ - extern f_status_t f_type_uint8ss_decrease_by(const f_array_length_t amount, f_uint8ss_t *uint8ss); -#endif // _di_f_type_uint8ss_decrease_by_ - -/** - * Increase the size of the string uint8ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param uint8ss - * The string uint8ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint8ss_increase_ - extern f_status_t f_type_uint8ss_increase(const uint16_t step, f_uint8ss_t *uint8ss); -#endif // _di_f_type_uint8ss_increase_ - -/** - * Resize the string uint8ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param uint8ss - * The string uint8ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint8ss_increase_by_ - extern f_status_t f_type_uint8ss_increase_by(const f_array_length_t amount, f_uint8ss_t *uint8ss); -#endif // _di_f_type_uint8ss_increase_by_ - -/** - * Resize the string uint8ss array. - * - * @param length - * The new size to use. - * @param uint8ss - * The string uint8ss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint8ss_resize_ - extern f_status_t f_type_uint8ss_resize(const f_array_length_t length, f_uint8ss_t *uint8ss); -#endif // _di_f_type_uint8ss_resize_ - -/** - * Resize the int16s array. - * - * @param length - * The new size to use. - * @param int16s - * The int16s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_int16s_adjust_ - extern f_status_t f_type_int16s_adjust(const f_array_length_t length, f_int16s_t *int16s); -#endif // _di_f_type_int16s_adjust_ - -/** - * Append the source int16s onto the destination. - * - * @param source - * The source int16s to append. - * @param destination - * The destination int16s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int16s_append_ - extern f_status_t f_type_int16s_append(const f_int16s_t source, f_int16s_t *destination); -#endif // _di_f_type_int16s_append_ - -/** - * Resize the int16s 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param int16s - * The int16s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_int16s_decimate_by_ - extern f_status_t f_type_int16s_decimate_by(const f_array_length_t amount, f_int16s_t *int16s); -#endif // _di_f_type_int16s_decimate_by_ - -/** - * Resize the int16s 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param int16s - * The int16s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int16s_decrease_by_ - extern f_status_t f_type_int16s_decrease_by(const f_array_length_t amount, f_int16s_t *int16s); -#endif // _di_f_type_int16s_decrease_by_ - -/** - * Increase the size of the int16s array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param int16s - * The int16s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int16s_increase_ - extern f_status_t f_type_int16s_increase(const uint16_t step, f_int16s_t *int16s); -#endif // _di_f_type_int16s_increase_ - -/** - * Resize the int16s 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param int16s - * The int16s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int16s_increase_by_ - extern f_status_t f_type_int16s_increase_by(const f_array_length_t amount, f_int16s_t *int16s); -#endif // _di_f_type_int16s_increase_by_ - -/** - * Resize the int16s array. - * - * @param length - * The new size to use. - * @param int16s - * The int16s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int16s_resize_ - extern f_status_t f_type_int16s_resize(const f_array_length_t length, f_int16s_t *int16s); -#endif // _di_f_type_int16s_resize_ - -/** - * Resize the int16ss array. - * - * @param length - * The new size to use. - * @param int16ss - * The int16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int16ss_adjust_ - extern f_status_t f_type_int16ss_adjust(const f_array_length_t length, f_int16ss_t *int16ss); -#endif // _di_f_type_int16ss_adjust_ - -/** - * Append the source int16ss onto the destination. - * - * @param source - * The source int16ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int16ss_append_ - extern f_status_t f_type_int16ss_append(const f_int16ss_t source, f_int16ss_t *destination); -#endif // _di_f_type_int16ss_append_ - -/** - * Resize the int16ss array. - * - * @param length - * The new size to use. - * @param int16ss - * The int16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int16ss_adjust_ - extern f_status_t f_type_int16ss_adjust(const f_array_length_t length, f_int16ss_t *int16ss); -#endif // _di_f_type_int16ss_adjust_ - -/** - * Resize the int16ss 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 int16ss - * The int16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int16ss_decimate_by_ - extern f_status_t f_type_int16ss_decimate_by(const f_array_length_t amount, f_int16ss_t *int16ss); -#endif // _di_f_type_int16ss_decimate_by_ - -/** - * Resize the int16ss 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 int16ss - * The int16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int16ss_decrease_by_ - extern f_status_t f_type_int16ss_decrease_by(const f_array_length_t amount, f_int16ss_t *int16ss); -#endif // _di_f_type_int16ss_decrease_by_ - -/** - * Increase the size of the int16ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param int16ss - * The int16ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int16ss_increase_ - extern f_status_t f_type_int16ss_increase(const uint16_t step, f_int16ss_t *int16ss); -#endif // _di_f_type_int16ss_increase_ - -/** - * Resize the int16ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param int16ss - * The int16ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int16ss_increase_by_ - extern f_status_t f_type_int16ss_increase_by(const f_array_length_t amount, f_int16ss_t *int16ss); -#endif // _di_f_type_int16ss_increase_by_ - -/** - * Resize the int16ss array. - * - * @param length - * The new size to use. - * @param int16ss - * The int16ss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int16ss_resize_ - extern f_status_t f_type_int16ss_resize(const f_array_length_t length, f_int16ss_t *int16ss); -#endif // _di_f_type_int16ss_resize_ - -/** - * Resize the string uint16s array. - * - * @param length - * The new size to use. - * @param uint16s - * The string uint16s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_uint16s_adjust_ - extern f_status_t f_type_uint16s_adjust(const f_array_length_t length, f_uint16s_t *uint16s); -#endif // _di_f_type_uint16s_adjust_ - -/** - * Append the source uint16s onto the destination. - * - * @param source - * The source uint16s to append. - * @param destination - * The destination uint16s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint16s_append_ - extern f_status_t f_type_uint16s_append(const f_uint16s_t source, f_uint16s_t *destination); -#endif // _di_f_type_uint16s_append_ - -/** - * Resize the string uint16s 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param uint16s - * The string uint16s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_uint16s_decimate_by_ - extern f_status_t f_type_uint16s_decimate_by(const f_array_length_t amount, f_uint16s_t *uint16s); -#endif // _di_f_type_uint16s_decimate_by_ - -/** - * Resize the string uint16s 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param uint16s - * The string uint16s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint16s_decrease_by_ - extern f_status_t f_type_uint16s_decrease_by(const f_array_length_t amount, f_uint16s_t *uint16s); -#endif // _di_f_type_uint16s_decrease_by_ - -/** - * Increase the size of the string uint16s array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param uint16s - * The string uint16s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint16s_increase_ - extern f_status_t f_type_uint16s_increase(const uint16_t step, f_uint16s_t *uint16s); -#endif // _di_f_type_uint16s_increase_ - -/** - * Resize the string uint16s 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param uint16s - * The string uint16s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint16s_increase_by_ - extern f_status_t f_type_uint16s_increase_by(const f_array_length_t amount, f_uint16s_t *uint16s); -#endif // _di_f_type_uint16s_increase_by_ - -/** - * Resize the string uint16s array. - * - * @param length - * The new size to use. - * @param uint16s - * The string uint16s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint16s_resize_ - extern f_status_t f_type_uint16s_resize(const f_array_length_t length, f_uint16s_t *uint16s); -#endif // _di_f_type_uint16s_resize_ - -/** - * Resize the string uint16ss array. - * - * @param length - * The new size to use. - * @param uint16ss - * The string uint16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint16ss_adjust_ - extern f_status_t f_type_uint16ss_adjust(const f_array_length_t length, f_uint16ss_t *uint16ss); -#endif // _di_f_type_uint16ss_adjust_ - -/** - * Append the source uint16ss onto the destination. - * - * @param source - * The source uint16ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint16ss_append_ - extern f_status_t f_type_uint16ss_append(const f_uint16ss_t source, f_uint16ss_t *destination); -#endif // _di_f_type_uint16ss_append_ - -/** - * Resize the string uint16ss array. - * - * @param length - * The new size to use. - * @param uint16ss - * The string uint16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint16ss_adjust_ - extern f_status_t f_type_uint16ss_adjust(const f_array_length_t length, f_uint16ss_t *uint16ss); -#endif // _di_f_type_uint16ss_adjust_ - -/** - * Resize the string uint16ss 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 uint16ss - * The string uint16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint16ss_decimate_by_ - extern f_status_t f_type_uint16ss_decimate_by(const f_array_length_t amount, f_uint16ss_t *uint16ss); -#endif // _di_f_type_uint16ss_decimate_by_ - -/** - * Resize the string uint16ss 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 uint16ss - * The string uint16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint16ss_decrease_by_ - extern f_status_t f_type_uint16ss_decrease_by(const f_array_length_t amount, f_uint16ss_t *uint16ss); -#endif // _di_f_type_uint16ss_decrease_by_ - -/** - * Increase the size of the string uint16ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param uint16ss - * The string uint16ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint16ss_increase_ - extern f_status_t f_type_uint16ss_increase(const uint16_t step, f_uint16ss_t *uint16ss); -#endif // _di_f_type_uint16ss_increase_ - -/** - * Resize the string uint16ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param uint16ss - * The string uint16ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint16ss_increase_by_ - extern f_status_t f_type_uint16ss_increase_by(const f_array_length_t amount, f_uint16ss_t *uint16ss); -#endif // _di_f_type_uint16ss_increase_by_ - -/** - * Resize the string uint16ss array. - * - * @param length - * The new size to use. - * @param uint16ss - * The string uint16ss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint16ss_resize_ - extern f_status_t f_type_uint16ss_resize(const f_array_length_t length, f_uint16ss_t *uint16ss); -#endif // _di_f_type_uint16ss_resize_ - -/** - * Resize the int32s array. - * - * @param length - * The new size to use. - * @param int32s - * The int32s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_int32s_adjust_ - extern f_status_t f_type_int32s_adjust(const f_array_length_t length, f_int32s_t *int32s); -#endif // _di_f_type_int32s_adjust_ - -/** - * Append the source int32s onto the destination. - * - * @param source - * The source int32s to append. - * @param destination - * The destination int32s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int32s_append_ - extern f_status_t f_type_int32s_append(const f_int32s_t source, f_int32s_t *destination); -#endif // _di_f_type_int32s_append_ - -/** - * Resize the int32s 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param int32s - * The int32s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_int32s_decimate_by_ - extern f_status_t f_type_int32s_decimate_by(const f_array_length_t amount, f_int32s_t *int32s); -#endif // _di_f_type_int32s_decimate_by_ - -/** - * Resize the int32s 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param int32s - * The int32s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int32s_decrease_by_ - extern f_status_t f_type_int32s_decrease_by(const f_array_length_t amount, f_int32s_t *int32s); -#endif // _di_f_type_int32s_decrease_by_ - -/** - * Increase the size of the int32s array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param int32s - * The int32s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int32s_increase_ - extern f_status_t f_type_int32s_increase(const uint16_t step, f_int32s_t *int32s); -#endif // _di_f_type_int32s_increase_ - -/** - * Resize the int32s 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param int32s - * The int32s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int32s_increase_by_ - extern f_status_t f_type_int32s_increase_by(const f_array_length_t amount, f_int32s_t *int32s); -#endif // _di_f_type_int32s_increase_by_ - -/** - * Resize the int32s array. - * - * @param length - * The new size to use. - * @param int32s - * The int32s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int32s_resize_ - extern f_status_t f_type_int32s_resize(const f_array_length_t length, f_int32s_t *int32s); -#endif // _di_f_type_int32s_resize_ - -/** - * Resize the int32ss array. - * - * @param length - * The new size to use. - * @param int32ss - * The int32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int32ss_adjust_ - extern f_status_t f_type_int32ss_adjust(const f_array_length_t length, f_int32ss_t *int32ss); -#endif // _di_f_type_int32ss_adjust_ - -/** - * Append the source int32ss onto the destination. - * - * @param source - * The source int32ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int32ss_append_ - extern f_status_t f_type_int32ss_append(const f_int32ss_t source, f_int32ss_t *destination); -#endif // _di_f_type_int32ss_append_ - -/** - * Resize the int32ss array. - * - * @param length - * The new size to use. - * @param int32ss - * The int32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int32ss_adjust_ - extern f_status_t f_type_int32ss_adjust(const f_array_length_t length, f_int32ss_t *int32ss); -#endif // _di_f_type_int32ss_adjust_ - -/** - * Resize the int32ss 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 int32ss - * The int32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int32ss_decimate_by_ - extern f_status_t f_type_int32ss_decimate_by(const f_array_length_t amount, f_int32ss_t *int32ss); -#endif // _di_f_type_int32ss_decimate_by_ - -/** - * Resize the int32ss 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 int32ss - * The int32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int32ss_decrease_by_ - extern f_status_t f_type_int32ss_decrease_by(const f_array_length_t amount, f_int32ss_t *int32ss); -#endif // _di_f_type_int32ss_decrease_by_ - -/** - * Increase the size of the int32ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param int32ss - * The int32ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int32ss_increase_ - extern f_status_t f_type_int32ss_increase(const uint16_t step, f_int32ss_t *int32ss); -#endif // _di_f_type_int32ss_increase_ - -/** - * Resize the int32ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param int32ss - * The int32ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int32ss_increase_by_ - extern f_status_t f_type_int32ss_increase_by(const f_array_length_t amount, f_int32ss_t *int32ss); -#endif // _di_f_type_int32ss_increase_by_ - -/** - * Resize the int32ss array. - * - * @param length - * The new size to use. - * @param int32ss - * The int32ss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int32ss_resize_ - extern f_status_t f_type_int32ss_resize(const f_array_length_t length, f_int32ss_t *int32ss); -#endif // _di_f_type_int32ss_resize_ - -/** - * Resize the string uint32s array. - * - * @param length - * The new size to use. - * @param uint32s - * The string uint32s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_uint32s_adjust_ - extern f_status_t f_type_uint32s_adjust(const f_array_length_t length, f_uint32s_t *uint32s); -#endif // _di_f_type_uint32s_adjust_ - -/** - * Append the source uint32s onto the destination. - * - * @param source - * The source uint32s to append. - * @param destination - * The destination uint32s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint32s_append_ - extern f_status_t f_type_uint32s_append(const f_uint32s_t source, f_uint32s_t *destination); -#endif // _di_f_type_uint32s_append_ - -/** - * Resize the string uint32s 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param uint32s - * The string uint32s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_uint32s_decimate_by_ - extern f_status_t f_type_uint32s_decimate_by(const f_array_length_t amount, f_uint32s_t *uint32s); -#endif // _di_f_type_uint32s_decimate_by_ - -/** - * Resize the string uint32s 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param uint32s - * The string uint32s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint32s_decrease_by_ - extern f_status_t f_type_uint32s_decrease_by(const f_array_length_t amount, f_uint32s_t *uint32s); -#endif // _di_f_type_uint32s_decrease_by_ - -/** - * Increase the size of the string uint32s array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param uint32s - * The string uint32s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint32s_increase_ - extern f_status_t f_type_uint32s_increase(const uint16_t step, f_uint32s_t *uint32s); -#endif // _di_f_type_uint32s_increase_ - -/** - * Resize the string uint32s 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param uint32s - * The string uint32s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint32s_increase_by_ - extern f_status_t f_type_uint32s_increase_by(const f_array_length_t amount, f_uint32s_t *uint32s); -#endif // _di_f_type_uint32s_increase_by_ - -/** - * Resize the string uint32s array. - * - * @param length - * The new size to use. - * @param uint32s - * The string uint32s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint32s_resize_ - extern f_status_t f_type_uint32s_resize(const f_array_length_t length, f_uint32s_t *uint32s); -#endif // _di_f_type_uint32s_resize_ - -/** - * Resize the string uint32ss array. - * - * @param length - * The new size to use. - * @param uint32ss - * The string uint32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint32ss_adjust_ - extern f_status_t f_type_uint32ss_adjust(const f_array_length_t length, f_uint32ss_t *uint32ss); -#endif // _di_f_type_uint32ss_adjust_ - -/** - * Append the source uint32ss onto the destination. - * - * @param source - * The source uint32ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint32ss_append_ - extern f_status_t f_type_uint32ss_append(const f_uint32ss_t source, f_uint32ss_t *destination); -#endif // _di_f_type_uint32ss_append_ - -/** - * Resize the string uint32ss array. - * - * @param length - * The new size to use. - * @param uint32ss - * The string uint32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint32ss_adjust_ - extern f_status_t f_type_uint32ss_adjust(const f_array_length_t length, f_uint32ss_t *uint32ss); -#endif // _di_f_type_uint32ss_adjust_ - -/** - * Resize the string uint32ss 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 uint32ss - * The string uint32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint32ss_decimate_by_ - extern f_status_t f_type_uint32ss_decimate_by(const f_array_length_t amount, f_uint32ss_t *uint32ss); -#endif // _di_f_type_uint32ss_decimate_by_ - -/** - * Resize the string uint32ss 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 uint32ss - * The string uint32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint32ss_decrease_by_ - extern f_status_t f_type_uint32ss_decrease_by(const f_array_length_t amount, f_uint32ss_t *uint32ss); -#endif // _di_f_type_uint32ss_decrease_by_ - -/** - * Increase the size of the string uint32ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param uint32ss - * The string uint32ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint32ss_increase_ - extern f_status_t f_type_uint32ss_increase(const uint16_t step, f_uint32ss_t *uint32ss); -#endif // _di_f_type_uint32ss_increase_ - -/** - * Resize the string uint32ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param uint32ss - * The string uint32ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint32ss_increase_by_ - extern f_status_t f_type_uint32ss_increase_by(const f_array_length_t amount, f_uint32ss_t *uint32ss); -#endif // _di_f_type_uint32ss_increase_by_ - -/** - * Resize the string uint32ss array. - * - * @param length - * The new size to use. - * @param uint32ss - * The string uint32ss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint32ss_resize_ - extern f_status_t f_type_uint32ss_resize(const f_array_length_t length, f_uint32ss_t *uint32ss); -#endif // _di_f_type_uint32ss_resize_ - -/** - * Resize the int64s array. - * - * @param length - * The new size to use. - * @param int64s - * The int64s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_int64s_adjust_ - extern f_status_t f_type_int64s_adjust(const f_array_length_t length, f_int64s_t *int64s); -#endif // _di_f_type_int64s_adjust_ - -/** - * Append the source int64s onto the destination. - * - * @param source - * The source int64s to append. - * @param destination - * The destination int64s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int64s_append_ - extern f_status_t f_type_int64s_append(const f_int64s_t source, f_int64s_t *destination); -#endif // _di_f_type_int64s_append_ - -/** - * Resize the int64s 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param int64s - * The int64s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_int64s_decimate_by_ - extern f_status_t f_type_int64s_decimate_by(const f_array_length_t amount, f_int64s_t *int64s); -#endif // _di_f_type_int64s_decimate_by_ - -/** - * Resize the int64s 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param int64s - * The int64s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int64s_decrease_by_ - extern f_status_t f_type_int64s_decrease_by(const f_array_length_t amount, f_int64s_t *int64s); -#endif // _di_f_type_int64s_decrease_by_ - -/** - * Increase the size of the int64s array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param int64s - * The int64s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int64s_increase_ - extern f_status_t f_type_int64s_increase(const uint16_t step, f_int64s_t *int64s); -#endif // _di_f_type_int64s_increase_ - -/** - * Resize the int64s 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param int64s - * The int64s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int64s_increase_by_ - extern f_status_t f_type_int64s_increase_by(const f_array_length_t amount, f_int64s_t *int64s); -#endif // _di_f_type_int64s_increase_by_ - -/** - * Resize the int64s array. - * - * @param length - * The new size to use. - * @param int64s - * The int64s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int64s_resize_ - extern f_status_t f_type_int64s_resize(const f_array_length_t length, f_int64s_t *int64s); -#endif // _di_f_type_int64s_resize_ - -/** - * Resize the int64ss array. - * - * @param length - * The new size to use. - * @param int64ss - * The int64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int64ss_adjust_ - extern f_status_t f_type_int64ss_adjust(const f_array_length_t length, f_int64ss_t *int64ss); -#endif // _di_f_type_int64ss_adjust_ - -/** - * Append the source int64ss onto the destination. - * - * @param source - * The source int64ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int64ss_append_ - extern f_status_t f_type_int64ss_append(const f_int64ss_t source, f_int64ss_t *destination); -#endif // _di_f_type_int64ss_append_ - -/** - * Resize the int64ss array. - * - * @param length - * The new size to use. - * @param int64ss - * The int64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int64ss_adjust_ - extern f_status_t f_type_int64ss_adjust(const f_array_length_t length, f_int64ss_t *int64ss); -#endif // _di_f_type_int64ss_adjust_ - -/** - * Resize the int64ss 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 int64ss - * The int64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int64ss_decimate_by_ - extern f_status_t f_type_int64ss_decimate_by(const f_array_length_t amount, f_int64ss_t *int64ss); -#endif // _di_f_type_int64ss_decimate_by_ - -/** - * Resize the int64ss 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 int64ss - * The int64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int64ss_decrease_by_ - extern f_status_t f_type_int64ss_decrease_by(const f_array_length_t amount, f_int64ss_t *int64ss); -#endif // _di_f_type_int64ss_decrease_by_ - -/** - * Increase the size of the int64ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param int64ss - * The int64ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int64ss_increase_ - extern f_status_t f_type_int64ss_increase(const uint16_t step, f_int64ss_t *int64ss); -#endif // _di_f_type_int64ss_increase_ - -/** - * Resize the int64ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param int64ss - * The int64ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int64ss_increase_by_ - extern f_status_t f_type_int64ss_increase_by(const f_array_length_t amount, f_int64ss_t *int64ss); -#endif // _di_f_type_int64ss_increase_by_ - -/** - * Resize the int64ss array. - * - * @param length - * The new size to use. - * @param int64ss - * The int64ss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int64ss_resize_ - extern f_status_t f_type_int64ss_resize(const f_array_length_t length, f_int64ss_t *int64ss); -#endif // _di_f_type_int64ss_resize_ - -/** - * Resize the string uint64s array. - * - * @param length - * The new size to use. - * @param uint64s - * The string uint64s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_uint64s_adjust_ - extern f_status_t f_type_uint64s_adjust(const f_array_length_t length, f_uint64s_t *uint64s); -#endif // _di_f_type_uint64s_adjust_ - -/** - * Append the source uint64s onto the destination. - * - * @param source - * The source uint64s to append. - * @param destination - * The destination uint64s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint64s_append_ - extern f_status_t f_type_uint64s_append(const f_uint64s_t source, f_uint64s_t *destination); -#endif // _di_f_type_uint64s_append_ - -/** - * Resize the string uint64s 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param uint64s - * The string uint64s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_uint64s_decimate_by_ - extern f_status_t f_type_uint64s_decimate_by(const f_array_length_t amount, f_uint64s_t *uint64s); -#endif // _di_f_type_uint64s_decimate_by_ - -/** - * Resize the string uint64s 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param uint64s - * The string uint64s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint64s_decrease_by_ - extern f_status_t f_type_uint64s_decrease_by(const f_array_length_t amount, f_uint64s_t *uint64s); -#endif // _di_f_type_uint64s_decrease_by_ - -/** - * Increase the size of the string uint64s array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param uint64s - * The string uint64s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint64s_increase_ - extern f_status_t f_type_uint64s_increase(const uint16_t step, f_uint64s_t *uint64s); -#endif // _di_f_type_uint64s_increase_ - -/** - * Resize the string uint64s 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param uint64s - * The string uint64s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint64s_increase_by_ - extern f_status_t f_type_uint64s_increase_by(const f_array_length_t amount, f_uint64s_t *uint64s); -#endif // _di_f_type_uint64s_increase_by_ - -/** - * Resize the string uint64s array. - * - * @param length - * The new size to use. - * @param uint64s - * The string uint64s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint64s_resize_ - extern f_status_t f_type_uint64s_resize(const f_array_length_t length, f_uint64s_t *uint64s); -#endif // _di_f_type_uint64s_resize_ - -/** - * Resize the string uint64ss array. - * - * @param length - * The new size to use. - * @param uint64ss - * The string uint64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint64ss_adjust_ - extern f_status_t f_type_uint64ss_adjust(const f_array_length_t length, f_uint64ss_t *uint64ss); -#endif // _di_f_type_uint64ss_adjust_ - -/** - * Append the source uint64ss onto the destination. - * - * @param source - * The source uint64ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint64ss_append_ - extern f_status_t f_type_uint64ss_append(const f_uint64ss_t source, f_uint64ss_t *destination); -#endif // _di_f_type_uint64ss_append_ - -/** - * Resize the string uint64ss array. - * - * @param length - * The new size to use. - * @param uint64ss - * The string uint64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint64ss_adjust_ - extern f_status_t f_type_uint64ss_adjust(const f_array_length_t length, f_uint64ss_t *uint64ss); -#endif // _di_f_type_uint64ss_adjust_ - -/** - * Resize the string uint64ss 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 uint64ss - * The string uint64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint64ss_decimate_by_ - extern f_status_t f_type_uint64ss_decimate_by(const f_array_length_t amount, f_uint64ss_t *uint64ss); -#endif // _di_f_type_uint64ss_decimate_by_ - -/** - * Resize the string uint64ss 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 uint64ss - * The string uint64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint64ss_decrease_by_ - extern f_status_t f_type_uint64ss_decrease_by(const f_array_length_t amount, f_uint64ss_t *uint64ss); -#endif // _di_f_type_uint64ss_decrease_by_ - -/** - * Increase the size of the string uint64ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param uint64ss - * The string uint64ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint64ss_increase_ - extern f_status_t f_type_uint64ss_increase(const uint16_t step, f_uint64ss_t *uint64ss); -#endif // _di_f_type_uint64ss_increase_ - -/** - * Resize the string uint64ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param uint64ss - * The string uint64ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint64ss_increase_by_ - extern f_status_t f_type_uint64ss_increase_by(const f_array_length_t amount, f_uint64ss_t *uint64ss); -#endif // _di_f_type_uint64ss_increase_by_ - -/** - * Resize the string uint64ss array. - * - * @param length - * The new size to use. - * @param uint64ss - * The string uint64ss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint64ss_resize_ - extern f_status_t f_type_uint64ss_resize(const f_array_length_t length, f_uint64ss_t *uint64ss); -#endif // _di_f_type_uint64ss_resize_ - -/** - * Resize the int128s array. - * - * @param length - * The new size to use. - * @param int128s - * The int128s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_int128s_adjust_ - extern f_status_t f_type_int128s_adjust(const f_array_length_t length, f_int128s_t *int128s); -#endif // _di_f_type_int128s_adjust_ - -/** - * Append the source int128s onto the destination. - * - * @param source - * The source int128s to append. - * @param destination - * The destination int128s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int128s_append_ - extern f_status_t f_type_int128s_append(const f_int128s_t source, f_int128s_t *destination); -#endif // _di_f_type_int128s_append_ - -/** - * Resize the int128s 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param int128s - * The int128s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_int128s_decimate_by_ - extern f_status_t f_type_int128s_decimate_by(const f_array_length_t amount, f_int128s_t *int128s); -#endif // _di_f_type_int128s_decimate_by_ - -/** - * Resize the int128s 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param int128s - * The int128s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int128s_decrease_by_ - extern f_status_t f_type_int128s_decrease_by(const f_array_length_t amount, f_int128s_t *int128s); -#endif // _di_f_type_int128s_decrease_by_ - -/** - * Increase the size of the int128s array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param int128s - * The int128s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int128s_increase_ - extern f_status_t f_type_int128s_increase(const uint16_t step, f_int128s_t *int128s); -#endif // _di_f_type_int128s_increase_ - -/** - * Resize the int128s 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param int128s - * The int128s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int128s_increase_by_ - extern f_status_t f_type_int128s_increase_by(const f_array_length_t amount, f_int128s_t *int128s); -#endif // _di_f_type_int128s_increase_by_ - -/** - * Resize the int128s array. - * - * @param length - * The new size to use. - * @param int128s - * The int128s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int128s_resize_ - extern f_status_t f_type_int128s_resize(const f_array_length_t length, f_int128s_t *int128s); -#endif // _di_f_type_int128s_resize_ - -/** - * Resize the int128ss array. - * - * @param length - * The new size to use. - * @param int128ss - * The int128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int128ss_adjust_ - extern f_status_t f_type_int128ss_adjust(const f_array_length_t length, f_int128ss_t *int128ss); -#endif // _di_f_type_int128ss_adjust_ - -/** - * Append the source int128ss onto the destination. - * - * @param source - * The source int128ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int128ss_append_ - extern f_status_t f_type_int128ss_append(const f_int128ss_t source, f_int128ss_t *destination); -#endif // _di_f_type_int128ss_append_ - -/** - * Resize the int128ss array. - * - * @param length - * The new size to use. - * @param int128ss - * The int128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int128ss_adjust_ - extern f_status_t f_type_int128ss_adjust(const f_array_length_t length, f_int128ss_t *int128ss); -#endif // _di_f_type_int128ss_adjust_ - -/** - * Resize the int128ss 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 int128ss - * The int128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_int128ss_decimate_by_ - extern f_status_t f_type_int128ss_decimate_by(const f_array_length_t amount, f_int128ss_t *int128ss); -#endif // _di_f_type_int128ss_decimate_by_ - -/** - * Resize the int128ss 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 int128ss - * The int128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int128ss_decrease_by_ - extern f_status_t f_type_int128ss_decrease_by(const f_array_length_t amount, f_int128ss_t *int128ss); -#endif // _di_f_type_int128ss_decrease_by_ - -/** - * Increase the size of the int128ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param int128ss - * The int128ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int128ss_increase_ - extern f_status_t f_type_int128ss_increase(const uint16_t step, f_int128ss_t *int128ss); -#endif // _di_f_type_int128ss_increase_ - -/** - * Resize the int128ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param int128ss - * The int128ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int128ss_increase_by_ - extern f_status_t f_type_int128ss_increase_by(const f_array_length_t amount, f_int128ss_t *int128ss); -#endif // _di_f_type_int128ss_increase_by_ - -/** - * Resize the int128ss array. - * - * @param length - * The new size to use. - * @param int128ss - * The int128ss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_int128ss_resize_ - extern f_status_t f_type_int128ss_resize(const f_array_length_t length, f_int128ss_t *int128ss); -#endif // _di_f_type_int128ss_resize_ - -/** - * Resize the string uint128s array. - * - * @param length - * The new size to use. - * @param uint128s - * The string uint128s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_uint128s_adjust_ - extern f_status_t f_type_uint128s_adjust(const f_array_length_t length, f_uint128s_t *uint128s); -#endif // _di_f_type_uint128s_adjust_ - -/** - * Append the source uint128s onto the destination. - * - * @param source - * The source uint128s to append. - * @param destination - * The destination uint128s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint128s_append_ - extern f_status_t f_type_uint128s_append(const f_uint128s_t source, f_uint128s_t *destination); -#endif // _di_f_type_uint128s_append_ - -/** - * Resize the string uint128s 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 les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param uint128s - * The string uint128s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - */ -#ifndef _di_f_type_uint128s_decimate_by_ - extern f_status_t f_type_uint128s_decimate_by(const f_array_length_t amount, f_uint128s_t *uint128s); -#endif // _di_f_type_uint128s_decimate_by_ - -/** - * Resize the string uint128s 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 les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param uint128s - * The string uint128s array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint128s_decrease_by_ - extern f_status_t f_type_uint128s_decrease_by(const f_array_length_t amount, f_uint128s_t *uint128s); -#endif // _di_f_type_uint128s_decrease_by_ - -/** - * Increase the size of the string uint128s array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param uint128s - * The string uint128s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint128s_increase_ - extern f_status_t f_type_uint128s_increase(const uint16_t step, f_uint128s_t *uint128s); -#endif // _di_f_type_uint128s_increase_ - -/** - * Resize the string uint128s 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param uint128s - * The string uint128s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint128s_increase_by_ - extern f_status_t f_type_uint128s_increase_by(const f_array_length_t amount, f_uint128s_t *uint128s); -#endif // _di_f_type_uint128s_increase_by_ - -/** - * Resize the string uint128s array. - * - * @param length - * The new size to use. - * @param uint128s - * The string uint128s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint128s_resize_ - extern f_status_t f_type_uint128s_resize(const f_array_length_t length, f_uint128s_t *uint128s); -#endif // _di_f_type_uint128s_resize_ - -/** - * Resize the string uint128ss array. - * - * @param length - * The new size to use. - * @param uint128ss - * The string uint128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint128ss_adjust_ - extern f_status_t f_type_uint128ss_adjust(const f_array_length_t length, f_uint128ss_t *uint128ss); -#endif // _di_f_type_uint128ss_adjust_ - -/** - * Append the source uint128ss onto the destination. - * - * @param source - * The source uint128ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint128ss_append_ - extern f_status_t f_type_uint128ss_append(const f_uint128ss_t source, f_uint128ss_t *destination); -#endif // _di_f_type_uint128ss_append_ - -/** - * Resize the string uint128ss array. - * - * @param length - * The new size to use. - * @param uint128ss - * The string uint128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint128ss_adjust_ - extern f_status_t f_type_uint128ss_adjust(const f_array_length_t length, f_uint128ss_t *uint128ss); -#endif // _di_f_type_uint128ss_adjust_ - -/** - * Resize the string uint128ss 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 uint128ss - * The string uint128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - */ -#ifndef _di_f_type_uint128ss_decimate_by_ - extern f_status_t f_type_uint128ss_decimate_by(const f_array_length_t amount, f_uint128ss_t *uint128ss); -#endif // _di_f_type_uint128ss_decimate_by_ - -/** - * Resize the string uint128ss 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 uint128ss - * The string uint128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint128ss_decrease_by_ - extern f_status_t f_type_uint128ss_decrease_by(const f_array_length_t amount, f_uint128ss_t *uint128ss); -#endif // _di_f_type_uint128ss_decrease_by_ - -/** - * Increase the size of the string uint128ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param uint128ss - * The string uint128ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint128ss_increase_ - extern f_status_t f_type_uint128ss_increase(const uint16_t step, f_uint128ss_t *uint128ss); -#endif // _di_f_type_uint128ss_increase_ - -/** - * Resize the string uint128ss 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_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param uint128ss - * The string uint128ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint128ss_increase_by_ - extern f_status_t f_type_uint128ss_increase_by(const f_array_length_t amount, f_uint128ss_t *uint128ss); -#endif // _di_f_type_uint128ss_increase_by_ - -/** - * Resize the string uint128ss array. - * - * @param length - * The new size to use. - * @param uint128ss - * The string uint128ss 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. - * - * Errors (with error bit) from: f_memory_delete(). - * Errors (with error bit) from: f_memory_resize(). - */ -#ifndef _di_f_type_uint128ss_resize_ - extern f_status_t f_type_uint128ss_resize(const f_array_length_t length, f_uint128ss_t *uint128ss); -#endif // _di_f_type_uint128ss_resize_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/c/type_array/array_length.c b/level_0/f_type_array/c/type_array/array_length.c new file mode 100644 index 0000000..5eb1a0e --- /dev/null +++ b/level_0/f_type_array/c/type_array/array_length.c @@ -0,0 +1,235 @@ +#include "../type_array.h" +#include "array_length.h" +#include "private-array_length.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_type_array_lengths_adjust_ + f_status_t f_type_array_lengths_adjust(const f_array_length_t length, f_array_lengths_t *lengths) { + #ifndef _di_level_0_parameter_checking_ + if (!lengths) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_array_lengths_adjust(length, lengths); + } +#endif // _di_f_type_array_lengths_adjust_ + +#ifndef _di_f_type_array_lengths_append_ + f_status_t f_type_array_lengths_append(const f_array_lengths_t source, f_array_lengths_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_array_lengths_append(source, destination); + } +#endif // _di_f_type_array_lengths_append_ + +#ifndef _di_f_type_array_lengths_decimate_by_ + f_status_t f_type_array_lengths_decimate_by(const f_array_length_t amount, f_array_lengths_t *lengths) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!lengths) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (lengths->size - amount > 0) { + return private_f_type_array_lengths_adjust(lengths->size - amount, lengths); + } + + return private_f_type_array_lengths_adjust(0, lengths); + } +#endif // _di_f_type_array_lengths_decimate_by_ + +#ifndef _di_f_type_array_lengths_decrease_by_ + f_status_t f_type_array_lengths_decrease_by(const f_array_length_t amount, f_array_lengths_t *lengths) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!lengths) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (lengths->size - amount > 0) { + return private_f_type_array_lengths_resize(lengths->size - amount, lengths); + } + + return private_f_type_array_lengths_resize(0, lengths); + } +#endif // _di_f_type_array_lengths_decrease_by_ + +#ifndef _di_f_type_array_lengths_increase_ + f_status_t f_type_array_lengths_increase(const uint16_t step, f_array_lengths_t *lengths) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!lengths) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (lengths->used + 1 > lengths->size) { + f_array_length_t size = lengths->used + step; + + if (size > F_array_length_t_size_d) { + if (lengths->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_array_lengths_resize(size, lengths); + } + + return F_data_not; + } +#endif // _di_f_type_array_lengths_increase_ + +#ifndef _di_f_type_array_lengths_increase_by_ + f_status_t f_type_array_lengths_increase_by(const f_array_length_t amount, f_array_lengths_t *lengths) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!lengths) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (lengths->used + amount > lengths->size) { + if (lengths->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_array_lengths_resize(lengths->used + amount, lengths); + } + + return F_data_not; + } +#endif // _di_f_type_array_lengths_increase_by_ + +#ifndef _di_f_type_array_lengths_resize_ + f_status_t f_type_array_lengths_resize(const f_array_length_t length, f_array_lengths_t *lengths) { + #ifndef _di_level_0_parameter_checking_ + if (!lengths) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_array_lengths_resize(length, lengths); + } +#endif // _di_f_type_array_lengths_resize_ + +#ifndef _di_f_type_array_lengthss_adjust_ + f_status_t f_type_array_lengthss_adjust(const f_array_length_t length, f_array_lengthss_t *lengthss) { + #ifndef _di_level_0_parameter_checking_ + if (!lengthss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_array_lengthss_adjust(length, lengthss); + } +#endif // _di_f_type_array_lengthss_adjust_ + +#ifndef _di_f_type_array_lengthss_append_ + f_status_t f_type_array_lengthss_append(const f_array_lengthss_t source, f_array_lengthss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_array_lengthss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_array_lengths_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_array_lengthss_append_ + +#ifndef _di_f_type_array_lengthss_decimate_by_ + f_status_t f_type_array_lengthss_decimate_by(const f_array_length_t amount, f_array_lengthss_t *lengthss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!lengthss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (lengthss->size - amount > 0) { + return private_f_type_array_lengthss_adjust(lengthss->size - amount, lengthss); + } + + return private_f_type_array_lengthss_adjust(0, lengthss); + } +#endif // _di_f_type_array_lengthss_decimate_by_ + +#ifndef _di_f_type_array_lengthss_decrease_by_ + f_status_t f_type_array_lengthss_decrease_by(const f_array_length_t amount, f_array_lengthss_t *lengthss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!lengthss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (lengthss->size - amount > 0) { + return private_f_type_array_lengthss_resize(lengthss->size - amount, lengthss); + } + + return private_f_type_array_lengthss_resize(0, lengthss); + } +#endif // _di_f_type_array_lengthss_decrease_by_ + +#ifndef _di_f_type_array_lengthss_increase_ + f_status_t f_type_array_lengthss_increase(const uint16_t step, f_array_lengthss_t *lengthss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!lengthss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (lengthss->used + 1 > lengthss->size) { + f_array_length_t size = lengthss->used + step; + + if (size > F_array_length_t_size_d) { + if (lengthss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_array_lengthss_resize(size, lengthss); + } + + return F_data_not; + } +#endif // _di_f_type_array_lengthss_increase_ + +#ifndef _di_f_type_array_lengthss_increase_by_ + f_status_t f_type_array_lengthss_increase_by(const f_array_length_t amount, f_array_lengthss_t *lengthss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!lengthss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (lengthss->used + amount > lengthss->size) { + if (lengthss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_array_lengthss_resize(lengthss->used + amount, lengthss); + } + + return F_data_not; + } +#endif // _di_f_type_array_lengthss_increase_by_ + +#ifndef _di_f_type_array_lengthss_resize_ + f_status_t f_type_array_lengthss_resize(const f_array_length_t length, f_array_lengthss_t *lengthss) { + #ifndef _di_level_0_parameter_checking_ + if (!lengthss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_array_lengthss_resize(length, lengthss); + } +#endif // _di_f_type_array_lengthss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/array_length.h b/level_0/f_type_array/c/type_array/array_length.h new file mode 100644 index 0000000..5517cb7 --- /dev/null +++ b/level_0/f_type_array/c/type_array/array_length.h @@ -0,0 +1,355 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines data to be used for/by type (array) related functionality. + * + * This is auto-included by type_array.h and should not need to be explicitly included. + */ +#ifndef _F_type_array_array_length_h +#define _F_type_array_array_length_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the string lengths array. + * + * @param length + * The new size to use. + * @param lengths + * The string lengths array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_array_lengths_adjust_ + extern f_status_t f_type_array_lengths_adjust(const f_array_length_t length, f_array_lengths_t *lengths); +#endif // _di_f_type_array_lengths_adjust_ + +/** + * Append the source lengths onto the destination. + * + * @param source + * The source lengths to append. + * @param destination + * The destination lengths the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_array_lengths_append_ + extern f_status_t f_type_array_lengths_append(const f_array_lengths_t source, f_array_lengths_t *destination); +#endif // _di_f_type_array_lengths_append_ + +/** + * Resize the string lengths 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param lengths + * The string lengths array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_array_lengths_decimate_by_ + extern f_status_t f_type_array_lengths_decimate_by(const f_array_length_t amount, f_array_lengths_t *lengths); +#endif // _di_f_type_array_lengths_decimate_by_ + +/** + * Resize the string lengths 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param lengths + * The string lengths array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_array_lengths_decrease_by_ + extern f_status_t f_type_array_lengths_decrease_by(const f_array_length_t amount, f_array_lengths_t *lengths); +#endif // _di_f_type_array_lengths_decrease_by_ + +/** + * Increase the size of the string lengths array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param lengths + * The string lengths array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_array_lengths_increase_ + extern f_status_t f_type_array_lengths_increase(const uint16_t step, f_array_lengths_t *lengths); +#endif // _di_f_type_array_lengths_increase_ + +/** + * Resize the string lengths 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param lengths + * The string lengths array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_array_lengths_increase_by_ + extern f_status_t f_type_array_lengths_increase_by(const f_array_length_t amount, f_array_lengths_t *lengths); +#endif // _di_f_type_array_lengths_increase_by_ + +/** + * Resize the string lengths array. + * + * @param length + * The new size to use. + * @param lengths + * The string lengths array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_array_lengths_resize_ + extern f_status_t f_type_array_lengths_resize(const f_array_length_t length, f_array_lengths_t *lengths); +#endif // _di_f_type_array_lengths_resize_ + +/** + * Resize the string lengthss array. + * + * @param length + * The new size to use. + * @param lengthss + * The string lengthss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_array_lengthss_adjust_ + extern f_status_t f_type_array_lengthss_adjust(const f_array_length_t length, f_array_lengthss_t *lengthss); +#endif // _di_f_type_array_lengthss_adjust_ + +/** + * Append the source lengthss onto the destination. + * + * @param source + * The source lengthss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_array_lengthss_append_ + extern f_status_t f_type_array_lengthss_append(const f_array_lengthss_t source, f_array_lengthss_t *destination); +#endif // _di_f_type_array_lengthss_append_ + +/** + * Resize the string lengthss array. + * + * @param length + * The new size to use. + * @param lengthss + * The string lengthss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_array_lengthss_adjust_ + extern f_status_t f_type_array_lengthss_adjust(const f_array_length_t length, f_array_lengthss_t *lengthss); +#endif // _di_f_type_array_lengthss_adjust_ + +/** + * Resize the string lengthss 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 lengthss + * The string lengthss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_array_lengthss_decimate_by_ + extern f_status_t f_type_array_lengthss_decimate_by(const f_array_length_t amount, f_array_lengthss_t *lengthss); +#endif // _di_f_type_array_lengthss_decimate_by_ + +/** + * Resize the string lengthss 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 lengthss + * The string lengthss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_array_lengthss_decrease_by_ + extern f_status_t f_type_array_lengthss_decrease_by(const f_array_length_t amount, f_array_lengthss_t *lengthss); +#endif // _di_f_type_array_lengthss_decrease_by_ + +/** + * Increase the size of the string lengthss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param lengthss + * The string lengthss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_array_lengthss_increase_ + extern f_status_t f_type_array_lengthss_increase(const uint16_t step, f_array_lengthss_t *lengthss); +#endif // _di_f_type_array_lengthss_increase_ + +/** + * Resize the string lengthss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param lengthss + * The string lengthss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_array_lengthss_increase_by_ + extern f_status_t f_type_array_lengthss_increase_by(const f_array_length_t amount, f_array_lengthss_t *lengthss); +#endif // _di_f_type_array_lengthss_increase_by_ + +/** + * Resize the string lengthss array. + * + * @param length + * The new size to use. + * @param lengthss + * The string lengthss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_array_lengthss_resize_ + extern f_status_t f_type_array_lengthss_resize(const f_array_length_t length, f_array_lengthss_t *lengthss); +#endif // _di_f_type_array_lengthss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_array_array_length_h diff --git a/level_0/f_type_array/c/type_array/cell.c b/level_0/f_type_array/c/type_array/cell.c new file mode 100644 index 0000000..d4e937d --- /dev/null +++ b/level_0/f_type_array/c/type_array/cell.c @@ -0,0 +1,235 @@ +#include "../type_array.h" +#include "cell.h" +#include "private-cell.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_type_cells_adjust_ + f_status_t f_type_cells_adjust(const f_array_length_t length, f_cells_t *cells) { + #ifndef _di_level_0_parameter_checking_ + if (!cells) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_cells_adjust(length, cells); + } +#endif // _di_f_type_cells_adjust_ + +#ifndef _di_f_type_cells_append_ + f_status_t f_type_cells_append(const f_cells_t source, f_cells_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_cells_append(source, destination); + } +#endif // _di_f_type_cells_append_ + +#ifndef _di_f_type_cells_decimate_by_ + f_status_t f_type_cells_decimate_by(const f_array_length_t amount, f_cells_t *cells) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!cells) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (cells->size - amount > 0) { + return private_f_type_cells_adjust(cells->size - amount, cells); + } + + return private_f_type_cells_adjust(0, cells); + } +#endif // _di_f_type_cells_decimate_by_ + +#ifndef _di_f_type_cells_decrease_by_ + f_status_t f_type_cells_decrease_by(const f_array_length_t amount, f_cells_t *cells) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!cells) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (cells->size - amount > 0) { + return private_f_type_cells_resize(cells->size - amount, cells); + } + + return private_f_type_cells_resize(0, cells); + } +#endif // _di_f_type_cells_decrease_by_ + +#ifndef _di_f_type_cells_increase_ + f_status_t f_type_cells_increase(const uint16_t step, f_cells_t *cells) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!cells) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (cells->used + 1 > cells->size) { + f_array_length_t size = cells->used + step; + + if (size > F_array_length_t_size_d) { + if (cells->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_cells_resize(size, cells); + } + + return F_data_not; + } +#endif // _di_f_type_cells_increase_ + +#ifndef _di_f_type_cells_increase_by_ + f_status_t f_type_cells_increase_by(const f_array_length_t amount, f_cells_t *cells) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!cells) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (cells->used + amount > cells->size) { + if (cells->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_cells_resize(cells->used + amount, cells); + } + + return F_data_not; + } +#endif // _di_f_type_cells_increase_by_ + +#ifndef _di_f_type_cells_resize_ + f_status_t f_type_cells_resize(const f_array_length_t length, f_cells_t *cells) { + #ifndef _di_level_0_parameter_checking_ + if (!cells) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_cells_resize(length, cells); + } +#endif // _di_f_type_cells_resize_ + +#ifndef _di_f_type_cellss_adjust_ + f_status_t f_type_cellss_adjust(const f_array_length_t length, f_cellss_t *cellss) { + #ifndef _di_level_0_parameter_checking_ + if (!cellss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_cellss_adjust(length, cellss); + } +#endif // _di_f_type_cellss_adjust_ + +#ifndef _di_f_type_cellss_append_ + f_status_t f_type_cellss_append(const f_cellss_t source, f_cellss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_cellss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_cells_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_cellss_append_ + +#ifndef _di_f_type_cellss_decimate_by_ + f_status_t f_type_cellss_decimate_by(const f_array_length_t amount, f_cellss_t *cellss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!cellss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (cellss->size - amount > 0) { + return private_f_type_cellss_adjust(cellss->size - amount, cellss); + } + + return private_f_type_cellss_adjust(0, cellss); + } +#endif // _di_f_type_cellss_decimate_by_ + +#ifndef _di_f_type_cellss_decrease_by_ + f_status_t f_type_cellss_decrease_by(const f_array_length_t amount, f_cellss_t *cellss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!cellss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (cellss->size - amount > 0) { + return private_f_type_cellss_resize(cellss->size - amount, cellss); + } + + return private_f_type_cellss_resize(0, cellss); + } +#endif // _di_f_type_cellss_decrease_by_ + +#ifndef _di_f_type_cellss_increase_ + f_status_t f_type_cellss_increase(const uint16_t step, f_cellss_t *cellss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!cellss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (cellss->used + 1 > cellss->size) { + f_array_length_t size = cellss->used + step; + + if (size > F_array_length_t_size_d) { + if (cellss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_cellss_resize(size, cellss); + } + + return F_data_not; + } +#endif // _di_f_type_cellss_increase_ + +#ifndef _di_f_type_cellss_increase_by_ + f_status_t f_type_cellss_increase_by(const f_array_length_t amount, f_cellss_t *cellss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!cellss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (cellss->used + amount > cellss->size) { + if (cellss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_cellss_resize(cellss->used + amount, cellss); + } + + return F_data_not; + } +#endif // _di_f_type_cellss_increase_by_ + +#ifndef _di_f_type_cellss_resize_ + f_status_t f_type_cellss_resize(const f_array_length_t length, f_cellss_t *cellss) { + #ifndef _di_level_0_parameter_checking_ + if (!cellss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_cellss_resize(length, cellss); + } +#endif // _di_f_type_cellss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/cell.h b/level_0/f_type_array/c/type_array/cell.h new file mode 100644 index 0000000..80f4cd0 --- /dev/null +++ b/level_0/f_type_array/c/type_array/cell.h @@ -0,0 +1,355 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines data to be used for/by type (array) related functionality. + * + * This is auto-included by type_array.h and should not need to be explicitly included. + */ +#ifndef _F_type_array_cell_h +#define _F_type_array_cell_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the string cells array. + * + * @param length + * The new size to use. + * @param cells + * The string cells array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_cells_adjust_ + extern f_status_t f_type_cells_adjust(const f_array_length_t length, f_cells_t *cells); +#endif // _di_f_type_cells_adjust_ + +/** + * Append the source cells onto the destination. + * + * @param source + * The source cells to append. + * @param destination + * The destination cells the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_cells_append_ + extern f_status_t f_type_cells_append(const f_cells_t source, f_cells_t *destination); +#endif // _di_f_type_cells_append_ + +/** + * Resize the string cells 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param cells + * The string cells array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_cells_decimate_by_ + extern f_status_t f_type_cells_decimate_by(const f_array_length_t amount, f_cells_t *cells); +#endif // _di_f_type_cells_decimate_by_ + +/** + * Resize the string cells 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param cells + * The string cells array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_cells_decrease_by_ + extern f_status_t f_type_cells_decrease_by(const f_array_length_t amount, f_cells_t *cells); +#endif // _di_f_type_cells_decrease_by_ + +/** + * Increase the size of the string cells array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param cells + * The string cells array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_cells_increase_ + extern f_status_t f_type_cells_increase(const uint16_t step, f_cells_t *cells); +#endif // _di_f_type_cells_increase_ + +/** + * Resize the string cells 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param cells + * The string cells array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_cells_increase_by_ + extern f_status_t f_type_cells_increase_by(const f_array_length_t amount, f_cells_t *cells); +#endif // _di_f_type_cells_increase_by_ + +/** + * Resize the string cells array. + * + * @param length + * The new size to use. + * @param cells + * The string cells array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_cells_resize_ + extern f_status_t f_type_cells_resize(const f_array_length_t length, f_cells_t *cells); +#endif // _di_f_type_cells_resize_ + +/** + * Resize the string cellss array. + * + * @param length + * The new size to use. + * @param cellss + * The string cellss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_cellss_adjust_ + extern f_status_t f_type_cellss_adjust(const f_array_length_t length, f_cellss_t *cellss); +#endif // _di_f_type_cellss_adjust_ + +/** + * Append the source cellss onto the destination. + * + * @param source + * The source cellss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_cellss_append_ + extern f_status_t f_type_cellss_append(const f_cellss_t source, f_cellss_t *destination); +#endif // _di_f_type_cellss_append_ + +/** + * Resize the string cellss array. + * + * @param length + * The new size to use. + * @param cellss + * The string cellss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_cellss_adjust_ + extern f_status_t f_type_cellss_adjust(const f_array_length_t length, f_cellss_t *cellss); +#endif // _di_f_type_cellss_adjust_ + +/** + * Resize the string cellss 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 cellss + * The string cellss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_cellss_decimate_by_ + extern f_status_t f_type_cellss_decimate_by(const f_array_length_t amount, f_cellss_t *cellss); +#endif // _di_f_type_cellss_decimate_by_ + +/** + * Resize the string cellss 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 cellss + * The string cellss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_cellss_decrease_by_ + extern f_status_t f_type_cellss_decrease_by(const f_array_length_t amount, f_cellss_t *cellss); +#endif // _di_f_type_cellss_decrease_by_ + +/** + * Increase the size of the string cellss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param cellss + * The string cellss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_cellss_increase_ + extern f_status_t f_type_cellss_increase(const uint16_t step, f_cellss_t *cellss); +#endif // _di_f_type_cellss_increase_ + +/** + * Resize the string cellss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param cellss + * The string cellss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_cellss_increase_by_ + extern f_status_t f_type_cellss_increase_by(const f_array_length_t amount, f_cellss_t *cellss); +#endif // _di_f_type_cellss_increase_by_ + +/** + * Resize the string cellss array. + * + * @param length + * The new size to use. + * @param cellss + * The string cellss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_cellss_resize_ + extern f_status_t f_type_cellss_resize(const f_array_length_t length, f_cellss_t *cellss); +#endif // _di_f_type_cellss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_array_cell_h diff --git a/level_0/f_type_array/c/type_array/fll_id.c b/level_0/f_type_array/c/type_array/fll_id.c new file mode 100644 index 0000000..d2c2c9c --- /dev/null +++ b/level_0/f_type_array/c/type_array/fll_id.c @@ -0,0 +1,235 @@ +#include "../type_array.h" +#include "fll_id.h" +#include "private-fll_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_type_fll_ids_adjust_ + f_status_t f_type_fll_ids_adjust(const f_array_length_t length, f_fll_ids_t *ids) { + #ifndef _di_level_0_parameter_checking_ + if (!ids) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_fll_ids_adjust(length, ids); + } +#endif // _di_f_type_fll_ids_adjust_ + +#ifndef _di_f_type_fll_ids_append_ + f_status_t f_type_fll_ids_append(const f_fll_ids_t source, f_fll_ids_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_fll_ids_append(source, destination); + } +#endif // _di_f_type_fll_ids_append_ + +#ifndef _di_f_type_fll_ids_decimate_by_ + f_status_t f_type_fll_ids_decimate_by(const f_array_length_t amount, f_fll_ids_t *ids) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!ids) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (ids->size - amount > 0) { + return private_f_type_fll_ids_adjust(ids->size - amount, ids); + } + + return private_f_type_fll_ids_adjust(0, ids); + } +#endif // _di_f_type_fll_ids_decimate_by_ + +#ifndef _di_f_type_fll_ids_decrease_by_ + f_status_t f_type_fll_ids_decrease_by(const f_array_length_t amount, f_fll_ids_t *ids) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!ids) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (ids->size - amount > 0) { + return private_f_type_fll_ids_resize(ids->size - amount, ids); + } + + return private_f_type_fll_ids_resize(0, ids); + } +#endif // _di_f_type_fll_ids_decrease_by_ + +#ifndef _di_f_type_fll_ids_increase_ + f_status_t f_type_fll_ids_increase(const uint16_t step, f_fll_ids_t *ids) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!ids) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (ids->used + 1 > ids->size) { + f_array_length_t size = ids->used + step; + + if (size > F_array_length_t_size_d) { + if (ids->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_fll_ids_resize(size, ids); + } + + return F_data_not; + } +#endif // _di_f_type_fll_ids_increase_ + +#ifndef _di_f_type_fll_ids_increase_by_ + f_status_t f_type_fll_ids_increase_by(const f_array_length_t amount, f_fll_ids_t *ids) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!ids) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (ids->used + amount > ids->size) { + if (ids->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_fll_ids_resize(ids->used + amount, ids); + } + + return F_data_not; + } +#endif // _di_f_type_fll_ids_increase_by_ + +#ifndef _di_f_type_fll_ids_resize_ + f_status_t f_type_fll_ids_resize(const f_array_length_t length, f_fll_ids_t *ids) { + #ifndef _di_level_0_parameter_checking_ + if (!ids) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_fll_ids_resize(length, ids); + } +#endif // _di_f_type_fll_ids_resize_ + +#ifndef _di_f_type_fll_idss_adjust_ + f_status_t f_type_fll_idss_adjust(const f_array_length_t length, f_fll_idss_t *idss) { + #ifndef _di_level_0_parameter_checking_ + if (!idss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_fll_idss_adjust(length, idss); + } +#endif // _di_f_type_fll_idss_adjust_ + +#ifndef _di_f_type_fll_idss_append_ + f_status_t f_type_fll_idss_append(const f_fll_idss_t source, f_fll_idss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_fll_idss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_fll_ids_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_fll_idss_append_ + +#ifndef _di_f_type_fll_idss_decimate_by_ + f_status_t f_type_fll_idss_decimate_by(const f_array_length_t amount, f_fll_idss_t *idss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!idss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (idss->size - amount > 0) { + return private_f_type_fll_idss_adjust(idss->size - amount, idss); + } + + return private_f_type_fll_idss_adjust(0, idss); + } +#endif // _di_f_type_fll_idss_decimate_by_ + +#ifndef _di_f_type_fll_idss_decrease_by_ + f_status_t f_type_fll_idss_decrease_by(const f_array_length_t amount, f_fll_idss_t *idss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!idss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (idss->size - amount > 0) { + return private_f_type_fll_idss_resize(idss->size - amount, idss); + } + + return private_f_type_fll_idss_resize(0, idss); + } +#endif // _di_f_type_fll_idss_decrease_by_ + +#ifndef _di_f_type_fll_idss_increase_ + f_status_t f_type_fll_idss_increase(const uint16_t step, f_fll_idss_t *idss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!idss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (idss->used + 1 > idss->size) { + f_array_length_t size = idss->used + step; + + if (size > F_array_length_t_size_d) { + if (idss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_fll_idss_resize(size, idss); + } + + return F_data_not; + } +#endif // _di_f_type_fll_idss_increase_ + +#ifndef _di_f_type_fll_idss_increase_by_ + f_status_t f_type_fll_idss_increase_by(const f_array_length_t amount, f_fll_idss_t *idss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!idss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (idss->used + amount > idss->size) { + if (idss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_fll_idss_resize(idss->used + amount, idss); + } + + return F_data_not; + } +#endif // _di_f_type_fll_idss_increase_by_ + +#ifndef _di_f_type_fll_idss_resize_ + f_status_t f_type_fll_idss_resize(const f_array_length_t length, f_fll_idss_t *idss) { + #ifndef _di_level_0_parameter_checking_ + if (!idss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_fll_idss_resize(length, idss); + } +#endif // _di_f_type_fll_idss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/fll_id.h b/level_0/f_type_array/c/type_array/fll_id.h new file mode 100644 index 0000000..74a937b --- /dev/null +++ b/level_0/f_type_array/c/type_array/fll_id.h @@ -0,0 +1,355 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines data to be used for/by type (array) related functionality. + * + * This is auto-included by type_array.h and should not need to be explicitly included. + */ +#ifndef _F_type_array_fll_id_h +#define _F_type_array_fll_id_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the string ids array. + * + * @param length + * The new size to use. + * @param ids + * The string ids array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_fll_ids_adjust_ + extern f_status_t f_type_fll_ids_adjust(const f_array_length_t length, f_fll_ids_t *ids); +#endif // _di_f_type_fll_ids_adjust_ + +/** + * Append the source ids onto the destination. + * + * @param source + * The source ids to append. + * @param destination + * The destination ids the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_fll_ids_append_ + extern f_status_t f_type_fll_ids_append(const f_fll_ids_t source, f_fll_ids_t *destination); +#endif // _di_f_type_fll_ids_append_ + +/** + * Resize the string ids 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param ids + * The string ids array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_fll_ids_decimate_by_ + extern f_status_t f_type_fll_ids_decimate_by(const f_array_length_t amount, f_fll_ids_t *ids); +#endif // _di_f_type_fll_ids_decimate_by_ + +/** + * Resize the string ids 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param ids + * The string ids array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_fll_ids_decrease_by_ + extern f_status_t f_type_fll_ids_decrease_by(const f_array_length_t amount, f_fll_ids_t *ids); +#endif // _di_f_type_fll_ids_decrease_by_ + +/** + * Increase the size of the string ids array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param ids + * The string ids array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_fll_ids_increase_ + extern f_status_t f_type_fll_ids_increase(const uint16_t step, f_fll_ids_t *ids); +#endif // _di_f_type_fll_ids_increase_ + +/** + * Resize the string ids 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param ids + * The string ids array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_fll_ids_increase_by_ + extern f_status_t f_type_fll_ids_increase_by(const f_array_length_t amount, f_fll_ids_t *ids); +#endif // _di_f_type_fll_ids_increase_by_ + +/** + * Resize the string ids array. + * + * @param length + * The new size to use. + * @param ids + * The string ids array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_fll_ids_resize_ + extern f_status_t f_type_fll_ids_resize(const f_array_length_t length, f_fll_ids_t *ids); +#endif // _di_f_type_fll_ids_resize_ + +/** + * Resize the string idss array. + * + * @param length + * The new size to use. + * @param idss + * The string idss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_fll_idss_adjust_ + extern f_status_t f_type_fll_idss_adjust(const f_array_length_t length, f_fll_idss_t *idss); +#endif // _di_f_type_fll_idss_adjust_ + +/** + * Append the source idss onto the destination. + * + * @param source + * The source idss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_fll_idss_append_ + extern f_status_t f_type_fll_idss_append(const f_fll_idss_t source, f_fll_idss_t *destination); +#endif // _di_f_type_fll_idss_append_ + +/** + * Resize the string idss array. + * + * @param length + * The new size to use. + * @param idss + * The string idss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_fll_idss_adjust_ + extern f_status_t f_type_fll_idss_adjust(const f_array_length_t length, f_fll_idss_t *idss); +#endif // _di_f_type_fll_idss_adjust_ + +/** + * Resize the string idss 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 idss + * The string idss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_fll_idss_decimate_by_ + extern f_status_t f_type_fll_idss_decimate_by(const f_array_length_t amount, f_fll_idss_t *idss); +#endif // _di_f_type_fll_idss_decimate_by_ + +/** + * Resize the string idss 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 idss + * The string idss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_fll_idss_decrease_by_ + extern f_status_t f_type_fll_idss_decrease_by(const f_array_length_t amount, f_fll_idss_t *idss); +#endif // _di_f_type_fll_idss_decrease_by_ + +/** + * Increase the size of the string idss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param idss + * The string idss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_fll_idss_increase_ + extern f_status_t f_type_fll_idss_increase(const uint16_t step, f_fll_idss_t *idss); +#endif // _di_f_type_fll_idss_increase_ + +/** + * Resize the string idss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param idss + * The string idss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_fll_idss_increase_by_ + extern f_status_t f_type_fll_idss_increase_by(const f_array_length_t amount, f_fll_idss_t *idss); +#endif // _di_f_type_fll_idss_increase_by_ + +/** + * Resize the string idss array. + * + * @param length + * The new size to use. + * @param idss + * The string idss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_fll_idss_resize_ + extern f_status_t f_type_fll_idss_resize(const f_array_length_t length, f_fll_idss_t *idss); +#endif // _di_f_type_fll_idss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_array_fll_id_h diff --git a/level_0/f_type_array/c/type_array/int128.c b/level_0/f_type_array/c/type_array/int128.c new file mode 100644 index 0000000..8a62baa --- /dev/null +++ b/level_0/f_type_array/c/type_array/int128.c @@ -0,0 +1,459 @@ +#include "../type_array.h" +#include "int128.h" +#include "private-int128.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_type_int128s_adjust_ + f_status_t f_type_int128s_adjust(const f_array_length_t length, f_int128s_t *int128s) { + #ifndef _di_level_0_parameter_checking_ + if (!int128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int128s_adjust(length, int128s); + } +#endif // _di_f_type_int128s_adjust_ + +#ifndef _di_f_type_int128s_append_ + f_status_t f_type_int128s_append(const f_int128s_t source, f_int128s_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_int128s_append(source, destination); + } +#endif // _di_f_type_int128s_append_ + +#ifndef _di_f_type_int128s_decimate_by_ + f_status_t f_type_int128s_decimate_by(const f_array_length_t amount, f_int128s_t *int128s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int128s->size - amount > 0) { + return private_f_type_int128s_adjust(int128s->size - amount, int128s); + } + + return private_f_type_int128s_adjust(0, int128s); + } +#endif // _di_f_type_int128s_decimate_by_ + +#ifndef _di_f_type_int128s_decrease_by_ + f_status_t f_type_int128s_decrease_by(const f_array_length_t amount, f_int128s_t *int128s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int128s->size - amount > 0) { + return private_f_type_int128s_resize(int128s->size - amount, int128s); + } + + return private_f_type_int128s_resize(0, int128s); + } +#endif // _di_f_type_int128s_decrease_by_ + +#ifndef _di_f_type_int128s_increase_ + f_status_t f_type_int128s_increase(const uint16_t step, f_int128s_t *int128s) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!int128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int128s->used + 1 > int128s->size) { + f_array_length_t size = int128s->used + step; + + if (size > F_array_length_t_size_d) { + if (int128s->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_int128s_resize(size, int128s); + } + + return F_data_not; + } +#endif // _di_f_type_int128s_increase_ + +#ifndef _di_f_type_int128s_increase_by_ + f_status_t f_type_int128s_increase_by(const f_array_length_t amount, f_int128s_t *int128s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int128s->used + amount > int128s->size) { + if (int128s->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_int128s_resize(int128s->used + amount, int128s); + } + + return F_data_not; + } +#endif // _di_f_type_int128s_increase_by_ + +#ifndef _di_f_type_int128s_resize_ + f_status_t f_type_int128s_resize(const f_array_length_t length, f_int128s_t *int128s) { + #ifndef _di_level_0_parameter_checking_ + if (!int128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int128s_resize(length, int128s); + } +#endif // _di_f_type_int128s_resize_ + +#ifndef _di_f_type_int128ss_adjust_ + f_status_t f_type_int128ss_adjust(const f_array_length_t length, f_int128ss_t *int128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!int128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int128ss_adjust(length, int128ss); + } +#endif // _di_f_type_int128ss_adjust_ + +#ifndef _di_f_type_int128ss_append_ + f_status_t f_type_int128ss_append(const f_int128ss_t source, f_int128ss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_int128ss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_int128s_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_int128ss_append_ + +#ifndef _di_f_type_int128ss_decimate_by_ + f_status_t f_type_int128ss_decimate_by(const f_array_length_t amount, f_int128ss_t *int128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int128ss->size - amount > 0) { + return private_f_type_int128ss_adjust(int128ss->size - amount, int128ss); + } + + return private_f_type_int128ss_adjust(0, int128ss); + } +#endif // _di_f_type_int128ss_decimate_by_ + +#ifndef _di_f_type_int128ss_decrease_by_ + f_status_t f_type_int128ss_decrease_by(const f_array_length_t amount, f_int128ss_t *int128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int128ss->size - amount > 0) { + return private_f_type_int128ss_resize(int128ss->size - amount, int128ss); + } + + return private_f_type_int128ss_resize(0, int128ss); + } +#endif // _di_f_type_int128ss_decrease_by_ + +#ifndef _di_f_type_int128ss_increase_ + f_status_t f_type_int128ss_increase(const uint16_t step, f_int128ss_t *int128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!int128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int128ss->used + 1 > int128ss->size) { + f_array_length_t size = int128ss->used + step; + + if (size > F_array_length_t_size_d) { + if (int128ss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_int128ss_resize(size, int128ss); + } + + return F_data_not; + } +#endif // _di_f_type_int128ss_increase_ + +#ifndef _di_f_type_int128ss_increase_by_ + f_status_t f_type_int128ss_increase_by(const f_array_length_t amount, f_int128ss_t *int128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int128ss->used + amount > int128ss->size) { + if (int128ss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_int128ss_resize(int128ss->used + amount, int128ss); + } + + return F_data_not; + } +#endif // _di_f_type_int128ss_increase_by_ + +#ifndef _di_f_type_int128ss_resize_ + f_status_t f_type_int128ss_resize(const f_array_length_t length, f_int128ss_t *int128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!int128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int128ss_resize(length, int128ss); + } +#endif // _di_f_type_int128ss_resize_ + +#ifndef _di_f_type_uint128s_adjust_ + f_status_t f_type_uint128s_adjust(const f_array_length_t length, f_uint128s_t *uint128s) { + #ifndef _di_level_0_parameter_checking_ + if (!uint128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint128s_adjust(length, uint128s); + } +#endif // _di_f_type_uint128s_adjust_ + +#ifndef _di_f_type_uint128s_append_ + f_status_t f_type_uint128s_append(const f_uint128s_t source, f_uint128s_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_uint128s_append(source, destination); + } +#endif // _di_f_type_uint128s_append_ + +#ifndef _di_f_type_uint128s_decimate_by_ + f_status_t f_type_uint128s_decimate_by(const f_array_length_t amount, f_uint128s_t *uint128s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint128s->size - amount > 0) { + return private_f_type_uint128s_adjust(uint128s->size - amount, uint128s); + } + + return private_f_type_uint128s_adjust(0, uint128s); + } +#endif // _di_f_type_uint128s_decimate_by_ + +#ifndef _di_f_type_uint128s_decrease_by_ + f_status_t f_type_uint128s_decrease_by(const f_array_length_t amount, f_uint128s_t *uint128s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint128s->size - amount > 0) { + return private_f_type_uint128s_resize(uint128s->size - amount, uint128s); + } + + return private_f_type_uint128s_resize(0, uint128s); + } +#endif // _di_f_type_uint128s_decrease_by_ + +#ifndef _di_f_type_uint128s_increase_ + f_status_t f_type_uint128s_increase(const uint16_t step, f_uint128s_t *uint128s) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!uint128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint128s->used + 1 > uint128s->size) { + f_array_length_t size = uint128s->used + step; + + if (size > F_array_length_t_size_d) { + if (uint128s->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_uint128s_resize(size, uint128s); + } + + return F_data_not; + } +#endif // _di_f_type_uint128s_increase_ + +#ifndef _di_f_type_uint128s_increase_by_ + f_status_t f_type_uint128s_increase_by(const f_array_length_t amount, f_uint128s_t *uint128s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint128s->used + amount > uint128s->size) { + if (uint128s->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_uint128s_resize(uint128s->used + amount, uint128s); + } + + return F_data_not; + } +#endif // _di_f_type_uint128s_increase_by_ + +#ifndef _di_f_type_uint128s_resize_ + f_status_t f_type_uint128s_resize(const f_array_length_t length, f_uint128s_t *uint128s) { + #ifndef _di_level_0_parameter_checking_ + if (!uint128s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint128s_resize(length, uint128s); + } +#endif // _di_f_type_uint128s_resize_ + +#ifndef _di_f_type_uint128ss_adjust_ + f_status_t f_type_uint128ss_adjust(const f_array_length_t length, f_uint128ss_t *uint128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!uint128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint128ss_adjust(length, uint128ss); + } +#endif // _di_f_type_uint128ss_adjust_ + +#ifndef _di_f_type_uint128ss_append_ + f_status_t f_type_uint128ss_append(const f_uint128ss_t source, f_uint128ss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_uint128ss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_uint128s_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_uint128ss_append_ + +#ifndef _di_f_type_uint128ss_decimate_by_ + f_status_t f_type_uint128ss_decimate_by(const f_array_length_t amount, f_uint128ss_t *uint128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint128ss->size - amount > 0) { + return private_f_type_uint128ss_adjust(uint128ss->size - amount, uint128ss); + } + + return private_f_type_uint128ss_adjust(0, uint128ss); + } +#endif // _di_f_type_uint128ss_decimate_by_ + +#ifndef _di_f_type_uint128ss_decrease_by_ + f_status_t f_type_uint128ss_decrease_by(const f_array_length_t amount, f_uint128ss_t *uint128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint128ss->size - amount > 0) { + return private_f_type_uint128ss_resize(uint128ss->size - amount, uint128ss); + } + + return private_f_type_uint128ss_resize(0, uint128ss); + } +#endif // _di_f_type_uint128ss_decrease_by_ + +#ifndef _di_f_type_uint128ss_increase_ + f_status_t f_type_uint128ss_increase(const uint16_t step, f_uint128ss_t *uint128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!uint128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint128ss->used + 1 > uint128ss->size) { + f_array_length_t size = uint128ss->used + step; + + if (size > F_array_length_t_size_d) { + if (uint128ss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_uint128ss_resize(size, uint128ss); + } + + return F_data_not; + } +#endif // _di_f_type_uint128ss_increase_ + +#ifndef _di_f_type_uint128ss_increase_by_ + f_status_t f_type_uint128ss_increase_by(const f_array_length_t amount, f_uint128ss_t *uint128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint128ss->used + amount > uint128ss->size) { + if (uint128ss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_uint128ss_resize(uint128ss->used + amount, uint128ss); + } + + return F_data_not; + } +#endif // _di_f_type_uint128ss_increase_by_ + +#ifndef _di_f_type_uint128ss_resize_ + f_status_t f_type_uint128ss_resize(const f_array_length_t length, f_uint128ss_t *uint128ss) { + #ifndef _di_level_0_parameter_checking_ + if (!uint128ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint128ss_resize(length, uint128ss); + } +#endif // _di_f_type_uint128ss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/int128.h b/level_0/f_type_array/c/type_array/int128.h new file mode 100644 index 0000000..43372e5 --- /dev/null +++ b/level_0/f_type_array/c/type_array/int128.h @@ -0,0 +1,687 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines data to be used for/by type (array) related functionality. + * + * This is auto-included by type_array.h and should not need to be explicitly included. + */ +#ifndef _F_type_array_int128_h +#define _F_type_array_int128_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the int128s array. + * + * @param length + * The new size to use. + * @param int128s + * The int128s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_int128s_adjust_ + extern f_status_t f_type_int128s_adjust(const f_array_length_t length, f_int128s_t *int128s); +#endif // _di_f_type_int128s_adjust_ + +/** + * Append the source int128s onto the destination. + * + * @param source + * The source int128s to append. + * @param destination + * The destination int128s the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int128s_append_ + extern f_status_t f_type_int128s_append(const f_int128s_t source, f_int128s_t *destination); +#endif // _di_f_type_int128s_append_ + +/** + * Resize the int128s 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param int128s + * The int128s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_int128s_decimate_by_ + extern f_status_t f_type_int128s_decimate_by(const f_array_length_t amount, f_int128s_t *int128s); +#endif // _di_f_type_int128s_decimate_by_ + +/** + * Resize the int128s 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param int128s + * The int128s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int128s_decrease_by_ + extern f_status_t f_type_int128s_decrease_by(const f_array_length_t amount, f_int128s_t *int128s); +#endif // _di_f_type_int128s_decrease_by_ + +/** + * Increase the size of the int128s array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param int128s + * The int128s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int128s_increase_ + extern f_status_t f_type_int128s_increase(const uint16_t step, f_int128s_t *int128s); +#endif // _di_f_type_int128s_increase_ + +/** + * Resize the int128s 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param int128s + * The int128s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int128s_increase_by_ + extern f_status_t f_type_int128s_increase_by(const f_array_length_t amount, f_int128s_t *int128s); +#endif // _di_f_type_int128s_increase_by_ + +/** + * Resize the int128s array. + * + * @param length + * The new size to use. + * @param int128s + * The int128s array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int128s_resize_ + extern f_status_t f_type_int128s_resize(const f_array_length_t length, f_int128s_t *int128s); +#endif // _di_f_type_int128s_resize_ + +/** + * Resize the int128ss array. + * + * @param length + * The new size to use. + * @param int128ss + * The int128ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int128ss_adjust_ + extern f_status_t f_type_int128ss_adjust(const f_array_length_t length, f_int128ss_t *int128ss); +#endif // _di_f_type_int128ss_adjust_ + +/** + * Append the source int128ss onto the destination. + * + * @param source + * The source int128ss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int128ss_append_ + extern f_status_t f_type_int128ss_append(const f_int128ss_t source, f_int128ss_t *destination); +#endif // _di_f_type_int128ss_append_ + +/** + * Resize the int128ss array. + * + * @param length + * The new size to use. + * @param int128ss + * The int128ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int128ss_adjust_ + extern f_status_t f_type_int128ss_adjust(const f_array_length_t length, f_int128ss_t *int128ss); +#endif // _di_f_type_int128ss_adjust_ + +/** + * Resize the int128ss 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 int128ss + * The int128ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int128ss_decimate_by_ + extern f_status_t f_type_int128ss_decimate_by(const f_array_length_t amount, f_int128ss_t *int128ss); +#endif // _di_f_type_int128ss_decimate_by_ + +/** + * Resize the int128ss 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 int128ss + * The int128ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int128ss_decrease_by_ + extern f_status_t f_type_int128ss_decrease_by(const f_array_length_t amount, f_int128ss_t *int128ss); +#endif // _di_f_type_int128ss_decrease_by_ + +/** + * Increase the size of the int128ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param int128ss + * The int128ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int128ss_increase_ + extern f_status_t f_type_int128ss_increase(const uint16_t step, f_int128ss_t *int128ss); +#endif // _di_f_type_int128ss_increase_ + +/** + * Resize the int128ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param int128ss + * The int128ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int128ss_increase_by_ + extern f_status_t f_type_int128ss_increase_by(const f_array_length_t amount, f_int128ss_t *int128ss); +#endif // _di_f_type_int128ss_increase_by_ + +/** + * Resize the int128ss array. + * + * @param length + * The new size to use. + * @param int128ss + * The int128ss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int128ss_resize_ + extern f_status_t f_type_int128ss_resize(const f_array_length_t length, f_int128ss_t *int128ss); +#endif // _di_f_type_int128ss_resize_ + +/** + * Resize the string uint128s array. + * + * @param length + * The new size to use. + * @param uint128s + * The string uint128s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_uint128s_adjust_ + extern f_status_t f_type_uint128s_adjust(const f_array_length_t length, f_uint128s_t *uint128s); +#endif // _di_f_type_uint128s_adjust_ + +/** + * Append the source uint128s onto the destination. + * + * @param source + * The source uint128s to append. + * @param destination + * The destination uint128s the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint128s_append_ + extern f_status_t f_type_uint128s_append(const f_uint128s_t source, f_uint128s_t *destination); +#endif // _di_f_type_uint128s_append_ + +/** + * Resize the string uint128s 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param uint128s + * The string uint128s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_uint128s_decimate_by_ + extern f_status_t f_type_uint128s_decimate_by(const f_array_length_t amount, f_uint128s_t *uint128s); +#endif // _di_f_type_uint128s_decimate_by_ + +/** + * Resize the string uint128s 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param uint128s + * The string uint128s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint128s_decrease_by_ + extern f_status_t f_type_uint128s_decrease_by(const f_array_length_t amount, f_uint128s_t *uint128s); +#endif // _di_f_type_uint128s_decrease_by_ + +/** + * Increase the size of the string uint128s array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param uint128s + * The string uint128s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint128s_increase_ + extern f_status_t f_type_uint128s_increase(const uint16_t step, f_uint128s_t *uint128s); +#endif // _di_f_type_uint128s_increase_ + +/** + * Resize the string uint128s 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param uint128s + * The string uint128s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint128s_increase_by_ + extern f_status_t f_type_uint128s_increase_by(const f_array_length_t amount, f_uint128s_t *uint128s); +#endif // _di_f_type_uint128s_increase_by_ + +/** + * Resize the string uint128s array. + * + * @param length + * The new size to use. + * @param uint128s + * The string uint128s array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint128s_resize_ + extern f_status_t f_type_uint128s_resize(const f_array_length_t length, f_uint128s_t *uint128s); +#endif // _di_f_type_uint128s_resize_ + +/** + * Resize the string uint128ss array. + * + * @param length + * The new size to use. + * @param uint128ss + * The string uint128ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint128ss_adjust_ + extern f_status_t f_type_uint128ss_adjust(const f_array_length_t length, f_uint128ss_t *uint128ss); +#endif // _di_f_type_uint128ss_adjust_ + +/** + * Append the source uint128ss onto the destination. + * + * @param source + * The source uint128ss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint128ss_append_ + extern f_status_t f_type_uint128ss_append(const f_uint128ss_t source, f_uint128ss_t *destination); +#endif // _di_f_type_uint128ss_append_ + +/** + * Resize the string uint128ss array. + * + * @param length + * The new size to use. + * @param uint128ss + * The string uint128ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint128ss_adjust_ + extern f_status_t f_type_uint128ss_adjust(const f_array_length_t length, f_uint128ss_t *uint128ss); +#endif // _di_f_type_uint128ss_adjust_ + +/** + * Resize the string uint128ss 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 uint128ss + * The string uint128ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint128ss_decimate_by_ + extern f_status_t f_type_uint128ss_decimate_by(const f_array_length_t amount, f_uint128ss_t *uint128ss); +#endif // _di_f_type_uint128ss_decimate_by_ + +/** + * Resize the string uint128ss 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 uint128ss + * The string uint128ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint128ss_decrease_by_ + extern f_status_t f_type_uint128ss_decrease_by(const f_array_length_t amount, f_uint128ss_t *uint128ss); +#endif // _di_f_type_uint128ss_decrease_by_ + +/** + * Increase the size of the string uint128ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param uint128ss + * The string uint128ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint128ss_increase_ + extern f_status_t f_type_uint128ss_increase(const uint16_t step, f_uint128ss_t *uint128ss); +#endif // _di_f_type_uint128ss_increase_ + +/** + * Resize the string uint128ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param uint128ss + * The string uint128ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint128ss_increase_by_ + extern f_status_t f_type_uint128ss_increase_by(const f_array_length_t amount, f_uint128ss_t *uint128ss); +#endif // _di_f_type_uint128ss_increase_by_ + +/** + * Resize the string uint128ss array. + * + * @param length + * The new size to use. + * @param uint128ss + * The string uint128ss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint128ss_resize_ + extern f_status_t f_type_uint128ss_resize(const f_array_length_t length, f_uint128ss_t *uint128ss); +#endif // _di_f_type_uint128ss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_array_int128_h diff --git a/level_0/f_type_array/c/type_array/int16.c b/level_0/f_type_array/c/type_array/int16.c new file mode 100644 index 0000000..109a397 --- /dev/null +++ b/level_0/f_type_array/c/type_array/int16.c @@ -0,0 +1,459 @@ +#include "../type_array.h" +#include "int16.h" +#include "private-int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_type_int16s_adjust_ + f_status_t f_type_int16s_adjust(const f_array_length_t length, f_int16s_t *int16s) { + #ifndef _di_level_0_parameter_checking_ + if (!int16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int16s_adjust(length, int16s); + } +#endif // _di_f_type_int16s_adjust_ + +#ifndef _di_f_type_int16s_append_ + f_status_t f_type_int16s_append(const f_int16s_t source, f_int16s_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_int16s_append(source, destination); + } +#endif // _di_f_type_int16s_append_ + +#ifndef _di_f_type_int16s_decimate_by_ + f_status_t f_type_int16s_decimate_by(const f_array_length_t amount, f_int16s_t *int16s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int16s->size - amount > 0) { + return private_f_type_int16s_adjust(int16s->size - amount, int16s); + } + + return private_f_type_int16s_adjust(0, int16s); + } +#endif // _di_f_type_int16s_decimate_by_ + +#ifndef _di_f_type_int16s_decrease_by_ + f_status_t f_type_int16s_decrease_by(const f_array_length_t amount, f_int16s_t *int16s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int16s->size - amount > 0) { + return private_f_type_int16s_resize(int16s->size - amount, int16s); + } + + return private_f_type_int16s_resize(0, int16s); + } +#endif // _di_f_type_int16s_decrease_by_ + +#ifndef _di_f_type_int16s_increase_ + f_status_t f_type_int16s_increase(const uint16_t step, f_int16s_t *int16s) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!int16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int16s->used + 1 > int16s->size) { + f_array_length_t size = int16s->used + step; + + if (size > F_array_length_t_size_d) { + if (int16s->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_int16s_resize(size, int16s); + } + + return F_data_not; + } +#endif // _di_f_type_int16s_increase_ + +#ifndef _di_f_type_int16s_increase_by_ + f_status_t f_type_int16s_increase_by(const f_array_length_t amount, f_int16s_t *int16s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int16s->used + amount > int16s->size) { + if (int16s->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_int16s_resize(int16s->used + amount, int16s); + } + + return F_data_not; + } +#endif // _di_f_type_int16s_increase_by_ + +#ifndef _di_f_type_int16s_resize_ + f_status_t f_type_int16s_resize(const f_array_length_t length, f_int16s_t *int16s) { + #ifndef _di_level_0_parameter_checking_ + if (!int16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int16s_resize(length, int16s); + } +#endif // _di_f_type_int16s_resize_ + +#ifndef _di_f_type_int16ss_adjust_ + f_status_t f_type_int16ss_adjust(const f_array_length_t length, f_int16ss_t *int16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!int16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int16ss_adjust(length, int16ss); + } +#endif // _di_f_type_int16ss_adjust_ + +#ifndef _di_f_type_int16ss_append_ + f_status_t f_type_int16ss_append(const f_int16ss_t source, f_int16ss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_int16ss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_int16s_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_int16ss_append_ + +#ifndef _di_f_type_int16ss_decimate_by_ + f_status_t f_type_int16ss_decimate_by(const f_array_length_t amount, f_int16ss_t *int16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int16ss->size - amount > 0) { + return private_f_type_int16ss_adjust(int16ss->size - amount, int16ss); + } + + return private_f_type_int16ss_adjust(0, int16ss); + } +#endif // _di_f_type_int16ss_decimate_by_ + +#ifndef _di_f_type_int16ss_decrease_by_ + f_status_t f_type_int16ss_decrease_by(const f_array_length_t amount, f_int16ss_t *int16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int16ss->size - amount > 0) { + return private_f_type_int16ss_resize(int16ss->size - amount, int16ss); + } + + return private_f_type_int16ss_resize(0, int16ss); + } +#endif // _di_f_type_int16ss_decrease_by_ + +#ifndef _di_f_type_int16ss_increase_ + f_status_t f_type_int16ss_increase(const uint16_t step, f_int16ss_t *int16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!int16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int16ss->used + 1 > int16ss->size) { + f_array_length_t size = int16ss->used + step; + + if (size > F_array_length_t_size_d) { + if (int16ss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_int16ss_resize(size, int16ss); + } + + return F_data_not; + } +#endif // _di_f_type_int16ss_increase_ + +#ifndef _di_f_type_int16ss_increase_by_ + f_status_t f_type_int16ss_increase_by(const f_array_length_t amount, f_int16ss_t *int16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int16ss->used + amount > int16ss->size) { + if (int16ss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_int16ss_resize(int16ss->used + amount, int16ss); + } + + return F_data_not; + } +#endif // _di_f_type_int16ss_increase_by_ + +#ifndef _di_f_type_int16ss_resize_ + f_status_t f_type_int16ss_resize(const f_array_length_t length, f_int16ss_t *int16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!int16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int16ss_resize(length, int16ss); + } +#endif // _di_f_type_int16ss_resize_ + +#ifndef _di_f_type_uint16s_adjust_ + f_status_t f_type_uint16s_adjust(const f_array_length_t length, f_uint16s_t *uint16s) { + #ifndef _di_level_0_parameter_checking_ + if (!uint16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint16s_adjust(length, uint16s); + } +#endif // _di_f_type_uint16s_adjust_ + +#ifndef _di_f_type_uint16s_append_ + f_status_t f_type_uint16s_append(const f_uint16s_t source, f_uint16s_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_uint16s_append(source, destination); + } +#endif // _di_f_type_uint16s_append_ + +#ifndef _di_f_type_uint16s_decimate_by_ + f_status_t f_type_uint16s_decimate_by(const f_array_length_t amount, f_uint16s_t *uint16s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint16s->size - amount > 0) { + return private_f_type_uint16s_adjust(uint16s->size - amount, uint16s); + } + + return private_f_type_uint16s_adjust(0, uint16s); + } +#endif // _di_f_type_uint16s_decimate_by_ + +#ifndef _di_f_type_uint16s_decrease_by_ + f_status_t f_type_uint16s_decrease_by(const f_array_length_t amount, f_uint16s_t *uint16s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint16s->size - amount > 0) { + return private_f_type_uint16s_resize(uint16s->size - amount, uint16s); + } + + return private_f_type_uint16s_resize(0, uint16s); + } +#endif // _di_f_type_uint16s_decrease_by_ + +#ifndef _di_f_type_uint16s_increase_ + f_status_t f_type_uint16s_increase(const uint16_t step, f_uint16s_t *uint16s) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!uint16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint16s->used + 1 > uint16s->size) { + f_array_length_t size = uint16s->used + step; + + if (size > F_array_length_t_size_d) { + if (uint16s->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_uint16s_resize(size, uint16s); + } + + return F_data_not; + } +#endif // _di_f_type_uint16s_increase_ + +#ifndef _di_f_type_uint16s_increase_by_ + f_status_t f_type_uint16s_increase_by(const f_array_length_t amount, f_uint16s_t *uint16s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint16s->used + amount > uint16s->size) { + if (uint16s->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_uint16s_resize(uint16s->used + amount, uint16s); + } + + return F_data_not; + } +#endif // _di_f_type_uint16s_increase_by_ + +#ifndef _di_f_type_uint16s_resize_ + f_status_t f_type_uint16s_resize(const f_array_length_t length, f_uint16s_t *uint16s) { + #ifndef _di_level_0_parameter_checking_ + if (!uint16s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint16s_resize(length, uint16s); + } +#endif // _di_f_type_uint16s_resize_ + +#ifndef _di_f_type_uint16ss_adjust_ + f_status_t f_type_uint16ss_adjust(const f_array_length_t length, f_uint16ss_t *uint16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!uint16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint16ss_adjust(length, uint16ss); + } +#endif // _di_f_type_uint16ss_adjust_ + +#ifndef _di_f_type_uint16ss_append_ + f_status_t f_type_uint16ss_append(const f_uint16ss_t source, f_uint16ss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_uint16ss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_uint16s_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_uint16ss_append_ + +#ifndef _di_f_type_uint16ss_decimate_by_ + f_status_t f_type_uint16ss_decimate_by(const f_array_length_t amount, f_uint16ss_t *uint16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint16ss->size - amount > 0) { + return private_f_type_uint16ss_adjust(uint16ss->size - amount, uint16ss); + } + + return private_f_type_uint16ss_adjust(0, uint16ss); + } +#endif // _di_f_type_uint16ss_decimate_by_ + +#ifndef _di_f_type_uint16ss_decrease_by_ + f_status_t f_type_uint16ss_decrease_by(const f_array_length_t amount, f_uint16ss_t *uint16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint16ss->size - amount > 0) { + return private_f_type_uint16ss_resize(uint16ss->size - amount, uint16ss); + } + + return private_f_type_uint16ss_resize(0, uint16ss); + } +#endif // _di_f_type_uint16ss_decrease_by_ + +#ifndef _di_f_type_uint16ss_increase_ + f_status_t f_type_uint16ss_increase(const uint16_t step, f_uint16ss_t *uint16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!uint16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint16ss->used + 1 > uint16ss->size) { + f_array_length_t size = uint16ss->used + step; + + if (size > F_array_length_t_size_d) { + if (uint16ss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_uint16ss_resize(size, uint16ss); + } + + return F_data_not; + } +#endif // _di_f_type_uint16ss_increase_ + +#ifndef _di_f_type_uint16ss_increase_by_ + f_status_t f_type_uint16ss_increase_by(const f_array_length_t amount, f_uint16ss_t *uint16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint16ss->used + amount > uint16ss->size) { + if (uint16ss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_uint16ss_resize(uint16ss->used + amount, uint16ss); + } + + return F_data_not; + } +#endif // _di_f_type_uint16ss_increase_by_ + +#ifndef _di_f_type_uint16ss_resize_ + f_status_t f_type_uint16ss_resize(const f_array_length_t length, f_uint16ss_t *uint16ss) { + #ifndef _di_level_0_parameter_checking_ + if (!uint16ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint16ss_resize(length, uint16ss); + } +#endif // _di_f_type_uint16ss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/int16.h b/level_0/f_type_array/c/type_array/int16.h new file mode 100644 index 0000000..15c2a05 --- /dev/null +++ b/level_0/f_type_array/c/type_array/int16.h @@ -0,0 +1,687 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines data to be used for/by type (array) related functionality. + * + * This is auto-included by type_array.h and should not need to be explicitly included. + */ +#ifndef _F_type_array_int16_h +#define _F_type_array_int16_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the int16s array. + * + * @param length + * The new size to use. + * @param int16s + * The int16s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_int16s_adjust_ + extern f_status_t f_type_int16s_adjust(const f_array_length_t length, f_int16s_t *int16s); +#endif // _di_f_type_int16s_adjust_ + +/** + * Append the source int16s onto the destination. + * + * @param source + * The source int16s to append. + * @param destination + * The destination int16s the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int16s_append_ + extern f_status_t f_type_int16s_append(const f_int16s_t source, f_int16s_t *destination); +#endif // _di_f_type_int16s_append_ + +/** + * Resize the int16s 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param int16s + * The int16s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_int16s_decimate_by_ + extern f_status_t f_type_int16s_decimate_by(const f_array_length_t amount, f_int16s_t *int16s); +#endif // _di_f_type_int16s_decimate_by_ + +/** + * Resize the int16s 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param int16s + * The int16s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int16s_decrease_by_ + extern f_status_t f_type_int16s_decrease_by(const f_array_length_t amount, f_int16s_t *int16s); +#endif // _di_f_type_int16s_decrease_by_ + +/** + * Increase the size of the int16s array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param int16s + * The int16s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int16s_increase_ + extern f_status_t f_type_int16s_increase(const uint16_t step, f_int16s_t *int16s); +#endif // _di_f_type_int16s_increase_ + +/** + * Resize the int16s 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param int16s + * The int16s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int16s_increase_by_ + extern f_status_t f_type_int16s_increase_by(const f_array_length_t amount, f_int16s_t *int16s); +#endif // _di_f_type_int16s_increase_by_ + +/** + * Resize the int16s array. + * + * @param length + * The new size to use. + * @param int16s + * The int16s array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int16s_resize_ + extern f_status_t f_type_int16s_resize(const f_array_length_t length, f_int16s_t *int16s); +#endif // _di_f_type_int16s_resize_ + +/** + * Resize the int16ss array. + * + * @param length + * The new size to use. + * @param int16ss + * The int16ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int16ss_adjust_ + extern f_status_t f_type_int16ss_adjust(const f_array_length_t length, f_int16ss_t *int16ss); +#endif // _di_f_type_int16ss_adjust_ + +/** + * Append the source int16ss onto the destination. + * + * @param source + * The source int16ss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int16ss_append_ + extern f_status_t f_type_int16ss_append(const f_int16ss_t source, f_int16ss_t *destination); +#endif // _di_f_type_int16ss_append_ + +/** + * Resize the int16ss array. + * + * @param length + * The new size to use. + * @param int16ss + * The int16ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int16ss_adjust_ + extern f_status_t f_type_int16ss_adjust(const f_array_length_t length, f_int16ss_t *int16ss); +#endif // _di_f_type_int16ss_adjust_ + +/** + * Resize the int16ss 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 int16ss + * The int16ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int16ss_decimate_by_ + extern f_status_t f_type_int16ss_decimate_by(const f_array_length_t amount, f_int16ss_t *int16ss); +#endif // _di_f_type_int16ss_decimate_by_ + +/** + * Resize the int16ss 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 int16ss + * The int16ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int16ss_decrease_by_ + extern f_status_t f_type_int16ss_decrease_by(const f_array_length_t amount, f_int16ss_t *int16ss); +#endif // _di_f_type_int16ss_decrease_by_ + +/** + * Increase the size of the int16ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param int16ss + * The int16ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int16ss_increase_ + extern f_status_t f_type_int16ss_increase(const uint16_t step, f_int16ss_t *int16ss); +#endif // _di_f_type_int16ss_increase_ + +/** + * Resize the int16ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param int16ss + * The int16ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int16ss_increase_by_ + extern f_status_t f_type_int16ss_increase_by(const f_array_length_t amount, f_int16ss_t *int16ss); +#endif // _di_f_type_int16ss_increase_by_ + +/** + * Resize the int16ss array. + * + * @param length + * The new size to use. + * @param int16ss + * The int16ss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int16ss_resize_ + extern f_status_t f_type_int16ss_resize(const f_array_length_t length, f_int16ss_t *int16ss); +#endif // _di_f_type_int16ss_resize_ + +/** + * Resize the string uint16s array. + * + * @param length + * The new size to use. + * @param uint16s + * The string uint16s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_uint16s_adjust_ + extern f_status_t f_type_uint16s_adjust(const f_array_length_t length, f_uint16s_t *uint16s); +#endif // _di_f_type_uint16s_adjust_ + +/** + * Append the source uint16s onto the destination. + * + * @param source + * The source uint16s to append. + * @param destination + * The destination uint16s the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint16s_append_ + extern f_status_t f_type_uint16s_append(const f_uint16s_t source, f_uint16s_t *destination); +#endif // _di_f_type_uint16s_append_ + +/** + * Resize the string uint16s 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param uint16s + * The string uint16s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_uint16s_decimate_by_ + extern f_status_t f_type_uint16s_decimate_by(const f_array_length_t amount, f_uint16s_t *uint16s); +#endif // _di_f_type_uint16s_decimate_by_ + +/** + * Resize the string uint16s 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param uint16s + * The string uint16s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint16s_decrease_by_ + extern f_status_t f_type_uint16s_decrease_by(const f_array_length_t amount, f_uint16s_t *uint16s); +#endif // _di_f_type_uint16s_decrease_by_ + +/** + * Increase the size of the string uint16s array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param uint16s + * The string uint16s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint16s_increase_ + extern f_status_t f_type_uint16s_increase(const uint16_t step, f_uint16s_t *uint16s); +#endif // _di_f_type_uint16s_increase_ + +/** + * Resize the string uint16s 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param uint16s + * The string uint16s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint16s_increase_by_ + extern f_status_t f_type_uint16s_increase_by(const f_array_length_t amount, f_uint16s_t *uint16s); +#endif // _di_f_type_uint16s_increase_by_ + +/** + * Resize the string uint16s array. + * + * @param length + * The new size to use. + * @param uint16s + * The string uint16s array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint16s_resize_ + extern f_status_t f_type_uint16s_resize(const f_array_length_t length, f_uint16s_t *uint16s); +#endif // _di_f_type_uint16s_resize_ + +/** + * Resize the string uint16ss array. + * + * @param length + * The new size to use. + * @param uint16ss + * The string uint16ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint16ss_adjust_ + extern f_status_t f_type_uint16ss_adjust(const f_array_length_t length, f_uint16ss_t *uint16ss); +#endif // _di_f_type_uint16ss_adjust_ + +/** + * Append the source uint16ss onto the destination. + * + * @param source + * The source uint16ss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint16ss_append_ + extern f_status_t f_type_uint16ss_append(const f_uint16ss_t source, f_uint16ss_t *destination); +#endif // _di_f_type_uint16ss_append_ + +/** + * Resize the string uint16ss array. + * + * @param length + * The new size to use. + * @param uint16ss + * The string uint16ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint16ss_adjust_ + extern f_status_t f_type_uint16ss_adjust(const f_array_length_t length, f_uint16ss_t *uint16ss); +#endif // _di_f_type_uint16ss_adjust_ + +/** + * Resize the string uint16ss 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 uint16ss + * The string uint16ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint16ss_decimate_by_ + extern f_status_t f_type_uint16ss_decimate_by(const f_array_length_t amount, f_uint16ss_t *uint16ss); +#endif // _di_f_type_uint16ss_decimate_by_ + +/** + * Resize the string uint16ss 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 uint16ss + * The string uint16ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint16ss_decrease_by_ + extern f_status_t f_type_uint16ss_decrease_by(const f_array_length_t amount, f_uint16ss_t *uint16ss); +#endif // _di_f_type_uint16ss_decrease_by_ + +/** + * Increase the size of the string uint16ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param uint16ss + * The string uint16ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint16ss_increase_ + extern f_status_t f_type_uint16ss_increase(const uint16_t step, f_uint16ss_t *uint16ss); +#endif // _di_f_type_uint16ss_increase_ + +/** + * Resize the string uint16ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param uint16ss + * The string uint16ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint16ss_increase_by_ + extern f_status_t f_type_uint16ss_increase_by(const f_array_length_t amount, f_uint16ss_t *uint16ss); +#endif // _di_f_type_uint16ss_increase_by_ + +/** + * Resize the string uint16ss array. + * + * @param length + * The new size to use. + * @param uint16ss + * The string uint16ss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint16ss_resize_ + extern f_status_t f_type_uint16ss_resize(const f_array_length_t length, f_uint16ss_t *uint16ss); +#endif // _di_f_type_uint16ss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_array_int16_h diff --git a/level_0/f_type_array/c/type_array/int32.c b/level_0/f_type_array/c/type_array/int32.c new file mode 100644 index 0000000..4319443 --- /dev/null +++ b/level_0/f_type_array/c/type_array/int32.c @@ -0,0 +1,459 @@ +#include "../type_array.h" +#include "int32.h" +#include "private-int32.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_type_int32s_adjust_ + f_status_t f_type_int32s_adjust(const f_array_length_t length, f_int32s_t *int32s) { + #ifndef _di_level_0_parameter_checking_ + if (!int32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int32s_adjust(length, int32s); + } +#endif // _di_f_type_int32s_adjust_ + +#ifndef _di_f_type_int32s_append_ + f_status_t f_type_int32s_append(const f_int32s_t source, f_int32s_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_int32s_append(source, destination); + } +#endif // _di_f_type_int32s_append_ + +#ifndef _di_f_type_int32s_decimate_by_ + f_status_t f_type_int32s_decimate_by(const f_array_length_t amount, f_int32s_t *int32s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int32s->size - amount > 0) { + return private_f_type_int32s_adjust(int32s->size - amount, int32s); + } + + return private_f_type_int32s_adjust(0, int32s); + } +#endif // _di_f_type_int32s_decimate_by_ + +#ifndef _di_f_type_int32s_decrease_by_ + f_status_t f_type_int32s_decrease_by(const f_array_length_t amount, f_int32s_t *int32s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int32s->size - amount > 0) { + return private_f_type_int32s_resize(int32s->size - amount, int32s); + } + + return private_f_type_int32s_resize(0, int32s); + } +#endif // _di_f_type_int32s_decrease_by_ + +#ifndef _di_f_type_int32s_increase_ + f_status_t f_type_int32s_increase(const uint16_t step, f_int32s_t *int32s) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!int32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int32s->used + 1 > int32s->size) { + f_array_length_t size = int32s->used + step; + + if (size > F_array_length_t_size_d) { + if (int32s->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_int32s_resize(size, int32s); + } + + return F_data_not; + } +#endif // _di_f_type_int32s_increase_ + +#ifndef _di_f_type_int32s_increase_by_ + f_status_t f_type_int32s_increase_by(const f_array_length_t amount, f_int32s_t *int32s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int32s->used + amount > int32s->size) { + if (int32s->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_int32s_resize(int32s->used + amount, int32s); + } + + return F_data_not; + } +#endif // _di_f_type_int32s_increase_by_ + +#ifndef _di_f_type_int32s_resize_ + f_status_t f_type_int32s_resize(const f_array_length_t length, f_int32s_t *int32s) { + #ifndef _di_level_0_parameter_checking_ + if (!int32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int32s_resize(length, int32s); + } +#endif // _di_f_type_int32s_resize_ + +#ifndef _di_f_type_int32ss_adjust_ + f_status_t f_type_int32ss_adjust(const f_array_length_t length, f_int32ss_t *int32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!int32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int32ss_adjust(length, int32ss); + } +#endif // _di_f_type_int32ss_adjust_ + +#ifndef _di_f_type_int32ss_append_ + f_status_t f_type_int32ss_append(const f_int32ss_t source, f_int32ss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_int32ss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_int32s_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_int32ss_append_ + +#ifndef _di_f_type_int32ss_decimate_by_ + f_status_t f_type_int32ss_decimate_by(const f_array_length_t amount, f_int32ss_t *int32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int32ss->size - amount > 0) { + return private_f_type_int32ss_adjust(int32ss->size - amount, int32ss); + } + + return private_f_type_int32ss_adjust(0, int32ss); + } +#endif // _di_f_type_int32ss_decimate_by_ + +#ifndef _di_f_type_int32ss_decrease_by_ + f_status_t f_type_int32ss_decrease_by(const f_array_length_t amount, f_int32ss_t *int32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int32ss->size - amount > 0) { + return private_f_type_int32ss_resize(int32ss->size - amount, int32ss); + } + + return private_f_type_int32ss_resize(0, int32ss); + } +#endif // _di_f_type_int32ss_decrease_by_ + +#ifndef _di_f_type_int32ss_increase_ + f_status_t f_type_int32ss_increase(const uint16_t step, f_int32ss_t *int32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!int32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int32ss->used + 1 > int32ss->size) { + f_array_length_t size = int32ss->used + step; + + if (size > F_array_length_t_size_d) { + if (int32ss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_int32ss_resize(size, int32ss); + } + + return F_data_not; + } +#endif // _di_f_type_int32ss_increase_ + +#ifndef _di_f_type_int32ss_increase_by_ + f_status_t f_type_int32ss_increase_by(const f_array_length_t amount, f_int32ss_t *int32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int32ss->used + amount > int32ss->size) { + if (int32ss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_int32ss_resize(int32ss->used + amount, int32ss); + } + + return F_data_not; + } +#endif // _di_f_type_int32ss_increase_by_ + +#ifndef _di_f_type_int32ss_resize_ + f_status_t f_type_int32ss_resize(const f_array_length_t length, f_int32ss_t *int32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!int32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int32ss_resize(length, int32ss); + } +#endif // _di_f_type_int32ss_resize_ + +#ifndef _di_f_type_uint32s_adjust_ + f_status_t f_type_uint32s_adjust(const f_array_length_t length, f_uint32s_t *uint32s) { + #ifndef _di_level_0_parameter_checking_ + if (!uint32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint32s_adjust(length, uint32s); + } +#endif // _di_f_type_uint32s_adjust_ + +#ifndef _di_f_type_uint32s_append_ + f_status_t f_type_uint32s_append(const f_uint32s_t source, f_uint32s_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_uint32s_append(source, destination); + } +#endif // _di_f_type_uint32s_append_ + +#ifndef _di_f_type_uint32s_decimate_by_ + f_status_t f_type_uint32s_decimate_by(const f_array_length_t amount, f_uint32s_t *uint32s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint32s->size - amount > 0) { + return private_f_type_uint32s_adjust(uint32s->size - amount, uint32s); + } + + return private_f_type_uint32s_adjust(0, uint32s); + } +#endif // _di_f_type_uint32s_decimate_by_ + +#ifndef _di_f_type_uint32s_decrease_by_ + f_status_t f_type_uint32s_decrease_by(const f_array_length_t amount, f_uint32s_t *uint32s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint32s->size - amount > 0) { + return private_f_type_uint32s_resize(uint32s->size - amount, uint32s); + } + + return private_f_type_uint32s_resize(0, uint32s); + } +#endif // _di_f_type_uint32s_decrease_by_ + +#ifndef _di_f_type_uint32s_increase_ + f_status_t f_type_uint32s_increase(const uint16_t step, f_uint32s_t *uint32s) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!uint32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint32s->used + 1 > uint32s->size) { + f_array_length_t size = uint32s->used + step; + + if (size > F_array_length_t_size_d) { + if (uint32s->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_uint32s_resize(size, uint32s); + } + + return F_data_not; + } +#endif // _di_f_type_uint32s_increase_ + +#ifndef _di_f_type_uint32s_increase_by_ + f_status_t f_type_uint32s_increase_by(const f_array_length_t amount, f_uint32s_t *uint32s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint32s->used + amount > uint32s->size) { + if (uint32s->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_uint32s_resize(uint32s->used + amount, uint32s); + } + + return F_data_not; + } +#endif // _di_f_type_uint32s_increase_by_ + +#ifndef _di_f_type_uint32s_resize_ + f_status_t f_type_uint32s_resize(const f_array_length_t length, f_uint32s_t *uint32s) { + #ifndef _di_level_0_parameter_checking_ + if (!uint32s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint32s_resize(length, uint32s); + } +#endif // _di_f_type_uint32s_resize_ + +#ifndef _di_f_type_uint32ss_adjust_ + f_status_t f_type_uint32ss_adjust(const f_array_length_t length, f_uint32ss_t *uint32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!uint32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint32ss_adjust(length, uint32ss); + } +#endif // _di_f_type_uint32ss_adjust_ + +#ifndef _di_f_type_uint32ss_append_ + f_status_t f_type_uint32ss_append(const f_uint32ss_t source, f_uint32ss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_uint32ss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_uint32s_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_uint32ss_append_ + +#ifndef _di_f_type_uint32ss_decimate_by_ + f_status_t f_type_uint32ss_decimate_by(const f_array_length_t amount, f_uint32ss_t *uint32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint32ss->size - amount > 0) { + return private_f_type_uint32ss_adjust(uint32ss->size - amount, uint32ss); + } + + return private_f_type_uint32ss_adjust(0, uint32ss); + } +#endif // _di_f_type_uint32ss_decimate_by_ + +#ifndef _di_f_type_uint32ss_decrease_by_ + f_status_t f_type_uint32ss_decrease_by(const f_array_length_t amount, f_uint32ss_t *uint32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint32ss->size - amount > 0) { + return private_f_type_uint32ss_resize(uint32ss->size - amount, uint32ss); + } + + return private_f_type_uint32ss_resize(0, uint32ss); + } +#endif // _di_f_type_uint32ss_decrease_by_ + +#ifndef _di_f_type_uint32ss_increase_ + f_status_t f_type_uint32ss_increase(const uint16_t step, f_uint32ss_t *uint32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!uint32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint32ss->used + 1 > uint32ss->size) { + f_array_length_t size = uint32ss->used + step; + + if (size > F_array_length_t_size_d) { + if (uint32ss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_uint32ss_resize(size, uint32ss); + } + + return F_data_not; + } +#endif // _di_f_type_uint32ss_increase_ + +#ifndef _di_f_type_uint32ss_increase_by_ + f_status_t f_type_uint32ss_increase_by(const f_array_length_t amount, f_uint32ss_t *uint32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint32ss->used + amount > uint32ss->size) { + if (uint32ss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_uint32ss_resize(uint32ss->used + amount, uint32ss); + } + + return F_data_not; + } +#endif // _di_f_type_uint32ss_increase_by_ + +#ifndef _di_f_type_uint32ss_resize_ + f_status_t f_type_uint32ss_resize(const f_array_length_t length, f_uint32ss_t *uint32ss) { + #ifndef _di_level_0_parameter_checking_ + if (!uint32ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint32ss_resize(length, uint32ss); + } +#endif // _di_f_type_uint32ss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/int32.h b/level_0/f_type_array/c/type_array/int32.h new file mode 100644 index 0000000..10a0762 --- /dev/null +++ b/level_0/f_type_array/c/type_array/int32.h @@ -0,0 +1,687 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines data to be used for/by type (array) related functionality. + * + * This is auto-included by type_array.h and should not need to be explicitly included. + */ +#ifndef _F_type_array_int32_h +#define _F_type_array_int32_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the int32s array. + * + * @param length + * The new size to use. + * @param int32s + * The int32s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_int32s_adjust_ + extern f_status_t f_type_int32s_adjust(const f_array_length_t length, f_int32s_t *int32s); +#endif // _di_f_type_int32s_adjust_ + +/** + * Append the source int32s onto the destination. + * + * @param source + * The source int32s to append. + * @param destination + * The destination int32s the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int32s_append_ + extern f_status_t f_type_int32s_append(const f_int32s_t source, f_int32s_t *destination); +#endif // _di_f_type_int32s_append_ + +/** + * Resize the int32s 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param int32s + * The int32s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_int32s_decimate_by_ + extern f_status_t f_type_int32s_decimate_by(const f_array_length_t amount, f_int32s_t *int32s); +#endif // _di_f_type_int32s_decimate_by_ + +/** + * Resize the int32s 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param int32s + * The int32s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int32s_decrease_by_ + extern f_status_t f_type_int32s_decrease_by(const f_array_length_t amount, f_int32s_t *int32s); +#endif // _di_f_type_int32s_decrease_by_ + +/** + * Increase the size of the int32s array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param int32s + * The int32s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int32s_increase_ + extern f_status_t f_type_int32s_increase(const uint16_t step, f_int32s_t *int32s); +#endif // _di_f_type_int32s_increase_ + +/** + * Resize the int32s 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param int32s + * The int32s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int32s_increase_by_ + extern f_status_t f_type_int32s_increase_by(const f_array_length_t amount, f_int32s_t *int32s); +#endif // _di_f_type_int32s_increase_by_ + +/** + * Resize the int32s array. + * + * @param length + * The new size to use. + * @param int32s + * The int32s array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int32s_resize_ + extern f_status_t f_type_int32s_resize(const f_array_length_t length, f_int32s_t *int32s); +#endif // _di_f_type_int32s_resize_ + +/** + * Resize the int32ss array. + * + * @param length + * The new size to use. + * @param int32ss + * The int32ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int32ss_adjust_ + extern f_status_t f_type_int32ss_adjust(const f_array_length_t length, f_int32ss_t *int32ss); +#endif // _di_f_type_int32ss_adjust_ + +/** + * Append the source int32ss onto the destination. + * + * @param source + * The source int32ss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int32ss_append_ + extern f_status_t f_type_int32ss_append(const f_int32ss_t source, f_int32ss_t *destination); +#endif // _di_f_type_int32ss_append_ + +/** + * Resize the int32ss array. + * + * @param length + * The new size to use. + * @param int32ss + * The int32ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int32ss_adjust_ + extern f_status_t f_type_int32ss_adjust(const f_array_length_t length, f_int32ss_t *int32ss); +#endif // _di_f_type_int32ss_adjust_ + +/** + * Resize the int32ss 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 int32ss + * The int32ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int32ss_decimate_by_ + extern f_status_t f_type_int32ss_decimate_by(const f_array_length_t amount, f_int32ss_t *int32ss); +#endif // _di_f_type_int32ss_decimate_by_ + +/** + * Resize the int32ss 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 int32ss + * The int32ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int32ss_decrease_by_ + extern f_status_t f_type_int32ss_decrease_by(const f_array_length_t amount, f_int32ss_t *int32ss); +#endif // _di_f_type_int32ss_decrease_by_ + +/** + * Increase the size of the int32ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param int32ss + * The int32ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int32ss_increase_ + extern f_status_t f_type_int32ss_increase(const uint16_t step, f_int32ss_t *int32ss); +#endif // _di_f_type_int32ss_increase_ + +/** + * Resize the int32ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param int32ss + * The int32ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int32ss_increase_by_ + extern f_status_t f_type_int32ss_increase_by(const f_array_length_t amount, f_int32ss_t *int32ss); +#endif // _di_f_type_int32ss_increase_by_ + +/** + * Resize the int32ss array. + * + * @param length + * The new size to use. + * @param int32ss + * The int32ss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int32ss_resize_ + extern f_status_t f_type_int32ss_resize(const f_array_length_t length, f_int32ss_t *int32ss); +#endif // _di_f_type_int32ss_resize_ + +/** + * Resize the string uint32s array. + * + * @param length + * The new size to use. + * @param uint32s + * The string uint32s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_uint32s_adjust_ + extern f_status_t f_type_uint32s_adjust(const f_array_length_t length, f_uint32s_t *uint32s); +#endif // _di_f_type_uint32s_adjust_ + +/** + * Append the source uint32s onto the destination. + * + * @param source + * The source uint32s to append. + * @param destination + * The destination uint32s the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint32s_append_ + extern f_status_t f_type_uint32s_append(const f_uint32s_t source, f_uint32s_t *destination); +#endif // _di_f_type_uint32s_append_ + +/** + * Resize the string uint32s 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param uint32s + * The string uint32s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_uint32s_decimate_by_ + extern f_status_t f_type_uint32s_decimate_by(const f_array_length_t amount, f_uint32s_t *uint32s); +#endif // _di_f_type_uint32s_decimate_by_ + +/** + * Resize the string uint32s 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param uint32s + * The string uint32s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint32s_decrease_by_ + extern f_status_t f_type_uint32s_decrease_by(const f_array_length_t amount, f_uint32s_t *uint32s); +#endif // _di_f_type_uint32s_decrease_by_ + +/** + * Increase the size of the string uint32s array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param uint32s + * The string uint32s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint32s_increase_ + extern f_status_t f_type_uint32s_increase(const uint16_t step, f_uint32s_t *uint32s); +#endif // _di_f_type_uint32s_increase_ + +/** + * Resize the string uint32s 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param uint32s + * The string uint32s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint32s_increase_by_ + extern f_status_t f_type_uint32s_increase_by(const f_array_length_t amount, f_uint32s_t *uint32s); +#endif // _di_f_type_uint32s_increase_by_ + +/** + * Resize the string uint32s array. + * + * @param length + * The new size to use. + * @param uint32s + * The string uint32s array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint32s_resize_ + extern f_status_t f_type_uint32s_resize(const f_array_length_t length, f_uint32s_t *uint32s); +#endif // _di_f_type_uint32s_resize_ + +/** + * Resize the string uint32ss array. + * + * @param length + * The new size to use. + * @param uint32ss + * The string uint32ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint32ss_adjust_ + extern f_status_t f_type_uint32ss_adjust(const f_array_length_t length, f_uint32ss_t *uint32ss); +#endif // _di_f_type_uint32ss_adjust_ + +/** + * Append the source uint32ss onto the destination. + * + * @param source + * The source uint32ss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint32ss_append_ + extern f_status_t f_type_uint32ss_append(const f_uint32ss_t source, f_uint32ss_t *destination); +#endif // _di_f_type_uint32ss_append_ + +/** + * Resize the string uint32ss array. + * + * @param length + * The new size to use. + * @param uint32ss + * The string uint32ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint32ss_adjust_ + extern f_status_t f_type_uint32ss_adjust(const f_array_length_t length, f_uint32ss_t *uint32ss); +#endif // _di_f_type_uint32ss_adjust_ + +/** + * Resize the string uint32ss 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 uint32ss + * The string uint32ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint32ss_decimate_by_ + extern f_status_t f_type_uint32ss_decimate_by(const f_array_length_t amount, f_uint32ss_t *uint32ss); +#endif // _di_f_type_uint32ss_decimate_by_ + +/** + * Resize the string uint32ss 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 uint32ss + * The string uint32ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint32ss_decrease_by_ + extern f_status_t f_type_uint32ss_decrease_by(const f_array_length_t amount, f_uint32ss_t *uint32ss); +#endif // _di_f_type_uint32ss_decrease_by_ + +/** + * Increase the size of the string uint32ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param uint32ss + * The string uint32ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint32ss_increase_ + extern f_status_t f_type_uint32ss_increase(const uint16_t step, f_uint32ss_t *uint32ss); +#endif // _di_f_type_uint32ss_increase_ + +/** + * Resize the string uint32ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param uint32ss + * The string uint32ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint32ss_increase_by_ + extern f_status_t f_type_uint32ss_increase_by(const f_array_length_t amount, f_uint32ss_t *uint32ss); +#endif // _di_f_type_uint32ss_increase_by_ + +/** + * Resize the string uint32ss array. + * + * @param length + * The new size to use. + * @param uint32ss + * The string uint32ss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint32ss_resize_ + extern f_status_t f_type_uint32ss_resize(const f_array_length_t length, f_uint32ss_t *uint32ss); +#endif // _di_f_type_uint32ss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_array_int32_h diff --git a/level_0/f_type_array/c/type_array/int64.c b/level_0/f_type_array/c/type_array/int64.c new file mode 100644 index 0000000..2572b19 --- /dev/null +++ b/level_0/f_type_array/c/type_array/int64.c @@ -0,0 +1,459 @@ +#include "../type_array.h" +#include "int64.h" +#include "private-int64.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_type_int64s_adjust_ + f_status_t f_type_int64s_adjust(const f_array_length_t length, f_int64s_t *int64s) { + #ifndef _di_level_0_parameter_checking_ + if (!int64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int64s_adjust(length, int64s); + } +#endif // _di_f_type_int64s_adjust_ + +#ifndef _di_f_type_int64s_append_ + f_status_t f_type_int64s_append(const f_int64s_t source, f_int64s_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_int64s_append(source, destination); + } +#endif // _di_f_type_int64s_append_ + +#ifndef _di_f_type_int64s_decimate_by_ + f_status_t f_type_int64s_decimate_by(const f_array_length_t amount, f_int64s_t *int64s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int64s->size - amount > 0) { + return private_f_type_int64s_adjust(int64s->size - amount, int64s); + } + + return private_f_type_int64s_adjust(0, int64s); + } +#endif // _di_f_type_int64s_decimate_by_ + +#ifndef _di_f_type_int64s_decrease_by_ + f_status_t f_type_int64s_decrease_by(const f_array_length_t amount, f_int64s_t *int64s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int64s->size - amount > 0) { + return private_f_type_int64s_resize(int64s->size - amount, int64s); + } + + return private_f_type_int64s_resize(0, int64s); + } +#endif // _di_f_type_int64s_decrease_by_ + +#ifndef _di_f_type_int64s_increase_ + f_status_t f_type_int64s_increase(const uint16_t step, f_int64s_t *int64s) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!int64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int64s->used + 1 > int64s->size) { + f_array_length_t size = int64s->used + step; + + if (size > F_array_length_t_size_d) { + if (int64s->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_int64s_resize(size, int64s); + } + + return F_data_not; + } +#endif // _di_f_type_int64s_increase_ + +#ifndef _di_f_type_int64s_increase_by_ + f_status_t f_type_int64s_increase_by(const f_array_length_t amount, f_int64s_t *int64s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int64s->used + amount > int64s->size) { + if (int64s->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_int64s_resize(int64s->used + amount, int64s); + } + + return F_data_not; + } +#endif // _di_f_type_int64s_increase_by_ + +#ifndef _di_f_type_int64s_resize_ + f_status_t f_type_int64s_resize(const f_array_length_t length, f_int64s_t *int64s) { + #ifndef _di_level_0_parameter_checking_ + if (!int64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int64s_resize(length, int64s); + } +#endif // _di_f_type_int64s_resize_ + +#ifndef _di_f_type_int64ss_adjust_ + f_status_t f_type_int64ss_adjust(const f_array_length_t length, f_int64ss_t *int64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!int64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int64ss_adjust(length, int64ss); + } +#endif // _di_f_type_int64ss_adjust_ + +#ifndef _di_f_type_int64ss_append_ + f_status_t f_type_int64ss_append(const f_int64ss_t source, f_int64ss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_int64ss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_int64s_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_int64ss_append_ + +#ifndef _di_f_type_int64ss_decimate_by_ + f_status_t f_type_int64ss_decimate_by(const f_array_length_t amount, f_int64ss_t *int64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int64ss->size - amount > 0) { + return private_f_type_int64ss_adjust(int64ss->size - amount, int64ss); + } + + return private_f_type_int64ss_adjust(0, int64ss); + } +#endif // _di_f_type_int64ss_decimate_by_ + +#ifndef _di_f_type_int64ss_decrease_by_ + f_status_t f_type_int64ss_decrease_by(const f_array_length_t amount, f_int64ss_t *int64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int64ss->size - amount > 0) { + return private_f_type_int64ss_resize(int64ss->size - amount, int64ss); + } + + return private_f_type_int64ss_resize(0, int64ss); + } +#endif // _di_f_type_int64ss_decrease_by_ + +#ifndef _di_f_type_int64ss_increase_ + f_status_t f_type_int64ss_increase(const uint16_t step, f_int64ss_t *int64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!int64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int64ss->used + 1 > int64ss->size) { + f_array_length_t size = int64ss->used + step; + + if (size > F_array_length_t_size_d) { + if (int64ss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_int64ss_resize(size, int64ss); + } + + return F_data_not; + } +#endif // _di_f_type_int64ss_increase_ + +#ifndef _di_f_type_int64ss_increase_by_ + f_status_t f_type_int64ss_increase_by(const f_array_length_t amount, f_int64ss_t *int64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int64ss->used + amount > int64ss->size) { + if (int64ss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_int64ss_resize(int64ss->used + amount, int64ss); + } + + return F_data_not; + } +#endif // _di_f_type_int64ss_increase_by_ + +#ifndef _di_f_type_int64ss_resize_ + f_status_t f_type_int64ss_resize(const f_array_length_t length, f_int64ss_t *int64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!int64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int64ss_resize(length, int64ss); + } +#endif // _di_f_type_int64ss_resize_ + +#ifndef _di_f_type_uint64s_adjust_ + f_status_t f_type_uint64s_adjust(const f_array_length_t length, f_uint64s_t *uint64s) { + #ifndef _di_level_0_parameter_checking_ + if (!uint64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint64s_adjust(length, uint64s); + } +#endif // _di_f_type_uint64s_adjust_ + +#ifndef _di_f_type_uint64s_append_ + f_status_t f_type_uint64s_append(const f_uint64s_t source, f_uint64s_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_uint64s_append(source, destination); + } +#endif // _di_f_type_uint64s_append_ + +#ifndef _di_f_type_uint64s_decimate_by_ + f_status_t f_type_uint64s_decimate_by(const f_array_length_t amount, f_uint64s_t *uint64s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint64s->size - amount > 0) { + return private_f_type_uint64s_adjust(uint64s->size - amount, uint64s); + } + + return private_f_type_uint64s_adjust(0, uint64s); + } +#endif // _di_f_type_uint64s_decimate_by_ + +#ifndef _di_f_type_uint64s_decrease_by_ + f_status_t f_type_uint64s_decrease_by(const f_array_length_t amount, f_uint64s_t *uint64s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint64s->size - amount > 0) { + return private_f_type_uint64s_resize(uint64s->size - amount, uint64s); + } + + return private_f_type_uint64s_resize(0, uint64s); + } +#endif // _di_f_type_uint64s_decrease_by_ + +#ifndef _di_f_type_uint64s_increase_ + f_status_t f_type_uint64s_increase(const uint16_t step, f_uint64s_t *uint64s) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!uint64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint64s->used + 1 > uint64s->size) { + f_array_length_t size = uint64s->used + step; + + if (size > F_array_length_t_size_d) { + if (uint64s->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_uint64s_resize(size, uint64s); + } + + return F_data_not; + } +#endif // _di_f_type_uint64s_increase_ + +#ifndef _di_f_type_uint64s_increase_by_ + f_status_t f_type_uint64s_increase_by(const f_array_length_t amount, f_uint64s_t *uint64s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint64s->used + amount > uint64s->size) { + if (uint64s->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_uint64s_resize(uint64s->used + amount, uint64s); + } + + return F_data_not; + } +#endif // _di_f_type_uint64s_increase_by_ + +#ifndef _di_f_type_uint64s_resize_ + f_status_t f_type_uint64s_resize(const f_array_length_t length, f_uint64s_t *uint64s) { + #ifndef _di_level_0_parameter_checking_ + if (!uint64s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint64s_resize(length, uint64s); + } +#endif // _di_f_type_uint64s_resize_ + +#ifndef _di_f_type_uint64ss_adjust_ + f_status_t f_type_uint64ss_adjust(const f_array_length_t length, f_uint64ss_t *uint64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!uint64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint64ss_adjust(length, uint64ss); + } +#endif // _di_f_type_uint64ss_adjust_ + +#ifndef _di_f_type_uint64ss_append_ + f_status_t f_type_uint64ss_append(const f_uint64ss_t source, f_uint64ss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_uint64ss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_uint64s_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_uint64ss_append_ + +#ifndef _di_f_type_uint64ss_decimate_by_ + f_status_t f_type_uint64ss_decimate_by(const f_array_length_t amount, f_uint64ss_t *uint64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint64ss->size - amount > 0) { + return private_f_type_uint64ss_adjust(uint64ss->size - amount, uint64ss); + } + + return private_f_type_uint64ss_adjust(0, uint64ss); + } +#endif // _di_f_type_uint64ss_decimate_by_ + +#ifndef _di_f_type_uint64ss_decrease_by_ + f_status_t f_type_uint64ss_decrease_by(const f_array_length_t amount, f_uint64ss_t *uint64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint64ss->size - amount > 0) { + return private_f_type_uint64ss_resize(uint64ss->size - amount, uint64ss); + } + + return private_f_type_uint64ss_resize(0, uint64ss); + } +#endif // _di_f_type_uint64ss_decrease_by_ + +#ifndef _di_f_type_uint64ss_increase_ + f_status_t f_type_uint64ss_increase(const uint16_t step, f_uint64ss_t *uint64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!uint64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint64ss->used + 1 > uint64ss->size) { + f_array_length_t size = uint64ss->used + step; + + if (size > F_array_length_t_size_d) { + if (uint64ss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_uint64ss_resize(size, uint64ss); + } + + return F_data_not; + } +#endif // _di_f_type_uint64ss_increase_ + +#ifndef _di_f_type_uint64ss_increase_by_ + f_status_t f_type_uint64ss_increase_by(const f_array_length_t amount, f_uint64ss_t *uint64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint64ss->used + amount > uint64ss->size) { + if (uint64ss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_uint64ss_resize(uint64ss->used + amount, uint64ss); + } + + return F_data_not; + } +#endif // _di_f_type_uint64ss_increase_by_ + +#ifndef _di_f_type_uint64ss_resize_ + f_status_t f_type_uint64ss_resize(const f_array_length_t length, f_uint64ss_t *uint64ss) { + #ifndef _di_level_0_parameter_checking_ + if (!uint64ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint64ss_resize(length, uint64ss); + } +#endif // _di_f_type_uint64ss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/int64.h b/level_0/f_type_array/c/type_array/int64.h new file mode 100644 index 0000000..803bf3d --- /dev/null +++ b/level_0/f_type_array/c/type_array/int64.h @@ -0,0 +1,687 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines data to be used for/by type (array) related functionality. + * + * This is auto-included by type_array.h and should not need to be explicitly included. + */ +#ifndef _F_type_array_int64_h +#define _F_type_array_int64_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the int64s array. + * + * @param length + * The new size to use. + * @param int64s + * The int64s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_int64s_adjust_ + extern f_status_t f_type_int64s_adjust(const f_array_length_t length, f_int64s_t *int64s); +#endif // _di_f_type_int64s_adjust_ + +/** + * Append the source int64s onto the destination. + * + * @param source + * The source int64s to append. + * @param destination + * The destination int64s the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int64s_append_ + extern f_status_t f_type_int64s_append(const f_int64s_t source, f_int64s_t *destination); +#endif // _di_f_type_int64s_append_ + +/** + * Resize the int64s 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param int64s + * The int64s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_int64s_decimate_by_ + extern f_status_t f_type_int64s_decimate_by(const f_array_length_t amount, f_int64s_t *int64s); +#endif // _di_f_type_int64s_decimate_by_ + +/** + * Resize the int64s 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param int64s + * The int64s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int64s_decrease_by_ + extern f_status_t f_type_int64s_decrease_by(const f_array_length_t amount, f_int64s_t *int64s); +#endif // _di_f_type_int64s_decrease_by_ + +/** + * Increase the size of the int64s array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param int64s + * The int64s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int64s_increase_ + extern f_status_t f_type_int64s_increase(const uint16_t step, f_int64s_t *int64s); +#endif // _di_f_type_int64s_increase_ + +/** + * Resize the int64s 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param int64s + * The int64s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int64s_increase_by_ + extern f_status_t f_type_int64s_increase_by(const f_array_length_t amount, f_int64s_t *int64s); +#endif // _di_f_type_int64s_increase_by_ + +/** + * Resize the int64s array. + * + * @param length + * The new size to use. + * @param int64s + * The int64s array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int64s_resize_ + extern f_status_t f_type_int64s_resize(const f_array_length_t length, f_int64s_t *int64s); +#endif // _di_f_type_int64s_resize_ + +/** + * Resize the int64ss array. + * + * @param length + * The new size to use. + * @param int64ss + * The int64ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int64ss_adjust_ + extern f_status_t f_type_int64ss_adjust(const f_array_length_t length, f_int64ss_t *int64ss); +#endif // _di_f_type_int64ss_adjust_ + +/** + * Append the source int64ss onto the destination. + * + * @param source + * The source int64ss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int64ss_append_ + extern f_status_t f_type_int64ss_append(const f_int64ss_t source, f_int64ss_t *destination); +#endif // _di_f_type_int64ss_append_ + +/** + * Resize the int64ss array. + * + * @param length + * The new size to use. + * @param int64ss + * The int64ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int64ss_adjust_ + extern f_status_t f_type_int64ss_adjust(const f_array_length_t length, f_int64ss_t *int64ss); +#endif // _di_f_type_int64ss_adjust_ + +/** + * Resize the int64ss 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 int64ss + * The int64ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int64ss_decimate_by_ + extern f_status_t f_type_int64ss_decimate_by(const f_array_length_t amount, f_int64ss_t *int64ss); +#endif // _di_f_type_int64ss_decimate_by_ + +/** + * Resize the int64ss 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 int64ss + * The int64ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int64ss_decrease_by_ + extern f_status_t f_type_int64ss_decrease_by(const f_array_length_t amount, f_int64ss_t *int64ss); +#endif // _di_f_type_int64ss_decrease_by_ + +/** + * Increase the size of the int64ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param int64ss + * The int64ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int64ss_increase_ + extern f_status_t f_type_int64ss_increase(const uint16_t step, f_int64ss_t *int64ss); +#endif // _di_f_type_int64ss_increase_ + +/** + * Resize the int64ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param int64ss + * The int64ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int64ss_increase_by_ + extern f_status_t f_type_int64ss_increase_by(const f_array_length_t amount, f_int64ss_t *int64ss); +#endif // _di_f_type_int64ss_increase_by_ + +/** + * Resize the int64ss array. + * + * @param length + * The new size to use. + * @param int64ss + * The int64ss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int64ss_resize_ + extern f_status_t f_type_int64ss_resize(const f_array_length_t length, f_int64ss_t *int64ss); +#endif // _di_f_type_int64ss_resize_ + +/** + * Resize the string uint64s array. + * + * @param length + * The new size to use. + * @param uint64s + * The string uint64s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_uint64s_adjust_ + extern f_status_t f_type_uint64s_adjust(const f_array_length_t length, f_uint64s_t *uint64s); +#endif // _di_f_type_uint64s_adjust_ + +/** + * Append the source uint64s onto the destination. + * + * @param source + * The source uint64s to append. + * @param destination + * The destination uint64s the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint64s_append_ + extern f_status_t f_type_uint64s_append(const f_uint64s_t source, f_uint64s_t *destination); +#endif // _di_f_type_uint64s_append_ + +/** + * Resize the string uint64s 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param uint64s + * The string uint64s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_uint64s_decimate_by_ + extern f_status_t f_type_uint64s_decimate_by(const f_array_length_t amount, f_uint64s_t *uint64s); +#endif // _di_f_type_uint64s_decimate_by_ + +/** + * Resize the string uint64s 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param uint64s + * The string uint64s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint64s_decrease_by_ + extern f_status_t f_type_uint64s_decrease_by(const f_array_length_t amount, f_uint64s_t *uint64s); +#endif // _di_f_type_uint64s_decrease_by_ + +/** + * Increase the size of the string uint64s array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param uint64s + * The string uint64s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint64s_increase_ + extern f_status_t f_type_uint64s_increase(const uint16_t step, f_uint64s_t *uint64s); +#endif // _di_f_type_uint64s_increase_ + +/** + * Resize the string uint64s 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param uint64s + * The string uint64s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint64s_increase_by_ + extern f_status_t f_type_uint64s_increase_by(const f_array_length_t amount, f_uint64s_t *uint64s); +#endif // _di_f_type_uint64s_increase_by_ + +/** + * Resize the string uint64s array. + * + * @param length + * The new size to use. + * @param uint64s + * The string uint64s array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint64s_resize_ + extern f_status_t f_type_uint64s_resize(const f_array_length_t length, f_uint64s_t *uint64s); +#endif // _di_f_type_uint64s_resize_ + +/** + * Resize the string uint64ss array. + * + * @param length + * The new size to use. + * @param uint64ss + * The string uint64ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint64ss_adjust_ + extern f_status_t f_type_uint64ss_adjust(const f_array_length_t length, f_uint64ss_t *uint64ss); +#endif // _di_f_type_uint64ss_adjust_ + +/** + * Append the source uint64ss onto the destination. + * + * @param source + * The source uint64ss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint64ss_append_ + extern f_status_t f_type_uint64ss_append(const f_uint64ss_t source, f_uint64ss_t *destination); +#endif // _di_f_type_uint64ss_append_ + +/** + * Resize the string uint64ss array. + * + * @param length + * The new size to use. + * @param uint64ss + * The string uint64ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint64ss_adjust_ + extern f_status_t f_type_uint64ss_adjust(const f_array_length_t length, f_uint64ss_t *uint64ss); +#endif // _di_f_type_uint64ss_adjust_ + +/** + * Resize the string uint64ss 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 uint64ss + * The string uint64ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint64ss_decimate_by_ + extern f_status_t f_type_uint64ss_decimate_by(const f_array_length_t amount, f_uint64ss_t *uint64ss); +#endif // _di_f_type_uint64ss_decimate_by_ + +/** + * Resize the string uint64ss 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 uint64ss + * The string uint64ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint64ss_decrease_by_ + extern f_status_t f_type_uint64ss_decrease_by(const f_array_length_t amount, f_uint64ss_t *uint64ss); +#endif // _di_f_type_uint64ss_decrease_by_ + +/** + * Increase the size of the string uint64ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param uint64ss + * The string uint64ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint64ss_increase_ + extern f_status_t f_type_uint64ss_increase(const uint16_t step, f_uint64ss_t *uint64ss); +#endif // _di_f_type_uint64ss_increase_ + +/** + * Resize the string uint64ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param uint64ss + * The string uint64ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint64ss_increase_by_ + extern f_status_t f_type_uint64ss_increase_by(const f_array_length_t amount, f_uint64ss_t *uint64ss); +#endif // _di_f_type_uint64ss_increase_by_ + +/** + * Resize the string uint64ss array. + * + * @param length + * The new size to use. + * @param uint64ss + * The string uint64ss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint64ss_resize_ + extern f_status_t f_type_uint64ss_resize(const f_array_length_t length, f_uint64ss_t *uint64ss); +#endif // _di_f_type_uint64ss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_array_int64_h diff --git a/level_0/f_type_array/c/type_array/int8.c b/level_0/f_type_array/c/type_array/int8.c new file mode 100644 index 0000000..2a62d6e --- /dev/null +++ b/level_0/f_type_array/c/type_array/int8.c @@ -0,0 +1,459 @@ +#include "../type_array.h" +#include "int8.h" +#include "private-int8.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_type_int8s_adjust_ + f_status_t f_type_int8s_adjust(const f_array_length_t length, f_int8s_t *int8s) { + #ifndef _di_level_0_parameter_checking_ + if (!int8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int8s_adjust(length, int8s); + } +#endif // _di_f_type_int8s_adjust_ + +#ifndef _di_f_type_int8s_append_ + f_status_t f_type_int8s_append(const f_int8s_t source, f_int8s_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_int8s_append(source, destination); + } +#endif // _di_f_type_int8s_append_ + +#ifndef _di_f_type_int8s_decimate_by_ + f_status_t f_type_int8s_decimate_by(const f_array_length_t amount, f_int8s_t *int8s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int8s->size - amount > 0) { + return private_f_type_int8s_adjust(int8s->size - amount, int8s); + } + + return private_f_type_int8s_adjust(0, int8s); + } +#endif // _di_f_type_int8s_decimate_by_ + +#ifndef _di_f_type_int8s_decrease_by_ + f_status_t f_type_int8s_decrease_by(const f_array_length_t amount, f_int8s_t *int8s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int8s->size - amount > 0) { + return private_f_type_int8s_resize(int8s->size - amount, int8s); + } + + return private_f_type_int8s_resize(0, int8s); + } +#endif // _di_f_type_int8s_decrease_by_ + +#ifndef _di_f_type_int8s_increase_ + f_status_t f_type_int8s_increase(const uint16_t step, f_int8s_t *int8s) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!int8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int8s->used + 1 > int8s->size) { + f_array_length_t size = int8s->used + step; + + if (size > F_array_length_t_size_d) { + if (int8s->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_int8s_resize(size, int8s); + } + + return F_data_not; + } +#endif // _di_f_type_int8s_increase_ + +#ifndef _di_f_type_int8s_increase_by_ + f_status_t f_type_int8s_increase_by(const f_array_length_t amount, f_int8s_t *int8s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int8s->used + amount > int8s->size) { + if (int8s->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_int8s_resize(int8s->used + amount, int8s); + } + + return F_data_not; + } +#endif // _di_f_type_int8s_increase_by_ + +#ifndef _di_f_type_int8s_resize_ + f_status_t f_type_int8s_resize(const f_array_length_t length, f_int8s_t *int8s) { + #ifndef _di_level_0_parameter_checking_ + if (!int8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int8s_resize(length, int8s); + } +#endif // _di_f_type_int8s_resize_ + +#ifndef _di_f_type_int8ss_adjust_ + f_status_t f_type_int8ss_adjust(const f_array_length_t length, f_int8ss_t *int8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!int8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int8ss_adjust(length, int8ss); + } +#endif // _di_f_type_int8ss_adjust_ + +#ifndef _di_f_type_int8ss_append_ + f_status_t f_type_int8ss_append(const f_int8ss_t source, f_int8ss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_int8ss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_int8s_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_int8ss_append_ + +#ifndef _di_f_type_int8ss_decimate_by_ + f_status_t f_type_int8ss_decimate_by(const f_array_length_t amount, f_int8ss_t *int8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int8ss->size - amount > 0) { + return private_f_type_int8ss_adjust(int8ss->size - amount, int8ss); + } + + return private_f_type_int8ss_adjust(0, int8ss); + } +#endif // _di_f_type_int8ss_decimate_by_ + +#ifndef _di_f_type_int8ss_decrease_by_ + f_status_t f_type_int8ss_decrease_by(const f_array_length_t amount, f_int8ss_t *int8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int8ss->size - amount > 0) { + return private_f_type_int8ss_resize(int8ss->size - amount, int8ss); + } + + return private_f_type_int8ss_resize(0, int8ss); + } +#endif // _di_f_type_int8ss_decrease_by_ + +#ifndef _di_f_type_int8ss_increase_ + f_status_t f_type_int8ss_increase(const uint16_t step, f_int8ss_t *int8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!int8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int8ss->used + 1 > int8ss->size) { + f_array_length_t size = int8ss->used + step; + + if (size > F_array_length_t_size_d) { + if (int8ss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_int8ss_resize(size, int8ss); + } + + return F_data_not; + } +#endif // _di_f_type_int8ss_increase_ + +#ifndef _di_f_type_int8ss_increase_by_ + f_status_t f_type_int8ss_increase_by(const f_array_length_t amount, f_int8ss_t *int8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!int8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (int8ss->used + amount > int8ss->size) { + if (int8ss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_int8ss_resize(int8ss->used + amount, int8ss); + } + + return F_data_not; + } +#endif // _di_f_type_int8ss_increase_by_ + +#ifndef _di_f_type_int8ss_resize_ + f_status_t f_type_int8ss_resize(const f_array_length_t length, f_int8ss_t *int8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!int8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_int8ss_resize(length, int8ss); + } +#endif // _di_f_type_int8ss_resize_ + +#ifndef _di_f_type_uint8s_adjust_ + f_status_t f_type_uint8s_adjust(const f_array_length_t length, f_uint8s_t *uint8s) { + #ifndef _di_level_0_parameter_checking_ + if (!uint8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint8s_adjust(length, uint8s); + } +#endif // _di_f_type_uint8s_adjust_ + +#ifndef _di_f_type_uint8s_append_ + f_status_t f_type_uint8s_append(const f_uint8s_t source, f_uint8s_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_uint8s_append(source, destination); + } +#endif // _di_f_type_uint8s_append_ + +#ifndef _di_f_type_uint8s_decimate_by_ + f_status_t f_type_uint8s_decimate_by(const f_array_length_t amount, f_uint8s_t *uint8s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint8s->size - amount > 0) { + return private_f_type_uint8s_adjust(uint8s->size - amount, uint8s); + } + + return private_f_type_uint8s_adjust(0, uint8s); + } +#endif // _di_f_type_uint8s_decimate_by_ + +#ifndef _di_f_type_uint8s_decrease_by_ + f_status_t f_type_uint8s_decrease_by(const f_array_length_t amount, f_uint8s_t *uint8s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint8s->size - amount > 0) { + return private_f_type_uint8s_resize(uint8s->size - amount, uint8s); + } + + return private_f_type_uint8s_resize(0, uint8s); + } +#endif // _di_f_type_uint8s_decrease_by_ + +#ifndef _di_f_type_uint8s_increase_ + f_status_t f_type_uint8s_increase(const uint16_t step, f_uint8s_t *uint8s) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!uint8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint8s->used + 1 > uint8s->size) { + f_array_length_t size = uint8s->used + step; + + if (size > F_array_length_t_size_d) { + if (uint8s->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_uint8s_resize(size, uint8s); + } + + return F_data_not; + } +#endif // _di_f_type_uint8s_increase_ + +#ifndef _di_f_type_uint8s_increase_by_ + f_status_t f_type_uint8s_increase_by(const f_array_length_t amount, f_uint8s_t *uint8s) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint8s->used + amount > uint8s->size) { + if (uint8s->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_uint8s_resize(uint8s->used + amount, uint8s); + } + + return F_data_not; + } +#endif // _di_f_type_uint8s_increase_by_ + +#ifndef _di_f_type_uint8s_resize_ + f_status_t f_type_uint8s_resize(const f_array_length_t length, f_uint8s_t *uint8s) { + #ifndef _di_level_0_parameter_checking_ + if (!uint8s) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint8s_resize(length, uint8s); + } +#endif // _di_f_type_uint8s_resize_ + +#ifndef _di_f_type_uint8ss_adjust_ + f_status_t f_type_uint8ss_adjust(const f_array_length_t length, f_uint8ss_t *uint8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!uint8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint8ss_adjust(length, uint8ss); + } +#endif // _di_f_type_uint8ss_adjust_ + +#ifndef _di_f_type_uint8ss_append_ + f_status_t f_type_uint8ss_append(const f_uint8ss_t source, f_uint8ss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_uint8ss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_uint8s_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_uint8ss_append_ + +#ifndef _di_f_type_uint8ss_decimate_by_ + f_status_t f_type_uint8ss_decimate_by(const f_array_length_t amount, f_uint8ss_t *uint8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint8ss->size - amount > 0) { + return private_f_type_uint8ss_adjust(uint8ss->size - amount, uint8ss); + } + + return private_f_type_uint8ss_adjust(0, uint8ss); + } +#endif // _di_f_type_uint8ss_decimate_by_ + +#ifndef _di_f_type_uint8ss_decrease_by_ + f_status_t f_type_uint8ss_decrease_by(const f_array_length_t amount, f_uint8ss_t *uint8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint8ss->size - amount > 0) { + return private_f_type_uint8ss_resize(uint8ss->size - amount, uint8ss); + } + + return private_f_type_uint8ss_resize(0, uint8ss); + } +#endif // _di_f_type_uint8ss_decrease_by_ + +#ifndef _di_f_type_uint8ss_increase_ + f_status_t f_type_uint8ss_increase(const uint16_t step, f_uint8ss_t *uint8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!uint8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint8ss->used + 1 > uint8ss->size) { + f_array_length_t size = uint8ss->used + step; + + if (size > F_array_length_t_size_d) { + if (uint8ss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_uint8ss_resize(size, uint8ss); + } + + return F_data_not; + } +#endif // _di_f_type_uint8ss_increase_ + +#ifndef _di_f_type_uint8ss_increase_by_ + f_status_t f_type_uint8ss_increase_by(const f_array_length_t amount, f_uint8ss_t *uint8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!uint8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (uint8ss->used + amount > uint8ss->size) { + if (uint8ss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_uint8ss_resize(uint8ss->used + amount, uint8ss); + } + + return F_data_not; + } +#endif // _di_f_type_uint8ss_increase_by_ + +#ifndef _di_f_type_uint8ss_resize_ + f_status_t f_type_uint8ss_resize(const f_array_length_t length, f_uint8ss_t *uint8ss) { + #ifndef _di_level_0_parameter_checking_ + if (!uint8ss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_uint8ss_resize(length, uint8ss); + } +#endif // _di_f_type_uint8ss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/int8.h b/level_0/f_type_array/c/type_array/int8.h new file mode 100644 index 0000000..37fb88a --- /dev/null +++ b/level_0/f_type_array/c/type_array/int8.h @@ -0,0 +1,687 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines data to be used for/by type (array) related functionality. + * + * This is auto-included by type_array.h and should not need to be explicitly included. + */ +#ifndef _F_type_array_int8_h +#define _F_type_array_int8_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the int8s array. + * + * @param length + * The new size to use. + * @param int8s + * The int8s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_int8s_adjust_ + extern f_status_t f_type_int8s_adjust(const f_array_length_t length, f_int8s_t *int8s); +#endif // _di_f_type_int8s_adjust_ + +/** + * Append the source int8s onto the destination. + * + * @param source + * The source int8s to append. + * @param destination + * The destination int8s the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int8s_append_ + extern f_status_t f_type_int8s_append(const f_int8s_t source, f_int8s_t *destination); +#endif // _di_f_type_int8s_append_ + +/** + * Resize the int8s 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param int8s + * The int8s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_int8s_decimate_by_ + extern f_status_t f_type_int8s_decimate_by(const f_array_length_t amount, f_int8s_t *int8s); +#endif // _di_f_type_int8s_decimate_by_ + +/** + * Resize the int8s 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param int8s + * The int8s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int8s_decrease_by_ + extern f_status_t f_type_int8s_decrease_by(const f_array_length_t amount, f_int8s_t *int8s); +#endif // _di_f_type_int8s_decrease_by_ + +/** + * Increase the size of the int8s array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param int8s + * The int8s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int8s_increase_ + extern f_status_t f_type_int8s_increase(const uint16_t step, f_int8s_t *int8s); +#endif // _di_f_type_int8s_increase_ + +/** + * Resize the int8s 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param int8s + * The int8s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int8s_increase_by_ + extern f_status_t f_type_int8s_increase_by(const f_array_length_t amount, f_int8s_t *int8s); +#endif // _di_f_type_int8s_increase_by_ + +/** + * Resize the int8s array. + * + * @param length + * The new size to use. + * @param int8s + * The int8s array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int8s_resize_ + extern f_status_t f_type_int8s_resize(const f_array_length_t length, f_int8s_t *int8s); +#endif // _di_f_type_int8s_resize_ + +/** + * Resize the int8ss array. + * + * @param length + * The new size to use. + * @param int8ss + * The int8ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int8ss_adjust_ + extern f_status_t f_type_int8ss_adjust(const f_array_length_t length, f_int8ss_t *int8ss); +#endif // _di_f_type_int8ss_adjust_ + +/** + * Append the source int8ss onto the destination. + * + * @param source + * The source int8ss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int8ss_append_ + extern f_status_t f_type_int8ss_append(const f_int8ss_t source, f_int8ss_t *destination); +#endif // _di_f_type_int8ss_append_ + +/** + * Resize the int8ss array. + * + * @param length + * The new size to use. + * @param int8ss + * The int8ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int8ss_adjust_ + extern f_status_t f_type_int8ss_adjust(const f_array_length_t length, f_int8ss_t *int8ss); +#endif // _di_f_type_int8ss_adjust_ + +/** + * Resize the int8ss 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 int8ss + * The int8ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_int8ss_decimate_by_ + extern f_status_t f_type_int8ss_decimate_by(const f_array_length_t amount, f_int8ss_t *int8ss); +#endif // _di_f_type_int8ss_decimate_by_ + +/** + * Resize the int8ss 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 int8ss + * The int8ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int8ss_decrease_by_ + extern f_status_t f_type_int8ss_decrease_by(const f_array_length_t amount, f_int8ss_t *int8ss); +#endif // _di_f_type_int8ss_decrease_by_ + +/** + * Increase the size of the int8ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param int8ss + * The int8ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int8ss_increase_ + extern f_status_t f_type_int8ss_increase(const uint16_t step, f_int8ss_t *int8ss); +#endif // _di_f_type_int8ss_increase_ + +/** + * Resize the int8ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param int8ss + * The int8ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int8ss_increase_by_ + extern f_status_t f_type_int8ss_increase_by(const f_array_length_t amount, f_int8ss_t *int8ss); +#endif // _di_f_type_int8ss_increase_by_ + +/** + * Resize the int8ss array. + * + * @param length + * The new size to use. + * @param int8ss + * The int8ss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_int8ss_resize_ + extern f_status_t f_type_int8ss_resize(const f_array_length_t length, f_int8ss_t *int8ss); +#endif // _di_f_type_int8ss_resize_ + +/** + * Resize the string uint8s array. + * + * @param length + * The new size to use. + * @param uint8s + * The string uint8s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_uint8s_adjust_ + extern f_status_t f_type_uint8s_adjust(const f_array_length_t length, f_uint8s_t *uint8s); +#endif // _di_f_type_uint8s_adjust_ + +/** + * Append the source uint8s onto the destination. + * + * @param source + * The source uint8s to append. + * @param destination + * The destination uint8s the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint8s_append_ + extern f_status_t f_type_uint8s_append(const f_uint8s_t source, f_uint8s_t *destination); +#endif // _di_f_type_uint8s_append_ + +/** + * Resize the string uint8s 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param uint8s + * The string uint8s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_uint8s_decimate_by_ + extern f_status_t f_type_uint8s_decimate_by(const f_array_length_t amount, f_uint8s_t *uint8s); +#endif // _di_f_type_uint8s_decimate_by_ + +/** + * Resize the string uint8s 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param uint8s + * The string uint8s array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint8s_decrease_by_ + extern f_status_t f_type_uint8s_decrease_by(const f_array_length_t amount, f_uint8s_t *uint8s); +#endif // _di_f_type_uint8s_decrease_by_ + +/** + * Increase the size of the string uint8s array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param uint8s + * The string uint8s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint8s_increase_ + extern f_status_t f_type_uint8s_increase(const uint16_t step, f_uint8s_t *uint8s); +#endif // _di_f_type_uint8s_increase_ + +/** + * Resize the string uint8s 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param uint8s + * The string uint8s array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint8s_increase_by_ + extern f_status_t f_type_uint8s_increase_by(const f_array_length_t amount, f_uint8s_t *uint8s); +#endif // _di_f_type_uint8s_increase_by_ + +/** + * Resize the string uint8s array. + * + * @param length + * The new size to use. + * @param uint8s + * The string uint8s array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint8s_resize_ + extern f_status_t f_type_uint8s_resize(const f_array_length_t length, f_uint8s_t *uint8s); +#endif // _di_f_type_uint8s_resize_ + +/** + * Resize the string uint8ss array. + * + * @param length + * The new size to use. + * @param uint8ss + * The string uint8ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint8ss_adjust_ + extern f_status_t f_type_uint8ss_adjust(const f_array_length_t length, f_uint8ss_t *uint8ss); +#endif // _di_f_type_uint8ss_adjust_ + +/** + * Append the source uint8ss onto the destination. + * + * @param source + * The source uint8ss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint8ss_append_ + extern f_status_t f_type_uint8ss_append(const f_uint8ss_t source, f_uint8ss_t *destination); +#endif // _di_f_type_uint8ss_append_ + +/** + * Resize the string uint8ss array. + * + * @param length + * The new size to use. + * @param uint8ss + * The string uint8ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint8ss_adjust_ + extern f_status_t f_type_uint8ss_adjust(const f_array_length_t length, f_uint8ss_t *uint8ss); +#endif // _di_f_type_uint8ss_adjust_ + +/** + * Resize the string uint8ss 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 uint8ss + * The string uint8ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_uint8ss_decimate_by_ + extern f_status_t f_type_uint8ss_decimate_by(const f_array_length_t amount, f_uint8ss_t *uint8ss); +#endif // _di_f_type_uint8ss_decimate_by_ + +/** + * Resize the string uint8ss 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 uint8ss + * The string uint8ss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint8ss_decrease_by_ + extern f_status_t f_type_uint8ss_decrease_by(const f_array_length_t amount, f_uint8ss_t *uint8ss); +#endif // _di_f_type_uint8ss_decrease_by_ + +/** + * Increase the size of the string uint8ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param uint8ss + * The string uint8ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint8ss_increase_ + extern f_status_t f_type_uint8ss_increase(const uint16_t step, f_uint8ss_t *uint8ss); +#endif // _di_f_type_uint8ss_increase_ + +/** + * Resize the string uint8ss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param uint8ss + * The string uint8ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint8ss_increase_by_ + extern f_status_t f_type_uint8ss_increase_by(const f_array_length_t amount, f_uint8ss_t *uint8ss); +#endif // _di_f_type_uint8ss_increase_by_ + +/** + * Resize the string uint8ss array. + * + * @param length + * The new size to use. + * @param uint8ss + * The string uint8ss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_uint8ss_resize_ + extern f_status_t f_type_uint8ss_resize(const f_array_length_t length, f_uint8ss_t *uint8ss); +#endif // _di_f_type_uint8ss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_array_int8_h diff --git a/level_0/f_type_array/c/type_array/private-array_length.c b/level_0/f_type_array/c/type_array/private-array_length.c new file mode 100644 index 0000000..2077326 --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-array_length.c @@ -0,0 +1,118 @@ +#include "../type_array.h" +#include "private-array_length.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_type_array_lengths_adjust_) || !defined(_di_f_type_array_lengths_decimate_by_) + f_status_t private_f_type_array_lengths_adjust(const f_array_length_t length, f_array_lengths_t *array_lengths) { + + const f_status_t status = f_memory_adjust(array_lengths->size, length, sizeof(f_array_length_t), (void **) & array_lengths->array); + + if (F_status_is_error_not(status)) { + array_lengths->size = length; + + if (array_lengths->used > array_lengths->size) { + array_lengths->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_array_lengths_adjust_) || !defined(_di_f_type_array_lengths_decimate_by_) + +#if !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengthss_append_) + extern f_status_t private_f_type_array_lengths_append(const f_array_lengths_t source, f_array_lengths_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_array_lengths_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengthss_append_) + +#if !defined(_di_f_type_array_lengths_resize_) || !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengths_decimate_by_) || !defined(_di_f_type_array_lengthss_append_) + f_status_t private_f_type_array_lengths_resize(const f_array_length_t length, f_array_lengths_t *lengths) { + + const f_status_t status = f_memory_resize(lengths->size, length, sizeof(f_array_length_t), (void **) & lengths->array); + + if (F_status_is_error_not(status)) { + lengths->size = length; + + if (lengths->used > lengths->size) { + lengths->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_array_lengths_resize_) || !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengths_decimate_by_) || !defined(_di_f_type_array_lengthss_append_) + +#if !defined(_di_f_type_array_lengthss_adjust_) || !defined(_di_f_type_array_lengthss_decimate_by_) + f_status_t private_f_type_array_lengthss_adjust(const f_array_length_t length, f_array_lengthss_t *lengthss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < lengthss->size; ++i) { + + status = f_memory_destroy(lengthss->array[i].size, sizeof(f_array_lengths_t), (void **) & lengthss->array[i].array); + if (F_status_is_error(status)) return status; + + lengthss->array[i].size = 0; + lengthss->array[i].used = 0; + } // for + + status = f_memory_adjust(lengthss->size, length, sizeof(f_array_lengths_t), (void **) & lengthss->array); + + if (F_status_is_error_not(status)) { + lengthss->size = length; + + if (lengthss->used > lengthss->size) { + lengthss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_array_lengthss_adjust_) || !defined(_di_f_type_array_lengthss_decimate_by_) + +#if !defined(_di_f_type_array_lengthss_decrease_by_) || !defined(_di_f_type_array_lengthss_increase_) || !defined(_di_f_type_array_lengthss_increase_by_) || !defined(_di_f_type_array_lengthss_resize_) + f_status_t private_f_type_array_lengthss_resize(const f_array_length_t length, f_array_lengthss_t *lengthss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < lengthss->size; ++i) { + + status = f_memory_delete(lengthss->array[i].size, sizeof(f_array_lengths_t), (void **) & lengthss->array[i].array); + if (F_status_is_error(status)) return status; + + lengthss->array[i].size = 0; + lengthss->array[i].used = 0; + } // for + + status = f_memory_resize(lengthss->size, length, sizeof(f_array_lengths_t), (void **) & lengthss->array); + + if (F_status_is_error_not(status)) { + lengthss->size = length; + + if (lengthss->used > lengthss->size) { + lengthss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_array_lengthss_decrease_by_) || !defined(_di_f_type_array_lengthss_increase_) || !defined(_di_f_type_array_lengthss_increase_by_) || !defined(_di_f_type_array_lengthss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/private-array_length.h b/level_0/f_type_array/c/type_array/private-array_length.h new file mode 100644 index 0000000..3b632e2 --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-array_length.h @@ -0,0 +1,150 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_type_array_array_length_h +#define _PRIVATE_F_type_array_array_length_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing the array_lengths array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param lengths + * The lengths array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_array_lengths_adjust() + * @see f_type_array_lengths_decimate_by() + */ +#if !defined(_di_f_type_array_lengths_adjust_) || !defined(_di_f_type_array_lengths_decimate_by_) + extern f_status_t private_f_type_array_lengths_adjust(const f_array_length_t length, f_array_lengths_t *lengths) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_array_lengths_adjust_) || !defined(_di_f_type_array_lengths_decimate_by_) + +/** + * Private implementation for appending the array_length array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source array_lengths to append. + * @param destination + * The destination lengths the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_array_lengths_append() + * @see f_type_array_lengthss_append() + */ +#if !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengthss_append_) + extern f_status_t private_f_type_array_lengths_append(const f_array_lengths_t source, f_array_lengths_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengthss_append_) + +/** + * Private implementation for resizing the array_lengths array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param lengths + * The lengths array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_array_lengths_resize() + * @see f_type_array_lengths_append() + * @see f_type_array_lengths_decimate_by() + * @see f_type_array_lengthss_append() + */ +#if !defined(_di_f_type_array_lengths_resize_) || !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengths_decimate_by_) || !defined(_di_f_type_array_lengthss_append_) + extern f_status_t private_f_type_array_lengths_resize(const f_array_length_t length, f_array_lengths_t *lengths) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_array_lengths_resize_) || !defined(_di_f_type_array_lengths_append_) || !defined(_di_f_type_array_lengths_decimate_by_) || !defined(_di_f_type_array_lengthss_append_) + +/** + * Private implementation for resizing the lengthss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param lengthss + * The lengthss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_array_lengthss_adjust() + * @see f_type_array_lengthss_decimate_by() + */ +#if !defined(_di_f_type_array_lengthss_adjust_) || !defined(_di_f_type_array_lengthss_decimate_by_) + extern f_status_t private_f_type_array_lengthss_adjust(const f_array_length_t length, f_array_lengthss_t *lengthss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_array_lengthss_adjust_) || !defined(_di_f_type_array_lengthss_decimate_by_) + +/** + * Private implementation for resizing the lengthss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param lengthss + * The lengthss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_array_lengthss_decrease_by() + * @see f_type_array_lengthss_increase() + * @see f_type_array_lengthss_increase_by() + * @see f_type_array_lengthss_resize() + */ +#if !defined(_di_f_type_array_lengthss_decrease_by_) || !defined(_di_f_type_array_lengthss_increase_) || !defined(_di_f_type_array_lengthss_increase_by_) || !defined(_di_f_type_array_lengthss_resize_) + extern f_status_t private_f_type_array_lengthss_resize(const f_array_length_t length, f_array_lengthss_t *lengthss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_array_lengthss_decrease_by_) || !defined(_di_f_type_array_lengthss_increase_) || !defined(_di_f_type_array_lengthss_increase_by_) || !defined(_di_f_type_array_lengthss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_type_array_array_length_h diff --git a/level_0/f_type_array/c/type_array/private-cell.c b/level_0/f_type_array/c/type_array/private-cell.c new file mode 100644 index 0000000..66d5258 --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-cell.c @@ -0,0 +1,118 @@ +#include "../type_array.h" +#include "private-cell.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_type_cells_adjust_) || !defined(_di_f_type_cells_decimate_by_) + f_status_t private_f_type_cells_adjust(const f_array_length_t length, f_cells_t *cells) { + + const f_status_t status = f_memory_adjust(cells->size, length, sizeof(f_cell_t), (void **) & cells->array); + + if (F_status_is_error_not(status)) { + cells->size = length; + + if (cells->used > cells->size) { + cells->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_cells_adjust_) || !defined(_di_f_type_cells_decimate_by_) + +#if !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cellss_append_) + extern f_status_t private_f_type_cells_append(const f_cells_t source, f_cells_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_cells_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cellss_append_) + +#if !defined(_di_f_type_cells_resize_) || !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cells_decimate_by_) || !defined(_di_f_type_cellss_append_) + f_status_t private_f_type_cells_resize(const f_array_length_t length, f_cells_t *cells) { + + const f_status_t status = f_memory_resize(cells->size, length, sizeof(f_cell_t), (void **) & cells->array); + + if (F_status_is_error_not(status)) { + cells->size = length; + + if (cells->used > cells->size) { + cells->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_cells_resize_) || !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cells_decimate_by_) || !defined(_di_f_type_cellss_append_) + +#if !defined(_di_f_type_cellss_adjust_) || !defined(_di_f_type_cellss_decimate_by_) + f_status_t private_f_type_cellss_adjust(const f_array_length_t length, f_cellss_t *cellss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < cellss->size; ++i) { + + status = f_memory_destroy(cellss->array[i].size, sizeof(f_cells_t), (void **) & cellss->array[i].array); + if (F_status_is_error(status)) return status; + + cellss->array[i].size = 0; + cellss->array[i].used = 0; + } // for + + status = f_memory_adjust(cellss->size, length, sizeof(f_cells_t), (void **) & cellss->array); + + if (F_status_is_error_not(status)) { + cellss->size = length; + + if (cellss->used > cellss->size) { + cellss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_cellss_adjust_) || !defined(_di_f_type_cellss_decimate_by_) + +#if !defined(_di_f_type_cellss_decrease_by_) || !defined(_di_f_type_cellss_increase_) || !defined(_di_f_type_cellss_increase_by_) || !defined(_di_f_type_cellss_resize_) + f_status_t private_f_type_cellss_resize(const f_array_length_t length, f_cellss_t *cellss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < cellss->size; ++i) { + + status = f_memory_delete(cellss->array[i].size, sizeof(f_cells_t), (void **) & cellss->array[i].array); + if (F_status_is_error(status)) return status; + + cellss->array[i].size = 0; + cellss->array[i].used = 0; + } // for + + status = f_memory_resize(cellss->size, length, sizeof(f_cells_t), (void **) & cellss->array); + + if (F_status_is_error_not(status)) { + cellss->size = length; + + if (cellss->used > cellss->size) { + cellss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_cellss_decrease_by_) || !defined(_di_f_type_cellss_increase_) || !defined(_di_f_type_cellss_increase_by_) || !defined(_di_f_type_cellss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/private-cell.h b/level_0/f_type_array/c/type_array/private-cell.h new file mode 100644 index 0000000..2e64328 --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-cell.h @@ -0,0 +1,150 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_type_array_cell_h +#define _PRIVATE_F_type_array_cell_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing the cells array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param cells + * The cells array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_cells_adjust() + * @see f_type_cells_decimate_by() + */ +#if !defined(_di_f_type_cells_adjust_) || !defined(_di_f_type_cells_decimate_by_) + extern f_status_t private_f_type_cells_adjust(const f_array_length_t length, f_cells_t *cells) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_cells_adjust_) || !defined(_di_f_type_cells_decimate_by_) + +/** + * Private implementation for appending the cell array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source cells to append. + * @param destination + * The destination cells the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_cells_append() + * @see f_type_cellss_append() + */ +#if !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cellss_append_) + extern f_status_t private_f_type_cells_append(const f_cells_t source, f_cells_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cellss_append_) + +/** + * Private implementation for resizing the cells array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param cells + * The cells array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_cells_resize() + * @see f_type_cells_append() + * @see f_type_cells_decimate_by() + * @see f_type_cellss_append() + */ +#if !defined(_di_f_type_cells_resize_) || !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cells_decimate_by_) || !defined(_di_f_type_cellss_append_) + extern f_status_t private_f_type_cells_resize(const f_array_length_t length, f_cells_t *cells) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_cells_resize_) || !defined(_di_f_type_cells_append_) || !defined(_di_f_type_cells_decimate_by_) || !defined(_di_f_type_cellss_append_) + +/** + * Private implementation for resizing the cellss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param cellss + * The cellss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_cellss_adjust() + * @see f_type_cellss_decimate_by() + */ +#if !defined(_di_f_type_cellss_adjust_) || !defined(_di_f_type_cellss_decimate_by_) + extern f_status_t private_f_type_cellss_adjust(const f_array_length_t length, f_cellss_t *cellss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_cellss_adjust_) || !defined(_di_f_type_cellss_decimate_by_) + +/** + * Private implementation for resizing the cellss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param cellss + * The cellss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_cellss_decrease_by() + * @see f_type_cellss_increase() + * @see f_type_cellss_increase_by() + * @see f_type_cellss_resize() + */ +#if !defined(_di_f_type_cellss_decrease_by_) || !defined(_di_f_type_cellss_increase_) || !defined(_di_f_type_cellss_increase_by_) || !defined(_di_f_type_cellss_resize_) + extern f_status_t private_f_type_cellss_resize(const f_array_length_t length, f_cellss_t *cellss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_cellss_decrease_by_) || !defined(_di_f_type_cellss_increase_) || !defined(_di_f_type_cellss_increase_by_) || !defined(_di_f_type_cellss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_type_array_cell_h diff --git a/level_0/f_type_array/c/type_array/private-fll_id.c b/level_0/f_type_array/c/type_array/private-fll_id.c new file mode 100644 index 0000000..8b9679e --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-fll_id.c @@ -0,0 +1,118 @@ +#include "../type_array.h" +#include "private-fll_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_type_fll_ids_adjust_) || !defined(_di_f_type_fll_ids_decimate_by_) + f_status_t private_f_type_fll_ids_adjust(const f_array_length_t length, f_fll_ids_t *ids) { + + const f_status_t status = f_memory_adjust(ids->size, length, sizeof(f_fll_id_t), (void **) & ids->array); + + if (F_status_is_error_not(status)) { + ids->size = length; + + if (ids->used > ids->size) { + ids->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_fll_ids_adjust_) || !defined(_di_f_type_fll_ids_decimate_by_) + +#if !defined(_di_f_type_fll_ids_append_) || !defined(_di_f_type_fll_idss_append_) + extern f_status_t private_f_type_fll_ids_append(const f_fll_ids_t source, f_fll_ids_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_fll_ids_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_fll_ids_append_) || !defined(_di_f_type_fll_idss_append_) + +#if !defined(_di_f_type_fll_ids_resize_) || !defined(_di_f_type_fll_ids_append_) || !defined(_di_f_type_fll_ids_decimate_by_) || !defined(_di_f_type_fll_idss_append_) + f_status_t private_f_type_fll_ids_resize(const f_array_length_t length, f_fll_ids_t *ids) { + + const f_status_t status = f_memory_resize(ids->size, length, sizeof(f_fll_id_t), (void **) & ids->array); + + if (F_status_is_error_not(status)) { + ids->size = length; + + if (ids->used > ids->size) { + ids->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_fll_ids_resize_) || !defined(_di_f_type_fll_ids_append_) || !defined(_di_f_type_fll_ids_decimate_by_) || !defined(_di_f_type_fll_idss_append_) + +#if !defined(_di_f_type_fll_idss_adjust_) || !defined(_di_f_type_fll_idss_decimate_by_) + f_status_t private_f_type_fll_idss_adjust(const f_array_length_t length, f_fll_idss_t *idss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < idss->size; ++i) { + + status = f_memory_destroy(idss->array[i].size, sizeof(f_fll_ids_t), (void **) & idss->array[i].array); + if (F_status_is_error(status)) return status; + + idss->array[i].size = 0; + idss->array[i].used = 0; + } // for + + status = f_memory_adjust(idss->size, length, sizeof(f_fll_ids_t), (void **) & idss->array); + + if (F_status_is_error_not(status)) { + idss->size = length; + + if (idss->used > idss->size) { + idss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_fll_idss_adjust_) || !defined(_di_f_type_fll_idss_decimate_by_) + +#if !defined(_di_f_type_fll_idss_decrease_by_) || !defined(_di_f_type_fll_idss_increase_) || !defined(_di_f_type_fll_idss_increase_by_) || !defined(_di_f_type_fll_idss_resize_) + f_status_t private_f_type_fll_idss_resize(const f_array_length_t length, f_fll_idss_t *idss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < idss->size; ++i) { + + status = f_memory_delete(idss->array[i].size, sizeof(f_fll_ids_t), (void **) & idss->array[i].array); + if (F_status_is_error(status)) return status; + + idss->array[i].size = 0; + idss->array[i].used = 0; + } // for + + status = f_memory_resize(idss->size, length, sizeof(f_fll_ids_t), (void **) & idss->array); + + if (F_status_is_error_not(status)) { + idss->size = length; + + if (idss->used > idss->size) { + idss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_fll_idss_decrease_by_) || !defined(_di_f_type_fll_idss_increase_) || !defined(_di_f_type_fll_idss_increase_by_) || !defined(_di_f_type_fll_idss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/private-type_array.h b/level_0/f_type_array/c/type_array/private-fll_id.h similarity index 99% rename from level_0/f_type_array/c/private-type_array.h rename to level_0/f_type_array/c/type_array/private-fll_id.h index 4545efc..65c92b2 100644 --- a/level_0/f_type_array/c/private-type_array.h +++ b/level_0/f_type_array/c/type_array/private-fll_id.h @@ -8,8 +8,8 @@ * These are provided for internal reduction in redundant code. * These should not be exposed/used outside of this project. */ -#ifndef _PRIVATE_F_type_array_h -#define _PRIVATE_F_type_array_h +#ifndef _PRIVATE_F_type_array_cell_h +#define _PRIVATE_F_type_array_cell_h #ifdef __cplusplus extern "C" { @@ -1938,4 +1938,4 @@ extern "C" { } // extern "C" #endif -#endif // _PRIVATE_F_type_array_h +#endif // _PRIVATE_F_type_array_cell_h diff --git a/level_0/f_type_array/c/type_array/private-int128.c b/level_0/f_type_array/c/type_array/private-int128.c new file mode 100644 index 0000000..387c263 --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-int128.c @@ -0,0 +1,226 @@ +#include "../type_array.h" +#include "private-int128.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_type_int128s_adjust_) || !defined(_di_f_type_int128s_decimate_by_) + f_status_t private_f_type_int128s_adjust(const f_array_length_t length, f_int128s_t *int128s) { + + const f_status_t status = f_memory_adjust(int128s->size, length, sizeof(f_int128_t), (void **) & int128s->array); + + if (F_status_is_error_not(status)) { + int128s->size = length; + + if (int128s->used > int128s->size) { + int128s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int128s_adjust_) || !defined(_di_f_type_int128s_decimate_by_) + +#if !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128ss_append_) + extern f_status_t private_f_type_int128s_append(const f_int128s_t source, f_int128s_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_int128s_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128ss_append_) + +#if !defined(_di_f_type_int128s_resize_) || !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128s_decimate_by_) || !defined(_di_f_type_int128ss_append_) + f_status_t private_f_type_int128s_resize(const f_array_length_t length, f_int128s_t *int128s) { + + const f_status_t status = f_memory_resize(int128s->size, length, sizeof(f_int128_t), (void **) & int128s->array); + + if (F_status_is_error_not(status)) { + int128s->size = length; + + if (int128s->used > int128s->size) { + int128s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int128s_resize_) || !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128s_decimate_by_) || !defined(_di_f_type_int128ss_append_) + +#if !defined(_di_f_type_int128ss_adjust_) || !defined(_di_f_type_int128ss_decimate_by_) + f_status_t private_f_type_int128ss_adjust(const f_array_length_t length, f_int128ss_t *int128ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < int128ss->size; ++i) { + + status = f_memory_destroy(int128ss->array[i].size, sizeof(f_int128s_t), (void **) & int128ss->array[i].array); + if (F_status_is_error(status)) return status; + + int128ss->array[i].size = 0; + int128ss->array[i].used = 0; + } // for + + status = f_memory_adjust(int128ss->size, length, sizeof(f_int128s_t), (void **) & int128ss->array); + + if (F_status_is_error_not(status)) { + int128ss->size = length; + + if (int128ss->used > int128ss->size) { + int128ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int128ss_adjust_) || !defined(_di_f_type_int128ss_decimate_by_) + +#if !defined(_di_f_type_int128ss_decrease_by_) || !defined(_di_f_type_int128ss_increase_) || !defined(_di_f_type_int128ss_increase_by_) || !defined(_di_f_type_int128ss_resize_) + f_status_t private_f_type_int128ss_resize(const f_array_length_t length, f_int128ss_t *int128ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < int128ss->size; ++i) { + + status = f_memory_delete(int128ss->array[i].size, sizeof(f_int128s_t), (void **) & int128ss->array[i].array); + if (F_status_is_error(status)) return status; + + int128ss->array[i].size = 0; + int128ss->array[i].used = 0; + } // for + + status = f_memory_resize(int128ss->size, length, sizeof(f_int128s_t), (void **) & int128ss->array); + + if (F_status_is_error_not(status)) { + int128ss->size = length; + + if (int128ss->used > int128ss->size) { + int128ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int128ss_decrease_by_) || !defined(_di_f_type_int128ss_increase_) || !defined(_di_f_type_int128ss_increase_by_) || !defined(_di_f_type_int128ss_resize_) + +#if !defined(_di_f_type_uint128s_adjust_) || !defined(_di_f_type_uint128s_decimate_by_) + f_status_t private_f_type_uint128s_adjust(const f_array_length_t length, f_uint128s_t *uint128s) { + + const f_status_t status = f_memory_adjust(uint128s->size, length, sizeof(f_uint128_t), (void **) & uint128s->array); + + if (F_status_is_error_not(status)) { + uint128s->size = length; + + if (uint128s->used > uint128s->size) { + uint128s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint128s_adjust_) || !defined(_di_f_type_uint128s_decimate_by_) + +#if !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128ss_append_) + extern f_status_t private_f_type_uint128s_append(const f_uint128s_t source, f_uint128s_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_uint128s_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128ss_append_) + +#if !defined(_di_f_type_uint128s_resize_) || !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128s_decimate_by_) || !defined(_di_f_type_uint128ss_append_) + f_status_t private_f_type_uint128s_resize(const f_array_length_t length, f_uint128s_t *uint128s) { + + const f_status_t status = f_memory_resize(uint128s->size, length, sizeof(f_uint128_t), (void **) & uint128s->array); + + if (F_status_is_error_not(status)) { + uint128s->size = length; + + if (uint128s->used > uint128s->size) { + uint128s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint128s_resize_) || !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128s_decimate_by_) || !defined(_di_f_type_uint128ss_append_) + +#if !defined(_di_f_type_uint128ss_adjust_) || !defined(_di_f_type_uint128ss_decimate_by_) + f_status_t private_f_type_uint128ss_adjust(const f_array_length_t length, f_uint128ss_t *uint128ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < uint128ss->size; ++i) { + + status = f_memory_destroy(uint128ss->array[i].size, sizeof(f_uint128s_t), (void **) & uint128ss->array[i].array); + if (F_status_is_error(status)) return status; + + uint128ss->array[i].size = 0; + uint128ss->array[i].used = 0; + } // for + + status = f_memory_adjust(uint128ss->size, length, sizeof(f_uint128s_t), (void **) & uint128ss->array); + + if (F_status_is_error_not(status)) { + uint128ss->size = length; + + if (uint128ss->used > uint128ss->size) { + uint128ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint128ss_adjust_) || !defined(_di_f_type_uint128ss_decimate_by_) + +#if !defined(_di_f_type_uint128ss_decrease_by_) || !defined(_di_f_type_uint128ss_increase_) || !defined(_di_f_type_uint128ss_increase_by_) || !defined(_di_f_type_uint128ss_resize_) + f_status_t private_f_type_uint128ss_resize(const f_array_length_t length, f_uint128ss_t *uint128ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < uint128ss->size; ++i) { + + status = f_memory_delete(uint128ss->array[i].size, sizeof(f_uint128s_t), (void **) & uint128ss->array[i].array); + if (F_status_is_error(status)) return status; + + uint128ss->array[i].size = 0; + uint128ss->array[i].used = 0; + } // for + + status = f_memory_resize(uint128ss->size, length, sizeof(f_uint128s_t), (void **) & uint128ss->array); + + if (F_status_is_error_not(status)) { + uint128ss->size = length; + + if (uint128ss->used > uint128ss->size) { + uint128ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint128ss_decrease_by_) || !defined(_di_f_type_uint128ss_increase_) || !defined(_di_f_type_uint128ss_increase_by_) || !defined(_di_f_type_uint128ss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/private-int128.h b/level_0/f_type_array/c/type_array/private-int128.h new file mode 100644 index 0000000..c7a3b36 --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-int128.h @@ -0,0 +1,278 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_type_array_int128_h +#define _PRIVATE_F_type_array_int128_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing the int128s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int128s + * The int128s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_int128s_adjust() + * @see f_type_int128s_decimate_by() + */ +#if !defined(_di_f_type_int128s_adjust_) || !defined(_di_f_type_int128s_decimate_by_) + extern f_status_t private_f_type_int128s_adjust(const f_array_length_t length, f_int128s_t *int128s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int128s_adjust_) || !defined(_di_f_type_int128s_decimate_by_) + +/** + * Private implementation for appending the int128 array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source int128s to append. + * @param destination + * The destination int128s the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int128s_append() + * @see f_type_int128ss_append() + */ +#if !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128ss_append_) + extern f_status_t private_f_type_int128s_append(const f_int128s_t source, f_int128s_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128ss_append_) + +/** + * Private implementation for resizing the int128s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int128s + * The int128s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int128s_resize() + * @see f_type_int128s_append() + * @see f_type_int128s_decimate_by() + * @see f_type_int128ss_append() + */ +#if !defined(_di_f_type_int128s_resize_) || !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128s_decimate_by_) || !defined(_di_f_type_int128ss_append_) + extern f_status_t private_f_type_int128s_resize(const f_array_length_t length, f_int128s_t *int128s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int128s_resize_) || !defined(_di_f_type_int128s_append_) || !defined(_di_f_type_int128s_decimate_by_) || !defined(_di_f_type_int128ss_append_) + +/** + * Private implementation for resizing the int128ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int128ss + * The int128ss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_int128ss_adjust() + * @see f_type_int128ss_decimate_by() + */ +#if !defined(_di_f_type_int128ss_adjust_) || !defined(_di_f_type_int128ss_decimate_by_) + extern f_status_t private_f_type_int128ss_adjust(const f_array_length_t length, f_int128ss_t *int128ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int128ss_adjust_) || !defined(_di_f_type_int128ss_decimate_by_) + +/** + * Private implementation for resizing the int128ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param int128ss + * The int128ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int128ss_decrease_by() + * @see f_type_int128ss_increase() + * @see f_type_int128ss_increase_by() + * @see f_type_int128ss_resize() + */ +#if !defined(_di_f_type_int128ss_decrease_by_) || !defined(_di_f_type_int128ss_increase_) || !defined(_di_f_type_int128ss_increase_by_) || !defined(_di_f_type_int128ss_resize_) + extern f_status_t private_f_type_int128ss_resize(const f_array_length_t length, f_int128ss_t *int128ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int128ss_decrease_by_) || !defined(_di_f_type_int128ss_increase_) || !defined(_di_f_type_int128ss_increase_by_) || !defined(_di_f_type_int128ss_resize_) + +/** + * Private implementation for resizing the uint128s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint128s + * The uint128s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_uint128s_adjust() + * @see f_type_uint128s_decimate_by() + */ +#if !defined(_di_f_type_uint128s_adjust_) || !defined(_di_f_type_uint128s_decimate_by_) + extern f_status_t private_f_type_uint128s_adjust(const f_array_length_t length, f_uint128s_t *uint128s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint128s_adjust_) || !defined(_di_f_type_uint128s_decimate_by_) + +/** + * Private implementation for appending the uint128 array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source uint128s to append. + * @param destination + * The destination uint128s the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint128s_append() + * @see f_type_uint128ss_append() + */ +#if !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128ss_append_) + extern f_status_t private_f_type_uint128s_append(const f_uint128s_t source, f_uint128s_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128ss_append_) + +/** + * Private implementation for resizing the uint128s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint128s + * The uint128s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint128s_resize() + * @see f_type_uint128s_append() + * @see f_type_uint128s_decimate_by() + * @see f_type_uint128ss_append() + */ +#if !defined(_di_f_type_uint128s_resize_) || !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128s_decimate_by_) || !defined(_di_f_type_uint128ss_append_) + extern f_status_t private_f_type_uint128s_resize(const f_array_length_t length, f_uint128s_t *uint128s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint128s_resize_) || !defined(_di_f_type_uint128s_append_) || !defined(_di_f_type_uint128s_decimate_by_) || !defined(_di_f_type_uint128ss_append_) + +/** + * Private implementation for resizing the uint128ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint128ss + * The uint128ss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_uint128ss_adjust() + * @see f_type_uint128ss_decimate_by() + */ +#if !defined(_di_f_type_uint128ss_adjust_) || !defined(_di_f_type_uint128ss_decimate_by_) + extern f_status_t private_f_type_uint128ss_adjust(const f_array_length_t length, f_uint128ss_t *uint128ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint128ss_adjust_) || !defined(_di_f_type_uint128ss_decimate_by_) + +/** + * Private implementation for resizing the uint128ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param uint128ss + * The uint128ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint128ss_decrease_by() + * @see f_type_uint128ss_increase() + * @see f_type_uint128ss_increase_by() + * @see f_type_uint128ss_resize() + */ +#if !defined(_di_f_type_uint128ss_decrease_by_) || !defined(_di_f_type_uint128ss_increase_) || !defined(_di_f_type_uint128ss_increase_by_) || !defined(_di_f_type_uint128ss_resize_) + extern f_status_t private_f_type_uint128ss_resize(const f_array_length_t length, f_uint128ss_t *uint128ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint128ss_decrease_by_) || !defined(_di_f_type_uint128ss_increase_) || !defined(_di_f_type_uint128ss_increase_by_) || !defined(_di_f_type_uint128ss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_type_array_int128_h diff --git a/level_0/f_type_array/c/type_array/private-int16.c b/level_0/f_type_array/c/type_array/private-int16.c new file mode 100644 index 0000000..a0ac56a --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-int16.c @@ -0,0 +1,226 @@ +#include "../type_array.h" +#include "private-int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_type_int16s_adjust_) || !defined(_di_f_type_int16s_decimate_by_) + f_status_t private_f_type_int16s_adjust(const f_array_length_t length, f_int16s_t *int16s) { + + const f_status_t status = f_memory_adjust(int16s->size, length, sizeof(int16_t), (void **) & int16s->array); + + if (F_status_is_error_not(status)) { + int16s->size = length; + + if (int16s->used > int16s->size) { + int16s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int16s_adjust_) || !defined(_di_f_type_int16s_decimate_by_) + +#if !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16ss_append_) + extern f_status_t private_f_type_int16s_append(const f_int16s_t source, f_int16s_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_int16s_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16ss_append_) + +#if !defined(_di_f_type_int16s_resize_) || !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16s_decimate_by_) || !defined(_di_f_type_int16ss_append_) + f_status_t private_f_type_int16s_resize(const f_array_length_t length, f_int16s_t *int16s) { + + const f_status_t status = f_memory_resize(int16s->size, length, sizeof(int16_t), (void **) & int16s->array); + + if (F_status_is_error_not(status)) { + int16s->size = length; + + if (int16s->used > int16s->size) { + int16s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int16s_resize_) || !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16s_decimate_by_) || !defined(_di_f_type_int16ss_append_) + +#if !defined(_di_f_type_int16ss_adjust_) || !defined(_di_f_type_int16ss_decimate_by_) + f_status_t private_f_type_int16ss_adjust(const f_array_length_t length, f_int16ss_t *int16ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < int16ss->size; ++i) { + + status = f_memory_destroy(int16ss->array[i].size, sizeof(f_int16s_t), (void **) & int16ss->array[i].array); + if (F_status_is_error(status)) return status; + + int16ss->array[i].size = 0; + int16ss->array[i].used = 0; + } // for + + status = f_memory_adjust(int16ss->size, length, sizeof(f_int16s_t), (void **) & int16ss->array); + + if (F_status_is_error_not(status)) { + int16ss->size = length; + + if (int16ss->used > int16ss->size) { + int16ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int16ss_adjust_) || !defined(_di_f_type_int16ss_decimate_by_) + +#if !defined(_di_f_type_int16ss_decrease_by_) || !defined(_di_f_type_int16ss_increase_) || !defined(_di_f_type_int16ss_increase_by_) || !defined(_di_f_type_int16ss_resize_) + f_status_t private_f_type_int16ss_resize(const f_array_length_t length, f_int16ss_t *int16ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < int16ss->size; ++i) { + + status = f_memory_delete(int16ss->array[i].size, sizeof(f_int16s_t), (void **) & int16ss->array[i].array); + if (F_status_is_error(status)) return status; + + int16ss->array[i].size = 0; + int16ss->array[i].used = 0; + } // for + + status = f_memory_resize(int16ss->size, length, sizeof(f_int16s_t), (void **) & int16ss->array); + + if (F_status_is_error_not(status)) { + int16ss->size = length; + + if (int16ss->used > int16ss->size) { + int16ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int16ss_decrease_by_) || !defined(_di_f_type_int16ss_increase_) || !defined(_di_f_type_int16ss_increase_by_) || !defined(_di_f_type_int16ss_resize_) + +#if !defined(_di_f_type_uint16s_adjust_) || !defined(_di_f_type_uint16s_decimate_by_) + f_status_t private_f_type_uint16s_adjust(const f_array_length_t length, f_uint16s_t *uint16s) { + + const f_status_t status = f_memory_adjust(uint16s->size, length, sizeof(uint16_t), (void **) & uint16s->array); + + if (F_status_is_error_not(status)) { + uint16s->size = length; + + if (uint16s->used > uint16s->size) { + uint16s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint16s_adjust_) || !defined(_di_f_type_uint16s_decimate_by_) + +#if !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16ss_append_) + extern f_status_t private_f_type_uint16s_append(const f_uint16s_t source, f_uint16s_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_uint16s_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16ss_append_) + +#if !defined(_di_f_type_uint16s_resize_) || !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16s_decimate_by_) || !defined(_di_f_type_uint16ss_append_) + f_status_t private_f_type_uint16s_resize(const f_array_length_t length, f_uint16s_t *uint16s) { + + const f_status_t status = f_memory_resize(uint16s->size, length, sizeof(uint16_t), (void **) & uint16s->array); + + if (F_status_is_error_not(status)) { + uint16s->size = length; + + if (uint16s->used > uint16s->size) { + uint16s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint16s_resize_) || !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16s_decimate_by_) || !defined(_di_f_type_uint16ss_append_) + +#if !defined(_di_f_type_uint16ss_adjust_) || !defined(_di_f_type_uint16ss_decimate_by_) + f_status_t private_f_type_uint16ss_adjust(const f_array_length_t length, f_uint16ss_t *uint16ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < uint16ss->size; ++i) { + + status = f_memory_destroy(uint16ss->array[i].size, sizeof(f_uint16s_t), (void **) & uint16ss->array[i].array); + if (F_status_is_error(status)) return status; + + uint16ss->array[i].size = 0; + uint16ss->array[i].used = 0; + } // for + + status = f_memory_adjust(uint16ss->size, length, sizeof(f_uint16s_t), (void **) & uint16ss->array); + + if (F_status_is_error_not(status)) { + uint16ss->size = length; + + if (uint16ss->used > uint16ss->size) { + uint16ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint16ss_adjust_) || !defined(_di_f_type_uint16ss_decimate_by_) + +#if !defined(_di_f_type_uint16ss_decrease_by_) || !defined(_di_f_type_uint16ss_increase_) || !defined(_di_f_type_uint16ss_increase_by_) || !defined(_di_f_type_uint16ss_resize_) + f_status_t private_f_type_uint16ss_resize(const f_array_length_t length, f_uint16ss_t *uint16ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < uint16ss->size; ++i) { + + status = f_memory_delete(uint16ss->array[i].size, sizeof(f_uint16s_t), (void **) & uint16ss->array[i].array); + if (F_status_is_error(status)) return status; + + uint16ss->array[i].size = 0; + uint16ss->array[i].used = 0; + } // for + + status = f_memory_resize(uint16ss->size, length, sizeof(f_uint16s_t), (void **) & uint16ss->array); + + if (F_status_is_error_not(status)) { + uint16ss->size = length; + + if (uint16ss->used > uint16ss->size) { + uint16ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint16ss_decrease_by_) || !defined(_di_f_type_uint16ss_increase_) || !defined(_di_f_type_uint16ss_increase_by_) || !defined(_di_f_type_uint16ss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/private-int16.h b/level_0/f_type_array/c/type_array/private-int16.h new file mode 100644 index 0000000..a22ea92 --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-int16.h @@ -0,0 +1,278 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_type_array_int16_h +#define _PRIVATE_F_type_array_int16_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing the int16s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int16s + * The int16s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_int16s_adjust() + * @see f_type_int16s_decimate_by() + */ +#if !defined(_di_f_type_int16s_adjust_) || !defined(_di_f_type_int16s_decimate_by_) + extern f_status_t private_f_type_int16s_adjust(const f_array_length_t length, f_int16s_t *int16s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int16s_adjust_) || !defined(_di_f_type_int16s_decimate_by_) + +/** + * Private implementation for appending the int16 array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source int16s to append. + * @param destination + * The destination int16s the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int16s_append() + * @see f_type_int16ss_append() + */ +#if !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16ss_append_) + extern f_status_t private_f_type_int16s_append(const f_int16s_t source, f_int16s_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16ss_append_) + +/** + * Private implementation for resizing the int16s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int16s + * The int16s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int16s_resize() + * @see f_type_int16s_append() + * @see f_type_int16s_decimate_by() + * @see f_type_int16ss_append() + */ +#if !defined(_di_f_type_int16s_resize_) || !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16s_decimate_by_) || !defined(_di_f_type_int16ss_append_) + extern f_status_t private_f_type_int16s_resize(const f_array_length_t length, f_int16s_t *int16s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int16s_resize_) || !defined(_di_f_type_int16s_append_) || !defined(_di_f_type_int16s_decimate_by_) || !defined(_di_f_type_int16ss_append_) + +/** + * Private implementation for resizing the int16ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int16ss + * The int16ss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_int16ss_adjust() + * @see f_type_int16ss_decimate_by() + */ +#if !defined(_di_f_type_int16ss_adjust_) || !defined(_di_f_type_int16ss_decimate_by_) + extern f_status_t private_f_type_int16ss_adjust(const f_array_length_t length, f_int16ss_t *int16ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int16ss_adjust_) || !defined(_di_f_type_int16ss_decimate_by_) + +/** + * Private implementation for resizing the int16ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param int16ss + * The int16ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int16ss_decrease_by() + * @see f_type_int16ss_increase() + * @see f_type_int16ss_increase_by() + * @see f_type_int16ss_resize() + */ +#if !defined(_di_f_type_int16ss_decrease_by_) || !defined(_di_f_type_int16ss_increase_) || !defined(_di_f_type_int16ss_increase_by_) || !defined(_di_f_type_int16ss_resize_) + extern f_status_t private_f_type_int16ss_resize(const f_array_length_t length, f_int16ss_t *int16ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int16ss_decrease_by_) || !defined(_di_f_type_int16ss_increase_) || !defined(_di_f_type_int16ss_increase_by_) || !defined(_di_f_type_int16ss_resize_) + +/** + * Private implementation for resizing the uint16s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint16s + * The uint16s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_uint16s_adjust() + * @see f_type_uint16s_decimate_by() + */ +#if !defined(_di_f_type_uint16s_adjust_) || !defined(_di_f_type_uint16s_decimate_by_) + extern f_status_t private_f_type_uint16s_adjust(const f_array_length_t length, f_uint16s_t *uint16s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint16s_adjust_) || !defined(_di_f_type_uint16s_decimate_by_) + +/** + * Private implementation for appending the uint16 array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source uint16s to append. + * @param destination + * The destination uint16s the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint16s_append() + * @see f_type_uint16ss_append() + */ +#if !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16ss_append_) + extern f_status_t private_f_type_uint16s_append(const f_uint16s_t source, f_uint16s_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16ss_append_) + +/** + * Private implementation for resizing the uint16s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint16s + * The uint16s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint16s_resize() + * @see f_type_uint16s_append() + * @see f_type_uint16s_decimate_by() + * @see f_type_uint16ss_append() + */ +#if !defined(_di_f_type_uint16s_resize_) || !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16s_decimate_by_) || !defined(_di_f_type_uint16ss_append_) + extern f_status_t private_f_type_uint16s_resize(const f_array_length_t length, f_uint16s_t *uint16s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint16s_resize_) || !defined(_di_f_type_uint16s_append_) || !defined(_di_f_type_uint16s_decimate_by_) || !defined(_di_f_type_uint16ss_append_) + +/** + * Private implementation for resizing the uint16ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint16ss + * The uint16ss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_uint16ss_adjust() + * @see f_type_uint16ss_decimate_by() + */ +#if !defined(_di_f_type_uint16ss_adjust_) || !defined(_di_f_type_uint16ss_decimate_by_) + extern f_status_t private_f_type_uint16ss_adjust(const f_array_length_t length, f_uint16ss_t *uint16ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint16ss_adjust_) || !defined(_di_f_type_uint16ss_decimate_by_) + +/** + * Private implementation for resizing the uint16ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param uint16ss + * The uint16ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint16ss_decrease_by() + * @see f_type_uint16ss_increase() + * @see f_type_uint16ss_increase_by() + * @see f_type_uint16ss_resize() + */ +#if !defined(_di_f_type_uint16ss_decrease_by_) || !defined(_di_f_type_uint16ss_increase_) || !defined(_di_f_type_uint16ss_increase_by_) || !defined(_di_f_type_uint16ss_resize_) + extern f_status_t private_f_type_uint16ss_resize(const f_array_length_t length, f_uint16ss_t *uint16ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint16ss_decrease_by_) || !defined(_di_f_type_uint16ss_increase_) || !defined(_di_f_type_uint16ss_increase_by_) || !defined(_di_f_type_uint16ss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_type_array_int16_h diff --git a/level_0/f_type_array/c/type_array/private-int32.c b/level_0/f_type_array/c/type_array/private-int32.c new file mode 100644 index 0000000..8cda65c --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-int32.c @@ -0,0 +1,226 @@ +#include "../type_array.h" +#include "private-int32.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_type_int32s_adjust_) || !defined(_di_f_type_int32s_decimate_by_) + f_status_t private_f_type_int32s_adjust(const f_array_length_t length, f_int32s_t *int32s) { + + const f_status_t status = f_memory_adjust(int32s->size, length, sizeof(int32_t), (void **) & int32s->array); + + if (F_status_is_error_not(status)) { + int32s->size = length; + + if (int32s->used > int32s->size) { + int32s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int32s_adjust_) || !defined(_di_f_type_int32s_decimate_by_) + +#if !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32ss_append_) + extern f_status_t private_f_type_int32s_append(const f_int32s_t source, f_int32s_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_int32s_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32ss_append_) + +#if !defined(_di_f_type_int32s_resize_) || !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32s_decimate_by_) || !defined(_di_f_type_int32ss_append_) + f_status_t private_f_type_int32s_resize(const f_array_length_t length, f_int32s_t *int32s) { + + const f_status_t status = f_memory_resize(int32s->size, length, sizeof(int32_t), (void **) & int32s->array); + + if (F_status_is_error_not(status)) { + int32s->size = length; + + if (int32s->used > int32s->size) { + int32s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int32s_resize_) || !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32s_decimate_by_) || !defined(_di_f_type_int32ss_append_) + +#if !defined(_di_f_type_int32ss_adjust_) || !defined(_di_f_type_int32ss_decimate_by_) + f_status_t private_f_type_int32ss_adjust(const f_array_length_t length, f_int32ss_t *int32ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < int32ss->size; ++i) { + + status = f_memory_destroy(int32ss->array[i].size, sizeof(f_int32s_t), (void **) & int32ss->array[i].array); + if (F_status_is_error(status)) return status; + + int32ss->array[i].size = 0; + int32ss->array[i].used = 0; + } // for + + status = f_memory_adjust(int32ss->size, length, sizeof(f_int32s_t), (void **) & int32ss->array); + + if (F_status_is_error_not(status)) { + int32ss->size = length; + + if (int32ss->used > int32ss->size) { + int32ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int32ss_adjust_) || !defined(_di_f_type_int32ss_decimate_by_) + +#if !defined(_di_f_type_int32ss_decrease_by_) || !defined(_di_f_type_int32ss_increase_) || !defined(_di_f_type_int32ss_increase_by_) || !defined(_di_f_type_int32ss_resize_) + f_status_t private_f_type_int32ss_resize(const f_array_length_t length, f_int32ss_t *int32ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < int32ss->size; ++i) { + + status = f_memory_delete(int32ss->array[i].size, sizeof(f_int32s_t), (void **) & int32ss->array[i].array); + if (F_status_is_error(status)) return status; + + int32ss->array[i].size = 0; + int32ss->array[i].used = 0; + } // for + + status = f_memory_resize(int32ss->size, length, sizeof(f_int32s_t), (void **) & int32ss->array); + + if (F_status_is_error_not(status)) { + int32ss->size = length; + + if (int32ss->used > int32ss->size) { + int32ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int32ss_decrease_by_) || !defined(_di_f_type_int32ss_increase_) || !defined(_di_f_type_int32ss_increase_by_) || !defined(_di_f_type_int32ss_resize_) + +#if !defined(_di_f_type_uint32s_adjust_) || !defined(_di_f_type_uint32s_decimate_by_) + f_status_t private_f_type_uint32s_adjust(const f_array_length_t length, f_uint32s_t *uint32s) { + + const f_status_t status = f_memory_adjust(uint32s->size, length, sizeof(uint32_t), (void **) & uint32s->array); + + if (F_status_is_error_not(status)) { + uint32s->size = length; + + if (uint32s->used > uint32s->size) { + uint32s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint32s_adjust_) || !defined(_di_f_type_uint32s_decimate_by_) + +#if !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32ss_append_) + extern f_status_t private_f_type_uint32s_append(const f_uint32s_t source, f_uint32s_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_uint32s_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32ss_append_) + +#if !defined(_di_f_type_uint32s_resize_) || !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32s_decimate_by_) || !defined(_di_f_type_uint32ss_append_) + f_status_t private_f_type_uint32s_resize(const f_array_length_t length, f_uint32s_t *uint32s) { + + const f_status_t status = f_memory_resize(uint32s->size, length, sizeof(uint32_t), (void **) & uint32s->array); + + if (F_status_is_error_not(status)) { + uint32s->size = length; + + if (uint32s->used > uint32s->size) { + uint32s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint32s_resize_) || !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32s_decimate_by_) || !defined(_di_f_type_uint32ss_append_) + +#if !defined(_di_f_type_uint32ss_adjust_) || !defined(_di_f_type_uint32ss_decimate_by_) + f_status_t private_f_type_uint32ss_adjust(const f_array_length_t length, f_uint32ss_t *uint32ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < uint32ss->size; ++i) { + + status = f_memory_destroy(uint32ss->array[i].size, sizeof(f_uint32s_t), (void **) & uint32ss->array[i].array); + if (F_status_is_error(status)) return status; + + uint32ss->array[i].size = 0; + uint32ss->array[i].used = 0; + } // for + + status = f_memory_adjust(uint32ss->size, length, sizeof(f_uint32s_t), (void **) & uint32ss->array); + + if (F_status_is_error_not(status)) { + uint32ss->size = length; + + if (uint32ss->used > uint32ss->size) { + uint32ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint32ss_adjust_) || !defined(_di_f_type_uint32ss_decimate_by_) + +#if !defined(_di_f_type_uint32ss_decrease_by_) || !defined(_di_f_type_uint32ss_increase_) || !defined(_di_f_type_uint32ss_increase_by_) || !defined(_di_f_type_uint32ss_resize_) + f_status_t private_f_type_uint32ss_resize(const f_array_length_t length, f_uint32ss_t *uint32ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < uint32ss->size; ++i) { + + status = f_memory_delete(uint32ss->array[i].size, sizeof(f_uint32s_t), (void **) & uint32ss->array[i].array); + if (F_status_is_error(status)) return status; + + uint32ss->array[i].size = 0; + uint32ss->array[i].used = 0; + } // for + + status = f_memory_resize(uint32ss->size, length, sizeof(f_uint32s_t), (void **) & uint32ss->array); + + if (F_status_is_error_not(status)) { + uint32ss->size = length; + + if (uint32ss->used > uint32ss->size) { + uint32ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint32ss_decrease_by_) || !defined(_di_f_type_uint32ss_increase_) || !defined(_di_f_type_uint32ss_increase_by_) || !defined(_di_f_type_uint32ss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/private-int32.h b/level_0/f_type_array/c/type_array/private-int32.h new file mode 100644 index 0000000..fcf854e --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-int32.h @@ -0,0 +1,278 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_type_array_int32_h +#define _PRIVATE_F_type_array_int32_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing the int32s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int32s + * The int32s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_int32s_adjust() + * @see f_type_int32s_decimate_by() + */ +#if !defined(_di_f_type_int32s_adjust_) || !defined(_di_f_type_int32s_decimate_by_) + extern f_status_t private_f_type_int32s_adjust(const f_array_length_t length, f_int32s_t *int32s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int32s_adjust_) || !defined(_di_f_type_int32s_decimate_by_) + +/** + * Private implementation for appending the int32 array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source int32s to append. + * @param destination + * The destination int32s the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int32s_append() + * @see f_type_int32ss_append() + */ +#if !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32ss_append_) + extern f_status_t private_f_type_int32s_append(const f_int32s_t source, f_int32s_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32ss_append_) + +/** + * Private implementation for resizing the int32s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int32s + * The int32s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int32s_resize() + * @see f_type_int32s_append() + * @see f_type_int32s_decimate_by() + * @see f_type_int32ss_append() + */ +#if !defined(_di_f_type_int32s_resize_) || !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32s_decimate_by_) || !defined(_di_f_type_int32ss_append_) + extern f_status_t private_f_type_int32s_resize(const f_array_length_t length, f_int32s_t *int32s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int32s_resize_) || !defined(_di_f_type_int32s_append_) || !defined(_di_f_type_int32s_decimate_by_) || !defined(_di_f_type_int32ss_append_) + +/** + * Private implementation for resizing the int32ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int32ss + * The int32ss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_int32ss_adjust() + * @see f_type_int32ss_decimate_by() + */ +#if !defined(_di_f_type_int32ss_adjust_) || !defined(_di_f_type_int32ss_decimate_by_) + extern f_status_t private_f_type_int32ss_adjust(const f_array_length_t length, f_int32ss_t *int32ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int32ss_adjust_) || !defined(_di_f_type_int32ss_decimate_by_) + +/** + * Private implementation for resizing the int32ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param int32ss + * The int32ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int32ss_decrease_by() + * @see f_type_int32ss_increase() + * @see f_type_int32ss_increase_by() + * @see f_type_int32ss_resize() + */ +#if !defined(_di_f_type_int32ss_decrease_by_) || !defined(_di_f_type_int32ss_increase_) || !defined(_di_f_type_int32ss_increase_by_) || !defined(_di_f_type_int32ss_resize_) + extern f_status_t private_f_type_int32ss_resize(const f_array_length_t length, f_int32ss_t *int32ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int32ss_decrease_by_) || !defined(_di_f_type_int32ss_increase_) || !defined(_di_f_type_int32ss_increase_by_) || !defined(_di_f_type_int32ss_resize_) + +/** + * Private implementation for resizing the uint32s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint32s + * The uint32s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_uint32s_adjust() + * @see f_type_uint32s_decimate_by() + */ +#if !defined(_di_f_type_uint32s_adjust_) || !defined(_di_f_type_uint32s_decimate_by_) + extern f_status_t private_f_type_uint32s_adjust(const f_array_length_t length, f_uint32s_t *uint32s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint32s_adjust_) || !defined(_di_f_type_uint32s_decimate_by_) + +/** + * Private implementation for appending the uint32 array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source uint32s to append. + * @param destination + * The destination uint32s the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint32s_append() + * @see f_type_uint32ss_append() + */ +#if !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32ss_append_) + extern f_status_t private_f_type_uint32s_append(const f_uint32s_t source, f_uint32s_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32ss_append_) + +/** + * Private implementation for resizing the uint32s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint32s + * The uint32s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint32s_resize() + * @see f_type_uint32s_append() + * @see f_type_uint32s_decimate_by() + * @see f_type_uint32ss_append() + */ +#if !defined(_di_f_type_uint32s_resize_) || !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32s_decimate_by_) || !defined(_di_f_type_uint32ss_append_) + extern f_status_t private_f_type_uint32s_resize(const f_array_length_t length, f_uint32s_t *uint32s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint32s_resize_) || !defined(_di_f_type_uint32s_append_) || !defined(_di_f_type_uint32s_decimate_by_) || !defined(_di_f_type_uint32ss_append_) + +/** + * Private implementation for resizing the uint32ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint32ss + * The uint32ss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_uint32ss_adjust() + * @see f_type_uint32ss_decimate_by() + */ +#if !defined(_di_f_type_uint32ss_adjust_) || !defined(_di_f_type_uint32ss_decimate_by_) + extern f_status_t private_f_type_uint32ss_adjust(const f_array_length_t length, f_uint32ss_t *uint32ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint32ss_adjust_) || !defined(_di_f_type_uint32ss_decimate_by_) + +/** + * Private implementation for resizing the uint32ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param uint32ss + * The uint32ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint32ss_decrease_by() + * @see f_type_uint32ss_increase() + * @see f_type_uint32ss_increase_by() + * @see f_type_uint32ss_resize() + */ +#if !defined(_di_f_type_uint32ss_decrease_by_) || !defined(_di_f_type_uint32ss_increase_) || !defined(_di_f_type_uint32ss_increase_by_) || !defined(_di_f_type_uint32ss_resize_) + extern f_status_t private_f_type_uint32ss_resize(const f_array_length_t length, f_uint32ss_t *uint32ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint32ss_decrease_by_) || !defined(_di_f_type_uint32ss_increase_) || !defined(_di_f_type_uint32ss_increase_by_) || !defined(_di_f_type_uint32ss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_type_array_int32_h diff --git a/level_0/f_type_array/c/type_array/private-int64.c b/level_0/f_type_array/c/type_array/private-int64.c new file mode 100644 index 0000000..84e128f --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-int64.c @@ -0,0 +1,226 @@ +#include "../type_array.h" +#include "private-int64.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_type_int64s_adjust_) || !defined(_di_f_type_int64s_decimate_by_) + f_status_t private_f_type_int64s_adjust(const f_array_length_t length, f_int64s_t *int64s) { + + const f_status_t status = f_memory_adjust(int64s->size, length, sizeof(int64_t), (void **) & int64s->array); + + if (F_status_is_error_not(status)) { + int64s->size = length; + + if (int64s->used > int64s->size) { + int64s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int64s_adjust_) || !defined(_di_f_type_int64s_decimate_by_) + +#if !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64ss_append_) + extern f_status_t private_f_type_int64s_append(const f_int64s_t source, f_int64s_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_int64s_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64ss_append_) + +#if !defined(_di_f_type_int64s_resize_) || !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64s_decimate_by_) || !defined(_di_f_type_int64ss_append_) + f_status_t private_f_type_int64s_resize(const f_array_length_t length, f_int64s_t *int64s) { + + const f_status_t status = f_memory_resize(int64s->size, length, sizeof(int64_t), (void **) & int64s->array); + + if (F_status_is_error_not(status)) { + int64s->size = length; + + if (int64s->used > int64s->size) { + int64s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int64s_resize_) || !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64s_decimate_by_) || !defined(_di_f_type_int64ss_append_) + +#if !defined(_di_f_type_int64ss_adjust_) || !defined(_di_f_type_int64ss_decimate_by_) + f_status_t private_f_type_int64ss_adjust(const f_array_length_t length, f_int64ss_t *int64ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < int64ss->size; ++i) { + + status = f_memory_destroy(int64ss->array[i].size, sizeof(f_int64s_t), (void **) & int64ss->array[i].array); + if (F_status_is_error(status)) return status; + + int64ss->array[i].size = 0; + int64ss->array[i].used = 0; + } // for + + status = f_memory_adjust(int64ss->size, length, sizeof(f_int64s_t), (void **) & int64ss->array); + + if (F_status_is_error_not(status)) { + int64ss->size = length; + + if (int64ss->used > int64ss->size) { + int64ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int64ss_adjust_) || !defined(_di_f_type_int64ss_decimate_by_) + +#if !defined(_di_f_type_int64ss_decrease_by_) || !defined(_di_f_type_int64ss_increase_) || !defined(_di_f_type_int64ss_increase_by_) || !defined(_di_f_type_int64ss_resize_) + f_status_t private_f_type_int64ss_resize(const f_array_length_t length, f_int64ss_t *int64ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < int64ss->size; ++i) { + + status = f_memory_delete(int64ss->array[i].size, sizeof(f_int64s_t), (void **) & int64ss->array[i].array); + if (F_status_is_error(status)) return status; + + int64ss->array[i].size = 0; + int64ss->array[i].used = 0; + } // for + + status = f_memory_resize(int64ss->size, length, sizeof(f_int64s_t), (void **) & int64ss->array); + + if (F_status_is_error_not(status)) { + int64ss->size = length; + + if (int64ss->used > int64ss->size) { + int64ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int64ss_decrease_by_) || !defined(_di_f_type_int64ss_increase_) || !defined(_di_f_type_int64ss_increase_by_) || !defined(_di_f_type_int64ss_resize_) + +#if !defined(_di_f_type_uint64s_adjust_) || !defined(_di_f_type_uint64s_decimate_by_) + f_status_t private_f_type_uint64s_adjust(const f_array_length_t length, f_uint64s_t *uint64s) { + + const f_status_t status = f_memory_adjust(uint64s->size, length, sizeof(uint64_t), (void **) & uint64s->array); + + if (F_status_is_error_not(status)) { + uint64s->size = length; + + if (uint64s->used > uint64s->size) { + uint64s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint64s_adjust_) || !defined(_di_f_type_uint64s_decimate_by_) + +#if !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64ss_append_) + extern f_status_t private_f_type_uint64s_append(const f_uint64s_t source, f_uint64s_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_uint64s_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64ss_append_) + +#if !defined(_di_f_type_uint64s_resize_) || !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64s_decimate_by_) || !defined(_di_f_type_uint64ss_append_) + f_status_t private_f_type_uint64s_resize(const f_array_length_t length, f_uint64s_t *uint64s) { + + const f_status_t status = f_memory_resize(uint64s->size, length, sizeof(uint64_t), (void **) & uint64s->array); + + if (F_status_is_error_not(status)) { + uint64s->size = length; + + if (uint64s->used > uint64s->size) { + uint64s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint64s_resize_) || !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64s_decimate_by_) || !defined(_di_f_type_uint64ss_append_) + +#if !defined(_di_f_type_uint64ss_adjust_) || !defined(_di_f_type_uint64ss_decimate_by_) + f_status_t private_f_type_uint64ss_adjust(const f_array_length_t length, f_uint64ss_t *uint64ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < uint64ss->size; ++i) { + + status = f_memory_destroy(uint64ss->array[i].size, sizeof(f_uint64s_t), (void **) & uint64ss->array[i].array); + if (F_status_is_error(status)) return status; + + uint64ss->array[i].size = 0; + uint64ss->array[i].used = 0; + } // for + + status = f_memory_adjust(uint64ss->size, length, sizeof(f_uint64s_t), (void **) & uint64ss->array); + + if (F_status_is_error_not(status)) { + uint64ss->size = length; + + if (uint64ss->used > uint64ss->size) { + uint64ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint64ss_adjust_) || !defined(_di_f_type_uint64ss_decimate_by_) + +#if !defined(_di_f_type_uint64ss_decrease_by_) || !defined(_di_f_type_uint64ss_increase_) || !defined(_di_f_type_uint64ss_increase_by_) || !defined(_di_f_type_uint64ss_resize_) + f_status_t private_f_type_uint64ss_resize(const f_array_length_t length, f_uint64ss_t *uint64ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < uint64ss->size; ++i) { + + status = f_memory_delete(uint64ss->array[i].size, sizeof(f_uint64s_t), (void **) & uint64ss->array[i].array); + if (F_status_is_error(status)) return status; + + uint64ss->array[i].size = 0; + uint64ss->array[i].used = 0; + } // for + + status = f_memory_resize(uint64ss->size, length, sizeof(f_uint64s_t), (void **) & uint64ss->array); + + if (F_status_is_error_not(status)) { + uint64ss->size = length; + + if (uint64ss->used > uint64ss->size) { + uint64ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint64ss_decrease_by_) || !defined(_di_f_type_uint64ss_increase_) || !defined(_di_f_type_uint64ss_increase_by_) || !defined(_di_f_type_uint64ss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/private-int64.h b/level_0/f_type_array/c/type_array/private-int64.h new file mode 100644 index 0000000..bcf17a2 --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-int64.h @@ -0,0 +1,278 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_type_array_int64_h +#define _PRIVATE_F_type_array_int64_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing the int64s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int64s + * The int64s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_int64s_adjust() + * @see f_type_int64s_decimate_by() + */ +#if !defined(_di_f_type_int64s_adjust_) || !defined(_di_f_type_int64s_decimate_by_) + extern f_status_t private_f_type_int64s_adjust(const f_array_length_t length, f_int64s_t *int64s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int64s_adjust_) || !defined(_di_f_type_int64s_decimate_by_) + +/** + * Private implementation for appending the int64 array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source int64s to append. + * @param destination + * The destination int64s the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int64s_append() + * @see f_type_int64ss_append() + */ +#if !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64ss_append_) + extern f_status_t private_f_type_int64s_append(const f_int64s_t source, f_int64s_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64ss_append_) + +/** + * Private implementation for resizing the int64s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int64s + * The int64s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int64s_resize() + * @see f_type_int64s_append() + * @see f_type_int64s_decimate_by() + * @see f_type_int64ss_append() + */ +#if !defined(_di_f_type_int64s_resize_) || !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64s_decimate_by_) || !defined(_di_f_type_int64ss_append_) + extern f_status_t private_f_type_int64s_resize(const f_array_length_t length, f_int64s_t *int64s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int64s_resize_) || !defined(_di_f_type_int64s_append_) || !defined(_di_f_type_int64s_decimate_by_) || !defined(_di_f_type_int64ss_append_) + +/** + * Private implementation for resizing the int64ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int64ss + * The int64ss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_int64ss_adjust() + * @see f_type_int64ss_decimate_by() + */ +#if !defined(_di_f_type_int64ss_adjust_) || !defined(_di_f_type_int64ss_decimate_by_) + extern f_status_t private_f_type_int64ss_adjust(const f_array_length_t length, f_int64ss_t *int64ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int64ss_adjust_) || !defined(_di_f_type_int64ss_decimate_by_) + +/** + * Private implementation for resizing the int64ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param int64ss + * The int64ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int64ss_decrease_by() + * @see f_type_int64ss_increase() + * @see f_type_int64ss_increase_by() + * @see f_type_int64ss_resize() + */ +#if !defined(_di_f_type_int64ss_decrease_by_) || !defined(_di_f_type_int64ss_increase_) || !defined(_di_f_type_int64ss_increase_by_) || !defined(_di_f_type_int64ss_resize_) + extern f_status_t private_f_type_int64ss_resize(const f_array_length_t length, f_int64ss_t *int64ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int64ss_decrease_by_) || !defined(_di_f_type_int64ss_increase_) || !defined(_di_f_type_int64ss_increase_by_) || !defined(_di_f_type_int64ss_resize_) + +/** + * Private implementation for resizing the uint64s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint64s + * The uint64s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_uint64s_adjust() + * @see f_type_uint64s_decimate_by() + */ +#if !defined(_di_f_type_uint64s_adjust_) || !defined(_di_f_type_uint64s_decimate_by_) + extern f_status_t private_f_type_uint64s_adjust(const f_array_length_t length, f_uint64s_t *uint64s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint64s_adjust_) || !defined(_di_f_type_uint64s_decimate_by_) + +/** + * Private implementation for appending the uint64 array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source uint64s to append. + * @param destination + * The destination uint64s the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint64s_append() + * @see f_type_uint64ss_append() + */ +#if !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64ss_append_) + extern f_status_t private_f_type_uint64s_append(const f_uint64s_t source, f_uint64s_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64ss_append_) + +/** + * Private implementation for resizing the uint64s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint64s + * The uint64s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint64s_resize() + * @see f_type_uint64s_append() + * @see f_type_uint64s_decimate_by() + * @see f_type_uint64ss_append() + */ +#if !defined(_di_f_type_uint64s_resize_) || !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64s_decimate_by_) || !defined(_di_f_type_uint64ss_append_) + extern f_status_t private_f_type_uint64s_resize(const f_array_length_t length, f_uint64s_t *uint64s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint64s_resize_) || !defined(_di_f_type_uint64s_append_) || !defined(_di_f_type_uint64s_decimate_by_) || !defined(_di_f_type_uint64ss_append_) + +/** + * Private implementation for resizing the uint64ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint64ss + * The uint64ss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_uint64ss_adjust() + * @see f_type_uint64ss_decimate_by() + */ +#if !defined(_di_f_type_uint64ss_adjust_) || !defined(_di_f_type_uint64ss_decimate_by_) + extern f_status_t private_f_type_uint64ss_adjust(const f_array_length_t length, f_uint64ss_t *uint64ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint64ss_adjust_) || !defined(_di_f_type_uint64ss_decimate_by_) + +/** + * Private implementation for resizing the uint64ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param uint64ss + * The uint64ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint64ss_decrease_by() + * @see f_type_uint64ss_increase() + * @see f_type_uint64ss_increase_by() + * @see f_type_uint64ss_resize() + */ +#if !defined(_di_f_type_uint64ss_decrease_by_) || !defined(_di_f_type_uint64ss_increase_) || !defined(_di_f_type_uint64ss_increase_by_) || !defined(_di_f_type_uint64ss_resize_) + extern f_status_t private_f_type_uint64ss_resize(const f_array_length_t length, f_uint64ss_t *uint64ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint64ss_decrease_by_) || !defined(_di_f_type_uint64ss_increase_) || !defined(_di_f_type_uint64ss_increase_by_) || !defined(_di_f_type_uint64ss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_type_array_int64_h diff --git a/level_0/f_type_array/c/type_array/private-int8.c b/level_0/f_type_array/c/type_array/private-int8.c new file mode 100644 index 0000000..55fa02b --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-int8.c @@ -0,0 +1,226 @@ +#include "../type_array.h" +#include "private-int8.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_type_int8s_adjust_) || !defined(_di_f_type_int8s_decimate_by_) + f_status_t private_f_type_int8s_adjust(const f_array_length_t length, f_int8s_t *int8s) { + + const f_status_t status = f_memory_adjust(int8s->size, length, sizeof(int8_t), (void **) & int8s->array); + + if (F_status_is_error_not(status)) { + int8s->size = length; + + if (int8s->used > int8s->size) { + int8s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int8s_adjust_) || !defined(_di_f_type_int8s_decimate_by_) + +#if !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8ss_append_) + extern f_status_t private_f_type_int8s_append(const f_int8s_t source, f_int8s_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_int8s_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8ss_append_) + +#if !defined(_di_f_type_int8s_resize_) || !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8s_decimate_by_) || !defined(_di_f_type_int8ss_append_) + f_status_t private_f_type_int8s_resize(const f_array_length_t length, f_int8s_t *int8s) { + + const f_status_t status = f_memory_resize(int8s->size, length, sizeof(int8_t), (void **) & int8s->array); + + if (F_status_is_error_not(status)) { + int8s->size = length; + + if (int8s->used > int8s->size) { + int8s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int8s_resize_) || !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8s_decimate_by_) || !defined(_di_f_type_int8ss_append_) + +#if !defined(_di_f_type_int8ss_adjust_) || !defined(_di_f_type_int8ss_decimate_by_) + f_status_t private_f_type_int8ss_adjust(const f_array_length_t length, f_int8ss_t *int8ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < int8ss->size; ++i) { + + status = f_memory_destroy(int8ss->array[i].size, sizeof(f_int8s_t), (void **) & int8ss->array[i].array); + if (F_status_is_error(status)) return status; + + int8ss->array[i].size = 0; + int8ss->array[i].used = 0; + } // for + + status = f_memory_adjust(int8ss->size, length, sizeof(f_int8s_t), (void **) & int8ss->array); + + if (F_status_is_error_not(status)) { + int8ss->size = length; + + if (int8ss->used > int8ss->size) { + int8ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int8ss_adjust_) || !defined(_di_f_type_int8ss_decimate_by_) + +#if !defined(_di_f_type_int8ss_decrease_by_) || !defined(_di_f_type_int8ss_increase_) || !defined(_di_f_type_int8ss_increase_by_) || !defined(_di_f_type_int8ss_resize_) + f_status_t private_f_type_int8ss_resize(const f_array_length_t length, f_int8ss_t *int8ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < int8ss->size; ++i) { + + status = f_memory_delete(int8ss->array[i].size, sizeof(f_int8s_t), (void **) & int8ss->array[i].array); + if (F_status_is_error(status)) return status; + + int8ss->array[i].size = 0; + int8ss->array[i].used = 0; + } // for + + status = f_memory_resize(int8ss->size, length, sizeof(f_int8s_t), (void **) & int8ss->array); + + if (F_status_is_error_not(status)) { + int8ss->size = length; + + if (int8ss->used > int8ss->size) { + int8ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_int8ss_decrease_by_) || !defined(_di_f_type_int8ss_increase_) || !defined(_di_f_type_int8ss_increase_by_) || !defined(_di_f_type_int8ss_resize_) + +#if !defined(_di_f_type_uint8s_adjust_) || !defined(_di_f_type_uint8s_decimate_by_) + f_status_t private_f_type_uint8s_adjust(const f_array_length_t length, f_uint8s_t *uint8s) { + + const f_status_t status = f_memory_adjust(uint8s->size, length, sizeof(uint8_t), (void **) & uint8s->array); + + if (F_status_is_error_not(status)) { + uint8s->size = length; + + if (uint8s->used > uint8s->size) { + uint8s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint8s_adjust_) || !defined(_di_f_type_uint8s_decimate_by_) + +#if !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8ss_append_) + extern f_status_t private_f_type_uint8s_append(const f_uint8s_t source, f_uint8s_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_uint8s_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8ss_append_) + +#if !defined(_di_f_type_uint8s_resize_) || !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8s_decimate_by_) || !defined(_di_f_type_uint8ss_append_) + f_status_t private_f_type_uint8s_resize(const f_array_length_t length, f_uint8s_t *uint8s) { + + const f_status_t status = f_memory_resize(uint8s->size, length, sizeof(uint8_t), (void **) & uint8s->array); + + if (F_status_is_error_not(status)) { + uint8s->size = length; + + if (uint8s->used > uint8s->size) { + uint8s->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint8s_resize_) || !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8s_decimate_by_) || !defined(_di_f_type_uint8ss_append_) + +#if !defined(_di_f_type_uint8ss_adjust_) || !defined(_di_f_type_uint8ss_decimate_by_) + f_status_t private_f_type_uint8ss_adjust(const f_array_length_t length, f_uint8ss_t *uint8ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < uint8ss->size; ++i) { + + status = f_memory_destroy(uint8ss->array[i].size, sizeof(f_uint8s_t), (void **) & uint8ss->array[i].array); + if (F_status_is_error(status)) return status; + + uint8ss->array[i].size = 0; + uint8ss->array[i].used = 0; + } // for + + status = f_memory_adjust(uint8ss->size, length, sizeof(f_uint8s_t), (void **) & uint8ss->array); + + if (F_status_is_error_not(status)) { + uint8ss->size = length; + + if (uint8ss->used > uint8ss->size) { + uint8ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint8ss_adjust_) || !defined(_di_f_type_uint8ss_decimate_by_) + +#if !defined(_di_f_type_uint8ss_decrease_by_) || !defined(_di_f_type_uint8ss_increase_) || !defined(_di_f_type_uint8ss_increase_by_) || !defined(_di_f_type_uint8ss_resize_) + f_status_t private_f_type_uint8ss_resize(const f_array_length_t length, f_uint8ss_t *uint8ss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < uint8ss->size; ++i) { + + status = f_memory_delete(uint8ss->array[i].size, sizeof(f_uint8s_t), (void **) & uint8ss->array[i].array); + if (F_status_is_error(status)) return status; + + uint8ss->array[i].size = 0; + uint8ss->array[i].used = 0; + } // for + + status = f_memory_resize(uint8ss->size, length, sizeof(f_uint8s_t), (void **) & uint8ss->array); + + if (F_status_is_error_not(status)) { + uint8ss->size = length; + + if (uint8ss->used > uint8ss->size) { + uint8ss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_uint8ss_decrease_by_) || !defined(_di_f_type_uint8ss_increase_) || !defined(_di_f_type_uint8ss_increase_by_) || !defined(_di_f_type_uint8ss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/private-int8.h b/level_0/f_type_array/c/type_array/private-int8.h new file mode 100644 index 0000000..3354ab2 --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-int8.h @@ -0,0 +1,278 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_type_array_int8_h +#define _PRIVATE_F_type_array_int8_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing the int8s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int8s + * The int8s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_int8s_adjust() + * @see f_type_int8s_decimate_by() + */ +#if !defined(_di_f_type_int8s_adjust_) || !defined(_di_f_type_int8s_decimate_by_) + extern f_status_t private_f_type_int8s_adjust(const f_array_length_t length, f_int8s_t *int8s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int8s_adjust_) || !defined(_di_f_type_int8s_decimate_by_) + +/** + * Private implementation for appending the int8 array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source int8s to append. + * @param destination + * The destination int8s the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int8s_append() + * @see f_type_int8ss_append() + */ +#if !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8ss_append_) + extern f_status_t private_f_type_int8s_append(const f_int8s_t source, f_int8s_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8ss_append_) + +/** + * Private implementation for resizing the int8s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int8s + * The int8s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int8s_resize() + * @see f_type_int8s_append() + * @see f_type_int8s_decimate_by() + * @see f_type_int8ss_append() + */ +#if !defined(_di_f_type_int8s_resize_) || !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8s_decimate_by_) || !defined(_di_f_type_int8ss_append_) + extern f_status_t private_f_type_int8s_resize(const f_array_length_t length, f_int8s_t *int8s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int8s_resize_) || !defined(_di_f_type_int8s_append_) || !defined(_di_f_type_int8s_decimate_by_) || !defined(_di_f_type_int8ss_append_) + +/** + * Private implementation for resizing the int8ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param int8ss + * The int8ss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_int8ss_adjust() + * @see f_type_int8ss_decimate_by() + */ +#if !defined(_di_f_type_int8ss_adjust_) || !defined(_di_f_type_int8ss_decimate_by_) + extern f_status_t private_f_type_int8ss_adjust(const f_array_length_t length, f_int8ss_t *int8ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int8ss_adjust_) || !defined(_di_f_type_int8ss_decimate_by_) + +/** + * Private implementation for resizing the int8ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param int8ss + * The int8ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_int8ss_decrease_by() + * @see f_type_int8ss_increase() + * @see f_type_int8ss_increase_by() + * @see f_type_int8ss_resize() + */ +#if !defined(_di_f_type_int8ss_decrease_by_) || !defined(_di_f_type_int8ss_increase_) || !defined(_di_f_type_int8ss_increase_by_) || !defined(_di_f_type_int8ss_resize_) + extern f_status_t private_f_type_int8ss_resize(const f_array_length_t length, f_int8ss_t *int8ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_int8ss_decrease_by_) || !defined(_di_f_type_int8ss_increase_) || !defined(_di_f_type_int8ss_increase_by_) || !defined(_di_f_type_int8ss_resize_) + +/** + * Private implementation for resizing the uint8s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint8s + * The uint8s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_uint8s_adjust() + * @see f_type_uint8s_decimate_by() + */ +#if !defined(_di_f_type_uint8s_adjust_) || !defined(_di_f_type_uint8s_decimate_by_) + extern f_status_t private_f_type_uint8s_adjust(const f_array_length_t length, f_uint8s_t *uint8s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint8s_adjust_) || !defined(_di_f_type_uint8s_decimate_by_) + +/** + * Private implementation for appending the uint8 array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source uint8s to append. + * @param destination + * The destination uint8s the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint8s_append() + * @see f_type_uint8ss_append() + */ +#if !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8ss_append_) + extern f_status_t private_f_type_uint8s_append(const f_uint8s_t source, f_uint8s_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8ss_append_) + +/** + * Private implementation for resizing the uint8s array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint8s + * The uint8s array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint8s_resize() + * @see f_type_uint8s_append() + * @see f_type_uint8s_decimate_by() + * @see f_type_uint8ss_append() + */ +#if !defined(_di_f_type_uint8s_resize_) || !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8s_decimate_by_) || !defined(_di_f_type_uint8ss_append_) + extern f_status_t private_f_type_uint8s_resize(const f_array_length_t length, f_uint8s_t *uint8s) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint8s_resize_) || !defined(_di_f_type_uint8s_append_) || !defined(_di_f_type_uint8s_decimate_by_) || !defined(_di_f_type_uint8ss_append_) + +/** + * Private implementation for resizing the uint8ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param uint8ss + * The uint8ss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_uint8ss_adjust() + * @see f_type_uint8ss_decimate_by() + */ +#if !defined(_di_f_type_uint8ss_adjust_) || !defined(_di_f_type_uint8ss_decimate_by_) + extern f_status_t private_f_type_uint8ss_adjust(const f_array_length_t length, f_uint8ss_t *uint8ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint8ss_adjust_) || !defined(_di_f_type_uint8ss_decimate_by_) + +/** + * Private implementation for resizing the uint8ss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param uint8ss + * The uint8ss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_uint8ss_decrease_by() + * @see f_type_uint8ss_increase() + * @see f_type_uint8ss_increase_by() + * @see f_type_uint8ss_resize() + */ +#if !defined(_di_f_type_uint8ss_decrease_by_) || !defined(_di_f_type_uint8ss_increase_) || !defined(_di_f_type_uint8ss_increase_by_) || !defined(_di_f_type_uint8ss_resize_) + extern f_status_t private_f_type_uint8ss_resize(const f_array_length_t length, f_uint8ss_t *uint8ss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_uint8ss_decrease_by_) || !defined(_di_f_type_uint8ss_increase_) || !defined(_di_f_type_uint8ss_increase_by_) || !defined(_di_f_type_uint8ss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_type_array_int8_h diff --git a/level_0/f_type_array/c/type_array/private-state.c b/level_0/f_type_array/c/type_array/private-state.c new file mode 100644 index 0000000..a5973fa --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-state.c @@ -0,0 +1,118 @@ +#include "../type_array.h" +#include "private-state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_type_states_adjust_) || !defined(_di_f_type_states_decimate_by_) + f_status_t private_f_type_states_adjust(const f_array_length_t length, f_states_t *states) { + + const f_status_t status = f_memory_adjust(states->size, length, sizeof(f_state_t), (void **) & states->array); + + if (F_status_is_error_not(status)) { + states->size = length; + + if (states->used > states->size) { + states->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_states_adjust_) || !defined(_di_f_type_states_decimate_by_) + +#if !defined(_di_f_type_states_append_) || !defined(_di_f_type_statess_append_) + extern f_status_t private_f_type_states_append(const f_states_t source, f_states_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_states_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_states_append_) || !defined(_di_f_type_statess_append_) + +#if !defined(_di_f_type_states_resize_) || !defined(_di_f_type_states_append_) || !defined(_di_f_type_states_decimate_by_) || !defined(_di_f_type_statess_append_) + f_status_t private_f_type_states_resize(const f_array_length_t length, f_states_t *states) { + + const f_status_t status = f_memory_resize(states->size, length, sizeof(f_state_t), (void **) & states->array); + + if (F_status_is_error_not(status)) { + states->size = length; + + if (states->used > states->size) { + states->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_states_resize_) || !defined(_di_f_type_states_append_) || !defined(_di_f_type_states_decimate_by_) || !defined(_di_f_type_statess_append_) + +#if !defined(_di_f_type_statess_adjust_) || !defined(_di_f_type_statess_decimate_by_) + f_status_t private_f_type_statess_adjust(const f_array_length_t length, f_statess_t *statess) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < statess->size; ++i) { + + status = f_memory_destroy(statess->array[i].size, sizeof(f_states_t), (void **) & statess->array[i].array); + if (F_status_is_error(status)) return status; + + statess->array[i].size = 0; + statess->array[i].used = 0; + } // for + + status = f_memory_adjust(statess->size, length, sizeof(f_states_t), (void **) & statess->array); + + if (F_status_is_error_not(status)) { + statess->size = length; + + if (statess->used > statess->size) { + statess->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_statess_adjust_) || !defined(_di_f_type_statess_decimate_by_) + +#if !defined(_di_f_type_statess_decrease_by_) || !defined(_di_f_type_statess_increase_) || !defined(_di_f_type_statess_increase_by_) || !defined(_di_f_type_statess_resize_) + f_status_t private_f_type_statess_resize(const f_array_length_t length, f_statess_t *statess) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < statess->size; ++i) { + + status = f_memory_delete(statess->array[i].size, sizeof(f_states_t), (void **) & statess->array[i].array); + if (F_status_is_error(status)) return status; + + statess->array[i].size = 0; + statess->array[i].used = 0; + } // for + + status = f_memory_resize(statess->size, length, sizeof(f_states_t), (void **) & statess->array); + + if (F_status_is_error_not(status)) { + statess->size = length; + + if (statess->used > statess->size) { + statess->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_statess_decrease_by_) || !defined(_di_f_type_statess_increase_) || !defined(_di_f_type_statess_increase_by_) || !defined(_di_f_type_statess_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/private-state.h b/level_0/f_type_array/c/type_array/private-state.h new file mode 100644 index 0000000..ab93ce5 --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-state.h @@ -0,0 +1,150 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_type_array_state_h +#define _PRIVATE_F_type_array_state_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing the states array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param states + * The states array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_states_adjust() + * @see f_type_states_decimate_by() + */ +#if !defined(_di_f_type_states_adjust_) || !defined(_di_f_type_states_decimate_by_) + extern f_status_t private_f_type_states_adjust(const f_array_length_t length, f_states_t *states) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_states_adjust_) || !defined(_di_f_type_states_decimate_by_) + +/** + * Private implementation for appending the state array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source states to append. + * @param destination + * The destination states the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_states_append() + * @see f_type_statess_append() + */ +#if !defined(_di_f_type_states_append_) || !defined(_di_f_type_statess_append_) + extern f_status_t private_f_type_states_append(const f_states_t source, f_states_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_states_append_) || !defined(_di_f_type_statess_append_) + +/** + * Private implementation for resizing the states array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param states + * The states array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_states_resize() + * @see f_type_states_append() + * @see f_type_states_decimate_by() + * @see f_type_statess_append() + */ +#if !defined(_di_f_type_states_resize_) || !defined(_di_f_type_states_append_) || !defined(_di_f_type_states_decimate_by_) || !defined(_di_f_type_statess_append_) + extern f_status_t private_f_type_states_resize(const f_array_length_t length, f_states_t *states) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_states_resize_) || !defined(_di_f_type_states_append_) || !defined(_di_f_type_states_decimate_by_) || !defined(_di_f_type_statess_append_) + +/** + * Private implementation for resizing the statess array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param statess + * The statess array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_statess_adjust() + * @see f_type_statess_decimate_by() + */ +#if !defined(_di_f_type_statess_adjust_) || !defined(_di_f_type_statess_decimate_by_) + extern f_status_t private_f_type_statess_adjust(const f_array_length_t length, f_statess_t *statess) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_statess_adjust_) || !defined(_di_f_type_statess_decimate_by_) + +/** + * Private implementation for resizing the statess array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param statess + * The statess array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_statess_decrease_by() + * @see f_type_statess_increase() + * @see f_type_statess_increase_by() + * @see f_type_statess_resize() + */ +#if !defined(_di_f_type_statess_decrease_by_) || !defined(_di_f_type_statess_increase_) || !defined(_di_f_type_statess_increase_by_) || !defined(_di_f_type_statess_resize_) + extern f_status_t private_f_type_statess_resize(const f_array_length_t length, f_statess_t *statess) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_statess_decrease_by_) || !defined(_di_f_type_statess_increase_) || !defined(_di_f_type_statess_increase_by_) || !defined(_di_f_type_statess_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_type_array_state_h diff --git a/level_0/f_type_array/c/type_array/private-status.c b/level_0/f_type_array/c/type_array/private-status.c new file mode 100644 index 0000000..1f5fdd8 --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-status.c @@ -0,0 +1,118 @@ +#include "../type_array.h" +#include "private-status.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_f_type_statuss_adjust_) || !defined(_di_f_type_statuss_decimate_by_) + f_status_t private_f_type_statuss_adjust(const f_array_length_t length, f_statuss_t *statuss) { + + const f_status_t status = f_memory_adjust(statuss->size, length, sizeof(f_status_t), (void **) & statuss->array); + + if (F_status_is_error_not(status)) { + statuss->size = length; + + if (statuss->used > statuss->size) { + statuss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_statuss_adjust_) || !defined(_di_f_type_statuss_decimate_by_) + +#if !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statusss_append_) + extern f_status_t private_f_type_statuss_append(const f_statuss_t source, f_statuss_t *destination) { + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_statuss_adjust(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + destination->array[destination->used] = source.array[i]; + } // for + + return F_none; + } +#endif // !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statusss_append_) + +#if !defined(_di_f_type_statuss_resize_) || !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statuss_decimate_by_) || !defined(_di_f_type_statusss_append_) + f_status_t private_f_type_statuss_resize(const f_array_length_t length, f_statuss_t *statuss) { + + const f_status_t status = f_memory_resize(statuss->size, length, sizeof(f_status_t), (void **) & statuss->array); + + if (F_status_is_error_not(status)) { + statuss->size = length; + + if (statuss->used > statuss->size) { + statuss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_statuss_resize_) || !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statuss_decimate_by_) || !defined(_di_f_type_statusss_append_) + +#if !defined(_di_f_type_statusss_adjust_) || !defined(_di_f_type_statusss_decimate_by_) + f_status_t private_f_type_statusss_adjust(const f_array_length_t length, f_statusss_t *statusss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < statusss->size; ++i) { + + status = f_memory_destroy(statusss->array[i].size, sizeof(f_statuss_t), (void **) & statusss->array[i].array); + if (F_status_is_error(status)) return status; + + statusss->array[i].size = 0; + statusss->array[i].used = 0; + } // for + + status = f_memory_adjust(statusss->size, length, sizeof(f_statuss_t), (void **) & statusss->array); + + if (F_status_is_error_not(status)) { + statusss->size = length; + + if (statusss->used > statusss->size) { + statusss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_statusss_adjust_) || !defined(_di_f_type_statusss_decimate_by_) + +#if !defined(_di_f_type_statusss_decrease_by_) || !defined(_di_f_type_statusss_increase_) || !defined(_di_f_type_statusss_increase_by_) || !defined(_di_f_type_statusss_resize_) + f_status_t private_f_type_statusss_resize(const f_array_length_t length, f_statusss_t *statusss) { + + f_status_t status = F_none; + + for (f_array_length_t i = length; i < statusss->size; ++i) { + + status = f_memory_delete(statusss->array[i].size, sizeof(f_statuss_t), (void **) & statusss->array[i].array); + if (F_status_is_error(status)) return status; + + statusss->array[i].size = 0; + statusss->array[i].used = 0; + } // for + + status = f_memory_resize(statusss->size, length, sizeof(f_statuss_t), (void **) & statusss->array); + + if (F_status_is_error_not(status)) { + statusss->size = length; + + if (statusss->used > statusss->size) { + statusss->used = length; + } + } + + return status; + } +#endif // !defined(_di_f_type_statusss_decrease_by_) || !defined(_di_f_type_statusss_increase_) || !defined(_di_f_type_statusss_increase_by_) || !defined(_di_f_type_statusss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/private-status.h b/level_0/f_type_array/c/type_array/private-status.h new file mode 100644 index 0000000..54c0aed --- /dev/null +++ b/level_0/f_type_array/c/type_array/private-status.h @@ -0,0 +1,150 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_F_type_array_status_h +#define _PRIVATE_F_type_array_status_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation for resizing the statuss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param statuss + * The statuss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_type_statuss_adjust() + * @see f_type_statuss_decimate_by() + */ +#if !defined(_di_f_type_statuss_adjust_) || !defined(_di_f_type_statuss_decimate_by_) + extern f_status_t private_f_type_statuss_adjust(const f_array_length_t length, f_statuss_t *statuss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_statuss_adjust_) || !defined(_di_f_type_statuss_decimate_by_) + +/** + * Private implementation for appending the status array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source statuss to append. + * @param destination + * The destination statuss the source is appended onto. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_statuss_append() + * @see f_type_statusss_append() + */ +#if !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statusss_append_) + extern f_status_t private_f_type_statuss_append(const f_statuss_t source, f_statuss_t *destination) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statusss_append_) + +/** + * Private implementation for resizing the statuss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param statuss + * The statuss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_statuss_resize() + * @see f_type_statuss_append() + * @see f_type_statuss_decimate_by() + * @see f_type_statusss_append() + */ +#if !defined(_di_f_type_statuss_resize_) || !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statuss_decimate_by_) || !defined(_di_f_type_statusss_append_) + extern f_status_t private_f_type_statuss_resize(const f_array_length_t length, f_statuss_t *statuss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_statuss_resize_) || !defined(_di_f_type_statuss_append_) || !defined(_di_f_type_statuss_decimate_by_) || !defined(_di_f_type_statusss_append_) + +/** + * Private implementation for resizing the statusss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to adjust to. + * @param statusss + * The statusss array to adjust. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + * + * @see f_type_statusss_adjust() + * @see f_type_statusss_decimate_by() + */ +#if !defined(_di_f_type_statusss_adjust_) || !defined(_di_f_type_statusss_decimate_by_) + extern f_status_t private_f_type_statusss_adjust(const f_array_length_t length, f_statusss_t *statusss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_statusss_adjust_) || !defined(_di_f_type_statusss_decimate_by_) + +/** + * Private implementation for resizing the statusss array. + * + * Intended to be shared to each of the different implementation variations. + * + * @param length + * The length to resize to. + * @param statusss + * The statusss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if new length is larger than max array length. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + * + * @see f_type_statusss_decrease_by() + * @see f_type_statusss_increase() + * @see f_type_statusss_increase_by() + * @see f_type_statusss_resize() + */ +#if !defined(_di_f_type_statusss_decrease_by_) || !defined(_di_f_type_statusss_increase_) || !defined(_di_f_type_statusss_increase_by_) || !defined(_di_f_type_statusss_resize_) + extern f_status_t private_f_type_statusss_resize(const f_array_length_t length, f_statusss_t *statusss) F_attribute_visibility_internal_d; +#endif // !defined(_di_f_type_statusss_decrease_by_) || !defined(_di_f_type_statusss_increase_) || !defined(_di_f_type_statusss_increase_by_) || !defined(_di_f_type_statusss_resize_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_type_array_status_h diff --git a/level_0/f_type_array/c/type_array/state.c b/level_0/f_type_array/c/type_array/state.c new file mode 100644 index 0000000..e388949 --- /dev/null +++ b/level_0/f_type_array/c/type_array/state.c @@ -0,0 +1,235 @@ +#include "../type_array.h" +#include "state.h" +#include "private-state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_type_states_adjust_ + f_status_t f_type_states_adjust(const f_array_length_t length, f_states_t *states) { + #ifndef _di_level_0_parameter_checking_ + if (!states) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_states_adjust(length, states); + } +#endif // _di_f_type_states_adjust_ + +#ifndef _di_f_type_states_append_ + f_status_t f_type_states_append(const f_states_t source, f_states_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_states_append(source, destination); + } +#endif // _di_f_type_states_append_ + +#ifndef _di_f_type_states_decimate_by_ + f_status_t f_type_states_decimate_by(const f_array_length_t amount, f_states_t *states) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!states) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (states->size - amount > 0) { + return private_f_type_states_adjust(states->size - amount, states); + } + + return private_f_type_states_adjust(0, states); + } +#endif // _di_f_type_states_decimate_by_ + +#ifndef _di_f_type_states_decrease_by_ + f_status_t f_type_states_decrease_by(const f_array_length_t amount, f_states_t *states) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!states) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (states->size - amount > 0) { + return private_f_type_states_resize(states->size - amount, states); + } + + return private_f_type_states_resize(0, states); + } +#endif // _di_f_type_states_decrease_by_ + +#ifndef _di_f_type_states_increase_ + f_status_t f_type_states_increase(const uint16_t step, f_states_t *states) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!states) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (states->used + 1 > states->size) { + f_array_length_t size = states->used + step; + + if (size > F_array_length_t_size_d) { + if (states->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_states_resize(size, states); + } + + return F_data_not; + } +#endif // _di_f_type_states_increase_ + +#ifndef _di_f_type_states_increase_by_ + f_status_t f_type_states_increase_by(const f_array_length_t amount, f_states_t *states) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!states) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (states->used + amount > states->size) { + if (states->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_states_resize(states->used + amount, states); + } + + return F_data_not; + } +#endif // _di_f_type_states_increase_by_ + +#ifndef _di_f_type_states_resize_ + f_status_t f_type_states_resize(const f_array_length_t length, f_states_t *states) { + #ifndef _di_level_0_parameter_checking_ + if (!states) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_states_resize(length, states); + } +#endif // _di_f_type_states_resize_ + +#ifndef _di_f_type_statess_adjust_ + f_status_t f_type_statess_adjust(const f_array_length_t length, f_statess_t *statess) { + #ifndef _di_level_0_parameter_checking_ + if (!statess) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_statess_adjust(length, statess); + } +#endif // _di_f_type_statess_adjust_ + +#ifndef _di_f_type_statess_append_ + f_status_t f_type_statess_append(const f_statess_t source, f_statess_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_statess_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_states_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_statess_append_ + +#ifndef _di_f_type_statess_decimate_by_ + f_status_t f_type_statess_decimate_by(const f_array_length_t amount, f_statess_t *statess) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!statess) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statess->size - amount > 0) { + return private_f_type_statess_adjust(statess->size - amount, statess); + } + + return private_f_type_statess_adjust(0, statess); + } +#endif // _di_f_type_statess_decimate_by_ + +#ifndef _di_f_type_statess_decrease_by_ + f_status_t f_type_statess_decrease_by(const f_array_length_t amount, f_statess_t *statess) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!statess) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statess->size - amount > 0) { + return private_f_type_statess_resize(statess->size - amount, statess); + } + + return private_f_type_statess_resize(0, statess); + } +#endif // _di_f_type_statess_decrease_by_ + +#ifndef _di_f_type_statess_increase_ + f_status_t f_type_statess_increase(const uint16_t step, f_statess_t *statess) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!statess) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statess->used + 1 > statess->size) { + f_array_length_t size = statess->used + step; + + if (size > F_array_length_t_size_d) { + if (statess->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_statess_resize(size, statess); + } + + return F_data_not; + } +#endif // _di_f_type_statess_increase_ + +#ifndef _di_f_type_statess_increase_by_ + f_status_t f_type_statess_increase_by(const f_array_length_t amount, f_statess_t *statess) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!statess) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statess->used + amount > statess->size) { + if (statess->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_statess_resize(statess->used + amount, statess); + } + + return F_data_not; + } +#endif // _di_f_type_statess_increase_by_ + +#ifndef _di_f_type_statess_resize_ + f_status_t f_type_statess_resize(const f_array_length_t length, f_statess_t *statess) { + #ifndef _di_level_0_parameter_checking_ + if (!statess) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_statess_resize(length, statess); + } +#endif // _di_f_type_statess_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/state.h b/level_0/f_type_array/c/type_array/state.h new file mode 100644 index 0000000..fd489bb --- /dev/null +++ b/level_0/f_type_array/c/type_array/state.h @@ -0,0 +1,355 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines data to be used for/by type (array) related functionality. + * + * This is auto-included by type_array.h and should not need to be explicitly included. + */ +#ifndef _F_type_array_state_h +#define _F_type_array_state_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the string states array. + * + * @param length + * The new size to use. + * @param states + * The string states array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_states_adjust_ + extern f_status_t f_type_states_adjust(const f_array_length_t length, f_states_t *states); +#endif // _di_f_type_states_adjust_ + +/** + * Append the source states onto the destination. + * + * @param source + * The source states to append. + * @param destination + * The destination states the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_states_append_ + extern f_status_t f_type_states_append(const f_states_t source, f_states_t *destination); +#endif // _di_f_type_states_append_ + +/** + * Resize the string states 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param states + * The string states array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_states_decimate_by_ + extern f_status_t f_type_states_decimate_by(const f_array_length_t amount, f_states_t *states); +#endif // _di_f_type_states_decimate_by_ + +/** + * Resize the string states 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param states + * The string states array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_states_decrease_by_ + extern f_status_t f_type_states_decrease_by(const f_array_length_t amount, f_states_t *states); +#endif // _di_f_type_states_decrease_by_ + +/** + * Increase the size of the string states array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param states + * The string states array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_states_increase_ + extern f_status_t f_type_states_increase(const uint16_t step, f_states_t *states); +#endif // _di_f_type_states_increase_ + +/** + * Resize the string states 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param states + * The string states array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_states_increase_by_ + extern f_status_t f_type_states_increase_by(const f_array_length_t amount, f_states_t *states); +#endif // _di_f_type_states_increase_by_ + +/** + * Resize the string states array. + * + * @param length + * The new size to use. + * @param states + * The string states array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_states_resize_ + extern f_status_t f_type_states_resize(const f_array_length_t length, f_states_t *states); +#endif // _di_f_type_states_resize_ + +/** + * Resize the string statess array. + * + * @param length + * The new size to use. + * @param statess + * The string statess array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_statess_adjust_ + extern f_status_t f_type_statess_adjust(const f_array_length_t length, f_statess_t *statess); +#endif // _di_f_type_statess_adjust_ + +/** + * Append the source statess onto the destination. + * + * @param source + * The source statess to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statess_append_ + extern f_status_t f_type_statess_append(const f_statess_t source, f_statess_t *destination); +#endif // _di_f_type_statess_append_ + +/** + * Resize the string statess array. + * + * @param length + * The new size to use. + * @param statess + * The string statess array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_statess_adjust_ + extern f_status_t f_type_statess_adjust(const f_array_length_t length, f_statess_t *statess); +#endif // _di_f_type_statess_adjust_ + +/** + * Resize the string statess 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 statess + * The string statess array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_statess_decimate_by_ + extern f_status_t f_type_statess_decimate_by(const f_array_length_t amount, f_statess_t *statess); +#endif // _di_f_type_statess_decimate_by_ + +/** + * Resize the string statess 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 statess + * The string statess array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statess_decrease_by_ + extern f_status_t f_type_statess_decrease_by(const f_array_length_t amount, f_statess_t *statess); +#endif // _di_f_type_statess_decrease_by_ + +/** + * Increase the size of the string statess 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param statess + * The string statess array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statess_increase_ + extern f_status_t f_type_statess_increase(const uint16_t step, f_statess_t *statess); +#endif // _di_f_type_statess_increase_ + +/** + * Resize the string statess 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param statess + * The string statess array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statess_increase_by_ + extern f_status_t f_type_statess_increase_by(const f_array_length_t amount, f_statess_t *statess); +#endif // _di_f_type_statess_increase_by_ + +/** + * Resize the string statess array. + * + * @param length + * The new size to use. + * @param statess + * The string statess array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statess_resize_ + extern f_status_t f_type_statess_resize(const f_array_length_t length, f_statess_t *statess); +#endif // _di_f_type_statess_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_array_state_h diff --git a/level_0/f_type_array/c/type_array/status.c b/level_0/f_type_array/c/type_array/status.c new file mode 100644 index 0000000..ce1f34d --- /dev/null +++ b/level_0/f_type_array/c/type_array/status.c @@ -0,0 +1,235 @@ +#include "../type_array.h" +#include "status.h" +#include "private-status.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_type_statuss_adjust_ + f_status_t f_type_statuss_adjust(const f_array_length_t length, f_statuss_t *statuss) { + #ifndef _di_level_0_parameter_checking_ + if (!statuss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_statuss_adjust(length, statuss); + } +#endif // _di_f_type_statuss_adjust_ + +#ifndef _di_f_type_statuss_append_ + f_status_t f_type_statuss_append(const f_statuss_t source, f_statuss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + return private_f_type_statuss_append(source, destination); + } +#endif // _di_f_type_statuss_append_ + +#ifndef _di_f_type_statuss_decimate_by_ + f_status_t f_type_statuss_decimate_by(const f_array_length_t amount, f_statuss_t *statuss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!statuss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statuss->size - amount > 0) { + return private_f_type_statuss_adjust(statuss->size - amount, statuss); + } + + return private_f_type_statuss_adjust(0, statuss); + } +#endif // _di_f_type_statuss_decimate_by_ + +#ifndef _di_f_type_statuss_decrease_by_ + f_status_t f_type_statuss_decrease_by(const f_array_length_t amount, f_statuss_t *statuss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!statuss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statuss->size - amount > 0) { + return private_f_type_statuss_resize(statuss->size - amount, statuss); + } + + return private_f_type_statuss_resize(0, statuss); + } +#endif // _di_f_type_statuss_decrease_by_ + +#ifndef _di_f_type_statuss_increase_ + f_status_t f_type_statuss_increase(const uint16_t step, f_statuss_t *statuss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!statuss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statuss->used + 1 > statuss->size) { + f_array_length_t size = statuss->used + step; + + if (size > F_array_length_t_size_d) { + if (statuss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_statuss_resize(size, statuss); + } + + return F_data_not; + } +#endif // _di_f_type_statuss_increase_ + +#ifndef _di_f_type_statuss_increase_by_ + f_status_t f_type_statuss_increase_by(const f_array_length_t amount, f_statuss_t *statuss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!statuss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statuss->used + amount > statuss->size) { + if (statuss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_statuss_resize(statuss->used + amount, statuss); + } + + return F_data_not; + } +#endif // _di_f_type_statuss_increase_by_ + +#ifndef _di_f_type_statuss_resize_ + f_status_t f_type_statuss_resize(const f_array_length_t length, f_statuss_t *statuss) { + #ifndef _di_level_0_parameter_checking_ + if (!statuss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_statuss_resize(length, statuss); + } +#endif // _di_f_type_statuss_resize_ + +#ifndef _di_f_type_statusss_adjust_ + f_status_t f_type_statusss_adjust(const f_array_length_t length, f_statusss_t *statusss) { + #ifndef _di_level_0_parameter_checking_ + if (!statusss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_statusss_adjust(length, statusss); + } +#endif // _di_f_type_statusss_adjust_ + +#ifndef _di_f_type_statusss_append_ + f_status_t f_type_statusss_append(const f_statusss_t source, f_statusss_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not; + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_type_statusss_resize(destination->used + source.used, destination); + if (F_status_is_error(status)) return status; + } + + for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) { + status = private_f_type_statuss_append(source.array[i], &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } // for + + return F_none; + } +#endif // _di_f_type_statusss_append_ + +#ifndef _di_f_type_statusss_decimate_by_ + f_status_t f_type_statusss_decimate_by(const f_array_length_t amount, f_statusss_t *statusss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!statusss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statusss->size - amount > 0) { + return private_f_type_statusss_adjust(statusss->size - amount, statusss); + } + + return private_f_type_statusss_adjust(0, statusss); + } +#endif // _di_f_type_statusss_decimate_by_ + +#ifndef _di_f_type_statusss_decrease_by_ + f_status_t f_type_statusss_decrease_by(const f_array_length_t amount, f_statusss_t *statusss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!statusss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statusss->size - amount > 0) { + return private_f_type_statusss_resize(statusss->size - amount, statusss); + } + + return private_f_type_statusss_resize(0, statusss); + } +#endif // _di_f_type_statusss_decrease_by_ + +#ifndef _di_f_type_statusss_increase_ + f_status_t f_type_statusss_increase(const uint16_t step, f_statusss_t *statusss) { + #ifndef _di_level_0_parameter_checking_ + if (!step) return F_status_set_error(F_parameter); + if (!statusss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statusss->used + 1 > statusss->size) { + f_array_length_t size = statusss->used + step; + + if (size > F_array_length_t_size_d) { + if (statusss->used + 1 > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + size = F_array_length_t_size_d; + } + + return private_f_type_statusss_resize(size, statusss); + } + + return F_data_not; + } +#endif // _di_f_type_statusss_increase_ + +#ifndef _di_f_type_statusss_increase_by_ + f_status_t f_type_statusss_increase_by(const f_array_length_t amount, f_statusss_t *statusss) { + #ifndef _di_level_0_parameter_checking_ + if (!amount) return F_status_set_error(F_parameter); + if (!statusss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (statusss->used + amount > statusss->size) { + if (statusss->used + amount > F_array_length_t_size_d) { + return F_status_set_error(F_array_too_large); + } + + return private_f_type_statusss_resize(statusss->used + amount, statusss); + } + + return F_data_not; + } +#endif // _di_f_type_statusss_increase_by_ + +#ifndef _di_f_type_statusss_resize_ + f_status_t f_type_statusss_resize(const f_array_length_t length, f_statusss_t *statusss) { + #ifndef _di_level_0_parameter_checking_ + if (!statusss) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return private_f_type_statusss_resize(length, statusss); + } +#endif // _di_f_type_statusss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/status.h b/level_0/f_type_array/c/type_array/status.h new file mode 100644 index 0000000..f99b86f --- /dev/null +++ b/level_0/f_type_array/c/type_array/status.h @@ -0,0 +1,355 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines data to be used for/by type (array) related functionality. + * + * This is auto-included by type_array.h and should not need to be explicitly included. + */ +#ifndef _F_type_array_status_h +#define _F_type_array_status_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the string statuss array. + * + * @param length + * The new size to use. + * @param statuss + * The string statuss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_statuss_adjust_ + extern f_status_t f_type_statuss_adjust(const f_array_length_t length, f_statuss_t *statuss); +#endif // _di_f_type_statuss_adjust_ + +/** + * Append the source statuss onto the destination. + * + * @param source + * The source statuss to append. + * @param destination + * The destination statuss the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statuss_append_ + extern f_status_t f_type_statuss_append(const f_statuss_t source, f_statuss_t *destination); +#endif // _di_f_type_statuss_append_ + +/** + * Resize the string statuss 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 les than 0. + * + * @param amount + * A positive number representing how much to decimate the size by. + * @param statuss + * The string statuss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + */ +#ifndef _di_f_type_statuss_decimate_by_ + extern f_status_t f_type_statuss_decimate_by(const f_array_length_t amount, f_statuss_t *statuss); +#endif // _di_f_type_statuss_decimate_by_ + +/** + * Resize the string statuss 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 les than 0. + * + * @param amount + * A positive number representing how much to decrease the size by. + * @param statuss + * The string statuss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statuss_decrease_by_ + extern f_status_t f_type_statuss_decrease_by(const f_array_length_t amount, f_statuss_t *statuss); +#endif // _di_f_type_statuss_decrease_by_ + +/** + * Increase the size of the string statuss array, but only if necesary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param statuss + * The string statuss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statuss_increase_ + extern f_status_t f_type_statuss_increase(const uint16_t step, f_statuss_t *statuss); +#endif // _di_f_type_statuss_increase_ + +/** + * Resize the string statuss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param statuss + * The string statuss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statuss_increase_by_ + extern f_status_t f_type_statuss_increase_by(const f_array_length_t amount, f_statuss_t *statuss); +#endif // _di_f_type_statuss_increase_by_ + +/** + * Resize the string statuss array. + * + * @param length + * The new size to use. + * @param statuss + * The string statuss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statuss_resize_ + extern f_status_t f_type_statuss_resize(const f_array_length_t length, f_statuss_t *statuss); +#endif // _di_f_type_statuss_resize_ + +/** + * Resize the string statusss array. + * + * @param length + * The new size to use. + * @param statusss + * The string statusss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_statusss_adjust_ + extern f_status_t f_type_statusss_adjust(const f_array_length_t length, f_statusss_t *statusss); +#endif // _di_f_type_statusss_adjust_ + +/** + * Append the source statusss onto the destination. + * + * @param source + * The source statusss to append. + * @param destination + * The destination ranges the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statusss_append_ + extern f_status_t f_type_statusss_append(const f_statusss_t source, f_statusss_t *destination); +#endif // _di_f_type_statusss_append_ + +/** + * Resize the string statusss array. + * + * @param length + * The new size to use. + * @param statusss + * The string statusss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_statusss_adjust_ + extern f_status_t f_type_statusss_adjust(const f_array_length_t length, f_statusss_t *statusss); +#endif // _di_f_type_statusss_adjust_ + +/** + * Resize the string statusss 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 statusss + * The string statusss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_destroy(). + */ +#ifndef _di_f_type_statusss_decimate_by_ + extern f_status_t f_type_statusss_decimate_by(const f_array_length_t amount, f_statusss_t *statusss); +#endif // _di_f_type_statusss_decimate_by_ + +/** + * Resize the string statusss 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 statusss + * The string statusss array to resize. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statusss_decrease_by_ + extern f_status_t f_type_statusss_decrease_by(const f_array_length_t amount, f_statusss_t *statusss); +#endif // _di_f_type_statusss_decrease_by_ + +/** + * Increase the size of the string statusss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param step + * The allocation step to use. + * Must be greater than 0. + * @param statusss + * The string statusss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + 1 <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statusss_increase_ + extern f_status_t f_type_statusss_increase(const uint16_t step, f_statusss_t *statusss); +#endif // _di_f_type_statusss_increase_ + +/** + * Resize the string statusss 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_d). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. + * @param statusss + * The string statusss array to resize. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statusss_increase_by_ + extern f_status_t f_type_statusss_increase_by(const f_array_length_t amount, f_statusss_t *statusss); +#endif // _di_f_type_statusss_increase_by_ + +/** + * Resize the string statusss array. + * + * @param length + * The new size to use. + * @param statusss + * The string statusss array to adjust. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_delete(). + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_type_statusss_resize_ + extern f_status_t f_type_statusss_resize(const f_array_length_t length, f_statusss_t *statusss); +#endif // _di_f_type_statusss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_array_status_h diff --git a/level_0/f_type_array/data/build/settings b/level_0/f_type_array/data/build/settings index ff821d5..1378a2b 100644 --- a/level_0/f_type_array/data/build/settings +++ b/level_0/f_type_array/data/build/settings @@ -30,7 +30,8 @@ build_objects_library_static build_objects_program build_objects_program_shared build_objects_program_static -build_sources_library type_array.c private-type_array.c +build_sources_library type_array/array_length.c type_array/cell.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/state.c type_array/status.c +build_sources_library type_array/private-array_length.c type_array/private-cell.c type_array/private-fll_id.c type_array/private-int8.c type_array/private-int16.c type_array/private-int32.c type_array/private-int64.c type_array/private-int128.c type_array/private-state.c type_array/private-status.c build_sources_library_shared build_sources_library_static build_sources_object @@ -40,6 +41,7 @@ build_sources_program build_sources_program_shared build_sources_program_static build_sources_headers type_array.h type_array-common.h +build_sources_headers type_array/array_length.h type_array/cell.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/state.h type_array/status.h build_sources_headers_shared build_sources_headers_static build_sources_script @@ -62,7 +64,7 @@ path_sources path_sources_object has_path_standard yes -preserve_path_headers no +preserve_path_headers yes search_exclusive yes search_shared yes