From 601b01d231e9d22ddfa5fe63e8e39b95eb44749f Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 24 Jun 2020 23:00:41 -0500 Subject: [PATCH] Update: dependencies changes, project level changes, and includes changes. Review the current dependencies and fix them. There are some cases where some dependencies are not necessary, such as f_utf. There are some cases where some dependencies are missing (or newly added). f_conversion split into f_conversion and fl_conversion. Update dependencies accordingly. For simplicity, include the core level_0 project headers, except in a small number of cases. Add fss header comment in dependencies files. Add comments in *_array.h headers for level_0 core projects. Add missing header in f_string. Replace _di_level_0_parameter_checking_ with _di_level_1_parameter_checking_ where incorrect. The fl_fss identify functions should instead be in the fll_fss project. Make sure the IKI projects are in the bootstrap example script. Remove the fl_console_parameter_to_number_unsigned() and similar functions. These are just wrappers to another call and is therefore a waste. Instead, just call the fl_conversion_string_to_number_unsigned() and similar functions. --- build/level_0/settings | 2 +- build/level_1/settings | 4 +- build/level_2/settings | 2 +- build/monolithic/settings | 4 +- build/scripts/bootstrap-example.sh | 2 +- level_0/f_color/c/color.h | 1 - level_0/f_color/data/build/dependencies | 4 +- level_0/f_color/data/build/settings | 2 +- level_0/f_console/c/console.h | 3 +- level_0/f_console/data/build/dependencies | 2 + level_0/f_conversion/c/conversion.c | 854 -------------------- level_0/f_conversion/c/conversion.h | 363 +-------- level_0/f_conversion/data/build/dependencies | 2 + level_0/f_directory/c/directory.h | 2 +- level_0/f_directory/data/build/dependencies | 2 + level_0/f_environment/c/environment.h | 2 +- level_0/f_environment/data/build/dependencies | 2 + level_0/f_file/c/file.h | 3 +- level_0/f_file/data/build/dependencies | 2 + level_0/f_fss/data/build/dependencies | 2 + level_0/f_iki/c/iki.h | 2 +- level_0/f_iki/data/build/dependencies | 2 + level_0/f_memory/c/memory.h | 2 +- level_0/f_memory/data/build/dependencies | 2 + level_0/f_path/c/path.h | 3 +- level_0/f_path/data/build/dependencies | 3 +- level_0/f_path/data/build/settings | 2 +- level_0/f_pipe/data/build/dependencies | 2 + level_0/f_print/c/print.h | 3 +- level_0/f_print/data/build/dependencies | 2 + level_0/f_serialize/c/serialize.h | 4 +- level_0/f_serialize/data/build/dependencies | 6 +- level_0/f_socket/c/socket.h | 1 + level_0/f_socket/data/build/dependencies | 6 +- level_0/f_status/c/status_array.h | 2 + level_0/f_status/data/build/dependencies | 2 + level_0/f_string/data/build/dependencies | 2 + level_0/f_string/data/build/settings | 2 +- level_0/f_type/c/type_array.h | 4 +- level_0/f_type/data/build/dependencies | 2 + level_0/f_utf/c/utf.h | 3 +- level_0/f_utf/data/build/dependencies | 2 + level_1/fl_color/c/color.h | 7 +- level_1/fl_color/data/build/dependencies | 2 + level_1/fl_console/c/console.c | 40 +- level_1/fl_console/c/console.h | 73 +- level_1/fl_console/data/build/dependencies | 4 +- level_1/fl_conversion/c/conversion.c | 856 +++++++++++++++++++++ level_1/fl_conversion/c/conversion.h | 393 ++++++++++ level_1/fl_conversion/data/build/defines | 2 + level_1/fl_conversion/data/build/dependencies | 8 + level_1/fl_conversion/data/build/settings | 52 ++ level_1/fl_directory/c/directory.h | 2 +- level_1/fl_directory/data/build/dependencies | 2 + level_1/fl_fss/c/fss.c | 40 - level_1/fl_fss/c/fss.h | 55 +- level_1/fl_fss/c/private-fss.c | 126 --- level_1/fl_fss/c/private-fss.h | 25 - level_1/fl_fss/data/build/dependencies | 3 +- level_1/fl_fss/data/build/settings | 2 +- level_1/fl_iki/c/iki.h | 4 +- level_1/fl_iki/data/build/dependencies | 2 + level_1/fl_iki/data/build/settings | 2 +- level_1/fl_print/c/print.h | 5 +- level_1/fl_print/data/build/dependencies | 2 + level_1/fl_status/c/status.h | 3 +- level_1/fl_status/data/build/dependencies | 3 + level_1/fl_string/c/string.h | 2 +- level_1/fl_string/data/build/dependencies | 2 + level_1/fl_utf/c/utf.h | 2 +- level_1/fl_utf/data/build/dependencies | 2 + level_1/fl_utf_file/c/utf_file.h | 3 +- level_1/fl_utf_file/data/build/dependencies | 2 + level_2/fll_execute/c/execute.h | 3 +- level_2/fll_execute/data/build/dependencies | 2 + level_2/fll_execute/data/build/settings | 2 +- level_2/fll_file/c/file.h | 3 +- level_2/fll_file/data/build/dependencies | 3 +- level_2/fll_file/data/build/settings | 2 +- level_2/fll_fss/c/fss.c | 41 + level_2/fll_fss/c/fss.h | 51 +- level_2/fll_fss/c/private-fss.c | 138 ++++ level_2/fll_fss/c/private-fss.h | 47 ++ level_2/fll_fss/data/build/dependencies | 5 +- level_2/fll_fss/data/build/settings | 4 +- level_2/fll_program/c/program.h | 6 +- level_2/fll_program/data/build/dependencies | 3 + level_2/fll_status/c/status.h | 5 +- level_2/fll_status/data/build/dependencies | 4 +- level_3/byte_dump/c/byte_dump.c | 15 +- level_3/byte_dump/c/byte_dump.h | 10 +- level_3/byte_dump/data/build/dependencies | 5 +- level_3/byte_dump/data/build/settings | 2 +- level_3/fake/c/fake.h | 4 +- level_3/fake/data/build/dependencies | 1 + level_3/fake/data/build/settings | 2 +- level_3/firewall/c/firewall.h | 9 +- level_3/firewall/data/build/dependencies | 5 +- level_3/firewall/data/build/settings | 2 +- .../fss_basic_list_read/c/fss_basic_list_read.h | 4 + .../c/private-fss_basic_list_read.c | 22 +- .../fss_basic_list_read/data/build/dependencies | 4 + level_3/fss_basic_list_read/data/build/settings | 2 +- .../fss_basic_list_write/c/fss_basic_list_write.h | 7 +- .../fss_basic_list_write/data/build/dependencies | 4 + level_3/fss_basic_list_write/data/build/settings | 2 +- level_3/fss_basic_read/c/fss_basic_read.h | 4 + level_3/fss_basic_read/c/private-fss_basic_read.c | 22 +- level_3/fss_basic_read/data/build/dependencies | 4 + level_3/fss_basic_read/data/build/settings | 2 +- level_3/fss_basic_write/c/fss_basic_write.h | 7 +- level_3/fss_basic_write/data/build/dependencies | 4 + level_3/fss_basic_write/data/build/settings | 2 +- .../c/fss_extended_list_read.h | 4 + .../c/private-fss_extended_list_read.c | 24 +- .../fss_extended_list_read/data/build/dependencies | 4 + level_3/fss_extended_list_read/data/build/settings | 2 +- level_3/fss_extended_read/c/fss_extended_read.h | 4 + .../c/private-fss_extended_read.c | 22 +- level_3/fss_extended_read/data/build/dependencies | 4 + level_3/fss_extended_read/data/build/settings | 2 +- level_3/fss_extended_write/c/fss_extended_write.h | 7 +- level_3/fss_extended_write/data/build/dependencies | 4 + level_3/fss_extended_write/data/build/settings | 2 +- level_3/fss_status_code/c/fss_status_code.h | 9 +- .../fss_status_code/c/private-fss_status_code.c | 8 +- level_3/fss_status_code/data/build/dependencies | 5 +- level_3/fss_status_code/data/build/settings | 2 +- level_3/iki_read/c/iki_read.c | 11 +- level_3/iki_read/c/iki_read.h | 4 + level_3/iki_read/data/build/dependencies | 3 + level_3/iki_read/data/build/settings | 2 +- level_3/init/c/init.h | 3 + level_3/init/data/build/dependencies | 4 +- level_3/init/data/build/settings | 2 +- level_3/status_code/c/private-status_code.c | 8 +- level_3/status_code/c/status_code.h | 9 +- level_3/status_code/data/build/dependencies | 5 +- level_3/status_code/data/build/settings | 2 +- 139 files changed, 1957 insertions(+), 1708 deletions(-) create mode 100644 level_1/fl_conversion/c/conversion.c create mode 100644 level_1/fl_conversion/c/conversion.h create mode 100644 level_1/fl_conversion/data/build/defines create mode 100644 level_1/fl_conversion/data/build/dependencies create mode 100644 level_1/fl_conversion/data/build/settings create mode 100644 level_2/fll_fss/c/private-fss.c create mode 100644 level_2/fll_fss/c/private-fss.h diff --git a/build/level_0/settings b/build/level_0/settings index 0016f9e..3dd0c74 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -22,7 +22,7 @@ build_libraries -lc build_libraries-level build_sources_library console.c conversion.c directory.c private-directory.c environment.c private-environment.c file.c private-file.c fss.c iki.c memory.c path.c pipe.c print.c serialize.c private-serialize.c socket.c utf.c private-utf.c build_sources_program -build_sources_headers color.h console.h conversion.h directory.h directory_type.h environment.h file.h fss.h fss-common.h fss-named.h fss-nest.h fss-set.h iki.h iki-common.h iki-common.h memory.h memory-structure.h path.h pipe.h print.h serialize.h socket.h status.h status_array.h string.h string-common.h string-dynamic.h string-map.h string-quantity.h string-range.h type.h type_array.h utf.h utf-common.h +build_sources_headers color.h console.h conversion.h directory.h directory_type.h environment.h file.h fss.h fss-common.h fss-named.h fss-nest.h fss-set.h iki.h iki-common.h memory.h memory-structure.h path.h pipe.h print.h serialize.h socket.h status.h status_array.h string.h string-common.h string-dynamic.h string-map.h string-quantity.h string-range.h type.h type_array.h utf.h utf-common.h build_sources_script build_sources_setting build_script yes diff --git a/build/level_1/settings b/build/level_1/settings index 82170e8..b996d14 100644 --- a/build/level_1/settings +++ b/build/level_1/settings @@ -20,9 +20,9 @@ build_language c build_linker ar build_libraries -lc build_libraries-level -lfll_0 -build_sources_library color.c console.c directory.c private-directory.c fss.c private-fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c iki.c print.c status.c string.c private-string.c utf.c private-utf.c utf_file.c private-utf_file.c +build_sources_library color.c console.c conversion.c directory.c private-directory.c fss.c private-fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c iki.c print.c status.c string.c private-string.c utf.c private-utf.c utf_file.c private-utf_file.c build_sources_program -build_sources_headers color.h console.h directory.h fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_macro.h fss_status.h iki.h print.h status.h string.h utf.h utf_file.h +build_sources_headers color.h console.h conversion.h directory.h fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_macro.h fss_status.h iki.h print.h status.h string.h utf.h utf_file.h build_sources_script build_sources_setting build_script yes diff --git a/build/level_2/settings b/build/level_2/settings index af6cf01..a77c00c 100644 --- a/build/level_2/settings +++ b/build/level_2/settings @@ -20,7 +20,7 @@ build_language c build_linker ar build_libraries -lc build_libraries-level -lfll_1 -lfll_0 -build_sources_library execute.c private-execute.c file.c fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c fss_status.c program.c status.c +build_sources_library execute.c private-execute.c file.c fss.c private-fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c fss_status.c program.c status.c build_sources_program build_sources_headers execute.h file.h fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_status.h program.h status.h build_sources_script diff --git a/build/monolithic/settings b/build/monolithic/settings index 8edfee6..541ec12 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -20,9 +20,9 @@ build_language c build_linker ar build_libraries -lc build_libraries-monolithic -build_sources_library level_0/console.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/private-file.c level_0/fss.c level_0/iki.c level_0/memory.c level_0/path.c level_0/pipe.c level_0/print.c level_0/serialize.c level_0/private-serialize.c level_0/socket.c level_0/utf.c level_0/private-utf.c level_1/color.c level_1/console.c level_1/directory.c level_1/private-directory.c level_1/fss.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/print.c level_1/iki.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/program.c level_2/status.c +build_sources_library level_0/console.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/private-file.c level_0/fss.c level_0/iki.c level_0/memory.c level_0/path.c level_0/pipe.c level_0/print.c level_0/serialize.c level_0/private-serialize.c level_0/socket.c level_0/utf.c level_0/private-utf.c level_1/color.c level_1/console.c level_1/conversion.c level_1/directory.c level_1/private-directory.c level_1/fss.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/program.c level_2/status.c build_sources_program -build_sources_headers level_0/color.h level_0/console.h level_0/conversion.h level_0/directory.h level_0/directory_type.h level_0/environment.h level_0/file.h level_0/fss.h level_0/fss-common.h level_0/fss-named.h level_0/fss-nest.h level_0/fss-set.h level_0/iki.h level_0/iki-common.h level_0/iki-common.h level_0/memory.h level_0/memory-structure.h level_0/path.h level_0/pipe.h level_0/print.h level_0/serialize.h level_0/socket.h level_0/status.h level_0/status_array.h level_0/string.h level_0/string-common.h level_0/string-dynamic.h level_0/string-map.h level_0/string-quantity.h level_0/string-range.h level_0/type.h level_0/type_array.h level_0/utf.h level_0/utf-common.h level_1/color.h level_1/console.h level_1/directory.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_macro.h level_1/fss_status.h level_1/print.h level_1/iki.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/program.h level_2/status.h +build_sources_headers level_0/color.h level_0/console.h level_0/conversion.h level_0/directory.h level_0/directory_type.h level_0/environment.h level_0/file.h level_0/fss.h level_0/fss-common.h level_0/fss-named.h level_0/fss-nest.h level_0/fss-set.h level_0/iki.h level_0/iki-common.h level_0/memory.h level_0/memory-structure.h level_0/path.h level_0/pipe.h level_0/print.h level_0/serialize.h level_0/socket.h level_0/status.h level_0/status_array.h level_0/string.h level_0/string-common.h level_0/string-dynamic.h level_0/string-map.h level_0/string-quantity.h level_0/string-range.h level_0/type.h level_0/type_array.h level_0/utf.h level_0/utf-common.h level_1/color.h level_1/console.h level_1/conversion.h level_1/directory.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_macro.h level_1/fss_status.h level_1/iki.h level_1/print.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/program.h level_2/status.h build_sources_script build_sources_setting build_script yes diff --git a/build/scripts/bootstrap-example.sh b/build/scripts/bootstrap-example.sh index 6e4ae07..abd4f96 100644 --- a/build/scripts/bootstrap-example.sh +++ b/build/scripts/bootstrap-example.sh @@ -23,7 +23,7 @@ if [[ $1 == "individual" ]] ; then bash build/scripts/package.sh build -i if [[ $? -eq 0 ]] ; then - for i in f_type f_status f_memory f_string f_utf f_color f_console f_conversion f_directory f_environment f_file f_fss f_path f_pipe f_print f_serialize f_socket fl_color fl_console fl_directory fl_fss fl_print fl_status fl_string fl_utf fl_utf_file fll_execute fll_file fll_fss fll_program fll_status ; do + for i in f_type f_status f_memory f_string f_utf f_color f_console f_conversion f_directory f_environment f_file f_fss f_iki f_path f_pipe f_print f_serialize f_socket fl_color fl_console fl_conversion fl_directory fl_fss fl_iki fl_print fl_status fl_string fl_utf fl_utf_file fll_execute fll_file fll_fss fll_program fll_status ; do echo && echo "Processing $i." && cd package/individual/$i-$2/ && diff --git a/level_0/f_color/c/color.h b/level_0/f_color/c/color.h index 4d7e164..c1da063 100644 --- a/level_0/f_color/c/color.h +++ b/level_0/f_color/c/color.h @@ -12,7 +12,6 @@ #define _F_color_h // fll-0 includes -#include #include #ifdef __cplusplus diff --git a/level_0/f_color/data/build/dependencies b/level_0/f_color/data/build/dependencies index 9a8639a..1e9ec2a 100644 --- a/level_0/f_color/data/build/dependencies +++ b/level_0/f_color/data/build/dependencies @@ -1,3 +1,3 @@ +# fss-0000 + f_type -f_memory -f_string diff --git a/level_0/f_color/data/build/settings b/level_0/f_color/data/build/settings index c9dbab0..4d9de0b 100644 --- a/level_0/f_color/data/build/settings +++ b/level_0/f_color/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lf_memory +build_libraries-individual build_sources_library build_sources_program build_sources_headers color.h diff --git a/level_0/f_console/c/console.h b/level_0/f_console/c/console.h index 645118a..62129f7 100644 --- a/level_0/f_console/c/console.h +++ b/level_0/f_console/c/console.h @@ -14,9 +14,10 @@ #include // fll-0 includes +#include #include +#include #include -#include #include #ifdef __cplusplus diff --git a/level_0/f_console/data/build/dependencies b/level_0/f_console/data/build/dependencies index 13b45c7..deb9037 100644 --- a/level_0/f_console/data/build/dependencies +++ b/level_0/f_console/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_0/f_conversion/c/conversion.c b/level_0/f_conversion/c/conversion.c index 7b9cf51..a36a388 100644 --- a/level_0/f_conversion/c/conversion.c +++ b/level_0/f_conversion/c/conversion.c @@ -204,860 +204,6 @@ extern "C" { } #endif // _di_f_conversion_character_to_octal_ -#ifndef _di_f_conversion_string_to_binary_signed_ - f_return_status f_conversion_string_to_binary_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t scale = 0; - f_number_unsigned digit = 0; - f_number_unsigned converted = 0; - - for (f_string_length i = range.start; i <= range.stop; i++) { - if (f_conversion_character_to_binary(string[i], &digit) == F_none) { - if (scale) { - scale++; - - if (negative) { - if (scale > f_conversion_scale_binary_signed) { - return F_status_set_error(F_number_underflow); - } - - converted <<= 1; - converted -= digit; - } - else { - if (scale > f_conversion_scale_binary_signed) { - return F_status_set_error(F_number_overflow); - } - - converted <<= 1; - converted += digit; - } - } - else if (digit != 0) { - scale = 1; - - if (negative) { - converted = 0 - digit; - } - else { - converted = digit; - } - } - } - else if (string[i] != 0) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - return F_none; - } -#endif // _di_f_conversion_string_to_binary_signed_ - -#ifndef _di_f_conversion_string_to_binary_unsigned_ - f_return_status f_conversion_string_to_binary_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t scale = 0; - f_number_unsigned digit = 0; - f_number_unsigned converted = 0; - - for (f_string_length i = range.start; i <= range.stop; i++) { - if (f_conversion_character_to_binary(string[i], &digit) == F_none) { - if (scale) { - scale++; - - if (scale > f_conversion_scale_binary_unsigned) { - return F_status_set_error(F_number_overflow); - } - - converted <<= 1; - converted += digit; - } - else if (digit != 0) { - scale = 1; - converted = digit; - } - } - else if (string[i] != 0) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - return F_none; - } -#endif // _di_f_conversion_string_to_binary_unsigned_ - -#ifndef _di_f_conversion_string_to_decimal_signed_ - f_return_status f_conversion_string_to_decimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t scale = 0; - f_number_unsigned digit = 0; - f_number_unsigned converted = 0; - - for (f_string_length i = range.start; i <= range.stop; i++) { - if (f_conversion_character_to_decimal(string[i], &digit) == F_none) { - - if (scale) { - scale++; - - if (negative) { - if (scale > f_conversion_scale_decimal_signed) { - if ((converted * 10) - digit < f_type_number_size_negative || (converted * 10) - digit > converted) { - return F_status_set_error(F_number_underflow); - } - } - - converted *= 10; - converted -= digit; - } - else { - if (scale > f_conversion_scale_decimal_signed) { - if ((converted * 10) + digit > f_type_number_size_positive || (converted * 10) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted *= 10; - converted += digit; - } - } - else if (digit != 0) { - scale = 1; - - if (negative) { - converted = 0 - digit; - } - else { - converted = digit; - } - } - } - else if (string[i] != 0) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - return F_none; - } -#endif // _di_f_conversion_string_to_decimal_signed_ - -#ifndef _di_f_conversion_string_to_decimal_unsigned_ - f_return_status f_conversion_string_to_decimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t scale = 0; - f_number_unsigned digit = 0; - f_number_unsigned converted = 0; - - for (f_string_length i = range.start; i <= range.stop; i++) { - if (f_conversion_character_to_decimal(string[i], &digit) == F_none) { - - if (scale) { - scale++; - - if (scale > f_conversion_scale_decimal_unsigned) { - if ((converted * 10) + digit > f_type_number_size_unsigned || (converted * 10) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted *= 10; - converted += digit; - } - else if (digit != 0) { - scale = 1; - converted = digit; - } - } - else if (string[i] != 0) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - return F_none; - } -#endif // _di_f_conversion_string_to_decimal_unsigned_ - -#ifndef _di_f_conversion_string_to_duodecimal_signed_ - f_return_status f_conversion_string_to_duodecimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t scale = 0; - f_number_unsigned digit = 0; - f_number_unsigned converted = 0; - - for (f_string_length i = range.start; i <= range.stop; i++) { - if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) { - - if (scale) { - scale++; - - if (negative) { - if (scale > f_conversion_scale_duodecimal_signed) { - if ((converted * 12) - digit < f_type_number_size_negative || (converted * 12) - digit > converted) { - return F_status_set_error(F_number_underflow); - } - } - - converted *= 12; - converted -= digit; - } - else { - if (scale > f_conversion_scale_duodecimal_signed) { - if ((converted * 12) + digit > f_type_number_size_positive || (converted * 12) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted *= 12; - converted += digit; - } - } - else if (digit != 0) { - scale = 1; - - if (negative) { - converted = 0 - digit; - } - else { - converted = digit; - } - } - } - else if (string[i] != 0) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - return F_none; - } -#endif // _di_f_conversion_string_to_duodecimal_signed_ - -#ifndef _di_f_conversion_string_to_duodecimal_unsigned_ - f_return_status f_conversion_string_to_duodecimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t scale = 0; - f_number_unsigned digit = 0; - f_number_unsigned converted = 0; - - for (f_string_length i = range.start; i <= range.stop; i++) { - if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) { - - if (scale) { - scale++; - - if (scale > f_conversion_scale_duodecimal_unsigned) { - if ((converted * 12) + digit > f_type_number_size_unsigned || (converted * 12) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted *= 12; - converted += digit; - } - else if (digit != 0) { - scale = 1; - converted = digit; - } - } - else if (string[i] != 0) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - return F_none; - } -#endif // _di_f_conversion_string_to_duodecimal_unsigned_ - -#ifndef _di_f_conversion_string_to_hexidecimal_signed_ - f_return_status f_conversion_string_to_hexidecimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t scale = 0; - f_number_unsigned digit = 0; - f_number_unsigned converted = 0; - - for (f_string_length i = range.start; i <= range.stop; i++) { - if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) { - - if (scale) { - scale++; - - if (negative) { - if (scale > f_conversion_scale_hexidecimal_signed) { - if ((converted << 4) - digit < f_type_number_size_negative || (converted << 4) - digit > converted) { - return F_status_set_error(F_number_underflow); - } - } - - converted <<= 4; - converted -= digit; - } - else { - if (scale > f_conversion_scale_hexidecimal_signed) { - if ((converted << 4) + digit > f_type_number_size_positive || (converted << 4) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted <<= 4; - converted += digit; - } - } - else if (digit != 0) { - scale = 1; - - if (negative) { - converted = 0 - digit; - } - else { - converted = digit; - } - } - } - else if (string[i] != 0) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - return F_none; - } -#endif // _di_f_conversion_string_to_hexidecimal_signed_ - -#ifndef _di_f_conversion_string_to_hexidecimal_unsigned_ - f_return_status f_conversion_string_to_hexidecimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t scale = 0; - f_number_unsigned digit = 0; - f_number_unsigned converted = 0; - - for (f_string_length i = range.start; i <= range.stop; i++) { - if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) { - - if (scale) { - scale++; - - if (scale > f_conversion_scale_hexidecimal_unsigned) { - if ((converted << 4) + digit > f_type_number_size_unsigned || (converted << 4) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted <<= 4; - converted += digit; - } - else if (digit != 0) { - scale = 1; - converted = digit; - } - } - else if (string[i] != 0) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - return F_none; - } -#endif // _di_f_conversion_string_to_hexidecimal_unsigned_ - -#ifndef _di_f_conversion_string_to_octal_signed_ - f_return_status f_conversion_string_to_octal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t scale = 0; - f_number_unsigned digit = 0; - f_number_unsigned converted = 0; - - for (f_string_length i = range.start; i <= range.stop; i++) { - if (f_conversion_character_to_octal(string[i], &digit) == F_none) { - - if (scale) { - scale++; - - if (negative) { - if (scale > f_conversion_scale_octal_signed) { - if ((converted << 3) - digit < f_type_number_size_negative || (converted << 3) - digit > converted) { - return F_status_set_error(F_number_underflow); - } - } - - converted <<= 3; - converted -= digit; - } - else { - if (scale > f_conversion_scale_octal_signed) { - if ((converted << 3) + digit > f_type_number_size_positive || (converted << 3) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted <<= 3; - converted += digit; - } - } - else if (digit != 0) { - scale = 1; - - if (negative) { - converted = 0 - digit; - } - else { - converted = digit; - } - } - } - else if (string[i] != 0) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - return F_none; - } -#endif // _di_f_conversion_string_to_octal_signed_ - -#ifndef _di_f_conversion_string_to_octal_unsigned_ - f_return_status f_conversion_string_to_octal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t scale = 0; - f_number_unsigned digit = 0; - f_number_unsigned converted = 0; - - for (f_string_length i = range.start; i <= range.stop; i++) { - if (f_conversion_character_to_octal(string[i], &digit) == F_none) { - - if (scale) { - scale++; - - if (scale > f_conversion_scale_octal_unsigned) { - if ((converted << 3) + digit > f_type_number_size_unsigned || (converted << 3) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted <<= 3; - converted += digit; - } - else if (digit != 0) { - scale = 1; - converted = digit; - } - } - else if (string[i] != 0) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - return F_none; - } -#endif // _di_f_conversion_string_to_octal_unsigned_ - -#ifndef _di_f_conversion_string_to_number_signed_ - f_return_status f_conversion_string_to_number_signed(const f_string string, f_number_signed *number, const f_string_range range) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t width = 0; - uint8_t width_max = 0; - uint8_t mode = 0; - int8_t vector = 0; // 0 for assumed positive, 1 for explicit positive, -1 for negative. - f_string_length j = 0; - f_string_length offset = 0; - f_status status = F_none; - - for (f_string_length i = range.start; i <= range.stop; i++) { - width = f_macro_utf_byte_width_is(string[i]); - - if (width == 0) { - if (isspace(string[i])) { - if (mode == 0 && vector == 0) { - offset++; - continue; - } - - return F_status_set_error(F_number); - } - } - else { - if (mode == 0 && vector == 0) { - 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_incomplete_utf); - } - - return status; - } - } - - return F_status_set_error(F_number); - } - - if (string[i] == 0x30) { - j = i + 1; - - // 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] > 0x29 && 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 { - 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 == 0 && vector == 0) { - vector = 1; - offset++; - } - else { - return F_status_set_error(F_number); - } - } - - // negative sign is not allowed. - if (string[i] == 0x2d) { - if (mode == 0 && vector == 0) { - 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 == 0) { - return F_status_set_error(F_number); - } - - f_string_range location_offset = f_string_range_initialize; - location_offset.start = range.start + offset; - location_offset.stop = range.stop; - - if (mode == 10) { - return f_conversion_string_to_decimal_signed(string, number, location_offset, vector == -1); - } - - if (mode == 16) { - return f_conversion_string_to_hexidecimal_signed(string, number, location_offset, vector == -1); - } - - if (mode == 12) { - return f_conversion_string_to_duodecimal_signed(string, number, location_offset, vector == -1); - } - - if (mode == 8) { - return f_conversion_string_to_octal_signed(string, number, location_offset, vector == -1); - } - - return f_conversion_string_to_binary_signed(string, number, location_offset, vector == -1); - } -#endif // _di_f_conversion_string_to_number_signed_ - -#ifndef _di_f_conversion_string_to_number_unsigned_ - f_return_status f_conversion_string_to_number_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { - #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (string[0] == 0) { - return F_data_not; - } - - uint8_t width = 0; - uint8_t width_max = 0; - uint8_t mode = 0; - f_string_length j = 0; - f_string_length offset = 0; - f_status status = F_none; - int8_t sign_found = 0; - - for (f_string_length i = range.start; i <= range.stop; i++) { - width = f_macro_utf_byte_width_is(string[i]); - - if (width == 0) { - if (isspace(string[i])) { - if (mode == 0) { - offset++; - continue; - } - - return F_status_set_error(F_number); - } - } - else { - if (mode == 0) { - 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_incomplete_utf); - } - - return status; - } - } - - return F_status_set_error(F_number); - } - - if (string[i] == 0x30) { - j = i + 1; - - // 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] > 0x29 && 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 { - 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 == 0) { - return F_status_set_error(F_number); - } - - f_string_range location_offset = f_string_range_initialize; - location_offset.start = range.start + offset; - location_offset.stop = range.stop; - - if (range.start + offset > range.stop) { - return F_status_set_error(F_number); - } - - if (mode == 10) { - status = f_conversion_string_to_decimal_unsigned(string, number, location_offset); - } - else if (mode == 16) { - status = f_conversion_string_to_hexidecimal_unsigned(string, number, location_offset); - } - else if (mode == 12) { - status = f_conversion_string_to_duodecimal_unsigned(string, number, location_offset); - } - else if (mode == 8) { - status = f_conversion_string_to_octal_unsigned(string, number, location_offset); - } - else { - status = f_conversion_string_to_binary_unsigned(string, number, location_offset); - } - - // +/- 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 // _di_f_conversion_string_to_number_unsigned_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_conversion/c/conversion.h b/level_0/f_conversion/c/conversion.h index d77a390..2688361 100644 --- a/level_0/f_conversion/c/conversion.h +++ b/level_0/f_conversion/c/conversion.h @@ -15,9 +15,10 @@ #include // fll-0 includes +#include #include +#include #include -#include #include #ifdef __cplusplus @@ -242,366 +243,6 @@ extern "C" { extern f_return_status f_conversion_character_to_octal(const int8_t character, f_number_unsigned *number); #endif // _di_f_conversion_character_to_octal_ -/** - * Convert a series of positive or negative binary number characters into a f_number_signed. - * - * This will stop at one of the following: location.stop or a non-digit. - * This will ignore NULL values. - * This will not process signed statuses (+/-). - * - * @param string - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @param location - * The start/stop range to convert. - * @param negative - * Set to 0 to treat string as a positive number, 1 for as a negative number. - * - * @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_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_f_conversion_string_to_binary_signed_ - extern f_return_status f_conversion_string_to_binary_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative); -#endif // _di_f_conversion_string_to_binary_signed_ - -/** - * Convert a series of positive binary number characters into a f_number_unsigned. - * - * 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 - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @param range - * The start/stop range to convert. - * - * @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_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_conversion_string_to_binary_unsigned_ - extern f_return_status f_conversion_string_to_binary_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); -#endif // _di_f_conversion_string_to_binary_unsigned_ - -/** - * Convert a series of positive or negative decimal number characters into an f_number_signed. - * - * 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 - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @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. - * - * @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_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_f_conversion_string_to_decimal_signed_ - extern f_return_status f_conversion_string_to_decimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative); -#endif // _di_f_conversion_string_to_decimal_signed_ - -/** - * Convert a series of positive decimal number characters into an f_number_unsigned. - * - * 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 - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @param range - * The start/stop range to convert. - * - * @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_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_conversion_string_to_decimal_unsigned_ - extern f_return_status f_conversion_string_to_decimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); -#endif // _di_f_conversion_string_to_decimal_unsigned_ - -/** - * Convert a series of positive or negative duodecimal number characters into an f_number_signed. - * - * 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 - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @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. - * - * @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_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_f_conversion_string_to_duodecimal_signed_ - extern f_return_status f_conversion_string_to_duodecimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative); -#endif // _di_f_conversion_string_to_duodecimal_signed_ - -/** - * Convert a series of positive duodecimal number characters into an f_number_unsigned. - * - * 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 - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @param range - * The start/stop range to convert. - * - * @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_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_conversion_string_to_duodecimal_unsigned_ - extern f_return_status f_conversion_string_to_duodecimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); -#endif // _di_f_conversion_string_to_duodecimal_unsigned_ - -/** - * Convert a series of positive or negative hexidecimal number characters into an f_number_signed. - * - * 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 - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @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. - * - * @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_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_f_conversion_string_to_hexidecimal_signed_ - extern f_return_status f_conversion_string_to_hexidecimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative); -#endif // _di_f_conversion_string_to_hexidecimal_signed_ - -/** - * Convert a series of positive hexidecimal number characters into an f_number_unsigned. - * - * 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 - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @param range - * The start/stop range to convert. - * - * @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_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_conversion_string_to_hexidecimal_unsigned_ - extern f_return_status f_conversion_string_to_hexidecimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); -#endif // _di_f_conversion_string_to_hexidecimal_unsigned_ - -/** - * Convert a series of positive or negative octal number characters into an f_number_signed. - * - * 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 - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @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. - * - * @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_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_conversion_string_to_octal_signed_ - extern f_return_status f_conversion_string_to_octal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative); -#endif // _di_f_conversion_string_to_octal_signed_ - -/** - * Convert a series of positive octal number characters into an f_number_unsigned. - * - * 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 - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @param range - * The start/stop range to convert. - * - * @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_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_conversion_string_to_octal_unsigned_ - extern f_return_status f_conversion_string_to_octal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); -#endif // _di_f_conversion_string_to_octal_unsigned_ - -/** - * Convert a series of positive or negative number characters into an f_number_signed. - * - * This will stop at one of the following: range.stop or 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 string - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @param range - * The start/stop range to convert. - * - * @return - * F_none on success. - * F_data_not if string starts with a null (length is 0). - * F_incomplete_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_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_f_conversion_string_to_number_signed_ - extern f_return_status f_conversion_string_to_number_signed(const f_string string, f_number_signed *number, const f_string_range range); -#endif // _di_f_conversion_string_to_number_signed_ - -/** - * Convert a series of positive number characters into an f_number_unsigned. - * - * 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 (+/-). - * 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 string - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * @param range - * The start/stop range to convert. - * - * @return - * F_none on success. - * F_data_not if string starts with a null (length is 0). - * F_incomplete_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_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_f_conversion_string_to_number_unsigned_ - extern f_return_status f_conversion_string_to_number_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); -#endif // _di_f_conversion_string_to_number_unsigned_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_conversion/data/build/dependencies b/level_0/f_conversion/data/build/dependencies index 13b45c7..deb9037 100644 --- a/level_0/f_conversion/data/build/dependencies +++ b/level_0/f_conversion/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_0/f_directory/c/directory.h b/level_0/f_directory/c/directory.h index fe55668..493300f 100644 --- a/level_0/f_directory/c/directory.h +++ b/level_0/f_directory/c/directory.h @@ -30,10 +30,10 @@ #endif // __USE_XOPEN_EXTENDED // fll-0 includes +#include #include #include #include -#include #include #ifdef __cplusplus diff --git a/level_0/f_directory/data/build/dependencies b/level_0/f_directory/data/build/dependencies index d8175f5..d798245 100644 --- a/level_0/f_directory/data/build/dependencies +++ b/level_0/f_directory/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_0/f_environment/c/environment.h b/level_0/f_environment/c/environment.h index eda396c..be12382 100644 --- a/level_0/f_environment/c/environment.h +++ b/level_0/f_environment/c/environment.h @@ -15,10 +15,10 @@ #include // fll-0 includes +#include #include #include #include -#include #ifdef __cplusplus extern "C" { diff --git a/level_0/f_environment/data/build/dependencies b/level_0/f_environment/data/build/dependencies index d8175f5..d798245 100644 --- a/level_0/f_environment/data/build/dependencies +++ b/level_0/f_environment/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_0/f_file/c/file.h b/level_0/f_file/c/file.h index ecb8cb6..c8f0bb5 100644 --- a/level_0/f_file/c/file.h +++ b/level_0/f_file/c/file.h @@ -30,9 +30,10 @@ #include // fll-0 includes +#include #include +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/level_0/f_file/data/build/dependencies b/level_0/f_file/data/build/dependencies index d8175f5..d798245 100644 --- a/level_0/f_file/data/build/dependencies +++ b/level_0/f_file/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_0/f_fss/data/build/dependencies b/level_0/f_fss/data/build/dependencies index 13b45c7..deb9037 100644 --- a/level_0/f_fss/data/build/dependencies +++ b/level_0/f_fss/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_0/f_iki/c/iki.h b/level_0/f_iki/c/iki.h index fa6c7b5..0fb55d9 100644 --- a/level_0/f_iki/c/iki.h +++ b/level_0/f_iki/c/iki.h @@ -18,10 +18,10 @@ #include // fll-0 includes +#include #include #include #include -#include #include // fll-0 iki includes diff --git a/level_0/f_iki/data/build/dependencies b/level_0/f_iki/data/build/dependencies index 13b45c7..deb9037 100644 --- a/level_0/f_iki/data/build/dependencies +++ b/level_0/f_iki/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_0/f_memory/c/memory.h b/level_0/f_memory/c/memory.h index df8f4d7..dbfec8f 100644 --- a/level_0/f_memory/c/memory.h +++ b/level_0/f_memory/c/memory.h @@ -20,8 +20,8 @@ #include // fll-0 includes -#include #include +#include // fll-0 memory includes #include diff --git a/level_0/f_memory/data/build/dependencies b/level_0/f_memory/data/build/dependencies index 2060b72..d9c4b77 100644 --- a/level_0/f_memory/data/build/dependencies +++ b/level_0/f_memory/data/build/dependencies @@ -1,2 +1,4 @@ +# fss-0000 + f_type f_status diff --git a/level_0/f_path/c/path.h b/level_0/f_path/c/path.h index b6a70a3..488990b 100644 --- a/level_0/f_path/c/path.h +++ b/level_0/f_path/c/path.h @@ -15,11 +15,10 @@ #include // fll-0 includes +#include #include #include #include -#include -#include #ifdef __cplusplus extern "C" { diff --git a/level_0/f_path/data/build/dependencies b/level_0/f_path/data/build/dependencies index 13b45c7..d798245 100644 --- a/level_0/f_path/data/build/dependencies +++ b/level_0/f_path/data/build/dependencies @@ -1,5 +1,6 @@ +# fss-0000 + f_type f_status f_memory f_string -f_utf diff --git a/level_0/f_path/data/build/settings b/level_0/f_path/data/build/settings index a63b540..af77606 100644 --- a/level_0/f_path/data/build/settings +++ b/level_0/f_path/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lf_utf -lf_memory +build_libraries-individual -lf_memory build_sources_library path.c build_sources_program build_sources_headers path.h diff --git a/level_0/f_pipe/data/build/dependencies b/level_0/f_pipe/data/build/dependencies index 2060b72..d9c4b77 100644 --- a/level_0/f_pipe/data/build/dependencies +++ b/level_0/f_pipe/data/build/dependencies @@ -1,2 +1,4 @@ +# fss-0000 + f_type f_status diff --git a/level_0/f_print/c/print.h b/level_0/f_print/c/print.h index 9ba88f7..47da122 100644 --- a/level_0/f_print/c/print.h +++ b/level_0/f_print/c/print.h @@ -19,9 +19,10 @@ #include // fll-0 includes +#include #include +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/level_0/f_print/data/build/dependencies b/level_0/f_print/data/build/dependencies index d8175f5..d798245 100644 --- a/level_0/f_print/data/build/dependencies +++ b/level_0/f_print/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_0/f_serialize/c/serialize.h b/level_0/f_serialize/c/serialize.h index 5d081da..959f649 100644 --- a/level_0/f_serialize/c/serialize.h +++ b/level_0/f_serialize/c/serialize.h @@ -16,10 +16,10 @@ #include // fll-0 includes +#include #include -#include +#include #include -#include #include #ifdef __cplusplus diff --git a/level_0/f_serialize/data/build/dependencies b/level_0/f_serialize/data/build/dependencies index e783f2d..deb9037 100644 --- a/level_0/f_serialize/data/build/dependencies +++ b/level_0/f_serialize/data/build/dependencies @@ -1,5 +1,7 @@ -f_memory +# fss-0000 + +f_type f_status +f_memory f_string -f_type f_utf diff --git a/level_0/f_socket/c/socket.h b/level_0/f_socket/c/socket.h index bee68d3..22d4efc 100644 --- a/level_0/f_socket/c/socket.h +++ b/level_0/f_socket/c/socket.h @@ -23,6 +23,7 @@ // fll-0 includes #include #include +#include #include #ifdef __cplusplus diff --git a/level_0/f_socket/data/build/dependencies b/level_0/f_socket/data/build/dependencies index 300ca78..d798245 100644 --- a/level_0/f_socket/data/build/dependencies +++ b/level_0/f_socket/data/build/dependencies @@ -1,4 +1,6 @@ -f_memory +# fss-0000 + +f_type f_status +f_memory f_string -f_type diff --git a/level_0/f_status/c/status_array.h b/level_0/f_status/c/status_array.h index 5cb939b..47e87d4 100644 --- a/level_0/f_status/c/status_array.h +++ b/level_0/f_status/c/status_array.h @@ -6,6 +6,8 @@ * Licenses: lgplv2.1 * * Provides status arrays that require memory operations. + * + * Because memory requires status.h, this is moved to a separate file to reduce potential circular dependency issues. */ #ifndef _F_status_array_h #define _F_status_array_h diff --git a/level_0/f_status/data/build/dependencies b/level_0/f_status/data/build/dependencies index e69de29..c665317 100644 --- a/level_0/f_status/data/build/dependencies +++ b/level_0/f_status/data/build/dependencies @@ -0,0 +1,2 @@ +# fss-0000 + diff --git a/level_0/f_string/data/build/dependencies b/level_0/f_string/data/build/dependencies index f8f708c..66dca29 100644 --- a/level_0/f_string/data/build/dependencies +++ b/level_0/f_string/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_0/f_string/data/build/settings b/level_0/f_string/data/build/settings index 21d990d..7d7368d 100644 --- a/level_0/f_string/data/build/settings +++ b/level_0/f_string/data/build/settings @@ -22,7 +22,7 @@ build_libraries -lc build_libraries-individual -lf_memory build_sources_library build_sources_program -build_sources_headers string.h string-common.h string-dynamic.h string-quantity.h string-range.h +build_sources_headers string.h string-common.h string-dynamic.h string-map.h string-quantity.h string-range.h build_sources_script build_sources_setting build_script yes diff --git a/level_0/f_type/c/type_array.h b/level_0/f_type/c/type_array.h index 55ea309..1a1a9ae 100644 --- a/level_0/f_type/c/type_array.h +++ b/level_0/f_type/c/type_array.h @@ -6,13 +6,15 @@ * Licenses: lgplv2.1 * * Provides datatypes that require memory operations. + * + * Because memory requires status.h, this is moved to a separate file to reduce potential circular dependency issues. */ #ifndef _F_type_array_h #define _F_type_array_h // fll-0 includes -#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type/data/build/dependencies b/level_0/f_type/data/build/dependencies index e69de29..c665317 100644 --- a/level_0/f_type/data/build/dependencies +++ b/level_0/f_type/data/build/dependencies @@ -0,0 +1,2 @@ +# fss-0000 + diff --git a/level_0/f_utf/c/utf.h b/level_0/f_utf/c/utf.h index 0c071d5..4f28179 100644 --- a/level_0/f_utf/c/utf.h +++ b/level_0/f_utf/c/utf.h @@ -39,8 +39,9 @@ #include // fll-0 includes -#include #include +#include +#include #include // fll-0 utf includes diff --git a/level_0/f_utf/data/build/dependencies b/level_0/f_utf/data/build/dependencies index d8175f5..d798245 100644 --- a/level_0/f_utf/data/build/dependencies +++ b/level_0/f_utf/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_1/fl_color/c/color.h b/level_1/fl_color/c/color.h index 5ab2fb3..21f63a6 100644 --- a/level_1/fl_color/c/color.h +++ b/level_1/fl_color/c/color.h @@ -16,11 +16,12 @@ #include // fll-0 includes -#include +#include #include -#include +#include #include -#include +#include +#include #include #ifdef __cplusplus diff --git a/level_1/fl_color/data/build/dependencies b/level_1/fl_color/data/build/dependencies index f86139a..5f3a165 100644 --- a/level_1/fl_color/data/build/dependencies +++ b/level_1/fl_color/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_1/fl_console/c/console.c b/level_1/fl_console/c/console.c index 33ca898..6234a43 100644 --- a/level_1/fl_console/c/console.c +++ b/level_1/fl_console/c/console.c @@ -6,9 +6,9 @@ extern "C" { #ifndef _fl_console_parameter_to_string_dynamic_directory_ f_return_status fl_console_parameter_to_string_dynamic_directory(const f_string argument, f_string_dynamic *directory) { - #ifndef _di_level_0_parameter_checking_ + #ifndef _di_level_1_parameter_checking_ if (argument == 0) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_f + #endif // _di_level_1_parameter_checking_ f_status status = F_none; f_string_length length = strlen(argument); @@ -159,42 +159,6 @@ extern "C" { } #endif // _fl_console_parameter_to_string_dynamic_directory_ -#ifndef _fl_console_parameter_to_number_signed_ - f_return_status fl_console_parameter_to_number_signed(const f_string argument, f_number_signed *number) { - #ifndef _di_level_0_parameter_checking_ - if (argument == 0) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_f - - if (argument[0] == 0) { - return F_data_not; - } - - f_string_range range = f_string_range_initialize; - range.start = 0; - range.stop = strlen(argument) - 1; - - return f_conversion_string_to_number_signed(argument, number, range); - } -#endif // _fl_console_parameter_to_number_signed_ - -#ifndef _fl_console_parameter_to_number_unsigned_ - f_return_status fl_console_parameter_to_number_unsigned(const f_string argument, f_number_unsigned *number) { - #ifndef _di_level_0_parameter_checking_ - if (argument == 0) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_f - - if (argument[0] == 0) { - return F_data_not; - } - - f_string_range range = f_string_range_initialize; - range.start = 0; - range.stop = strlen(argument) - 1; - - return f_conversion_string_to_number_unsigned(argument, number, range); - } -#endif // _fl_console_parameter_to_number_unsigned_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_1/fl_console/c/console.h b/level_1/fl_console/c/console.h index 5d5e956..5992d84 100644 --- a/level_1/fl_console/c/console.h +++ b/level_1/fl_console/c/console.h @@ -16,12 +16,13 @@ #include // fll-0 includes -#include -#include +#include #include +#include #include -#include #include +#include +#include #ifdef __cplusplus extern "C" { @@ -58,72 +59,6 @@ extern "C" { extern f_return_status fl_console_parameter_to_string_dynamic_directory(const f_string argument, f_string_dynamic *directory); #endif // _fl_console_parameter_to_string_dynamic_directory_ -/** - * Convert a console parameter additional argument to a signed integer. - * - * 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. - * - * @param argv - * The argument string expected to be a number. - * This is generally passed from the argv[]. - * @param number - * The converted number is stored here. - * This only gets modified on success. - * - * @return - * F_none on success. - * F_data_not if string starts wth a null (length is 0). - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors from (with error bit): f_conversion_string_to_number_signed(). - * - * @see f_conversion_string_to_number_signed() - */ -#ifndef _fl_console_parameter_to_number_signed_ - extern f_return_status fl_console_parameter_to_number_signed(const f_string argument, f_number_signed *number); -#endif // _fl_console_parameter_to_number_signed_ - -/** - * Convert a console parameter additional argument to an unsigned integer. - * - * 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. - * - * @param argv - * The argument string expected to be a number. - * This is generally passed from the argv[]. - * @param number - * The converted number is stored here. - * This only gets modified on success. - * - * @return - * F_none on success. - * F_data_not if string starts wth a null (length is 0). - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors from (with error bit): f_conversion_string_to_number_unsigned(). - * - * @see f_conversion_string_to_number_unsigned() - */ -#ifndef _fl_console_parameter_to_number_unsigned_ - extern f_return_status fl_console_parameter_to_number_unsigned(const f_string argument, f_number_unsigned *number); -#endif // _fl_console_parameter_to_number_unsigned_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_1/fl_console/data/build/dependencies b/level_1/fl_console/data/build/dependencies index a7982aa..71a6d9d 100644 --- a/level_1/fl_console/data/build/dependencies +++ b/level_1/fl_console/data/build/dependencies @@ -1,7 +1,9 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_console f_conversion -f_utf diff --git a/level_1/fl_conversion/c/conversion.c b/level_1/fl_conversion/c/conversion.c new file mode 100644 index 0000000..a7d1251 --- /dev/null +++ b/level_1/fl_conversion/c/conversion.c @@ -0,0 +1,856 @@ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fl_conversion_string_to_binary_signed_ + f_return_status fl_conversion_string_to_binary_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t scale = 0; + f_number_unsigned digit = 0; + f_number_unsigned converted = 0; + + for (f_string_length i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_binary(string[i], &digit) == F_none) { + if (scale) { + scale++; + + if (negative) { + if (scale > f_conversion_scale_binary_signed) { + return F_status_set_error(F_number_underflow); + } + + converted <<= 1; + converted -= digit; + } + else { + if (scale > f_conversion_scale_binary_signed) { + return F_status_set_error(F_number_overflow); + } + + converted <<= 1; + converted += digit; + } + } + else if (digit != 0) { + scale = 1; + + if (negative) { + converted = 0 - digit; + } + else { + converted = digit; + } + } + } + else if (string[i] != 0) { + return F_status_set_error(F_number); + } + } // for + + *number = converted; + return F_none; + } +#endif // _di_fl_conversion_string_to_binary_signed_ + +#ifndef _di_fl_conversion_string_to_binary_unsigned_ + f_return_status fl_conversion_string_to_binary_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t scale = 0; + f_number_unsigned digit = 0; + f_number_unsigned converted = 0; + + for (f_string_length i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_binary(string[i], &digit) == F_none) { + if (scale) { + scale++; + + if (scale > f_conversion_scale_binary_unsigned) { + return F_status_set_error(F_number_overflow); + } + + converted <<= 1; + converted += digit; + } + else if (digit != 0) { + scale = 1; + converted = digit; + } + } + else if (string[i] != 0) { + return F_status_set_error(F_number); + } + } // for + + *number = converted; + return F_none; + } +#endif // _di_fl_conversion_string_to_binary_unsigned_ + +#ifndef _di_fl_conversion_string_to_decimal_signed_ + f_return_status fl_conversion_string_to_decimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t scale = 0; + f_number_unsigned digit = 0; + f_number_unsigned converted = 0; + + for (f_string_length i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_decimal(string[i], &digit) == F_none) { + + if (scale) { + scale++; + + if (negative) { + if (scale > f_conversion_scale_decimal_signed) { + if ((converted * 10) - digit < f_type_number_size_negative || (converted * 10) - digit > converted) { + return F_status_set_error(F_number_underflow); + } + } + + converted *= 10; + converted -= digit; + } + else { + if (scale > f_conversion_scale_decimal_signed) { + if ((converted * 10) + digit > f_type_number_size_positive || (converted * 10) + digit < converted) { + return F_status_set_error(F_number_overflow); + } + } + + converted *= 10; + converted += digit; + } + } + else if (digit != 0) { + scale = 1; + + if (negative) { + converted = 0 - digit; + } + else { + converted = digit; + } + } + } + else if (string[i] != 0) { + return F_status_set_error(F_number); + } + } // for + + *number = converted; + return F_none; + } +#endif // _di_fl_conversion_string_to_decimal_signed_ + +#ifndef _di_fl_conversion_string_to_decimal_unsigned_ + f_return_status fl_conversion_string_to_decimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t scale = 0; + f_number_unsigned digit = 0; + f_number_unsigned converted = 0; + + for (f_string_length i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_decimal(string[i], &digit) == F_none) { + + if (scale) { + scale++; + + if (scale > f_conversion_scale_decimal_unsigned) { + if ((converted * 10) + digit > f_type_number_size_unsigned || (converted * 10) + digit < converted) { + return F_status_set_error(F_number_overflow); + } + } + + converted *= 10; + converted += digit; + } + else if (digit != 0) { + scale = 1; + converted = digit; + } + } + else if (string[i] != 0) { + return F_status_set_error(F_number); + } + } // for + + *number = converted; + return F_none; + } +#endif // _di_fl_conversion_string_to_decimal_unsigned_ + +#ifndef _di_fl_conversion_string_to_duodecimal_signed_ + f_return_status fl_conversion_string_to_duodecimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t scale = 0; + f_number_unsigned digit = 0; + f_number_unsigned converted = 0; + + for (f_string_length i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) { + + if (scale) { + scale++; + + if (negative) { + if (scale > f_conversion_scale_duodecimal_signed) { + if ((converted * 12) - digit < f_type_number_size_negative || (converted * 12) - digit > converted) { + return F_status_set_error(F_number_underflow); + } + } + + converted *= 12; + converted -= digit; + } + else { + if (scale > f_conversion_scale_duodecimal_signed) { + if ((converted * 12) + digit > f_type_number_size_positive || (converted * 12) + digit < converted) { + return F_status_set_error(F_number_overflow); + } + } + + converted *= 12; + converted += digit; + } + } + else if (digit != 0) { + scale = 1; + + if (negative) { + converted = 0 - digit; + } + else { + converted = digit; + } + } + } + else if (string[i] != 0) { + return F_status_set_error(F_number); + } + } // for + + *number = converted; + return F_none; + } +#endif // _di_fl_conversion_string_to_duodecimal_signed_ + +#ifndef _di_fl_conversion_string_to_duodecimal_unsigned_ + f_return_status fl_conversion_string_to_duodecimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t scale = 0; + f_number_unsigned digit = 0; + f_number_unsigned converted = 0; + + for (f_string_length i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) { + + if (scale) { + scale++; + + if (scale > f_conversion_scale_duodecimal_unsigned) { + if ((converted * 12) + digit > f_type_number_size_unsigned || (converted * 12) + digit < converted) { + return F_status_set_error(F_number_overflow); + } + } + + converted *= 12; + converted += digit; + } + else if (digit != 0) { + scale = 1; + converted = digit; + } + } + else if (string[i] != 0) { + return F_status_set_error(F_number); + } + } // for + + *number = converted; + return F_none; + } +#endif // _di_fl_conversion_string_to_duodecimal_unsigned_ + +#ifndef _di_fl_conversion_string_to_hexidecimal_signed_ + f_return_status fl_conversion_string_to_hexidecimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t scale = 0; + f_number_unsigned digit = 0; + f_number_unsigned converted = 0; + + for (f_string_length i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) { + + if (scale) { + scale++; + + if (negative) { + if (scale > f_conversion_scale_hexidecimal_signed) { + if ((converted << 4) - digit < f_type_number_size_negative || (converted << 4) - digit > converted) { + return F_status_set_error(F_number_underflow); + } + } + + converted <<= 4; + converted -= digit; + } + else { + if (scale > f_conversion_scale_hexidecimal_signed) { + if ((converted << 4) + digit > f_type_number_size_positive || (converted << 4) + digit < converted) { + return F_status_set_error(F_number_overflow); + } + } + + converted <<= 4; + converted += digit; + } + } + else if (digit != 0) { + scale = 1; + + if (negative) { + converted = 0 - digit; + } + else { + converted = digit; + } + } + } + else if (string[i] != 0) { + return F_status_set_error(F_number); + } + } // for + + *number = converted; + return F_none; + } +#endif // _di_fl_conversion_string_to_hexidecimal_signed_ + +#ifndef _di_fl_conversion_string_to_hexidecimal_unsigned_ + f_return_status fl_conversion_string_to_hexidecimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t scale = 0; + f_number_unsigned digit = 0; + f_number_unsigned converted = 0; + + for (f_string_length i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) { + + if (scale) { + scale++; + + if (scale > f_conversion_scale_hexidecimal_unsigned) { + if ((converted << 4) + digit > f_type_number_size_unsigned || (converted << 4) + digit < converted) { + return F_status_set_error(F_number_overflow); + } + } + + converted <<= 4; + converted += digit; + } + else if (digit != 0) { + scale = 1; + converted = digit; + } + } + else if (string[i] != 0) { + return F_status_set_error(F_number); + } + } // for + + *number = converted; + return F_none; + } +#endif // _di_fl_conversion_string_to_hexidecimal_unsigned_ + +#ifndef _di_fl_conversion_string_to_octal_signed_ + f_return_status fl_conversion_string_to_octal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t scale = 0; + f_number_unsigned digit = 0; + f_number_unsigned converted = 0; + + for (f_string_length i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_octal(string[i], &digit) == F_none) { + + if (scale) { + scale++; + + if (negative) { + if (scale > f_conversion_scale_octal_signed) { + if ((converted << 3) - digit < f_type_number_size_negative || (converted << 3) - digit > converted) { + return F_status_set_error(F_number_underflow); + } + } + + converted <<= 3; + converted -= digit; + } + else { + if (scale > f_conversion_scale_octal_signed) { + if ((converted << 3) + digit > f_type_number_size_positive || (converted << 3) + digit < converted) { + return F_status_set_error(F_number_overflow); + } + } + + converted <<= 3; + converted += digit; + } + } + else if (digit != 0) { + scale = 1; + + if (negative) { + converted = 0 - digit; + } + else { + converted = digit; + } + } + } + else if (string[i] != 0) { + return F_status_set_error(F_number); + } + } // for + + *number = converted; + return F_none; + } +#endif // _di_fl_conversion_string_to_octal_signed_ + +#ifndef _di_fl_conversion_string_to_octal_unsigned_ + f_return_status fl_conversion_string_to_octal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t scale = 0; + f_number_unsigned digit = 0; + f_number_unsigned converted = 0; + + for (f_string_length i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_octal(string[i], &digit) == F_none) { + + if (scale) { + scale++; + + if (scale > f_conversion_scale_octal_unsigned) { + if ((converted << 3) + digit > f_type_number_size_unsigned || (converted << 3) + digit < converted) { + return F_status_set_error(F_number_overflow); + } + } + + converted <<= 3; + converted += digit; + } + else if (digit != 0) { + scale = 1; + converted = digit; + } + } + else if (string[i] != 0) { + return F_status_set_error(F_number); + } + } // for + + *number = converted; + return F_none; + } +#endif // _di_fl_conversion_string_to_octal_unsigned_ + +#ifndef _di_fl_conversion_string_to_number_signed_ + f_return_status fl_conversion_string_to_number_signed(const f_string string, f_number_signed *number, const f_string_range range) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t width = 0; + uint8_t width_max = 0; + uint8_t mode = 0; + int8_t vector = 0; // 0 for assumed positive, 1 for explicit positive, -1 for negative. + f_string_length j = 0; + f_string_length offset = 0; + f_status status = F_none; + + for (f_string_length i = range.start; i <= range.stop; i++) { + width = f_macro_utf_byte_width_is(string[i]); + + if (width == 0) { + if (isspace(string[i])) { + if (mode == 0 && vector == 0) { + offset++; + continue; + } + + return F_status_set_error(F_number); + } + } + else { + if (mode == 0 && vector == 0) { + 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_incomplete_utf); + } + + return status; + } + } + + return F_status_set_error(F_number); + } + + if (string[i] == 0x30) { + j = i + 1; + + // 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] > 0x29 && 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 { + 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 == 0 && vector == 0) { + vector = 1; + offset++; + } + else { + return F_status_set_error(F_number); + } + } + + // negative sign is not allowed. + if (string[i] == 0x2d) { + if (mode == 0 && vector == 0) { + 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 == 0) { + return F_status_set_error(F_number); + } + + f_string_range location_offset = f_string_range_initialize; + location_offset.start = range.start + offset; + location_offset.stop = range.stop; + + if (range.start + offset > range.stop) { + return F_status_set_error(F_number); + } + + if (mode == 10) { + return fl_conversion_string_to_decimal_signed(string, number, location_offset, vector == -1); + } + + if (mode == 16) { + return fl_conversion_string_to_hexidecimal_signed(string, number, location_offset, vector == -1); + } + + if (mode == 12) { + return fl_conversion_string_to_duodecimal_signed(string, number, location_offset, vector == -1); + } + + if (mode == 8) { + return fl_conversion_string_to_octal_signed(string, number, location_offset, vector == -1); + } + + return fl_conversion_string_to_binary_signed(string, number, location_offset, vector == -1); + } +#endif // _di_fl_conversion_string_to_number_signed_ + +#ifndef _di_fl_conversion_string_to_number_unsigned_ + f_return_status fl_conversion_string_to_number_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range) { + #ifndef _di_level_1_parameter_checking_ + if (string == 0) return F_status_set_error(F_parameter); + if (number == 0) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + if (string[0] == 0) { + return F_data_not; + } + + uint8_t width = 0; + uint8_t width_max = 0; + uint8_t mode = 0; + f_string_length j = 0; + f_string_length offset = 0; + f_status status = F_none; + int8_t sign_found = 0; + + for (f_string_length i = range.start; i <= range.stop; i++) { + width = f_macro_utf_byte_width_is(string[i]); + + if (width == 0) { + if (isspace(string[i])) { + if (mode == 0) { + offset++; + continue; + } + + return F_status_set_error(F_number); + } + } + else { + if (mode == 0) { + 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_incomplete_utf); + } + + return status; + } + } + + return F_status_set_error(F_number); + } + + if (string[i] == 0x30) { + j = i + 1; + + // 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] > 0x29 && 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 { + 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 == 0) { + return F_status_set_error(F_number); + } + + f_string_range location_offset = f_string_range_initialize; + location_offset.start = range.start + offset; + location_offset.stop = range.stop; + + if (range.start + offset > range.stop) { + return F_status_set_error(F_number); + } + + if (mode == 10) { + status = fl_conversion_string_to_decimal_unsigned(string, number, location_offset); + } + else if (mode == 16) { + status = fl_conversion_string_to_hexidecimal_unsigned(string, number, location_offset); + } + else if (mode == 12) { + status = fl_conversion_string_to_duodecimal_unsigned(string, number, location_offset); + } + else if (mode == 8) { + status = fl_conversion_string_to_octal_unsigned(string, number, location_offset); + } + else { + status = fl_conversion_string_to_binary_unsigned(string, number, location_offset); + } + + // +/- 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 // _di_fl_conversion_string_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 new file mode 100644 index 0000000..a218e3e --- /dev/null +++ b/level_1/fl_conversion/c/conversion.h @@ -0,0 +1,393 @@ +/** + * FLL - Level 0 + * + * Project: Conversion + * API Version: 0.5 + * Licenses: lgplv2.1 + * + * Provide means to convert one data type to another, such as a string to an integer. + */ +#ifndef _FL_conversion_h +#define _FL_conversion_h + +// libc includes +#include +#include + +// fll-0 includes +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Convert a series of positive or negative binary number characters into a f_number_signed. + * + * This will stop at one of the following: location.stop or a non-digit. + * This will ignore NULL values. + * This will not process signed statuses (+/-). + * + * @param string + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @param location + * The start/stop range to convert. + * @param negative + * Set to 0 to treat string as a positive number, 1 for as a negative number. + * + * @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_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_string_to_binary_signed_ + extern f_return_status fl_conversion_string_to_binary_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative); +#endif // _di_fl_conversion_string_to_binary_signed_ + +/** + * Convert a series of positive binary number characters into a f_number_unsigned. + * + * 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 + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @param range + * The start/stop range to convert. + * + * @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_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_return_status fl_conversion_string_to_binary_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); +#endif // _di_fl_conversion_string_to_binary_unsigned_ + +/** + * Convert a series of positive or negative decimal number characters into an f_number_signed. + * + * 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 + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @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. + * + * @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_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_string_to_decimal_signed_ + extern f_return_status fl_conversion_string_to_decimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative); +#endif // _di_fl_conversion_string_to_decimal_signed_ + +/** + * Convert a series of positive decimal number characters into an f_number_unsigned. + * + * 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 + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @param range + * The start/stop range to convert. + * + * @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_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_return_status fl_conversion_string_to_decimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); +#endif // _di_fl_conversion_string_to_decimal_unsigned_ + +/** + * Convert a series of positive or negative duodecimal number characters into an f_number_signed. + * + * 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 + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @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. + * + * @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_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_string_to_duodecimal_signed_ + extern f_return_status fl_conversion_string_to_duodecimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative); +#endif // _di_fl_conversion_string_to_duodecimal_signed_ + +/** + * Convert a series of positive duodecimal number characters into an f_number_unsigned. + * + * 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 + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @param range + * The start/stop range to convert. + * + * @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_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_return_status fl_conversion_string_to_duodecimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); +#endif // _di_fl_conversion_string_to_duodecimal_unsigned_ + +/** + * Convert a series of positive or negative hexidecimal number characters into an f_number_signed. + * + * 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 + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @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. + * + * @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_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_string_to_hexidecimal_signed_ + extern f_return_status fl_conversion_string_to_hexidecimal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative); +#endif // _di_fl_conversion_string_to_hexidecimal_signed_ + +/** + * Convert a series of positive hexidecimal number characters into an f_number_unsigned. + * + * 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 + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @param range + * The start/stop range to convert. + * + * @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_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_return_status fl_conversion_string_to_hexidecimal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); +#endif // _di_fl_conversion_string_to_hexidecimal_unsigned_ + +/** + * Convert a series of positive or negative octal number characters into an f_number_signed. + * + * 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 + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @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. + * + * @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_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_return_status fl_conversion_string_to_octal_signed(const f_string string, f_number_signed *number, const f_string_range range, const bool negative); +#endif // _di_fl_conversion_string_to_octal_signed_ + +/** + * Convert a series of positive octal number characters into an f_number_unsigned. + * + * 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 + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @param range + * The start/stop range to convert. + * + * @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_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_return_status fl_conversion_string_to_octal_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); +#endif // _di_fl_conversion_string_to_octal_unsigned_ + +/** + * Convert a series of positive or negative number characters into an f_number_signed. + * + * This will stop at one of the following: range.stop or 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 string + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @param range + * The start/stop range to convert. + * + * @return + * F_none on success. + * F_data_not if string starts with a null (length is 0). + * F_incomplete_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_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_string_to_number_signed_ + extern f_return_status fl_conversion_string_to_number_signed(const f_string string, f_number_signed *number, const f_string_range range); +#endif // _di_fl_conversion_string_to_number_signed_ + +/** + * Convert a series of positive number characters into an f_number_unsigned. + * + * 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 (+/-). + * 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 string + * The string to convert. + * @param number + * This will store the value of the converted string. + * This value is only changed on success. + * @param range + * The start/stop range to convert. + * + * @return + * F_none on success. + * F_data_not if string starts with a null (length is 0). + * F_incomplete_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_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_string_to_number_unsigned_ + extern f_return_status fl_conversion_string_to_number_unsigned(const f_string string, f_number_unsigned *number, const f_string_range range); +#endif // _di_fl_conversion_string_to_number_unsigned_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _FL_conversion_h diff --git a/level_1/fl_conversion/data/build/defines b/level_1/fl_conversion/data/build/defines new file mode 100644 index 0000000..c665317 --- /dev/null +++ b/level_1/fl_conversion/data/build/defines @@ -0,0 +1,2 @@ +# fss-0000 + diff --git a/level_1/fl_conversion/data/build/dependencies b/level_1/fl_conversion/data/build/dependencies new file mode 100644 index 0000000..d3b519a --- /dev/null +++ b/level_1/fl_conversion/data/build/dependencies @@ -0,0 +1,8 @@ +# fss-0000 + +f_type +f_status +f_memory +f_string +f_utf +f_conversion diff --git a/level_1/fl_conversion/data/build/settings b/level_1/fl_conversion/data/build/settings new file mode 100644 index 0000000..36f5aa9 --- /dev/null +++ b/level_1/fl_conversion/data/build/settings @@ -0,0 +1,52 @@ +# fss-0001 + +project_name fl_conversion + +version_major 0 +version_minor 5 +version_micro 0 +version_target major + +environment + +process_pre +process_post + +modes individual +modes_default individual + +build_compiler gcc +build_language c +build_linker ar +build_libraries -lc +build_libraries-individual -lf_conversion -lf_utf -lf_memory +build_sources_library conversion.c +build_sources_program +build_sources_headers conversion.h +build_sources_script +build_sources_setting +build_script yes +build_shared yes +build_static yes + +path_headers level_1 +path_library_script script +path_library_shared shared +path_library_static static +path_program_script script +path_program_shared shared +path_program_static static + +search_exclusive yes +search_shared yes +search_static yes + +defines_all +defines_static +defines_shared + +flags_all -z now -g +flags_shared +flags_static +flags_library -fPIC +flags_program -fPIE diff --git a/level_1/fl_directory/c/directory.h b/level_1/fl_directory/c/directory.h index a596b6b..83a744e 100644 --- a/level_1/fl_directory/c/directory.h +++ b/level_1/fl_directory/c/directory.h @@ -30,11 +30,11 @@ #endif // __USE_XOPEN_EXTENDED // fll-0 includes +#include #include #include #include #include -#include #include #include #include diff --git a/level_1/fl_directory/data/build/dependencies b/level_1/fl_directory/data/build/dependencies index c1d179c..b9aa0b4 100644 --- a/level_1/fl_directory/data/build/dependencies +++ b/level_1/fl_directory/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_1/fl_fss/c/fss.c b/level_1/fl_fss/c/fss.c index a213be8..24bb264 100644 --- a/level_1/fl_fss/c/fss.c +++ b/level_1/fl_fss/c/fss.c @@ -5,46 +5,6 @@ extern "C" { #endif -#ifndef _di_fl_fss_identify_ - f_return_status fl_fss_identify(const f_string_static buffer, f_fss_header *header) { - #ifndef _di_level_1_parameter_checking_ - if (header == 0) return F_status_set_error(F_parameter); - if (buffer.used <= 0) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - return private_fl_fss_identify(buffer, header); - } -#endif // _di_fl_fss_identify_ - -#ifndef _di_fl_fss_identify_file_ - f_return_status fl_fss_identify_file(f_file *file, f_fss_header *header) { - #ifndef _di_level_1_parameter_checking_ - if (file == 0) return F_status_set_error(F_parameter); - if (header == 0) return F_status_set_error(F_parameter); - if (file->id == 0) return F_status_set_error(F_file_closed); - if (file->id < 0) return F_status_set_error(F_file); - #endif // _di_level_1_parameter_checking_ - - { - f_string_length seeked = 0; - if (F_status_is_error(f_file_seek(file->id, SEEK_SET, 0, &seeked))) { - return F_status_set_error(F_file_seek); - } - } - - f_status status = F_none; - f_string_dynamic buffer = f_string_dynamic_initialize; - - f_macro_string_dynamic_resize(status, buffer, f_fss_max_header_length + 1); - if (F_status_is_error(status)) return status; - - status = f_file_read_until(*file, &buffer, f_fss_max_header_length + 1); - if (F_status_is_error(status)) return status; - - return private_fl_fss_identify(buffer, header); - } -#endif // _di_fl_fss_identify_file_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_1/fl_fss/c/fss.h b/level_1/fl_fss/c/fss.h index 01d09ea..18a867c 100644 --- a/level_1/fl_fss/c/fss.h +++ b/level_1/fl_fss/c/fss.h @@ -13,13 +13,13 @@ #include // fll-0 includes -#include +#include #include -#include -#include +#include #include -#include #include +#include +#include // fll-1 includes #include @@ -29,53 +29,6 @@ extern "C" { #endif -/** - * Identify FSS type from a buffered string. - * - * @param buffer - * The string to process. - * @param header - * The header data to populate with results of this function. - * - * @return - * F_none on success - * FL_fss_header_not if no header is found. - * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified. - * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header. - * - * Errors from (with error bit): f_conversion_string_to_hexidecimal_unsigned(). - */ -#ifndef _di_fl_fss_identify_ - extern f_return_status fl_fss_identify(const f_string_static buffer, f_fss_header *header); -#endif // _di_fl_fss_identify_ - -/** - * Identify FSS type from a file. - * - * @param file - * The file information. - * @param header - * The header data to populate with results of this function. - * - * @return - * F_none on success. - * FL_fss_header_not if no header is found. - * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified. - * F_memory_reallocation (with error bit) on memory reallocation error. - * F_parameter (with error bit) if a parameter is invalid. - * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header. - * - * Errors from (with error bit): f_conversion_string_to_hexidecimal_unsigned(). - * Errors from (with error bit): f_file_read_until(). - * Errors from (with error bit): f_file_seek(). - * - * @see f_file_read_until() - * @see fl_fss_identify() - */ -#ifndef _di_fl_fss_identify_file_ - extern f_return_status fl_fss_identify_file(f_file *file, f_fss_header *header); -#endif // _di_fl_fss_identify_file_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index 70a4e09..3dab2ac 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -5,132 +5,6 @@ extern "C" { #endif -#if !defined(_di_fl_fss_identify_) || !defined(_di_fl_fss_identify_file_) - f_return_status private_fl_fss_identify(const f_string_static buffer, f_fss_header *header) { - register f_string_length i = 0; - - if (buffer.used < 10) { - // "# fss-0000" is always at least 10 characters. - return FL_fss_header_not; - } - - // If this correctly follows the FSS specification, then this should be all that needs to be done (as well as atoh for ascii to hex). - // All characters used in the identifier are only in the ascii equivalents of the characters, any similarly looking character or number representing in UTF-8 is considered invalid. - if (buffer.string[i] == f_fss_type_header_open) { - i++; - - if (buffer.string[i] == f_fss_type_header_part1) { - i++; - - if (buffer.string[i] == f_fss_type_header_part2) { - i++; - - if (buffer.string[i] == f_fss_type_header_part3) { - i++; - - if (buffer.string[i] == f_fss_type_header_part4) { - i++; - - if (buffer.string[i] == f_fss_type_header_part5) { - i++; - - if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { - i++; - - if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { - i++; - - if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { - i++; - - if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { - i++; - - f_string_range range = f_string_range_initialize; - - range.start = i - 4; - range.stop = i; - - // 1: A possibly valid header type was found, now convert it into its proper format and save the header type. - const f_status status = f_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range); - if (F_status_is_error(status)) return status; - - if (status == F_none) { - // 2: At this point, we can still know the proper format for the file and still have a invalid header, handle accordingly. - if (buffer.string[i] == f_fss_type_header_close) { - header->length = i + 1; - - return F_none; - } - else { - // if "# fss-0000" is there, regardless of whats next, we can guess this to be of fss-0000, even if its fss-00001 (this is a guess afterall). - header->length = i + 1; - - return F_status_set_warning(FL_fss_accepted_invalid); - } - } - } - } - } - } - } - } - } - } - } - // people can miss spaces, so lets accept in an attempt to interpret the file anyway, but return values at this point are to be flagged as invalid. - else if (buffer.string[i] == f_fss_type_header_part2) { - i++; - - if (buffer.string[i] == f_fss_type_header_part3) { - i++; - - if (buffer.string[i] == f_fss_type_header_part4) { - i++; - - if (buffer.string[i] == f_fss_type_header_part5) { - i++; - - if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { - i++; - - if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { - i++; - - if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { - i++; - - if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { - i++; - - f_string_range range = f_string_range_initialize; - - range.start = i - 4; - range.stop = i; - - const f_status status = f_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range); - if (F_status_is_error(status)) return status; - - header->length = i + 1; - - return F_status_set_warning(FL_fss_accepted_invalid); - } - } - } - } - } - } - } - } - } - - // @todo At some point add checksum and compressions checks here, but the above statements will have to be adjusted accordingly. - // 3: eventually this will be processing the checksum and 4: will be processing the compression. - - return FL_fss_header_not; - } -#endif // !defined(_di_fl_fss_identify_) || !defined(_di_fl_fss_identify_file_) - #if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) f_return_status private_fl_fss_basic_object_read(const bool is_basic, f_string_dynamic *buffer, f_string_range *range, f_fss_object *found) { f_status status = F_none; diff --git a/level_1/fl_fss/c/private-fss.h b/level_1/fl_fss/c/private-fss.h index 45bd919..bb9bfdc 100644 --- a/level_1/fl_fss/c/private-fss.h +++ b/level_1/fl_fss/c/private-fss.h @@ -16,31 +16,6 @@ extern "C" { #endif /** - * Private implementation of fl_fss_identify(). - * - * Intended to be shared to each of the different implementation variations. - * - * @param buffer - * The string to process. - * @param header - * The header data to populate with results of this function. - * - * @return - * F_none on success - * FL_fss_header_not if no header is found. - * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified. - * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header. - * - * Errors from (with error bit): f_conversion_string_to_hexidecimal_unsigned(). - * - * @see fl_fss_identify() - * @see fl_fss_identify_file() - */ -#if !defined(_di_fl_fss_identify_) || !defined(_di_fl_fss_identify_file_) - extern f_return_status private_fl_fss_identify(const f_string_static buffer, f_fss_header *header) f_gcc_attribute_visibility_internal; -#endif // !defined(_di_fl_fss_identify_) || !defined(_di_fl_fss_identify_file_) - -/** * Private implementation of fl_fss_basic_object_read(). * * Intended to be shared to each of the different implementation variations. diff --git a/level_1/fl_fss/data/build/dependencies b/level_1/fl_fss/data/build/dependencies index 30ef68e..9877054 100644 --- a/level_1/fl_fss/data/build/dependencies +++ b/level_1/fl_fss/data/build/dependencies @@ -1,8 +1,9 @@ +# fss-0000 + f_type f_status f_memory f_string f_utf -f_conversion f_file f_fss diff --git a/level_1/fl_fss/data/build/settings b/level_1/fl_fss/data/build/settings index 8e3ab21..8b2cc04 100644 --- a/level_1/fl_fss/data/build/settings +++ b/level_1/fl_fss/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lf_fss -lf_file -lf_conversion -lf_utf -lf_memory +build_libraries-individual -lf_fss -lf_file -lf_utf -lf_memory build_sources_library fss.c private-fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c build_sources_program build_sources_headers fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_macro.h fss_status.h diff --git a/level_1/fl_iki/c/iki.h b/level_1/fl_iki/c/iki.h index 6545c1a..470b93c 100644 --- a/level_1/fl_iki/c/iki.h +++ b/level_1/fl_iki/c/iki.h @@ -18,10 +18,10 @@ #include // fll-0 includes +#include #include #include #include -#include #include #include @@ -30,7 +30,7 @@ extern "C" { #endif /** - * Read all iki Vocabulary and Content in the given range of the given buffer. + * Read all IKI Vocabulary and Content in the given range of the given buffer. * * This does not verify if any vocabulary name is known. * This only finds complete vocabulary names and their respective content. diff --git a/level_1/fl_iki/data/build/dependencies b/level_1/fl_iki/data/build/dependencies index 7fa938f..3e78910 100644 --- a/level_1/fl_iki/data/build/dependencies +++ b/level_1/fl_iki/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_1/fl_iki/data/build/settings b/level_1/fl_iki/data/build/settings index f909138..ff67114 100644 --- a/level_1/fl_iki/data/build/settings +++ b/level_1/fl_iki/data/build/settings @@ -29,7 +29,7 @@ build_script yes build_shared yes build_static yes -path_headers level_0 +path_headers level_1 path_library_script script path_library_shared shared path_library_static static diff --git a/level_1/fl_print/c/print.h b/level_1/fl_print/c/print.h index a4e93c8..c3981b8 100644 --- a/level_1/fl_print/c/print.h +++ b/level_1/fl_print/c/print.h @@ -13,11 +13,12 @@ #define _FL_print_h // fll-0 includes -#include +#include #include +#include #include -#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_1/fl_print/data/build/dependencies b/level_1/fl_print/data/build/dependencies index bb1c052..756ff60 100644 --- a/level_1/fl_print/data/build/dependencies +++ b/level_1/fl_print/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_1/fl_status/c/status.h b/level_1/fl_status/c/status.h index 06cfde1..38f0dd7 100644 --- a/level_1/fl_status/c/status.h +++ b/level_1/fl_status/c/status.h @@ -11,9 +11,10 @@ #define _FL_status_h // fll-0 includes +#include #include +#include #include -#include #include #ifdef __cplusplus diff --git a/level_1/fl_status/data/build/dependencies b/level_1/fl_status/data/build/dependencies index 2e85624..deb9037 100644 --- a/level_1/fl_status/data/build/dependencies +++ b/level_1/fl_status/data/build/dependencies @@ -1,4 +1,7 @@ +# fss-0000 + f_type f_status +f_memory f_string f_utf diff --git a/level_1/fl_string/c/string.h b/level_1/fl_string/c/string.h index de125fb..c6d3bb8 100644 --- a/level_1/fl_string/c/string.h +++ b/level_1/fl_string/c/string.h @@ -24,10 +24,10 @@ #include // fll-0 includes +#include #include #include #include -#include #include #ifdef __cplusplus diff --git a/level_1/fl_string/data/build/dependencies b/level_1/fl_string/data/build/dependencies index 13b45c7..deb9037 100644 --- a/level_1/fl_string/data/build/dependencies +++ b/level_1/fl_string/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_1/fl_utf/c/utf.h b/level_1/fl_utf/c/utf.h index d5e8f3d..c22472f 100644 --- a/level_1/fl_utf/c/utf.h +++ b/level_1/fl_utf/c/utf.h @@ -24,10 +24,10 @@ #include // fll-0 includes +#include #include #include #include -#include #include #ifdef __cplusplus diff --git a/level_1/fl_utf/data/build/dependencies b/level_1/fl_utf/data/build/dependencies index 13b45c7..deb9037 100644 --- a/level_1/fl_utf/data/build/dependencies +++ b/level_1/fl_utf/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_1/fl_utf_file/c/utf_file.h b/level_1/fl_utf_file/c/utf_file.h index 9e47c69..3c6d6b0 100644 --- a/level_1/fl_utf_file/c/utf_file.h +++ b/level_1/fl_utf_file/c/utf_file.h @@ -14,9 +14,10 @@ #include // fll-0 includes +#include #include +#include #include -#include #include #include diff --git a/level_1/fl_utf_file/data/build/dependencies b/level_1/fl_utf_file/data/build/dependencies index fed74d0..e4e94f3 100644 --- a/level_1/fl_utf_file/data/build/dependencies +++ b/level_1/fl_utf_file/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_2/fll_execute/c/execute.h b/level_2/fll_execute/c/execute.h index 4a006fd..dd97c37 100644 --- a/level_2/fll_execute/c/execute.h +++ b/level_2/fll_execute/c/execute.h @@ -18,10 +18,11 @@ #include // fll-0 includes +#include #include #include #include -#include +#include #include #include #include diff --git a/level_2/fll_execute/data/build/dependencies b/level_2/fll_execute/data/build/dependencies index fad9ef5..f2299d5 100644 --- a/level_2/fll_execute/data/build/dependencies +++ b/level_2/fll_execute/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory diff --git a/level_2/fll_execute/data/build/settings b/level_2/fll_execute/data/build/settings index d9b8057..70484c8 100644 --- a/level_2/fll_execute/data/build/settings +++ b/level_2/fll_execute/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfl_string -lf_path -lf_utf -lf_file -lf_environment -lf_memory +build_libraries-individual -lfl_string -lf_utf -lf_path -lf_file -lf_environment -lf_memory build_sources_library execute.c private-execute.c build_sources_program build_sources_headers execute.h diff --git a/level_2/fll_file/c/file.h b/level_2/fll_file/c/file.h index 5f7b664..54d5223 100644 --- a/level_2/fll_file/c/file.h +++ b/level_2/fll_file/c/file.h @@ -14,11 +14,10 @@ #include // fll-0 includes +#include #include #include #include -#include -#include // fll-1 includes #include diff --git a/level_2/fll_file/data/build/dependencies b/level_2/fll_file/data/build/dependencies index c73716f..0759aad 100644 --- a/level_2/fll_file/data/build/dependencies +++ b/level_2/fll_file/data/build/dependencies @@ -1,6 +1,7 @@ +# fss-0000 + f_type f_status f_memory f_string -f_utf fl_color diff --git a/level_2/fll_file/data/build/settings b/level_2/fll_file/data/build/settings index 2e41b0b..fa37f7d 100644 --- a/level_2/fll_file/data/build/settings +++ b/level_2/fll_file/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfl_color -lf_print -lf_file -lf_utf -lf_memory +build_libraries-individual -lfl_color -lf_print -lf_file -lf_memory build_sources_library file.c build_sources_program build_sources_headers file.h diff --git a/level_2/fll_fss/c/fss.c b/level_2/fll_fss/c/fss.c index 76d7c6f..029cafe 100644 --- a/level_2/fll_fss/c/fss.c +++ b/level_2/fll_fss/c/fss.c @@ -1,9 +1,50 @@ #include +#include "private-fss.h" #ifdef __cplusplus extern "C" { #endif +#ifndef _di_fll_fss_identify_ + f_return_status fll_fss_identify(const f_string_static buffer, f_fss_header *header) { + #ifndef _di_level_2_parameter_checking_ + if (header == 0) return F_status_set_error(F_parameter); + if (buffer.used <= 0) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ + + return private_fll_fss_identify(buffer, header); + } +#endif // _di_fll_fss_identify_ + +#ifndef _di_fll_fss_identify_file_ + f_return_status fll_fss_identify_file(f_file *file, f_fss_header *header) { + #ifndef _di_level_2_parameter_checking_ + if (file == 0) return F_status_set_error(F_parameter); + if (header == 0) return F_status_set_error(F_parameter); + if (file->id == 0) return F_status_set_error(F_file_closed); + if (file->id < 0) return F_status_set_error(F_file); + #endif // _di_level_2_parameter_checking_ + + { + f_string_length seeked = 0; + if (F_status_is_error(f_file_seek(file->id, SEEK_SET, 0, &seeked))) { + return F_status_set_error(F_file_seek); + } + } + + f_status status = F_none; + f_string_dynamic buffer = f_string_dynamic_initialize; + + f_macro_string_dynamic_resize(status, buffer, f_fss_max_header_length + 1); + if (F_status_is_error(status)) return status; + + status = f_file_read_until(*file, &buffer, f_fss_max_header_length + 1); + if (F_status_is_error(status)) return status; + + return private_fll_fss_identify(buffer, header); + } +#endif // _di_fll_fss_identify_file_ + #ifndef _di_fll_fss_snatch_ f_return_status fll_fss_snatch(const f_string_static buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], const f_string_length size, f_string_dynamic *values[]) { #ifndef _di_level_2_parameter_checking_ diff --git a/level_2/fll_fss/c/fss.h b/level_2/fll_fss/c/fss.h index c3299e1..6ee9ce9 100644 --- a/level_2/fll_fss/c/fss.h +++ b/level_2/fll_fss/c/fss.h @@ -13,14 +13,15 @@ #define _FLL_fss_h // fll-0 includes +#include #include -#include #include #include -#include #include +#include // fll-1 includes +#include #include #include #include @@ -31,6 +32,52 @@ extern "C" { #endif /** + * Identify FSS type from a buffered string. + * + * @param buffer + * The string to process. + * @param header + * The header data to populate with results of this function. + * + * @return + * F_none on success + * FL_fss_header_not if no header is found. + * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified. + * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header. + * + * Errors from (with error bit): fl_conversion_string_to_hexidecimal_unsigned(). + */ +#ifndef _di_fll_fss_identify_ + extern f_return_status fll_fss_identify(const f_string_static buffer, f_fss_header *header); +#endif // _di_fll_fss_identify_ + +/** + * Identify FSS type from a file. + * + * @param file + * The file information. + * @param header + * The header data to populate with results of this function. + * + * @return + * F_none on success. + * FL_fss_header_not if no header is found. + * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified. + * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header. + * + * Errors from (with error bit): fl_conversion_string_to_hexidecimal_unsigned(). + * Errors from (with error bit): f_file_read_until(). + * Errors from (with error bit): f_file_seek(). + * + * @see f_file_read_until() + */ +#ifndef _di_fll_fss_identify_file_ + extern f_return_status fll_fss_identify_file(f_file *file, f_fss_header *header); +#endif // _di_fll_fss_identify_file_ + +/** * Perform simple search through all objects against the given set, saving all values when matched. * * Only the first match for each distinct object is snatched. diff --git a/level_2/fll_fss/c/private-fss.c b/level_2/fll_fss/c/private-fss.c new file mode 100644 index 0000000..88185af --- /dev/null +++ b/level_2/fll_fss/c/private-fss.c @@ -0,0 +1,138 @@ +#include +#include "private-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_di_fll_fss_identify_) || !defined(_di_fll_fss_identify_file_) + f_return_status private_fll_fss_identify(const f_string_static buffer, f_fss_header *header) { + register f_string_length i = 0; + + if (buffer.used < 10) { + // "# fss-0000" is always at least 10 characters. + return FL_fss_header_not; + } + + // If this correctly follows the FSS specification, then this should be all that needs to be done (as well as atoh for ascii to hex). + // All characters used in the identifier are only in the ascii equivalents of the characters, any similarly looking character or number representing in UTF-8 is considered invalid. + if (buffer.string[i] == f_fss_type_header_open) { + i++; + + if (buffer.string[i] == f_fss_type_header_part1) { + i++; + + if (buffer.string[i] == f_fss_type_header_part2) { + i++; + + if (buffer.string[i] == f_fss_type_header_part3) { + i++; + + if (buffer.string[i] == f_fss_type_header_part4) { + i++; + + if (buffer.string[i] == f_fss_type_header_part5) { + i++; + + if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { + i++; + + if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { + i++; + + if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { + i++; + + if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { + i++; + + f_string_range range = f_string_range_initialize; + + range.start = i - 4; + range.stop = i; + + // 1: A possibly valid header type was found, now convert it into its proper format and save the header type. + const f_status status = fl_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range); + if (F_status_is_error(status)) return status; + + if (status == F_none) { + // 2: At this point, we can still know the proper format for the file and still have a invalid header, handle accordingly. + if (buffer.string[i] == f_fss_type_header_close) { + header->length = i + 1; + + return F_none; + } + else { + // @todo this needs to be changed to support sub-headers (maybe something like FL_fss_accepted_additional). + // if "# fss-0000" is there, regardless of whats next, we can guess this to be of fss-0000, even if its fss-00001 (this is a guess afterall). + header->length = i + 1; + + return F_status_set_warning(FL_fss_accepted_invalid); + } + } + } + } + } + } + } + } + } + } + } + // people can miss spaces, so lets accept in an attempt to interpret the file anyway, but return values at this point are to be flagged as invalid. + else if (buffer.string[i] == f_fss_type_header_part2) { + i++; + + if (buffer.string[i] == f_fss_type_header_part3) { + i++; + + if (buffer.string[i] == f_fss_type_header_part4) { + i++; + + if (buffer.string[i] == f_fss_type_header_part5) { + i++; + + if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { + i++; + + if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { + i++; + + if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { + i++; + + if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { + // @todo this needs to be changed to support sub-headers (maybe something like FL_fss_accepted_additional). + i++; + + f_string_range range = f_string_range_initialize; + + range.start = i - 4; + range.stop = i; + + const f_status status = fl_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range); + if (F_status_is_error(status)) return status; + + header->length = i + 1; + + return F_status_set_warning(FL_fss_accepted_invalid); + } + } + } + } + } + } + } + } + } + + // @todo At some point add checksum and compressions checks here, but the above statements will have to be adjusted accordingly. + // 3: eventually this will be processing the checksum and 4: will be processing the compression. + + return FL_fss_header_not; + } +#endif // !defined(_di_fll_fss_identify_) || !defined(_di_fll_fss_identify_file_) + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_2/fll_fss/c/private-fss.h b/level_2/fll_fss/c/private-fss.h new file mode 100644 index 0000000..ff09249 --- /dev/null +++ b/level_2/fll_fss/c/private-fss.h @@ -0,0 +1,47 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgplv2.1 + * + * These are provided for internal reduction in redundant code. + * These should not be exposed/used outside of this project. + */ +#ifndef _PRIVATE_FLL_fss_h +#define _PRIVATE_FLL_fss_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation of fll_fss_identify(). + * + * Intended to be shared to each of the different implementation variations. + * + * @param buffer + * The string to process. + * @param header + * The header data to populate with results of this function. + * + * @return + * F_none on success + * FL_fss_header_not if no header is found. + * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified. + * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header. + * + * Errors from (with error bit): fl_conversion_string_to_hexidecimal_unsigned(). + * + * @see fll_fss_identify() + * @see fll_fss_identify_file() + */ +#if !defined(_di_fll_fss_identify_) || !defined(_di_fll_fss_identify_file_) + extern f_return_status private_fll_fss_identify(const f_string_static buffer, f_fss_header *header) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_fll_fss_identify_) || !defined(_di_fll_fss_identify_file_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_FLL_fss_h diff --git a/level_2/fll_fss/data/build/dependencies b/level_2/fll_fss/data/build/dependencies index f8f5567..d36fb05 100644 --- a/level_2/fll_fss/data/build/dependencies +++ b/level_2/fll_fss/data/build/dependencies @@ -1,10 +1,13 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_conversion f_fss -f_utf +fl_conversion fl_fss fl_status fl_string diff --git a/level_2/fll_fss/data/build/settings b/level_2/fll_fss/data/build/settings index a8cfaf5..a8a4ebf 100644 --- a/level_2/fll_fss/data/build/settings +++ b/level_2/fll_fss/data/build/settings @@ -19,8 +19,8 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfl_string -lfl_status -lfl_fss -lf_file -lf_fss -lf_conversion -lf_utf -lf_memory -build_sources_library fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c fss_status.c +build_libraries-individual -lfl_string -lfl_status -lfl_fss -lf_file -lfl_conversion -lf_fss -lf_conversion -lf_utf -lf_memory +build_sources_library fss.c private-fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c fss_status.c build_sources_program build_sources_headers fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_status.h build_sources_script diff --git a/level_2/fll_program/c/program.h b/level_2/fll_program/c/program.h index 876b31d..226f129 100644 --- a/level_2/fll_program/c/program.h +++ b/level_2/fll_program/c/program.h @@ -14,10 +14,12 @@ #include // fll-0 includes -#include +#include #include +#include #include -#include +#include +#include // fll-1 includes #include diff --git a/level_2/fll_program/data/build/dependencies b/level_2/fll_program/data/build/dependencies index 7a2bf68..6518702 100644 --- a/level_2/fll_program/data/build/dependencies +++ b/level_2/fll_program/data/build/dependencies @@ -1,7 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_console fl_color fl_string diff --git a/level_2/fll_status/c/status.h b/level_2/fll_status/c/status.h index a729eb7..f379574 100644 --- a/level_2/fll_status/c/status.h +++ b/level_2/fll_status/c/status.h @@ -11,11 +11,12 @@ #define _FLL_status_h // fll-0 includes -#include +#include #include +#include #include -#include #include +#include // fll-1 includes #include diff --git a/level_2/fll_status/data/build/dependencies b/level_2/fll_status/data/build/dependencies index 1e5b4b2..2910b21 100644 --- a/level_2/fll_status/data/build/dependencies +++ b/level_2/fll_status/data/build/dependencies @@ -1,8 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string -f_conversion f_utf +f_conversion fl_status fl_string diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index 36f6525..0ef751e 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -170,9 +170,12 @@ extern "C" { return F_status_set_error(status); } else if (data->parameters[byte_dump_parameter_width].result == f_console_result_additional) { + const f_string_length index = data->parameters[byte_dump_parameter_width].additional.array[data->parameters[byte_dump_parameter_width].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); + f_number_unsigned number = 0; - status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[byte_dump_parameter_width].additional.array[data->parameters[byte_dump_parameter_width].additional.used - 1]], &number); + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); if (F_status_is_error(status) || number < 1 || number >= 0xfb) { fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: The parameter '"); fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, byte_dump_long_width); @@ -198,9 +201,12 @@ extern "C" { return F_status_set_error(status); } else if (data->parameters[byte_dump_parameter_first].result == f_console_result_additional) { + const f_string_length index = data->parameters[byte_dump_parameter_first].additional.array[data->parameters[byte_dump_parameter_first].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); + f_number_unsigned number = 0; - status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[byte_dump_parameter_first].additional.array[data->parameters[byte_dump_parameter_first].additional.used - 1]], &number); + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); if (F_status_is_error(status) || number > f_type_number_size_unsigned) { fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: The parameter '"); fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, byte_dump_long_first); @@ -226,9 +232,12 @@ extern "C" { return F_status_set_error(status); } else if (data->parameters[byte_dump_parameter_last].result == f_console_result_additional) { + const f_string_length index = data->parameters[byte_dump_parameter_last].additional.array[data->parameters[byte_dump_parameter_last].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); + f_number_unsigned number = 0; - status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[byte_dump_parameter_last].additional.array[data->parameters[byte_dump_parameter_last].additional.used - 1]], &number); + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); if (F_status_is_error(status) || number < 0 || number > f_type_number_size_unsigned) { fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: The parameter '"); fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, byte_dump_long_last); diff --git a/level_3/byte_dump/c/byte_dump.h b/level_3/byte_dump/c/byte_dump.h index 9868836..b294b66 100644 --- a/level_3/byte_dump/c/byte_dump.h +++ b/level_3/byte_dump/c/byte_dump.h @@ -21,19 +21,21 @@ #include // fll-0 includes +#include +#include +#include +#include +#include #include #include #include #include #include -#include -#include -#include -#include // fll-1 includes #include #include +#include #include #include diff --git a/level_3/byte_dump/data/build/dependencies b/level_3/byte_dump/data/build/dependencies index 62f64d0..1144d6a 100644 --- a/level_3/byte_dump/data/build/dependencies +++ b/level_3/byte_dump/data/build/dependencies @@ -1,16 +1,19 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_conversion f_file f_pipe f_print -f_utf fl_color fl_console +fl_conversion fl_string fl_utf fll_program diff --git a/level_3/byte_dump/data/build/settings b/level_3/byte_dump/data/build/settings index f0f53be..963be4c 100644 --- a/level_3/byte_dump/data/build/settings +++ b/level_3/byte_dump/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfl_utf -lfl_string -lfl_console -lfl_color -lf_print -lf_pipe -lf_file -lf_conversion -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfl_utf -lfl_string -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_file -lf_conversion -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library byte_dump.c private-byte_dump.c diff --git a/level_3/fake/c/fake.h b/level_3/fake/c/fake.h index 20390aa..3ee8192 100644 --- a/level_3/fake/c/fake.h +++ b/level_3/fake/c/fake.h @@ -49,9 +49,11 @@ #include // fll-0 includes +#include #include +#include #include -#include +#include #include #include #include diff --git a/level_3/fake/data/build/dependencies b/level_3/fake/data/build/dependencies index a473180..e114de7 100644 --- a/level_3/fake/data/build/dependencies +++ b/level_3/fake/data/build/dependencies @@ -17,6 +17,7 @@ f_path f_print fl_color fl_console +fl_conversion fl_directory fl_fss fl_iki diff --git a/level_3/fake/data/build/settings b/level_3/fake/data/build/settings index 9b06103..ba781b9 100644 --- a/level_3/fake/data/build/settings +++ b/level_3/fake/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfll_execute -lfll_fss -lfl_utf -lfl_string -lfl_status -lfl_iki -lfl_fss -lfl_directory -lfl_console -lfl_color -lf_print -lf_path -lf_iki -lf_file -lf_fss -lf_environment -lf_directory -lf_conversion -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfll_execute -lfll_fss -lfl_utf -lfl_string -lfl_status -lfl_iki -lfl_fss -lfl_directory -lfl_conversion -lfl_console -lfl_color -lf_print -lf_path -lf_iki -lf_file -lf_fss -lf_environment -lf_directory -lf_conversion -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library fake.c private-fake.c private-clean.c private-build.c private-make.c private-print.c private-skeleton.c diff --git a/level_3/firewall/c/firewall.h b/level_3/firewall/c/firewall.h index d3887ff..9043839 100644 --- a/level_3/firewall/c/firewall.h +++ b/level_3/firewall/c/firewall.h @@ -17,14 +17,17 @@ #include // fll-0 includes +#include +#include +#include +#include +#include +#include #include #include #include #include #include -#include -#include -#include // fll-1 includes #include diff --git a/level_3/firewall/data/build/dependencies b/level_3/firewall/data/build/dependencies index c5ab0b2..a44bb21 100644 --- a/level_3/firewall/data/build/dependencies +++ b/level_3/firewall/data/build/dependencies @@ -1,7 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_directory @@ -11,9 +14,9 @@ f_fss f_path f_pipe f_print -f_utf fl_color fl_console +fl_conversion fl_fss fl_status fl_string diff --git a/level_3/firewall/data/build/settings b/level_3/firewall/data/build/settings index 4fe7316..5c50459 100644 --- a/level_3/firewall/data/build/settings +++ b/level_3/firewall/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_path -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_path -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library firewall.c private-firewall.c diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.h b/level_3/fss_basic_list_read/c/fss_basic_list_read.h index 9d3c725..94cd9f4 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.h +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.h @@ -21,7 +21,10 @@ // fll-0 includes #include +#include +#include #include +#include #include #include #include @@ -31,6 +34,7 @@ // fll-1 includes #include #include +#include #include #include diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c index 358d329..6148817 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c @@ -120,10 +120,11 @@ extern "C" { else { position_depth = data.parameters[fss_basic_list_read_parameter_depth].additional.array[i]; - status = fl_console_parameter_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth); + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[position_depth])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range); if (F_status_is_error(status)) { - fss_basic_list_read_print_number_argument_error(data.context, "fl_console_parameter_to_number_unsigned", fss_basic_list_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status)); + fss_basic_list_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_basic_list_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status)); return status; } } @@ -140,10 +141,11 @@ extern "C" { depths->array[i].index_at = data.parameters[fss_basic_list_read_parameter_at].additional.array[position_at]; - status = fl_console_parameter_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at); + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[depths->array[i].index_at])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range); if (F_status_is_error(status)) { - fss_basic_list_read_print_number_argument_error(data.context, "fl_console_parameter_to_number_unsigned", fss_basic_list_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status)); + fss_basic_list_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_basic_list_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status)); return status; } } // for @@ -297,10 +299,12 @@ extern "C" { f_string_length select = 0; if (data->parameters[fss_basic_list_read_parameter_select].result == f_console_result_additional) { - status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[fss_basic_list_read_parameter_select].additional.array[data->parameters[fss_basic_list_read_parameter_select].additional.used - 1]], &select); + const f_string_length index = data->parameters[fss_basic_list_read_parameter_select].additional.array[data->parameters[fss_basic_list_read_parameter_select].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range); if (F_status_is_error(status)) { - fss_basic_list_read_print_number_argument_error(data->context, "fl_console_parameter_to_number_unsigned", fss_basic_list_read_long_select, arguments.argv[data->parameters[fss_basic_list_read_parameter_select].additional.array[0]], F_status_set_fine(status)); + fss_basic_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_list_read_long_select, arguments.argv[index], F_status_set_fine(status)); return status; } @@ -313,10 +317,12 @@ extern "C" { f_string_length line = 0; if (data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { - status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[fss_basic_list_read_parameter_line].additional.array[data->parameters[fss_basic_list_read_parameter_line].additional.used - 1]], &line); + const f_string_length index = data->parameters[fss_basic_list_read_parameter_line].additional.array[data->parameters[fss_basic_list_read_parameter_line].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &line, range); if (F_status_is_error(status)) { - fss_basic_list_read_print_number_argument_error(data->context, "fl_console_parameter_to_number_unsigned", fss_basic_list_read_long_line, arguments.argv[data->parameters[fss_basic_list_read_parameter_line].additional.array[0]], F_status_set_fine(status)); + fss_basic_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_list_read_long_line, arguments.argv[index], F_status_set_fine(status)); return status; } } diff --git a/level_3/fss_basic_list_read/data/build/dependencies b/level_3/fss_basic_list_read/data/build/dependencies index 86c144e..c6ca3bc 100644 --- a/level_3/fss_basic_list_read/data/build/dependencies +++ b/level_3/fss_basic_list_read/data/build/dependencies @@ -1,7 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_directory @@ -12,6 +15,7 @@ f_pipe f_print fl_color fl_console +fl_conversion fl_fss fl_print fl_status diff --git a/level_3/fss_basic_list_read/data/build/settings b/level_3/fss_basic_list_read/data/build/settings index 18b8913..7647953 100644 --- a/level_3/fss_basic_list_read/data/build/settings +++ b/level_3/fss_basic_list_read/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library fss_basic_list_read.c private-fss_basic_list_read.c diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.h b/level_3/fss_basic_list_write/c/fss_basic_list_write.h index e86cb70..aad3bfe 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.h +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.h @@ -15,12 +15,15 @@ #include // fll-0 includes +#include +#include +#include +#include +#include #include #include #include #include -#include -#include // fll-1 includes #include diff --git a/level_3/fss_basic_list_write/data/build/dependencies b/level_3/fss_basic_list_write/data/build/dependencies index e4297e7..f7149ed 100644 --- a/level_3/fss_basic_list_write/data/build/dependencies +++ b/level_3/fss_basic_list_write/data/build/dependencies @@ -1,7 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_directory @@ -12,6 +15,7 @@ f_pipe f_print fl_color fl_console +fl_conversion fl_fss fl_status fl_string diff --git a/level_3/fss_basic_list_write/data/build/settings b/level_3/fss_basic_list_write/data/build/settings index d1a5406..3395a5e 100644 --- a/level_3/fss_basic_list_write/data/build/settings +++ b/level_3/fss_basic_list_write/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library fss_basic_list_write.c diff --git a/level_3/fss_basic_read/c/fss_basic_read.h b/level_3/fss_basic_read/c/fss_basic_read.h index 3da47c5..01a52ff 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.h +++ b/level_3/fss_basic_read/c/fss_basic_read.h @@ -21,7 +21,10 @@ // fll-0 includes #include +#include +#include #include +#include #include #include #include @@ -31,6 +34,7 @@ // fll-1 includes #include #include +#include #include #include diff --git a/level_3/fss_basic_read/c/private-fss_basic_read.c b/level_3/fss_basic_read/c/private-fss_basic_read.c index 60c6312..88d1707 100644 --- a/level_3/fss_basic_read/c/private-fss_basic_read.c +++ b/level_3/fss_basic_read/c/private-fss_basic_read.c @@ -120,10 +120,11 @@ extern "C" { else { position_depth = data.parameters[fss_basic_read_parameter_depth].additional.array[i]; - status = fl_console_parameter_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth); + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[position_depth])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range); if (F_status_is_error(status)) { - fss_basic_read_print_number_argument_error(data.context, "fl_console_parameter_to_number_unsigned", fss_basic_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status)); + fss_basic_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status)); return status; } } @@ -140,10 +141,11 @@ extern "C" { depths->array[i].index_at = data.parameters[fss_basic_read_parameter_at].additional.array[position_at]; - status = fl_console_parameter_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at); + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[depths->array[i].index_at])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range); if (F_status_is_error(status)) { - fss_basic_read_print_number_argument_error(data.context, "fl_console_parameter_to_number_unsigned", fss_basic_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status)); + fss_basic_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status)); return status; } } // for @@ -297,10 +299,12 @@ extern "C" { f_string_length select = 0; if (data->parameters[fss_basic_read_parameter_select].result == f_console_result_additional) { - status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[fss_basic_read_parameter_select].additional.array[data->parameters[fss_basic_read_parameter_select].additional.used - 1]], &select); + const f_string_length index = data->parameters[fss_basic_read_parameter_select].additional.array[data->parameters[fss_basic_read_parameter_select].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range); if (F_status_is_error(status)) { - fss_basic_read_print_number_argument_error(data->context, "fl_console_parameter_to_number_unsigned", fss_basic_read_long_select, arguments.argv[data->parameters[fss_basic_read_parameter_select].additional.array[0]], F_status_set_fine(status)); + fss_basic_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_select, arguments.argv[index], F_status_set_fine(status)); return status; } @@ -313,10 +317,12 @@ extern "C" { f_string_length line = 0; if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { - status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[fss_basic_read_parameter_line].additional.array[data->parameters[fss_basic_read_parameter_line].additional.used - 1]], &line); + const f_string_length index = data->parameters[fss_basic_read_parameter_line].additional.array[data->parameters[fss_basic_read_parameter_line].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &line, range); if (F_status_is_error(status)) { - fss_basic_read_print_number_argument_error(data->context, "fl_console_parameter_to_number_unsigned", fss_basic_read_long_line, arguments.argv[data->parameters[fss_basic_read_parameter_line].additional.array[0]], F_status_set_fine(status)); + fss_basic_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_line, arguments.argv[index], F_status_set_fine(status)); return status; } } diff --git a/level_3/fss_basic_read/data/build/dependencies b/level_3/fss_basic_read/data/build/dependencies index 86c144e..c6ca3bc 100644 --- a/level_3/fss_basic_read/data/build/dependencies +++ b/level_3/fss_basic_read/data/build/dependencies @@ -1,7 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_directory @@ -12,6 +15,7 @@ f_pipe f_print fl_color fl_console +fl_conversion fl_fss fl_print fl_status diff --git a/level_3/fss_basic_read/data/build/settings b/level_3/fss_basic_read/data/build/settings index 19061df..8ff4dc8 100644 --- a/level_3/fss_basic_read/data/build/settings +++ b/level_3/fss_basic_read/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library fss_basic_read.c private-fss_basic_read.c diff --git a/level_3/fss_basic_write/c/fss_basic_write.h b/level_3/fss_basic_write/c/fss_basic_write.h index a929e11..85dbcc0 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.h +++ b/level_3/fss_basic_write/c/fss_basic_write.h @@ -15,12 +15,15 @@ #include // fll-0 includes +#include +#include +#include +#include +#include #include #include #include #include -#include -#include // fll-1 includes #include diff --git a/level_3/fss_basic_write/data/build/dependencies b/level_3/fss_basic_write/data/build/dependencies index e4297e7..f7149ed 100644 --- a/level_3/fss_basic_write/data/build/dependencies +++ b/level_3/fss_basic_write/data/build/dependencies @@ -1,7 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_directory @@ -12,6 +15,7 @@ f_pipe f_print fl_color fl_console +fl_conversion fl_fss fl_status fl_string diff --git a/level_3/fss_basic_write/data/build/settings b/level_3/fss_basic_write/data/build/settings index b64b0fa..4f7aab3 100644 --- a/level_3/fss_basic_write/data/build/settings +++ b/level_3/fss_basic_write/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library fss_basic_write.c diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.h b/level_3/fss_extended_list_read/c/fss_extended_list_read.h index ab5db84..ced955e 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.h +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.h @@ -21,7 +21,10 @@ // fll-0 includes #include +#include +#include #include +#include #include #include #include @@ -31,6 +34,7 @@ // fll-1 includes #include #include +#include #include #include diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c index 08bdcab..80f091b 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c @@ -120,10 +120,11 @@ extern "C" { else { position_depth = data.parameters[fss_extended_list_read_parameter_depth].additional.array[i]; - status = fl_console_parameter_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth); + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[position_depth])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range); if (F_status_is_error(status)) { - fss_extended_list_read_print_number_argument_error(data.context, "fl_console_parameter_to_number_unsigned", fss_extended_list_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status)); + fss_extended_list_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status)); return status; } } @@ -140,10 +141,11 @@ extern "C" { depths->array[i].index_at = data.parameters[fss_extended_list_read_parameter_at].additional.array[position_at]; - status = fl_console_parameter_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at); + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[depths->array[i].index_at])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range); if (F_status_is_error(status)) { - fss_extended_list_read_print_number_argument_error(data.context, "fl_console_parameter_to_number_unsigned", fss_extended_list_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status)); + fss_extended_list_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status)); return status; } } // for @@ -307,10 +309,12 @@ extern "C" { f_string_length select = 0; if (data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_additional) { - status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[fss_extended_list_read_parameter_select].additional.array[data->parameters[fss_extended_list_read_parameter_select].additional.used - 1]], &select); + const f_string_length index = data->parameters[fss_extended_list_read_parameter_select].additional.array[data->parameters[fss_extended_list_read_parameter_select].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range); if (F_status_is_error(status)) { - fss_extended_list_read_print_number_argument_error(data->context, "fl_console_parameter_to_number_unsigned", fss_extended_list_read_long_select, arguments.argv[data->parameters[fss_extended_list_read_parameter_select].additional.array[0]], F_status_set_fine(status)); + fss_extended_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_select, arguments.argv[index], F_status_set_fine(status)); return status; } @@ -324,10 +328,14 @@ extern "C" { f_string_length line = 0; if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { - status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[fss_extended_list_read_parameter_line].additional.array[data->parameters[fss_extended_list_read_parameter_line].additional.used - 1]], &line); + const f_string_length index = data->parameters[fss_extended_list_read_parameter_line].additional.array[data->parameters[fss_extended_list_read_parameter_line].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); + f_number_unsigned number = 0; + + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); if (F_status_is_error(status)) { - fss_extended_list_read_print_number_argument_error(data->context, "fl_console_parameter_to_number_unsigned", fss_extended_list_read_long_line, arguments.argv[data->parameters[fss_extended_list_read_parameter_line].additional.array[0]], F_status_set_fine(status)); + fss_extended_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_line, arguments.argv[index], F_status_set_fine(status)); return status; } } diff --git a/level_3/fss_extended_list_read/data/build/dependencies b/level_3/fss_extended_list_read/data/build/dependencies index 86c144e..c6ca3bc 100644 --- a/level_3/fss_extended_list_read/data/build/dependencies +++ b/level_3/fss_extended_list_read/data/build/dependencies @@ -1,7 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_directory @@ -12,6 +15,7 @@ f_pipe f_print fl_color fl_console +fl_conversion fl_fss fl_print fl_status diff --git a/level_3/fss_extended_list_read/data/build/settings b/level_3/fss_extended_list_read/data/build/settings index a6a1003..a2ceb63 100644 --- a/level_3/fss_extended_list_read/data/build/settings +++ b/level_3/fss_extended_list_read/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library fss_extended_list_read.c private-fss_extended_list_read.c diff --git a/level_3/fss_extended_read/c/fss_extended_read.h b/level_3/fss_extended_read/c/fss_extended_read.h index 980211f..15a99d3 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.h +++ b/level_3/fss_extended_read/c/fss_extended_read.h @@ -21,7 +21,10 @@ // fll-0 includes #include +#include +#include #include +#include #include #include #include @@ -31,6 +34,7 @@ // fll-1 includes #include #include +#include #include #include diff --git a/level_3/fss_extended_read/c/private-fss_extended_read.c b/level_3/fss_extended_read/c/private-fss_extended_read.c index acb0a1f..2b73c1e 100644 --- a/level_3/fss_extended_read/c/private-fss_extended_read.c +++ b/level_3/fss_extended_read/c/private-fss_extended_read.c @@ -120,10 +120,11 @@ extern "C" { else { position_depth = data.parameters[fss_extended_read_parameter_depth].additional.array[i]; - status = fl_console_parameter_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth); + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[position_depth])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range); if (F_status_is_error(status)) { - fss_extended_read_print_number_argument_error(data.context, "fl_console_parameter_to_number_unsigned", fss_extended_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status)); + fss_extended_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status)); return status; } } @@ -140,10 +141,11 @@ extern "C" { depths->array[i].index_at = data.parameters[fss_extended_read_parameter_at].additional.array[position_at]; - status = fl_console_parameter_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at); + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[depths->array[i].index_at])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range); if (F_status_is_error(status)) { - fss_extended_read_print_number_argument_error(data.context, "fl_console_parameter_to_number_unsigned", fss_extended_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status)); + fss_extended_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status)); return status; } } // for @@ -297,10 +299,12 @@ extern "C" { f_string_length select = 0; if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { - status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[fss_extended_read_parameter_select].additional.array[data->parameters[fss_extended_read_parameter_select].additional.used - 1]], &select); + const f_string_length index = data->parameters[fss_extended_read_parameter_select].additional.array[data->parameters[fss_extended_read_parameter_select].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range); if (F_status_is_error(status)) { - fss_extended_read_print_number_argument_error(data->context, "fl_console_parameter_to_number_unsigned", fss_extended_read_long_select, arguments.argv[data->parameters[fss_extended_read_parameter_select].additional.array[0]], F_status_set_fine(status)); + fss_extended_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_select, arguments.argv[index], F_status_set_fine(status)); return status; } } @@ -308,10 +312,12 @@ extern "C" { f_string_length line = 0; if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { - status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[fss_extended_read_parameter_line].additional.array[data->parameters[fss_extended_read_parameter_line].additional.used - 1]], &line); + const f_string_length index = data->parameters[fss_extended_read_parameter_line].additional.array[data->parameters[fss_extended_read_parameter_line].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &line, range); if (F_status_is_error(status)) { - fss_extended_read_print_number_argument_error(data->context, "fl_console_parameter_to_number_unsigned", fss_extended_read_long_line, arguments.argv[data->parameters[fss_extended_read_parameter_line].additional.array[0]], F_status_set_fine(status)); + fss_extended_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_line, arguments.argv[index], F_status_set_fine(status)); return status; } } diff --git a/level_3/fss_extended_read/data/build/dependencies b/level_3/fss_extended_read/data/build/dependencies index 86c144e..24804a4 100644 --- a/level_3/fss_extended_read/data/build/dependencies +++ b/level_3/fss_extended_read/data/build/dependencies @@ -1,7 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_directory @@ -11,6 +14,7 @@ f_fss f_pipe f_print fl_color +fl_conversion fl_console fl_fss fl_print diff --git a/level_3/fss_extended_read/data/build/settings b/level_3/fss_extended_read/data/build/settings index 0139814..d186cba 100644 --- a/level_3/fss_extended_read/data/build/settings +++ b/level_3/fss_extended_read/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lfl_conversion -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library fss_extended_read.c private-fss_extended_read.c diff --git a/level_3/fss_extended_write/c/fss_extended_write.h b/level_3/fss_extended_write/c/fss_extended_write.h index d470f5c..478b937 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.h +++ b/level_3/fss_extended_write/c/fss_extended_write.h @@ -15,12 +15,15 @@ #include // fll-0 includes +#include +#include +#include +#include +#include #include #include #include #include -#include -#include // fll-1 includes #include diff --git a/level_3/fss_extended_write/data/build/dependencies b/level_3/fss_extended_write/data/build/dependencies index 260ee14..5c4b55f 100644 --- a/level_3/fss_extended_write/data/build/dependencies +++ b/level_3/fss_extended_write/data/build/dependencies @@ -1,7 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_directory @@ -11,6 +14,7 @@ f_fss f_pipe f_print fl_color +fl_conversion fl_fss fl_status fl_string diff --git a/level_3/fss_extended_write/data/build/settings b/level_3/fss_extended_write/data/build/settings index c30b05f..eeabed2 100644 --- a/level_3/fss_extended_write/data/build/settings +++ b/level_3/fss_extended_write/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_conversion -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library fss_extended_write.c diff --git a/level_3/fss_status_code/c/fss_status_code.h b/level_3/fss_status_code/c/fss_status_code.h index 73b767f..c31c0e2 100644 --- a/level_3/fss_status_code/c/fss_status_code.h +++ b/level_3/fss_status_code/c/fss_status_code.h @@ -15,17 +15,20 @@ #include // fll-0 includes +#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include // fll-1 includes #include #include +#include #include #include 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 18745b7..98ba214 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 @@ -48,9 +48,11 @@ extern "C" { f_status status = F_none; { + const f_string_range range = f_macro_string_range_initialize(strlen(value)); + f_number_unsigned number = 0; - status = fl_console_parameter_to_number_unsigned(value, &number); + status = fl_conversion_string_to_number_unsigned(value, &number, range); if (status == F_none) { fl_color_print_line(f_type_output, data.context.error, data.context.reset, "invalid name"); @@ -131,7 +133,9 @@ extern "C" { #ifndef _di_fss_status_code_convert_number_ f_return_status fss_status_code_convert_number(const fss_status_code_data data, const f_string value, f_number_unsigned *number) { - f_status status = fl_console_parameter_to_number_unsigned(value, number); + const f_string_range range = f_macro_string_range_initialize(strlen(value)); + + f_status status = fl_conversion_string_to_number_unsigned(value, number, range); if (*number > F_status_size_max_with_signal) { fl_color_print_line(f_type_output, data.context.error, data.context.reset, "out of range"); diff --git a/level_3/fss_status_code/data/build/dependencies b/level_3/fss_status_code/data/build/dependencies index c181f38..528ffcd 100644 --- a/level_3/fss_status_code/data/build/dependencies +++ b/level_3/fss_status_code/data/build/dependencies @@ -1,7 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_conversion @@ -11,9 +14,9 @@ f_file f_fss f_pipe f_print -f_utf fl_color fl_console +fl_conversion fl_fss fl_status fl_string diff --git a/level_3/fss_status_code/data/build/settings b/level_3/fss_status_code/data/build/settings index ee1b6f4..0b30493 100644 --- a/level_3/fss_status_code/data/build/settings +++ b/level_3/fss_status_code/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_status -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_utf -lfl_string -lfl_status -lfl_fss -lfl_console -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_conversion -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_status -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_utf -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_conversion -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library fss_status_code.c private-fss_status_code.c diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index 32c6ba9..9ff64e0 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -161,17 +161,22 @@ extern "C" { } else if (data->parameters[iki_read_parameter_line].result == f_console_result_additional) { const f_string_length index = data->parameters[iki_read_parameter_line].additional.array[data->parameters[iki_read_parameter_line].additional.used - 1]; + const f_string_range range = f_macro_string_range_initialize(strlen(arguments.argv[index])); - status = fl_console_parameter_to_number_unsigned(arguments.argv[index], &data->line); + f_number_unsigned number = 0; + + status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); if (F_status_is_error(status)) { - iki_read_print_error_number_argument(data->context, data->verbosity, F_status_set_fine(status), "fl_console_parameter_to_number_unsigned", iki_read_long_line, arguments.argv[index]); + iki_read_print_error_number_argument(data->context, data->verbosity, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", iki_read_long_line, arguments.argv[index]); fprintf(f_type_error, "%c", f_string_eol[0]); iki_read_delete_data(data); return F_status_set_error(F_parameter); } - // additional + data->line = number; + + // additional @todo } if (data->parameters[iki_read_parameter_name].result == f_console_result_found) { diff --git a/level_3/iki_read/c/iki_read.h b/level_3/iki_read/c/iki_read.h index 2cc6434..526977a 100644 --- a/level_3/iki_read/c/iki_read.h +++ b/level_3/iki_read/c/iki_read.h @@ -21,7 +21,10 @@ // fll-0 includes #include +#include +#include #include +#include #include #include #include @@ -32,6 +35,7 @@ // fll-1 includes #include #include +#include #include #include #include diff --git a/level_3/iki_read/data/build/dependencies b/level_3/iki_read/data/build/dependencies index 7de6d34..2a02015 100644 --- a/level_3/iki_read/data/build/dependencies +++ b/level_3/iki_read/data/build/dependencies @@ -1,3 +1,5 @@ +# fss-0000 + f_type f_status f_memory @@ -12,6 +14,7 @@ f_pipe f_print fl_color fl_console +fl_conversion fl_iki fl_string fl_utf diff --git a/level_3/iki_read/data/build/settings b/level_3/iki_read/data/build/settings index 9599f41..af608ee 100644 --- a/level_3/iki_read/data/build/settings +++ b/level_3/iki_read/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfll_file -lfl_string -lfl_status -lfl_print -lfl_iki -lfl_fss -lfl_console -lfl_color -lf_print -lf_pipe -lf_path -lf_iki -lf_fss -lf_file -lf_environment -lf_conversion -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfll_file -lfl_utf -lfl_string -lfl_iki -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_iki -lf_file -lf_conversion -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library iki_read.c private-iki_read.c diff --git a/level_3/init/c/init.h b/level_3/init/c/init.h index a5ae4e2..e6211f6 100644 --- a/level_3/init/c/init.h +++ b/level_3/init/c/init.h @@ -60,7 +60,10 @@ // fll-0 includes #include +#include +#include #include +#include #include #include #include diff --git a/level_3/init/data/build/dependencies b/level_3/init/data/build/dependencies index 1156585..2c1c9af 100644 --- a/level_3/init/data/build/dependencies +++ b/level_3/init/data/build/dependencies @@ -1,7 +1,10 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_directory @@ -10,7 +13,6 @@ f_file f_fss f_pipe f_print -f_utf fl_color fl_console fl_fss diff --git a/level_3/init/data/build/settings b/level_3/init/data/build/settings index aa92144..cda5d8d 100644 --- a/level_3/init/data/build/settings +++ b/level_3/init/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_program -lfll_fss -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_program -lfll_fss -lfl_conversion -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library init.c private-init.c diff --git a/level_3/status_code/c/private-status_code.c b/level_3/status_code/c/private-status_code.c index 57d84de..93d5cda 100644 --- a/level_3/status_code/c/private-status_code.c +++ b/level_3/status_code/c/private-status_code.c @@ -48,9 +48,11 @@ extern "C" { f_status status = F_none; { + const f_string_range range = f_macro_string_range_initialize(strlen(value)); + f_number_unsigned number = 0; - status = fl_console_parameter_to_number_unsigned(value, &number); + status = fl_conversion_string_to_number_unsigned(value, &number, range); if (status == F_none) { fl_color_print_line(f_type_output, data.context.error, data.context.reset, "invalid name"); @@ -125,7 +127,9 @@ extern "C" { #ifndef _di_status_code_convert_number_ f_return_status status_code_convert_number(const status_code_data data, const f_string value, f_number_unsigned *number) { - f_status status = fl_console_parameter_to_number_unsigned(value, number); + const f_string_range range = f_macro_string_range_initialize(strlen(value)); + + f_status status = fl_conversion_string_to_number_unsigned(value, number, range); if (*number > F_status_size_max_with_signal) { fl_color_print_line(f_type_output, data.context.error, data.context.reset, "out of range"); diff --git a/level_3/status_code/c/status_code.h b/level_3/status_code/c/status_code.h index 2e20d18..3534683 100644 --- a/level_3/status_code/c/status_code.h +++ b/level_3/status_code/c/status_code.h @@ -15,17 +15,20 @@ #include // fll-0 includes +#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include // fll-1 includes #include #include +#include #include #include diff --git a/level_3/status_code/data/build/dependencies b/level_3/status_code/data/build/dependencies index c085bd4..2614524 100644 --- a/level_3/status_code/data/build/dependencies +++ b/level_3/status_code/data/build/dependencies @@ -1,16 +1,19 @@ +# fss-0000 + f_type f_status f_memory f_string +f_utf f_color f_console f_conversion f_file f_pipe f_print -f_utf fl_color fl_console +fl_conversion fl_status fl_string fl_utf diff --git a/level_3/status_code/data/build/settings b/level_3/status_code/data/build/settings index d6c84a7..8d35094 100644 --- a/level_3/status_code/data/build/settings +++ b/level_3/status_code/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -lfll_status -lfll_program -lfl_utf -lfl_string -lfl_status -lfl_console -lfl_color -lf_print -lf_pipe -lf_file -lf_conversion -lf_console -lf_utf -lf_memory +build_libraries-individual -lfll_status -lfll_program -lfl_utf -lfl_string -lfl_status -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_file -lf_conversion -lf_console -lf_utf -lf_memory build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library status_code.c private-status_code.c -- 1.8.3.1