From 4fcef875c2ea65fd4a544257a604cc092bde95d2 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 19 Feb 2022 18:36:52 -0600 Subject: [PATCH] Progress: Continue mass converting to f_string_static_t and use const more. In particular this separates the fl_conversion functions into two forms: 1) That accepts only the f_string_static_t and uses dynamic.used as the length. 2) That accepts both f_string_static_t and f_string_range_t and uses the range to determine the length. This makes the conversion functions more consistent with the rest of the project's practices. --- level_0/f_limit/c/limit.h | 2 +- level_1/fl_control_group/c/control_group.h | 2 +- level_1/fl_conversion/c/conversion.c | 575 +++++++++------------ level_1/fl_conversion/c/conversion.h | 459 ++++++++++++++-- level_1/fl_conversion/c/private-conversion.c | 422 ++++++++++++--- level_1/fl_conversion/c/private-conversion.h | 229 +++++--- level_1/fl_execute/c/execute.h | 2 +- level_2/fll_execute/c/execute.h | 2 +- level_3/byte_dump/c/byte_dump.c | 12 +- .../controller/c/controller/private-controller.c | 8 +- .../controller/c/controller/private-controller.h | 12 +- level_3/controller/c/entry/private-entry.c | 7 +- level_3/controller/c/rule/private-rule.c | 34 +- level_3/controller/c/rule/private-rule.h | 4 +- level_3/fake/c/private-make-operate_process_type.c | 4 +- level_3/fake/c/private-make-operate_process_type.h | 4 +- level_3/fake/c/private-make-operate_validate.c | 2 +- level_3/fake/c/private-make.c | 12 +- .../fss_basic_list_read/c/fss_basic_list_read.c | 4 +- level_3/fss_basic_list_read/c/private-read.c | 17 +- level_3/fss_basic_list_read/c/private-read.h | 8 +- level_3/fss_basic_read/c/fss_basic_read.c | 4 +- level_3/fss_basic_read/c/private-read.c | 17 +- level_3/fss_basic_read/c/private-read.h | 8 +- .../c/fss_embedded_list_read.c | 4 +- level_3/fss_embedded_list_read/c/private-read.c | 16 +- level_3/fss_embedded_list_write/c/private-write.c | 8 +- .../c/fss_extended_list_read.c | 4 +- level_3/fss_extended_list_read/c/private-read.c | 17 +- level_3/fss_extended_list_read/c/private-read.h | 8 +- level_3/fss_extended_list_write/c/private-write.c | 8 +- level_3/fss_extended_read/c/fss_extended_read.c | 4 +- level_3/fss_extended_read/c/private-read.c | 17 +- level_3/fss_extended_read/c/private-read.h | 8 +- level_3/fss_identify/c/fss_identify.c | 5 +- level_3/fss_identify/c/private-identify.c | 2 +- level_3/fss_identify/c/private-identify.h | 4 +- level_3/fss_payload_read/c/fss_payload_read.c | 4 +- level_3/fss_payload_read/c/private-read.c | 17 +- level_3/fss_payload_read/c/private-read.h | 8 +- .../fss_status_code/c/private-fss_status_code.c | 8 +- level_3/iki_read/c/iki_read.c | 10 +- level_3/status_code/c/private-status_code.c | 8 +- 43 files changed, 1289 insertions(+), 721 deletions(-) diff --git a/level_0/f_limit/c/limit.h b/level_0/f_limit/c/limit.h index 9a5985a..682dad1 100644 --- a/level_0/f_limit/c/limit.h +++ b/level_0/f_limit/c/limit.h @@ -10,7 +10,7 @@ #ifndef _F_limit_h #define _F_limit_h -// include pre-requirements +// Include pre-requirements. #define _GNU_SOURCE // Libc includes. diff --git a/level_1/fl_control_group/c/control_group.h b/level_1/fl_control_group/c/control_group.h index e93d0cb..da3a948 100644 --- a/level_1/fl_control_group/c/control_group.h +++ b/level_1/fl_control_group/c/control_group.h @@ -16,7 +16,7 @@ #ifndef _FL_control_group_h #define _FL_control_group_h -// include pre-requirements +// Include pre-requirements. #define _GNU_SOURCE // Libc includes. diff --git a/level_1/fl_conversion/c/conversion.c b/level_1/fl_conversion/c/conversion.c index 88fd9d0..1506f0c 100644 --- a/level_1/fl_conversion/c/conversion.c +++ b/level_1/fl_conversion/c/conversion.c @@ -5,452 +5,341 @@ extern "C" { #endif -#ifndef _di_fl_conversion_string_to_binary_signed_ - f_status_t fl_conversion_string_to_binary_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) { +#ifndef _di_fl_conversion_dynamic_partial_to_binary_signed_ + f_status_t fl_conversion_dynamic_partial_to_binary_signed(const f_string_static_t dynamic, const f_string_range_t range, const bool negative, f_number_signed_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - return private_fl_conversion_string_to_binary_signed(string, range, negative, number); + if (!dynamic.used || range.start > range.stop) { + return F_data_not; + } + + return private_fl_conversion_dynamic_to_binary_signed(dynamic.string + range.start, (range.stop - range.start) + 1, negative, number); } -#endif // _di_fl_conversion_string_to_binary_signed_ +#endif // _di_fl_conversion_dynamic_partial_to_binary_signed_ -#ifndef _di_fl_conversion_string_to_binary_unsigned_ - f_status_t fl_conversion_string_to_binary_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) { +#ifndef _di_fl_conversion_dynamic_partial_to_binary_unsigned_ + f_status_t fl_conversion_dynamic_partial_to_binary_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - return private_fl_conversion_string_to_binary_unsigned(string, range, number); + if (!dynamic.used || range.start > range.stop) { + return F_data_not; + } + + return private_fl_conversion_dynamic_to_binary_unsigned(dynamic.string + range.start, (range.stop - range.start) + 1, number); } -#endif // _di_fl_conversion_string_to_binary_unsigned_ +#endif // _di_fl_conversion_dynamic_partial_to_binary_unsigned_ -#ifndef _di_fl_conversion_string_to_decimal_signed_ - f_status_t fl_conversion_string_to_decimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) { +#ifndef _di_fl_conversion_dynamic_partial_to_decimal_signed_ + f_status_t fl_conversion_dynamic_partial_to_decimal_signed(const f_string_static_t dynamic, const f_string_range_t range, const bool negative, f_number_signed_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - return private_fl_conversion_string_to_decimal_signed(string, range, negative, number); + if (!dynamic.used || range.start > range.stop) { + return F_data_not; + } + + return private_fl_conversion_dynamic_to_decimal_signed(dynamic.string + range.start, (range.stop - range.start) + 1, negative, number); } -#endif // _di_fl_conversion_string_to_decimal_signed_ +#endif // _di_fl_conversion_dynamic_partial_to_decimal_signed_ -#ifndef _di_fl_conversion_string_to_decimal_unsigned_ - f_status_t fl_conversion_string_to_decimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) { +#ifndef _di_fl_conversion_dynamic_partial_to_decimal_unsigned_ + f_status_t fl_conversion_dynamic_partial_to_decimal_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - return private_fl_conversion_string_to_decimal_unsigned(string, range, number); + if (!dynamic.used || range.start > range.stop) { + return F_data_not; + } + + return private_fl_conversion_dynamic_to_decimal_unsigned(dynamic.string + range.start, (range.stop - range.start) + 1, number); } -#endif // _di_fl_conversion_string_to_decimal_unsigned_ +#endif // _di_fl_conversion_dynamic_partial_to_decimal_unsigned_ -#ifndef _di_fl_conversion_string_to_duodecimal_signed_ - f_status_t fl_conversion_string_to_duodecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) { +#ifndef _di_fl_conversion_dynamic_partial_to_duodecimal_signed_ + f_status_t fl_conversion_dynamic_partial_to_duodecimal_signed(const f_string_static_t dynamic, const f_string_range_t range, const bool negative, f_number_signed_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - return private_fl_conversion_string_to_duodecimal_signed(string, range, negative, number); + if (!dynamic.used || range.start > range.stop) { + return F_data_not; + } + + return private_fl_conversion_dynamic_to_duodecimal_signed(dynamic.string + range.start, (range.stop - range.start) + 1, negative, number); } -#endif // _di_fl_conversion_string_to_duodecimal_signed_ +#endif // _di_fl_conversion_dynamic_partial_to_duodecimal_signed_ -#ifndef _di_fl_conversion_string_to_duodecimal_unsigned_ - f_status_t fl_conversion_string_to_duodecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) { +#ifndef _di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_ + f_status_t fl_conversion_dynamic_partial_to_duodecimal_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - return private_fl_conversion_string_to_duodecimal_unsigned(string, range, number); + if (!dynamic.used || range.start > range.stop) { + return F_data_not; + } + + return private_fl_conversion_dynamic_to_duodecimal_unsigned(dynamic.string + range.start, (range.stop - range.start) + 1, number); } -#endif // _di_fl_conversion_string_to_duodecimal_unsigned_ +#endif // _di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_ -#ifndef _di_fl_conversion_string_to_hexidecimal_signed_ - f_status_t fl_conversion_string_to_hexidecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) { +#ifndef _di_fl_conversion_dynamic_partial_to_hexidecimal_signed_ + f_status_t fl_conversion_dynamic_partial_to_hexidecimal_signed(const f_string_static_t dynamic, const f_string_range_t range, const bool negative, f_number_signed_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - return private_fl_conversion_string_to_hexidecimal_signed(string, range, negative, number); + if (!dynamic.used || range.start > range.stop) { + return F_data_not; + } + + return private_fl_conversion_dynamic_to_hexidecimal_signed(dynamic.string + range.start, (range.stop - range.start) + 1, negative, number); } -#endif // _di_fl_conversion_string_to_hexidecimal_signed_ +#endif // _di_fl_conversion_dynamic_partial_to_hexidecimal_signed_ -#ifndef _di_fl_conversion_string_to_hexidecimal_unsigned_ - f_status_t fl_conversion_string_to_hexidecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) { +#ifndef _di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_ + f_status_t fl_conversion_dynamic_partial_to_hexidecimal_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - return private_fl_conversion_string_to_hexidecimal_unsigned(string, range, number); + if (!dynamic.used || range.start > range.stop) { + return F_data_not; + } + + return private_fl_conversion_dynamic_to_hexidecimal_unsigned(dynamic.string + range.start, (range.stop - range.start) + 1, number); } -#endif // _di_fl_conversion_string_to_hexidecimal_unsigned_ +#endif // _di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_ -#ifndef _di_fl_conversion_string_to_octal_signed_ - f_status_t fl_conversion_string_to_octal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) { +#ifndef _di_fl_conversion_dynamic_partial_to_octal_signed_ + f_status_t fl_conversion_dynamic_partial_to_octal_signed(const f_string_static_t dynamic, const f_string_range_t range, const bool negative, f_number_signed_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - return private_fl_conversion_string_to_octal_signed(string, range, negative, number); + if (!dynamic.used || range.start > range.stop) { + return F_data_not; + } + + return private_fl_conversion_dynamic_to_octal_signed(dynamic.string + range.start, (range.stop - range.start) + 1, negative, number); } -#endif // _di_fl_conversion_string_to_octal_signed_ +#endif // _di_fl_conversion_dynamic_partial_to_octal_signed_ -#ifndef _di_fl_conversion_string_to_octal_unsigned_ - f_status_t fl_conversion_string_to_octal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) { +#ifndef _di_fl_conversion_dynamic_partial_to_octal_unsigned_ + f_status_t fl_conversion_dynamic_partial_to_octal_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - return private_fl_conversion_string_to_octal_unsigned(string, range, number); + if (!dynamic.used || range.start > range.stop) { + return F_data_not; + } + + return private_fl_conversion_dynamic_to_octal_unsigned(dynamic.string + range.start, (range.stop - range.start) + 1, number); } -#endif // _di_fl_conversion_string_to_octal_unsigned_ +#endif // _di_fl_conversion_dynamic_partial_to_octal_unsigned_ -#ifndef _di_fl_conversion_string_to_number_signed_ - f_status_t fl_conversion_string_to_number_signed(const f_string_t string, const f_string_range_t range, f_number_signed_t *number) { +#ifndef _di_fl_conversion_dynamic_partial_to_number_signed_ + f_status_t fl_conversion_dynamic_partial_to_number_signed(const f_string_static_t dynamic, const f_string_range_t range, f_number_signed_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!string[0]) { + if (!dynamic.used || range.start > range.stop) { return F_data_not; } - uint8_t width = 0; - f_array_length_t width_max = 0; - uint8_t mode = 0; - int8_t vector = 0; // 0 for assumed positive, 1 for explicit positive, -1 for negative. - f_array_length_t j = 0; - f_array_length_t offset = 0; - f_status_t status = F_none; - - for (f_array_length_t i = range.start; i <= range.stop; ++i) { - - width = macro_f_utf_byte_width_is(string[i]); - - if (!width) { - if (isspace(string[i])) { - if (!mode && !vector) { - ++offset; - - continue; - } - - return F_status_set_error(F_number); - } - } - else { - if (!mode && !vector) { - width_max = (range.stop - i) + 1; - - status = f_utf_is_whitespace(string + i, width_max); - - if (status == F_true) { - offset = i + 1; - - continue; - } - - if (F_status_is_error(status)) { - if (status == F_status_set_error(F_maybe)) { - status = F_status_set_error(F_complete_not_utf); - } - - return status; - } - } - - return F_status_set_error(F_number); - } - - if (string[i] == 0x30) { - - // skip past all NULLs. - for (j = i + 1; j <= range.stop; ++j) { - if (string[j]) break; - } // for - - // Immediate next value must be either a number, 'x', 'X', 'd', 'D', 'o', 'O', 'b', or 'B'. - if (j > range.stop) { - *number = 0; - return F_none; - } - else if (string[j] > 0x2f && string[j] < 0x3a) { - mode = 10; - } - else if (string[j] == 0x78 || string[j] == 0x58) { - mode = 16; - offset += 2; - } - else if (string[j] == 0x44 || string[j] == 0x64) { - mode = 12; - offset += 2; - } - else if (string[j] == 0x6f || string[j] == 0x4f) { - mode = 8; - offset += 2; - } - else if (string[j] == 0x62 || string[j] == 0x42) { - mode = 2; - offset += 2; - } - else if (string[j] == 0x2e) { - return F_status_set_error(F_number_decimal); - } - else { - return F_status_set_error(F_number); - } - - break; - } - - // plus sign is only allowed as the first non-whitespace character. - if (string[i] == 0x2b) { - if (!mode && !vector) { - vector = 1; - ++offset; - } - else { - return F_status_set_error(F_number); - } - } - - // negative sign is not allowed. - if (string[i] == 0x2d) { - if (!mode && !vector) { - vector = -1; - ++offset; - } - else { - return F_status_set_error(F_number); - } - } - - if (f_conversion_character_is_decimal(string[i]) == F_true) { - mode = 10; - break; - } - - return F_status_set_error(F_number); - } // for - - if (!mode) { - return F_status_set_error(F_number); - } + return private_fl_conversion_dynamic_to_number_signed(dynamic.string + range.start, (range.stop - range.start) + 1, number); + } +#endif // _di_fl_conversion_dynamic_partial_to_number_signed_ - f_string_range_t location_offset = f_string_range_t_initialize; - location_offset.start = range.start + offset; - location_offset.stop = range.stop; +#ifndef _di_fl_conversion_dynamic_partial_to_number_unsigned_ + f_status_t fl_conversion_dynamic_partial_to_number_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ - if (range.start + offset > range.stop) { - return F_status_set_error(F_number); + if (!dynamic.used || range.start > range.stop) { + return F_data_not; } - if (mode == 10) { - return private_fl_conversion_string_to_decimal_signed(string, location_offset, vector == -1, number); - } + return private_fl_conversion_dynamic_to_number_unsigned(dynamic.string + range.start, (range.stop - range.start) + 1, number); + } +#endif // _di_fl_conversion_dynamic_partial_to_number_unsigned_ - if (mode == 16) { - return private_fl_conversion_string_to_hexidecimal_signed(string, location_offset, vector == -1, number); - } +#ifndef _di_fl_conversion_dynamic_to_binary_signed_ + f_status_t fl_conversion_dynamic_to_binary_signed(const f_string_static_t dynamic, const bool negative, f_number_signed_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ - if (mode == 12) { - return private_fl_conversion_string_to_duodecimal_signed(string, location_offset, vector == -1, number); + if (!dynamic.used) { + return F_data_not; } - if (mode == 8) { - return private_fl_conversion_string_to_octal_signed(string, location_offset, vector == -1, number); + return private_fl_conversion_dynamic_to_binary_signed(dynamic.string, dynamic.used, negative, number); + } +#endif // _di_fl_conversion_dynamic_to_binary_signed_ + +#ifndef _di_fl_conversion_dynamic_to_binary_unsigned_ + f_status_t fl_conversion_dynamic_to_binary_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (!dynamic.used) { + return F_data_not; } - return private_fl_conversion_string_to_binary_signed(string, location_offset, vector == -1, number); + return private_fl_conversion_dynamic_to_binary_unsigned(dynamic.string, dynamic.used, number); } -#endif // _di_fl_conversion_string_to_number_signed_ +#endif // _di_fl_conversion_dynamic_to_binary_unsigned_ -#ifndef _di_fl_conversion_string_to_number_unsigned_ - f_status_t fl_conversion_string_to_number_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) { +#ifndef _di_fl_conversion_dynamic_to_decimal_signed_ + f_status_t fl_conversion_dynamic_to_decimal_signed(const f_string_static_t dynamic, const bool negative, f_number_signed_t * const number) { #ifndef _di_level_1_parameter_checking_ - if (!string) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!string[0]) { + if (!dynamic.used) { return F_data_not; } - uint8_t width = 0; - f_array_length_t width_max = 0; - uint8_t mode = 0; - f_array_length_t j = 0; - f_array_length_t offset = 0; - f_status_t status = F_none; - int8_t sign_found = 0; - - for (f_array_length_t i = range.start; i <= range.stop; ++i) { - - width = macro_f_utf_byte_width_is(string[i]); - - if (!width) { - if (isspace(string[i])) { - if (!mode) { - ++offset; - - continue; - } - - return F_status_set_error(F_number); - } - } - else { - if (!mode) { - width_max = (range.stop - i) + 1; - - status = f_utf_is_whitespace(string + i, width_max); - - if (status == F_true) { - offset = i + 1; - - continue; - } - - if (F_status_is_error(status)) { - if (status == F_status_set_error(F_maybe)) { - status = F_status_set_error(F_complete_not_utf); - } - - return status; - } - } - - return F_status_set_error(F_number); - } - - if (string[i] == 0x30) { - - // skip past all NULLs. - for (j = i + 1; j <= range.stop; ++j) { - if (string[j]) break; - } // for - - // Immediate next value must be either a number, 'x', 'X', 'd', 'D', 'o', 'O', 'b', or 'B'. - if (j > range.stop) { - *number = 0; - - return F_none; - } - else if (string[j] > 0x2f && string[j] < 0x3a) { - mode = 10; - } - else if (string[j] == 0x78 || string[j] == 0x58) { - mode = 16; - offset += 2; - } - else if (string[j] == 0x44 || string[j] == 0x64) { - mode = 12; - offset += 2; - } - else if (string[j] == 0x6f || string[j] == 0x4f) { - mode = 8; - offset += 2; - } - else if (string[j] == 0x62 || string[j] == 0x42) { - mode = 2; - offset += 2; - } - else if (string[j] == 0x2e) { - return F_status_set_error(F_number_decimal); - } - else { - return F_status_set_error(F_number); - } - - break; - } - - if (string[i] == 0x2b) { - ++offset; - sign_found = 1; - } - - if (string[i] == 0x2d) { - ++offset; - sign_found = -1; - } - - if (f_conversion_character_is_decimal(string[i]) == F_true) { - mode = 10; - break; - } - - return F_status_set_error(F_number); - } // for - - if (!mode) { - return F_status_set_error(F_number); + return private_fl_conversion_dynamic_to_decimal_signed(dynamic.string, dynamic.used, negative, number); + } +#endif // _di_fl_conversion_dynamic_to_decimal_signed_ + +#ifndef _di_fl_conversion_dynamic_to_decimal_unsigned_ + f_status_t fl_conversion_dynamic_to_decimal_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (!dynamic.used) { + return F_data_not; } - f_string_range_t location_offset = f_string_range_t_initialize; - location_offset.start = range.start + offset; - location_offset.stop = range.stop; + return private_fl_conversion_dynamic_to_decimal_unsigned(dynamic.string, dynamic.used, number); + } +#endif // _di_fl_conversion_dynamic_to_decimal_unsigned_ - if (range.start + offset > range.stop) { - return F_status_set_error(F_number); +#ifndef _di_fl_conversion_dynamic_to_duodecimal_signed_ + f_status_t fl_conversion_dynamic_to_duodecimal_signed(const f_string_static_t dynamic, const bool negative, f_number_signed_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (!dynamic.used) { + return F_data_not; } - if (mode == 10) { - status = private_fl_conversion_string_to_decimal_unsigned(string, location_offset, number); + return private_fl_conversion_dynamic_to_duodecimal_signed(dynamic.string, dynamic.used, negative, number); + } +#endif // _di_fl_conversion_dynamic_to_duodecimal_signed_ + +#ifndef _di_fl_conversion_dynamic_to_duodecimal_unsigned_ + f_status_t fl_conversion_dynamic_to_duodecimal_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (!dynamic.used) { + return F_data_not; } - else if (mode == 16) { - status = private_fl_conversion_string_to_hexidecimal_unsigned(string, location_offset, number); + + return private_fl_conversion_dynamic_to_duodecimal_unsigned(dynamic.string, dynamic.used, number); + } +#endif // _di_fl_conversion_dynamic_to_duodecimal_unsigned_ + +#ifndef _di_fl_conversion_dynamic_to_hexidecimal_signed_ + f_status_t fl_conversion_dynamic_to_hexidecimal_signed(const f_string_static_t dynamic, const bool negative, f_number_signed_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (!dynamic.used) { + return F_data_not; } - else if (mode == 12) { - status = private_fl_conversion_string_to_duodecimal_unsigned(string, location_offset, number); + + return private_fl_conversion_dynamic_to_hexidecimal_signed(dynamic.string, dynamic.used, negative, number); + } +#endif // _di_fl_conversion_dynamic_to_hexidecimal_signed_ + +#ifndef _di_fl_conversion_dynamic_to_hexidecimal_unsigned_ + f_status_t fl_conversion_dynamic_to_hexidecimal_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (!dynamic.used) { + return F_data_not; } - else if (mode == 8) { - status = private_fl_conversion_string_to_octal_unsigned(string, location_offset, number); + + return private_fl_conversion_dynamic_to_hexidecimal_unsigned(dynamic.string, dynamic.used, number); + } +#endif // _di_fl_conversion_dynamic_to_hexidecimal_unsigned_ + +#ifndef _di_fl_conversion_dynamic_to_octal_signed_ + f_status_t fl_conversion_dynamic_to_octal_signed(const f_string_static_t dynamic, const bool negative, f_number_signed_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (!dynamic.used) { + return F_data_not; } - else { - status = private_fl_conversion_string_to_binary_unsigned(string, location_offset, number); + + return private_fl_conversion_dynamic_to_octal_signed(dynamic.string, dynamic.used, negative, number); + } +#endif // _di_fl_conversion_dynamic_to_octal_signed_ + +#ifndef _di_fl_conversion_dynamic_to_octal_unsigned_ + f_status_t fl_conversion_dynamic_to_octal_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (!dynamic.used) { + return F_data_not; } - // +/- signs are not allowed. - if (sign_found) { - if (status == F_none) { - if (sign_found == -1) { - return F_status_set_error(F_number_negative); - } + return private_fl_conversion_dynamic_to_octal_unsigned(dynamic.string, dynamic.used, number); + } +#endif // _di_fl_conversion_dynamic_to_octal_unsigned_ - return F_status_set_error(F_number_positive); - } +#ifndef _di_fl_conversion_dynamic_to_number_signed_ + f_status_t fl_conversion_dynamic_to_number_signed(const f_string_static_t dynamic, f_number_signed_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ - return F_status_set_error(F_number); + if (!dynamic.used) { + return F_data_not; } - return status; + return private_fl_conversion_dynamic_to_number_signed(dynamic.string, dynamic.used, number); } -#endif // _di_fl_conversion_string_to_number_unsigned_ +#endif // _di_fl_conversion_dynamic_to_number_signed_ + +#ifndef _di_fl_conversion_dynamic_to_number_unsigned_ + f_status_t fl_conversion_dynamic_to_number_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number) { + #ifndef _di_level_1_parameter_checking_ + if (!number) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + if (!dynamic.used) { + return F_data_not; + } + + return private_fl_conversion_dynamic_to_number_unsigned(dynamic.string, dynamic.used, number); + } +#endif // _di_fl_conversion_dynamic_to_number_unsigned_ #ifdef __cplusplus } // extern "C" #endif diff --git a/level_1/fl_conversion/c/conversion.h b/level_1/fl_conversion/c/conversion.h index 3fa0294..4f8c6b5 100644 --- a/level_1/fl_conversion/c/conversion.h +++ b/level_1/fl_conversion/c/conversion.h @@ -29,13 +29,13 @@ extern "C" { /** * Convert a series of positive or negative binary number characters into a f_number_signed_t. * - * This will stop at one of the following: location.stop or a non-digit. + * This will stop at one of the following: range.stop or a non-digit. * This will ignore NULL values. * This will not process signed statuses (+/-). * - * @param string + * @param dynamic * The string to convert. - * @param location + * @param range * The start/stop range to convert. * @param negative * Set to 0 to treat string as a positive number, 1 for as a negative number. @@ -53,9 +53,9 @@ extern "C" { * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_string_to_binary_signed_ - extern f_status_t fl_conversion_string_to_binary_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number); -#endif // _di_fl_conversion_string_to_binary_signed_ +#ifndef _di_fl_conversion_dynamic_partial_to_binary_signed_ + extern f_status_t fl_conversion_dynamic_partial_to_binary_signed(const f_string_static_t dynamic, const f_string_range_t range, const bool negative, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_binary_signed_ /** * Convert a series of positive binary number characters into a f_number_unsigned_t. @@ -64,7 +64,7 @@ extern "C" { * This will ignore NULL values. * This will not process signed statuses (+/-). * - * @param string + * @param dynamic * The string to convert. * @param range * The start/stop range to convert. @@ -81,9 +81,9 @@ extern "C" { * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_string_to_binary_unsigned_ - extern f_status_t fl_conversion_string_to_binary_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number); -#endif // _di_fl_conversion_string_to_binary_unsigned_ +#ifndef _di_fl_conversion_dynamic_partial_to_binary_unsigned_ + extern f_status_t fl_conversion_dynamic_partial_to_binary_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_binary_unsigned_ /** * Convert a series of positive or negative decimal number characters into an f_number_signed_t. @@ -92,7 +92,7 @@ extern "C" { * This will ignore NULL values. * This will not process signed statuses (+/-). * - * @param string + * @param dynamic * The string to convert. * @param range * The start/stop range to convert. @@ -112,9 +112,9 @@ extern "C" { * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_string_to_decimal_signed_ - extern f_status_t fl_conversion_string_to_decimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number); -#endif // _di_fl_conversion_string_to_decimal_signed_ +#ifndef _di_fl_conversion_dynamic_partial_to_decimal_signed_ + extern f_status_t fl_conversion_dynamic_partial_to_decimal_signed(const f_string_static_t dynamic, const f_string_range_t range, const bool negative, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_decimal_signed_ /** * Convert a series of positive decimal number characters into an f_number_unsigned_t. @@ -123,7 +123,7 @@ extern "C" { * This will ignore NULL values. * This will not process signed statuses (+/-). * - * @param string + * @param dynamic * The string to convert. * @param range * The start/stop range to convert. @@ -140,9 +140,9 @@ extern "C" { * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_string_to_decimal_unsigned_ - extern f_status_t fl_conversion_string_to_decimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number); -#endif // _di_fl_conversion_string_to_decimal_unsigned_ +#ifndef _di_fl_conversion_dynamic_partial_to_decimal_unsigned_ + extern f_status_t fl_conversion_dynamic_partial_to_decimal_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_decimal_unsigned_ /** * Convert a series of positive or negative duodecimal number characters into an f_number_signed_t. @@ -151,7 +151,7 @@ extern "C" { * This will ignore NULL values. * This will not process signed statuses (+/-). * - * @param string + * @param dynamic * The string to convert. * @param range * The start/stop range to convert. @@ -171,9 +171,9 @@ extern "C" { * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_string_to_duodecimal_signed_ - extern f_status_t fl_conversion_string_to_duodecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number); -#endif // _di_fl_conversion_string_to_duodecimal_signed_ +#ifndef _di_fl_conversion_dynamic_partial_to_duodecimal_signed_ + extern f_status_t fl_conversion_dynamic_partial_to_duodecimal_signed(const f_string_static_t dynamic, const f_string_range_t range, const bool negative, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_duodecimal_signed_ /** * Convert a series of positive duodecimal number characters into an f_number_unsigned_t. @@ -182,7 +182,7 @@ extern "C" { * This will ignore NULL values. * This will not process signed statuses (+/-). * - * @param string + * @param dynamic * The string to convert. * @param range * The start/stop range to convert. @@ -199,9 +199,9 @@ extern "C" { * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_string_to_duodecimal_unsigned_ - extern f_status_t fl_conversion_string_to_duodecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number); -#endif // _di_fl_conversion_string_to_duodecimal_unsigned_ +#ifndef _di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_ + extern f_status_t fl_conversion_dynamic_partial_to_duodecimal_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_ /** * Convert a series of positive or negative hexidecimal number characters into an f_number_signed_t. @@ -210,7 +210,7 @@ extern "C" { * This will ignore NULL values. * This will not process signed statuses (+/-). * - * @param string + * @param dynamic * The string to convert. * @param range * The start/stop range to convert. @@ -230,9 +230,9 @@ extern "C" { * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_string_to_hexidecimal_signed_ - extern f_status_t fl_conversion_string_to_hexidecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number); -#endif // _di_fl_conversion_string_to_hexidecimal_signed_ +#ifndef _di_fl_conversion_dynamic_partial_to_hexidecimal_signed_ + extern f_status_t fl_conversion_dynamic_partial_to_hexidecimal_signed(const f_string_static_t dynamic, const f_string_range_t range, const bool negative, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_hexidecimal_signed_ /** * Convert a series of positive hexidecimal number characters into an f_number_unsigned_t. @@ -241,7 +241,7 @@ extern "C" { * This will ignore NULL values. * This will not process signed statuses (+/-). * - * @param string + * @param dynamic * The string to convert. * @param range * The start/stop range to convert. @@ -258,9 +258,9 @@ extern "C" { * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_string_to_hexidecimal_unsigned_ - extern f_status_t fl_conversion_string_to_hexidecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number); -#endif // _di_fl_conversion_string_to_hexidecimal_unsigned_ +#ifndef _di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_ + extern f_status_t fl_conversion_dynamic_partial_to_hexidecimal_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_ /** * Convert a series of positive or negative octal number characters into an f_number_signed_t. @@ -269,7 +269,7 @@ extern "C" { * This will ignore NULL values. * This will not process signed statuses (+/-). * - * @param string + * @param dynamic * The string to convert. * @param range * The start/stop range to convert. @@ -288,9 +288,9 @@ extern "C" { * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_string_to_octal_signed_ - extern f_status_t fl_conversion_string_to_octal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number); -#endif // _di_fl_conversion_string_to_octal_signed_ +#ifndef _di_fl_conversion_dynamic_partial_to_octal_signed_ + extern f_status_t fl_conversion_dynamic_partial_to_octal_signed(const f_string_static_t dynamic, const f_string_range_t range, const bool negative, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_octal_signed_ /** * Convert a series of positive octal number characters into an f_number_unsigned_t. @@ -299,7 +299,7 @@ extern "C" { * This will ignore NULL values. * This will not process signed statuses (+/-). * - * @param string + * @param dynamic * The string to convert. * @param range * The start/stop range to convert. @@ -316,9 +316,9 @@ extern "C" { * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_string_to_octal_unsigned_ - extern f_status_t fl_conversion_string_to_octal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number); -#endif // _di_fl_conversion_string_to_octal_unsigned_ +#ifndef _di_fl_conversion_dynamic_partial_to_octal_unsigned_ + extern f_status_t fl_conversion_dynamic_partial_to_octal_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_octal_unsigned_ /** * Convert a series of positive or negative number characters into an f_number_signed_t. @@ -339,7 +339,7 @@ extern "C" { * This function is similar to strtoll(), but the behavior of error handling and special bases are different. * In particular, octals are specified here with '0b' prefix or '0B' prefix instead of the ridiculous '0' prefix. * - * @param string + * @param dynamic * The string to convert. * @param range * The start/stop range to convert. @@ -360,9 +360,9 @@ extern "C" { * * @see strtoll() */ -#ifndef _di_fl_conversion_string_to_number_signed_ - extern f_status_t fl_conversion_string_to_number_signed(const f_string_t string, const f_string_range_t range, f_number_signed_t *number); -#endif // _di_fl_conversion_string_to_number_signed_ +#ifndef _di_fl_conversion_dynamic_partial_to_number_signed_ + extern f_status_t fl_conversion_dynamic_partial_to_number_signed(const f_string_static_t dynamic, const f_string_range_t range, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_number_signed_ /** * Convert a series of positive number characters into an f_number_unsigned_t. @@ -384,7 +384,7 @@ extern "C" { * In particular, octals are specified here with '0b' prefix or '0B' prefix instead of the ridiculous '0' prefix. * Negative values are reported as such instead of being converted into the unsigned equivalent. * - * @param string + * @param dynamic * The string to convert. * @param range * The start/stop range to convert. @@ -406,9 +406,368 @@ extern "C" { * * @see strtoull() */ -#ifndef _di_fl_conversion_string_to_number_unsigned_ - extern f_status_t fl_conversion_string_to_number_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number); -#endif // _di_fl_conversion_string_to_number_unsigned_ +#ifndef _di_fl_conversion_dynamic_partial_to_number_unsigned_ + extern f_status_t fl_conversion_dynamic_partial_to_number_unsigned(const f_string_static_t dynamic, const f_string_range_t range, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_number_unsigned_ +/** + * Convert a series of positive or negative binary number characters into a f_number_signed_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * + * @param dynamic + * The string to convert. + * @param negative + * Set to 0 to treat string as a positive number, 1 for as a negative number. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none if the binary string was converted to an signed long. + * F_data_not if string starts with a null (length is 0). + * + * F_number (with error bit) if no conversion was made due to non-binary values being found. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_number_underflow (with error bit) on integer underflow. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_conversion_dynamic_to_binary_signed_ + extern f_status_t fl_conversion_dynamic_to_binary_signed(const f_string_static_t dynamic, const bool negative, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_to_binary_signed_ + +/** + * Convert a series of positive binary number characters into a f_number_unsigned_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * + * @param dynamic + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none if the binary string was converted to an unsigned long. + * F_data_not if string starts with a null (length is 0). + * + * F_number (with error bit) if no conversion was made due to non-binary values being found. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_conversion_dynamic_to_binary_unsigned_ + extern f_status_t fl_conversion_dynamic_to_binary_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_to_binary_unsigned_ + +/** + * Convert a series of positive or negative decimal number characters into an f_number_signed_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * + * @param dynamic + * The string to convert. + * @param negative + * Set to 0 to treat string as a positive number, 1 for as a negative number. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none if the decimal string was converted to an signed long. + * F_data_not if string starts with a null (length is 0). + * + * F_number (with error bit) if no conversion was made due to non-decimal values being found. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_number_underflow (with error bit) on integer underflow. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_conversion_dynamic_to_decimal_signed_ + extern f_status_t fl_conversion_dynamic_to_decimal_signed(const f_string_static_t dynamic, const bool negative, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_to_decimal_signed_ + +/** + * Convert a series of positive decimal number characters into an f_number_unsigned_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * + * @param dynamic + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none if the decimal string was converted to an unsigned long. + * F_data_not if string starts with a null (length is 0). + * + * F_number (with error bit) if no conversion was made due to non-decimal values being found. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_conversion_dynamic_to_decimal_unsigned_ + extern f_status_t fl_conversion_dynamic_to_decimal_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_to_decimal_unsigned_ + +/** + * Convert a series of positive or negative duodecimal number characters into an f_number_signed_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * + * @param dynamic + * The string to convert. + * @param negative + * Set to 0 to treat string as a positive number, 1 for as a negative number. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none if the duodecimal string was converted to an signed long. + * F_data_not if string starts with a null (length is 0). + * + * F_number (with error bit) if no conversion was made due to non-duodecimal values being found. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_number_underflow (with error bit) on integer underflow. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_conversion_dynamic_to_duodecimal_signed_ + extern f_status_t fl_conversion_dynamic_to_duodecimal_signed(const f_string_static_t dynamic, const bool negative, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_to_duodecimal_signed_ + +/** + * Convert a series of positive duodecimal number characters into an f_number_unsigned_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * + * @param dynamic + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none if the duodecimal string was converted to an unsigned long. + * F_data_not if string starts with a null (length is 0). + * + * F_number (with error bit) if no conversion was made due to non-duodecimal values being found. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_conversion_dynamic_to_duodecimal_unsigned_ + extern f_status_t fl_conversion_dynamic_to_duodecimal_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_to_duodecimal_unsigned_ + +/** + * Convert a series of positive or negative hexidecimal number characters into an f_number_signed_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * + * @param dynamic + * The string to convert. + * @param negative + * Set to 0 to treat string as a positive number, 1 for as a negative number. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none if the hexidecimal string was converted to an signed long. + * F_data_not if string starts with a null (length is 0). + * + * F_number (with error bit) if no conversion was made due to non-hexidecimal values being found. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_number_underflow (with error bit) on integer underflow. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_conversion_dynamic_to_hexidecimal_signed_ + extern f_status_t fl_conversion_dynamic_to_hexidecimal_signed(const f_string_static_t dynamic, const bool negative, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_to_hexidecimal_signed_ + +/** + * Convert a series of positive hexidecimal number characters into an f_number_unsigned_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * + * @param dynamic + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none if the hexidecimal string was converted to an unsigned long. + * F_data_not if string starts with a null (length is 0). + * + * F_number (with error bit) if no conversion was made due to non-hexidecimal values being found. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_conversion_dynamic_to_hexidecimal_unsigned_ + extern f_status_t fl_conversion_dynamic_to_hexidecimal_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_to_hexidecimal_unsigned_ + +/** + * Convert a series of positive or negative octal number characters into an f_number_signed_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * + * @param dynamic + * The string to convert. + * @param negative + * Set to 0 to treat string as a positive number, 1 for as a negative number. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none if the octal string was converted to an signed long. + * F_data_not if string starts with a null (length is 0). + * + * F_number (with error bit) if no conversion was made due to non-octal values being found. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_conversion_dynamic_to_octal_signed_ + extern f_status_t fl_conversion_dynamic_to_octal_signed(const f_string_static_t dynamic, const bool negative, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_to_octal_signed_ + +/** + * Convert a series of positive octal number characters into an f_number_unsigned_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * + * @param dynamic + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none if the octal string was converted to an unsigned long. + * F_data_not if string starts with a null (length is 0). + * + * F_number (with error bit) if no conversion was made due to non-octal values being found. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_conversion_dynamic_to_octal_unsigned_ + extern f_status_t fl_conversion_dynamic_to_octal_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_to_octal_unsigned_ + +/** + * Convert a series of positive or negative number characters into an f_number_signed_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will process signed statuses (+/-). + * This will detect based types as follows: + * - hexidecimals begin with either '0x' or '0X'. + * - duodecimals begin with either '0d' or '0D'. + * - octals begin with either '0o' or '0O'. + * - binaries begin with either '0b' or '0B'. + * - decimal is used for all other cases. + * + * Leading 0's and whitespace are ignored. + * Whitespace after the first digit is considered invalid. + * + * This function is similar to strtoll(), but the behavior of error handling and special bases are different. + * In particular, octals are specified here with '0b' prefix or '0B' prefix instead of the ridiculous '0' prefix. + * + * @param dynamic + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none on success. + * F_data_not if string starts with a null (length is 0). + * + * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found. + * F_number (with error bit) if parameter is not a number. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_number_underflow (with error bit) on integer underflow. + * F_parameter (with error bit) if a parameter is invalid. + * + * @see strtoll() + */ +#ifndef _di_fl_conversion_dynamic_to_number_signed_ + extern f_status_t fl_conversion_dynamic_to_number_signed(const f_string_static_t dynamic, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_to_number_signed_ + +/** + * Convert a series of positive number characters into an f_number_unsigned_t. + * + * This will stop at one of the following: a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * This will detect based types as follows: + * - hexidecimals begin with either '0x' or '0X'. + * - duodecimals begin with either '0d' or '0D'. + * - octals begin with either '0o' or '0O'. + * - binaries begin with either '0b' or '0B'. + * - decimal is used for all other cases. + * + * Leading 0's and whitespace are ignored. + * Whitespace after the first digit is considered invalid. + * + * This function is similar to strtoull(), but the behavior of error handling and special bases are different. + * In particular, octals are specified here with '0b' prefix or '0B' prefix instead of the ridiculous '0' prefix. + * Negative values are reported as such instead of being converted into the unsigned equivalent. + * + * @param dynamic + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none on success. + * F_data_not if string starts with a null (length is 0). + * + * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found. + * F_number (with error bit) if parameter is not a number. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_negative (with error bit) on negative value. + * F_number_positive (with error bit) on positive value (has a +, such as '+1', when only '1' is valid here). + * F_number_overflow (with error bit) on integer overflow. + * F_parameter (with error bit) if a parameter is invalid. + * + * @see strtoull() + */ +#ifndef _di_fl_conversion_dynamic_to_number_unsigned_ + extern f_status_t fl_conversion_dynamic_to_number_unsigned(const f_string_static_t dynamic, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_to_number_unsigned_ #ifdef __cplusplus } // extern "C" diff --git a/level_1/fl_conversion/c/private-conversion.c b/level_1/fl_conversion/c/private-conversion.c index 16c10cd..4a3fad1 100644 --- a/level_1/fl_conversion/c/private-conversion.c +++ b/level_1/fl_conversion/c/private-conversion.c @@ -5,18 +5,14 @@ extern "C" { #endif -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_number_unsigned_) - f_status_t private_fl_conversion_string_to_binary_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) { - - if (!string[0]) { - return F_data_not; - } +#if !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) + f_status_t private_fl_conversion_dynamic_to_binary_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; ++i) { + for (f_array_length_t i = 0; i < length; ++i) { if (string[i] == 0x2e) { return F_status_set_error(F_number_decimal); @@ -63,20 +59,16 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_binary_signed_) +#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_binary_unsigned_) - f_status_t private_fl_conversion_string_to_binary_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) { - - if (!string[0]) { - return F_data_not; - } +#if !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + f_status_t private_fl_conversion_dynamic_to_binary_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; ++i) { + for (f_array_length_t i = 0; i < length; ++i) { if (string[i] == 0x2e) { return F_status_set_error(F_number_decimal); @@ -107,20 +99,16 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_binary_unsigned_) - -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_decimal_signed_) - f_status_t private_fl_conversion_string_to_decimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) { +#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - if (!string[0]) { - return F_data_not; - } +#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) + f_status_t private_fl_conversion_dynamic_to_decimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; ++i) { + for (f_array_length_t i = 0; i < length; ++i) { if (string[i] == 0x2e) { return F_status_set_error(F_number_decimal); @@ -172,20 +160,16 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_decimal_signed_) - -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_decimal_unsigned_) - f_status_t private_fl_conversion_string_to_decimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) { +#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - if (!string[0]) { - return F_data_not; - } +#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + f_status_t private_fl_conversion_dynamic_to_decimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; ++i) { + for (f_array_length_t i = 0; i < length; ++i) { if (string[i] == 0x2e) { return F_status_set_error(F_number_decimal); @@ -219,20 +203,16 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_decimal_unsigned_) +#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_duodecimal_signed_) - f_status_t private_fl_conversion_string_to_duodecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) { - - if (!string[0]) { - return F_data_not; - } +#if !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) + f_status_t private_fl_conversion_dynamic_to_duodecimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; ++i) { + for (f_array_length_t i = 0; i < length; ++i) { if (string[i] == 0x2e) { return F_status_set_error(F_number_decimal); @@ -284,20 +264,16 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_duodecimal_signed_) +#endif // !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_duodecimal_unsigned_) - f_status_t private_fl_conversion_string_to_duodecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) { - - if (!string[0]) { - return F_data_not; - } +#if !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + f_status_t private_fl_conversion_dynamic_to_duodecimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; ++i) { + for (f_array_length_t i = 0; i < length; ++i) { if (string[i] == 0x2e) { return F_status_set_error(F_number_decimal); @@ -331,20 +307,16 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_duodecimal_unsigned_) +#endif // !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_hexidecimal_signed_) - f_status_t private_fl_conversion_string_to_hexidecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) { - - if (!string[0]) { - return F_data_not; - } +#if !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) + f_status_t private_fl_conversion_dynamic_to_hexidecimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; ++i) { + for (f_array_length_t i = 0; i < length; ++i) { if (string[i] == 0x2e) { return F_status_set_error(F_number_decimal); @@ -393,22 +365,19 @@ extern "C" { } // for *number = converted; + return F_none; } -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_hexidecimal_signed_) +#endif // !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_hexidecimal_unsigned_) - f_status_t private_fl_conversion_string_to_hexidecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) { - - if (!string[0]) { - return F_data_not; - } +#if !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + f_status_t private_fl_conversion_dynamic_to_hexidecimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; ++i) { + for (f_array_length_t i = 0; i < length; ++i) { if (string[i] == 0x2e) { return F_status_set_error(F_number_decimal); @@ -439,22 +408,19 @@ extern "C" { } // for *number = converted; + return F_none; } -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_hexidecimal_unsigned_) +#endif // !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_octal_signed_) - f_status_t private_fl_conversion_string_to_octal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) { - - if (!string[0]) { - return F_data_not; - } +#if !defined(_di_fl_conversion_dynamic_partial_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) + f_status_t private_fl_conversion_dynamic_to_octal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; ++i) { + for (f_array_length_t i = 0; i < length; ++i) { if (string[i] == 0x2e) { return F_status_set_error(F_number_decimal); @@ -506,20 +472,16 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_octal_signed_) - -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_octal_unsigned_) - f_status_t private_fl_conversion_string_to_octal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) { +#endif // !defined(_di_fl_conversion_dynamic_partial_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - if (!string[0]) { - return F_data_not; - } +#if !defined(_di_fl_conversion_dynamic_partial_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + f_status_t private_fl_conversion_dynamic_to_octal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; ++i) { + for (f_array_length_t i = 0; i < length; ++i) { if (string[i] == 0x2e) { return F_status_set_error(F_number_decimal); @@ -553,7 +515,307 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_octal_unsigned_) +#endif // !defined(_di_fl_conversion_dynamic_partial_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + +#if !defined(_di_fl_conversion_dynamic_to_number_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) + f_status_t private_fl_conversion_dynamic_to_number_signed(const f_string_t string, const f_array_length_t length, f_number_signed_t * const number) { + + uint8_t width = 0; + f_array_length_t width_max = 0; + uint8_t mode = 0; + int8_t vector = 0; // 0 for assumed positive, 1 for explicit positive, -1 for negative. + f_array_length_t j = 0; + f_array_length_t offset = 0; + f_status_t status = F_none; + + for (f_array_length_t i = 0; i < length; ++i) { + + width = macro_f_utf_byte_width_is(string[i]); + + if (!width) { + if (isspace(string[i])) { + if (!mode && !vector) { + ++offset; + + continue; + } + + return F_status_set_error(F_number); + } + } + else { + if (!mode && !vector) { + width_max = length - i; + + status = f_utf_is_whitespace(string + i, width_max); + + if (status == F_true) { + offset = i + 1; + + continue; + } + + if (F_status_is_error(status)) { + if (status == F_status_set_error(F_maybe)) { + status = F_status_set_error(F_complete_not_utf); + } + + return status; + } + } + + return F_status_set_error(F_number); + } + + if (string[i] == 0x30) { + + // Skip past all NULLs. + for (j = i + 1; j < length; ++j) { + if (string[j]) break; + } // for + + // Immediate next value must be either a number, 'x', 'X', 'd', 'D', 'o', 'O', 'b', or 'B'. + if (j >= length) { + *number = 0; + return F_none; + } + else if (string[j] > 0x2f && string[j] < 0x3a) { + mode = 10; + } + else if (string[j] == 0x78 || string[j] == 0x58) { + mode = 16; + offset += 2; + } + else if (string[j] == 0x44 || string[j] == 0x64) { + mode = 12; + offset += 2; + } + else if (string[j] == 0x6f || string[j] == 0x4f) { + mode = 8; + offset += 2; + } + else if (string[j] == 0x62 || string[j] == 0x42) { + mode = 2; + offset += 2; + } + else if (string[j] == 0x2e) { + return F_status_set_error(F_number_decimal); + } + else { + return F_status_set_error(F_number); + } + + break; + } + + // Plus sign is only allowed as the first non-whitespace character. + if (string[i] == 0x2b) { + if (!mode && !vector) { + vector = 1; + ++offset; + } + else { + return F_status_set_error(F_number); + } + } + + // Negative sign is not allowed. + if (string[i] == 0x2d) { + if (!mode && !vector) { + vector = -1; + ++offset; + } + else { + return F_status_set_error(F_number); + } + } + + if (f_conversion_character_is_decimal(string[i]) == F_true) { + mode = 10; + break; + } + + return F_status_set_error(F_number); + } // for + + if (!mode) { + return F_status_set_error(F_number); + } + + if (offset >= length) { + return F_status_set_error(F_number); + } + + if (mode == 10) { + return private_fl_conversion_dynamic_to_decimal_signed(string + offset, length - offset, vector == -1, number); + } + + if (mode == 16) { + return private_fl_conversion_dynamic_to_hexidecimal_signed(string + offset, length - offset, vector == -1, number); + } + + if (mode == 12) { + return private_fl_conversion_dynamic_to_duodecimal_signed(string + offset, length - offset, vector == -1, number); + } + + if (mode == 8) { + return private_fl_conversion_dynamic_to_octal_signed(string + offset, length - offset, vector == -1, number); + } + + return private_fl_conversion_dynamic_to_binary_signed(string + offset, length - offset, vector == -1, number); + } +#endif // !defined(_di_fl_conversion_dynamic_to_number_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) + +#if !defined(_di_fl_conversion_dynamic_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) + f_status_t private_fl_conversion_dynamic_to_number_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { + + uint8_t width = 0; + f_array_length_t width_max = 0; + uint8_t mode = 0; + f_array_length_t j = 0; + f_array_length_t offset = 0; + f_status_t status = F_none; + int8_t sign_found = 0; + + for (f_array_length_t i = 0; i < length; ++i) { + + width = macro_f_utf_byte_width_is(string[i]); + + if (!width) { + if (isspace(string[i])) { + if (!mode) { + ++offset; + + continue; + } + + return F_status_set_error(F_number); + } + } + else { + if (!mode) { + width_max = length - i; + + status = f_utf_is_whitespace(string + i, width_max); + + if (status == F_true) { + offset = i + 1; + + continue; + } + + if (F_status_is_error(status)) { + if (status == F_status_set_error(F_maybe)) { + status = F_status_set_error(F_complete_not_utf); + } + + return status; + } + } + + return F_status_set_error(F_number); + } + + if (string[i] == 0x30) { + + // Skip past all NULLs. + for (j = i + 1; j < length; ++j) { + if (string[j]) break; + } // for + + // Immediate next value must be either a number, 'x', 'X', 'd', 'D', 'o', 'O', 'b', or 'B'. + if (j >= length) { + *number = 0; + + return F_none; + } + else if (string[j] > 0x2f && string[j] < 0x3a) { + mode = 10; + } + else if (string[j] == 0x78 || string[j] == 0x58) { + mode = 16; + offset += 2; + } + else if (string[j] == 0x44 || string[j] == 0x64) { + mode = 12; + offset += 2; + } + else if (string[j] == 0x6f || string[j] == 0x4f) { + mode = 8; + offset += 2; + } + else if (string[j] == 0x62 || string[j] == 0x42) { + mode = 2; + offset += 2; + } + else if (string[j] == 0x2e) { + return F_status_set_error(F_number_decimal); + } + else { + return F_status_set_error(F_number); + } + + break; + } + + if (string[i] == 0x2b) { + ++offset; + sign_found = 1; + } + + if (string[i] == 0x2d) { + ++offset; + sign_found = -1; + } + + if (f_conversion_character_is_decimal(string[i]) == F_true) { + mode = 10; + break; + } + + return F_status_set_error(F_number); + } // for + + if (!mode) { + return F_status_set_error(F_number); + } + + if (offset >= length) { + return F_status_set_error(F_number); + } + + if (mode == 10) { + status = private_fl_conversion_dynamic_to_decimal_unsigned(string + offset, length - offset, number); + } + else if (mode == 16) { + status = private_fl_conversion_dynamic_to_hexidecimal_unsigned(string + offset, length - offset, number); + } + else if (mode == 12) { + status = private_fl_conversion_dynamic_to_duodecimal_unsigned(string + offset, length - offset, number); + } + else if (mode == 8) { + status = private_fl_conversion_dynamic_to_octal_unsigned(string + offset, length - offset, number); + } + else { + status = private_fl_conversion_dynamic_to_binary_unsigned(string + offset, length - offset, number); + } + + // +/- signs are not allowed. + if (sign_found) { + if (status == F_none) { + if (sign_found == -1) { + return F_status_set_error(F_number_negative); + } + + return F_status_set_error(F_number_positive); + } + + return F_status_set_error(F_number); + } + + return status; + } +#endif // !defined(_di_fl_conversion_dynamic_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) #ifdef __cplusplus } // extern "C" diff --git a/level_1/fl_conversion/c/private-conversion.h b/level_1/fl_conversion/c/private-conversion.h index a34b0bb..d9c1b79 100644 --- a/level_1/fl_conversion/c/private-conversion.h +++ b/level_1/fl_conversion/c/private-conversion.h @@ -16,14 +16,14 @@ extern "C" { #endif /** - * Private implementation of fl_conversion_string_to_binary_signed(). + * Private implementation of fl_conversion_dynamic_to_binary_signed(). * * Intended to be shared to each of the different implementation variations. * * @param string * The string to convert. - * @param location - * The start/stop range to convert. + * @param length + * The length of the string to convert. * @param negative * Set to 0 to treat string as a positive number, 1 for as a negative number. * @param number @@ -39,20 +39,25 @@ extern "C" { * F_number_overflow (with error bit) on integer overflow. * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. + * + * @see fl_conversion_dynamic_partial_to_binary_signed() + * @see fl_conversion_dynamic_partial_to_number_signed() + * @see fl_conversion_dynamic_to_binary_signed() + * @see fl_conversion_dynamic_to_number_signed() */ -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_binary_signed_) - extern f_status_t private_fl_conversion_string_to_binary_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number); -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_binary_signed_) +#if !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) + extern f_status_t private_fl_conversion_dynamic_to_binary_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) /** - * Private implementation of fl_conversion_string_to_binary_unsigned(). + * Private implementation of fl_conversion_dynamic_to_binary_unsigned(). * * Intended to be shared to each of the different implementation variations. * * @param string * The string to convert. - * @param range - * The start/stop range to convert. + * @param length + * The length of the string to convert. * @param number * This will store the value of the converted string. * This value is only changed on success. @@ -65,20 +70,25 @@ extern "C" { * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. + * + * @see fl_conversion_dynamic_partial_to_binary_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_to_binary_unsigned() + * @see fl_conversion_dynamic_to_number_unsigned() */ -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_binary_unsigned_) - extern f_status_t private_fl_conversion_string_to_binary_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number); -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_binary_unsigned_) +#if !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + extern f_status_t private_fl_conversion_dynamic_to_binary_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) /** - * Private implementation of fl_conversion_string_to_decimal_signed(). + * Private implementation of fl_conversion_dynamic_to_decimal_signed(). * * Intended to be shared to each of the different implementation variations. * * @param string * The string to convert. - * @param range - * The start/stop range to convert. + * @param length + * The length of the string to convert. * @param negative * Set to 0 to treat string as a positive number, 1 for as a negative number. * @param number @@ -94,20 +104,25 @@ extern "C" { * F_number_overflow (with error bit) on integer overflow. * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. + * + * @see fl_conversion_dynamic_partial_to_decimal_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_to_decimal_unsigned() + * @see fl_conversion_dynamic_to_number_unsigned() */ -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_decimal_signed_) - extern f_status_t private_fl_conversion_string_to_decimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number); -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_decimal_signed_) +#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) + extern f_status_t private_fl_conversion_dynamic_to_decimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) /** - * Private implementation of fl_conversion_string_to_decimal_unsigned(). + * Private implementation of fl_conversion_dynamic_to_decimal_unsigned(). * * Intended to be shared to each of the different implementation variations. * * @param string * The string to convert. - * @param range - * The start/stop range to convert. + * @param length + * The length of the string to convert. * @param number * This will store the value of the converted string. * This value is only changed on success. @@ -120,20 +135,25 @@ extern "C" { * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. + * + * @see fl_conversion_dynamic_partial_to_decimal_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_to_decimal_unsigned() + * @see fl_conversion_dynamic_to_number_unsigned() */ -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_decimal_unsigned_) - extern f_status_t private_fl_conversion_string_to_decimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number); -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_decimal_unsigned_) +#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + extern f_status_t private_fl_conversion_dynamic_to_decimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) /** - * Private implementation of fl_conversion_string_to_duodecimal_signed(). + * Private implementation of fl_conversion_dynamic_to_duodecimal_signed(). * * Intended to be shared to each of the different implementation variations. * * @param string * The string to convert. - * @param range - * The start/stop range to convert. + * @param length + * The length of the string to convert. * @param negative * Set to 0 to treat string as a positive number, 1 for as a negative number. * @param number @@ -149,20 +169,25 @@ extern "C" { * F_number_overflow (with error bit) on integer overflow. * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. + * + * @see fl_conversion_dynamic_partial_to_duodecimal_signed() + * @see fl_conversion_dynamic_partial_to_number_signed() + * @see fl_conversion_dynamic_to_duodecimal_signed() + * @see fl_conversion_dynamic_to_number_signed() */ -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_duodecimal_signed_) - extern f_status_t private_fl_conversion_string_to_duodecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number); -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_duodecimal_signed_) +#if !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) + extern f_status_t private_fl_conversion_dynamic_to_duodecimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) /** - * Private implementation of fl_conversion_string_to_duodecimal_unsigned(). + * Private implementation of fl_conversion_dynamic_to_duodecimal_unsigned(). * * Intended to be shared to each of the different implementation variations. * * @param string * The string to convert. - * @param range - * The start/stop range to convert. + * @param length + * The length of the string to convert. * @param number * This will store the value of the converted string. * This value is only changed on success. @@ -175,20 +200,25 @@ extern "C" { * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. + * + * @see fl_conversion_dynamic_partial_to_duodecimal_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_to_duodecimal_unsigned() + * @see fl_conversion_dynamic_to_number_unsigned() */ -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_duodecimal_unsigned_) - extern f_status_t private_fl_conversion_string_to_duodecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number); -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_duodecimal_unsigned_) +#if !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + extern f_status_t private_fl_conversion_dynamic_to_duodecimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) /** - * Private implementation of fl_conversion_string_to_hexidecimal_signed(). + * Private implementation of fl_conversion_dynamic_to_hexidecimal_signed(). * * Intended to be shared to each of the different implementation variations. * * @param string * The string to convert. - * @param range - * The start/stop range to convert. + * @param length + * The length of the string to convert. * @param negative * Set to 0 to treat string as a positive number, 1 for as a negative number. * @param number @@ -204,20 +234,25 @@ extern "C" { * F_number_overflow (with error bit) on integer overflow. * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. + * + * @see fl_conversion_dynamic_partial_to_hexidecimal_signed() + * @see fl_conversion_dynamic_partial_to_number_signed() + * @see fl_conversion_dynamic_to_hexidecimal_signed() + * @see fl_conversion_dynamic_to_number_signed() */ -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_hexidecimal_signed_) - extern f_status_t private_fl_conversion_string_to_hexidecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number); -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_hexidecimal_signed_) +#if !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) + extern f_status_t private_fl_conversion_dynamic_to_hexidecimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) /** - * Private implementation of fl_conversion_string_to_hexidecimal_unsigned(). + * Private implementation of fl_conversion_dynamic_to_hexidecimal_unsigned(). * * Intended to be shared to each of the different implementation variations. * * @param string * The string to convert. - * @param range - * The start/stop range to convert. + * @param length + * The length of the string to convert. * @param number * This will store the value of the converted string. * This value is only changed on success. @@ -230,20 +265,25 @@ extern "C" { * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. + * + * @see fl_conversion_dynamic_partial_to_hexidecimal_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_to_hexidecimal_unsigned() + * @see fl_conversion_dynamic_to_number_unsigned() */ -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_hexidecimal_unsigned_) - extern f_status_t private_fl_conversion_string_to_hexidecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number); -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_hexidecimal_unsigned_) +#if !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + extern f_status_t private_fl_conversion_dynamic_to_hexidecimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) /** - * Private implementation of fl_conversion_string_to_octal_signed(). + * Private implementation of fl_conversion_dynamic_to_octal_signed(). * * Intended to be shared to each of the different implementation variations. * * @param string * The string to convert. - * @param range - * The start/stop range to convert. + * @param length + * The length of the string to convert. * @param negative * Set to 0 to treat string as a positive number, 1 for as a negative number. * @param number @@ -258,20 +298,25 @@ extern "C" { * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. + * + * @see fl_conversion_dynamic_partial_to_octal_signed() + * @see fl_conversion_dynamic_partial_to_number_signed() + * @see fl_conversion_dynamic_to_octal_signed() + * @see fl_conversion_dynamic_to_number_signed() */ -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_octal_signed_) - extern f_status_t private_fl_conversion_string_to_octal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number); -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_octal_signed_) +#if !defined(_di_fl_conversion_dynamic_partial_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) + extern f_status_t private_fl_conversion_dynamic_to_octal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) /** - * Private implementation of fl_conversion_string_to_octal_unsigned(). + * Private implementation of fl_conversion_dynamic_to_octal_unsigned(). * * Intended to be shared to each of the different implementation variations. * * @param string * The string to convert. - * @param range - * The start/stop range to convert. + * @param length + * The length of the string to convert. * @param number * This will store the value of the converted string. * This value is only changed on success. @@ -284,10 +329,74 @@ extern "C" { * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. + * + * @see fl_conversion_dynamic_partial_to_octal_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_to_octal_unsigned() + * @see fl_conversion_dynamic_to_number_unsigned() + */ +#if !defined(_di_fl_conversion_dynamic_partial_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + extern f_status_t private_fl_conversion_dynamic_to_octal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) + +/** + * Private implementation of fl_conversion_dynamic_to_number_signed(). + * + * Intended to be shared to each of the different implementation variations. + * + * @param string + * The string to convert. + * @param length + * The length of the string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none on success. + * F_data_not if string starts with a null (length is 0). + * + * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found. + * F_number (with error bit) if parameter is not a number. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_overflow (with error bit) on integer overflow. + * F_number_underflow (with error bit) on integer underflow. + * F_parameter (with error bit) if a parameter is invalid. + */ +#if !defined(_di_fl_conversion_dynamic_to_number_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) + extern f_status_t private_fl_conversion_dynamic_to_number_signed(const f_string_t string, const f_array_length_t length, f_number_signed_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_to_number_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) + +/** + * Private implementation of fl_conversion_dynamic_to_number_unsigned(). + * + * Intended to be shared to each of the different implementation variations. + * + * @param string + * The string to convert. + * @param range + * The start/stop range to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * + * @return + * F_none on success. + * F_data_not if string starts with a null (length is 0). + * + * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found. + * F_number (with error bit) if parameter is not a number. + * F_number_decimal (with error bit) if number has a decimal digit. + * F_number_negative (with error bit) on negative value. + * F_number_positive (with error bit) on positive value (has a +, such as '+1', when only '1' is valid here). + * F_number_overflow (with error bit) on integer overflow. + * F_parameter (with error bit) if a parameter is invalid. + * + * @see strtoull() */ -#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_octal_unsigned_) - extern f_status_t private_fl_conversion_string_to_octal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number); -#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_octal_unsigned_) +#if !defined(_di_fl_conversion_dynamic_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) + extern f_status_t private_fl_conversion_dynamic_to_number_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) #ifdef __cplusplus } // extern "C" diff --git a/level_1/fl_execute/c/execute.h b/level_1/fl_execute/c/execute.h index bcb0094..2b9c76c 100644 --- a/level_1/fl_execute/c/execute.h +++ b/level_1/fl_execute/c/execute.h @@ -14,7 +14,7 @@ #ifndef _FL_execute_h #define _FL_execute_h -// include pre-requirements +// Include pre-requirements. #define _GNU_SOURCE // Libc includes. diff --git a/level_2/fll_execute/c/execute.h b/level_2/fll_execute/c/execute.h index 918ea45..e86a8ba 100644 --- a/level_2/fll_execute/c/execute.h +++ b/level_2/fll_execute/c/execute.h @@ -13,7 +13,7 @@ #ifndef _FLL_execute_h #define _FLL_execute_h -// include pre-requirements +// Include pre-requirements. #define _GNU_SOURCE // Libc includes. diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index e0aae3e..011f205 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -279,11 +279,9 @@ extern "C" { if (main->parameters.array[byte_dump_parameter_width_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[byte_dump_parameter_width_e].values.array[main->parameters.array[byte_dump_parameter_width_e].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used); - f_number_unsigned_t number = 0; - status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number); + status = fl_conversion_dynamic_to_number_unsigned(argv[index], &number); if (F_status_is_error(status) || number < 1 || number >= 0xfb) { flockfile(main->error.to.stream); @@ -324,11 +322,9 @@ extern "C" { if (main->parameters.array[byte_dump_parameter_first_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[byte_dump_parameter_first_e].values.array[main->parameters.array[byte_dump_parameter_first_e].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used); - f_number_unsigned_t number = 0; - status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number); + status = fl_conversion_dynamic_to_number_unsigned(argv[index], &number); if (F_status_is_error(status) || number > F_number_t_size_unsigned_d) { flockfile(main->error.to.stream); @@ -369,11 +365,9 @@ extern "C" { if (main->parameters.array[byte_dump_parameter_last_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[byte_dump_parameter_last_e].values.array[main->parameters.array[byte_dump_parameter_last_e].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used); - f_number_unsigned_t number = 0; - status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number); + status = fl_conversion_dynamic_to_number_unsigned(argv[index], &number); if (F_status_is_error(status) || number < 0 || number > F_number_t_size_unsigned_d) { flockfile(main->error.to.stream); diff --git a/level_3/controller/c/controller/private-controller.c b/level_3/controller/c/controller/private-controller.c index 2677062..e9c1a50 100644 --- a/level_3/controller/c/controller/private-controller.c +++ b/level_3/controller/c/controller/private-controller.c @@ -238,7 +238,7 @@ extern "C" { if (!isspace(pid_buffer.string[range.stop])) break; } // for - status = fl_conversion_string_to_decimal_unsigned(pid_buffer.string, range, &number); + status = fl_conversion_dynamic_partial_to_decimal_unsigned(pid_buffer, range, &number); if (F_status_is_error_not(status) && number == pid) { status = f_file_remove(path); @@ -291,7 +291,7 @@ extern "C" { if (!isspace(pid_buffer.string[range.stop])) break; } // for - status = fl_conversion_string_to_decimal_unsigned(pid_buffer.string, range, &number); + status = fl_conversion_dynamic_partial_to_decimal_unsigned(pid_buffer, range, &number); if (F_status_is_error_not(status)) { *pid = (pid_t) number; @@ -309,7 +309,7 @@ extern "C" { f_number_unsigned_t number = 0; - f_status_t status = fl_conversion_string_to_number_unsigned(buffer.string, range, &number); + f_status_t status = fl_conversion_dynamic_partial_to_number_unsigned(buffer, range, &number); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_number) { @@ -344,7 +344,7 @@ extern "C" { f_number_unsigned_t number = 0; - f_status_t status = fl_conversion_string_to_number_unsigned(buffer.string, range, &number); + f_status_t status = fl_conversion_dynamic_partial_to_number_unsigned(buffer, range, &number); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_number) { diff --git a/level_3/controller/c/controller/private-controller.h b/level_3/controller/c/controller/private-controller.h index 01e2541..52ad1cb 100644 --- a/level_3/controller/c/controller/private-controller.h +++ b/level_3/controller/c/controller/private-controller.h @@ -172,7 +172,7 @@ extern "C" { * Errors (with error bit) from: f_file_stream_close(). * Errors (with error bit) from: f_file_stream_open(). * Errors (with error bit) from: f_file_stream_read(). - * Errors (with error bit) from: fl_conversion_string_to_decimal_unsigned() + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_decimal_unsigned() */ #ifndef _di_controller_file_pid_delete_ f_status_t controller_file_pid_delete(const pid_t pid, const f_string_static_t path) F_attribute_visibility_internal_d; @@ -192,7 +192,7 @@ extern "C" { * Errors (with error bit) from: f_file_stream_close(). * Errors (with error bit) from: f_file_stream_open(). * Errors (with error bit) from: f_file_stream_read(). - * Errors (with error bit) from: fl_conversion_string_to_decimal_unsigned() + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_decimal_unsigned() */ #ifndef _di_controller_file_pid_read_ f_status_t controller_file_pid_read(const f_string_static_t path, pid_t * const pid) F_attribute_visibility_internal_d; @@ -216,10 +216,10 @@ extern "C" { * F_number_too_large (with error bit) if the given ID is too large. * * Errors (with error bit) from: f_account_id_by_name(). - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * * @see f_account_id_by_name() - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() */ #ifndef _di_controller_get_id_user_ f_status_t controller_get_id_user(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, uid_t * const id) F_attribute_visibility_internal_d; @@ -243,10 +243,10 @@ extern "C" { * F_number_too_large (with error bit) if the given ID is too large. * * Errors (with error bit) from: f_account_group_id_by_name(). - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * * @see f_account_group_id_by_name() - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() */ #ifndef _di_controller_get_id_group_ f_status_t controller_get_id_group(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, gid_t * const id) F_attribute_visibility_internal_d; diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index f835858..49f548e 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -591,9 +591,7 @@ extern "C" { } if (action->status == F_none) { - const f_string_range_t range = macro_f_string_range_t_initialize(action->parameters.array[1].used); - - status = fl_conversion_string_to_number_unsigned(action->parameters.array[1].string, range, &action->number); + status = fl_conversion_dynamic_to_number_unsigned(action->parameters.array[1], &action->number); if (F_status_is_error(status) || status == F_data_not) { action->number = 0; @@ -606,9 +604,10 @@ extern "C" { } if (F_status_set_fine(status) == F_memory_not) { - controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, global.thread); + controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, global.thread); status_action = status; + break; } diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index 03cb8e1..2e45f1b 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -691,10 +691,10 @@ extern "C" { status = F_status_set_error(F_valid_not); } else { - status = fl_conversion_string_to_number_signed(cache->buffer_item.string, cache->content_action.array[++(*index)], &parsed); + status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, cache->content_action.array[++(*index)], &parsed); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_string_to_number_signed(cache->buffer_item.string, controller_range_after_number_sign(cache->buffer_item, cache->content_action.array[*index]), &parsed); + status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_action.array[*index]), &parsed); } if (status == F_data_not) { @@ -3720,10 +3720,10 @@ extern "C" { break; } - status = fl_conversion_string_to_number_signed(cache->buffer_item.string, cache->content_actions.array[i].array[j], &number); + status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, cache->content_actions.array[i].array[j], &number); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_string_to_number_signed(cache->buffer_item.string, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number); + status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number); // Restore error on parameter problem. if (F_status_set_fine(status) == F_parameter) { @@ -3752,7 +3752,7 @@ extern "C" { } } else { - controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_signed", F_true, F_false); + controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_signed", F_true, F_false); status = F_status_set_error(status); @@ -4113,10 +4113,10 @@ extern "C" { for (j = 1; j < 3; ++j, number = 0) { - status = fl_conversion_string_to_number_signed(cache->buffer_item.string, cache->content_actions.array[i].array[j], &number); + status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, cache->content_actions.array[i].array[j], &number); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_string_to_number_signed(cache->buffer_item.string, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number); + status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number); // Restore error on parameter problem. if (F_status_set_fine(status) == F_parameter) { @@ -4145,7 +4145,7 @@ extern "C" { } } else { - controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_signed", F_true, F_false); + controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_signed", F_true, F_false); status = F_status_set_error(status); @@ -4357,10 +4357,10 @@ extern "C" { f_number_signed_t number = 0; - status = fl_conversion_string_to_number_signed(cache->buffer_item.string, cache->content_actions.array[i].array[1], &number); + status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, cache->content_actions.array[i].array[1], &number); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_string_to_number_signed(cache->buffer_item.string, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number); + status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number); // Restore error on parameter problem. if (F_status_set_fine(status) == F_parameter) { @@ -4407,7 +4407,7 @@ extern "C" { } } else { - controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false); + controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_dynamic_partial_to_number_signed", F_true, F_false); status = F_status_set_error(status); if (F_status_is_error_not(status_return)) { @@ -4479,10 +4479,10 @@ extern "C" { f_number_unsigned_t number = 0; - status = fl_conversion_string_to_number_unsigned(cache->buffer_item.string, cache->content_actions.array[i].array[1], &number); + status = fl_conversion_dynamic_partial_to_number_unsigned(cache->buffer_item, cache->content_actions.array[i].array[1], &number); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_string_to_number_unsigned(cache->buffer_item.string, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number); + status = fl_conversion_dynamic_partial_to_number_unsigned(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number); // Restore error on parameter problem. if (F_status_set_fine(status) == F_parameter) { @@ -4507,7 +4507,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false); + controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_dynamic_partial_to_number_signed", F_true, F_false); } if (F_status_is_error_not(status_return)) { @@ -4633,10 +4633,10 @@ extern "C" { else if (type == controller_rule_setting_type_nice_e) { f_number_signed_t number = 0; - status = fl_conversion_string_to_number_signed(cache->buffer_item.string, cache->content_actions.array[i].array[0], &number); + status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, cache->content_actions.array[i].array[0], &number); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_string_to_number_signed(cache->buffer_item.string, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[0]), &number); + status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[0]), &number); // Restore error on parameter problem. if (F_status_set_fine(status) == F_parameter) { @@ -4676,7 +4676,7 @@ extern "C" { } } else { - controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false); + controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_dynamic_partial_to_number_signed", F_true, F_false); status = F_status_set_error(status); if (F_status_is_error_not(status_return)) { diff --git a/level_3/controller/c/rule/private-rule.h b/level_3/controller/c/rule/private-rule.h index 2384a29..383d5b1 100644 --- a/level_3/controller/c/rule/private-rule.h +++ b/level_3/controller/c/rule/private-rule.h @@ -667,10 +667,10 @@ extern "C" { * * F_valid_not (with error bit) on failure due to invalid value. * - * Errors (with error bit) from: fl_conversion_string_to_number_signed(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_signed(). * * @see controller_rule_action_read() - * @see fl_conversion_string_to_number_signed() + * @see fl_conversion_dynamic_partial_to_number_signed() */ #ifndef _di_controller_rule_action_read_rerun_number_ extern f_status_t controller_rule_action_read_rerun_number(const controller_global_t global, const f_string_t name, controller_cache_t * const cache, f_array_length_t * const index, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; diff --git a/level_3/fake/c/private-make-operate_process_type.c b/level_3/fake/c/private-make-operate_process_type.c index 38ae4db..31eac13 100644 --- a/level_3/fake/c/private-make-operate_process_type.c +++ b/level_3/fake/c/private-make-operate_process_type.c @@ -653,7 +653,7 @@ extern "C" { status = F_status_set_error(F_failure); } else { - status = fl_conversion_string_to_number_unsigned(arguments.array[i].string, range, &number_left); + status = fl_conversion_dynamic_partial_to_number_unsigned(arguments.array[i], range, &number_left); } if (F_status_is_error_not(status)) { @@ -677,7 +677,7 @@ extern "C" { status = F_status_set_error(F_failure); } else { - status = fl_conversion_string_to_number_unsigned(arguments.array[i].string, range, &number_right); + status = fl_conversion_dynamic_partial_to_number_unsigned(arguments.array[i], range, &number_right); } } else { diff --git a/level_3/fake/c/private-make-operate_process_type.h b/level_3/fake/c/private-make-operate_process_type.h index 4be8a14..bdc1ed4 100644 --- a/level_3/fake/c/private-make-operate_process_type.h +++ b/level_3/fake/c/private-make-operate_process_type.h @@ -166,9 +166,9 @@ extern "C" { * @return * F_none on success. * - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() */ #ifndef _di_fake_make_operate_process_type_if_greater_if_lesser_ extern f_status_t fake_make_operate_process_type_if_greater_if_lesser(fake_make_data_t * const data_make, const f_string_dynamics_t arguments, fake_state_process_t *state_process) F_attribute_visibility_internal_d; diff --git a/level_3/fake/c/private-make-operate_validate.c b/level_3/fake/c/private-make-operate_validate.c index 6d4d7f5a..60132f5 100644 --- a/level_3/fake/c/private-make-operate_validate.c +++ b/level_3/fake/c/private-make-operate_validate.c @@ -1016,7 +1016,7 @@ extern "C" { status_number = F_status_set_error(F_failure); } else { - status_number = fl_conversion_string_to_number_unsigned(arguments.array[i].string, range, &number); + status_number = fl_conversion_dynamic_partial_to_number_unsigned(arguments.array[i], range, &number); } } else { diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index 464ad45..6156140 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -50,11 +50,9 @@ extern "C" { #ifndef _di_fake_make_get_id_group_ f_status_t fake_make_get_id_group(fake_main_t * const main, const fl_print_t print, const f_string_static_t buffer, gid_t *id) { - const f_string_range_t range = macro_f_string_range_t_initialize(buffer.used); - f_number_unsigned_t number = 0; - f_status_t status = fl_conversion_string_to_number_unsigned(buffer.string, range, &number); + f_status_t status = fl_conversion_dynamic_to_number_unsigned(buffer, &number); if (F_status_is_error(status)) { status = F_status_set_fine(status); @@ -84,7 +82,7 @@ extern "C" { return F_none; } - fll_error_print(print, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true); + fll_error_print(print, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true); return F_status_set_error(status); } else if (number > F_type_size_32_unsigned_d) { @@ -141,11 +139,9 @@ extern "C" { #ifndef _di_fake_make_get_id_owner_ f_status_t fake_make_get_id_owner(fake_main_t * const main, const fl_print_t print, const f_string_static_t buffer, uid_t *id) { - const f_string_range_t range = macro_f_string_range_t_initialize(buffer.used); - f_number_unsigned_t number = 0; - f_status_t status = fl_conversion_string_to_number_unsigned(buffer.string, range, &number); + f_status_t status = fl_conversion_dynamic_to_number_unsigned(buffer, &number); if (F_status_is_error(status)) { status = F_status_set_fine(status); @@ -175,7 +171,7 @@ extern "C" { return F_none; } - fll_error_print(print, status, "fl_conversion_string_to_number_unsigned", F_true); + fll_error_print(print, status, "fl_conversion_dynamic_to_number_unsigned", F_true); return F_status_set_error(status); } else if (number > F_type_size_32_unsigned_d) { diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index 91636e4..47abaf5 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -463,10 +463,10 @@ extern "C" { ++range.start; } - status = fl_conversion_string_to_number_unsigned(data.argv[index].string, range, &data.delimit_depth); + status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_delimit_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_basic_list_read_long_delimit_s, data.argv[index]); break; } diff --git a/level_3/fss_basic_list_read/c/private-read.c b/level_3/fss_basic_list_read/c/private-read.c index aab60ae..50c0c72 100644 --- a/level_3/fss_basic_list_read/c/private-read.c +++ b/level_3/fss_basic_list_read/c/private-read.c @@ -108,12 +108,10 @@ extern "C" { else { position_depth = main->parameters.array[fss_basic_list_read_parameter_depth_e].values.array[i]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[position_depth].used); - - status = fl_conversion_string_to_number_unsigned(data->argv[position_depth].string, range, &data->depths.array[i].depth); + status = fl_conversion_dynamic_to_number_unsigned(data->argv[position_depth], &data->depths.array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_depth_s, data->argv[position_depth]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_basic_list_read_long_depth_s, data->argv[position_depth]); return status; } @@ -132,12 +130,10 @@ extern "C" { data->depths.array[i].index_at = main->parameters.array[fss_basic_list_read_parameter_at_e].values.array[position_at]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[data->depths.array[i].index_at].used); - - status = fl_conversion_string_to_number_unsigned(data->argv[data->depths.array[i].index_at].string, range, &data->depths.array[i].value_at); + status = fl_conversion_dynamic_to_number_unsigned(data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_at_s, data->argv[data->depths.array[i].index_at]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_basic_list_read_long_at_s, data->argv[data->depths.array[i].index_at]); return status; } @@ -284,12 +280,11 @@ extern "C" { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[index].used); - const f_status_t status = fl_conversion_string_to_number_unsigned(data->argv[index].string, range, number); + const f_status_t status = fl_conversion_dynamic_to_number_unsigned(data->argv[index], number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, data->argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, name, data->argv[index]); return status; } diff --git a/level_3/fss_basic_list_read/c/private-read.h b/level_3/fss_basic_list_read/c/private-read.h index 3a21d7b..9f329a3 100644 --- a/level_3/fss_basic_list_read/c/private-read.h +++ b/level_3/fss_basic_list_read/c/private-read.h @@ -61,13 +61,13 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: fl_string_rip(). - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * * Errors (with error bit) from: fss_basic_list_read_depths_resize(). * * @see f_string_append() * @see fl_string_rip() - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() * * @see fss_basic_list_read_depths_resize() */ @@ -139,9 +139,9 @@ extern "C" { * F_true on success and the parameter was found (and is valid). * F_false on success and the parameter was not found. * - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() * * @see fss_basic_list_read_depths_resize() */ diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index 46aba99..b5ff87e 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -458,10 +458,10 @@ extern "C" { ++range.start; } - status = fl_conversion_string_to_number_unsigned(data.argv[index].string, range, &data.delimit_depth); + status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_delimit_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_basic_read_long_delimit_s, data.argv[index]); break; } diff --git a/level_3/fss_basic_read/c/private-read.c b/level_3/fss_basic_read/c/private-read.c index 101a308..3a2f381 100644 --- a/level_3/fss_basic_read/c/private-read.c +++ b/level_3/fss_basic_read/c/private-read.c @@ -80,12 +80,10 @@ extern "C" { else { position_depth = main->parameters.array[fss_basic_read_parameter_depth_e].values.array[i]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[position_depth].used); - - status = fl_conversion_string_to_number_unsigned(data->argv[position_depth].string, range, &data->depths.array[i].depth); + status = fl_conversion_dynamic_to_number_unsigned(data->argv[position_depth], &data->depths.array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_depth_s, data->argv[position_depth]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_basic_read_long_depth_s, data->argv[position_depth]); return status; } @@ -104,12 +102,10 @@ extern "C" { data->depths.array[i].index_at = main->parameters.array[fss_basic_read_parameter_at_e].values.array[position_at]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[data->depths.array[i].index_at].used); - - status = fl_conversion_string_to_number_unsigned(data->argv[data->depths.array[i].index_at].string, range, &data->depths.array[i].value_at); + status = fl_conversion_dynamic_to_number_unsigned(data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_at_s, data->argv[data->depths.array[i].index_at]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_basic_read_long_at_s, data->argv[data->depths.array[i].index_at]); return status; } @@ -250,12 +246,11 @@ extern "C" { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[index].used); - const f_status_t status = fl_conversion_string_to_number_unsigned(data->argv[index].string, range, number); + const f_status_t status = fl_conversion_dynamic_to_number_unsigned(data->argv[index], number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, data->argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, name, data->argv[index]); return status; } diff --git a/level_3/fss_basic_read/c/private-read.h b/level_3/fss_basic_read/c/private-read.h index d3a15ac..44fc1b0 100644 --- a/level_3/fss_basic_read/c/private-read.h +++ b/level_3/fss_basic_read/c/private-read.h @@ -45,13 +45,13 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: fl_string_rip(). - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * * Errors (with error bit) from: fss_basic_read_depths_resize(). * * @see f_string_append() * @see fl_string_rip() - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() * * @see fss_basic_read_depths_resize() */ @@ -123,9 +123,9 @@ extern "C" { * F_true on success and the parameter was found (and is valid). * F_false on success and the parameter was not found. * - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() * * @see fss_basic_read_depths_resize() */ diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c index c697762..c46efe7 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c @@ -381,10 +381,10 @@ extern "C" { ++range.start; } - status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &main->delimit_depth); + status = fl_conversion_dynamic_partial_to_number_unsigned(argv[index], range, &main->delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_delimit_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_embedded_list_read_long_delimit_s, argv[index]); } } } diff --git a/level_3/fss_embedded_list_read/c/private-read.c b/level_3/fss_embedded_list_read/c/private-read.c index 7c3dd54..feeb544 100644 --- a/level_3/fss_embedded_list_read/c/private-read.c +++ b/level_3/fss_embedded_list_read/c/private-read.c @@ -134,12 +134,10 @@ extern "C" { } if (values_type[i] == fss_embedded_list_read_parameter_depth_e || values_type[i] == fss_embedded_list_read_parameter_at_e) { - const f_string_range_t range = macro_f_string_range_t_initialize(argv[values_order[i]].used); - - status = fl_conversion_string_to_number_unsigned(argv[values_order[i]].string, range, &number); + status = fl_conversion_dynamic_to_number_unsigned(argv[values_order[i]], &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_depth_s, argv[values_order[i]]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_depth_s, argv[values_order[i]]); return status; } @@ -302,12 +300,11 @@ extern "C" { if (main->parameters.array[fss_embedded_list_read_parameter_select_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[fss_embedded_list_read_parameter_select_e].values.array[main->parameters.array[fss_embedded_list_read_parameter_select_e].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(main->parameters.arguments.array[index].used); - status = fl_conversion_string_to_number_unsigned(main->parameters.arguments.array[index].string, range, &select); + status = fl_conversion_dynamic_to_number_unsigned(main->parameters.arguments.array[index], &select); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_select_s, main->parameters.arguments.array[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_select_s, main->parameters.arguments.array[index]); return status; } @@ -323,12 +320,11 @@ extern "C" { if (main->parameters.array[fss_embedded_list_read_parameter_line_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[fss_embedded_list_read_parameter_line_e].values.array[main->parameters.array[fss_embedded_list_read_parameter_line_e].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(main->parameters.arguments.array[index].used); - status = fl_conversion_string_to_number_unsigned(main->parameters.arguments.array[index].string, range, &line); + status = fl_conversion_dynamic_to_number_unsigned(main->parameters.arguments.array[index], &line); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_line_s, main->parameters.arguments.array[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_line_s, main->parameters.arguments.array[index]); return status; } diff --git a/level_3/fss_embedded_list_write/c/private-write.c b/level_3/fss_embedded_list_write/c/private-write.c index 5539572..9ea6f9f 100644 --- a/level_3/fss_embedded_list_write/c/private-write.c +++ b/level_3/fss_embedded_list_write/c/private-write.c @@ -419,10 +419,10 @@ extern "C" { range.start = 1; } - status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number); + status = fl_conversion_dynamic_partial_to_number_unsigned(argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore_s, argv[index]); return status; } @@ -439,10 +439,10 @@ extern "C" { range.start = 1; } - status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number); + status = fl_conversion_dynamic_partial_to_number_unsigned(argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore_s, argv[index]); return status; } diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index aa21681..3627f95 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -458,10 +458,10 @@ extern "C" { ++range.start; } - status = fl_conversion_string_to_number_unsigned(data.argv[index].string, range, &data.delimit_depth); + status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_delimit_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_extended_list_read_long_delimit_s, data.argv[index]); break; } diff --git a/level_3/fss_extended_list_read/c/private-read.c b/level_3/fss_extended_list_read/c/private-read.c index 43d4dc5..e36c780 100644 --- a/level_3/fss_extended_list_read/c/private-read.c +++ b/level_3/fss_extended_list_read/c/private-read.c @@ -103,12 +103,10 @@ extern "C" { else { position_depth = main->parameters.array[fss_extended_list_read_parameter_depth_e].values.array[i]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[position_depth].used); - - status = fl_conversion_string_to_number_unsigned(data->argv[position_depth].string, range, &data->depths.array[i].depth); + status = fl_conversion_dynamic_to_number_unsigned(data->argv[position_depth], &data->depths.array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_depth_s, data->argv[position_depth]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_extended_list_read_long_depth_s, data->argv[position_depth]); return status; } @@ -127,12 +125,10 @@ extern "C" { data->depths.array[i].index_at = main->parameters.array[fss_extended_list_read_parameter_at_e].values.array[position_at]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[data->depths.array[i].index_at].used); - - status = fl_conversion_string_to_number_unsigned(data->argv[data->depths.array[i].index_at].string, range, &data->depths.array[i].value_at); + status = fl_conversion_dynamic_to_number_unsigned(data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_at_s, data->argv[data->depths.array[i].index_at]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_extended_list_read_long_at_s, data->argv[data->depths.array[i].index_at]); return status; } @@ -272,12 +268,11 @@ extern "C" { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[index].used); - const f_status_t status = fl_conversion_string_to_number_unsigned(data->argv[index].string, range, number); + const f_status_t status = fl_conversion_dynamic_to_number_unsigned(data->argv[index], number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, data->argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, name, data->argv[index]); return status; } diff --git a/level_3/fss_extended_list_read/c/private-read.h b/level_3/fss_extended_list_read/c/private-read.h index 15a3230..512c39d 100644 --- a/level_3/fss_extended_list_read/c/private-read.h +++ b/level_3/fss_extended_list_read/c/private-read.h @@ -59,13 +59,13 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: fl_string_rip(). - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * * Errors (with error bit) from: fss_extended_list_read_depths_resize(). * * @see f_string_append() * @see fl_string_rip() - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() * * @see fss_extended_list_read_depths_resize() */ @@ -137,9 +137,9 @@ extern "C" { * F_true on success and the parameter was found (and is valid). * F_false on success and the parameter was not found. * - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() * * @see fss_extended_list_read_depths_resize() */ diff --git a/level_3/fss_extended_list_write/c/private-write.c b/level_3/fss_extended_list_write/c/private-write.c index 47dbf96..9e70d7c 100644 --- a/level_3/fss_extended_list_write/c/private-write.c +++ b/level_3/fss_extended_list_write/c/private-write.c @@ -416,10 +416,10 @@ extern "C" { range.start = 1; } - status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number); + status = fl_conversion_dynamic_partial_to_number_unsigned(argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_write_long_ignore_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_extended_list_write_long_ignore_s, argv[index]); return status; } @@ -436,10 +436,10 @@ extern "C" { range.start = 1; } - status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number); + status = fl_conversion_dynamic_partial_to_number_unsigned(argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_write_long_ignore_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_extended_list_write_long_ignore_s, argv[index]); return status; } diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 752829a..cb9d489 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -461,10 +461,10 @@ extern "C" { ++range.start; } - status = fl_conversion_string_to_number_unsigned(data.argv[index].string, range, &data.delimit_depth); + status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_delimit_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_extended_read_long_delimit_s, data.argv[index]); break; } diff --git a/level_3/fss_extended_read/c/private-read.c b/level_3/fss_extended_read/c/private-read.c index b653b46..13889d9 100644 --- a/level_3/fss_extended_read/c/private-read.c +++ b/level_3/fss_extended_read/c/private-read.c @@ -112,12 +112,10 @@ extern "C" { else { position_depth = main->parameters.array[fss_extended_read_parameter_depth_e].values.array[i]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[position_depth].used); - - status = fl_conversion_string_to_number_unsigned(data->argv[position_depth].string, range, &data->depths.array[i].depth); + status = fl_conversion_dynamic_to_number_unsigned(data->argv[position_depth], &data->depths.array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_depth_s, data->argv[position_depth]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_extended_read_long_depth_s, data->argv[position_depth]); return status; } @@ -136,12 +134,10 @@ extern "C" { data->depths.array[i].index_at = main->parameters.array[fss_extended_read_parameter_at_e].values.array[position_at]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[data->depths.array[i].index_at].used); - - status = fl_conversion_string_to_number_unsigned(data->argv[data->depths.array[i].index_at].string, range, &data->depths.array[i].value_at); + status = fl_conversion_dynamic_to_number_unsigned(data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_at_s, data->argv[data->depths.array[i].index_at]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_extended_read_long_at_s, data->argv[data->depths.array[i].index_at]); return status; } @@ -287,12 +283,11 @@ extern "C" { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[index].used); - const f_status_t status = fl_conversion_string_to_number_unsigned(data->argv[index].string, range, number); + const f_status_t status = fl_conversion_dynamic_to_number_unsigned(data->argv[index], number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, data->argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, name, data->argv[index]); return status; } diff --git a/level_3/fss_extended_read/c/private-read.h b/level_3/fss_extended_read/c/private-read.h index 1e6f45c..bfa35cf 100644 --- a/level_3/fss_extended_read/c/private-read.h +++ b/level_3/fss_extended_read/c/private-read.h @@ -59,13 +59,13 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: fl_string_rip(). - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * * Errors (with error bit) from: fss_extended_read_depths_resize(). * * @see f_string_append() * @see fl_string_rip() - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() * * @see fss_extended_read_depths_resize() */ @@ -137,9 +137,9 @@ extern "C" { * F_true on success and the parameter was found (and is valid). * F_false on success and the parameter was not found. * - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() * * @see fss_extended_read_depths_resize() */ diff --git a/level_3/fss_identify/c/fss_identify.c b/level_3/fss_identify/c/fss_identify.c index 959be2f..c15017f 100644 --- a/level_3/fss_identify/c/fss_identify.c +++ b/level_3/fss_identify/c/fss_identify.c @@ -176,12 +176,11 @@ extern "C" { } else if (main->parameters.array[fss_identify_parameter_line_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[fss_identify_parameter_line_e].values.array[main->parameters.array[fss_identify_parameter_line_e].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(data.argv[index].used); - status = fl_conversion_string_to_number_unsigned(data.argv[index].string, range, &data.line); + status = fl_conversion_dynamic_to_number_unsigned(data.argv[index], &data.line); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_identify_long_line_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_identify_long_line_s, data.argv[index]); } } } diff --git a/level_3/fss_identify/c/private-identify.c b/level_3/fss_identify/c/private-identify.c index 5970d2e..e397fd1 100644 --- a/level_3/fss_identify/c/private-identify.c +++ b/level_3/fss_identify/c/private-identify.c @@ -168,7 +168,7 @@ extern "C" { } // for { - const f_status_t status = fl_conversion_string_to_hexidecimal_unsigned(data->name.string, range, &number); + const f_status_t status = fl_conversion_dynamic_partial_to_hexidecimal_unsigned(data->name, range, &number); if (F_status_is_error(status)) return status; } diff --git a/level_3/fss_identify/c/private-identify.h b/level_3/fss_identify/c/private-identify.h index 518ba6d..14f491f 100644 --- a/level_3/fss_identify/c/private-identify.h +++ b/level_3/fss_identify/c/private-identify.h @@ -83,10 +83,10 @@ extern "C" { * F_true on match. * F_false on no match. * - * Errors (with error bit) from fl_conversion_string_to_hexidecimal_unsigned(). + * Errors (with error bit) from fl_conversion_dynamic_partial_to_hexidecimal_unsigned(). * Errors (with error bit) from fl_string_dynamic_compare_string(). * - * @see fl_conversion_string_to_hexidecimal_unsigned() + * @see fl_conversion_dynamic_partial_to_hexidecimal_unsigned() * @see fl_string_dynamic_compare_string() */ #ifndef _di_fss_identify_process_name_compare_ diff --git a/level_3/fss_payload_read/c/fss_payload_read.c b/level_3/fss_payload_read/c/fss_payload_read.c index 6a582b4..ac4cfa5 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.c +++ b/level_3/fss_payload_read/c/fss_payload_read.c @@ -481,10 +481,10 @@ extern "C" { ++range.start; } - status = fl_conversion_string_to_number_unsigned(data.argv[index].string, range, &data.delimit_depth); + status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_payload_read_long_delimit_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_payload_read_long_delimit_s, data.argv[index]); break; } diff --git a/level_3/fss_payload_read/c/private-read.c b/level_3/fss_payload_read/c/private-read.c index fd558a9..f60bc7f 100644 --- a/level_3/fss_payload_read/c/private-read.c +++ b/level_3/fss_payload_read/c/private-read.c @@ -108,12 +108,10 @@ extern "C" { else { position_depth = main->parameters.array[fss_payload_read_parameter_depth_e].values.array[i]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[position_depth].used); - - status = fl_conversion_string_to_number_unsigned(data->argv[position_depth].string, range, &data->depths.array[i].depth); + status = fl_conversion_dynamic_to_number_unsigned(data->argv[position_depth], &data->depths.array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_payload_read_long_depth_s, data->argv[position_depth]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_payload_read_long_depth_s, data->argv[position_depth]); return status; } @@ -132,12 +130,10 @@ extern "C" { data->depths.array[i].index_at = main->parameters.array[fss_payload_read_parameter_at_e].values.array[position_at]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[data->depths.array[i].index_at].used); - - status = fl_conversion_string_to_number_unsigned(data->argv[data->depths.array[i].index_at].string, range, &data->depths.array[i].value_at); + status = fl_conversion_dynamic_to_number_unsigned(data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_payload_read_long_at_s, data->argv[data->depths.array[i].index_at]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_payload_read_long_at_s, data->argv[data->depths.array[i].index_at]); return status; } @@ -318,12 +314,11 @@ extern "C" { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[index].used); - const f_status_t status = fl_conversion_string_to_number_unsigned(data->argv[index].string, range, number); + const f_status_t status = fl_conversion_dynamic_to_number_unsigned(data->argv[index], number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, data->argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, name, data->argv[index]); return status; } diff --git a/level_3/fss_payload_read/c/private-read.h b/level_3/fss_payload_read/c/private-read.h index e614965..cb7a830 100644 --- a/level_3/fss_payload_read/c/private-read.h +++ b/level_3/fss_payload_read/c/private-read.h @@ -63,13 +63,13 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: fl_string_rip(). - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * * Errors (with error bit) from: fss_payload_read_depths_resize(). * * @see f_string_append() * @see fl_string_rip() - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() * * @see fss_payload_read_depths_resize() */ @@ -141,9 +141,9 @@ extern "C" { * F_true on success and the parameter was found (and is valid). * F_false on success and the parameter was not found. * - * Errors (with error bit) from: fl_conversion_string_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). * - * @see fl_conversion_string_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_number_unsigned() * * @see fss_payload_read_depths_resize() */ diff --git a/level_3/fss_status_code/c/private-fss_status_code.c b/level_3/fss_status_code/c/private-fss_status_code.c index df6c258..8df8ea1 100644 --- a/level_3/fss_status_code/c/private-fss_status_code.c +++ b/level_3/fss_status_code/c/private-fss_status_code.c @@ -57,11 +57,9 @@ extern "C" { f_status_t status = F_none; { - const f_string_range_t range = macro_f_string_range_t_initialize(value.used); - f_number_unsigned_t number = 0; - status = fl_conversion_string_to_number_unsigned(value.string, range, &number); + status = fl_conversion_dynamic_to_number_unsigned(value, &number); if (status == F_none) { fl_print_format("%[invalid name%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -141,9 +139,7 @@ extern "C" { #ifndef _di_fss_status_code_convert_number_ f_status_t fss_status_code_convert_number(fll_program_data_t * const main, const f_string_static_t value, f_number_unsigned_t *number) { - const f_string_range_t range = macro_f_string_range_t_initialize(value.used); - - f_status_t status = fl_conversion_string_to_number_unsigned(value.string, range, number); + f_status_t status = fl_conversion_dynamic_to_number_unsigned(value, number); if (*number > F_status_size_max_with_signal) { fl_print_format("%[out of range%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index 6b86132..06e9964 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -187,14 +187,13 @@ extern "C" { } else if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[iki_read_parameter_at_e].values.array[main->parameters.array[iki_read_parameter_at_e].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used); f_number_unsigned_t number = 0; - status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number); + status = fl_conversion_dynamic_to_number_unsigned(argv[index], &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, iki_read_long_at_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, iki_read_long_at_s, argv[index]); status = F_status_set_error(F_parameter); } @@ -233,14 +232,13 @@ extern "C" { } else if (main->parameters.array[iki_read_parameter_line_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[iki_read_parameter_line_e].values.array[main->parameters.array[iki_read_parameter_line_e].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used); f_number_unsigned_t number = 0; - status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number); + status = fl_conversion_dynamic_to_number_unsigned(argv[index], &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, iki_read_long_line_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, iki_read_long_line_s, argv[index]); status = F_status_set_error(F_parameter); } diff --git a/level_3/status_code/c/private-status_code.c b/level_3/status_code/c/private-status_code.c index 6e1fca1..0550667 100644 --- a/level_3/status_code/c/private-status_code.c +++ b/level_3/status_code/c/private-status_code.c @@ -55,11 +55,9 @@ extern "C" { f_status_t status = F_none; { - const f_string_range_t range = macro_f_string_range_t_initialize(value.used); - f_number_unsigned_t number = 0; - status = fl_conversion_string_to_number_unsigned(value.string, range, &number); + status = fl_conversion_dynamic_to_number_unsigned(value, &number); if (status == F_none) { fl_print_format("%[invalid name%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -133,9 +131,7 @@ extern "C" { #ifndef _di_status_code_convert_number_ f_status_t status_code_convert_number(fll_program_data_t * const main, const f_string_static_t value, f_number_unsigned_t *number) { - const f_string_range_t range = macro_f_string_range_t_initialize(value.used); - - f_status_t status = fl_conversion_string_to_number_unsigned(value.string, range, number); + f_status_t status = fl_conversion_dynamic_to_number_unsigned(value, number); if (*number > F_status_size_max_with_signal) { fl_print_format("%[out of range%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); -- 1.8.3.1