From 383c541194799f77fab7d3282600e81b6834f0a5 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 14 Mar 2021 12:20:21 -0500 Subject: [PATCH] Update: add "eoa", add append functions, relocate f_string_dynamic*, and update comments, "eoa" or "End of Array" is being experimentally added as a compliment of "eos" or "End of String". Remove stale status code from before I fully embraced error and warning bits. Add more append functions. Make existing functions more consistent, checking for array overflows, returning F_array_too_large when appropriate. Update the comments while I am at it. Relocate the f_string_dynamic_* functions in string.h and string.c to string-dynamic.h and string-dynamic.c, respectively. This requires that the string_dynamic.h header depend on string_range.h --- level_0/f_status/c/status.h | 8 + level_0/f_string/c/private-string.c | 103 ++++- level_0/f_string/c/private-string.h | 128 +++--- level_0/f_string/c/string.c | 685 ----------------------------- level_0/f_string/c/string.h | 793 +++------------------------------ level_0/f_string/c/string_dynamic.c | 697 +++++++++++++++++++++++++++++ level_0/f_string/c/string_dynamic.h | 820 ++++++++++++++++++++++++++++++++++- level_0/f_string/c/string_map.c | 68 +++ level_0/f_string/c/string_map.h | 106 +++-- level_0/f_string/c/string_quantity.c | 25 ++ level_0/f_string/c/string_quantity.h | 62 ++- level_0/f_string/c/string_range.c | 25 ++ level_0/f_string/c/string_range.h | 57 ++- level_0/f_string/c/string_triple.c | 41 ++ level_0/f_string/c/string_triple.h | 38 +- level_0/f_type_array/c/type_array.c | 48 ++ level_0/f_type_array/c/type_array.h | 227 ++-------- level_1/fl_status/c/status.c | 24 + level_1/fl_status/c/status.h | 16 + level_2/fll_fss/c/fss_status.c | 77 ---- level_2/fll_fss/c/fss_status.h | 42 -- level_2/fll_status/c/status.c | 40 ++ 22 files changed, 2280 insertions(+), 1850 deletions(-) diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index 23ae3af..79cb98d 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -183,6 +183,8 @@ extern "C" { F_empty_not, F_encoding, F_encoding_not, + F_eoa, + F_eoa_not, F_eof, F_eof_not, F_eol, @@ -364,11 +366,13 @@ extern "C" { F_buffer_too_small, F_complete_not_utf, F_complete_not_utf_block, + F_complete_not_utf_eoa, F_complete_not_utf_eof, F_complete_not_utf_eol, F_complete_not_utf_eos, F_complete_not_utf_stop, F_none_block, + F_none_eoa, F_none_eof, F_none_eol, F_none_eos, @@ -376,6 +380,7 @@ extern "C" { F_data, F_data_not, F_data_not_block, + F_data_not_eoa, F_data_not_eof, F_data_not_eol, F_data_not_eos, @@ -383,17 +388,20 @@ extern "C" { F_terminated, F_terminated_not, F_terminated_not_block, + F_terminated_not_eoa, F_terminated_not_eof, F_terminated_not_eol, F_terminated_not_eos, F_terminated_not_group, F_terminated_not_group_block, + F_terminated_not_group_eoa, F_terminated_not_group_eof, F_terminated_not_group_eol, F_terminated_not_group_eos, F_terminated_not_group_stop, F_terminated_not_nest, F_terminated_not_nest_block, + F_terminated_not_nest_eoa, F_terminated_not_nest_eof, F_terminated_not_nest_eol, F_terminated_not_nest_eos, diff --git a/level_0/f_string/c/private-string.c b/level_0/f_string/c/private-string.c index 27333b6..1ebfe7d 100644 --- a/level_0/f_string/c/private-string.c +++ b/level_0/f_string/c/private-string.c @@ -5,7 +5,7 @@ extern "C" { #endif -#if !defined(_di_f_string_append_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_mash_) +#if !defined(_di_f_string_append_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_mash_) || !defined(f_string_map_multis_append) || !defined(f_string_maps_append) f_status_t private_f_string_append(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { if (destination->used + length > destination->size) { @@ -18,7 +18,7 @@ extern "C" { return F_none; } -#endif // !defined(_di_f_string_append_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_mash_) +#endif // !defined(_di_f_string_append_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_mash_) || !defined(f_string_map_multis_append) || !defined(f_string_maps_append) #if !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_mash_nulless_) f_status_t private_f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { @@ -123,6 +123,11 @@ extern "C" { #if !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_decimate_by_) f_status_t private_f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t *dynamics) { + + if (dynamics->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < dynamics->size; ++i) { @@ -144,8 +149,36 @@ extern "C" { } #endif // !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_decimate_by_) +#if !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) + f_status_t private_f_string_dynamics_append(const f_string_dynamics_t source, f_string_dynamics_t *destination) { + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_string_dynamics_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].used = 0; + + if (source.array[i].used) { + status = private_f_string_append(source.array[i].string, source.array[i].used, &destination->array[destination->used]); + if (F_status_is_error(status)) return status; + } + } // for + + return F_none; + } +#endif // !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) + #if !defined(_di_f_string_dynamics_decrease_by_) || !defined(_di_f_string_dynamics_increase_) || !defined(_di_f_string_dynamics_increase_by_) f_status_t private_f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t *dynamics) { + + if (dynamics->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < dynamics->size; ++i) { @@ -169,6 +202,11 @@ extern "C" { #if !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_decimate_by_) f_status_t private_f_string_map_multis_adjust(const f_array_length_t length, f_string_map_multis_t *map_multis) { + + if (map_multis->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < map_multis->size; ++i) { @@ -196,6 +234,11 @@ extern "C" { #if !defined(_di_f_string_map_multis_decrease_by_) || !defined(_di_f_string_map_multis_increase_) || !defined(_di_f_string_map_multis_increase_by_) || !defined(_di_f_string_map_multis_terminate_) || !defined(_di_f_string_map_multis_terminate_after_) f_status_t private_f_string_map_multis_resize(const f_array_length_t length, f_string_map_multis_t *map_multis) { + + if (map_multis->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < map_multis->size; ++i) { @@ -223,6 +266,11 @@ extern "C" { #if !defined(_di_f_string_maps_adjust_) || !defined(_di_f_string_maps_decimate_by_) f_status_t private_f_string_maps_adjust(const f_array_length_t length, f_string_maps_t *maps) { + + if (maps->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < maps->size; ++i) { @@ -250,6 +298,11 @@ extern "C" { #if !defined(_di_f_string_maps_decrease_by_) || !defined(_di_f_string_maps_increase_) || !defined(_di_f_string_maps_increase_by_) || !defined(_di_f_string_maps_terminate_) || !defined(_di_f_string_maps_terminate_after_) f_status_t private_f_string_maps_resize(const f_array_length_t length, f_string_maps_t *maps) { + + if (maps->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < maps->size; ++i) { @@ -369,6 +422,10 @@ extern "C" { #if !defined(_di_f_string_quantitys_adjust_) || !defined(_di_f_string_quantitys_decimate_by_) f_status_t private_f_string_quantitys_adjust(const f_array_length_t length, f_string_quantitys_t *quantitys) { + if (quantitys->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + const f_status_t status = f_memory_adjust(quantitys->size, length, sizeof(f_string_quantity_t), (void **) & quantitys->array); if (F_status_is_error_not(status)) { @@ -386,6 +443,10 @@ extern "C" { #if !defined(_di_f_string_quantitys_decrease_) || !defined(_di_f_string_quantitys_decrease_by_) || !defined(_di_f_string_quantitys_increase_) || !defined(_di_f_string_quantitys_increase_by_) || !defined(_di_f_string_quantitys_terminate_) || !defined(_di_f_string_quantitys_terminate_after_) f_status_t private_f_string_quantitys_resize(const f_array_length_t length, f_string_quantitys_t *quantitys) { + if (quantitys->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + const f_status_t status = f_memory_resize(quantitys->size, length, sizeof(f_string_quantity_t), (void **) & quantitys->array); if (F_status_is_error_not(status)) { @@ -402,6 +463,11 @@ extern "C" { #if !defined(_di_f_string_quantityss_adjust_) || !defined(_di_f_string_quantityss_decimate_by_) f_status_t private_f_string_quantityss_adjust(const f_array_length_t length, f_string_quantityss_t *quantityss) { + + if (quantityss->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < quantityss->size; ++i) { @@ -425,6 +491,11 @@ extern "C" { #if !defined(_di_f_string_quantityss_decrease_) || !defined(_di_f_string_quantityss_decrease_by_) || !defined(_di_f_string_quantityss_increase_) || !defined(_di_f_string_quantityss_increase_by_) || !defined(_di_f_string_quantityss_terminate_) || !defined(_di_f_string_quantityss_terminate_after_) f_status_t private_f_string_quantityss_resize(const f_array_length_t length, f_string_quantityss_t *quantityss) { + + if (quantityss->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < quantityss->size; ++i) { @@ -449,6 +520,10 @@ extern "C" { #if !defined(_di_f_string_ranges_adjust_) || !defined(_di_f_string_ranges_decimate_by_) f_status_t private_f_string_ranges_adjust(const f_array_length_t length, f_string_ranges_t *ranges) { + if (ranges->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + const f_status_t status = f_memory_adjust(ranges->size, length, sizeof(f_string_range_t), (void **) & ranges->array); if (F_status_is_error_not(status)) { @@ -466,6 +541,10 @@ extern "C" { #if !defined(_di_f_string_ranges_decrease_) || !defined(_di_f_string_ranges_decrease_by_) || !defined(_di_f_string_ranges_increase_) || !defined(_di_f_string_ranges_increase_by_) || !defined(_di_f_string_ranges_terminate_) || !defined(_di_f_string_ranges_terminate_after_) f_status_t private_f_string_ranges_resize(const f_array_length_t length, f_string_ranges_t *ranges) { + if (ranges->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + const f_status_t status = f_memory_resize(ranges->size, length, sizeof(f_string_range_t), (void **) & ranges->array); if (F_status_is_error_not(status)) { @@ -482,6 +561,11 @@ extern "C" { #if !defined(_di_f_string_rangess_adjust_) || !defined(_di_f_string_rangess_decimate_by_) f_status_t private_f_string_rangess_adjust(const f_array_length_t length, f_string_rangess_t *rangess) { + + if (rangess->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < rangess->size; ++i) { @@ -505,6 +589,11 @@ extern "C" { #if !defined(_di_f_string_rangess_decrease_) || !defined(_di_f_string_rangess_decrease_by_) || !defined(_di_f_string_rangess_increase_) || !defined(_di_f_string_rangess_increase_by_) || !defined(_di_f_string_rangess_terminate_) || !defined(_di_f_string_rangess_terminate_after_) f_status_t private_f_string_rangess_resize(const f_array_length_t length, f_string_rangess_t *rangess) { + + if (rangess->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < rangess->size; ++i) { @@ -528,6 +617,11 @@ extern "C" { #if !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_) f_status_t private_f_string_triples_adjust(const f_array_length_t length, f_string_triples_t *triples) { + + if (triples->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < triples->size; ++i) { @@ -558,6 +652,11 @@ extern "C" { #if !defined(_di_f_string_triples_decrease_) || !defined(_di_f_string_triples_decrease_by_) || !defined(_di_f_string_triples_increase_) || !defined(_di_f_string_triples_increase_by_) || !defined(_di_f_string_triples_terminate_) || !defined(_di_f_string_triples_terminate_after_) f_status_t private_f_string_triples_resize(const f_array_length_t length, f_string_triples_t *triples) { + + if (triples->used + length > f_array_length_t_size) { + return F_status_set_error(F_array_too_large); + } + f_status_t status = F_none; for (f_array_length_t i = length; i < triples->size; ++i) { diff --git a/level_0/f_string/c/private-string.h b/level_0/f_string/c/private-string.h index 21549c7..cade35e 100644 --- a/level_0/f_string/c/private-string.h +++ b/level_0/f_string/c/private-string.h @@ -29,28 +29,23 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. * - * @return - * F_none on success. + * F_string_too_large (with error bit) if the combined string is too large. * - * Errors (with error bit) from: private_f_string_dynamic_increase_by(). + * Errors (with error bit) from: f_memory_resize(). * * @see memcpy() * * @see f_string_append() * @see f_string_dynamic_append() * @see f_string_dynamic_mash() + * @see f_string_map_multis_append() + * @see f_string_maps_append() * @see f_string_mash() - * - * @see private_f_string_dynamic_increase_by() */ -#if !defined(_di_f_string_append_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_mash_) +#if !defined(_di_f_string_append_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_mash_) || !defined(f_string_map_multis_append) || !defined(f_string_maps_append) extern f_status_t private_f_string_append(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) f_gcc_attribute_visibility_internal; -#endif // !defined(_di_f_string_append_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_mash_) +#endif // !defined(_di_f_string_append_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_mash_) || !defined(f_string_map_multis_append) || !defined(f_string_maps_append) /** * Private implementation of f_string_append_nulless(). @@ -67,7 +62,7 @@ extern "C" { * @return * F_none on success. * - * Errors (with error bit) from: private_f_string_dynamic_increase_by(). + * F_string_too_large (with error bit) if the combined string is too large. * * @see memcpy() * @@ -76,8 +71,6 @@ extern "C" { * @see f_string_dynamic_append_nulless() * @see f_string_dynamic_mash_nulless() * @see f_string_mash_nulless() - * - * @see private_f_string_dynamic_increase_by() */ #if !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_mash_nulless_) extern f_status_t private_f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) f_gcc_attribute_visibility_internal; @@ -119,9 +112,10 @@ extern "C" { * @return * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * * F_string_too_large (with error bit) if the combined string is too large. * - * Errors (with error bit) from: private_f_string_dynamic_resize(). + * Errors (with error bit) from: f_memory_resize(). * * @see memcpy() * @@ -182,20 +176,43 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_adjust() * @see f_string_dynamics_adjust() * @see f_string_dynamics_decimate_by() - * - * @see private_f_string_dynamic_adjust() */ #if !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_decimate_by_) extern f_status_t private_f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t *strings) f_gcc_attribute_visibility_internal; #endif // !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_decimate_by_) /** + * Private implementation for appending. + * + * Intended to be shared to each of the different implementation variations. + * + * @param source + * The source strings to append. + * @param destination + * The destination strings the source is appended onto. + * + * @return + * F_none on success. + * + * F_array_too_large (with error bit) if the combined array is too large. + * + * Errors (with error bit) from: f_memory_adjust(). + * + * @see f_string_dynamics_append() + * @see f_string_map_multis_append() + */ +#if !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) + extern f_status_t private_f_string_dynamics_append(const f_string_dynamics_t source, f_string_dynamics_t *destination) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) + +/** * Private implementation for resizing. * * Intended to be shared to each of the different implementation variations. @@ -208,15 +225,14 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: private_f_string_dynamic_resize(). * * @see f_memory_resize() * @see f_string_dynamics_decrease_by() * @see f_string_dynamics_increase() * @see f_string_dynamics_increase_by() - * - * @see private_f_string_dynamic_resize() */ #if !defined(_di_f_string_dynamics_decrease_by_) || !defined(_di_f_string_dynamics_increase_) || !defined(_di_f_string_dynamics_increase_by_) extern f_status_t private_f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t *strings) f_gcc_attribute_visibility_internal; @@ -235,13 +251,12 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_adjust() * @see f_string_map_multis_adjust() - * - * @see private_f_string_dynamic_adjust() */ #if !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_decimate_by_) extern f_status_t private_f_string_map_multis_adjust(const f_array_length_t length, f_string_map_multis_t *map_multis) f_gcc_attribute_visibility_internal; @@ -260,8 +275,9 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: private_f_string_dynamic_resize(). * * @see f_memory_adjust() * @see f_string_map_multis_decrease_by() @@ -269,8 +285,6 @@ extern "C" { * @see f_string_map_multis_increase_by() * @see f_string_map_multis_terminate() * @see f_string_map_multis_terminate_after() - * - * @see private_f_string_dynamic_resize() */ #if !defined(_di_f_string_map_multis_decrease_by_) || !defined(_di_f_string_map_multis_increase_) || !defined(_di_f_string_map_multis_increase_by_) || !defined(_di_f_string_map_multis_terminate_) || !defined(_di_f_string_map_multis_terminate_after_) extern f_status_t private_f_string_map_multis_resize(const f_array_length_t length, f_string_map_multis_t *map_multis) f_gcc_attribute_visibility_internal; @@ -289,13 +303,12 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_adjust() * @see f_string_maps_adjust() - * - * @see private_f_string_dynamic_adjust() */ #if !defined(_di_f_string_maps_adjust_) || !defined(_di_f_string_maps_decimate_by_) extern f_status_t private_f_string_maps_adjust(const f_array_length_t length, f_string_maps_t *maps) f_gcc_attribute_visibility_internal; @@ -314,8 +327,9 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: private_f_string_dynamic_resize(). * * @see f_memory_adjust() * @see f_string_maps_decrease_by() @@ -323,8 +337,6 @@ extern "C" { * @see f_string_maps_increase_by() * @see f_string_maps_terminate() * @see f_string_maps_terminate_after() - * - * @see private_f_string_dynamic_resize() */ #if !defined(_di_f_string_maps_decrease_by_) || !defined(_di_f_string_maps_increase_) || !defined(_di_f_string_maps_increase_by_) || !defined(_di_f_string_maps_terminate_) || !defined(_di_f_string_maps_terminate_after_) extern f_status_t private_f_string_maps_resize(const f_array_length_t length, f_string_maps_t *maps) f_gcc_attribute_visibility_internal; @@ -344,9 +356,10 @@ extern "C" { * * @return * F_none on success. + * * F_string_too_large (with error bit) if the combined string is too large. * - * Errors (with error bit) from: private_f_string_dynamic_increase_by(). + * Errors (with error bit) from: f_memory_resize(). * * @see memcopy() * @see memmove() @@ -360,8 +373,6 @@ extern "C" { * @see f_string_mish() * @see f_string_prepend_assure() * @see f_string_prepend() - * - * @see private_f_string_dynamic_increase_by() */ #if !defined(_di_f_string_dynamic_mish_) || !defined(_di_f_string_dynamic_partial_mish_) || !defined(_di_f_string_dynamic_partial_prepend_assure_) || !defined(_di_f_string_dynamic_partial_prepend_) || !defined(_di_f_string_dynamic_prepend_assure_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_mish_) || !defined(_di_f_string_prepend_assure_) || !defined(_di_f_string_prepend_) extern f_status_t private_f_string_prepend(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) f_gcc_attribute_visibility_internal; @@ -381,9 +392,10 @@ extern "C" { * * @return * F_none on success. + * * F_string_too_large (with error bit) if the combined string is too large. * - * Errors (with error bit) from: private_f_string_dynamic_increase_by(). + * Errors (with error bit) from: f_memory_resize(). * * @see memcopy() * @see memmove() @@ -397,8 +409,6 @@ extern "C" { * @see f_string_mish_nulless() * @see f_string_prepend_assure_nulless() * @see f_string_prepend_nulless() - * - * @see private_f_string_dynamic_increase_by() */ #if !defined(_di_f_string_dynamic_mish_nulless_) || !defined(_di_f_string_dynamic_partial_mish_nulless_) || !defined(_di_f_string_dynamic_partial_prepend_assure_nulless_) || !defined(_di_f_string_dynamic_partial_prepend_nulless_) || !defined(_di_f_string_dynamic_prepend_assure_nulless_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_mish_nulless_) || !defined(_di_f_string_prepend_assure_nulless_) || !defined(_di_f_string_prepend_nulless_) extern f_status_t private_f_string_prepend_nulless(const f_string_t source, f_array_length_t length, f_string_dynamic_t *destination) f_gcc_attribute_visibility_internal; @@ -417,13 +427,13 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_adjust() * @see f_string_quantitys_adjust() * @see f_string_quantitys_decimate_by() - * @see private_f_string_dynamic_adjust() */ #if !defined(_di_f_string_quantitys_adjust_) || !defined(_di_f_string_quantitys_decimate_by_) extern f_status_t private_f_string_quantitys_adjust(const f_array_length_t length, f_string_quantitys_t *quantitys) f_gcc_attribute_visibility_internal; @@ -442,8 +452,9 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_resize() * @see f_string_quantitys_decrease_by() @@ -451,7 +462,6 @@ extern "C" { * @see f_string_quantitys_increase_by() * @see f_string_quantitys_terminate() * @see f_string_quantitys_terminate_after() - * @see private_f_string_dynamic_resize() */ #if !defined(_di_f_string_quantitys_decrease_by_) || !defined(_di_f_string_quantitys_increase_) || !defined(_di_f_string_quantitys_increase_by_) || !defined(_di_f_string_quantitys_terminate_) || !defined(_di_f_string_quantitys_terminate_after_) extern f_status_t private_f_string_quantitys_resize(const f_array_length_t length, f_string_quantitys_t *quantitys) f_gcc_attribute_visibility_internal; @@ -470,13 +480,13 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_adjust() * @see f_string_quantityss_adjust() * @see f_string_quantityss_decimate_by() - * @see private_f_string_dynamic_adjust() */ #if !defined(_di_f_string_quantityss_adjust_) || !defined(_di_f_string_quantityss_decimate_by_) extern f_status_t private_f_string_quantityss_adjust(const f_array_length_t length, f_string_quantityss_t *quantityss) f_gcc_attribute_visibility_internal; @@ -495,8 +505,9 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_resize() * @see f_string_quantityss_decrease_by() @@ -504,7 +515,6 @@ extern "C" { * @see f_string_quantityss_increase_by() * @see f_string_quantityss_terminate() * @see f_string_quantityss_terminate_after() - * @see private_f_string_dynamic_resize() */ #if !defined(_di_f_string_quantityss_decrease_by_) || !defined(_di_f_string_quantityss_increase_) || !defined(_di_f_string_quantityss_increase_by_) || !defined(_di_f_string_quantityss_terminate_) || !defined(_di_f_string_quantityss_terminate_after_) extern f_status_t private_f_string_quantityss_resize(const f_array_length_t length, f_string_quantityss_t *quantityss) f_gcc_attribute_visibility_internal; @@ -523,13 +533,13 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_adjust() * @see f_string_ranges_adjust() * @see f_string_ranges_decimate_by() - * @see private_f_string_dynamic_adjust() */ #if !defined(_di_f_string_ranges_adjust_) || !defined(_di_f_string_ranges_decimate_by_) extern f_status_t private_f_string_ranges_adjust(const f_array_length_t length, f_string_ranges_t *ranges) f_gcc_attribute_visibility_internal; @@ -548,8 +558,9 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_resize() * @see f_string_ranges_decrease_by() @@ -557,7 +568,6 @@ extern "C" { * @see f_string_ranges_increase_by() * @see f_string_ranges_terminate() * @see f_string_ranges_terminate_after() - * @see private_f_string_dynamic_resize() */ #if !defined(_di_f_string_ranges_decrease_by_) || !defined(_di_f_string_ranges_increase_) || !defined(_di_f_string_ranges_increase_by_) || !defined(_di_f_string_ranges_terminate_) || !defined(_di_f_string_ranges_terminate_after_) extern f_status_t private_f_string_ranges_resize(const f_array_length_t length, f_string_ranges_t *ranges) f_gcc_attribute_visibility_internal; @@ -576,13 +586,13 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_adjust() * @see f_string_rangess_adjust() * @see f_string_rangess_decimate_by() - * @see private_f_string_dynamic_adjust() */ #if !defined(_di_f_string_rangess_adjust_) || !defined(_di_f_string_rangess_decimate_by_) extern f_status_t private_f_string_rangess_adjust(const f_array_length_t length, f_string_rangess_t *rangess) f_gcc_attribute_visibility_internal; @@ -601,8 +611,9 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_resize() * @see f_string_rangess_decrease_by() @@ -610,7 +621,6 @@ extern "C" { * @see f_string_rangess_increase_by() * @see f_string_rangess_terminate() * @see f_string_rangess_terminate_after() - * @see private_f_string_dynamic_resize() */ #if !defined(_di_f_string_rangess_decrease_by_) || !defined(_di_f_string_rangess_increase_) || !defined(_di_f_string_rangess_increase_by_) || !defined(_di_f_string_rangess_terminate_) || !defined(_di_f_string_rangess_terminate_after_) extern f_status_t private_f_string_rangess_resize(const f_array_length_t length, f_string_rangess_t *rangess) f_gcc_attribute_visibility_internal; @@ -629,13 +639,13 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_adjust(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_adjust() * @see f_string_triples_adjust() * @see f_string_triples_decimate_by() - * @see private_f_string_dynamic_adjust() */ #if !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_) extern f_status_t private_f_string_triples_adjust(const f_array_length_t length, f_string_triples_t *triples) f_gcc_attribute_visibility_internal; @@ -654,8 +664,9 @@ extern "C" { * @return * F_none on success. * + * F_array_too_large (with error bit) if the combined array is too large. + * * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: private_f_string_dynamic_adjust(). * * @see f_memory_resize() * @see f_string_triples_decrease_by() @@ -663,7 +674,6 @@ extern "C" { * @see f_string_triples_increase_by() * @see f_string_triples_terminate() * @see f_string_triples_terminate_after() - * @see private_f_string_dynamic_resize() */ #if !defined(_di_f_string_triples_decrease_by_) || !defined(_di_f_string_triples_increase_) || !defined(_di_f_string_triples_increase_by_) || !defined(_di_f_string_triples_terminate_) || !defined(_di_f_string_triples_terminate_after_) extern f_status_t private_f_string_triples_resize(const f_array_length_t length, f_string_triples_t *triples) f_gcc_attribute_visibility_internal; diff --git a/level_0/f_string/c/string.c b/level_0/f_string/c/string.c index dc09cf7..5f10325 100644 --- a/level_0/f_string/c/string.c +++ b/level_0/f_string/c/string.c @@ -102,691 +102,6 @@ extern "C" { } #endif // _di_f_string_append_nulless_ -#ifndef _di_f_string_dynamic_append_ - f_status_t f_string_dynamic_append(const f_string_static_t source, f_string_dynamic_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_eos; - - return private_f_string_append(source.string, source.used, destination); - } -#endif // _di_f_string_dynamic_append_ - -#ifndef _di_f_string_dynamic_append_assure_ - f_status_t f_string_dynamic_append_assure(const f_string_static_t source, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - - if (destination->used < source.used) { - return private_f_string_append(source.string, source.used, destination); - } - - f_array_length_t i = 1; - f_array_length_t j = 1; - - while (i <= source.used && j <= destination->used) { - if (!source.string[source.used - i]) { - i++; - continue; - } - - if (!destination->string[destination->used - j]) { - j++; - continue; - } - - if (source.string[source.used - i] != destination->string[destination->used - j]) { - return private_f_string_append(source.string, source.used, destination); - } - - i++; - j++; - } // while - - return F_none; - } -#endif // _di_f_string_dynamic_append_assure_ - -#ifndef _di_f_string_dynamic_append_assure_nulless_ - f_status_t f_string_dynamic_append_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - - if (destination->used < source.used) { - return private_f_string_append_nulless(source.string, source.used, destination); - } - - f_array_length_t i = 1; - f_array_length_t j = 1; - - while (i <= source.used && j <= destination->used) { - if (!source.string[source.used - i]) { - i++; - continue; - } - - if (!destination->string[destination->used - j]) { - j++; - continue; - } - - if (source.string[source.used - i] != destination->string[destination->used - j]) { - return private_f_string_append_nulless(source.string, source.used, destination); - } - - i++; - j++; - } // while - - return F_none; - } -#endif // _di_f_string_dynamic_append_assure_nulless_ - -#ifndef _di_f_string_dynamic_append_nulless_ - f_status_t f_string_dynamic_append_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - - return private_f_string_append_nulless(source.string, source.used, destination); - } -#endif // _di_f_string_dynamic_append_nulless_ - -#ifndef _di_f_string_dynamic_mash_ - f_status_t f_string_dynamic_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_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_eos; - - if (glue_length && destination->used) { - const f_status_t status = private_f_string_append(glue, glue_length, destination); - if (F_status_is_error(status)) return status; - } - - return private_f_string_append(source.string, source.used, destination); - } -#endif // _di_f_string_dynamic_mash_ - -#ifndef _di_f_string_dynamic_mash_nulless_ - f_status_t f_string_dynamic_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_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_eos; - - if (glue_length && destination->used) { - const f_status_t status = private_f_string_append_nulless(glue, glue_length, destination); - if (F_status_is_error(status)) return status; - } - - return private_f_string_append_nulless(source.string, source.used, destination); - } -#endif // _di_f_string_dynamic_mash_nulless_ - -#ifndef _di_f_string_dynamic_mish_ - f_status_t f_string_dynamic_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_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_eos; - - if (glue_length && destination->used) { - const f_status_t status = private_f_string_prepend(glue, glue_length, destination); - if (F_status_is_error(status)) return status; - } - - return private_f_string_prepend(source.string, source.used, destination); - } -#endif // _di_f_string_dynamic_mish_ - -#ifndef _di_f_string_dynamic_mish_nulless_ - f_status_t f_string_dynamic_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_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_eos; - - if (glue_length && destination->used) { - const f_status_t status = private_f_string_prepend_nulless(glue, glue_length, destination); - if (F_status_is_error(status)) return status; - } - - return private_f_string_prepend_nulless(source.string, source.used, destination); - } -#endif // _di_f_string_dynamic_mish_nulless_ - -#ifndef _di_f_string_dynamic_partial_append_ - f_status_t f_string_dynamic_partial_append(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - return private_f_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); - } -#endif // _di_f_string_dynamic_partial_append_ - -#ifndef _di_f_string_dynamic_partial_append_assure_ - f_status_t f_string_dynamic_partial_append_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - const f_array_length_t length = (range.stop - range.start) + 1; - - if (destination->used < length) { - return private_f_string_append(source.string + range.start, length, destination); - } - - f_array_length_t i = 1; - f_array_length_t j = 1; - - while (i <= length && j <= destination->used) { - if (!source.string[range.stop - i]) { - i++; - continue; - } - - if (!destination->string[destination->used - j]) { - j++; - continue; - } - - if (source.string[range.stop - i] != destination->string[destination->used - j]) { - return private_f_string_append(source.string + range.start, length, destination); - } - - i++; - j++; - } // while - } -#endif // _di_f_string_dynamic_partial_append_assure_ - -#ifndef _di_f_string_dynamic_partial_append_assure_nulless_ - f_status_t f_string_dynamic_partial_append_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - const f_array_length_t length = (range.stop - range.start) + 1; - - if (destination->used < length) { - return private_f_string_append_nulless(source.string + range.start, length, destination); - } - - f_array_length_t i = 1; - f_array_length_t j = 1; - - while (i <= length && j <= destination->used) { - if (!source.string[range.stop - i]) { - i++; - continue; - } - - if (!destination->string[destination->used - j]) { - j++; - continue; - } - - if (source.string[range.stop - i] != destination->string[destination->used - j]) { - return private_f_string_append_nulless(source.string + range.start, length, destination); - } - - i++; - j++; - } // while - } -#endif // _di_f_string_dynamic_append_assure_nulless_ - -#ifndef _di_f_string_dynamic_partial_append_nulless_ - f_status_t f_string_dynamic_partial_append_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - return private_f_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); - } -#endif // _di_f_string_dynamic_partial_append_nulless_ - -#ifndef _di_f_string_dynamic_partial_mash_ - f_status_t f_string_dynamic_partial_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - if (glue_length && destination->used) { - f_status_t status = private_f_string_append(glue, glue_length, destination); - if (F_status_is_error(status)) return status; - } - - return private_f_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); - } -#endif // _di_f_string_dynamic_partial_mash_ - -#ifndef _di_f_string_dynamic_partial_mash_nulless_ - f_status_t f_string_dynamic_partial_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - if (glue_length && destination->used) { - f_status_t status = private_f_string_append_nulless(glue, glue_length, destination); - if (F_status_is_error(status)) return status; - } - - return private_f_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); - } -#endif // _di_f_string_dynamic_partial_mash_nulless_ - -#ifndef _di_f_string_dynamic_partial_mish_ - f_status_t f_string_partial_dynamic_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - if (glue_length && destination->used) { - f_status_t status = private_f_string_prepend(glue, glue_length, destination); - if (F_status_is_error(status)) return status; - } - - return private_f_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); - } -#endif // _di_f_string_dynamic_partial_mish_ - -#ifndef _di_f_string_dynamic_partial_mish_nulless_ - f_status_t f_string_dynamic_partial_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - if (glue_length && destination->used) { - f_status_t status = private_f_string_prepend_nulless(glue, glue_length, destination); - if (F_status_is_error(status)) return status; - } - - return private_f_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); - } -#endif // _di_f_string_dynamic_partial_mish_nulless_ - -#ifndef _di_f_string_dynamic_partial_prepend_ - f_status_t f_string_dynamic_partial_prepend(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - return private_f_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); - } -#endif // _di_f_string_dynamic_partial_prepend_ - -#ifndef _di_f_string_dynamic_partial_prepend_assure_ - f_status_t f_string_dynamic_partial_prepend_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - const f_array_length_t length = (range.stop - range.start) + 1; - - if (destination->used < length) { - return private_f_string_prepend(source.string + range.start, length, destination); - } - - f_array_length_t i = 0; - f_array_length_t j = 0; - - while (i < length && j < destination->used) { - if (!source.string[i + range.start]) { - i++; - continue; - } - - if (!destination->string[j]) { - j++; - continue; - } - - if (source.string[i + range.start] != destination->string[i]) { - return private_f_string_prepend(source.string + range.start, length, destination); - } - - i++; - j++; - } // while - - return F_none; - } -#endif // _di_f_string_dynamic_partial_prepend_assure_ - -#ifndef _di_f_string_dynamic_partial_prepend_assure_nulless_ - f_status_t f_string_dynamic_partial_prepend_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - const f_array_length_t length = (range.stop - range.start) + 1; - - if (destination->used < length) { - return private_f_string_prepend_nulless(source.string + range.start, length, destination); - } - - f_array_length_t i = 0; - f_array_length_t j = 0; - - while (i < length && j < destination->used) { - if (!source.string[i + range.start]) { - i++; - continue; - } - - if (!destination->string[j]) { - j++; - continue; - } - - if (source.string[i + range.start] != destination->string[i]) { - return private_f_string_prepend_nulless(source.string + range.start, length, destination); - } - - i++; - j++; - } // while - - return F_none; - } -#endif // _di_f_string_dynamic_partial_prepend_assure_nulless - -#ifndef _di_f_string_dynamic_partial_prepend_nulless_ - f_status_t f_string_dynamic_partial_prepend_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; - - return private_f_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); - } -#endif // _di_f_string_dynamic_partial_prepend_nulless - -#ifndef _di_f_string_dynamic_prepend_ - f_status_t f_string_dynamic_prepend(const f_string_static_t source, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - - return private_f_string_prepend(source.string, source.used, destination); - } -#endif // _di_f_string_dynamic_prepend_ - -#ifndef _di_f_string_dynamic_prepend_assure_ - f_status_t f_string_dynamic_prepend_assure(const f_string_static_t source, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - - if (destination->used < source.used) { - return private_f_string_prepend(source.string, source.used, destination); - } - - f_array_length_t i = 0; - f_array_length_t j = 0; - - while (i < source.used && j < destination->used) { - if (!source.string[i]) { - i++; - continue; - } - - if (!destination->string[j]) { - j++; - continue; - } - - if (source.string[i] != destination->string[i]) { - return private_f_string_prepend(source.string, source.used, destination); - } - - i++; - j++; - } // while - - return F_none; - } -#endif // _di_f_string_dynamic_prepend_assure_ - -#ifndef _di_f_string_dynamic_prepend_assure_nulless_ - f_status_t f_string_dynamic_prepend_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - - if (destination->used < source.used) { - return private_f_string_prepend_nulless(source.string, source.used, destination); - } - - f_array_length_t i = 0; - f_array_length_t j = 0; - - while (i < source.used && j < destination->used) { - if (!source.string[i]) { - i++; - continue; - } - - if (!destination->string[j]) { - j++; - continue; - } - - if (source.string[i] != destination->string[i]) { - return private_f_string_prepend_nulless(source.string, source.used, destination); - } - - i++; - j++; - } // while - - return F_none; - } -#endif // _di_f_string_dynamic_prepend_assure_nulless_ - -#ifndef _di_f_string_dynamic_prepend_nulless_ - f_status_t f_string_dynamic_prepend_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not_eos; - - return private_f_string_prepend_nulless(source.string, source.used, destination); - } -#endif // _di_f_string_dynamic_prepend_nulless_ - -#ifndef _di_f_string_dynamic_seek_line_ - f_status_t f_string_dynamic_seek_line(const f_string_t string, f_string_range_t *range) { - #ifndef _di_level_0_parameter_checking_ - if (!range) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!string) return F_data_not; - if (range->start > range->stop) return F_data_not_stop; - - while (string[range->start] != f_string_eol_s[0]) { - range->start++; - - if (range->start > range->stop) return F_none_stop; - } // while - - return F_none; - } -#endif // _di_f_string_dynamic_seek_line_ - -#ifndef _di_f_string_dynamic_seek_line_to_ - f_status_t f_string_dynamic_seek_line_to(const f_string_t string, const int8_t seek_to_this, f_string_range_t *range) { - #ifndef _di_level_0_parameter_checking_ - if (!range) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!string) return F_data_not; - if (range->start > range->stop) return F_data_not_stop; - - while (string[range->start] != seek_to_this) { - - if (string[range->start] == f_string_eol_s[0]) return F_none_eol; - - range->start++; - - if (range->start > range->stop) return F_none_stop; - } // while - - return F_none; - } -#endif // _di_f_string_dynamic_seek_line_to_ - -#ifndef _di_f_string_dynamic_seek_to_ - f_status_t f_string_dynamic_seek_to(const f_string_t string, const int8_t seek_to_this, f_string_range_t *range) { - #ifndef _di_level_0_parameter_checking_ - if (!range) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!string) return F_data_not; - if (range->start > range->stop) return F_data_not_stop; - - while (string[range->start] != seek_to_this) { - range->start++; - - if (range->start > range->stop) return F_none_stop; - } // while - - return F_none; - } -#endif // _di_f_string_dynamic_seek_to_ - -#ifndef _di_f_string_dynamic_terminate_ - f_status_t f_string_dynamic_terminate(f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - if (destination->used > destination->size) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!destination->used && destination->size && !destination->string[destination->used - 1]) { - return F_none; - } - - if (destination->used == f_array_length_t_size) { - return F_status_set_error(F_string_too_large); - } - - const f_array_length_t total = destination->used + 1; - - if (total > destination->size) { - const f_status_t status = private_f_string_dynamic_resize(total, destination); - if (F_status_is_error(status)) return status; - } - - destination->string[destination->used] = 0; - destination->used = total; - - return F_none; - } -#endif // _di_f_string_dynamic_terminate_ - -#ifndef _di_f_string_dynamic_terminate_after_ - f_status_t f_string_dynamic_terminate_after(f_string_dynamic_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - if (destination->used > destination->size) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (destination->used) { - for (; destination->used; destination->used--) { - if (!destination->string[destination->used - 1]) continue; - break; - } // for - } - - if (destination->used == f_array_length_t_size) { - return F_status_set_error(F_string_too_large); - } - - const f_array_length_t total = destination->used + 1; - - if (total > destination->size) { - const f_status_t status = private_f_string_dynamic_resize(total, destination); - if (F_status_is_error(status)) return status; - } - - destination->string[destination->used] = 0; - destination->used = total - 1; - - return F_none; - } -#endif // _di_f_string_dynamic_terminate_after_ - #ifndef _di_f_string_mash_ f_status_t f_string_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string.h b/level_0/f_string/c/string.h index ea7e8ef..76b8b5b 100644 --- a/level_0/f_string/c/string.h +++ b/level_0/f_string/c/string.h @@ -46,782 +46,91 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_append_ - extern f_status_t f_string_append(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); -#endif // _di_f_string_append_ - -/** - * Append the source string onto the destination, but only if the string is not already at the end. - * - * This ignores NULL characters when comparing both the source and the destination. - * - * @param source - * The source string to append. - * @param length - * The length of source to append. - * @param destination - * The destination string the source is appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_append_assure_ - extern f_status_t f_string_append_assure(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); -#endif // _di_f_string_append_assure_ - -/** - * Append the source string onto the destination, but only if the string is not already at the end. - * - * This ignores NULL characters when comparing both the source and the destination. - * Skips over NULL characters from source when appending. - * - * @param source - * The source string to append. - * @param length - * The length of source to append. - * @param destination - * The destination string the source is appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_append_assure_nulless_ - extern f_status_t f_string_append_assure_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); -#endif // _di_f_string_append_assure_nulless_ - -/** - * Append the source string onto the destination. - * - * Skips over NULL characters from source when appending. - * - * @param source - * The source string to append. - * @param length - * The length of source to append. - * @param destination - * The destination string the source is appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_append_nulless_ - extern f_status_t f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); -#endif // _di_f_string_append_nulless_ - -/** - * Append the source string onto the destination. - * - * @param source - * The source string to append. - * @param destination - * The destination string the source is appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_append_ - extern f_status_t f_string_dynamic_append(const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_append_ - -/** - * Append the source string onto the destination. - * - * @param source - * The source string to append. - * @param destination - * The destination string the source is appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_append_assure_ - extern f_status_t f_string_dynamic_append_assure(const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_append_assure_ - -/** - * Append the source string onto the destination. - * - * Skips over NULL characters from source when appending. - * - * @param source - * The source string to append. - * @param destination - * The destination string the source is appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_append_assure_nulless_ - extern f_status_t f_string_dynamic_append_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_append_assure_nulless_ - -/** - * Append the source string onto the destination. - * - * Skips over NULL characters from source when appending. - * - * @param source - * The source string to append. - * @param destination - * The destination string the source is appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_append_nulless_ - extern f_status_t f_string_dynamic_append_nulless(const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_append_nulless_ - -/** - * Append the source string onto the destination with the glue in between. - * - * If the destination string is empty, then no glue is appended. - * - * @param glue - * A string to append between the source and destination, such as a space: ' '. - * @param glue_length - * The number of bytes the glue takes up. - * @param source - * The source string to append. - * @param destination - * The destination string the source and glue are appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_mash_ - extern f_status_t f_string_dynamic_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_mash_ - -/** - * Append the source string onto the destination with the glue in between. - * - * If the destination string is empty, then no glue is appended. - * - * Skips over NULL characters from glue and source when appending. - * - * @param glue - * A string to append between the source and destination, such as a space: ' '. - * @param glue_length - * The number of bytes the glue takes up. - * @param source - * The source string to append. - * @param destination - * The destination string the source and glue are appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_mash_nulless_ - extern f_status_t f_string_dynamic_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_mash_nulless_ - -/** - * Prepend the source string onto the destination with the glue in between. - * - * If the destination string is empty, then no glue is appended. - * - * @param glue - * A string to append between the source and destination, such as a space: ' '. - * @param glue_length - * The number of bytes the glue takes up. - * @param source - * The source string to append. - * @param destination - * The destination string the source and glue are appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_mish_ - extern f_status_t f_string_dynamic_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_mish_ - -/** - * Prepend the source string onto the destination with the glue in between. - * - * If the destination string is empty, then no glue is appended. - * - * Skips over NULL characters from glue and source when appending. - * - * @param glue - * A string to append between the source and destination, such as a space: ' '. - * @param glue_length - * The number of bytes the glue takes up. - * @param source - * The source string to append. - * @param destination - * The destination string the source and glue are appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_mish_nulless_ - extern f_status_t f_string_dynamic_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_mish_nulless_ - -/** - * Append the source string onto the destination, but restricted to the given range. - * - * @param source - * The source string to append. - * @param range - * A range within the source to restrict the copy from. - * @param destination - * The destination string the source is appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_partial_append_ - extern f_status_t f_string_dynamic_partial_append(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_append_ - -/** - * Append the source string onto the destination, but only if the string is not already at the end and restricted to the given range - * - * This ignores NULL characters when comparing both the source and the destination. - * - * @param source - * The source string to append. - * @param range - * A range within the source to restrict the copy from. - * @param destination - * The destination string the source is appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_partial_append_assure_ - extern f_status_t f_string_dynamic_partial_append_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_append_assure_ - -/** - * Append the source string onto the destination, but only if the string is not already at the end and restricted to the given range - * - * This ignores NULL characters when comparing both the source and the destination. - * - * Skips over NULL characters from source when appending. - * - * @param source - * The source string to append. - * @param range - * A range within the source to restrict the copy from. - * @param destination - * The destination string the source is appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_partial_append_assure_nulless_ - extern f_status_t f_string_dynamic_partial_append_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_append_assure_nulless_ - -/** - * Append the source string onto the destination, but restricted to the given range. - * - * Skips over NULL characters from source when appending. - * - * @param source - * The source string to append. - * @param range - * A range within the source to restrict the copy from. - * @param destination - * The destination string the source is appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_partial_append_nulless_ - extern f_status_t f_string_dynamic_partial_append_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_append_nulless_ - -/** - * Append the source string onto the destination with the glue in between, but restricted to the given range. - * - * If the destination string is empty, then no glue is appended. - * - * @param glue - * A string to append between the source and destination, such as a space: ' '. - * @param glue_length - * The number of bytes the glue takes up. - * @param source - * The source string to append. - * @param range - * A range within the source to restrict the copy from. - * @param destination - * The destination string the source and glue are appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_partial_mash_ - extern f_status_t f_string_dynamic_partial_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_mash_ - -/** - * Append the source string onto the destination with the glue in between, but restricted to the given range. - * - * If the destination string is empty, then no glue is appended. - * - * Skips over NULL characters from glue and source when appending. - * - * @param glue - * A string to append between the source and destination, such as a space: ' '. - * @param glue_length - * The number of bytes the glue takes up. - * @param source - * The source string to append. - * @param range - * A range within the source to restrict the copy from. - * @param destination - * The destination string the source and glue are appended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_partial_mash_nulless_ - extern f_status_t f_string_dynamic_partial_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_mash_nulless_ - -/** - * Prepend the source string onto the destination with the glue in between, but restricted to the given range. - * - * If the destination string is empty, then no glue is appended. - * - * @param glue - * A string to append between the source and destination, such as a space: ' '. - * @param glue_length - * The number of bytes the glue takes up. - * @param source - * The source string to append. - * @param range - * A range within the source to restrict the copy from. - * @param destination - * The destination string the source and glue are appended onto. * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ -#ifndef _di_f_string_dynamic_partial_mish_ - extern f_status_t f_string_dynamic_partial_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_mish_ +#ifndef _di_f_string_append_ + extern f_status_t f_string_append(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); +#endif // _di_f_string_append_ /** - * Prepend the source string onto the destination with the glue in between, but restricted to the given range. - * - * If the destination string is empty, then no glue is appended. + * Append the source string onto the destination, but only if the string is not already at the end. * - * Skips over NULL characters from glue and source when appending. + * This ignores NULL characters when comparing both the source and the destination. * - * @param glue - * A string to append between the source and destination, such as a space: ' '. - * @param glue_length - * The number of bytes the glue takes up. * @param source * The source string to append. - * @param range - * A range within the source to restrict the copy from. + * @param length + * The length of source to append. * @param destination - * The destination string the source and glue are appended onto. + * The destination string the source is appended onto. * * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_partial_mish_nulless_ - extern f_status_t f_string_dynamic_partial_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_mish_nulless_ - -/** - * Prepend the source string onto the destination, but restricted to the given range. - * - * Prepend operations require memory move operations and are therefore likely more expensive than append operations. - * - * @param source - * The source string to prepend. - * @param range - * A range within the source to restrict the copy from. - * @param destination - * The destination string the source is prepended onto. * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_partial_prepend_ - extern f_status_t f_string_dynamic_partial_prepend(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_prepend_ - -/** - * Prepend the source string onto the destination, but only if the string is not already at the end and restricted to the given range - * - * Prepend operations require memory move operations and are therefore likely more expensive than append operations. - * - * This ignores NULL characters when comparing both the source and the destination. - * - * @param source - * The source string to prepend. - * @param range - * A range within the source to restrict the copy from. - * @param destination - * The destination string the source is prepended onto. * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. + * Errors (with error bit) from: f_memory_resize(). */ -#ifndef _di_f_string_dynamic_partial_prepend_assure_ - extern f_status_t f_string_dynamic_partial_prepend_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_prepend_assure_ +#ifndef _di_f_string_append_assure_ + extern f_status_t f_string_append_assure(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); +#endif // _di_f_string_append_assure_ /** - * Prepend the source string onto the destination, but only if the string is not already at the end and restricted to the given range - * - * Prepend operations require memory move operations and are therefore likely more expensive than append operations. + * Append the source string onto the destination, but only if the string is not already at the end. * * This ignores NULL characters when comparing both the source and the destination. + * Skips over NULL characters from source when appending. * * @param source - * The source string to prepend. - * @param range - * A range within the source to restrict the copy from. - * @param destination - * The destination string the source is prepended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_partial_prepend_assure_nulless_ - extern f_status_t f_string_dynamic_partial_prepend_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_prepend_assure_nulless_ - -/** - * Prepend the source string onto the destination, but restricted to the given range. - * - * Prepend operations require memory move operations and are therefore likely more expensive than append operations. - * - * @param source - * The source string to prepend. - * @param range - * A range within the source to restrict the copy from. + * The source string to append. + * @param length + * The length of source to append. * @param destination - * The destination string the source is prepended onto. + * The destination string the source is appended onto. * * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_partial_prepend_nulless_ - extern f_status_t f_string_dynamic_partial_prepend_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_partial_prepend_nulless_ - -/** - * Prepend the source string onto the destination. - * - * Prepend operations require memory move operations and are therefore likely more expensive than append operations. - * - * @param source - * The source string to prepend. - * @param destination - * The destination string the source is prepended onto. * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_prepend_ - extern f_status_t f_string_dynamic_prepend(const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_prepend_ - -/** - * Prepend the source string onto the destination, but only if the string is not already at the beginning. - * - * Prepend operations require memory move operations and are therefore likely more expensive than append operations. - * - * This ignores NULL characters when comparing both the source and the destination. - * - * @param source - * The source string to prepend. - * @param destination - * The destination string the source is prepended onto. * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. + * Errors (with error bit) from: f_memory_resize(). */ -#ifndef _di_f_string_dynamic_prepend_assure_ - extern f_status_t f_string_dynamic_prepend_assure(const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_prepend_assure_ +#ifndef _di_f_string_append_assure_nulless_ + extern f_status_t f_string_append_assure_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); +#endif // _di_f_string_append_assure_nulless_ /** - * Prepend the source string onto the destination, but only if the string is not already at the beginning. - * - * Prepend operations require memory move operations and are therefore likely more expensive than append operations. + * Append the source string onto the destination. * - * This ignores NULL characters when comparing both the source and the destination. + * Skips over NULL characters from source when appending. * * @param source - * The source string to prepend. + * The source string to append. + * @param length + * The length of source to append. * @param destination - * The destination string the source is prepended onto. + * The destination string the source is appended onto. * * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_prepend_assure_nulless_ - extern f_status_t f_string_dynamic_prepend_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_prepend_assure_nulless_ - -/** - * Prepend the source string onto the destination. - * - * Prepend operations require memory move operations and are therefore likely more expensive than append operations. * - * @param source - * The source string to prepend. - * @param destination - * The destination string the source is prepended onto. - * - * @return - * F_none on success. - * F_data_not_eos if source length is 0. - * F_data_not_stop if range.start > range.stop. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. - */ -#ifndef _di_f_string_dynamic_prepend_nulless_ - extern f_status_t f_string_dynamic_prepend_nulless(const f_string_static_t source, f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_prepend_nulless_ - -/** - * Seek the buffer location forward until EOL is reached. - * - * @param string - * The string to traverse. - * @param range - * A range within the buffer representing the start and stop locations. - * The start location will be incremented by seek. - * - * @return - * F_none on success. - * F_none_stop on success, but stopped at end of range. - * F_data_not on success, but there was no string data to seek. - * F_data_not_stop on success, but the range.start > range.stop. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_string_dynamic_seek_line_ - extern f_status_t f_string_dynamic_seek_line(const f_string_t string, f_string_range_t *range); -#endif // _di_f_string_dynamic_seek_line_ - -/** - * Seek the buffer location forward until the character (1-byte wide) or EOL is reached. - * - * @param string - * The string to traverse. - * @param seek_to_this - * A single-width character representing a character to seek to. - * @param range - * A range within the buffer representing the start and stop locations. - * The start location will be incremented by seek. * - * @return - * F_none on success. - * F_none_eol on success, but stopped at EOL. - * F_none_stop on success, but stopped at end of range. - * F_data_not on success, but there was no string data to seek. - * F_data_not_stop on success, but the range.start > range.stop. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_string_dynamic_seek_line_to_ - extern f_status_t f_string_dynamic_seek_line_to(const f_string_t string, const int8_t seek_to_this, f_string_range_t *range); -#endif // _di_f_string_dynamic_seek_line_to_ - -/** - * Seek the buffer location forward until the character (1-byte wide) is reached. - * - * @param string - * The string to traverse. - * @param seek_to_this - * A single-width character representing a character to seek to. - * @param range - * A range within the buffer representing the start and stop locations. - * The start location will be incremented by seek. - * - * @return - * F_none on success. - * F_none_stop on success, but stopped at end of range. - * F_data_not on success, but there was no string data to seek. - * F_data_not_stop on success, but the range.start > range.stop. - * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. - * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_string_dynamic_seek_to_ - extern f_status_t f_string_dynamic_seek_to(const f_string_t string, const int8_t seek_to_this, f_string_range_t *range); -#endif // _di_f_string_dynamic_seek_to_ - -/** - * Guarantee that an end of string (NULL) exists at the end of the string. - * - * This is intended to be used for anything requiring NULL terminated strings. - * This will reallocate more space if necessary. - * - * If destination size is 0, then it will be reallocated and have the NULL assigned at index 0. - * - * @param destination - * The new string, which will be allocated or reallocated as necessary. - * - * @return - * F_none on success. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if string is too large to fit into the buffer. - */ -#ifndef _di_f_string_dynamic_terminate_ - extern f_status_t f_string_dynamic_terminate(f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_terminate_ - -/** - * Guarantee that an end of string (NULL) exists at the end of the string. - * - * This ensures that the terminating NULL not only exists but is not counted in destination.used. - * - * This is intended to be used for anything requiring NULL terminated strings whose used length cannot be counted. - * This will reallocate more space if necessary. - * - * If destination size is 0, then it will be reallocated and have the NULL assigned at index 0. - * - * @param destination - * The new string, which will be allocated or reallocated as necessary. - * - * @return - * F_none on success. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if string is too large to fit into the buffer. + * Errors (with error bit) from: f_memory_resize(). */ -#ifndef _di_f_string_dynamic_terminate_after_ - extern f_status_t f_string_dynamic_terminate_after(f_string_dynamic_t *destination); -#endif // _di_f_string_dynamic_terminate_after_ +#ifndef _di_f_string_append_nulless_ + extern f_status_t f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); +#endif // _di_f_string_append_nulless_ /** * Append the source string onto the destination with the glue in between. @@ -842,9 +151,11 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_mash_ extern f_status_t f_string_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); @@ -871,9 +182,11 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_mash_nulless_ extern f_status_t f_string_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); @@ -898,9 +211,11 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_mish_ extern f_status_t f_string_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); @@ -927,9 +242,11 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_mish_nulless_ extern f_status_t f_string_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); @@ -950,9 +267,11 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_prepend_ extern f_status_t f_string_prepend(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); @@ -975,9 +294,11 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_prepend_assure_ extern f_status_t f_string_prepend_assure(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); @@ -1001,9 +322,11 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_prepend_assure_nulless_ extern f_status_t f_string_prepend_assure_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); @@ -1027,9 +350,11 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. - * F_memory_not (with error bit) on out of memory. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_prepend_nulless_ extern f_status_t f_string_prepend_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination); @@ -1051,6 +376,7 @@ extern "C" { * F_none_eol on success, but stopped at EOL. * F_none_stop on success, but stopped stop location. * F_data_not_stop if range.start > range.stop. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_string_seek_line_to_ @@ -1072,6 +398,7 @@ extern "C" { * F_none on success. * F_none_stop on success, but stopped stop location. * F_data_not_stop if range.start > range.stop. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_0/f_string/c/string_dynamic.c b/level_0/f_string/c/string_dynamic.c index d956528..d8799fa 100644 --- a/level_0/f_string/c/string_dynamic.c +++ b/level_0/f_string/c/string_dynamic.c @@ -19,6 +19,106 @@ extern "C" { } #endif // _di_f_string_dynamic_adjust_ +#ifndef _di_f_string_dynamic_append_ + f_status_t f_string_dynamic_append(const f_string_static_t source, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + + return private_f_string_append(source.string, source.used, destination); + } +#endif // _di_f_string_dynamic_append_ + +#ifndef _di_f_string_dynamic_append_assure_ + f_status_t f_string_dynamic_append_assure(const f_string_static_t source, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + + if (destination->used < source.used) { + return private_f_string_append(source.string, source.used, destination); + } + + f_array_length_t i = 1; + f_array_length_t j = 1; + + while (i <= source.used && j <= destination->used) { + if (!source.string[source.used - i]) { + i++; + continue; + } + + if (!destination->string[destination->used - j]) { + j++; + continue; + } + + if (source.string[source.used - i] != destination->string[destination->used - j]) { + return private_f_string_append(source.string, source.used, destination); + } + + i++; + j++; + } // while + + return F_none; + } +#endif // _di_f_string_dynamic_append_assure_ + +#ifndef _di_f_string_dynamic_append_assure_nulless_ + f_status_t f_string_dynamic_append_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + + if (destination->used < source.used) { + return private_f_string_append_nulless(source.string, source.used, destination); + } + + f_array_length_t i = 1; + f_array_length_t j = 1; + + while (i <= source.used && j <= destination->used) { + if (!source.string[source.used - i]) { + i++; + continue; + } + + if (!destination->string[destination->used - j]) { + j++; + continue; + } + + if (source.string[source.used - i] != destination->string[destination->used - j]) { + return private_f_string_append_nulless(source.string, source.used, destination); + } + + i++; + j++; + } // while + + return F_none; + } +#endif // _di_f_string_dynamic_append_assure_nulless_ + +#ifndef _di_f_string_dynamic_append_nulless_ + f_status_t f_string_dynamic_append_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + + return private_f_string_append_nulless(source.string, source.used, destination); + } +#endif // _di_f_string_dynamic_append_nulless_ + #ifndef _di_f_string_dynamic_decimate_by_ f_status_t f_string_dynamic_decimate_by(const f_array_length_t amount, f_string_dynamic_t *dynamic) { #ifndef _di_level_0_parameter_checking_ @@ -83,6 +183,470 @@ extern "C" { } #endif // _di_f_string_dynamic_increase_by_ +#ifndef _di_f_string_dynamic_mash_ + f_status_t f_string_dynamic_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_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_eos; + + if (glue_length && destination->used) { + const f_status_t status = private_f_string_append(glue, glue_length, destination); + if (F_status_is_error(status)) return status; + } + + return private_f_string_append(source.string, source.used, destination); + } +#endif // _di_f_string_dynamic_mash_ + +#ifndef _di_f_string_dynamic_mash_nulless_ + f_status_t f_string_dynamic_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_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_eos; + + if (glue_length && destination->used) { + const f_status_t status = private_f_string_append_nulless(glue, glue_length, destination); + if (F_status_is_error(status)) return status; + } + + return private_f_string_append_nulless(source.string, source.used, destination); + } +#endif // _di_f_string_dynamic_mash_nulless_ + +#ifndef _di_f_string_dynamic_mish_ + f_status_t f_string_dynamic_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_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_eos; + + if (glue_length && destination->used) { + const f_status_t status = private_f_string_prepend(glue, glue_length, destination); + if (F_status_is_error(status)) return status; + } + + return private_f_string_prepend(source.string, source.used, destination); + } +#endif // _di_f_string_dynamic_mish_ + +#ifndef _di_f_string_dynamic_mish_nulless_ + f_status_t f_string_dynamic_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_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_eos; + + if (glue_length && destination->used) { + const f_status_t status = private_f_string_prepend_nulless(glue, glue_length, destination); + if (F_status_is_error(status)) return status; + } + + return private_f_string_prepend_nulless(source.string, source.used, destination); + } +#endif // _di_f_string_dynamic_mish_nulless_ + +#ifndef _di_f_string_dynamic_partial_append_ + f_status_t f_string_dynamic_partial_append(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + return private_f_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); + } +#endif // _di_f_string_dynamic_partial_append_ + +#ifndef _di_f_string_dynamic_partial_append_assure_ + f_status_t f_string_dynamic_partial_append_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + const f_array_length_t length = (range.stop - range.start) + 1; + + if (destination->used < length) { + return private_f_string_append(source.string + range.start, length, destination); + } + + f_array_length_t i = 1; + f_array_length_t j = 1; + + while (i <= length && j <= destination->used) { + if (!source.string[range.stop - i]) { + i++; + continue; + } + + if (!destination->string[destination->used - j]) { + j++; + continue; + } + + if (source.string[range.stop - i] != destination->string[destination->used - j]) { + return private_f_string_append(source.string + range.start, length, destination); + } + + i++; + j++; + } // while + } +#endif // _di_f_string_dynamic_partial_append_assure_ + +#ifndef _di_f_string_dynamic_partial_append_assure_nulless_ + f_status_t f_string_dynamic_partial_append_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + const f_array_length_t length = (range.stop - range.start) + 1; + + if (destination->used < length) { + return private_f_string_append_nulless(source.string + range.start, length, destination); + } + + f_array_length_t i = 1; + f_array_length_t j = 1; + + while (i <= length && j <= destination->used) { + if (!source.string[range.stop - i]) { + i++; + continue; + } + + if (!destination->string[destination->used - j]) { + j++; + continue; + } + + if (source.string[range.stop - i] != destination->string[destination->used - j]) { + return private_f_string_append_nulless(source.string + range.start, length, destination); + } + + i++; + j++; + } // while + } +#endif // _di_f_string_dynamic_append_assure_nulless_ + +#ifndef _di_f_string_dynamic_partial_append_nulless_ + f_status_t f_string_dynamic_partial_append_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + return private_f_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); + } +#endif // _di_f_string_dynamic_partial_append_nulless_ + +#ifndef _di_f_string_dynamic_partial_mash_ + f_status_t f_string_dynamic_partial_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + if (glue_length && destination->used) { + f_status_t status = private_f_string_append(glue, glue_length, destination); + if (F_status_is_error(status)) return status; + } + + return private_f_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); + } +#endif // _di_f_string_dynamic_partial_mash_ + +#ifndef _di_f_string_dynamic_partial_mash_nulless_ + f_status_t f_string_dynamic_partial_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + if (glue_length && destination->used) { + f_status_t status = private_f_string_append_nulless(glue, glue_length, destination); + if (F_status_is_error(status)) return status; + } + + return private_f_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); + } +#endif // _di_f_string_dynamic_partial_mash_nulless_ + +#ifndef _di_f_string_dynamic_partial_mish_ + f_status_t f_string_partial_dynamic_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + if (glue_length && destination->used) { + f_status_t status = private_f_string_prepend(glue, glue_length, destination); + if (F_status_is_error(status)) return status; + } + + return private_f_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); + } +#endif // _di_f_string_dynamic_partial_mish_ + +#ifndef _di_f_string_dynamic_partial_mish_nulless_ + f_status_t f_string_dynamic_partial_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + if (glue_length && destination->used) { + f_status_t status = private_f_string_prepend_nulless(glue, glue_length, destination); + if (F_status_is_error(status)) return status; + } + + return private_f_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); + } +#endif // _di_f_string_dynamic_partial_mish_nulless_ + +#ifndef _di_f_string_dynamic_partial_prepend_ + f_status_t f_string_dynamic_partial_prepend(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + return private_f_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); + } +#endif // _di_f_string_dynamic_partial_prepend_ + +#ifndef _di_f_string_dynamic_partial_prepend_assure_ + f_status_t f_string_dynamic_partial_prepend_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + const f_array_length_t length = (range.stop - range.start) + 1; + + if (destination->used < length) { + return private_f_string_prepend(source.string + range.start, length, destination); + } + + f_array_length_t i = 0; + f_array_length_t j = 0; + + while (i < length && j < destination->used) { + if (!source.string[i + range.start]) { + i++; + continue; + } + + if (!destination->string[j]) { + j++; + continue; + } + + if (source.string[i + range.start] != destination->string[i]) { + return private_f_string_prepend(source.string + range.start, length, destination); + } + + i++; + j++; + } // while + + return F_none; + } +#endif // _di_f_string_dynamic_partial_prepend_assure_ + +#ifndef _di_f_string_dynamic_partial_prepend_assure_nulless_ + f_status_t f_string_dynamic_partial_prepend_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + const f_array_length_t length = (range.stop - range.start) + 1; + + if (destination->used < length) { + return private_f_string_prepend_nulless(source.string + range.start, length, destination); + } + + f_array_length_t i = 0; + f_array_length_t j = 0; + + while (i < length && j < destination->used) { + if (!source.string[i + range.start]) { + i++; + continue; + } + + if (!destination->string[j]) { + j++; + continue; + } + + if (source.string[i + range.start] != destination->string[i]) { + return private_f_string_prepend_nulless(source.string + range.start, length, destination); + } + + i++; + j++; + } // while + + return F_none; + } +#endif // _di_f_string_dynamic_partial_prepend_assure_nulless + +#ifndef _di_f_string_dynamic_partial_prepend_nulless_ + f_status_t f_string_dynamic_partial_prepend_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + return private_f_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); + } +#endif // _di_f_string_dynamic_partial_prepend_nulless + +#ifndef _di_f_string_dynamic_prepend_ + f_status_t f_string_dynamic_prepend(const f_string_static_t source, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + + return private_f_string_prepend(source.string, source.used, destination); + } +#endif // _di_f_string_dynamic_prepend_ + +#ifndef _di_f_string_dynamic_prepend_assure_ + f_status_t f_string_dynamic_prepend_assure(const f_string_static_t source, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + + if (destination->used < source.used) { + return private_f_string_prepend(source.string, source.used, destination); + } + + f_array_length_t i = 0; + f_array_length_t j = 0; + + while (i < source.used && j < destination->used) { + if (!source.string[i]) { + i++; + continue; + } + + if (!destination->string[j]) { + j++; + continue; + } + + if (source.string[i] != destination->string[i]) { + return private_f_string_prepend(source.string, source.used, destination); + } + + i++; + j++; + } // while + + return F_none; + } +#endif // _di_f_string_dynamic_prepend_assure_ + +#ifndef _di_f_string_dynamic_prepend_assure_nulless_ + f_status_t f_string_dynamic_prepend_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + + if (destination->used < source.used) { + return private_f_string_prepend_nulless(source.string, source.used, destination); + } + + f_array_length_t i = 0; + f_array_length_t j = 0; + + while (i < source.used && j < destination->used) { + if (!source.string[i]) { + i++; + continue; + } + + if (!destination->string[j]) { + j++; + continue; + } + + if (source.string[i] != destination->string[i]) { + return private_f_string_prepend_nulless(source.string, source.used, destination); + } + + i++; + j++; + } // while + + return F_none; + } +#endif // _di_f_string_dynamic_prepend_assure_nulless_ + +#ifndef _di_f_string_dynamic_prepend_nulless_ + f_status_t f_string_dynamic_prepend_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!source.used) return F_data_not_eos; + + return private_f_string_prepend_nulless(source.string, source.used, destination); + } +#endif // _di_f_string_dynamic_prepend_nulless_ + #ifndef _di_f_string_dynamic_resize_ f_status_t f_string_dynamic_resize(const f_array_length_t length, f_string_dynamic_t *dynamic) { #ifndef _di_level_0_parameter_checking_ @@ -93,6 +657,127 @@ extern "C" { } #endif // _di_f_string_dynamic_resize_ +#ifndef _di_f_string_dynamic_seek_line_ + f_status_t f_string_dynamic_seek_line(const f_string_t string, f_string_range_t *range) { + #ifndef _di_level_0_parameter_checking_ + if (!range) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!string) return F_data_not; + if (range->start > range->stop) return F_data_not_stop; + + while (string[range->start] != f_string_eol_s[0]) { + range->start++; + + if (range->start > range->stop) return F_none_stop; + } // while + + return F_none; + } +#endif // _di_f_string_dynamic_seek_line_ + +#ifndef _di_f_string_dynamic_seek_line_to_ + f_status_t f_string_dynamic_seek_line_to(const f_string_t string, const int8_t seek_to_this, f_string_range_t *range) { + #ifndef _di_level_0_parameter_checking_ + if (!range) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!string) return F_data_not; + if (range->start > range->stop) return F_data_not_stop; + + while (string[range->start] != seek_to_this) { + + if (string[range->start] == f_string_eol_s[0]) return F_none_eol; + + range->start++; + + if (range->start > range->stop) return F_none_stop; + } // while + + return F_none; + } +#endif // _di_f_string_dynamic_seek_line_to_ + +#ifndef _di_f_string_dynamic_seek_to_ + f_status_t f_string_dynamic_seek_to(const f_string_t string, const int8_t seek_to_this, f_string_range_t *range) { + #ifndef _di_level_0_parameter_checking_ + if (!range) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!string) return F_data_not; + if (range->start > range->stop) return F_data_not_stop; + + while (string[range->start] != seek_to_this) { + range->start++; + + if (range->start > range->stop) return F_none_stop; + } // while + + return F_none; + } +#endif // _di_f_string_dynamic_seek_to_ + +#ifndef _di_f_string_dynamic_terminate_ + f_status_t f_string_dynamic_terminate(f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + if (destination->used > destination->size) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!destination->used && destination->size && !destination->string[destination->used - 1]) { + return F_none; + } + + if (destination->used == f_array_length_t_size) { + return F_status_set_error(F_string_too_large); + } + + const f_array_length_t total = destination->used + 1; + + if (total > destination->size) { + const f_status_t status = private_f_string_dynamic_resize(total, destination); + if (F_status_is_error(status)) return status; + } + + destination->string[destination->used] = 0; + destination->used = total; + + return F_none; + } +#endif // _di_f_string_dynamic_terminate_ + +#ifndef _di_f_string_dynamic_terminate_after_ + f_status_t f_string_dynamic_terminate_after(f_string_dynamic_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + if (destination->used > destination->size) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (destination->used) { + for (; destination->used; destination->used--) { + if (!destination->string[destination->used - 1]) continue; + break; + } // for + } + + if (destination->used == f_array_length_t_size) { + return F_status_set_error(F_string_too_large); + } + + const f_array_length_t total = destination->used + 1; + + if (total > destination->size) { + const f_status_t status = private_f_string_dynamic_resize(total, destination); + if (F_status_is_error(status)) return status; + } + + destination->string[destination->used] = 0; + destination->used = total - 1; + + return F_none; + } +#endif // _di_f_string_dynamic_terminate_after_ + #ifndef _di_f_string_dynamics_adjust_ f_status_t f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t *dynamics) { #ifndef _di_level_0_parameter_checking_ @@ -103,6 +788,18 @@ extern "C" { } #endif // _di_f_string_dynamics_adjust_ +#ifndef _di_f_string_dynamics_append_ + f_status_t f_string_dynamics_append(const f_string_dynamics_t source, f_string_dynamics_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_string_dynamics_append(source, destination); + } +#endif // _di_f_string_dynamics_append_ + #ifndef _di_f_string_dynamics_decimate_by_ f_status_t f_string_dynamics_decimate_by(const f_array_length_t amount, f_string_dynamics_t *dynamics) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string_dynamic.h b/level_0/f_string/c/string_dynamic.h index dd56a51..2f4cb23 100644 --- a/level_0/f_string/c/string_dynamic.h +++ b/level_0/f_string/c/string_dynamic.h @@ -16,6 +16,9 @@ extern "C" { #endif +// fll-0 string includes +#include + /** * A string that is analogous to f_string_dynamic_t but intended for static-only uses. * @@ -148,6 +151,94 @@ extern "C" { #endif // _di_f_string_dynamic_adjust_ /** + * Append the source string onto the destination. + * + * @param source + * The source string to append. + * @param destination + * The destination string the source is appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_append_ + extern f_status_t f_string_dynamic_append(const f_string_dynamic_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_append_ + +/** + * Append the source string onto the destination. + * + * @param source + * The source string to append. + * @param destination + * The destination string the source is appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_append_assure_ + extern f_status_t f_string_dynamic_append_assure(const f_string_static_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_append_assure_ + +/** + * Append the source string onto the destination. + * + * Skips over NULL characters from source when appending. + * + * @param source + * The source string to append. + * @param destination + * The destination string the source is appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_append_assure_nulless_ + extern f_status_t f_string_dynamic_append_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_append_assure_nulless_ + +/** + * Append the source string onto the destination. + * + * Skips over NULL characters from source when appending. + * + * @param source + * The source string to append. + * @param destination + * The destination string the source is appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_append_nulless_ + extern f_status_t f_string_dynamic_append_nulless(const f_string_static_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_append_nulless_ + +/** * Resize the dynamic string to a smaller size. * * This will resize making the string smaller based on (size - given length). @@ -161,10 +252,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not on success, but there is no reason to decrease size (size = 0). * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_decrease_by_ extern f_status_t f_string_dynamic_decrease_by(const f_array_length_t amount, f_string_dynamic_t *dynamic); @@ -186,9 +278,10 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_increase_ extern f_status_t f_string_dynamic_increase(f_string_dynamic_t *dynamic); @@ -210,15 +303,564 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_increase_by_ extern f_status_t f_string_dynamic_increase_by(const f_array_length_t amount, f_string_dynamic_t *dynamic); #endif // _di_f_string_dynamic_increase_by_ /** + * Append the source string onto the destination with the glue in between. + * + * If the destination string is empty, then no glue is appended. + * + * @param glue + * A string to append between the source and destination, such as a space: ' '. + * @param glue_length + * The number of bytes the glue takes up. + * @param source + * The source string to append. + * @param destination + * The destination string the source and glue are appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_mash_ + extern f_status_t f_string_dynamic_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_mash_ + +/** + * Append the source string onto the destination with the glue in between. + * + * If the destination string is empty, then no glue is appended. + * + * Skips over NULL characters from glue and source when appending. + * + * @param glue + * A string to append between the source and destination, such as a space: ' '. + * @param glue_length + * The number of bytes the glue takes up. + * @param source + * The source string to append. + * @param destination + * The destination string the source and glue are appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_mash_nulless_ + extern f_status_t f_string_dynamic_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_mash_nulless_ + +/** + * Prepend the source string onto the destination with the glue in between. + * + * If the destination string is empty, then no glue is appended. + * + * @param glue + * A string to append between the source and destination, such as a space: ' '. + * @param glue_length + * The number of bytes the glue takes up. + * @param source + * The source string to append. + * @param destination + * The destination string the source and glue are appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_mish_ + extern f_status_t f_string_dynamic_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_mish_ + +/** + * Prepend the source string onto the destination with the glue in between. + * + * If the destination string is empty, then no glue is appended. + * + * Skips over NULL characters from glue and source when appending. + * + * @param glue + * A string to append between the source and destination, such as a space: ' '. + * @param glue_length + * The number of bytes the glue takes up. + * @param source + * The source string to append. + * @param destination + * The destination string the source and glue are appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_mish_nulless_ + extern f_status_t f_string_dynamic_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_mish_nulless_ + +/** + * Append the source string onto the destination, but restricted to the given range. + * + * @param source + * The source string to append. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source is appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_append_ + extern f_status_t f_string_dynamic_partial_append(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_append_ + +/** + * Append the source string onto the destination, but only if the string is not already at the end and restricted to the given range + * + * This ignores NULL characters when comparing both the source and the destination. + * + * @param source + * The source string to append. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source is appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_append_assure_ + extern f_status_t f_string_dynamic_partial_append_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_append_assure_ + +/** + * Append the source string onto the destination, but only if the string is not already at the end and restricted to the given range + * + * This ignores NULL characters when comparing both the source and the destination. + * + * Skips over NULL characters from source when appending. + * + * @param source + * The source string to append. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source is appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_append_assure_nulless_ + extern f_status_t f_string_dynamic_partial_append_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_append_assure_nulless_ + +/** + * Append the source string onto the destination, but restricted to the given range. + * + * Skips over NULL characters from source when appending. + * + * @param source + * The source string to append. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source is appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_append_nulless_ + extern f_status_t f_string_dynamic_partial_append_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_append_nulless_ + +/** + * Append the source string onto the destination with the glue in between, but restricted to the given range. + * + * If the destination string is empty, then no glue is appended. + * + * @param glue + * A string to append between the source and destination, such as a space: ' '. + * @param glue_length + * The number of bytes the glue takes up. + * @param source + * The source string to append. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source and glue are appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_mash_ + extern f_status_t f_string_dynamic_partial_mash(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_mash_ + +/** + * Append the source string onto the destination with the glue in between, but restricted to the given range. + * + * If the destination string is empty, then no glue is appended. + * + * Skips over NULL characters from glue and source when appending. + * + * @param glue + * A string to append between the source and destination, such as a space: ' '. + * @param glue_length + * The number of bytes the glue takes up. + * @param source + * The source string to append. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source and glue are appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_mash_nulless_ + extern f_status_t f_string_dynamic_partial_mash_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_mash_nulless_ + +/** + * Prepend the source string onto the destination with the glue in between, but restricted to the given range. + * + * If the destination string is empty, then no glue is appended. + * + * @param glue + * A string to append between the source and destination, such as a space: ' '. + * @param glue_length + * The number of bytes the glue takes up. + * @param source + * The source string to append. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source and glue are appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_mish_ + extern f_status_t f_string_dynamic_partial_mish(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_mish_ + +/** + * Prepend the source string onto the destination with the glue in between, but restricted to the given range. + * + * If the destination string is empty, then no glue is appended. + * + * Skips over NULL characters from glue and source when appending. + * + * @param glue + * A string to append between the source and destination, such as a space: ' '. + * @param glue_length + * The number of bytes the glue takes up. + * @param source + * The source string to append. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source and glue are appended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_mish_nulless_ + extern f_status_t f_string_dynamic_partial_mish_nulless(const f_string_t glue, const f_array_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_mish_nulless_ + +/** + * Prepend the source string onto the destination, but restricted to the given range. + * + * Prepend operations require memory move operations and are therefore likely more expensive than append operations. + * + * @param source + * The source string to prepend. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source is prepended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_prepend_ + extern f_status_t f_string_dynamic_partial_prepend(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_prepend_ + +/** + * Prepend the source string onto the destination, but only if the string is not already at the end and restricted to the given range + * + * Prepend operations require memory move operations and are therefore likely more expensive than append operations. + * + * This ignores NULL characters when comparing both the source and the destination. + * + * @param source + * The source string to prepend. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source is prepended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_prepend_assure_ + extern f_status_t f_string_dynamic_partial_prepend_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_prepend_assure_ + +/** + * Prepend the source string onto the destination, but only if the string is not already at the end and restricted to the given range + * + * Prepend operations require memory move operations and are therefore likely more expensive than append operations. + * + * This ignores NULL characters when comparing both the source and the destination. + * + * @param source + * The source string to prepend. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source is prepended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_prepend_assure_nulless_ + extern f_status_t f_string_dynamic_partial_prepend_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_prepend_assure_nulless_ + +/** + * Prepend the source string onto the destination, but restricted to the given range. + * + * Prepend operations require memory move operations and are therefore likely more expensive than append operations. + * + * @param source + * The source string to prepend. + * @param range + * A range within the source to restrict the copy from. + * @param destination + * The destination string the source is prepended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_partial_prepend_nulless_ + extern f_status_t f_string_dynamic_partial_prepend_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_partial_prepend_nulless_ + +/** + * Prepend the source string onto the destination. + * + * Prepend operations require memory move operations and are therefore likely more expensive than append operations. + * + * @param source + * The source string to prepend. + * @param destination + * The destination string the source is prepended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_prepend_ + extern f_status_t f_string_dynamic_prepend(const f_string_static_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_prepend_ + +/** + * Prepend the source string onto the destination, but only if the string is not already at the beginning. + * + * Prepend operations require memory move operations and are therefore likely more expensive than append operations. + * + * This ignores NULL characters when comparing both the source and the destination. + * + * @param source + * The source string to prepend. + * @param destination + * The destination string the source is prepended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_prepend_assure_ + extern f_status_t f_string_dynamic_prepend_assure(const f_string_static_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_prepend_assure_ + +/** + * Prepend the source string onto the destination, but only if the string is not already at the beginning. + * + * Prepend operations require memory move operations and are therefore likely more expensive than append operations. + * + * This ignores NULL characters when comparing both the source and the destination. + * + * @param source + * The source string to prepend. + * @param destination + * The destination string the source is prepended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_prepend_assure_nulless_ + extern f_status_t f_string_dynamic_prepend_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_prepend_assure_nulless_ + +/** + * Prepend the source string onto the destination. + * + * Prepend operations require memory move operations and are therefore likely more expensive than append operations. + * + * @param source + * The source string to prepend. + * @param destination + * The destination string the source is prepended onto. + * + * @return + * F_none on success. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_prepend_nulless_ + extern f_status_t f_string_dynamic_prepend_nulless(const f_string_static_t source, f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_prepend_nulless_ + +/** * Resize the dynamic string. * * @param length @@ -229,14 +871,139 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_dynamic_resize_ extern f_status_t f_string_dynamic_resize(const f_array_length_t length, f_string_dynamic_t *dynamic); #endif // _di_f_string_dynamic_resize_ /** + * Seek the buffer location forward until EOL is reached. + * + * @param string + * The string to traverse. + * @param range + * A range within the buffer representing the start and stop locations. + * The start location will be incremented by seek. + * + * @return + * F_none on success. + * F_none_stop on success, but stopped at end of range. + * F_data_not on success, but there was no string data to seek. + * F_data_not_stop on success, but the range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_seek_line_ + extern f_status_t f_string_dynamic_seek_line(const f_string_t string, f_string_range_t *range); +#endif // _di_f_string_dynamic_seek_line_ + +/** + * Seek the buffer location forward until the character (1-byte wide) or EOL is reached. + * + * @param string + * The string to traverse. + * @param seek_to_this + * A single-width character representing a character to seek to. + * @param range + * A range within the buffer representing the start and stop locations. + * The start location will be incremented by seek. + * + * @return + * F_none on success. + * F_none_eol on success, but stopped at EOL. + * F_none_stop on success, but stopped at end of range. + * F_data_not on success, but there was no string data to seek. + * F_data_not_stop on success, but the range.start > range.stop. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_seek_line_to_ + extern f_status_t f_string_dynamic_seek_line_to(const f_string_t string, const int8_t seek_to_this, f_string_range_t *range); +#endif // _di_f_string_dynamic_seek_line_to_ + +/** + * Seek the buffer location forward until the character (1-byte wide) is reached. + * + * @param string + * The string to traverse. + * @param seek_to_this + * A single-width character representing a character to seek to. + * @param range + * A range within the buffer representing the start and stop locations. + * The start location will be incremented by seek. + * + * @return + * F_none on success. + * F_none_stop on success, but stopped at end of range. + * F_data_not on success, but there was no string data to seek. + * F_data_not_stop on success, but the range.start > range.stop. + * + * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. + * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_seek_to_ + extern f_status_t f_string_dynamic_seek_to(const f_string_t string, const int8_t seek_to_this, f_string_range_t *range); +#endif // _di_f_string_dynamic_seek_to_ + +/** + * Guarantee that an end of string (NULL) exists at the end of the string. + * + * This is intended to be used for anything requiring NULL terminated strings. + * This will reallocate more space if necessary. + * + * If destination size is 0, then it will be reallocated and have the NULL assigned at index 0. + * + * @param destination + * The new string, which will be allocated or reallocated as necessary. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if string is too large to fit into the buffer. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_terminate_ + extern f_status_t f_string_dynamic_terminate(f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_terminate_ + +/** + * Guarantee that an end of string (NULL) exists at the end of the string. + * + * This ensures that the terminating NULL not only exists but is not counted in destination.used. + * + * This is intended to be used for anything requiring NULL terminated strings whose used length cannot be counted. + * This will reallocate more space if necessary. + * + * If destination size is 0, then it will be reallocated and have the NULL assigned at index 0. + * + * @param destination + * The new string, which will be allocated or reallocated as necessary. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if string is too large to fit into the buffer. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamic_terminate_after_ + extern f_status_t f_string_dynamic_terminate_after(f_string_dynamic_t *destination); +#endif // _di_f_string_dynamic_terminate_after_ + +/** * Resize the dynamic string array. * * @param length @@ -247,14 +1014,36 @@ extern "C" { * @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_adjust(). */ #ifndef _di_f_string_dynamics_adjust_ extern f_status_t f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t *dynamics); #endif // _di_f_string_dynamics_adjust_ /** + * Append the source strings onto the destination. + * + * @param source + * The source strings to append. + * @param destination + * The destination strings 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. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_dynamics_append_ + extern f_status_t f_string_dynamics_append(const f_string_dynamics_t source, f_string_dynamics_t *destination); +#endif // _di_f_string_dynamics_append_ + +/** * Resize the dynamic string array to a smaller size. * * This will resize making the array smaller based on (size - given length). @@ -270,8 +1059,9 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (size == 0). * - * 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_resize(). */ #ifndef _di_f_string_dynamics_decimate_by_ extern f_status_t f_string_dynamics_decimate_by(const f_array_length_t amount, f_string_dynamics_t *dynamics); @@ -293,8 +1083,9 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (size == 0). * - * 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_resize(). */ #ifndef _di_f_string_dynamics_decrease_by_ extern f_status_t f_string_dynamics_decrease_by(const f_array_length_t amount, f_string_dynamics_t *dynamics); @@ -313,9 +1104,10 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamics_increase_ extern f_status_t f_string_dynamics_increase(f_string_dynamics_t *dynamics); @@ -337,9 +1129,10 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamics_increase_by_ extern f_status_t f_string_dynamics_increase_by(const f_array_length_t amount, f_string_dynamics_t *dynamics); @@ -356,8 +1149,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_dynamics_resize_ extern f_status_t f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t *dynamics); diff --git a/level_0/f_string/c/string_map.c b/level_0/f_string/c/string_map.c index b88374f..341e5b3 100644 --- a/level_0/f_string/c/string_map.c +++ b/level_0/f_string/c/string_map.c @@ -15,6 +15,39 @@ extern "C" { } #endif // _di_f_string_map_multis_adjust_ +#ifndef _di_f_string_map_multis_append_ + f_status_t f_string_map_multis_append(const f_string_map_multis_t source, f_string_map_multis_t *destination) { + #ifndef _di_level_0_parameter_checking_ + if (!destination) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + f_status_t status = F_none; + + if (destination->used + source.used > destination->size) { + status = private_f_string_map_multis_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) { + + destination->array[destination->used].name.used = 0; + destination->array[destination->used].value.used = 0; + + if (source.array[i].name.used) { + status = private_f_string_append(source.array[i].name.string, source.array[i].name.used, &destination->array[destination->used].name); + if (F_status_is_error(status)) return status; + } + + if (source.array[i].value.used) { + status = private_f_string_dynamics_append(source.array[i].value, &destination->array[destination->used].value); + if (F_status_is_error(status)) return status; + } + } // for + + return F_none; + } +#endif // _di_f_string_map_multis_append_ + #ifndef _di_f_string_map_multis_decimate_by_ f_status_t f_string_map_multis_decimate_by(const f_array_length_t amount, f_string_map_multis_t *map_multis) { #ifndef _di_level_0_parameter_checking_ @@ -108,6 +141,41 @@ extern "C" { } #endif // _di_f_string_maps_adjust_ +#ifndef _di_f_string_maps_append_ + f_status_t f_string_maps_append(const f_string_maps_t source, f_string_maps_t *destination) { + #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_string_maps_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) { + + destination->array[destination->used].name.used = 0; + destination->array[destination->used].value.used = 0; + + if (source.array[i].name.used) { + status = private_f_string_append(source.array[i].name.string, source.array[i].name.used, &destination->array[destination->used].name); + if (F_status_is_error(status)) return status; + } + + if (source.array[i].value.used) { + status = private_f_string_append(source.array[i].value.string, source.array[i].value.used, &destination->array[destination->used].value); + if (F_status_is_error(status)) return status; + } + } // for + + return F_none; + } +#endif // _di_f_string_maps_append_ + #ifndef _di_f_string_maps_decimate_by_ f_status_t f_string_maps_decimate_by(const f_array_length_t amount, f_string_maps_t *maps) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string_map.h b/level_0/f_string/c/string_map.h index af9f9c6..b441fb8 100644 --- a/level_0/f_string/c/string_map.h +++ b/level_0/f_string/c/string_map.h @@ -133,25 +133,47 @@ extern "C" { #endif // _di_f_string_map_multis_t_ /** - * Resize the string map_multis array. + * Resize the map_multis array. * * @param length * The new size to use. * @param map_multis - * The string map_multis array to resize. + * The map_multis array to resize. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_map_multis_adjust_ extern f_status_t f_string_map_multis_adjust(const f_array_length_t length, f_string_map_multis_t *map_multis); #endif // _di_f_string_map_multis_adjust_ /** - * Resize the string map_multis array to a smaller size. + * Append the source map_multis onto the destination. + * + * @param source + * The source maps to append. + * @param destination + * The destination maps 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. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_map_multis_append_ + f_status_t f_string_map_multis_append(const f_string_map_multis_t source, f_string_map_multis_t *destination); +#endif // _di_f_string_map_multis_append_ + +/** + * Resize the map_multis 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. @@ -160,20 +182,21 @@ extern "C" { * @param amount * A positive number representing how much to decimate the size by. * @param map_multis - * The string map_multis array to resize. + * The map_multis array to resize. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_map_multis_decimate_by_ extern f_status_t f_string_map_multis_decimate_by(const f_array_length_t amount, f_string_map_multis_t *map_multis); #endif // _di_f_string_map_multis_decimate_by_ /** - * Resize the string map_multis array to a smaller size. + * Resize the map_multis 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. @@ -182,41 +205,43 @@ extern "C" { * @param amount * A positive number representing how much to decrease the size by. * @param map_multis - * The string map_multis array to resize. + * The map_multis array to resize. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_map_multis_decrease_by_ extern f_status_t f_string_map_multis_decrease_by(const f_array_length_t amount, f_string_map_multis_t *map_multis); #endif // _di_f_string_map_multis_decrease_by_ /** - * Increase the size of the string map_multis array, but only if necessary. + * Increase the size of the map_multis array, but only if necessary. * * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). * If already set to the maximum buffer size, then the resize will fail. * * @param map_multis - * The string map_multis array to resize. + * The map_multis array to resize. * * @return * F_none on success. * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_map_multis_increase_ extern f_status_t f_string_map_multis_increase(f_string_map_multis_t *map_multis); #endif // _di_f_string_map_multis_increase_ /** - * Resize the string map_multis array to a larger size. + * Resize the map_multis 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). @@ -225,33 +250,35 @@ extern "C" { * @param amount * A positive number representing how much to increase the size by. * @param map_multis - * The string map_multis array to resize. + * The map_multis array to resize. * * @return * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_map_multis_increase_by_ extern f_status_t f_string_map_multis_increase_by(const f_array_length_t amount, f_string_map_multis_t *map_multis); #endif // _di_f_string_map_multis_increase_by_ /** - * Resize the string map_multis array. + * Resize the map_multis array. * * @param length * The new size to use. * @param map_multis - * The string map_multis array to adjust. + * The map_multis 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_resize(). */ #ifndef _di_f_string_map_multis_resize_ extern f_status_t f_string_map_multis_resize(const f_array_length_t length, f_string_map_multis_t *map_multis); @@ -268,14 +295,36 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_maps_adjust_ extern f_status_t f_string_maps_adjust(const f_array_length_t length, f_string_maps_t *maps); #endif // _di_f_string_maps_adjust_ /** + * Append the source maps onto the destination. + * + * @param source + * The source maps to append. + * @param destination + * The destination maps 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. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_maps_append_ + extern f_status_t f_string_maps_append(const f_string_maps_t source, f_string_maps_t *destination); +#endif // _di_f_string_maps_append_ + +/** * Resize the string maps array to a smaller size. * * This will resize making the array smaller based on (size - given length). @@ -290,8 +339,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_maps_decimate_by_ extern f_status_t f_string_maps_decimate_by(const f_array_length_t amount, f_string_maps_t *maps); @@ -312,8 +362,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_maps_decrease_by_ extern f_status_t f_string_maps_decrease_by(const f_array_length_t amount, f_string_maps_t *maps); @@ -333,8 +384,9 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_maps_increase_ extern f_status_t f_string_maps_increase(f_string_maps_t *maps); @@ -356,9 +408,10 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_maps_increase_by_ extern f_status_t f_string_maps_increase_by(const f_array_length_t amount, f_string_maps_t *maps); @@ -375,8 +428,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_maps_resize_ extern f_status_t f_string_maps_resize(const f_array_length_t length, f_string_maps_t *maps); diff --git a/level_0/f_string/c/string_quantity.c b/level_0/f_string/c/string_quantity.c index c869ccf..83a515e 100644 --- a/level_0/f_string/c/string_quantity.c +++ b/level_0/f_string/c/string_quantity.c @@ -15,6 +15,31 @@ extern "C" { } #endif // _di_f_string_quantitys_adjust_ +#ifndef _di_f_string_quantitys_append_ + f_status_t f_string_quantitys_append(const f_string_quantitys_t source, f_string_quantitys_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_string_quantitys_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].start = source.array[i].start; + destination->array[destination->used].total = source.array[i].total; + } // for + + return F_none; + } +#endif // _di_f_string_quantitys_append_ + #ifndef _di_f_string_quantitys_decimate_by_ f_status_t f_string_quantitys_decimate_by(const f_array_length_t amount, f_string_quantitys_t *quantitys) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string_quantity.h b/level_0/f_string/c/string_quantity.h index 4ef2731..59446fb 100644 --- a/level_0/f_string/c/string_quantity.h +++ b/level_0/f_string/c/string_quantity.h @@ -110,14 +110,35 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_quantitys_adjust_ extern f_status_t f_string_quantitys_adjust(const f_array_length_t length, f_string_quantitys_t *quantitys); #endif // _di_f_string_quantitys_adjust_ /** + * Append the source quantitys onto the destination. + * + * @param source + * The source quantitys to append. + * @param destination + * The destination quantitys 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_string_quantitys_append_ + extern f_status_t f_string_quantitys_append(const f_string_quantitys_t source, f_string_quantitys_t *destination); +#endif // _di_f_string_quantitys_append_ + +/** * Resize the string quantitys array to a smaller size. * * This will resize making the array smaller based on (size - given length). @@ -132,8 +153,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_quantitys_decimate_by_ extern f_status_t f_string_quantitys_decimate_by(const f_array_length_t amount, f_string_quantitys_t *quantitys); @@ -154,8 +176,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_quantitys_decrease_by_ extern f_status_t f_string_quantitys_decrease_by(const f_array_length_t amount, f_string_quantitys_t *quantitys); @@ -172,10 +195,11 @@ extern "C" { * * @return * F_none on success. - * F_array_too_large (with error bit) if the new array length is too large. * - * F_memory_not (with error bit) on out of memory. + * F_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_string_quantitys_increase_ extern f_status_t f_string_quantitys_increase(f_string_quantitys_t *quantitys); @@ -196,9 +220,10 @@ extern "C" { * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantitys_increase_by_ extern f_status_t f_string_quantitys_increase_by(const f_array_length_t amount, f_string_quantitys_t *quantitys); @@ -215,8 +240,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_quantitys_resize_ extern f_status_t f_string_quantitys_resize(const f_array_length_t length, f_string_quantitys_t *quantitys); @@ -233,8 +259,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_quantityss_adjust_ extern f_status_t f_string_quantityss_adjust(const f_array_length_t length, f_string_quantityss_t *quantityss); @@ -255,8 +282,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_quantityss_decimate_by_ extern f_status_t f_string_quantityss_decimate_by(const f_array_length_t amount, f_string_quantityss_t *quantityss); @@ -277,8 +305,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_quantityss_decrease_by_ extern f_status_t f_string_quantityss_decrease_by(const f_array_length_t amount, f_string_quantityss_t *quantityss); @@ -298,8 +327,9 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantityss_increase_ extern f_status_t f_string_quantityss_increase(f_string_quantityss_t *quantityss); @@ -321,9 +351,10 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_quantityss_increase_by_ extern f_status_t f_string_quantityss_increase_by(const f_array_length_t amount, f_string_quantityss_t *quantityss); @@ -340,8 +371,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_quantityss_resize_ extern f_status_t f_string_quantityss_resize(const f_array_length_t length, f_string_quantityss_t *quantityss); diff --git a/level_0/f_string/c/string_range.c b/level_0/f_string/c/string_range.c index f4b4939..9568682 100644 --- a/level_0/f_string/c/string_range.c +++ b/level_0/f_string/c/string_range.c @@ -15,6 +15,31 @@ extern "C" { } #endif // _di_f_string_ranges_adjust_ +#ifndef _di_f_string_ranges_append_ + f_status_t f_string_ranges_append(const f_string_ranges_t source, f_string_ranges_t *destination) { + #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_string_ranges_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].start = source.array[i].start; + destination->array[destination->used].stop = source.array[i].stop; + } // for + + return F_none; + } +#endif // _di_f_string_ranges_append_ + #ifndef _di_f_string_ranges_decimate_by_ f_status_t f_string_ranges_decimate_by(const f_array_length_t amount, f_string_ranges_t *ranges) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string_range.h b/level_0/f_string/c/string_range.h index 2e35d3c..daf283d 100644 --- a/level_0/f_string/c/string_range.h +++ b/level_0/f_string/c/string_range.h @@ -124,6 +124,26 @@ extern "C" { #endif // _di_f_string_ranges_adjust_ /** + * Append the source ranges onto the destination. + * + * @param source + * The source ranges 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_string_ranges_append_ + extern f_status_t f_string_ranges_append(const f_string_ranges_t source, f_string_ranges_t *destination); +#endif // _di_f_string_ranges_append_ + +/** * Resize the string ranges array to a smaller size. * * This will resize making the array smaller based on (size - given length). @@ -138,8 +158,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_ranges_decimate_by_ extern f_status_t f_string_ranges_decimate_by(const f_array_length_t amount, f_string_ranges_t *ranges); @@ -160,8 +181,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_ranges_decrease_by_ extern f_status_t f_string_ranges_decrease_by(const f_array_length_t amount, f_string_ranges_t *ranges); @@ -181,8 +203,9 @@ extern "C" { * F_none on success. * F_array_too_large (with error bit) if the new array length is too large. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_ranges_increase_ extern f_status_t f_string_ranges_increase(f_string_ranges_t *ranges); @@ -204,9 +227,10 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_ranges_increase_by_ extern f_status_t f_string_ranges_increase_by(const f_array_length_t amount, f_string_ranges_t *ranges); @@ -223,8 +247,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_ranges_resize_ extern f_status_t f_string_ranges_resize(const f_array_length_t length, f_string_ranges_t *ranges); @@ -241,8 +266,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_rangess_adjust_ extern f_status_t f_string_rangess_adjust(const f_array_length_t length, f_string_rangess_t *rangess); @@ -263,8 +289,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_rangess_decimate_by_ extern f_status_t f_string_rangess_decimate_by(const f_array_length_t amount, f_string_rangess_t *rangess); @@ -285,8 +312,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_rangess_decrease_by_ extern f_status_t f_string_rangess_decrease_by(const f_array_length_t amount, f_string_rangess_t *rangess); @@ -306,8 +334,9 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_rangess_increase_ extern f_status_t f_string_rangess_increase(f_string_rangess_t *rangess); @@ -329,9 +358,10 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_rangess_increase_by_ extern f_status_t f_string_rangess_increase_by(const f_array_length_t amount, f_string_rangess_t *rangess); @@ -348,8 +378,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_rangess_resize_ extern f_status_t f_string_rangess_resize(const f_array_length_t length, f_string_rangess_t *rangess); diff --git a/level_0/f_string/c/string_triple.c b/level_0/f_string/c/string_triple.c index 59c2da9..8e6c7bf 100644 --- a/level_0/f_string/c/string_triple.c +++ b/level_0/f_string/c/string_triple.c @@ -15,6 +15,47 @@ extern "C" { } #endif // _di_f_string_triples_adjust_ +#ifndef _di_f_string_triples_append_ + f_status_t f_string_triples_append(const f_string_triples_t source, f_string_triples_t *destination) { + #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_string_triples_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].one.used = 0; + destination->array[destination->used].two.used = 0; + destination->array[destination->used].three.used = 0; + + if (source.array[i].one.used) { + status = private_f_string_append(source.array[i].one.string, source.array[i].one.used, &destination->array[destination->used].one); + if (F_status_is_error(status)) return status; + } + + if (source.array[i].two.used) { + status = private_f_string_append(source.array[i].two.string, source.array[i].two.used, &destination->array[destination->used].two); + if (F_status_is_error(status)) return status; + } + + if (source.array[i].three.used) { + status = private_f_string_append(source.array[i].three.string, source.array[i].three.used, &destination->array[destination->used].three); + if (F_status_is_error(status)) return status; + } + } // for + + return F_none; + } +#endif // _di_f_string_triples_append_ + #ifndef _di_f_string_triples_decimate_by_ f_status_t f_string_triples_decimate_by(const f_array_length_t amount, f_string_triples_t *triples) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string_triple.h b/level_0/f_string/c/string_triple.h index 6f12295..cb98bf0 100644 --- a/level_0/f_string/c/string_triple.h +++ b/level_0/f_string/c/string_triple.h @@ -104,6 +104,27 @@ extern "C" { #endif // _di_f_string_triples_adjust_ /** + * Append the source triples onto the destination. + * + * @param source + * The source triples to append. + * @param destination + * The destination triples the source is appended onto. + * + * @return + * F_none on success. + * F_data_not on success, but there is no reason to increase size (size == 0). + * + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. + * + * Errors (with error bit) from: f_memory_resize(). + */ +#ifndef _di_f_string_triples_append_ + extern f_status_t f_string_triples_append(const f_string_triples_t source, f_string_triples_t *destination); +#endif // _di_f_string_triples_append_ + +/** * Resize the string triples array to a smaller size. * * This will resize making the array smaller based on (size - given length). @@ -118,8 +139,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_triples_decimate_by_ extern f_status_t f_string_triples_decimate_by(const f_array_length_t amount, f_string_triples_t *triples); @@ -140,8 +162,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_triples_decrease_by_ extern f_status_t f_string_triples_decrease_by(const f_array_length_t amount, f_string_triples_t *triples); @@ -161,8 +184,9 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_triples_increase_ extern f_status_t f_string_triples_increase(f_string_triples_t *triples); @@ -184,9 +208,10 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_triples_increase_by_ extern f_status_t f_string_triples_increase_by(const f_array_length_t amount, f_string_triples_t *triples); @@ -203,8 +228,9 @@ extern "C" { * @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_resize(). */ #ifndef _di_f_string_triples_resize_ extern f_status_t f_string_triples_resize(const f_array_length_t length, f_string_triples_t *triples); diff --git a/level_0/f_type_array/c/type_array.c b/level_0/f_type_array/c/type_array.c index 9bf2eee..d957675 100644 --- a/level_0/f_type_array/c/type_array.c +++ b/level_0/f_type_array/c/type_array.c @@ -20,6 +20,8 @@ extern "C" { 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_ @@ -123,6 +125,8 @@ extern "C" { 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) { @@ -238,6 +242,8 @@ extern "C" { 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_ @@ -341,6 +347,8 @@ extern "C" { 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) { @@ -456,6 +464,8 @@ extern "C" { 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_ @@ -559,6 +569,8 @@ extern "C" { 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) { @@ -674,6 +686,8 @@ extern "C" { 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_ @@ -777,6 +791,8 @@ extern "C" { 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) { @@ -892,6 +908,8 @@ extern "C" { 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_ @@ -995,6 +1013,8 @@ extern "C" { 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) { @@ -1110,6 +1130,8 @@ extern "C" { 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_ @@ -1213,6 +1235,8 @@ extern "C" { 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) { @@ -1328,6 +1352,8 @@ extern "C" { 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_ @@ -1431,6 +1457,8 @@ extern "C" { 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) { @@ -1546,6 +1574,8 @@ extern "C" { 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_ @@ -1649,6 +1679,8 @@ extern "C" { 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) { @@ -1764,6 +1796,8 @@ extern "C" { 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_ @@ -1867,6 +1901,8 @@ extern "C" { 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) { @@ -1982,6 +2018,8 @@ extern "C" { 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_ @@ -2085,6 +2123,8 @@ extern "C" { 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) { @@ -2200,6 +2240,8 @@ extern "C" { 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_ @@ -2303,6 +2345,8 @@ extern "C" { 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) { @@ -2418,6 +2462,8 @@ extern "C" { 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_ @@ -2521,6 +2567,8 @@ extern "C" { 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) { diff --git a/level_0/f_type_array/c/type_array.h b/level_0/f_type_array/c/type_array.h index d4bd67b..b179582 100644 --- a/level_0/f_type_array/c/type_array.h +++ b/level_0/f_type_array/c/type_array.h @@ -53,6 +53,7 @@ extern "C" { * * @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. * @@ -77,7 +78,6 @@ extern "C" { * @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_adjust(). @@ -101,7 +101,6 @@ extern "C" { * @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_resize(). @@ -124,7 +123,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -149,9 +147,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -170,7 +167,6 @@ extern "C" { * @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_resize(). @@ -190,7 +186,6 @@ extern "C" { * @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_adjust(). @@ -210,8 +205,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -231,7 +226,6 @@ extern "C" { * @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_adjust(). @@ -256,7 +250,6 @@ extern "C" { * @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_adjust(). @@ -281,7 +274,6 @@ extern "C" { * @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(). @@ -305,7 +297,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -330,9 +321,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -351,7 +341,6 @@ extern "C" { * @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(). @@ -390,6 +379,7 @@ extern "C" { * * @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. * @@ -414,7 +404,6 @@ extern "C" { * @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_adjust(). @@ -438,7 +427,6 @@ extern "C" { * @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_resize(). @@ -461,7 +449,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -486,9 +473,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -507,7 +493,6 @@ extern "C" { * @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_resize(). @@ -527,7 +512,6 @@ extern "C" { * @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_adjust(). @@ -547,8 +531,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -568,7 +552,6 @@ extern "C" { * @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_adjust(). @@ -593,7 +576,6 @@ extern "C" { * @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_adjust(). @@ -618,7 +600,6 @@ extern "C" { * @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(). @@ -642,7 +623,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -667,9 +647,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -688,7 +667,6 @@ extern "C" { * @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(). @@ -727,6 +705,7 @@ extern "C" { * * @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. * @@ -751,7 +730,6 @@ extern "C" { * @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_adjust(). @@ -775,7 +753,6 @@ extern "C" { * @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_resize(). @@ -798,7 +775,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -823,9 +799,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -844,7 +819,6 @@ extern "C" { * @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_resize(). @@ -864,7 +838,6 @@ extern "C" { * @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_adjust(). @@ -884,8 +857,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -905,7 +878,6 @@ extern "C" { * @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_adjust(). @@ -930,7 +902,6 @@ extern "C" { * @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_adjust(). @@ -955,7 +926,6 @@ extern "C" { * @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(). @@ -979,7 +949,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -1004,9 +973,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -1025,7 +993,6 @@ extern "C" { * @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(). @@ -1064,6 +1031,7 @@ extern "C" { * * @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. * @@ -1088,7 +1056,6 @@ extern "C" { * @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_adjust(). @@ -1112,7 +1079,6 @@ extern "C" { * @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_resize(). @@ -1135,7 +1101,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -1160,9 +1125,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -1181,7 +1145,6 @@ extern "C" { * @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_resize(). @@ -1201,7 +1164,6 @@ extern "C" { * @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_adjust(). @@ -1221,8 +1183,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -1242,7 +1204,6 @@ extern "C" { * @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_adjust(). @@ -1267,7 +1228,6 @@ extern "C" { * @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_adjust(). @@ -1292,7 +1252,6 @@ extern "C" { * @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(). @@ -1316,7 +1275,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -1341,9 +1299,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -1362,7 +1319,6 @@ extern "C" { * @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(). @@ -1401,6 +1357,7 @@ extern "C" { * * @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. * @@ -1425,7 +1382,6 @@ extern "C" { * @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_adjust(). @@ -1449,7 +1405,6 @@ extern "C" { * @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_resize(). @@ -1472,7 +1427,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -1497,9 +1451,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -1518,7 +1471,6 @@ extern "C" { * @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_resize(). @@ -1538,7 +1490,6 @@ extern "C" { * @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_adjust(). @@ -1558,8 +1509,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -1579,7 +1530,6 @@ extern "C" { * @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_adjust(). @@ -1604,7 +1554,6 @@ extern "C" { * @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_adjust(). @@ -1629,7 +1578,6 @@ extern "C" { * @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(). @@ -1653,7 +1601,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -1678,9 +1625,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -1699,7 +1645,6 @@ extern "C" { * @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(). @@ -1738,6 +1683,7 @@ extern "C" { * * @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. * @@ -1762,7 +1708,6 @@ extern "C" { * @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_adjust(). @@ -1786,7 +1731,6 @@ extern "C" { * @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_resize(). @@ -1809,7 +1753,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -1834,9 +1777,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -1855,7 +1797,6 @@ extern "C" { * @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_resize(). @@ -1875,7 +1816,6 @@ extern "C" { * @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_adjust(). @@ -1895,8 +1835,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -1916,7 +1856,6 @@ extern "C" { * @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_adjust(). @@ -1941,7 +1880,6 @@ extern "C" { * @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_adjust(). @@ -1966,7 +1904,6 @@ extern "C" { * @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(). @@ -1990,7 +1927,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -2015,9 +1951,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -2036,7 +1971,6 @@ extern "C" { * @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(). @@ -2075,6 +2009,7 @@ extern "C" { * * @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. * @@ -2099,7 +2034,6 @@ extern "C" { * @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_adjust(). @@ -2123,7 +2057,6 @@ extern "C" { * @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_resize(). @@ -2146,7 +2079,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -2171,9 +2103,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -2192,7 +2123,6 @@ extern "C" { * @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_resize(). @@ -2212,7 +2142,6 @@ extern "C" { * @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_adjust(). @@ -2232,8 +2161,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -2253,7 +2182,6 @@ extern "C" { * @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_adjust(). @@ -2278,7 +2206,6 @@ extern "C" { * @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_adjust(). @@ -2303,7 +2230,6 @@ extern "C" { * @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(). @@ -2327,7 +2253,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -2352,9 +2277,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -2373,7 +2297,6 @@ extern "C" { * @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(). @@ -2412,6 +2335,7 @@ extern "C" { * * @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. * @@ -2436,7 +2360,6 @@ extern "C" { * @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_adjust(). @@ -2460,7 +2383,6 @@ extern "C" { * @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_resize(). @@ -2483,7 +2405,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -2508,9 +2429,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -2529,7 +2449,6 @@ extern "C" { * @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_resize(). @@ -2549,7 +2468,6 @@ extern "C" { * @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_adjust(). @@ -2569,8 +2487,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -2590,7 +2508,6 @@ extern "C" { * @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_adjust(). @@ -2615,7 +2532,6 @@ extern "C" { * @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_adjust(). @@ -2640,7 +2556,6 @@ extern "C" { * @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(). @@ -2664,7 +2579,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -2689,9 +2603,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -2710,7 +2623,6 @@ extern "C" { * @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(). @@ -2749,6 +2661,7 @@ extern "C" { * * @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. * @@ -2773,7 +2686,6 @@ extern "C" { * @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_adjust(). @@ -2797,7 +2709,6 @@ extern "C" { * @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_resize(). @@ -2820,7 +2731,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -2845,9 +2755,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -2866,7 +2775,6 @@ extern "C" { * @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_resize(). @@ -2886,7 +2794,6 @@ extern "C" { * @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_adjust(). @@ -2906,8 +2813,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -2927,7 +2834,6 @@ extern "C" { * @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_adjust(). @@ -2952,7 +2858,6 @@ extern "C" { * @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_adjust(). @@ -2977,7 +2882,6 @@ extern "C" { * @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(). @@ -3001,7 +2905,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -3026,9 +2929,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -3047,7 +2949,6 @@ extern "C" { * @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(). @@ -3086,6 +2987,7 @@ extern "C" { * * @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. * @@ -3110,7 +3012,6 @@ extern "C" { * @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_adjust(). @@ -3134,7 +3035,6 @@ extern "C" { * @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_resize(). @@ -3157,7 +3057,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -3182,9 +3081,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -3203,7 +3101,6 @@ extern "C" { * @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_resize(). @@ -3223,7 +3120,6 @@ extern "C" { * @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_adjust(). @@ -3243,8 +3139,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -3264,7 +3160,6 @@ extern "C" { * @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_adjust(). @@ -3289,7 +3184,6 @@ extern "C" { * @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_adjust(). @@ -3314,7 +3208,6 @@ extern "C" { * @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(). @@ -3338,7 +3231,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -3363,9 +3255,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -3384,7 +3275,6 @@ extern "C" { * @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(). @@ -3423,6 +3313,7 @@ extern "C" { * * @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. * @@ -3447,7 +3338,6 @@ extern "C" { * @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_adjust(). @@ -3471,7 +3361,6 @@ extern "C" { * @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_resize(). @@ -3494,7 +3383,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -3519,9 +3407,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -3540,7 +3427,6 @@ extern "C" { * @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_resize(). @@ -3560,7 +3446,6 @@ extern "C" { * @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_adjust(). @@ -3580,8 +3465,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -3601,7 +3486,6 @@ extern "C" { * @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_adjust(). @@ -3626,7 +3510,6 @@ extern "C" { * @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_adjust(). @@ -3651,7 +3534,6 @@ extern "C" { * @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(). @@ -3675,7 +3557,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -3700,9 +3581,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -3721,7 +3601,6 @@ extern "C" { * @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(). @@ -3760,6 +3639,7 @@ extern "C" { * * @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. * @@ -3784,7 +3664,6 @@ extern "C" { * @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_adjust(). @@ -3808,7 +3687,6 @@ extern "C" { * @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_resize(). @@ -3831,7 +3709,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -3856,9 +3733,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ @@ -3877,7 +3753,6 @@ extern "C" { * @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_resize(). @@ -3897,7 +3772,6 @@ extern "C" { * @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_adjust(). @@ -3917,8 +3791,8 @@ extern "C" { * * @return * F_none on success. + * F_data_not on success, but there is nothing to append (size == 0). * - * 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_resize(). @@ -3938,7 +3812,6 @@ extern "C" { * @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_adjust(). @@ -3963,7 +3836,6 @@ extern "C" { * @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_adjust(). @@ -3988,7 +3860,6 @@ extern "C" { * @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(). @@ -4012,7 +3883,6 @@ extern "C" { * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). @@ -4037,9 +3907,8 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. * F_array_too_large (with error bit) if the new array length is too large. + * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_resize(). */ diff --git a/level_1/fl_status/c/status.c b/level_1/fl_status/c/status.c index 0e25485..56ab045 100644 --- a/level_1/fl_status/c/status.c +++ b/level_1/fl_status/c/status.c @@ -332,6 +332,12 @@ extern "C" { case F_encoding_not: *string = FL_status_string_encoding_not; break; + case F_eoa: + *string = FL_status_string_eoa; + break; + case F_eoa_not: + *string = FL_status_string_eoa_not; + break; case F_eof: *string = FL_status_string_eof; break; @@ -842,6 +848,9 @@ extern "C" { case F_complete_not_utf_block: *string = FL_status_string_complete_not_utf_block; break; + case F_complete_not_utf_eoa: + *string = FL_status_string_complete_not_utf_eoa; + break; case F_complete_not_utf_eof: *string = FL_status_string_complete_not_utf_eof; break; @@ -857,6 +866,9 @@ extern "C" { case F_none_block: *string = FL_status_string_none_block; break; + case F_none_eoa: + *string = FL_status_string_none_eoa; + break; case F_none_eof: *string = FL_status_string_none_eof; break; @@ -878,6 +890,9 @@ extern "C" { case F_data_not_block: *string = FL_status_string_data_not_block; break; + case F_data_not_eoa: + *string = FL_status_string_data_not_eoa; + break; case F_data_not_eof: *string = FL_status_string_data_not_eof; break; @@ -899,6 +914,9 @@ extern "C" { case F_terminated_not_block: *string = FL_status_string_terminated_not_block; break; + case F_terminated_not_eoa: + *string = FL_status_string_terminated_not_eoa; + break; case F_terminated_not_eof: *string = FL_status_string_terminated_not_eof; break; @@ -914,6 +932,9 @@ extern "C" { case F_terminated_not_group_block: *string = FL_status_string_terminated_not_group_block; break; + case F_terminated_not_group_eoa: + *string = FL_status_string_terminated_not_group_eoa; + break; case F_terminated_not_group_eof: *string = FL_status_string_terminated_not_group_eof; break; @@ -932,6 +953,9 @@ extern "C" { case F_terminated_not_nest_block: *string = FL_status_string_terminated_not_nest_block; break; + case F_terminated_not_nest_eoa: + *string = FL_status_string_terminated_not_nest_eoa; + break; case F_terminated_not_nest_eof: *string = FL_status_string_terminated_not_nest_eof; break; diff --git a/level_1/fl_status/c/status.h b/level_1/fl_status/c/status.h index d971e33..04698b5 100644 --- a/level_1/fl_status/c/status.h +++ b/level_1/fl_status/c/status.h @@ -203,6 +203,8 @@ extern "C" { #define FL_status_string_empty_not "F_empty_not" #define FL_status_string_encoding "F_encoding" #define FL_status_string_encoding_not "F_encoding_not" + #define FL_status_string_eoa "F_eoa" + #define FL_status_string_eoa_not "F_eoa_not" #define FL_status_string_eof "F_eof" #define FL_status_string_eof_not "F_eof_not" #define FL_status_string_eol "F_eol" @@ -364,6 +366,8 @@ extern "C" { #define FL_status_string_empty_not_length 11 #define FL_status_string_encoding_length 10 #define FL_status_string_encoding_not_length 14 + #define FL_status_string_eoa_length 5 + #define FL_status_string_eoa_not_length 9 #define FL_status_string_eof_length 5 #define FL_status_string_eof_not_length 9 #define FL_status_string_eol_length 5 @@ -588,11 +592,13 @@ extern "C" { #define FL_status_string_buffer_too_small "F_buffer_too_small" #define FL_status_string_complete_not_utf "F_complete_not_utf" #define FL_status_string_complete_not_utf_block "F_complete_not_utf_block" + #define FL_status_string_complete_not_utf_eoa "F_complete_not_utf_eoa" #define FL_status_string_complete_not_utf_eof "F_complete_not_utf_eof" #define FL_status_string_complete_not_utf_eol "F_complete_not_utf_eol" #define FL_status_string_complete_not_utf_eos "F_complete_not_utf_eos" #define FL_status_string_complete_not_utf_stop "F_complete_not_utf_stop" #define FL_status_string_none_block "F_none_block" + #define FL_status_string_none_eoa "F_none_eoa" #define FL_status_string_none_eof "F_none_eof" #define FL_status_string_none_eol "F_none_eol" #define FL_status_string_none_eos "F_none_eos" @@ -601,6 +607,7 @@ extern "C" { #define FL_status_string_data "F_data" #define FL_status_string_data_not "F_data_not" #define FL_status_string_data_not_block "F_data_not_block" + #define FL_status_string_data_not_eoa "F_data_not_eoa" #define FL_status_string_data_not_eof "F_data_not_eof" #define FL_status_string_data_not_eol "F_data_not_eol" #define FL_status_string_data_not_eos "F_data_not_eos" @@ -608,18 +615,21 @@ extern "C" { #define FL_status_string_terminated "F_terminated" #define FL_status_string_terminated_not "F_terminated_not" #define FL_status_string_terminated_not_block "F_terminated_not_block" + #define FL_status_string_terminated_not_eoa "F_terminated_not_eoa" #define FL_status_string_terminated_not_eof "F_terminated_not_eof" #define FL_status_string_terminated_not_eol "F_terminated_not_eol" #define FL_status_string_terminated_not_eos "F_terminated_not_eos" #define FL_status_string_terminated_not_stop "F_terminated_not_stop" #define FL_status_string_terminated_not_group "F_terminated_not_group" #define FL_status_string_terminated_not_group_block "F_terminated_not_group_block" + #define FL_status_string_terminated_not_group_eoa "F_terminated_not_group_eoa" #define FL_status_string_terminated_not_group_eof "F_terminated_not_group_eof" #define FL_status_string_terminated_not_group_eol "F_terminated_not_group_eol" #define FL_status_string_terminated_not_group_eos "F_terminated_not_group_eos" #define FL_status_string_terminated_not_group_stop "F_terminated_not_group_stop" #define FL_status_string_terminated_not_nest "F_terminated_not_nest" #define FL_status_string_terminated_not_nest_block "F_terminated_not_nest_block" + #define FL_status_string_terminated_not_nest_eoa "F_terminated_not_nest_eoa" #define FL_status_string_terminated_not_nest_eof "F_terminated_not_nest_eof" #define FL_status_string_terminated_not_nest_eol "F_terminated_not_nest_eol" #define FL_status_string_terminated_not_nest_eos "F_terminated_not_nest_eos" @@ -631,11 +641,13 @@ extern "C" { #define FL_status_string_buffer_too_small_length 18 #define FL_status_string_complete_not_utf_length 18 #define FL_status_string_complete_not_utf_block_length 24 + #define FL_status_string_complete_not_utf_eoa_length 22 #define FL_status_string_complete_not_utf_eof_length 22 #define FL_status_string_complete_not_utf_eol_length 22 #define FL_status_string_complete_not_utf_eos_length 22 #define FL_status_string_complete_not_utf_stop_length 23 #define FL_status_string_none_block_length 12 + #define FL_status_string_none_eoa_length 10 #define FL_status_string_none_eof_length 10 #define FL_status_string_none_eol_length 10 #define FL_status_string_none_eos_length 10 @@ -643,6 +655,7 @@ extern "C" { #define FL_status_string_data_length 6 #define FL_status_string_data_not_length 10 #define FL_status_string_data_not_block_length 16 + #define FL_status_string_data_not_eoa_length 14 #define FL_status_string_data_not_eof_length 14 #define FL_status_string_data_not_eol_length 14 #define FL_status_string_data_not_eos_length 14 @@ -650,18 +663,21 @@ extern "C" { #define FL_status_string_terminated_length 12 #define FL_status_string_terminated_not_length 16 #define FL_status_string_terminated_not_block_length 22 + #define FL_status_string_terminated_not_eoa_length 20 #define FL_status_string_terminated_not_eof_length 20 #define FL_status_string_terminated_not_eol_length 20 #define FL_status_string_terminated_not_eos_length 20 #define FL_status_string_terminated_not_stop_length 21 #define FL_status_string_terminated_not_group_length 22 #define FL_status_string_terminated_not_group_block_length 28 + #define FL_status_string_terminated_not_group_eoa_length 25 #define FL_status_string_terminated_not_group_eof_length 25 #define FL_status_string_terminated_not_group_eol_length 25 #define FL_status_string_terminated_not_group_eos_length 25 #define FL_status_string_terminated_not_group_stop_length 26 #define FL_status_string_terminated_not_nest_length 21 #define FL_status_string_terminated_not_nest_block_length 26 + #define FL_status_string_terminated_not_nest_eoa_length 25 #define FL_status_string_terminated_not_nest_eof_length 25 #define FL_status_string_terminated_not_nest_eol_length 25 #define FL_status_string_terminated_not_nest_eos_length 25 diff --git a/level_2/fll_fss/c/fss_status.c b/level_2/fll_fss/c/fss_status.c index 41a84e3..3ebec8d 100644 --- a/level_2/fll_fss/c/fss_status.c +++ b/level_2/fll_fss/c/fss_status.c @@ -181,83 +181,6 @@ extern "C" { } #endif // _di_fll_status_to_string_ -#ifndef _di_fll_fss_status_is_error_ - f_status_t fll_fss_status_is_error(const f_status_t code) { - - if (fll_fss_status_is_fine(code) == F_true) { - return F_false; - } - else if (fll_fss_status_is_warning(code) == F_true) { - return F_false; - } - - return F_true; - } -#endif // _di_fll_fss_status_is_error_ - -#ifndef _di_fll_fss_status_is_warning_ - f_status_t fll_fss_status_is_warning(const f_status_t code) { - - switch (code) { - #ifndef _di_fll_fss_status_basic_ - case F_data_not: - return F_true; - #endif // _di_fll_fss_status_basic_ - - #ifndef _di_f_status_buffers_ - case F_data_not_eof: - return F_true; - case F_data_not_eos: - return F_true; - case F_data_not_stop: - return F_true; - case F_none_eof: - return F_true; - case F_none_eos: - return F_true; - case F_none_stop: - return F_true; - #endif // _di_f_status_buffers_ - } - - return F_false; - } -#endif // _di_fll_fss_status_is_warning_ - -#ifndef _di_fll_fss_status_is_fine_ - f_status_t fll_fss_status_is_fine(const f_status_t code) { - - switch (code) { - #ifndef _di_fll_fss_status_booleans_ - case F_false: - return F_true; - case F_true: - return F_true; - #endif // _di_fll_fss_status_booleans_ - - #ifndef _di_fll_fss_status_basic_ - case F_none: - return F_true; - case F_dummy: - return F_true; - #endif // _di_fll_fss_status_basic_ - - #ifndef _di_F_error_compare_ - case F_than_less: - return F_true; - case F_equal_to: - return F_true; - case F_equal_to_not: - return F_true; - case F_than_greater: - return F_true; - #endif // _di_fll_fss_status_non_ - } - - return F_false; - } -#endif // _di_fll_fss_status_is_fine_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_2/fll_fss/c/fss_status.h b/level_2/fll_fss/c/fss_status.h index 995be8a..ab1d975 100644 --- a/level_2/fll_fss/c/fss_status.h +++ b/level_2/fll_fss/c/fss_status.h @@ -125,48 +125,6 @@ extern "C" { extern f_status_t fll_fss_status_to_string(const f_status_t code, f_string_t *string); #endif // _di_fll_status_to_string_ -/** - * Returns true or false depending on whether the given status code has the error bit set. - * - * @param code - * The code to process. - * - * @return - * F_true if status has the error bit set. - * F_false otherwise. - */ -#ifndef _di_fll_fss_status_is_error_ - extern f_status_t fll_fss_status_is_error(const f_status_t code); -#endif // _di_fll_fss_status_is_error_ - -/** - * Returns true or false depending on whether the given status code has the warning bit set. - * - * @param code - * The code to process. - * - * @return - * F_true if status has the warning bit set. - * F_false otherwise. - */ -#ifndef _di_fll_fss_status_is_warning_ - extern f_status_t fll_fss_status_is_warning(const f_status_t code); -#endif // _di_fll_fss_status_is_warning_ - -/** - * Returns true or false depending on whether the given status code has neither the error bit nor the warning bit set. - * - * @param code - * The code to process. - * - * @return - * F_true if status does not have the error bit nor warning bit set. - * F_false otherwise. - */ -#ifndef _di_fll_fss_status_is_fine_ - extern f_status_t fll_fss_status_is_fine(const f_status_t code); -#endif // _di_fll_fss_status_is_fine_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_2/fll_status/c/status.c b/level_2/fll_status/c/status.c index b5bb518..399ee27 100644 --- a/level_2/fll_status/c/status.c +++ b/level_2/fll_status/c/status.c @@ -556,6 +556,16 @@ extern "C" { return F_none; } + if (fl_string_compare(string, FL_status_string_eoa, length, FL_status_string_eoa_length) == F_equal_to) { + *code = F_eoa; + return F_none; + } + + if (fl_string_compare(string, FL_status_string_eoa_not, length, FL_status_string_eoa_not_length) == F_equal_to) { + *code = F_eoa_not; + return F_none; + } + if (fl_string_compare(string, FL_status_string_eof, length, FL_status_string_eof_length) == F_equal_to) { *code = F_eof; return F_none; @@ -1396,6 +1406,11 @@ extern "C" { return F_none; } + if (fl_string_compare(string, FL_status_string_complete_not_utf_eoa, length, FL_status_string_complete_not_utf_eoa_length) == F_equal_to) { + *code = F_complete_not_utf_eoa; + return F_none; + } + if (fl_string_compare(string, FL_status_string_complete_not_utf_eof, length, FL_status_string_complete_not_utf_eof_length) == F_equal_to) { *code = F_complete_not_utf_eof; return F_none; @@ -1421,6 +1436,11 @@ extern "C" { return F_none; } + if (fl_string_compare(string, FL_status_string_none_eoa, length, FL_status_string_none_eoa_length) == F_equal_to) { + *code = F_none_eoa; + return F_none; + } + if (fl_string_compare(string, FL_status_string_none_eof, length, FL_status_string_none_eof_length) == F_equal_to) { *code = F_none_eof; return F_none; @@ -1456,6 +1476,11 @@ extern "C" { return F_none; } + if (fl_string_compare(string, FL_status_string_data_not_eoa, length, FL_status_string_data_not_eoa_length) == F_equal_to) { + *code = F_data_not_eoa; + return F_none; + } + if (fl_string_compare(string, FL_status_string_data_not_eof, length, FL_status_string_data_not_eof_length) == F_equal_to) { *code = F_data_not_eof; return F_none; @@ -1491,6 +1516,11 @@ extern "C" { return F_none; } + if (fl_string_compare(string, FL_status_string_terminated_not_eoa, length, FL_status_string_terminated_not_eoa_length) == F_equal_to) { + *code = F_terminated_not_eoa; + return F_none; + } + if (fl_string_compare(string, FL_status_string_terminated_not_eof, length, FL_status_string_terminated_not_eof_length) == F_equal_to) { *code = F_terminated_not_eof; return F_none; @@ -1516,6 +1546,11 @@ extern "C" { return F_none; } + if (fl_string_compare(string, FL_status_string_terminated_not_group_eoa, length, FL_status_string_terminated_not_group_eoa_length) == F_equal_to) { + *code = F_terminated_not_group_eoa; + return F_none; + } + if (fl_string_compare(string, FL_status_string_terminated_not_group_eof, length, FL_status_string_terminated_not_group_eof_length) == F_equal_to) { *code = F_terminated_not_group_eof; return F_none; @@ -1546,6 +1581,11 @@ extern "C" { return F_none; } + if (fl_string_compare(string, FL_status_string_terminated_not_nest_eoa, length, FL_status_string_terminated_not_nest_eoa_length) == F_equal_to) { + *code = F_terminated_not_nest_eoa; + return F_none; + } + if (fl_string_compare(string, FL_status_string_terminated_not_nest_eof, length, FL_status_string_terminated_not_nest_eof_length) == F_equal_to) { *code = F_terminated_not_nest_eof; return F_none; -- 1.8.3.1