From: Kevin Day Date: Thu, 11 Jun 2020 01:24:06 +0000 (-0500) Subject: Progress: continue work in update UTF-8 functions and string functions X-Git-Tag: 0.5.0~169 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=990f0f6f6396dca2520d2fd6626beed8e814edb9;p=fll Progress: continue work in update UTF-8 functions and string functions The UTF-8 functions have become out of date. This is part of a series of commits to get it up to date and fix problems. Fix problems with the string functions observed while performing this update. --- diff --git a/level_0/f_utf/c/utf.h b/level_0/f_utf/c/utf.h index 20c50bb..0c2ea75 100644 --- a/level_0/f_utf/c/utf.h +++ b/level_0/f_utf/c/utf.h @@ -172,6 +172,9 @@ extern "C" { #ifndef _di_f_utf_string_length_ typedef f_number_unsigned f_utf_string_length; + #define f_utf_string_length_size 0xfffffffffffffffe + #define f_utf_string_length_size_max f_type_number_size_max_unsigned + #define f_macro_utf_string_length_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_utf_string_length), length) #define f_macro_utf_string_length_delete(status, string, length) status = f_memory_delete((void **) & string, sizeof(f_utf_string_length), length) diff --git a/level_1/fl_string/c/private-string.c b/level_1/fl_string/c/private-string.c index af7e0f6..18c7903 100644 --- a/level_1/fl_string/c/private-string.c +++ b/level_1/fl_string/c/private-string.c @@ -5,8 +5,9 @@ extern "C" { #endif -#if !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) +#if !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) f_return_status private_fl_string_append(const f_string source, const f_string_length length, f_string_dynamic *destination) { + if (destination->used + length > f_string_length_size) return F_status_set_error(F_string_too_large); f_status status = F_none; @@ -23,10 +24,11 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) +#endif // !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) #if !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) f_return_status private_fl_string_append_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination) { + if (destination->used + length > f_string_length_size) return F_status_set_error(F_string_too_large); f_status status = F_none; @@ -245,9 +247,12 @@ extern "C" { } #endif // !defined(_di_fl_string_compare_trim_) || !defined(_di_fl_string_dynamic_compare_trim_) || !defined(_di_fl_string_dynamic_partial_compare_trim_) -#if !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) +#if !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_append_mish_) || !defined(_di_fl_string_dynamic_mish_) f_return_status private_fl_string_prepend(const f_string source, const f_string_length length, f_string_dynamic *destination) { - if (destination->used + length > f_string_length_size) return F_status_set_error(F_string_too_large); + + if (destination->used + length > f_string_length_size) { + return F_status_set_error(F_string_too_large); + } f_status status = F_none; @@ -273,7 +278,10 @@ extern "C" { #if !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) f_return_status private_fl_string_prepend_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination) { - if (destination->used + length > f_string_length_size) return F_status_set_error(F_string_too_large); + + if (destination->used + length > f_string_length_size) { + return F_status_set_error(F_string_too_large); + } f_status status = F_none; @@ -283,11 +291,13 @@ extern "C" { for (f_string_length i = 0; i <= length; i++) { if (i == length) { if (i > first) { - f_string_length size = i - first; + const f_string_length size = i - first; - if (destination->used + size > f_string_length_size) return F_status_set_error(F_string_too_large); + if (destination->used + size > f_string_length_size) { + return F_status_set_error(F_string_too_large); + } - f_string_length total = destination->used + size; + const f_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); @@ -307,11 +317,13 @@ extern "C" { if (source[i] == 0) { if (i > 0) { if (i > first) { - f_string_length size = i - first; + const f_string_length size = i - first; - if (destination->used + size > f_string_length_size) return F_status_set_error(F_string_too_large); + if (destination->used + size > f_string_length_size) { + return F_status_set_error(F_string_too_large); + } - f_string_length total = destination->used + size; + const f_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); @@ -338,11 +350,11 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) +#endif // !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_append_mish_) || !defined(_di_fl_string_dynamic_mish_) #if !defined(_di_fl_string_rip_) || !defined(_di_fl_string_dynamic_rip_) || !defined(_di_fl_string_rip_nulless_) || !defined(_di_fl_string_dynamic_rip_nulless_) f_return_status private_fl_string_rip_find_range(const f_string source, f_string_length *start, f_string_length *stop) { - f_string_length stop_original = *stop; + const f_string_length stop_original = *stop; f_status status = F_none; @@ -356,7 +368,9 @@ extern "C" { status = f_utf_is_whitespace(source + *start, (*stop - *start) + 1); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); + if (F_status_set_fine(status) == F_maybe) { + return F_status_set_error(F_utf); + } return status; } @@ -391,7 +405,9 @@ extern "C" { status = f_utf_is_whitespace(source + *stop, (stop_original - *stop) + 1); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); + if (F_status_set_fine(status) == F_maybe) { + return F_status_set_error(F_utf); + } return status; } @@ -402,7 +418,9 @@ extern "C" { if (*stop == *start) { status = f_utf_is_whitespace(source + *stop, (stop_original - *stop) + 1); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); + if (F_status_set_fine(status) == F_maybe) { + return F_status_set_error(F_utf); + } return status; } diff --git a/level_1/fl_string/c/private-string.h b/level_1/fl_string/c/private-string.h index c3920b0..f95ca72 100644 --- a/level_1/fl_string/c/private-string.h +++ b/level_1/fl_string/c/private-string.h @@ -26,18 +26,16 @@ extern "C" { * The source string to append. * @param length * Length of source to append. - * @param stop - * Inclusive stop point of string to append. * @param destination * The destination string the source and glue are appended onto. * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. * * @see fl_string_append() * @see fl_string_mash() @@ -62,11 +60,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. * * @see fl_string_append_nulless() * @see fl_string_mash_nulless() @@ -156,7 +154,7 @@ extern "C" { * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. * * @see fl_string_prepend() * @see fl_string_dynamic_prepend() @@ -182,7 +180,7 @@ extern "C" { * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. * * @see fl_string_prepend_nulless() * @see fl_string_dynamic_prepend_nulless() diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index 67854a9..846507b 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -11,7 +11,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; return private_fl_string_append(source, length, destination); } @@ -23,7 +23,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (destination->used < length) return private_fl_string_append(source, length, destination); f_string_length i = 1; @@ -58,7 +58,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (destination->used < length) { return private_fl_string_append_nulless(source, length, destination); @@ -96,7 +96,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; return private_fl_string_append_nulless(source, length, destination); } @@ -114,25 +114,13 @@ extern "C" { } #endif // _di_fl_string_compare_trim_ -#ifndef _di_fl_string_dynamic_compare_ - f_return_status fl_string_dynamic_compare(const f_string_static string1, const f_string_static string2) { - return private_fl_string_compare(string1.string, string2.string, 0, 0, string1.used, string2.used); - } -#endif // _di_fl_string_dynamic_compare_ - -#ifndef _di_fl_string_dynamic_compare_trim_ - f_return_status fl_string_dynamic_compare_trim(const f_string_static string1, const f_string_static string2) { - return private_fl_string_compare_trim(string1.string, string2.string, 0, 0, string1.used, string2.used); - } -#endif // _di_fl_string_dynamic_compare_trim_ - #ifndef _di_fl_string_dynamic_append_ f_return_status fl_string_dynamic_append(const f_string_static source, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; return private_fl_string_append(source.string, source.used, destination); } @@ -144,7 +132,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (destination->used < source.used) { return private_fl_string_append(source.string, source.used, destination); @@ -182,7 +170,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (destination->used < source.used) { return private_fl_string_append_nulless(source.string, source.used, destination); @@ -220,23 +208,34 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; return private_fl_string_append_nulless(source.string, source.used, destination); } #endif // _di_fl_string_dynamic_append_nulless_ +#ifndef _di_fl_string_dynamic_compare_ + f_return_status fl_string_dynamic_compare(const f_string_static string1, const f_string_static string2) { + return private_fl_string_compare(string1.string, string2.string, 0, 0, string1.used, string2.used); + } +#endif // _di_fl_string_dynamic_compare_ + +#ifndef _di_fl_string_dynamic_compare_trim_ + f_return_status fl_string_dynamic_compare_trim(const f_string_static string1, const f_string_static string2) { + return private_fl_string_compare_trim(string1.string, string2.string, 0, 0, string1.used, string2.used); + } +#endif // _di_fl_string_dynamic_compare_trim_ + #ifndef _di_fl_string_dynamic_mash_ f_return_status fl_string_dynamic_mash(const f_string glue, const f_string_length glue_length, const f_string_static source, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { const f_status status = private_fl_string_append(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -250,11 +249,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { const f_status status = private_fl_string_append_nulless(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -268,11 +266,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { const f_status status = private_fl_string_prepend(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -286,11 +283,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { const f_status status = private_fl_string_prepend_nulless(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -305,8 +301,8 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; return private_fl_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -319,10 +315,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; - f_string_length length = (range.stop - range.start) + 1; + const f_string_length length = (range.stop - range.start) + 1; if (destination->used < length) { return private_fl_string_append(source.string + range.start, length, destination); @@ -359,10 +355,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; - f_string_length length = (range.stop - range.start) + 1; + const f_string_length length = (range.stop - range.start) + 1; if (destination->used < length) { return private_fl_string_append_nulless(source.string + range.start, length, destination); @@ -399,12 +395,12 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; return private_fl_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } -#endif // _di_fl_string_dynamic_append_nulless_ +#endif // _di_fl_string_dynamic_partial_append_nulless_ #ifndef _di_fl_string_dynamic_partial_compare_ f_return_status fl_string_dynamic_partial_compare(const f_string_static string1, const f_string_static string2, const f_string_range range1, const f_string_range range2) { @@ -435,12 +431,11 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_string_append(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -455,12 +450,11 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_string_append_nulless(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -475,12 +469,11 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_string_prepend(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -495,12 +488,11 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_string_prepend_nulless(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -515,10 +507,24 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; + + return private_fl_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); + } +#endif // _di_fl_string_dynamic_partial_prepend_ + +#ifndef _di_fl_string_dynamic_partial_prepend_assure_ + f_return_status fl_string_dynamic_partial_prepend_assure(const f_string_static source, const f_string_range range, f_string_dynamic *destination) { + #ifndef _di_level_1_parameter_checking_ + if (source.used <= range.stop) return F_status_set_error(F_parameter); + if (destination == 0) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; - f_string_length length = (range.stop - range.start) + 1; + const f_string_length length = (range.stop - range.start) + 1; if (destination->used < length) { return private_fl_string_prepend(source.string + range.start, length, destination); @@ -548,19 +554,19 @@ extern "C" { return F_none; } -#endif // _di_fl_string_dynamic_partial_prepend_ +#endif // _di_fl_string_dynamic_partial_prepend_assure_ -#ifndef _di_fl_string_dynamic_partial_prepend_assure_ - f_return_status fl_string_dynamic_partial_prepend_assure(const f_string_static source, const f_string_range range, f_string_dynamic *destination) { +#ifndef _di_fl_string_dynamic_partial_prepend_assure_nulless_ + f_return_status fl_string_dynamic_partial_prepend_assure_nulless(const f_string_static source, const f_string_range range, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; - f_string_length length = (range.stop - range.start) + 1; + const f_string_length length = (range.stop - range.start) + 1; if (destination->used < length) { return private_fl_string_prepend_nulless(source.string + range.start, length, destination); @@ -590,20 +596,6 @@ extern "C" { return F_none; } -#endif // _di_fl_string_dynamic_partial_prepend_assure_ - -#ifndef _di_fl_string_dynamic_partial_prepend_assure_nulless_ - f_return_status fl_string_dynamic_partial_prepend_assure_nulless(const f_string_static source, const f_string_range range, f_string_dynamic *destination) { - #ifndef _di_level_1_parameter_checking_ - if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; - - return private_fl_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); - } #endif // _di_fl_string_dynamic_partial_prepend_assure_nulless #ifndef _di_fl_string_dynamic_partial_prepend_nulless_ @@ -613,8 +605,8 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; return private_fl_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -626,7 +618,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; return private_fl_string_prepend(source.string, source.used, destination); } @@ -638,7 +630,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (destination->used < source.used) { return private_fl_string_prepend(source.string, source.used, destination); @@ -676,7 +668,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (destination->used < source.used) { return private_fl_string_prepend_nulless(source.string, source.used, destination); @@ -714,7 +706,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; return private_fl_string_prepend_nulless(source.string, source.used, destination); } @@ -728,8 +720,8 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; return private_fl_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -743,8 +735,8 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; return private_fl_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -758,8 +750,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; while (buffer.string[range->start] != seek_to_this) { if (buffer.string[range->start] == f_string_eol[0]) return F_none_eol; @@ -782,8 +774,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; const unsigned short seek_width = f_macro_utf_character_width(seek_to_this); @@ -845,8 +837,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; f_status status = F_none; unsigned short width = 0; @@ -901,8 +893,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; f_status status = F_none; unsigned short width = 0; @@ -957,8 +949,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; while (buffer.string[range->start] != seek_to_this) { range->start++; @@ -979,8 +971,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; const unsigned short seek_width = f_macro_utf_character_width(seek_to_this); @@ -1097,11 +1089,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_string_append(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -1115,11 +1106,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_string_append_nulless(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -1133,11 +1123,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_string_prepend(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -1151,11 +1140,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_string_prepend_nulless(glue, glue_length, destination); - if (F_status_is_error(status)) return status; } @@ -1169,35 +1157,20 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; return private_fl_string_prepend(source, length, destination); } #endif // _di_fl_string_prepend_ -#ifndef _di_fl_string_prepend_nulless_ - f_return_status fl_string_prepend_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination) { - #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (length == 0) return F_data_not; - - return private_fl_string_prepend_nulless(source, length, destination); - } -#endif // _di_fl_string_prepend_nulless_ - #ifndef _di_fl_string_prepend_assure_ f_return_status fl_string_prepend_assure(const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; - - if (destination->used < length) { - return private_fl_string_prepend(source, length, destination); - } + if (length == 0) return F_data_not_eos; + if (destination->used < length) return private_fl_string_prepend(source, length, destination); f_string_length i = 0; f_string_length j = 0; @@ -1213,9 +1186,7 @@ extern "C" { continue; } - if (source[i] != destination->string[i]) { - return private_fl_string_prepend(source, length, destination); - } + if (source[i] != destination->string[i]) return private_fl_string_prepend(source, length, destination); i++; j++; @@ -1231,11 +1202,8 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; - - if (destination->used < length) { - return private_fl_string_prepend_nulless(source, length, destination); - } + if (length == 0) return F_data_not_eos; + if (destination->used < length) return private_fl_string_prepend_nulless(source, length, destination); f_string_length i = 0; f_string_length j = 0; @@ -1251,9 +1219,7 @@ extern "C" { continue; } - if (source[i] != destination->string[i]) { - return private_fl_string_prepend_nulless(source, length, destination); - } + if (source[i] != destination->string[i]) return private_fl_string_prepend_nulless(source, length, destination); i++; j++; @@ -1263,13 +1229,25 @@ extern "C" { } #endif // _di_fl_string_prepend_assure_nulless_ +#ifndef _di_fl_string_prepend_nulless_ + f_return_status fl_string_prepend_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination) { + #ifndef _di_level_1_parameter_checking_ + if (destination == 0) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (length == 0) return F_data_not_eos; + + return private_fl_string_prepend_nulless(source, length, destination); + } +#endif // _di_fl_string_prepend_nulless_ + #ifndef _di_fl_string_rip_ f_return_status fl_string_rip(const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; f_string_length begin = 0; f_string_length end = length - 1; @@ -1289,7 +1267,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; f_string_length begin = 0; f_string_length end = length - 1; @@ -1309,7 +1287,7 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) return F_data_not_stop; while (string[range->start] != seek_to_this) { if (string[range->start] == f_string_eol[0]) return F_none_eol; @@ -1329,7 +1307,7 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) return F_data_not_stop; const unsigned short seek_width = f_macro_utf_character_width(seek_to_this); @@ -1380,7 +1358,7 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) return F_data_not_stop; f_status status = F_none; unsigned short width = 0; @@ -1423,7 +1401,7 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) return F_data_not_stop; f_status status = F_none; unsigned short width = 0; @@ -1469,7 +1447,7 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) return F_data_not_stop; while (string[range->start] != seek_to_this) { range->start++; @@ -1487,7 +1465,7 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) return F_data_not_stop; const unsigned short seek_width = f_macro_utf_character_width(seek_to_this); diff --git a/level_1/fl_string/c/string.h b/level_1/fl_string/c/string.h index 7aac1ba..de125fb 100644 --- a/level_1/fl_string/c/string.h +++ b/level_1/fl_string/c/string.h @@ -9,7 +9,7 @@ * * UTF-8 is handled within these functions via normal string characters (f_string). * Unlike f_utf_string, these f_string base functions do not force padding of ASCII or UTF-8 characters. - * An ASCII character is 1-byte and a 4-byte wide UTF-8 character is 4-byte. + * With f_string, a 1-byte wide ASCII character is stored as 1 byte and a 4-byte wide UTF-8 character is stored as 4 bytes. * * This shortens the size of the string at the cost of complexity vs f_utf_string. * @@ -46,11 +46,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_append_ extern f_return_status fl_string_append(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -70,11 +70,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_append_assure_ extern f_return_status fl_string_append_assure(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -95,11 +95,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_append_assure_nulless_ extern f_return_status fl_string_append_assure_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -119,11 +119,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_append_nulless_ extern f_return_status fl_string_append_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -173,6 +173,10 @@ extern "C" { * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_whitespace(). + * + * @see f_utf_is_whitespace() */ #ifndef _di_fl_string_compare_trim_ extern f_return_status fl_string_compare_trim(const f_string string1, const f_string string2, const f_string_length length1, const f_string_length length2); @@ -188,11 +192,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_append_ extern f_return_status fl_string_dynamic_append(const f_string_static source, f_string_dynamic *destination); @@ -208,11 +212,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_append_assure_ extern f_return_status fl_string_dynamic_append_assure(const f_string_static source, f_string_dynamic *destination); @@ -230,11 +234,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_append_assure_nulless_ extern f_return_status fl_string_dynamic_append_assure_nulless(const f_string_static source, f_string_dynamic *destination); @@ -252,11 +256,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_append_nulless_ extern f_return_status fl_string_dynamic_append_nulless(const f_string_static source, f_string_dynamic *destination); @@ -298,6 +302,10 @@ extern "C" { * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_whitespace(). + * + * @see f_utf_is_whitespace() */ #ifndef _di_fl_string_dynamic_compare_trim_ extern f_return_status fl_string_dynamic_compare_trim(const f_string_static string1, const f_string_static string2); @@ -319,15 +327,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. - * - * Errors from (with error bit): f_utf_is_graph(). - * - * @see f_utf_is_graph() + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_mash_ extern f_return_status fl_string_dynamic_mash(const f_string glue, const f_string_length glue_length, const f_string_static source, f_string_dynamic *destination); @@ -351,11 +355,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_mash_nulless_ extern f_return_status fl_string_dynamic_mash_nulless(const f_string glue, const f_string_length glue_length, const f_string_static source, f_string_dynamic *destination); @@ -377,11 +381,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_mish_ extern f_return_status fl_string_dynamic_mish(const f_string glue, const f_string_length glue_length, const f_string_static source, f_string_dynamic *destination); @@ -405,11 +409,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_mish_nulless_ extern f_return_status fl_string_dynamic_mish_nulless(const f_string glue, const f_string_length glue_length, const f_string_static source, f_string_dynamic *destination); @@ -427,11 +431,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_append_ extern f_return_status fl_string_dynamic_partial_append(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -451,11 +456,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_append_assure_ extern f_return_status fl_string_dynamic_partial_append_assure(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -477,11 +483,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_append_assure_nulless_ extern f_return_status fl_string_dynamic_partial_append_assure_nulless(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -501,11 +508,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_append_nulless_ extern f_return_status fl_string_dynamic_partial_append_nulless(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -555,6 +563,10 @@ extern "C" { * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_whitespace(). + * + * @see f_utf_is_whitespace() */ #ifndef _di_fl_string_dynamic_partial_compare_trim_ extern f_return_status fl_string_dynamic_partial_compare_trim(const f_string_static string1, const f_string_static string2, const f_string_range range1, const f_string_range range2); @@ -578,11 +590,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_mash_ extern f_return_status fl_string_dynamic_partial_mash(const f_string glue, const f_string_length glue_length, const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -608,11 +621,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_mash_nulless_ extern f_return_status fl_string_dynamic_partial_mash_nulless(const f_string glue, const f_string_length glue_length, const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -636,11 +650,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_mish_ extern f_return_status fl_string_dynamic_partial_mish(const f_string glue, const f_string_length glue_length, const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -666,11 +681,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_mish_nulless_ extern f_return_status fl_string_dynamic_partial_mish_nulless(const f_string glue, const f_string_length glue_length, const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -690,11 +706,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_prepend_ extern f_return_status fl_string_dynamic_partial_prepend(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -716,11 +733,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_prepend_assure_ extern f_return_status fl_string_dynamic_partial_prepend_assure(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -742,11 +760,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_prepend_assure_nulless_ extern f_return_status fl_string_dynamic_partial_prepend_assure_nulless(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -766,11 +785,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_prepend_nulless_ extern f_return_status fl_string_dynamic_partial_prepend_nulless(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -788,11 +808,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_prepend_ extern f_return_status fl_string_dynamic_prepend(const f_string_static source, f_string_dynamic *destination); @@ -812,11 +833,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_prepend_assure_ extern f_return_status fl_string_dynamic_prepend_assure(const f_string_static source, f_string_dynamic *destination); @@ -836,11 +858,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_prepend_assure_nulless_ extern f_return_status fl_string_dynamic_prepend_assure_nulless(const f_string_static source, f_string_dynamic *destination); @@ -858,11 +881,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_prepend_nulless_ extern f_return_status fl_string_dynamic_prepend_nulless(const f_string_static source, f_string_dynamic *destination); @@ -883,11 +907,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_rip_ extern f_return_status fl_string_dynamic_rip(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -910,7 +935,8 @@ extern "C" { * * @return * F_none on success. - * F_data_not if nothing to rip, no allocations or reallocations are performed. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. @@ -935,6 +961,8 @@ extern "C" { * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_dynamic_seek_line_to_ @@ -956,6 +984,8 @@ extern "C" { * F_none on success. * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. @@ -984,6 +1014,8 @@ extern "C" { * F_none on success. * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. @@ -1014,6 +1046,8 @@ extern "C" { * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. @@ -1021,9 +1055,9 @@ extern "C" { * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. * - * Errors from (with error bit): f_utf_is_whitespace(). + * Errors from (with error bit): f_utf_is_graph(). * - * @see f_utf_is_whitespace() + * @see f_utf_is_graph() */ #ifndef _di_fl_string_dynamic_seek_line_until_non_graph_ extern f_return_status fl_string_dynamic_seek_line_until_non_graph(const f_string_static buffer, f_string_range *range, const int8_t placeholder); @@ -1044,6 +1078,8 @@ extern "C" { * F_none on success. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. @@ -1068,6 +1104,8 @@ extern "C" { * F_none on success. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. @@ -1144,11 +1182,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_mash_ extern f_return_status fl_string_mash(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1174,11 +1212,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_mash_nulless_ extern f_return_status fl_string_mash_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1202,11 +1240,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_mish_ extern f_return_status fl_string_mish(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1232,11 +1270,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_mish_nulless_ extern f_return_status fl_string_mish_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1256,11 +1294,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_prepend_ extern f_return_status fl_string_prepend(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1282,11 +1320,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_prepend_assure_ extern f_return_status fl_string_prepend_assure(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1309,11 +1347,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_prepend_assure_nulless_ extern f_return_status fl_string_prepend_assure_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1336,11 +1374,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_prepend_nulless_ extern f_return_status fl_string_prepend_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1361,10 +1399,14 @@ extern "C" { * * @return * F_none on success. - * F_data_not if nothing to rip, no allocations or reallocations are performed. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_whitespace(). + * + * @see f_utf_is_whitespace() */ #ifndef _di_fl_string_rip_ extern f_return_status fl_string_rip(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1387,10 +1429,14 @@ extern "C" { * * @return * F_none on success. - * F_data_not if nothing to rip, no allocations or reallocations are performed. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_whitespace(). + * + * @see f_utf_is_whitespace() */ #ifndef _di_fl_string_rip_nulless_ extern f_return_status fl_string_rip_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1411,6 +1457,7 @@ extern "C" { * F_none on success. * 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_fl_string_seek_line_to_ @@ -1431,6 +1478,7 @@ extern "C" { * @return * F_none on success. * F_none_eol on success, but stopped at EOL. + * F_data_not_stop if range.start > range.stop. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_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. @@ -1458,6 +1506,7 @@ extern "C" { * @return * F_none on success. * F_none_eol on success, but stopped at EOL. + * F_data_not_stop if range.start > range.stop. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_allocation (with error bit) on memory allocation error. @@ -1487,6 +1536,7 @@ extern "C" { * F_none on success. * 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_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_allocation (with error bit) on memory allocation error. @@ -1515,6 +1565,7 @@ extern "C" { * @return * F_none on success. * F_none_stop on success, but stopped stop location. + * F_data_not_stop if range.start > range.stop. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_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. @@ -1537,6 +1588,7 @@ extern "C" { * @return * F_none on success. * F_none_stop on success, but stopped stop location. + * F_data_not_stop if range.start > range.stop. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_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_1/fl_utf/c/private-utf.c b/level_1/fl_utf/c/private-utf.c index b61ea75..18fc24c 100644 --- a/level_1/fl_utf/c/private-utf.c +++ b/level_1/fl_utf/c/private-utf.c @@ -7,6 +7,7 @@ extern "C" { #if !defined(_di_fl_utf_string_append_) || !defined(_di_fl_utf_string_dynamic_append_) || !defined(_di_fl_utf_string_append_mash_) || !defined(_di_fl_utf_string_dynamic_mash_) f_return_status private_fl_utf_string_append(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { + if (destination->used + length > f_utf_string_max_size) return F_status_set_error(F_string_too_large); f_status status = F_none; @@ -27,6 +28,7 @@ extern "C" { #if !defined(_di_fl_utf_string_append_nulless_) || !defined(_di_fl_utf_string_dynamic_append_nulless_) || !defined(_di_fl_utf_string_mash_nulless_) || !defined(_di_fl_utf_string_dynamic_mash_nulless_) f_return_status private_fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { + if (destination->used + length > f_utf_string_max_size) return F_status_set_error(F_string_too_large); f_status status = F_none; @@ -235,7 +237,10 @@ extern "C" { #if !defined(_di_fl_utf_string_prepend_) || !defined(_di_fl_utf_string_dynamic_prepend_) f_return_status private_fl_utf_string_prepend(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { - if (destination->used + length > f_utf_string_max_size) return F_status_set_error(F_string_too_large); + + if (destination->used + length > f_utf_string_max_size) { + return F_status_set_error(F_string_too_large); + } f_status status = F_none; @@ -261,7 +266,10 @@ extern "C" { #if !defined(_di_fl_utf_string_prepend_nulless_) || !defined(_di_fl_utf_string_dynamic_prepend_nulless_) f_return_status private_fl_utf_string_prepend_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { - if (destination->used + length > f_utf_string_max_size) return F_status_set_error(F_string_too_large); + + if (destination->used + length > f_utf_string_max_size) { + return F_status_set_error(F_string_too_large); + } f_status status = F_none; @@ -271,11 +279,13 @@ extern "C" { for (f_utf_string_length i = 0; i <= length; i++) { if (i == length) { if (i > first) { - f_utf_string_length size = i - first; + const f_utf_string_length size = i - first; - if (destination->used + size > f_utf_string_max_size) return F_status_set_error(F_string_too_large); + if (destination->used + size > f_utf_string_max_size) { + return F_status_set_error(F_string_too_large); + } - f_utf_string_length total = destination->used + size; + const f_utf_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); @@ -295,11 +305,13 @@ extern "C" { if (source[i] == f_utf_character_eos) { if (i > 0) { if (i > first) { - f_utf_string_length size = i - first; + const f_utf_string_length size = i - first; - if (destination->used + size > f_utf_string_max_size) return F_status_set_error(F_string_too_large); + if (destination->used + size > f_utf_string_max_size) { + return F_status_set_error(F_string_too_large); + } - f_utf_string_length total = destination->used + size; + const f_utf_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); @@ -330,7 +342,6 @@ extern "C" { #if !defined(_di_fl_utf_string_rip_) || !defined(_di_fl_utf_string_dynamic_rip_) || !defined(_di_fl_utf_string_rip_nulless_) || !defined(_di_fl_utf_string_dynamic_rip_nulless_) f_return_status private_fl_utf_string_rip_find_range(const f_utf_string source, f_utf_string_length *start, f_utf_string_length *stop) { - f_utf_string_length stop_original = *stop; f_status status = F_none; @@ -342,7 +353,9 @@ extern "C" { status = f_utf_character_is_whitespace(source[*start]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); + if (F_status_set_fine(status) == F_maybe) { + return F_status_set_error(F_utf); + } return status; } @@ -360,7 +373,9 @@ extern "C" { status = f_utf_character_is_whitespace(source[*stop]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); + if (F_status_set_fine(status) == F_maybe) { + return F_status_set_error(F_utf); + } return status; } @@ -371,7 +386,9 @@ extern "C" { if (*stop == *start) { status = f_utf_character_is_whitespace(source[*stop]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); + if (F_status_set_fine(status) == F_maybe) { + return F_status_set_error(F_utf); + } return status; } diff --git a/level_1/fl_utf/c/private-utf.h b/level_1/fl_utf/c/private-utf.h index db0536e..64dc400 100644 --- a/level_1/fl_utf/c/private-utf.h +++ b/level_1/fl_utf/c/private-utf.h @@ -31,10 +31,11 @@ extern "C" { * * @return * F_none on success. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. * * @see fl_utf_string_append() * @see fl_utf_string_mash() @@ -59,10 +60,11 @@ extern "C" { * * @return * F_none on success. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. * * @see fl_utf_string_append_nulless() * @see fl_utf_string_mash_nulless() @@ -149,10 +151,10 @@ extern "C" { * * @return * F_none on success. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. * * @see fl_utf_string_prepend() * @see fl_utf_string_dynamic_prepend() @@ -175,10 +177,10 @@ extern "C" { * * @return * F_none on success. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * F_string_too_large (with error bit) if the combined string is too large. * * @see fl_utf_string_prepend_nulless() * @see fl_utf_string_dynamic_prepend_nulless() @@ -204,9 +206,9 @@ extern "C" { * @return * F_none on success. * F_data_not on success but only whitespace found. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. * * @see fl_utf_string_dynamic_rip() * @see fl_utf_string_rip() diff --git a/level_1/fl_utf/c/utf.c b/level_1/fl_utf/c/utf.c index 217e437..958d3ad 100644 --- a/level_1/fl_utf/c/utf.c +++ b/level_1/fl_utf/c/utf.c @@ -11,31 +11,19 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; return private_fl_utf_string_append(source, length, destination); } #endif // _di_fl_utf_string_append_ -#ifndef _di_fl_utf_string_append_nulless_ - f_return_status fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { - #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (length == 0) return F_data_not; - - return private_fl_utf_string_append_nulless(source, length, destination); - } -#endif // _di_fl_utf_string_append_nulless_ - #ifndef _di_fl_utf_string_append_assure_ f_return_status fl_utf_string_append_assure(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (destination->used < length) { return private_fl_utf_string_append(source, length, destination); @@ -73,7 +61,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (destination->used < length) { return private_fl_utf_string_append_nulless(source, length, destination); @@ -105,24 +93,26 @@ extern "C" { } #endif // _di_fl_utf_string_append_assure_nulless_ -#ifndef _di_fl_utf_string_compare_ - f_return_status fl_utf_string_compare(const f_utf_string string1, const f_utf_string string2, const f_utf_string_length length1, const f_utf_string_length length2) { +#ifndef _di_fl_utf_string_append_nulless_ + f_return_status fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ - if (length1 == 0) return F_status_set_error(F_parameter); - if (length2 == 0) return F_status_set_error(F_parameter); + if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ + if (length == 0) return F_data_not_eos; + + return private_fl_utf_string_append_nulless(source, length, destination); + } +#endif // _di_fl_utf_string_append_nulless_ + +#ifndef _di_fl_utf_string_compare_ + f_return_status fl_utf_string_compare(const f_utf_string string1, const f_utf_string string2, const f_utf_string_length length1, const f_utf_string_length length2) { return private_fl_utf_string_compare(string1, string2, 0, 0, length1, length2); } #endif // _di_fl_utf_string_compare_ #ifndef _di_fl_utf_string_compare_trim_ f_return_status fl_utf_string_compare_trim(const f_utf_string string1, const f_utf_string string2, const f_utf_string_length length1, const f_utf_string_length length2) { - #ifndef _di_level_1_parameter_checking_ - if (length1 == 0) return F_status_set_error(F_parameter); - if (length2 == 0) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - return private_fl_utf_string_compare_trim(string1, string2, 0, 0, length1, length2); } #endif // _di_fl_utf_string_compare_trim_ @@ -133,7 +123,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; return private_fl_utf_string_append(source.string, source.used, destination); } @@ -145,7 +135,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (destination->used < source.used) { return private_fl_utf_string_append(source.string, source.used, destination); @@ -183,7 +173,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (destination->used < source.used) { return private_fl_utf_string_append_nulless(source.string, source.used, destination); @@ -221,26 +211,35 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; return private_fl_utf_string_append_nulless(source.string, source.used, destination); } #endif // _di_fl_utf_string_dynamic_append_nulless_ +#ifndef _di_fl_utf_string_dynamic_compare_ + f_return_status fl_utf_string_dynamic_compare(const f_utf_string_static string1, const f_utf_string_static string2) { + return private_fl_utf_string_compare(string1.string, string2.string, 0, 0, string1.used, string2.used); + } +#endif // _di_fl_utf_string_dynamic_compare_ + +#ifndef _di_f_utf_string_dynamic_compare_trim_ + f_return_status f_utf_string_dynamic_compare_trim(const f_utf_string_static string1, const f_utf_string_static string2) { + return private_fl_utf_string_compare_trim(string1.string, string2.string, 0, 0, string1.used, string2.used); + } +#endif // _di_f_utf_string_dynamic_compare_trim_ + #ifndef _di_fl_utf_string_dynamic_mash_ f_return_status fl_utf_string_dynamic_mash(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string_static source, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_append(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + const f_status status = private_fl_utf_string_append(glue, glue_length, destination); + if (F_status_is_error(status)) return status; } return private_fl_utf_string_append(source.string, source.used, destination); @@ -253,14 +252,11 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_append_nulless(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + const f_status status = private_fl_utf_string_append_nulless(glue, glue_length, destination); + if (F_status_is_error(status)) return status; } return private_fl_utf_string_append_nulless(source.string, source.used, destination); @@ -273,14 +269,11 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_prepend(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + const f_status status = private_fl_utf_string_prepend(glue, glue_length, destination); + if (F_status_is_error(status)) return status; } return private_fl_utf_string_prepend(source.string, source.used, destination); @@ -293,32 +286,17 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_prepend_nulless(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + const f_status status = private_fl_utf_string_prepend_nulless(glue, glue_length, destination); + if (F_status_is_error(status)) return status; } return private_fl_utf_string_prepend_nulless(source.string, source.used, destination); } #endif // _di_fl_utf_string_dynamic_mish_nulless_ -#ifndef _di_fl_utf_string_dynamic_compare_ - f_return_status fl_utf_string_dynamic_compare(const f_utf_string_static string1, const f_utf_string_static string2) { - return private_fl_utf_string_compare(string1.string, string2.string, 0, 0, string1.used, string2.used); - } -#endif // _di_fl_utf_string_dynamic_compare_ - -#ifndef _di_f_utf_string_dynamic_compare_trim_ - f_return_status f_utf_string_dynamic_compare_trim(const f_utf_string_static string1, const f_utf_string_static string2) { - return private_fl_utf_string_compare_trim(string1.string, string2.string, 0, 0, string1.used, string2.used); - } -#endif // _di_f_utf_string_dynamic_compare_trim_ - #ifndef _di_fl_utf_string_dynamic_partial_append_ f_return_status fl_utf_string_dynamic_partial_append(const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ @@ -326,8 +304,8 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -340,10 +318,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; - f_utf_string_length length = (range.stop - range.start) + 1; + const f_utf_string_length length = (range.stop - range.start) + 1; if (destination->used < length) { return private_fl_utf_string_append(source.string + range.start, length, destination); @@ -380,10 +358,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; - f_utf_string_length length = (range.stop - range.start) + 1; + const f_utf_string_length length = (range.stop - range.start) + 1; if (destination->used < length) { return private_fl_utf_string_append_nulless(source.string + range.start, length, destination); @@ -420,8 +398,8 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -456,15 +434,12 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_utf_string_append(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } return private_fl_utf_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -478,15 +453,12 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_utf_string_append_nulless(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } return private_fl_utf_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -500,15 +472,12 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_utf_string_prepend(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } return private_fl_utf_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -522,15 +491,12 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_utf_string_prepend_nulless(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } return private_fl_utf_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -544,8 +510,8 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -558,10 +524,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; - f_utf_string_length length = (range.stop - range.start) + 1; + const f_utf_string_length length = (range.stop - range.start) + 1; if (destination->used < length) { return private_fl_utf_string_prepend(source.string + range.start, length, destination); @@ -600,10 +566,10 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; - f_utf_string_length length = (range.stop - range.start) + 1; + const f_utf_string_length length = (range.stop - range.start) + 1; if (destination->used < length) { return private_fl_utf_string_prepend_nulless(source.string + range.start, length, destination); @@ -642,8 +608,8 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -655,7 +621,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; return private_fl_utf_string_prepend(source.string, source.used, destination); } @@ -667,7 +633,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (destination->used < source.used) { return private_fl_utf_string_prepend(source.string, source.used, destination); @@ -705,7 +671,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; if (destination->used < source.used) { return private_fl_utf_string_prepend_nulless(source.string, source.used, destination); @@ -743,7 +709,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; + if (source.used == 0) return F_data_not_eos; return private_fl_utf_string_prepend_nulless(source.string, source.used, destination); } @@ -757,8 +723,8 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -772,8 +738,8 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not; - if (range.start > range.stop) return F_data_not; + if (source.used == 0) return F_data_not_eos; + if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -787,8 +753,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); @@ -799,9 +765,7 @@ extern "C" { range->start++; - if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { - return F_status_set_error(F_utf); - } + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) return F_status_set_error(F_utf); if (range->start >= buffer.used) return F_none_eos; if (range->start > range->stop) return F_none_stop; @@ -819,8 +783,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; f_utf_character seek_to_character = seek_to_this << 24; @@ -853,8 +817,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; f_status status = F_none; @@ -863,10 +827,7 @@ extern "C" { } while (buffer.string[range->start] == placeholder || (status = f_utf_character_is_graph(buffer.string[range->start])) == F_false) { - if (F_status_is_error(status)) { - return status; - } - + if (F_status_is_error(status)) return status; if (buffer.string[range->start] == f_utf_character_eol) return F_none_eol; range->start++; @@ -879,9 +840,7 @@ extern "C" { if (range->start > range->stop) return F_none_stop; } // while - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_none; } @@ -895,8 +854,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; f_status status = F_none; @@ -905,10 +864,7 @@ extern "C" { } while (buffer.string[range->start] == placeholder || (status = f_utf_character_is_whitespace(buffer.string[range->start])) == F_false) { - if (F_status_is_error(status)) { - return status; - } - + if (F_status_is_error(status)) return status; if (buffer.string[range->start] == f_utf_character_eol) return F_none_eol; range->start++; @@ -921,9 +877,7 @@ extern "C" { if (range->start > range->stop) return F_none_stop; } // while - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_none; } @@ -937,8 +891,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); @@ -967,8 +921,8 @@ extern "C" { if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (buffer.used == 0) return F_data_not_eos; + if (range->start > range->stop) return F_data_not_stop; f_utf_character seek_to_character = seek_to_this << 24; @@ -998,9 +952,13 @@ extern "C" { if (destination->used > destination->size) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (destination->used > 0 && destination->string[destination->used - 1] == f_utf_character_eos) return F_none; + if (destination->used > 0 && destination->string[destination->used - 1] == f_utf_character_eos) { + return F_none; + } - if (destination->used + 1 > f_utf_string_max_size) return F_status_set_error(F_string_too_large); + if (destination->used + 1 > f_utf_string_length_size) { + return F_status_set_error(F_string_too_large); + } const f_utf_string_length total = destination->used + 1; @@ -1018,20 +976,51 @@ extern "C" { } #endif // _di_fl_utf_string_dynamic_terminate_ +#ifndef _di_fl_utf_string_dynamic_terminate_after_ + f_return_status fl_utf_string_dynamic_terminate_after(f_utf_string_dynamic *destination) { + #ifndef _di_level_1_parameter_checking_ + if (destination == 0) return F_status_set_error(F_parameter); + if (destination->used > destination->size) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (destination->used > 0) { + for (; destination->used > 0; destination->used--) { + if (destination->string[destination->used - 1] == 0) continue; + break; + } // for + } + + if (destination->used + 1 > f_utf_string_length_size) { + return F_status_set_error(F_string_too_large); + } + + const f_utf_string_length total = destination->used + 1; + + if (total > destination->size) { + f_status status = F_none; + + f_macro_string_dynamic_resize(status, (*destination), total); + if (F_status_is_error(status)) return status; + } + + destination->string[destination->used] = 0; + destination->used = total - 1; + + return F_none; + } +#endif // _di_fl_utf_string_dynamic_terminate_after_ + #ifndef _di_fl_utf_string_mash_ f_return_status fl_utf_string_mash(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_utf_string_append(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } return private_fl_utf_string_append(source, length, destination); @@ -1044,14 +1033,11 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_utf_string_append_nulless(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } return private_fl_utf_string_append_nulless(source, length, destination); @@ -1064,14 +1050,11 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_utf_string_prepend(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } return private_fl_utf_string_prepend(source, length, destination); @@ -1084,14 +1067,11 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status status = private_fl_utf_string_prepend_nulless(glue, glue_length, destination); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } return private_fl_utf_string_prepend_nulless(source, length, destination); @@ -1104,7 +1084,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; return private_fl_utf_string_prepend(source, length, destination); } @@ -1116,7 +1096,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (destination->used < length) { return private_fl_utf_string_prepend(source, length, destination); @@ -1154,7 +1134,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; if (destination->used < length) { return private_fl_utf_string_prepend_nulless(source, length, destination); @@ -1192,7 +1172,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; return private_fl_utf_string_prepend_nulless(source, length, destination); } @@ -1204,7 +1184,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; f_utf_string_length begin = 0; f_utf_string_length end = length - 1; @@ -1224,7 +1204,7 @@ extern "C" { if (destination == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not; + if (length == 0) return F_data_not_eos; f_utf_string_length begin = 0; f_utf_string_length end = length - 1; @@ -1244,7 +1224,7 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) return F_data_not_stop; if (f_macro_utf_character_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf); @@ -1272,12 +1252,10 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) return F_data_not_stop; f_utf_character seek_to_character = seek_to_this << 24; - f_status status = F_none; - for (; range->start <= range->stop; range->start++) { if (f_macro_utf_character_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf); @@ -1297,7 +1275,7 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) return F_data_not_stop; f_status status = F_none; @@ -1306,10 +1284,7 @@ extern "C" { } while (string[range->start] == placeholder || (status = f_utf_character_is_graph(string[range->start])) == F_false) { - if (F_status_is_error(status)) { - return status; - } - + if (F_status_is_error(status)) return status; if (string[range->start] == f_utf_character_eol) return F_none_eol; range->start++; @@ -1321,9 +1296,7 @@ extern "C" { if (range->start > range->stop) return F_none_stop; } // while - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_none; } @@ -1335,19 +1308,14 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) return F_data_not_stop; f_status status = F_none; - if (f_macro_utf_character_width_is(string[range->start]) == 1) { - return F_status_set_error(F_utf); - } - - while (string[range->start] == placeholder || (status = f_utf_character_is_whitespace(string[range->start])) == F_false) { - if (F_status_is_error(status)) { - return status; - } + if (f_macro_utf_character_width_is(string[range->start]) == 1) return F_status_set_error(F_utf); + while (string[range->start] == placeholder || (status = f_utf_character_is_graph(string[range->start])) == F_true) { + if (F_status_is_error(status)) return status; if (string[range->start] == f_utf_character_eol) return F_none_eol; range->start++; @@ -1359,9 +1327,7 @@ extern "C" { if (range->start > range->stop) return F_none_stop; } // while - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_none; } @@ -1373,7 +1339,7 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) return F_data_not_stop; if (f_macro_utf_character_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf); @@ -1399,11 +1365,9 @@ extern "C" { if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_none_stop; - - f_utf_character seek_to_character = seek_to_this << 24; + if (range->start > range->stop) return F_data_not_stop; - f_status status = F_none; + const f_utf_character seek_to_character = seek_to_this << 24; if (f_macro_utf_character_width_is(string[0]) == 1) { return F_status_set_error(F_utf); diff --git a/level_1/fl_utf/c/utf.h b/level_1/fl_utf/c/utf.h index 9080747..d5e8f3d 100644 --- a/level_1/fl_utf/c/utf.h +++ b/level_1/fl_utf/c/utf.h @@ -9,7 +9,7 @@ * * UTF-8 is handled within these functions via padded string characters (f_utf_string). * Unlike f_string, these f_utf_string base functions force padding of ASCII or UTF-8 characters. - * An ASCII character is 4-byte and a 4-byte wide UTF-8 character is 4-byte. + * With f_utf_string, a 1-byte wide ASCII character is stored as 4 bytes and a 4-byte wide UTF-8 character is stored as 4 bytes. * * This simplifies traversing the strings at the cost of size vs f_string. * @@ -39,111 +39,96 @@ extern "C" { * * @param source * The source string to append. - * @param start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of 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 if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_append_nulless() + * 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_fl_utf_string_append_ extern f_return_status fl_utf_string_append(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_append_ /** - * Append the source UTF-8 string onto the destination. + * Append the source UTF-8 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 start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of 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 if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_append_assure() + * 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_fl_utf_string_append_nulless_ - extern f_return_status fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); -#endif // _di_fl_utf_string_append_nulless_ +#ifndef _di_fl_utf_string_append_assure_ + extern f_return_status fl_utf_string_append_assure(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); +#endif // _di_fl_utf_string_append_assure_ /** - * Append the source UTF-8 string onto the destination, but only if the string is not already at the end. + * Append the UTF-8 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 start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of 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 if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_append_assure_nulless() + * 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_fl_utf_string_append_assure_ - extern f_return_status fl_utf_string_append_assure(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); -#endif // _di_fl_utf_string_append_assure_ +#ifndef _di_fl_utf_string_append_assure_nulless_ + extern f_return_status fl_utf_string_append_assure_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); +#endif // _di_fl_utf_string_append_assure_nulless_ /** - * Append the source UTF-8 string onto the destination, but only if the string is not already at the end. + * Append the UTF-8 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 append. - * @param start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of 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 if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_append() + * 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_fl_utf_string_append_assure_nulless_ - extern f_return_status fl_utf_string_append_assure_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); -#endif // _di_fl_utf_string_append_assure_nulless_ +#ifndef _di_fl_utf_string_append_nulless_ + extern f_return_status fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); +#endif // _di_fl_utf_string_append_nulless_ /** * Compare two UTF-8 strings, similar to strncmp(). @@ -163,13 +148,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. - * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_utf_string_dynamic_compare() - * @see fl_utf_string_dynamic_compare_trim() - * @see fl_utf_string_dynamic_partial_compare() - * @see fl_utf_string_dynamic_partial_compare_trim() */ #ifndef _di_fl_utf_string_compare_ extern f_return_status fl_utf_string_compare(const f_utf_string string1, const f_utf_string string2, const f_utf_string_length length1, const f_utf_string_length length2); @@ -194,20 +173,18 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. - * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. * F_parameter (with error bit) if a parameter is invalid. * - * @see fl_utf_string_dynamic_compare() - * @see fl_utf_string_dynamic_compare_trim() - * @see fl_utf_string_dynamic_partial_compare() - * @see fl_utf_string_dynamic_partial_compare_trim() + * Errors from (with error bit): f_utf_character_is_whitespace(). + * + * @see f_utf_character_is_whitespace() */ #ifndef _di_fl_utf_string_compare_trim_ extern f_return_status fl_utf_string_compare_trim(const f_utf_string string1, const f_utf_string string2, const f_utf_string_length length1, const f_utf_string_length length2); #endif // _di_fl_utf_string_compare_trim_ /** - * Append the source UTF-8 string onto the destination. + * Append the UTF-8 source string onto the destination. * * @param source * The source string to append. @@ -216,22 +193,18 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_append_nulless() + * 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_fl_utf_string_dynamic_append_ extern f_return_status fl_utf_string_dynamic_append(const f_utf_string_static source, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_append_ /** - * Append the source UTF-8 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. + * Append the UTF-8 source string onto the destination. * * @param source * The source string to append. @@ -240,22 +213,19 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_append_assure_nulless() + * 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_fl_utf_string_dynamic_append_assure_ extern f_return_status fl_utf_string_dynamic_append_assure(const f_utf_string_static source, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_append_assure_ /** - * Append the source UTF-8 string onto the destination, but only if the string is not already at the end. + * Append the UTF-8 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 @@ -265,20 +235,18 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_append_assure() + * 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_fl_utf_string_dynamic_append_assure_nulless_ extern f_return_status fl_utf_string_dynamic_append_assure_nulless(const f_utf_string_static source, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_append_assure_nulless_ /** - * Append the source UTF-8 string onto the destination. + * Append the UTF-8 source string onto the destination. * * Skips over NULL characters from source when appending. * @@ -289,13 +257,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_append() + * 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_fl_utf_string_dynamic_append_nulless_ extern f_return_status fl_utf_string_dynamic_append_nulless(const f_utf_string_static source, f_utf_string_dynamic *destination); @@ -315,13 +281,8 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. - * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_utf_string_compare() - * @see fl_utf_string_compare_trim() - * @see fl_utf_string_dynamic_partial_compare() - * @see fl_utf_string_dynamic_partial_compare_trim() + * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. */ #ifndef _di_fl_utf_string_dynamic_compare_ extern f_return_status fl_utf_string_dynamic_compare(const f_utf_string_static string1, const f_utf_string_static string2); @@ -342,13 +303,12 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. - * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. + * + * Errors from (with error bit): f_utf_character_is_whitespace(). * - * @see fl_utf_string_compare() - * @see fl_utf_string_compare_trim() - * @see fl_utf_string_dynamic_partial_compare() - * @see fl_utf_string_dynamic_partial_compare_trim() + * @see f_utf_character_is_whitespace() */ #ifndef _di_f_utf_string_dynamic_compare_trim_ extern f_return_status f_utf_string_dynamic_compare_trim(const f_utf_string_static string1, const f_utf_string_static string2); @@ -370,14 +330,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_mash() - * @see fl_utf_string_dynamic_mash() + * 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_fl_utf_string_dynamic_mash_ extern f_return_status fl_utf_string_dynamic_mash(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string_static source, f_utf_string_dynamic *destination); @@ -401,14 +358,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_mash_nulless() - * @see fl_utf_string_dynamic_mash_nulless() + * 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_fl_utf_string_dynamic_mash_nulless_ extern f_return_status fl_utf_string_dynamic_mash_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string_static source, f_utf_string_dynamic *destination); @@ -430,14 +384,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_mish() - * @see fl_utf_string_dynamic_mish() + * 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_fl_utf_string_dynamic_mish_ extern f_return_status fl_utf_string_dynamic_mish(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string_static source, f_utf_string_dynamic *destination); @@ -461,21 +412,18 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_mish_nulless() - * @see fl_utf_string_dynamic_mish_nulless() + * 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_fl_utf_string_dynamic_mish_nulless_ extern f_return_status fl_utf_string_dynamic_mish_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string_static source, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_mish_nulless_ /** - * Append the source UTF-8 string onto the destination, but restricted to the given range. + * Append the UTF-8 source string onto the destination, but restricted to the given range. * * @param source * The source string to append. @@ -486,20 +434,21 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_partial_append_nulless() + * 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_fl_utf_string_dynamic_partial_append_ extern f_return_status fl_utf_string_dynamic_partial_append(const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_partial_append_ /** - * Append the source UTF-8 string onto the destination, but restricted to the given range. + * Append the UTF-8 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. @@ -510,22 +459,22 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_partial_append_assure_nulless() + * 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_fl_utf_string_dynamic_partial_append_assure_ extern f_return_status fl_utf_string_dynamic_partial_append_assure(const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_partial_append_assure_ /** - * Append the source UTF-8 string onto the destination, but only if the string is not already at the end and restricted to the given range + * Append the UTF-8 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 @@ -537,22 +486,20 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_partial_append_assure() + * 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_fl_utf_string_dynamic_partial_append_assure_nulless_ extern f_return_status fl_utf_string_dynamic_partial_append_assure_nulless(const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_partial_append_assure_nulless_ /** - * Append the source UTF-8 string onto the destination, but only if the string is not already at the end and restricted to the given range + * Append the UTF-8 source string onto the destination, but 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 @@ -564,13 +511,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_partial_append() + * 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_fl_utf_string_dynamic_partial_append_nulless_ extern f_return_status fl_utf_string_dynamic_partial_append_nulless(const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); @@ -594,13 +540,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. - * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_utf_string_compare() - * @see fl_utf_string_compare_trim() - * @see fl_utf_string_dynamic_compare() - * @see fl_utf_string_dynamic_compare_trim() */ #ifndef _di_fl_utf_string_dynamic_partial_compare_ extern f_return_status fl_utf_string_dynamic_partial_compare(const f_utf_string_static string1, const f_utf_string_static string2, const f_utf_string_range range1, const f_utf_string_range range2); @@ -625,13 +565,11 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. - * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. * F_parameter (with error bit) if a parameter is invalid. * - * @see fl_utf_string_compare() - * @see fl_utf_string_compare_trim() - * @see fl_utf_string_dynamic_compare() - * @see fl_utf_string_dynamic_compare_trim() + * Errors from (with error bit): f_utf_character_is_whitespace(). + * + * @see f_utf_character_is_whitespace() */ #ifndef _di_fl_utf_string_dynamic_partial_compare_trim_ extern f_return_status fl_utf_string_dynamic_partial_compare_trim(const f_utf_string_static string1, const f_utf_string_static string2, const f_utf_string_range range1, const f_utf_string_range range2); @@ -655,13 +593,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_mash_nulless() + * 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_fl_utf_string_dynamic_partial_mash_ extern f_return_status fl_utf_string_dynamic_partial_mash(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); @@ -687,13 +624,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_partial_mash() + * 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_fl_utf_string_dynamic_partial_mash_nulless_ extern f_return_status fl_utf_string_dynamic_partial_mash_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); @@ -717,13 +653,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_partial_mish_nulless() + * 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_fl_utf_string_dynamic_partial_mish_ extern f_return_status fl_utf_string_dynamic_partial_mish(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); @@ -749,20 +684,19 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_partial_mish() + * 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_fl_utf_string_dynamic_partial_mish_nulless_ extern f_return_status fl_utf_string_dynamic_partial_mish_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_partial_mish_nulless_ /** - * Prepend the source string onto the destination, but restricted to the given range. + * Prepend the UTF-8 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. * @@ -775,20 +709,19 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_partial_prepend_nulless() + * 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_fl_utf_string_dynamic_partial_prepend_ extern f_return_status fl_utf_string_dynamic_partial_prepend(const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_partial_prepend_ /** - * Prepend the source string onto the destination, but restricted to the given range, but only if the string is not already at the beginning. + * Prepend the UTF-8 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. * @@ -803,20 +736,19 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_partial_prepend_assure_nulless() + * 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_fl_utf_string_dynamic_partial_prepend_assure_ extern f_return_status fl_utf_string_dynamic_partial_prepend_assure(const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_partial_prepend_assure_ /** - * Prepend the source string onto the destination, but restricted to the given range, but only if the string is not already at the beginning. + * Prepend the UTF-8 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. * @@ -831,20 +763,19 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_partial_prepend_assure() + * 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_fl_utf_string_dynamic_partial_prepend_assure_nulless_ extern f_return_status fl_utf_string_dynamic_partial_prepend_assure_nulless(const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_partial_prepend_assure_nulless_ /** - * Prepend the source string onto the destination, but restricted to the given range. + * Prepend the UTF-8 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. * @@ -857,13 +788,12 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_partial_prepend() + * 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_fl_utf_string_dynamic_partial_prepend_nulless_ extern f_return_status fl_utf_string_dynamic_partial_prepend_nulless(const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); @@ -881,20 +811,19 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_prepend_nulless() + * 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_fl_utf_string_dynamic_prepend_ extern f_return_status fl_utf_string_dynamic_prepend(const f_utf_string_static source, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_prepend_ /** - * Prepend the source string onto the destination, but only if the string is not already at the beginning. + * Prepend the UTF-8 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. * @@ -907,20 +836,19 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_prepend_assure_nulless() + * 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_fl_utf_string_dynamic_prepend_assure_ extern f_return_status fl_utf_string_dynamic_prepend_assure(const f_utf_string_static source, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_prepend_assure_ /** - * Prepend the source string onto the destination, but only if the string is not already at the beginning. + * Prepend the UTF-8 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. * @@ -933,20 +861,19 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_prepend_assure() + * 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_fl_utf_string_dynamic_prepend_assure_nulless_ extern f_return_status fl_utf_string_dynamic_prepend_assure_nulless(const f_utf_string_static source, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_prepend_assure_nulless_ /** - * Prepend the source string onto the destination. + * Prepend the UTF-8 source string onto the destination. * * Prepend operations require memory move operations and are therefore likely more expensive than append operations. * @@ -957,20 +884,19 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_prepend() + * 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_fl_utf_string_dynamic_prepend_nulless_ extern f_return_status fl_utf_string_dynamic_prepend_nulless(const f_utf_string_static source, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_prepend_nulless_ /** - * Allocate a new string from the provided range in the buffer. + * Allocate a new UTF-8 string from the provided range in the buffer. * * Ignores leading and trailing whitespace. * As a result, resulting size may be smaller than requested range. @@ -984,19 +910,19 @@ extern "C" { * * @return * F_none on success. - * F_data_not if nothing to rip, no allocations or reallocations are performed. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_rip_nulless() + * 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_fl_utf_string_dynamic_rip_ extern f_return_status fl_utf_string_dynamic_rip(const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_dynamic_rip_ /** - * Allocate a new string from the provided range in the buffer. + * Allocate a new UTF-8 string from the provided range in the buffer. * * Ignores leading and trailing whitespace. * As a result, resulting size may be smaller than requested range. @@ -1012,12 +938,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if nothing to rip, no allocations or reallocations are performed. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. + * F_data_not_stop if range.start > range.stop. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_dynamic_rip() + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_utf_string_dynamic_rip_nulless_ extern f_return_status fl_utf_string_dynamic_rip_nulless(const f_utf_string_static source, const f_utf_string_range range, f_utf_string_dynamic *destination); @@ -1039,18 +964,17 @@ extern "C" { * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. - * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_utf_string_dynamic_seek_line_to_char() - * @see fl_utf_string_seek_line_to_char() + * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. */ #ifndef _di_fl_utf_string_dynamic_seek_line_to_ extern f_return_status fl_utf_string_dynamic_seek_line_to(const f_utf_string_static buffer, f_utf_string_range *range, const f_utf_character seek_to_this); #endif // _di_fl_utf_string_dynamic_seek_line_to_ /** - * Seek the buffer location forward until the 1-byte wide character or EOL is reached. + * Seek the buffer location forward until the (1-byte wide) character or EOL is reached. * * @param buffer * The buffer to traverse. @@ -1058,17 +982,16 @@ extern "C" { * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this - * A single-width non-UTF-8 character. + * A single-width character. * * @return * F_none on success. * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. - * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_utf_string_dynamic_seek_line_to() - * @see fl_utf_string_seek_line_to() + * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. */ #ifndef _di_fl_utf_string_seek_line_to_char_ extern f_return_status fl_utf_string_dynamic_seek_line_to_char(const f_utf_string_static buffer, f_utf_string_range *range, const int8_t seek_to_this); @@ -1088,10 +1011,14 @@ extern "C" { * F_none on success. * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. - * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_parameter (with error bit) if a parameter is invalid + * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. + * + * Errors from (with error bit): f_utf_character_is_graph(). * - * @see fl_utf_string_seek_line_until_graph() + * @see f_utf_character_is_graph() */ #ifndef _di_fl_utf_string_dynamic_seek_line_until_graph_ extern f_return_status fl_utf_string_dynamic_seek_line_until_graph(const f_utf_string_static buffer, f_utf_string_range *range, const f_utf_character placeholder); @@ -1112,17 +1039,21 @@ extern "C" { * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. - * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. * - * @see fl_utf_string_seek_line_until_non_graph() + * Errors from (with error bit): f_utf_character_is_graph(). + * + * @see f_utf_character_is_graph() */ #ifndef _di_fl_utf_string_dynamic_seek_line_until_non_graph_ extern f_return_status fl_utf_string_dynamic_seek_line_until_non_graph(const f_utf_string_static buffer, f_utf_string_range *range, const f_utf_character placeholder); #endif // _di_fl_utf_string_dynamic_seek_line_until_non_graph_ /** - * Seek the buffer location forward until the character (1-byte wide) is reached. + * Seek the buffer location forward until the UTF-8 character is reached. * * @param buffer * The buffer to traverse. @@ -1136,19 +1067,17 @@ extern "C" { * F_none on success. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. - * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_utf_string_dynamic_seek_to_char() - * @see fl_utf_string_seek_to() - * @see fl_utf_string_seek_to_char() + * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. */ #ifndef _di_fl_utf_string_dynamic_seek_to_ extern f_return_status fl_utf_string_dynamic_seek_to(const f_utf_string_static buffer, f_utf_string_range *range, const f_utf_character seek_to_this); #endif // _di_fl_utf_string_dynamic_seek_to_ /** - * Seek the buffer location forward until the UTF-8 character (up to 4-byte wide) is reached. + * Seek the buffer location forward until the UTF-8 character (1-byte wide) is reached. * * @param buffer * The buffer to traverse. @@ -1162,19 +1091,17 @@ extern "C" { * F_none on success. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_utf_string_dynamic_seek_to() - * @see fl_utf_string_seek_to() - * @see fl_utf_string_seek_to_char() */ #ifndef _di_fl_utf_string_dynamic_seek_to_char_ extern f_return_status fl_utf_string_dynamic_seek_to_char(const f_utf_string_static buffer, f_utf_string_range *range, const int8_t seek_to_this); #endif // _di_fl_utf_string_dynamic_seek_to_char_ /** - * Seek the buffer location forward until the UTF-8 character (up to 4-byte wide) is reached. + * Seek the buffer location forward until the (4-byte wide) UTF-8 character is reached. * * @param buffer * The buffer to traverse. @@ -1188,15 +1115,13 @@ extern "C" { * F_none on success. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. - * F_utf (with error bit) if character is an invalid UTF-8 character. + * F_data_not_eos if buffer length is 0. + * F_data_not_stop if range.start > range.stop. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. + * F_incomplete_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. - * - * @see fl_utf_string_dynamic_seek_to() - * @see fl_utf_string_seek_to() - * @see fl_utf_string_seek_to_character() + * F_utf (with error bit) if character is an invalid UTF-8 character. */ #ifndef _di_fl_utf_string_dynamic_seek_to_utf_character_ extern f_return_status fl_utf_string_dynamic_seek_to_utf_character(const f_utf_string_static buffer, f_utf_string_range *range, const f_utf_character seek_to_this); @@ -1215,8 +1140,8 @@ extern "C" { * * @return * F_none on success. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_reallocation (with error bit) on memory reallocation error. + * 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_fl_utf_string_dynamic_terminate_ @@ -1224,6 +1149,29 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_terminate_ /** + * Guarantee that an end of string (NULL) exists at the end of the UTF-8 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_reallocation (with error bit) on memory reallocation error. + * 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_fl_utf_string_dynamic_terminate_after_ + extern f_return_status fl_utf_string_dynamic_terminate_after(f_utf_string_dynamic *destination); +#endif // _di_fl_utf_string_dynamic_terminate_after_ + +/** * Append the UTF-8 source string onto the destination with the glue in between. * * If the destination string is empty, then no glue is appended. @@ -1234,22 +1182,18 @@ extern "C" { * The number of bytes the glue takes up. * @param source * The source string to append. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source and glue are appended onto. * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_mash_nulless() + * 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_fl_utf_string_mash_ extern f_return_status fl_utf_string_mash(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); @@ -1268,22 +1212,18 @@ extern "C" { * The number of bytes the glue takes up. * @param source * The source string to append. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source and glue are appended onto. * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_mash() + * 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_fl_utf_string_mash_nulless_ extern f_return_status fl_utf_string_mash_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); @@ -1300,22 +1240,18 @@ extern "C" { * The number of bytes the glue takes up. * @param source * The source string to append. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source and glue are appended onto. * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_mish_nulless() + * 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_fl_utf_string_mish_ extern f_return_status fl_utf_string_mish(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); @@ -1334,22 +1270,18 @@ extern "C" { * The number of bytes the glue takes up. * @param source * The source string to append. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source and glue are appended onto. * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_mish() + * 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_fl_utf_string_mish_nulless_ extern f_return_status fl_utf_string_mish_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); @@ -1362,22 +1294,18 @@ extern "C" { * * @param source * The source string to prepend. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source is prepended onto. * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_prepend_nulless() + * 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_fl_utf_string_prepend_ extern f_return_status fl_utf_string_prepend(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); @@ -1392,22 +1320,18 @@ extern "C" { * * @param source * The source string to prepend. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source is prepended onto. * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_prepend_assure_nulless() + * 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_fl_utf_string_prepend_assure_ extern f_return_status fl_utf_string_prepend_assure(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); @@ -1423,52 +1347,45 @@ extern "C" { * * @param source * The source string to prepend. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source is prepended onto. * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_prepend_assure() + * 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_fl_utf_string_prepend_assure_nulless_ extern f_return_status fl_utf_string_prepend_assure_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_prepend_assure_nulless_ /** - * Prepend the UTF-8 source string onto the destination. + * Prepend the UTF-8 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. * Skips over NULL characters from source when prepending. * * @param source * The source string to prepend. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source is prepended onto. * * @return * F_none on success. - * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_utf_string_prepend() + * 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_fl_utf_string_prepend_nulless_ extern f_return_status fl_utf_string_prepend_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); @@ -1478,25 +1395,25 @@ extern "C" { * Allocate a new UTF-8 string from the provided range in the string. * * Ignores leading and trailing whitespace. - * As a result, resulting size may be smaller than requested range. + * As a result, resulting size may be smaller than requested length. * * @param source * The string to rip from. - * @param start - * An inclusive start location within string. - * @param stop - * An inclusive stop location within string. + * @param length + * The length of source to append. * @param destination * The new string, which will be allocated or reallocated as necessary. * * @return * F_none on success. - * F_data_not if nothing to rip, no allocations or reallocations are performed. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. * - * @see fl_utf_string_rip_nulless() + * Errors from (with error bit): f_utf_character_is_whitespace(). + * + * @see f_utf_character_is_whitespace() */ #ifndef _di_fl_utf_string_rip_ extern f_return_status fl_utf_string_rip(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); @@ -1506,34 +1423,34 @@ extern "C" { * Allocate a new UTF-8 string from the provided range in the string. * * Ignores leading and trailing whitespace. - * As a result, resulting size may be smaller than requested range. + * As a result, resulting size may be smaller than requested length. * * Skips over NULL characters from source when ripping. * * @param source * The string to rip from. - * @param start - * An inclusive start location within string. - * @param stop - * An inclusive stop location within string. + * @param length + * The length of source to append. * @param destination * The new string, which will be allocated or reallocated as necessary. * * @return * F_none on success. - * F_data_not if nothing to rip, no allocations or reallocations are performed. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not_eos if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. * - * @see fl_utf_string_append() + * Errors from (with error bit): f_utf_character_is_whitespace(). + * + * @see f_utf_character_is_whitespace() */ #ifndef _di_fl_utf_string_rip_nulless_ extern f_return_status fl_utf_string_rip_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_rip_nulless_ /** - * Seek the string location forward until the UTF-8 character or EOL is reached. + * Seek the UTF-8 string location forward until the character (1-byte wide) or EOL is reached. * * @param string * The string to traverse. @@ -1541,17 +1458,14 @@ extern "C" { * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this - * A UTF-8 character representing a character to seek to. + * A single-width character representing a character to seek to. * * @return * F_none on success. * F_none_eol on success, but stopped at EOL. - * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. - * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. + * F_data_not_stop if range.start > range.stop. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_utf_string_seek_line_to_char() */ #ifndef _di_fl_utf_string_seek_line_to_ extern f_return_status fl_utf_string_seek_line_to(const f_utf_string string, f_utf_string_range *range, const f_utf_character seek_to_this); @@ -1566,16 +1480,15 @@ extern "C" { * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this - * A single-width non-UTF-8 character. + * A single-width character. * * @return * F_none on success. * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. - * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. + * F_data_not_stop if range.start > range.stop. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_utf_string_seek_line_to() + * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. */ #ifndef _di_fl_utf_string_seek_line_to_char_ extern f_return_status fl_utf_string_seek_line_to_char(const f_utf_string string, f_utf_string_range *range, const int8_t seek_to_this); @@ -1595,14 +1508,17 @@ extern "C" { * @return * F_none on success. * F_none_eol on success, but stopped at EOL. + * F_data_not_stop if range.start > range.stop. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. * - * @see fl_utf_string_dynamic_seek_line_until_graph() + * Errors from (with error bit): f_utf_character_is_graph(). + * + * @see f_utf_character_is_graph() */ #ifndef _di_fl_utf_string_seek_line_until_graph_ extern f_return_status fl_utf_string_seek_line_until_graph(const f_utf_string string, f_utf_string_range *range, const f_utf_character placeholder); @@ -1623,14 +1539,17 @@ extern "C" { * F_none on success. * 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_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. + * + * Errors from (with error bit): f_utf_character_is_graph(). * - * @see fl_utf_string_dynamic_seek_line_until_non_graph() + * @see f_utf_character_is_graph() */ #ifndef _di_fl_utf_string_seek_line_until_non_graph_ extern f_return_status fl_utf_string_seek_line_until_non_graph(const f_utf_string string, f_utf_string_range *range, const f_utf_character placeholder); @@ -1649,14 +1568,10 @@ extern "C" { * * @return * F_none on success. - * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. - * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. + * F_data_not_stop if range.start > range.stop. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_utf_string_dynamic_seek_to() - * @see fl_utf_string_dynamic_seek_to_char() - * @see fl_utf_string_seek_to_char() + * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. */ #ifndef _di_fl_utf_string_seek_to_ extern f_return_status fl_utf_string_seek_to(const f_utf_string string, f_utf_string_range *range, const f_utf_character seek_to_this); @@ -1677,12 +1592,9 @@ extern "C" { * F_none on success. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. - * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. + * F_data_not_stop if range.start > range.stop. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_utf_string_dynamic_seek_to() - * @see fl_utf_string_dynamic_seek_to_char() - * @see fl_utf_string_seek_to() + * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. */ #ifndef _di_fl_utf_string_seek_to_character_ extern f_return_status fl_utf_string_seek_to_char(const f_utf_string string, f_utf_string_range *range, const int8_t seek_to_this); diff --git a/level_2/fll_execute/c/execute.h b/level_2/fll_execute/c/execute.h index b21e2f1..9f8a24f 100644 --- a/level_2/fll_execute/c/execute.h +++ b/level_2/fll_execute/c/execute.h @@ -376,7 +376,7 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_file_found_not (with error bit) if file does not exist at the program_path. - * f_string_length_size (with error bit) if the combined string (generated from PATH) is too large. + * F_string_too_large (with error bit) if the combined string (generated from PATH) is too large. * * @see execvp() */ @@ -423,7 +423,7 @@ extern "C" { * F_access_denied (with error bit) on access denied for program_path. * F_loop (with error bit) on loop error while checking the program_path. * F_buffer_too_large (with error bit) if paths array (generated from PATH) is too large for further addressing. - * f_string_length_size (with error bit) if the combined string (generated from PATH) is too large. + * F_string_too_large (with error bit) if the combined string (generated from PATH) is too large. * * @see execvpe() */ diff --git a/level_2/fll_fss/c/fss.h b/level_2/fll_fss/c/fss.h index 40b4af1..7985e97 100644 --- a/level_2/fll_fss/c/fss.h +++ b/level_2/fll_fss/c/fss.h @@ -63,7 +63,7 @@ extern "C" { * F_data_not when there is no buffer, objects or contents to process. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if any combined string is too large when processing values. + * F_string_too_large (with error bit) if any combined string is too large when processing values. */ #ifndef _di_fll_fss_snatch_ extern f_return_status fll_fss_snatch(const f_string_static buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamic *values[], const f_string_length size); @@ -102,7 +102,7 @@ extern "C" { * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. * F_buffer_too_large (with error bit) on maximum buffer limit reached when processing values. - * f_string_length_size (with error bit) if any combined string is too large when processing values. + * F_string_too_large (with error bit) if any combined string is too large when processing values. */ #ifndef _di_fll_fss_snatch_apart_ extern f_return_status fll_fss_snatch_apart(const f_string_static buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamics *values[], const f_string_length size); @@ -140,7 +140,7 @@ extern "C" { * F_data_not when there is no buffer, objects or contents to process. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if any combined string is too large when processing values. + * F_string_too_large (with error bit) if any combined string is too large when processing values. */ #ifndef _di_fll_fss_snatch_together_ extern f_return_status fll_fss_snatch_together(const f_string_static buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamic *values[], const f_string_length size); @@ -183,7 +183,7 @@ extern "C" { * F_data_not when there is no buffer, objects or contents to process. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if any combined string is too large when processing values. + * F_string_too_large (with error bit) if any combined string is too large when processing values. */ #ifndef _di_fll_fss_snatch_mash_ extern f_return_status fll_fss_snatch_mash(const f_string_static buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamic *values[], const f_string_length size, const f_string glue, const f_string_length glue_length); @@ -225,7 +225,7 @@ extern "C" { * F_data_not when there is no buffer, objects or contents to process. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if any combined string is too large when processing values. + * F_string_too_large (with error bit) if any combined string is too large when processing values. */ #ifndef _di_fll_fss_snatch_mash_apart_ extern f_return_status fll_fss_snatch_mash_apart(const f_string_static buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamics *values[], const f_string_length size, const f_string glue, const f_string_length glue_length); @@ -267,7 +267,7 @@ extern "C" { * F_data_not when there is no buffer, objects or contents to process. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * f_string_length_size (with error bit) if any combined string is too large when processing values. + * F_string_too_large (with error bit) if any combined string is too large when processing values. */ #ifndef _di_fll_fss_snatch_mash_together_ extern f_return_status fll_fss_snatch_mash_together(const f_string_static buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamic *values[], const f_string_length size, const f_string glue, const f_string_length glue_length); diff --git a/level_2/fll_program/c/program.h b/level_2/fll_program/c/program.h index ac06ccf..18691b2 100644 --- a/level_2/fll_program/c/program.h +++ b/level_2/fll_program/c/program.h @@ -231,7 +231,7 @@ extern "C" { * @return * F_none on success. * F_data_not if nothing to rip, no allocations or reallocations are performed. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. @@ -283,7 +283,7 @@ extern "C" { * @return * F_none on success. * F_data_not if nothing to rip, no allocations or reallocations are performed. - * f_string_length_size (with error bit) if the combined string is too large. + * F_string_too_large (with error bit) if the combined string is too large. * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error.