From d2a3ee563f6d1678886bce8f12056589ee427198 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 18 Jun 2022 17:28:32 -0500 Subject: [PATCH] Update: Follow up previous Unicode changes. The previous commit changed a significant amount of behavior. That commit noted that follow up changes would be necessary. First things first. I noticed that when I simplified the is valid checks I ended up over simplifying them. There are several byte sequences that are not valid UTF-8 sequences. I previously added surrogates and it turns out that UTF-8 specifically does not support Unicode surrogates. Remove all related code. The f_utf_char_t is supposed to be in big-endian format. The macros are fixed to properly handle this. This fix exposed problems in the conversion functions. The conversion functions lack the proper big-endian and little-endian support. Introduce a new structure and parameters to support designating the big-endian and little-endian. Support a default order to host byte order. The utf8 program needs to properly handle the endianness in a different way. The bytes are in left-to-right format but when converted are converted in a left-to-right format but shifted to the right. Swapping between little-endian to big-endian would be incorrect because the byte order is aleady correct. The byte position is what is incorrect. That is 0x0000c280 should be shifted to 0xc2800000. Swapping the endianness would instead yield 0x80c20000 (which is incorrect). The use of the word "character" as a variable name and in documentation can be confusing. I have recently defined a "byte sequence", a "code point", and a "unicode" as specific types. Change the word "character" to the appropriate name to make the code less confusing and more specific. There are also other words used in place of "character" that might not be the ones listed above. Some of the tests, particularly the emoji tests, have incorrect data. I discovered that many sources out on the internet violate the standard and call code points an emoji that are not official recognized as an emoji by the standard. I'm going with wikipedia on the new and updated emoji list. The f_char_t is available so update old code that still uses uint8_t to instead use f_char_t for character related data. Changes to the is valid code resulted in identifying invalid byte sequences that were previously considered valid. --- build/level_0/settings | 2 +- build/level_1/settings | 4 +- build/monolithic/settings | 6 +- level_0/f_conversion/c/conversion/common.c | 10 +- level_0/f_conversion/c/conversion/common.h | 28 +- level_0/f_conversion/c/private-conversion.c | 28 +- level_0/f_status/c/status.h | 2 + level_0/f_status_string/c/status_string.c | 12 + level_0/f_status_string/c/status_string.h | 6 + level_0/f_utf/c/private-utf.c | 62 +-- level_0/f_utf/c/private-utf.h | 19 +- level_0/f_utf/c/private-utf_alphabetic.c | 70 +-- level_0/f_utf/c/private-utf_alphabetic.h | 18 +- level_0/f_utf/c/private-utf_combining.c | 484 ++++++++-------- level_0/f_utf/c/private-utf_combining.h | 6 +- level_0/f_utf/c/private-utf_control.c | 100 ++-- level_0/f_utf/c/private-utf_control.h | 24 +- level_0/f_utf/c/private-utf_digit.c | 156 +++--- level_0/f_utf/c/private-utf_digit.h | 6 +- level_0/f_utf/c/private-utf_emoji.c | 210 +++---- level_0/f_utf/c/private-utf_emoji.h | 6 +- level_0/f_utf/c/private-utf_numeric.c | 12 +- level_0/f_utf/c/private-utf_numeric.h | 6 +- level_0/f_utf/c/private-utf_phonetic.c | 6 +- level_0/f_utf/c/private-utf_phonetic.h | 6 +- level_0/f_utf/c/private-utf_private.c | 17 +- level_0/f_utf/c/private-utf_private.h | 6 +- level_0/f_utf/c/private-utf_punctuation.c | 372 ++++++------- level_0/f_utf/c/private-utf_punctuation.h | 6 +- level_0/f_utf/c/private-utf_subscript.c | 12 +- level_0/f_utf/c/private-utf_subscript.h | 6 +- level_0/f_utf/c/private-utf_superscript.c | 96 ++-- level_0/f_utf/c/private-utf_superscript.h | 6 +- level_0/f_utf/c/private-utf_surrogate.c | 39 -- level_0/f_utf/c/private-utf_surrogate.h | 48 -- level_0/f_utf/c/private-utf_symbol.c | 438 +++++++-------- level_0/f_utf/c/private-utf_symbol.h | 6 +- level_0/f_utf/c/private-utf_valid.c | 92 ++- level_0/f_utf/c/private-utf_valid.h | 6 +- level_0/f_utf/c/private-utf_whitespace.c | 28 +- level_0/f_utf/c/private-utf_whitespace.h | 18 +- level_0/f_utf/c/private-utf_wide.c | 50 +- level_0/f_utf/c/private-utf_wide.h | 4 +- level_0/f_utf/c/private-utf_word.c | 32 +- level_0/f_utf/c/private-utf_word.h | 18 +- level_0/f_utf/c/private-utf_zero_width.c | 14 +- level_0/f_utf/c/private-utf_zero_width.h | 6 +- level_0/f_utf/c/utf/common.c | 50 +- level_0/f_utf/c/utf/common.h | 56 +- level_0/f_utf/c/utf/convert.c | 83 +-- level_0/f_utf/c/utf/convert.h | 24 +- level_0/f_utf/c/utf/is.c | 31 -- level_0/f_utf/c/utf/is.h | 206 +++---- level_0/f_utf/c/utf/is_character.c | 312 +++++------ level_0/f_utf/c/utf/is_character.h | 202 +++---- level_0/f_utf/data/build/settings | 2 +- level_0/f_utf/data/build/settings-tests | 1 - level_0/f_utf/tests/unit/c/data-utf.c | 5 - level_0/f_utf/tests/unit/c/data-utf.h | 15 - .../unit/c/test-utf-character_is_alphabetic.c | 6 +- .../tests/unit/c/test-utf-character_is_combining.c | 6 +- .../tests/unit/c/test-utf-character_is_control.c | 6 +- .../tests/unit/c/test-utf-character_is_digit.c | 6 +- .../tests/unit/c/test-utf-character_is_emoji.c | 6 +- .../tests/unit/c/test-utf-character_is_numeric.c | 6 +- .../tests/unit/c/test-utf-character_is_phonetic.c | 6 +- .../tests/unit/c/test-utf-character_is_private.c | 6 +- .../unit/c/test-utf-character_is_punctuation.c | 6 +- .../tests/unit/c/test-utf-character_is_subscript.c | 6 +- .../unit/c/test-utf-character_is_superscript.c | 6 +- .../tests/unit/c/test-utf-character_is_surrogate.c | 39 -- .../tests/unit/c/test-utf-character_is_surrogate.h | 20 - .../tests/unit/c/test-utf-character_is_symbol.c | 6 +- .../tests/unit/c/test-utf-character_is_valid.c | 155 ++++-- .../unit/c/test-utf-character_is_whitespace.c | 6 +- .../tests/unit/c/test-utf-character_is_wide.c | 6 +- .../tests/unit/c/test-utf-character_is_word.c | 12 +- .../unit/c/test-utf-character_is_zero_width.c | 6 +- .../f_utf/tests/unit/c/test-utf-is_alphabetic.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_combining.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_control.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_digit.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_emoji.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_numeric.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_phonetic.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_private.c | 14 +- .../f_utf/tests/unit/c/test-utf-is_punctuation.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_subscript.c | 14 +- .../f_utf/tests/unit/c/test-utf-is_superscript.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_surrogate.c | 56 -- level_0/f_utf/tests/unit/c/test-utf-is_surrogate.h | 20 - level_0/f_utf/tests/unit/c/test-utf-is_symbol.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_valid.c | 122 +++- .../f_utf/tests/unit/c/test-utf-is_whitespace.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_wide.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-is_word.c | 28 +- .../f_utf/tests/unit/c/test-utf-is_zero_width.c | 14 +- level_0/f_utf/tests/unit/c/test-utf.c | 2 - level_0/f_utf/tests/unit/c/test-utf.h | 2 - level_1/fl_conversion/c/conversion.c | 292 ++-------- level_1/fl_conversion/c/conversion.h | 617 ++++----------------- level_1/fl_conversion/c/conversion/common.c | 19 + level_1/fl_conversion/c/conversion/common.h | 82 +++ level_1/fl_conversion/c/private-conversion.c | 566 +++++++------------ level_1/fl_conversion/c/private-conversion.h | 273 ++------- level_1/fl_conversion/data/build/settings | 4 +- level_2/fll_status_string/c/status_string.c | 20 +- level_3/byte_dump/c/byte_dump.c | 6 +- level_3/control/c/private-control.c | 4 +- level_3/control/c/private-control.h | 4 +- .../controller/c/controller/private-controller.c | 8 +- .../controller/c/controller/private-controller.h | 12 +- level_3/controller/c/entry/private-entry.c | 4 +- level_3/controller/c/rule/private-rule.c | 34 +- level_3/controller/c/rule/private-rule.h | 4 +- level_3/fake/c/private-make-operate.c | 2 +- level_3/fake/c/private-make-operate_process.c | 2 +- level_3/fake/c/private-make-operate_process_type.c | 4 +- level_3/fake/c/private-make-operate_process_type.h | 4 +- level_3/fake/c/private-make-operate_validate.c | 2 +- level_3/fake/c/private-make.c | 8 +- .../fss_basic_list_read/c/fss_basic_list_read.c | 4 +- level_3/fss_basic_list_read/c/private-read.c | 12 +- level_3/fss_basic_list_read/c/private-read.h | 8 +- level_3/fss_basic_read/c/fss_basic_read.c | 4 +- level_3/fss_basic_read/c/private-read.c | 12 +- level_3/fss_basic_read/c/private-read.h | 8 +- .../c/fss_embedded_list_read.c | 4 +- level_3/fss_embedded_list_read/c/private-read.c | 12 +- level_3/fss_embedded_list_write/c/private-write.c | 8 +- .../c/fss_extended_list_read.c | 4 +- level_3/fss_extended_list_read/c/private-read.c | 12 +- level_3/fss_extended_list_read/c/private-read.h | 8 +- level_3/fss_extended_list_write/c/private-write.c | 8 +- level_3/fss_extended_read/c/fss_extended_read.c | 4 +- level_3/fss_extended_read/c/private-read.c | 12 +- level_3/fss_extended_read/c/private-read.h | 8 +- level_3/fss_identify/c/fss_identify.c | 4 +- level_3/fss_identify/c/private-identify.c | 2 +- level_3/fss_payload_read/c/fss_payload_read.c | 4 +- level_3/fss_payload_read/c/private-read.c | 12 +- level_3/fss_payload_read/c/private-read.h | 8 +- .../fss_status_code/c/private-fss_status_code.c | 4 +- level_3/iki_read/c/iki_read.c | 8 +- level_3/status_code/c/private-status_code.c | 4 +- level_3/utf8/c/private-print.c | 122 ++-- level_3/utf8/c/private-print.h | 43 +- level_3/utf8/c/private-utf8.c | 8 +- level_3/utf8/c/private-utf8_bytesequence.c | 44 +- level_3/utf8/c/private-utf8_bytesequence.h | 10 +- level_3/utf8/c/private-utf8_codepoint.c | 100 ++-- level_3/utf8/c/private-utf8_codepoint.h | 22 +- 152 files changed, 2899 insertions(+), 3947 deletions(-) delete mode 100644 level_0/f_utf/c/private-utf_surrogate.c delete mode 100644 level_0/f_utf/c/private-utf_surrogate.h delete mode 100644 level_0/f_utf/tests/unit/c/test-utf-character_is_surrogate.c delete mode 100644 level_0/f_utf/tests/unit/c/test-utf-character_is_surrogate.h delete mode 100644 level_0/f_utf/tests/unit/c/test-utf-is_surrogate.c delete mode 100644 level_0/f_utf/tests/unit/c/test-utf-is_surrogate.h create mode 100644 level_1/fl_conversion/c/conversion/common.c create mode 100644 level_1/fl_conversion/c/conversion/common.h diff --git a/build/level_0/settings b/build/level_0/settings index 6982f5f..6984dec 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -43,7 +43,7 @@ build_sources_library status_string.c build_sources_library string.c private-string.c string/common.c string/dynamic.c string/map.c string/map_multi.c string/private-dynamic.c string/private-map.c string/private-map_multi.c string/private-quantity.c string/private-range.c string/private-triple.c string/quantity.c string/range.c string/static.c string/triple.c build_sources_library type_array/array_length.c type_array/cell.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c build_sources_library type_array/private-array_length.c type_array/private-cell.c type_array/private-fll_id.c type_array/private-int8.c type_array/private-int16.c type_array/private-int32.c type_array/private-int64.c type_array/private-int128.c type_array/private-state.c type_array/private-status.c type_array/private-uint8.c type_array/private-uint16.c type_array/private-uint32.c type_array/private-uint64.c type_array/private-uint128.c -build_sources_library utf.c private-utf.c private-utf_alphabetic.c private-utf_combining.c private-utf_control.c private-utf_digit.c private-utf_emoji.c private-utf_numeric.c private-utf_phonetic.c private-utf_private.c private-utf_punctuation.c private-utf_subscript.c private-utf_superscript.c private-utf_surrogate.c private-utf_symbol.c private-utf_valid.c private-utf_whitespace.c private-utf_wide.c private-utf_word.c private-utf_zero_width.c +build_sources_library utf.c private-utf.c private-utf_alphabetic.c private-utf_combining.c private-utf_control.c private-utf_digit.c private-utf_emoji.c private-utf_numeric.c private-utf_phonetic.c private-utf_private.c private-utf_punctuation.c private-utf_subscript.c private-utf_superscript.c private-utf_symbol.c private-utf_valid.c private-utf_whitespace.c private-utf_wide.c private-utf_word.c private-utf_zero_width.c build_sources_library utf/common.c utf/convert.c utf/dynamic.c utf/is.c utf/is_character.c utf/map.c utf/private-dynamic.c utf/private-map.c utf/private-map_multi.c utf/private-triple.c utf/private-is_unassigned.c utf/private-string.c utf/static.c utf/string.c utf/triple.c build_sources_library-level thread.c private-thread.c build_sources_library_shared diff --git a/build/level_1/settings b/build/level_1/settings index 8474995..43727e3 100644 --- a/build/level_1/settings +++ b/build/level_1/settings @@ -22,7 +22,7 @@ build_libraries-level -lfll_0 build_libraries-level_threadless -lfll_0 build_sources_library control_group.c -build_sources_library conversion.c private-conversion.c +build_sources_library conversion.c private-conversion.c conversion/common.c build_sources_library directory.c private-directory.c build_sources_library environment.c build_sources_library private-fss.c fss/basic.c fss/basic_list.c fss/embedded_list.c fss/extended.c fss/extended_list.c @@ -34,7 +34,7 @@ build_sources_library utf.c private-utf.c build_sources_library utf_file.c private-utf_file.c build_sources_headers control_group.h -build_sources_headers conversion.h +build_sources_headers conversion.h conversion/common.h build_sources_headers directory.h directory/common.h build_sources_headers environment.h build_sources_headers execute.h execute/common.h diff --git a/build/monolithic/settings b/build/monolithic/settings index 06a82d5..c652545 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -43,11 +43,11 @@ build_sources_library level_0/status_string.c build_sources_library level_0/string.c level_0/private-string.c level_0/string/common.c level_0/string/dynamic.c level_0/string/map.c level_0/string/map_multi.c level_0/string/private-dynamic.c level_0/string/private-map.c level_0/string/private-map_multi.c level_0/string/private-quantity.c level_0/string/private-range.c level_0/string/private-triple.c level_0/string/quantity.c level_0/string/range.c level_0/string/static.c level_0/string/triple.c build_sources_library level_0/type_array/array_length.c level_0/type_array/cell.c level_0/type_array/fll_id.c level_0/type_array/int8.c level_0/type_array/int16.c level_0/type_array/int32.c level_0/type_array/int64.c level_0/type_array/int128.c level_0/type_array/state.c level_0/type_array/status.c level_0/type_array/uint8.c level_0/type_array/uint16.c level_0/type_array/uint32.c level_0/type_array/uint64.c level_0/type_array/uint128.c build_sources_library level_0/type_array/private-array_length.c level_0/type_array/private-cell.c level_0/type_array/private-fll_id.c level_0/type_array/private-int8.c level_0/type_array/private-int16.c level_0/type_array/private-int32.c level_0/type_array/private-int64.c level_0/type_array/private-int128.c level_0/type_array/private-state.c level_0/type_array/private-status.c level_0/type_array/private-uint8.c level_0/type_array/private-uint16.c level_0/type_array/private-uint32.c level_0/type_array/private-uint64.c level_0/type_array/private-uint128.c -build_sources_library level_0/utf.c level_0/private-utf.c level_0/private-utf_alphabetic.c level_0/private-utf_combining.c level_0/private-utf_control.c level_0/private-utf_digit.c level_0/private-utf_emoji.c level_0/private-utf_numeric.c level_0/private-utf_phonetic.c level_0/private-utf_private.c level_0/private-utf_punctuation.c level_0/private-utf_subscript.c level_0/private-utf_superscript.c level_0/private-utf_surrogate.c level_0/private-utf_symbol.c level_0/private-utf_valid.c level_0/private-utf_whitespace.c level_0/private-utf_wide.c level_0/private-utf_word.c level_0/private-utf_zero_width.c +build_sources_library level_0/utf.c level_0/private-utf.c level_0/private-utf_alphabetic.c level_0/private-utf_combining.c level_0/private-utf_control.c level_0/private-utf_digit.c level_0/private-utf_emoji.c level_0/private-utf_numeric.c level_0/private-utf_phonetic.c level_0/private-utf_private.c level_0/private-utf_punctuation.c level_0/private-utf_subscript.c level_0/private-utf_superscript.c level_0/private-utf_symbol.c level_0/private-utf_valid.c level_0/private-utf_whitespace.c level_0/private-utf_wide.c level_0/private-utf_word.c level_0/private-utf_zero_width.c build_sources_library level_0/utf/common.c level_0/utf/convert.c level_0/utf/dynamic.c level_0/utf/is.c level_0/utf/is_character.c level_0/utf/map.c level_0/utf/map_multi.c level_0/utf/static.c level_0/utf/string.c level_0/utf/triple.c level_0/utf/private-dynamic.c level_0/utf/private-is_unassigned.c level_0/utf/private-map.c level_0/utf/private-map_multi.c level_0/utf/private-triple.c level_0/utf/private-string.c build_sources_library level_1/control_group.c -build_sources_library level_1/conversion.c level_1/private-conversion.c +build_sources_library level_1/conversion.c level_1/private-conversion.c level_1/conversion/common.c build_sources_library level_1/directory.c level_1/private-directory.c build_sources_library level_1/environment.c build_sources_library level_1/private-fss.c level_1/fss/basic.c level_1/fss/basic_list.c level_1/fss/embedded_list.c level_1/fss/extended.c level_1/fss/extended_list.c @@ -101,7 +101,7 @@ build_sources_headers level_0/type_array/array_length.h level_0/type_array/cell. build_sources_headers level_0/utf.h level_0/utf/common.h level_0/utf/convert.h level_0/utf/dynamic.h level_0/utf/is.h level_0/utf/is_character.h level_0/utf/map.h level_0/utf/map_multi.h level_0/utf/static.h level_0/utf/string.h level_0/utf/triple.h build_sources_headers level_1/control_group.h -build_sources_headers level_1/conversion.h +build_sources_headers level_1/conversion.h level_1/conversion/common.h build_sources_headers level_1/directory.h level_1/directory/common.h build_sources_headers level_1/environment.h build_sources_headers level_1/execute.h level_1/execute/common.h diff --git a/level_0/f_conversion/c/conversion/common.c b/level_0/f_conversion/c/conversion/common.c index 5fe41c6..a509f5f 100644 --- a/level_0/f_conversion/c/conversion/common.c +++ b/level_0/f_conversion/c/conversion/common.c @@ -5,11 +5,11 @@ extern "C" { #endif #ifndef _di_f_conversion_data_t_defines_ - const f_conversion_data_t f_conversion_data_base_2_s = macro_f_conversion_data_t_initialize(2, 0, 1); - const f_conversion_data_t f_conversion_data_base_8_s = macro_f_conversion_data_t_initialize(8, 0, 1); - const f_conversion_data_t f_conversion_data_base_10_s = macro_f_conversion_data_t_initialize(10, 0, 1); - const f_conversion_data_t f_conversion_data_base_12_s = macro_f_conversion_data_t_initialize(12, 0, 1); - const f_conversion_data_t f_conversion_data_base_16_s = macro_f_conversion_data_t_initialize(16, 0, 1); + const f_conversion_data_t f_conversion_data_base_2_c = macro_f_conversion_data_t_initialize(2, 0, 1); + const f_conversion_data_t f_conversion_data_base_8_c = macro_f_conversion_data_t_initialize(8, 0, 1); + const f_conversion_data_t f_conversion_data_base_10_c = macro_f_conversion_data_t_initialize(10, 0, 1); + const f_conversion_data_t f_conversion_data_base_12_c = macro_f_conversion_data_t_initialize(12, 0, 1); + const f_conversion_data_t f_conversion_data_base_16_c = macro_f_conversion_data_t_initialize(16, 0, 1); #endif // _di_f_conversion_data_t_defines_ #ifdef __cplusplus diff --git a/level_0/f_conversion/c/conversion/common.h b/level_0/f_conversion/c/conversion/common.h index 52e4d6c..2fac672 100644 --- a/level_0/f_conversion/c/conversion/common.h +++ b/level_0/f_conversion/c/conversion/common.h @@ -75,7 +75,7 @@ extern "C" { #endif // _en_f_type_number_128_t_ /** - * Provide a structure for customizing conversion settings for a conversion function using this. + * Provide a structure for customizing conversion settings for a conversion function to use. * * base: The base unit the number is to be represented as, only the numbers 2 through 16 are supported as a base. * flag: Store flags from f_conversion_data_flag_*. @@ -110,11 +110,11 @@ extern "C" { * - 16: Basic base-16 conversion structure. */ #ifndef _di_f_conversion_data_t_defines_ - extern const f_conversion_data_t f_conversion_data_base_2_s; - extern const f_conversion_data_t f_conversion_data_base_8_s; - extern const f_conversion_data_t f_conversion_data_base_10_s; - extern const f_conversion_data_t f_conversion_data_base_12_s; - extern const f_conversion_data_t f_conversion_data_base_16_s; + extern const f_conversion_data_t f_conversion_data_base_2_c; + extern const f_conversion_data_t f_conversion_data_base_8_c; + extern const f_conversion_data_t f_conversion_data_base_10_c; + extern const f_conversion_data_t f_conversion_data_base_12_c; + extern const f_conversion_data_t f_conversion_data_base_16_c; #endif // _di_f_conversion_data_t_defines_ /** @@ -124,6 +124,8 @@ extern "C" { * - align_left: Use left-justification. * - base_prepend: Prepend the base character, such as "0x", or "0X", defaulting to lowercase (this includes base 10) (does nothing for unsupported base units). * - base_upper: Any alphabet characters in the number are made uppercase rather than lowercase and when *_base_prepend flag is used, use uppercase in the base prepend. + * - endian_big: Use big-endian rather than host byte order or little-endian when converting. + * - endian_little: Use little-endian rather than host byte order or big-endian when converting. * - exponent: Use exponent rather than decimal for printing double values. * - exponent_either: Use either exponent or decimila for printing double values. * - exponent_upper: When using exponent, display the exponent 'e' as uppercase 'E'. @@ -142,12 +144,14 @@ extern "C" { #define F_conversion_data_flag_align_left_d 0x1 #define F_conversion_data_flag_base_prepend_d 0x2 #define F_conversion_data_flag_base_upper_d 0x4 - #define F_conversion_data_flag_exponent_d 0x8 - #define F_conversion_data_flag_exponent_either_d 0x10 - #define F_conversion_data_flag_exponent_upper_d 0x20 - #define F_conversion_data_flag_sign_always_d 0x40 - #define F_conversion_data_flag_sign_pad_d 0x80 - #define F_conversion_data_flag_zeros_leading_d 0x100 + #define F_conversion_data_flag_endian_big_d 0x8 + #define F_conversion_data_flag_endian_little_d 0x10 + #define F_conversion_data_flag_exponent_d 0x20 + #define F_conversion_data_flag_exponent_either_d 0x40 + #define F_conversion_data_flag_exponent_upper_d 0x80 + #define F_conversion_data_flag_sign_always_d 0x100 + #define F_conversion_data_flag_sign_pad_d 0x200 + #define F_conversion_data_flag_zeros_leading_d 0x400 #endif // _di_f_conversion_data_flag_ #ifdef __cplusplus diff --git a/level_0/f_conversion/c/private-conversion.c b/level_0/f_conversion/c/private-conversion.c index d02b039..0bd7e92 100644 --- a/level_0/f_conversion/c/private-conversion.c +++ b/level_0/f_conversion/c/private-conversion.c @@ -117,11 +117,19 @@ extern "C" { } while (current < f_string_ascii_0_s.used); } - #ifdef _is_F_endian_big + if (data.flag & F_conversion_data_flag_endian_big_d) { work <<= 1; - #else + } + else if (data.flag & F_conversion_data_flag_endian_big_d) { work >>= 1; - #endif // _is_F_endian_big + } + else { + #ifdef _is_F_endian_big + work <<= 1; + #else + work >>= 1; + #endif // _is_F_endian_big + } } // while return F_none; @@ -350,11 +358,19 @@ extern "C" { destination->string[destination->used++] = f_string_ascii_0_s.string[1]; } - #ifdef _is_F_endian_big + if (data.flag & F_conversion_data_flag_endian_big_d) { work <<= 1; - #else + } + else if (data.flag & F_conversion_data_flag_endian_big_d) { work >>= 1; - #endif // _is_F_endian_big + } + else { + #ifdef _is_F_endian_big + work <<= 1; + #else + work >>= 1; + #endif // _is_F_endian_big + } } // while return; diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index cdee1b0..f9fc27d 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -215,6 +215,8 @@ extern "C" { F_ascii_not, F_atomic, F_atomic_not, + F_base, + F_base_not, F_begin, F_begin_not, F_block, diff --git a/level_0/f_status_string/c/status_string.c b/level_0/f_status_string/c/status_string.c index 21d0e7a..66fe668 100644 --- a/level_0/f_status_string/c/status_string.c +++ b/level_0/f_status_string/c/status_string.c @@ -89,6 +89,8 @@ extern "C" { const f_string_static_t f_status_ascii_not_s = macro_f_string_static_t_initialize(F_status_ascii_not_s, 0, F_status_ascii_not_s_length); const f_string_static_t f_status_atomic_s = macro_f_string_static_t_initialize(F_status_atomic_s, 0, F_status_atomic_s_length); const f_string_static_t f_status_atomic_not_s = macro_f_string_static_t_initialize(F_status_atomic_not_s, 0, F_status_atomic_not_s_length); + const f_string_static_t f_status_base_s = macro_f_string_static_t_initialize(F_status_base_s, 0, F_status_base_s_length); + const f_string_static_t f_status_base_not_s = macro_f_string_static_t_initialize(F_status_base_not_s, 0, F_status_base_not_s_length); const f_string_static_t f_status_begin_s = macro_f_string_static_t_initialize(F_status_begin_s, 0, F_status_begin_s_length); const f_string_static_t f_status_begin_not_s = macro_f_string_static_t_initialize(F_status_begin_not_s, 0, F_status_begin_not_s_length); const f_string_static_t f_status_block_s = macro_f_string_static_t_initialize(F_status_block_s, 0, F_status_block_s_length); @@ -1046,6 +1048,16 @@ extern "C" { break; + case F_base: + *name = f_status_base_s; + + break; + + case F_base_not: + *name = f_status_base_not_s; + + break; + case F_begin: *name = f_status_begin_s; diff --git a/level_0/f_status_string/c/status_string.h b/level_0/f_status_string/c/status_string.h index 5781606..0c59d6e 100644 --- a/level_0/f_status_string/c/status_string.h +++ b/level_0/f_status_string/c/status_string.h @@ -242,6 +242,8 @@ extern "C" { #define F_status_ascii_not_s "F_ascii_not" #define F_status_atomic_s "F_atomic" #define F_status_atomic_not_s "F_atomic_not" + #define F_status_base_s "F_base" + #define F_status_base_not_s "F_base_not" #define F_status_begin_s "F_begin" #define F_status_begin_not_s "F_begin_not" #define F_status_block_s "F_block" @@ -528,6 +530,8 @@ extern "C" { #define F_status_ascii_not_s_length 11 #define F_status_atomic_s_length 8 #define F_status_atomic_not_s_length 12 + #define F_status_base_s_length 6 + #define F_status_base_not_s_length 10 #define F_status_begin_s_length 7 #define F_status_begin_not_s_length 11 #define F_status_break_s_length 7 @@ -814,6 +818,8 @@ extern "C" { extern const f_string_static_t f_status_ascii_not_s; extern const f_string_static_t f_status_atomic_s; extern const f_string_static_t f_status_atomic_not_s; + extern const f_string_static_t f_status_base_s; + extern const f_string_static_t f_status_base_not_s; extern const f_string_static_t f_status_begin_s; extern const f_string_static_t f_status_begin_not_s; extern const f_string_static_t f_status_block_s; diff --git a/level_0/f_utf/c/private-utf.c b/level_0/f_utf/c/private-utf.c index 4dff8f1..3245789 100644 --- a/level_0/f_utf/c/private-utf.c +++ b/level_0/f_utf/c/private-utf.c @@ -6,82 +6,82 @@ extern "C" { #endif -#if !defined(_di_f_utf_char_to_character_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_ascii_) || !defined(_di_f_utf_is_combining_) || !defined(_di_f_utf_is_control_) || !defined(_di_f_utf_is_control_picture_) || !defined(_di_f_utf_is_digit_) || !defined(_di_f_utf_is_emoji_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_numeric_) || !defined(_di_f_utf_is_phonetic_) || !defined(_di_f_utf_is_private_) || !defined(_di_f_utf_is_punctuation_) || !defined(_di_f_utf_is_surrogate_) || !defined(_di_f_utf_is_symbol_) || !defined(_di_f_utf_is_unassigned_) || !defined(_di_f_utf_is_valid_) || !defined(_di_f_utf_is_whitespace_) || !defined(_di_f_utf_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_other_) || !defined(_di_f_utf_is_wide_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(f_utf_unicode_to) - f_status_t private_f_utf_char_to_character(const f_string_t character, const f_array_length_t width_max, f_utf_char_t *character_utf) { +#if !defined(_di_f_utf_char_to_character_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_ascii_) || !defined(_di_f_utf_is_combining_) || !defined(_di_f_utf_is_control_) || !defined(_di_f_utf_is_control_picture_) || !defined(_di_f_utf_is_digit_) || !defined(_di_f_utf_is_emoji_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_numeric_) || !defined(_di_f_utf_is_phonetic_) || !defined(_di_f_utf_is_private_) || !defined(_di_f_utf_is_punctuation_) || !defined(_di_f_utf_is_symbol_) || !defined(_di_f_utf_is_unassigned_) || !defined(_di_f_utf_is_valid_) || !defined(_di_f_utf_is_whitespace_) || !defined(_di_f_utf_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_other_) || !defined(_di_f_utf_is_wide_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(f_utf_unicode_to) + f_status_t private_f_utf_char_to_character(const f_string_t sequence, const f_array_length_t width_max, f_utf_char_t *character_utf) { - if (!macro_f_utf_byte_width_is(*character)) { - *character_utf = macro_f_utf_char_t_from_char_1(character[0]); + if (!macro_f_utf_byte_width_is(*sequence)) { + *character_utf = macro_f_utf_char_t_from_char_1(sequence[0]); return F_none; } - if (macro_f_utf_byte_width_is(*character) == 1) { + if (macro_f_utf_byte_width_is(*sequence) == 1) { return F_status_set_error(F_utf_fragment); } - if (macro_f_utf_byte_width_is(*character) > width_max) { + if (macro_f_utf_byte_width_is(*sequence) > width_max) { return F_status_set_error(F_complete_not_utf); } - *character_utf = macro_f_utf_char_t_from_char_1(character[0]); + *character_utf = macro_f_utf_char_t_from_char_1(sequence[0]); - if (macro_f_utf_byte_width_is(*character) < 2) { + if (macro_f_utf_byte_width_is(*sequence) < 2) { return F_none; } - *character_utf |= macro_f_utf_char_t_from_char_2(character[1]); + *character_utf |= macro_f_utf_char_t_from_char_2(sequence[1]); - if (macro_f_utf_byte_width_is(*character) == 2) { + if (macro_f_utf_byte_width_is(*sequence) == 2) { return F_none; } - *character_utf |= macro_f_utf_char_t_from_char_3(character[2]); + *character_utf |= macro_f_utf_char_t_from_char_3(sequence[2]); - if (macro_f_utf_byte_width_is(*character) == 3) { + if (macro_f_utf_byte_width_is(*sequence) == 3) { return F_none; } - *character_utf |= macro_f_utf_char_t_from_char_4(character[3]); + *character_utf |= macro_f_utf_char_t_from_char_4(sequence[3]); return F_none; } -#endif // !defined(_di_f_utf_char_to_character_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_ascii_) || !defined(_di_f_utf_is_combining_) || !defined(_di_f_utf_is_control_) || !defined(_di_f_utf_is_control_picture_) || !defined(_di_f_utf_is_digit_) || !defined(_di_f_utf_is_emoji_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_numeric_) || !defined(_di_f_utf_is_phonetic_) || !defined(_di_f_utf_is_private_) || !defined(_di_f_utf_is_punctuation_) || !defined(_di_f_utf_is_surrogate_) || !defined(_di_f_utf_is_symbol_) || !defined(_di_f_utf_is_unassigned_) || !defined(_di_f_utf_is_valid_) || !defined(_di_f_utf_is_whitespace_) || !defined(_di_f_utf_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_other_) || !defined(_di_f_utf_is_wide_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(f_utf_unicode_to) +#endif // !defined(_di_f_utf_char_to_character_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_ascii_) || !defined(_di_f_utf_is_combining_) || !defined(_di_f_utf_is_control_) || !defined(_di_f_utf_is_control_picture_) || !defined(_di_f_utf_is_digit_) || !defined(_di_f_utf_is_emoji_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_numeric_) || !defined(_di_f_utf_is_phonetic_) || !defined(_di_f_utf_is_private_) || !defined(_di_f_utf_is_punctuation_) || !defined(_di_f_utf_is_symbol_) || !defined(_di_f_utf_is_unassigned_) || !defined(_di_f_utf_is_valid_) || !defined(_di_f_utf_is_whitespace_) || !defined(_di_f_utf_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_other_) || !defined(_di_f_utf_is_wide_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(f_utf_unicode_to) #if !defined(_di_f_utf_unicode_to_) || !defined(_di_f_utf_character_unicode_to_) - f_status_t private_f_utf_character_unicode_to(const f_utf_char_t character, uint32_t *unicode) { + f_status_t private_f_utf_character_unicode_to(const f_utf_char_t sequence, uint32_t *codepoint) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - if (private_f_utf_character_is_valid(character) == F_false) { + if (private_f_utf_character_is_valid(sequence) == F_false) { return F_status_set_error(F_utf_not); } // U+0000 -> U+007F (ASCII). - if (macro_f_utf_char_t_width(character) == 1) { - *unicode = macro_f_utf_char_t_to_char_1(character) & 0x7f; + if (macro_f_utf_char_t_width(sequence) == 1) { + *codepoint = macro_f_utf_char_t_to_char_1(sequence) & 0x7f; } // U+0080 -> U+07FF. - else if (macro_f_utf_char_t_width(character) == 2) { - *unicode = (macro_f_utf_char_t_to_char_1(character) & 0x1f) << 6; - *unicode |= macro_f_utf_char_t_to_char_2(character) & 0x3f; + else if (macro_f_utf_char_t_width(sequence) == 2) { + *codepoint = (macro_f_utf_char_t_to_char_1(sequence) & 0x1f) << 6; + *codepoint |= macro_f_utf_char_t_to_char_2(sequence) & 0x3f; } // U+0800 -> U+FFFF. - else if (macro_f_utf_char_t_width(character) == 3) { - *unicode = (macro_f_utf_char_t_to_char_1(character) & 0xf) << 12; - *unicode |= (macro_f_utf_char_t_to_char_2(character) & 0x3f) << 6; - *unicode |= macro_f_utf_char_t_to_char_3(character) & 0x3f; + else if (macro_f_utf_char_t_width(sequence) == 3) { + *codepoint = (macro_f_utf_char_t_to_char_1(sequence) & 0xf) << 12; + *codepoint |= (macro_f_utf_char_t_to_char_2(sequence) & 0x3f) << 6; + *codepoint |= macro_f_utf_char_t_to_char_3(sequence) & 0x3f; } // U+10000 -> U+10FFFF. - else if (macro_f_utf_char_t_width(character) == 4) { - *unicode = (macro_f_utf_char_t_to_char_1(character) & 0x7) << 18; - *unicode |= (macro_f_utf_char_t_to_char_2(character) & 0x3f) << 12; - *unicode |= (macro_f_utf_char_t_to_char_3(character) & 0x3f) << 6; - *unicode |= macro_f_utf_char_t_to_char_4(character) & 0x3f; + else if (macro_f_utf_char_t_width(sequence) == 4) { + *codepoint = (macro_f_utf_char_t_to_char_1(sequence) & 0x7) << 18; + *codepoint |= (macro_f_utf_char_t_to_char_2(sequence) & 0x3f) << 12; + *codepoint |= (macro_f_utf_char_t_to_char_3(sequence) & 0x3f) << 6; + *codepoint |= macro_f_utf_char_t_to_char_4(sequence) & 0x3f; } return F_none; diff --git a/level_0/f_utf/c/private-utf.h b/level_0/f_utf/c/private-utf.h index c68a677..60ef262 100644 --- a/level_0/f_utf/c/private-utf.h +++ b/level_0/f_utf/c/private-utf.h @@ -22,13 +22,13 @@ extern "C" { * * Intended to be shared to each of the different implementation variations. * - * @param character + * @param sequence * The character string to be converted to the f_utf_char_t type. * There must be enough space allocated to convert against, as limited by width_max. * @param width_max * The maximum width available for converting. * Can be anything greater than 0. - * @param character_utf + * @param sequence_utf * The generated character of type f_utf_char_t. * This value may be cleared, even on error. * @@ -38,7 +38,7 @@ extern "C" { * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 sequence. * F_parameter (with error bit) if a parameter is invalid. * F_utf_fragment (with error bit) if character is a UTF-8 fragment. - * F_utf_not (with error bit) if unicode is an invalid Unicode character. + * F_utf_not (with error bit) if codepoint is an invalid Unicode character. * * @see f_utf_char_to_character() * @see f_utf_character_is_valid() @@ -57,7 +57,6 @@ extern "C" { * @see f_utf_is_phonetic() * @see f_utf_is_private() * @see f_utf_is_punctuation() - * @see f_utf_is_surrogate() * @see f_utf_is_symbol() * @see f_utf_is_unassigned() * @see f_utf_is_valid() @@ -71,19 +70,19 @@ extern "C" { * @see f_utf_is_zero_width() * @see f_utf_unicode_to() */ -#if !defined(_di_f_utf_char_to_character_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_ascii_) || !defined(_di_f_utf_is_combining_) || !defined(_di_f_utf_is_control_) || !defined(_di_f_utf_is_control_picture_) || !defined(_di_f_utf_is_digit_) || !defined(_di_f_utf_is_emoji_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_numeric_) || !defined(_di_f_utf_is_phonetic_) || !defined(_di_f_utf_is_private_) || !defined(_di_f_utf_is_punctuation_) || !defined(_di_f_utf_is_surrogate_) || !defined(_di_f_utf_is_symbol_) || !defined(_di_f_utf_is_unassigned_) || !defined(_di_f_utf_is_valid_) || !defined(_di_f_utf_is_whitespace_) || !defined(_di_f_utf_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_other_) || !defined(_di_f_utf_is_wide_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(f_utf_unicode_to) +#if !defined(_di_f_utf_char_to_character_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_ascii_) || !defined(_di_f_utf_is_combining_) || !defined(_di_f_utf_is_control_) || !defined(_di_f_utf_is_control_picture_) || !defined(_di_f_utf_is_digit_) || !defined(_di_f_utf_is_emoji_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_numeric_) || !defined(_di_f_utf_is_phonetic_) || !defined(_di_f_utf_is_private_) || !defined(_di_f_utf_is_punctuation_) || !defined(_di_f_utf_is_symbol_) || !defined(_di_f_utf_is_unassigned_) || !defined(_di_f_utf_is_valid_) || !defined(_di_f_utf_is_whitespace_) || !defined(_di_f_utf_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_other_) || !defined(_di_f_utf_is_wide_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(f_utf_unicode_to) extern f_status_t private_f_utf_char_to_character(const f_string_t character, const f_array_length_t width_max, f_utf_char_t *character_utf) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_utf_char_to_character_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_ascii_) || !defined(_di_f_utf_is_combining_) || !defined(_di_f_utf_is_control_) || !defined(_di_f_utf_is_control_picture_) || !defined(_di_f_utf_is_digit_) || !defined(_di_f_utf_is_emoji_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_numeric_) || !defined(_di_f_utf_is_phonetic_) || !defined(_di_f_utf_is_private_) || !defined(_di_f_utf_is_punctuation_) || !defined(_di_f_utf_is_surrogate_) || !defined(_di_f_utf_is_symbol_) || !defined(_di_f_utf_is_unassigned_) || !defined(_di_f_utf_is_valid_) || !defined(_di_f_utf_is_whitespace_) || !defined(_di_f_utf_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_other_) || !defined(_di_f_utf_is_wide_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(f_utf_unicode_to) +#endif // !defined(_di_f_utf_char_to_character_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_ascii_) || !defined(_di_f_utf_is_combining_) || !defined(_di_f_utf_is_control_) || !defined(_di_f_utf_is_control_picture_) || !defined(_di_f_utf_is_digit_) || !defined(_di_f_utf_is_emoji_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_numeric_) || !defined(_di_f_utf_is_phonetic_) || !defined(_di_f_utf_is_private_) || !defined(_di_f_utf_is_punctuation_) || !defined(_di_f_utf_is_symbol_) || !defined(_di_f_utf_is_unassigned_) || !defined(_di_f_utf_is_valid_) || !defined(_di_f_utf_is_whitespace_) || !defined(_di_f_utf_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_other_) || !defined(_di_f_utf_is_wide_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(f_utf_unicode_to) /** * Private implementation of f_utf_character_is_zero_width(). * * Intended to be shared to each of the different implementation variations. * - * @param character + * @param sequence * The (UTF-8) character to convert to the Unicode representation. * The f_utf_char_t is a 32-bit integer containing UTF-8 sequences, unchanged. - * @param unicode + * @param codepoint * A 32-bit integer representing the Unicode (such as U+0001). * Does not need to be interpretted like UTF-8, this is a number from 0 onto max supported Unicode integer value (U+10FFFF). * @@ -93,13 +92,13 @@ extern "C" { * F_failure (with error bit) if width is not long enough to convert. * F_parameter (with error bit) if a parameter is invalid. * F_utf_fragment (with error bit) if character is a UTF-8 fragment. - * F_utf_not (with error bit) if unicode is an invalid Unicode character. + * F_utf_not (with error bit) if codepoint is an invalid Unicode character. * * @see f_utf_character_unicode_to() * @see f_utf_unicode_to() */ #if !defined(_di_f_utf_character_unicode_to_) || !defined(_di_f_utf_unicode_to_) - extern f_status_t private_f_utf_character_unicode_to(const f_utf_char_t character, uint32_t *unicode) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_unicode_to(const f_utf_char_t sequence, uint32_t *codepoint) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_unicode_to_) || !defined(_di_f_utf_unicode_to_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_alphabetic.c b/level_0/f_utf/c/private-utf_alphabetic.c index a2382eb..a35c162 100644 --- a/level_0/f_utf/c/private-utf_alphabetic.c +++ b/level_0/f_utf/c/private-utf_alphabetic.c @@ -16,46 +16,46 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_) - f_status_t private_f_utf_character_is_alphabetic(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_alphabetic(const f_utf_char_t sequence) { - if (private_f_utf_character_is_zero_width(character)) { + if (private_f_utf_character_is_zero_width(sequence)) { return F_false; } - // is_control() handles both is_control_code() and is_control_format(). - if (private_f_utf_character_is_control(character)) { + // The is_control() handles both is_control_code() and is_control_format(). + if (private_f_utf_character_is_control(sequence)) { return F_false; } - if (private_f_utf_character_is_control_picture(character)) { + if (private_f_utf_character_is_control_picture(sequence)) { return F_false; } - if (private_f_utf_character_is_combining(character)) { + if (private_f_utf_character_is_combining(sequence)) { return F_false; } - if (private_f_utf_character_is_whitespace(character)) { + if (private_f_utf_character_is_whitespace(sequence)) { return F_false; } - if (private_f_utf_character_is_whitespace_modifier(character)) { + if (private_f_utf_character_is_whitespace_modifier(sequence)) { return F_false; } - if (private_f_utf_character_is_numeric(character)) { + if (private_f_utf_character_is_numeric(sequence)) { return F_false; } - if (private_f_utf_character_is_punctuation(character)) { + if (private_f_utf_character_is_punctuation(sequence)) { return F_false; } - if (private_f_utf_character_is_symbol(character)) { + if (private_f_utf_character_is_symbol(sequence)) { return F_false; } - if (private_f_utf_character_is_phonetic(character)) { + if (private_f_utf_character_is_phonetic(sequence)) { return F_false; } @@ -64,46 +64,46 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_) #if !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_digit_) - f_status_t private_f_utf_character_is_alphabetic_digit(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_alphabetic_digit(const f_utf_char_t sequence) { - if (private_f_utf_character_is_digit(character)) { + if (private_f_utf_character_is_digit(sequence)) { return F_true; } - if (private_f_utf_character_is_zero_width(character)) { + if (private_f_utf_character_is_zero_width(sequence)) { return F_false; } - // is_control() handles both is_control_code() and is_control_format(). - if (private_f_utf_character_is_control(character)) { + // The is_control() handles both is_control_code() and is_control_format(). + if (private_f_utf_character_is_control(sequence)) { return F_false; } - if (private_f_utf_character_is_control_picture(character)) { + if (private_f_utf_character_is_control_picture(sequence)) { return F_false; } - if (private_f_utf_character_is_whitespace(character)) { + if (private_f_utf_character_is_whitespace(sequence)) { return F_false; } - if (private_f_utf_character_is_whitespace_modifier(character)) { + if (private_f_utf_character_is_whitespace_modifier(sequence)) { return F_false; } - if (private_f_utf_character_is_numeric(character)) { + if (private_f_utf_character_is_numeric(sequence)) { return F_false; } - if (private_f_utf_character_is_punctuation(character)) { + if (private_f_utf_character_is_punctuation(sequence)) { return F_false; } - if (private_f_utf_character_is_symbol(character)) { + if (private_f_utf_character_is_symbol(sequence)) { return F_false; } - if (private_f_utf_character_is_phonetic(character)) { + if (private_f_utf_character_is_phonetic(sequence)) { return F_false; } @@ -112,42 +112,42 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_digit_) #if !defined(_di_f_utf_character_is_alphabetic_numeric_) || !defined(_di_f_utf_is_alphabetic_numeric_) - f_status_t private_f_utf_character_is_alphabetic_numeric(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_alphabetic_numeric(const f_utf_char_t sequence) { - if (private_f_utf_character_is_numeric(character)) { + if (private_f_utf_character_is_numeric(sequence)) { return F_true; } - if (private_f_utf_character_is_zero_width(character)) { + if (private_f_utf_character_is_zero_width(sequence)) { return F_false; } - // is_control() handles both is_control_code() and is_control_format(). - if (private_f_utf_character_is_control(character)) { + // The is_control() handles both is_control_code() and is_control_format(). + if (private_f_utf_character_is_control(sequence)) { return F_false; } - if (private_f_utf_character_is_control_picture(character)) { + if (private_f_utf_character_is_control_picture(sequence)) { return F_false; } - if (private_f_utf_character_is_whitespace(character)) { + if (private_f_utf_character_is_whitespace(sequence)) { return F_false; } - if (private_f_utf_character_is_whitespace_modifier(character)) { + if (private_f_utf_character_is_whitespace_modifier(sequence)) { return F_false; } - if (private_f_utf_character_is_punctuation(character)) { + if (private_f_utf_character_is_punctuation(sequence)) { return F_false; } - if (private_f_utf_character_is_symbol(character)) { + if (private_f_utf_character_is_symbol(sequence)) { return F_false; } - if (private_f_utf_character_is_phonetic(character)) { + if (private_f_utf_character_is_phonetic(sequence)) { return F_false; } diff --git a/level_0/f_utf/c/private-utf_alphabetic.h b/level_0/f_utf/c/private-utf_alphabetic.h index df694eb..283142a 100644 --- a/level_0/f_utf/c/private-utf_alphabetic.h +++ b/level_0/f_utf/c/private-utf_alphabetic.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 alphabetic character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_alphabetic() */ #if !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_) - extern f_status_t private_f_utf_character_is_alphabetic(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_alphabetic(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_) /** @@ -48,8 +48,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 alphabetic or a digit character. @@ -62,7 +62,7 @@ extern "C" { * @see f_utf_is_alphabetic_digit() */ #if !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_digit_) - extern f_status_t private_f_utf_character_is_alphabetic_digit(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_alphabetic_digit(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_digit_) /** @@ -72,8 +72,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 alphabetic or a numeric character. @@ -86,7 +86,7 @@ extern "C" { * @see f_utf_is_alphabetic_numeric() */ #if !defined(_di_f_utf_character_is_alphabetic_numeric_) || !defined(_di_f_utf_is_alphabetic_numeric_) - extern f_status_t private_f_utf_character_is_alphabetic_numeric(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_alphabetic_numeric(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_alphabetic_numeric_) || !defined(_di_f_utf_is_alphabetic_numeric_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_combining.c b/level_0/f_utf/c/private-utf_combining.c index e7230b6..5c20bb3 100644 --- a/level_0/f_utf/c/private-utf_combining.c +++ b/level_0/f_utf/c/private-utf_combining.c @@ -7,104 +7,104 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_combining_) || !defined(_di_f_utf_is_combining_) - f_status_t private_f_utf_character_is_combining(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_combining(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { // Diacritical Marks: U+0300 to U+036F. - if (character >= 0xcc800000 && character <= 0xcdaf0000) { + if (sequence >= 0xcc800000 && sequence <= 0xcdaf0000) { return F_true; } // Cyrillic: U+0483 to U+0489. - if (character >= 0xd2830000 && character <= 0xd2890000) { + if (sequence >= 0xd2830000 && sequence <= 0xd2890000) { return F_true; } // Hebrew: U+0591 to U+05BD. - if (character >= 0xd6910000 && character <= 0xd6bd0000) { + if (sequence >= 0xd6910000 && sequence <= 0xd6bd0000) { return F_true; } // Hebrew: U+05C1 to U+05C7. - if (character >= 0xd7810000 && character <= 0xd7870000) { + if (sequence >= 0xd7810000 && sequence <= 0xd7870000) { return F_true; } // Arabic: U+0610 to U+061A. - if (character >= 0xd8900000 && character <= 0xd89a0000) { + if (sequence >= 0xd8900000 && sequence <= 0xd89a0000) { return F_true; } - if (macro_f_utf_char_t_to_char_1(character) == 0xd9) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xd9) { // Arabic: U+064B to U+065F. - if (character >= 0xd98b0000 && character <= 0xd99f0000) { + if (sequence >= 0xd98b0000 && sequence <= 0xd99f0000) { return F_true; } // Arabic: U+0670. - if (character == 0xd9b00000) { + if (sequence == 0xd9b00000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xdb) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xdb) { // Arabic: U+06D6 to U+06DC. - if (character >= 0xdb960000 && character <= 0xdb9c0000) { + if (sequence >= 0xdb960000 && sequence <= 0xdb9c0000) { return F_true; } // Arabic: U+06D6 to U+06DC. - if (character >= 0xdb960000 && character <= 0xdb9c0000) { + if (sequence >= 0xdb960000 && sequence <= 0xdb9c0000) { return F_true; } // Arabic: U+06DF to U+06E4. - if (character >= 0xdb9f0000 && character <= 0xdba40000) { + if (sequence >= 0xdb9f0000 && sequence <= 0xdba40000) { return F_true; } // Arabic: U+06E7 to U+06E8. - if (character >= 0xdba70000 && character <= 0xdba80000) { + if (sequence >= 0xdba70000 && sequence <= 0xdba80000) { return F_true; } // Arabic: U+06EA to U+06ED. - if (character >= 0xdbaa0000 && character <= 0xdbad0000) { + if (sequence >= 0xdbaa0000 && sequence <= 0xdbad0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xdc) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xdc) { // Syriac: U+0711. - if (character == 0xdc910000) { + if (sequence == 0xdc910000) { return F_true; } // Syriac: U+0730 to U+073F. - if (character >= 0xdcb00000 && character <= 0xdcbf0000) { + if (sequence >= 0xdcb00000 && sequence <= 0xdcbf0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xdd) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xdd) { // Syriac: U+0740 to U+074A. - if (character >= 0xdd800000 && character <= 0xdd8a0000) { + if (sequence >= 0xdd800000 && sequence <= 0xdd8a0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xde) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xde) { // Thaana: U+07A6 to U+07B0. - if (character >= 0xdea60000 && character <= 0xdeb00000) { + if (sequence >= 0xdea60000 && sequence <= 0xdeb00000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xdf) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xdf) { // NKo: U+07EB to U+07F3. - if (character >= 0xdfab0000 && character <= 0xdfb30000) { + if (sequence >= 0xdfab0000 && sequence <= 0xdfb30000) { return F_true; } } @@ -112,772 +112,772 @@ extern "C" { return F_false; } - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { - if (macro_f_utf_char_t_to_char_1(character) == 0xe0) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xe0) { // Samaritan: U+0816 to U+0819. - if (character >= 0xe0a09600 && character <= 0xe0a09900) { + if (sequence >= 0xe0a09600 && sequence <= 0xe0a09900) { return F_true; } // Samaritan: U+081B to U+0823. - if (character >= 0xe0a09b00 && character <= 0xe0a0a300) { + if (sequence >= 0xe0a09b00 && sequence <= 0xe0a0a300) { return F_true; } // Samaritan: U+0825 to U+0827. - if (character >= 0xe0a0a500 && character <= 0xe0a0a700) { + if (sequence >= 0xe0a0a500 && sequence <= 0xe0a0a700) { return F_true; } // Samaritan: U+0829. - if (character == 0xe0a0a900) { + if (sequence == 0xe0a0a900) { return F_true; } // Samaritan: U+082A to U+082D. - if (character >= 0xe0a0aa00 && character <= 0xe0a0ad00) { + if (sequence >= 0xe0a0aa00 && sequence <= 0xe0a0ad00) { return F_true; } // Mandaic: U+0859 to U+085B. - if (character >= 0xe0a19900 && character <= 0xe0a19b00) { + if (sequence >= 0xe0a19900 && sequence <= 0xe0a19b00) { return F_true; } // Arabic Extended-B: U+0898 to U+089F. - if (character >= 0xe0a29800 && character <= 0xe0a29f00) { + if (sequence >= 0xe0a29800 && sequence <= 0xe0a29f00) { return F_true; } // Arabic Extended-A: U+08CA to U+08FF. - if (character >= 0xe0a38a00 && character <= 0xe0a3bf00) { + if (sequence >= 0xe0a38a00 && sequence <= 0xe0a3bf00) { return F_true; } // Devanagari: U+0900 to U+0903. - if (character >= 0xe0a48000 && character <= 0xe0a48300) { + if (sequence >= 0xe0a48000 && sequence <= 0xe0a48300) { return F_true; } // Devanagari: U+093A to U+093C. - if (character >= 0xe0a4ba00 && character <= 0xe0a4bc00) { + if (sequence >= 0xe0a4ba00 && sequence <= 0xe0a4bc00) { return F_true; } // Devanagari: U+093E to U+094F. - if (character >= 0xe0a4be00 && character <= 0xe0a58f00) { + if (sequence >= 0xe0a4be00 && sequence <= 0xe0a58f00) { return F_true; } // Devanagari: U+0951 to U+0957. - if (character >= 0xe0a59100 && character <= 0xe0a59700) { + if (sequence >= 0xe0a59100 && sequence <= 0xe0a59700) { return F_true; } // Devanagari: U+0962 to U+0963. - if (character >= 0xe0a5a200 && character <= 0xe0a5a300) { + if (sequence >= 0xe0a5a200 && sequence <= 0xe0a5a300) { return F_true; } // Bengali: U+0981 to U+0983. - if (character >= 0xe0a68100 && character <= 0xe0a68300) { + if (sequence >= 0xe0a68100 && sequence <= 0xe0a68300) { return F_true; } // Bengali: U+09BC. - if (character == 0xe0a6bc00) { + if (sequence == 0xe0a6bc00) { return F_true; } // Bengali: U+09BE to U+09C4. - if (character >= 0xe0a6be00 && character <= 0xe0a78400) { + if (sequence >= 0xe0a6be00 && sequence <= 0xe0a78400) { return F_true; } // Bengali: U+09C7, U+09C8. - if (character == 0xe0a78700 || character == 0xe0a78800) { + if (sequence == 0xe0a78700 || sequence == 0xe0a78800) { return F_true; } // Bengali: U+09CB to U+09CD. - if (character >= 0xe0a78b00 && character <= 0xe0a78d00) { + if (sequence >= 0xe0a78b00 && sequence <= 0xe0a78d00) { return F_true; } // Bengali: U+09E2, U+09E3, U+09FE. - if (character == 0xe0a7a200 || character == 0xe0a7a300 || character == 0xe0a7be00) { + if (sequence == 0xe0a7a200 || sequence == 0xe0a7a300 || sequence == 0xe0a7be00) { return F_true; } // Gurmukhi: U+0A01 to U+0A03. - if (character >= 0xe0a88100 && character <= 0xe0a88300) { + if (sequence >= 0xe0a88100 && sequence <= 0xe0a88300) { return F_true; } // Gurmukhi: U+0A3C. - if (character == 0xe0a8bc00) { + if (sequence == 0xe0a8bc00) { return F_true; } // Gurmukhi: U+0A3E to U+0A42. - if (character >= 0xe0a8be00 && character <= 0xe0a98200) { + if (sequence >= 0xe0a8be00 && sequence <= 0xe0a98200) { return F_true; } // Gurmukhi: U+0A47 to U+0A48. - if (character >= 0xe0a98700 && character <= 0xe0a98800) { + if (sequence >= 0xe0a98700 && sequence <= 0xe0a98800) { return F_true; } // Gurmukhi: U+0A4B to U+0A4D. - if (character >= 0xe0a98b00 && character <= 0xe0a98d00) { + if (sequence >= 0xe0a98b00 && sequence <= 0xe0a98d00) { return F_true; } // Gurmukhi: U+0A51. - if (character == 0xe0a99100) { + if (sequence == 0xe0a99100) { return F_true; } // Gurmukhi: U+0A70, U+0A71, U+0A75. - if (character == 0xe0a9b000 || character == 0xe0a9b100 || character == 0xe0a9b500) { + if (sequence == 0xe0a9b000 || sequence == 0xe0a9b100 || sequence == 0xe0a9b500) { return F_true; } // Gujarati: U+0A81 to U+0A82. - if (character >= 0xe0aa8100 && character <= 0xe0aa8200) { + if (sequence >= 0xe0aa8100 && sequence <= 0xe0aa8200) { return F_true; } // Gujarati: U+0ABC. - if (character == 0xe0aabc00) { + if (sequence == 0xe0aabc00) { return F_true; } // Gujarati: U+0ABE to U+0AC5. - if (character >= 0xe0aabe00 && character <= 0xe0ab8500) { + if (sequence >= 0xe0aabe00 && sequence <= 0xe0ab8500) { return F_true; } // Gujarati: U+0AC7 to U+0AC9. - if (character >= 0xe0ab8700 && character <= 0xe0ab8900) { + if (sequence >= 0xe0ab8700 && sequence <= 0xe0ab8900) { return F_true; } // Gujarati: U+0ACB to U+0ACD. - if (character >= 0xe0ab8b00 && character <= 0xe0ab8d00) { + if (sequence >= 0xe0ab8b00 && sequence <= 0xe0ab8d00) { return F_true; } // Gujarati: U+0AE2 to U+0AE3. - if (character >= 0xe0aba200 && character <= 0xe0aba300) { + if (sequence >= 0xe0aba200 && sequence <= 0xe0aba300) { return F_true; } // Gujarati: U+0AFA to U+0AFF. - if (character >= 0xe0abba00 && character <= 0xe0abbf00) { + if (sequence >= 0xe0abba00 && sequence <= 0xe0abbf00) { return F_true; } // Oriya: U+0B01, U+0B3C, U+0B3F. - if (character == 0xe0ac8100 || character == 0xe0acbc00 || character == 0xe0acbf00) { + if (sequence == 0xe0ac8100 || sequence == 0xe0acbc00 || sequence == 0xe0acbf00) { return F_true; } // Oriya: U+0B41 to U+0B44. - if (character >= 0xe0ad8100 && character <= 0xe0ad8400) { + if (sequence >= 0xe0ad8100 && sequence <= 0xe0ad8400) { return F_true; } // Oriya: U+0B4D, U+0B56, U+0B62, U+0B63. - if (character == 0xe0ad8d00 || character == 0xe0ad9600 || character == 0xe0ada200 || character == 0xe0ada300) { + if (sequence == 0xe0ad8d00 || sequence == 0xe0ad9600 || sequence == 0xe0ada200 || sequence == 0xe0ada300) { return F_true; } // Tamil: U+0BC0, U+0BCD. - if (character == 0xe0af8000 || character == 0xe0af8d00) { + if (sequence == 0xe0af8000 || sequence == 0xe0af8d00) { return F_true; } // Telugu: U+0C00. - if (character == 0xe0b08000) { + if (sequence == 0xe0b08000) { return F_true; } // Telugu: U+0C3E to U+0C40. - if (character >= 0xe0b0be00 && character <= 0xe0b18000) { + if (sequence >= 0xe0b0be00 && sequence <= 0xe0b18000) { return F_true; } // Telugu: U+0C46 to U+0C48. - if (character >= 0xe0b18600 && character <= 0xe0b18800) { + if (sequence >= 0xe0b18600 && sequence <= 0xe0b18800) { return F_true; } // Telugu: U+0C4A to U+0C4D. - if (character >= 0xe0b18a00 && character <= 0xe0b18d00) { + if (sequence >= 0xe0b18a00 && sequence <= 0xe0b18d00) { return F_true; } // Telugu: U+0C55, U+0C56, U+0C62, U+0C63. - if (character == 0xe0b19500 || character == 0xe0b19600 || character == 0xe0b1a200 || character == 0xe0b1a300) { + if (sequence == 0xe0b19500 || sequence == 0xe0b19600 || sequence == 0xe0b1a200 || sequence == 0xe0b1a300) { return F_true; } // Kannada: U+0C81. - if (character == 0xe0b28100) { + if (sequence == 0xe0b28100) { return F_true; } // Kannada: U+0CBC to U+0CCD. - if (character >= 0xe0b2bc00 && character <= 0xe0b38d00) { + if (sequence >= 0xe0b2bc00 && sequence <= 0xe0b38d00) { return F_true; } // Kannada: U+0CE2, U+0CE3. - if (character == 0xe0b3a200 || character == 0xe0b3a300) { + if (sequence == 0xe0b3a200 || sequence == 0xe0b3a300) { return F_true; } // Malayalam: U+0D01. - if (character == 0xe0b48100) { + if (sequence == 0xe0b48100) { return F_true; } // Malayalam: U+0D41 to U+0D44. - if (character >= 0xe0b58100 && character <= 0xe0b58400) { + if (sequence >= 0xe0b58100 && sequence <= 0xe0b58400) { return F_true; } // Malayalam: U+0D4D, U+0D62, U+0D63. - if (character == 0xe0b58d00 || character == 0xe0b5a200 || character == 0xe0b5a300) { + if (sequence == 0xe0b58d00 || sequence == 0xe0b5a200 || sequence == 0xe0b5a300) { return F_true; } // Sinhala: U+0DCA. - if (character == 0xe0b78a00) { + if (sequence == 0xe0b78a00) { return F_true; } // Sinhala: U+0DD2 to U+0DD4. - if (character >= 0xe0b79200 && character <= 0xe0b79400) { + if (sequence >= 0xe0b79200 && sequence <= 0xe0b79400) { return F_true; } // Sinhala: U+0DD6. - if (character == 0xe0b79600) { + if (sequence == 0xe0b79600) { return F_true; } // Thai: U+0E31. - if (character == 0xe0b8b100) { + if (sequence == 0xe0b8b100) { return F_true; } // Thai: U+0E34 to U+0E3A. - if (character >= 0xe0b8b400 && character <= 0xe0b8ba00) { + if (sequence >= 0xe0b8b400 && sequence <= 0xe0b8ba00) { return F_true; } // Thai: U+0E47 to U+0E4E. - if (character >= 0xe0b98700 && character <= 0xe0b98e00) { + if (sequence >= 0xe0b98700 && sequence <= 0xe0b98e00) { return F_true; } // Lao: U+0EB1. - if (character == 0xe0bab100) { + if (sequence == 0xe0bab100) { return F_true; } // Lao: U+0EB4 to U+0EB9. - if (character >= 0xe0bab400 && character <= 0xe0bab900) { + if (sequence >= 0xe0bab400 && sequence <= 0xe0bab900) { return F_true; } // Lao: U+0EBB, U+0EBC. - if (character == 0xe0babb00 || character == 0xe0babc00) { + if (sequence == 0xe0babb00 || sequence == 0xe0babc00) { return F_true; } // Tibetan: U+0F18 to U+0F19. - if (character >= 0xe0bc9800 && character <= 0xe0bc9900) { + if (sequence >= 0xe0bc9800 && sequence <= 0xe0bc9900) { return F_true; } // Tibetan: U+0F35, U+0F37, U+0F39. - if (character == 0xe0bcb500 || character == 0xe0bcb700 || character == 0xe0bcb900) { + if (sequence == 0xe0bcb500 || sequence == 0xe0bcb700 || sequence == 0xe0bcb900) { return F_true; } // Tibetan: U+0F71 to U+0F7E. - if (character >= 0xe0bdb100 && character <= 0xe0bdbe00) { + if (sequence >= 0xe0bdb100 && sequence <= 0xe0bdbe00) { return F_true; } // Tibetan: U+0F80 to U+0F84. - if (character >= 0xe0be8000 && character <= 0xe0be8400) { + if (sequence >= 0xe0be8000 && sequence <= 0xe0be8400) { return F_true; } // Tibetan: U+0F86 to U+0F87. - if (character >= 0xe0be8600 && character <= 0xe0be8700) { + if (sequence >= 0xe0be8600 && sequence <= 0xe0be8700) { return F_true; } // Tibetan: U+0F8D to U+0F97. - if (character >= 0xe0be8d00 && character <= 0xe0be9700) { + if (sequence >= 0xe0be8d00 && sequence <= 0xe0be9700) { return F_true; } // Tibetan: U+0F99 to U+0FBC. - if (character >= 0xe0be9900 && character <= 0xe0bebc00) { + if (sequence >= 0xe0be9900 && sequence <= 0xe0bebc00) { return F_true; } // Tibetan: U+0FC6. - if (character == 0xe0bf8600) { + if (sequence == 0xe0bf8600) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe1) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe1) { // Myanmar: U+102D to U+1030. - if (character >= 0xe180ad00 && character <= 0xe180b000) { + if (sequence >= 0xe180ad00 && sequence <= 0xe180b000) { return F_true; } // Myanmar: U+1039 to U+103A. - if (character >= 0xe180b900 && character <= 0xe180ba00) { + if (sequence >= 0xe180b900 && sequence <= 0xe180ba00) { return F_true; } // Myanmar: U+103D to U+103E. - if (character >= 0xe180bd00 && character <= 0xe180be00) { + if (sequence >= 0xe180bd00 && sequence <= 0xe180be00) { return F_true; } // Myanmar: U+1058 to U+1059. - if (character >= 0xe1819800 && character <= 0xe1819900) { + if (sequence >= 0xe1819800 && sequence <= 0xe1819900) { return F_true; } // Myanmar: U+105E to U+1060. - if (character >= 0xe1819e00 && character <= 0xe181a000) { + if (sequence >= 0xe1819e00 && sequence <= 0xe181a000) { return F_true; } // Myanmar: U+1071 to U+1074. - if (character >= 0xe181b100 && character <= 0xe181b400) { + if (sequence >= 0xe181b100 && sequence <= 0xe181b400) { return F_true; } // Myanmar: U+1082, U+1085, U+1086, U+108D. - if (character == 0xe1828200 || character == 0xe1828500 || character == 0xe1828600 || character == 0xe1828d00) { + if (sequence == 0xe1828200 || sequence == 0xe1828500 || sequence == 0xe1828600 || sequence == 0xe1828d00) { return F_true; } // Myanmar: U+109D. - if (character == 0xe1829d00) { + if (sequence == 0xe1829d00) { return F_true; } // Ethiopic: U+135D to U+135F. - if (character >= 0xe18d9d00 && character <= 0xe18d9f00) { + if (sequence >= 0xe18d9d00 && sequence <= 0xe18d9f00) { return F_true; } // Tagalog: U+1712 to U+1714. - if (character >= 0xe19c9200 && character <= 0xe19c9400) { + if (sequence >= 0xe19c9200 && sequence <= 0xe19c9400) { return F_true; } // Hanunoo: U+1732 to U+1734. - if (character >= 0xe19cb200 && character <= 0xe19cb400) { + if (sequence >= 0xe19cb200 && sequence <= 0xe19cb400) { return F_true; } // Buhid: U+1752 to U+1753. - if (character >= 0xe19d9200 && character <= 0xe19d9300) { + if (sequence >= 0xe19d9200 && sequence <= 0xe19d9300) { return F_true; } // Tagbanwa: U+1772 to U+1773. - if (character >= 0xe19db200 && character <= 0xe19db300) { + if (sequence >= 0xe19db200 && sequence <= 0xe19db300) { return F_true; } // Khmer: U+17B4 to U+17B5. - if (character >= 0xe19eb400 && character <= 0xe19eb500) { + if (sequence >= 0xe19eb400 && sequence <= 0xe19eb500) { return F_true; } // Khmer: U+17B7 to U+17BD. - if (character >= 0xe19eb700 && character <= 0xe19ebd00) { + if (sequence >= 0xe19eb700 && sequence <= 0xe19ebd00) { return F_true; } // Khmer: U+17C6, U+17C9. - if (character == 0xe19f8600 || character == 0xe19f8900) { + if (sequence == 0xe19f8600 || sequence == 0xe19f8900) { return F_true; } // Khmer: U+17CA to U+17D3. - if (character >= 0xe19f8a00 && character <= 0xe19f9300) { + if (sequence >= 0xe19f8a00 && sequence <= 0xe19f9300) { return F_true; } // Khmer: U+17DD. - if (character == 0xe19f9d00) { + if (sequence == 0xe19f9d00) { return F_true; } // Mongolian: U+180B to U+180D. - if (character >= 0xe1a08b00 && character <= 0xe1a08d00) { + if (sequence >= 0xe1a08b00 && sequence <= 0xe1a08d00) { return F_true; } // Mongolian: U+18A9. - if (character == 0xe1a2a900) { + if (sequence == 0xe1a2a900) { return F_true; } // Mongolian: U+1920 to U+1922. - if (character >= 0xe1a4a000 && character <= 0xe1a4a200) { + if (sequence >= 0xe1a4a000 && sequence <= 0xe1a4a200) { return F_true; } // Limbu: U+1927, U+1928, U+1932. - if (character == 0xe1a4a700 || character == 0xe1a4a800 || character == 0xe1a4b200) { + if (sequence == 0xe1a4a700 || sequence == 0xe1a4a800 || sequence == 0xe1a4b200) { return F_true; } // Limbu: U+1939 to U+193B. - if (character >= 0xe1a4b900 && character <= 0xe1a4bb00) { + if (sequence >= 0xe1a4b900 && sequence <= 0xe1a4bb00) { return F_true; } // Buginese: U+1A17 to U+1A18. - if (character >= 0xe1a89700 && character <= 0xe1a89800) { + if (sequence >= 0xe1a89700 && sequence <= 0xe1a89800) { return F_true; } // Buginese: U+1A1B. - if (character == 0xe1a89b00) { + if (sequence == 0xe1a89b00) { return F_true; } // Tai Tham: U+1A56. - if (character == 0xe1a99600) { + if (sequence == 0xe1a99600) { return F_true; } // Tai Tham: U+1A58 to U+1A5E. - if (character >= 0xe1a99800 && character <= 0xe1a99e00) { + if (sequence >= 0xe1a99800 && sequence <= 0xe1a99e00) { return F_true; } // Tai Tham: U+1A60, U+1A62. - if (character == 0xe1a9a000 || character == 0xe1a9a200) { + if (sequence == 0xe1a9a000 || sequence == 0xe1a9a200) { return F_true; } // Tai Tham: U+1A65 to U+1A6C. - if (character >= 0xe1a9a500 && character <= 0xe1a9ac00) { + if (sequence >= 0xe1a9a500 && sequence <= 0xe1a9ac00) { return F_true; } // Tai Tham: U+1A73 to U+1A7C. - if (character >= 0xe1a9b300 && character <= 0xe1a9bc00) { + if (sequence >= 0xe1a9b300 && sequence <= 0xe1a9bc00) { return F_true; } // Tai Tham: U+1A7F. - if (character == 0xe1a9bf00) { + if (sequence == 0xe1a9bf00) { return F_true; } // Diacritical Marks Extended: U+1AB0 to U+1ACE. - if (character >= 0xe1aab000 && character <= 0xe1ab8e00) { + if (sequence >= 0xe1aab000 && sequence <= 0xe1ab8e00) { return F_true; } // Balinese: U+1B00 to U+1B03. - if (character >= 0xe1ac8000 && character <= 0xe1ac8300) { + if (sequence >= 0xe1ac8000 && sequence <= 0xe1ac8300) { return F_true; } // Balinese: U+1B34. - if (character == 0xe1acb400) { + if (sequence == 0xe1acb400) { return F_true; } // Balinese: U+1B36 to U+1B3A. - if (character >= 0xe1acb600 && character <= 0xe1acba00) { + if (sequence >= 0xe1acb600 && sequence <= 0xe1acba00) { return F_true; } // Balinese: U+1B3C, U+1B42. - if (character == 0xe1acbc00 || character == 0xe1ad8200) { + if (sequence == 0xe1acbc00 || sequence == 0xe1ad8200) { return F_true; } // Balinese: U+1B6B to U+1B73. - if (character >= 0xe1adab00 && character <= 0xe1adb300) { + if (sequence >= 0xe1adab00 && sequence <= 0xe1adb300) { return F_true; } // Sundanese: U+1B80 to U+1B81. - if (character >= 0xe1ae8000 && character <= 0xe1ae8100) { + if (sequence >= 0xe1ae8000 && sequence <= 0xe1ae8100) { return F_true; } // Sundanese: U+1BA2 to U+1BA5. - if (character >= 0xe1aea200 && character <= 0xe1aea500) { + if (sequence >= 0xe1aea200 && sequence <= 0xe1aea500) { return F_true; } // Sundanese: U+1BA8 to U+1BA9. - if (character >= 0xe1aea800 && character <= 0xe1aea900) { + if (sequence >= 0xe1aea800 && sequence <= 0xe1aea900) { return F_true; } // Sundanese: U+1BAB to U+1BAD. - if (character >= 0xe1aeab00 && character <= 0xe1aead00) { + if (sequence >= 0xe1aeab00 && sequence <= 0xe1aead00) { return F_true; } // Batak: U+1BE6, U+1BE8, U+1BE9, U+1BED. - if (character == 0xe1afa600 || character == 0xe1afa800 || character == 0xe1afa900 || character == 0xe1afad00) { + if (sequence == 0xe1afa600 || sequence == 0xe1afa800 || sequence == 0xe1afa900 || sequence == 0xe1afad00) { return F_true; } // Batak: U+1BEF, U+1BF0, U+1BF1. - if (character == 0xe1afaf00 || character == 0xe1afb000 || character == 0xe1afb100) { + if (sequence == 0xe1afaf00 || sequence == 0xe1afb000 || sequence == 0xe1afb100) { return F_true; } // Lepcha: U+1C2C to U+1C33. - if (character >= 0xe1b0ac00 && character <= 0xe1b0b300) { + if (sequence >= 0xe1b0ac00 && sequence <= 0xe1b0b300) { return F_true; } // Lepcha: U+1C36 to U+1C37. - if (character >= 0xe1b0b600 && character <= 0xe1b0b700) { + if (sequence >= 0xe1b0b600 && sequence <= 0xe1b0b700) { return F_true; } // Vedic Extensions: U+1CD4 to U+1CD2. - if (character >= 0xe1b39400 && character <= 0xe1b39200) { + if (sequence >= 0xe1b39400 && sequence <= 0xe1b39200) { return F_true; } // Vedic Extensions: U+1CD0 to U+1CE0. - if (character >= 0xe1b39000 && character <= 0xe1b3a000) { + if (sequence >= 0xe1b39000 && sequence <= 0xe1b3a000) { return F_true; } // Vedic Extensions: U+1CE2 to U+1CE8. - if (character >= 0xe1b3a200 && character <= 0xe1b3a800) { + if (sequence >= 0xe1b3a200 && sequence <= 0xe1b3a800) { return F_true; } // Vedic Extensions: U+1CED, U+1CF4, U+1CF8, U+1CF9. - if (character == 0xe1b3ad00 || character == 0xe1b3b400 || character == 0xe1b3b800 || character == 0xe1b3b900) { + if (sequence == 0xe1b3ad00 || sequence == 0xe1b3b400 || sequence == 0xe1b3b800 || sequence == 0xe1b3b900) { return F_true; } // Vedic Extensions: U+1DC0 to U+1CE8. - if (character >= 0xe1b78000 && character <= 0xe1b3a800) { + if (sequence >= 0xe1b78000 && sequence <= 0xe1b3a800) { return F_true; } // Diacritical Marks Supplement: U+1DC0 to U+1DFF. - if (character >= 0xe1b78000 && character <= 0xe1b7bf00) { + if (sequence >= 0xe1b78000 && sequence <= 0xe1b7bf00) { return F_true; } // Diacritical Marks Supplement: U+1DFB to U+1DFF. - if (character >= 0xe1b7bb00 && character <= 0xe1b7bf00) { + if (sequence >= 0xe1b7bb00 && sequence <= 0xe1b7bf00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe2) { // Diacritical Marks For Symbols: U+20D0 to U+20F0. - if (character >= 0xe2839000 && character <= 0xe283b000) { + if (sequence >= 0xe2839000 && sequence <= 0xe283b000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe3) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe3) { // CJK Symbols and Punctuation: U+302A to U+302D. - if (character >= 0xe380aa00 && character <= 0xe380ad00) { + if (sequence >= 0xe380aa00 && sequence <= 0xe380ad00) { return F_true; } // Hiragana: U+3099, U+309A. - if (character == 0xe3829900 || character == 0xe3829a00) { + if (sequence == 0xe3829900 || sequence == 0xe3829a00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xea) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xea) { // Cyrillic Extended-B: U+3099. - if (character == 0xea99af00) { + if (sequence == 0xea99af00) { return F_true; } // Cyrillic Extended-B: U+A66F to U+A672. - if (character >= 0xea99af00 && character <= 0xea99b200) { + if (sequence >= 0xea99af00 && sequence <= 0xea99b200) { return F_true; } // Cyrillic Extended-B: U+A674 to U+A69F. - if (character >= 0xea99b400 && character <= 0xea9a9f00) { + if (sequence >= 0xea99b400 && sequence <= 0xea9a9f00) { return F_true; } // Bamum: U+A6F0 to U+A6F1. - if (character >= 0xea9bb000 && character <= 0xea9bb100) { + if (sequence >= 0xea9bb000 && sequence <= 0xea9bb100) { return F_true; } // Syloti Nagri: U+A802, U+A806, U+A80B, U+A825. - if (character == 0xeaa08200 || character == 0xeaa08600 || character == 0xeaa08b00 || character == 0xeaa0a500) { + if (sequence == 0xeaa08200 || sequence == 0xeaa08600 || sequence == 0xeaa08b00 || sequence == 0xeaa0a500) { return F_true; } // Syloti Nagri: U+A826. - if (character == 0xeaa0a600) { + if (sequence == 0xeaa0a600) { return F_true; } // Saurashtra: U+A8C4, U+A8C5. - if (character == 0xeaa38400 || character == 0xeaa38500) { + if (sequence == 0xeaa38400 || sequence == 0xeaa38500) { return F_true; } // Devanagari Extended: U+A8E0 to U+A8F1. - if (character >= 0xeaa3a000 && character <= 0xeaa3b100) { + if (sequence >= 0xeaa3a000 && sequence <= 0xeaa3b100) { return F_true; } // Kayah Li: U+A926 to U+A92D. - if (character >= 0xeaa4a600 && character <= 0xeaa4ad00) { + if (sequence >= 0xeaa4a600 && sequence <= 0xeaa4ad00) { return F_true; } // Rejang: U+A947 to U+A951. - if (character >= 0xeaa58700 && character <= 0xeaa59100) { + if (sequence >= 0xeaa58700 && sequence <= 0xeaa59100) { return F_true; } // Javanese: U+A980 to U+A982. - if (character >= 0xeaa68000 && character <= 0xeaa68200) { + if (sequence >= 0xeaa68000 && sequence <= 0xeaa68200) { return F_true; } // Javanese: U+A9B3. - if (character == 0xeaa6b300) { + if (sequence == 0xeaa6b300) { return F_true; } // Javanese: U+A9B6 to U+A9B9. - if (character >= 0xeaa6b600 && character <= 0xeaa6b900) { + if (sequence >= 0xeaa6b600 && sequence <= 0xeaa6b900) { return F_true; } // Javanese: U+A9BC. - if (character == 0xeaa6bc00) { + if (sequence == 0xeaa6bc00) { return F_true; } // Myanmar Extended-B: U+A9E5. - if (character == 0xeaa7a500) { + if (sequence == 0xeaa7a500) { return F_true; } // Cham: U+AA29 to U+AA2E. - if (character >= 0xeaa8a900 && character <= 0xeaa8ae00) { + if (sequence >= 0xeaa8a900 && sequence <= 0xeaa8ae00) { return F_true; } // Cham: U+AA31 to U+AA32. - if (character >= 0xeaa8b100 && character <= 0xeaa8b200) { + if (sequence >= 0xeaa8b100 && sequence <= 0xeaa8b200) { return F_true; } // Cham: U+AA35 to U+AA36. - if (character >= 0xeaa8b500 && character <= 0xeaa8b600) { + if (sequence >= 0xeaa8b500 && sequence <= 0xeaa8b600) { return F_true; } // Cham: U+AA43, U+AA4C. - if (character == 0xeaa98300 || character == 0xeaa98c00) { + if (sequence == 0xeaa98300 || sequence == 0xeaa98c00) { return F_true; } // Tai Viet: U+AA7C. - if (character == 0xeaa9bc00) { + if (sequence == 0xeaa9bc00) { return F_true; } // Tai Viet: U+AAB0. - if (character == 0xeaaab000) { + if (sequence == 0xeaaab000) { return F_true; } // Tai Viet: U+AAB2 to U+AAB4. - if (character >= 0xeaaab200 && character <= 0xeaaab400) { + if (sequence >= 0xeaaab200 && sequence <= 0xeaaab400) { return F_true; } // Tai Viet: U+AAB7 to U+AAB8. - if (character >= 0xeaaab700 && character <= 0xeaaab800) { + if (sequence >= 0xeaaab700 && sequence <= 0xeaaab800) { return F_true; } // Tai Viet: U+AABE to U+AABF. - if (character >= 0xeaaabe00 && character <= 0xeaaabf00) { + if (sequence >= 0xeaaabe00 && sequence <= 0xeaaabf00) { return F_true; } // Tai Viet: U+AAC1. - if (character == 0xeaab8100) { + if (sequence == 0xeaab8100) { return F_true; } // Meetei Mayek Extensions: U+AAEC, U+AAED, U+AAF6. - if (character == 0xeaabac00 || character == 0xeaabad00 || character == 0xeaabb600) { + if (sequence == 0xeaabac00 || sequence == 0xeaabad00 || sequence == 0xeaabb600) { return F_true; } // Meetei Mayek: U+ABE5, U+ABE8, U+ABED. - if (character == 0xeaafa500 || character == 0xeaafa800 || character == 0xeaafad00) { + if (sequence == 0xeaafa500 || sequence == 0xeaafa800 || sequence == 0xeaafad00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xef) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xef) { // Alphabetic Presentation Forms: U+FB1E. - if (character == 0xefac9e00) { + if (sequence == 0xefac9e00) { return F_true; } // Variation Selectors: U+FE00 to U+FE0F. - if (character >= 0xefb88000 && character <= 0xefb88f00) { + if (sequence >= 0xefb88000 && sequence <= 0xefb88f00) { return F_true; } // Variation Selectors: U+FE20 to U+FE0F. - if (character >= 0xefb88000 && character <= 0xefb88f00) { + if (sequence >= 0xefb88000 && sequence <= 0xefb88f00) { return F_true; } // Combining Half Marks: U+FE20 to U+FE2F. - if (character >= 0xefb8a000 && character <= 0xefb8af00) { + if (sequence >= 0xefb8a000 && sequence <= 0xefb8af00) { return F_true; } } @@ -886,297 +886,297 @@ extern "C" { } // Phaistos Disc: U+101FD. - if (character == 0xf09087bd) { + if (sequence == 0xf09087bd) { return F_true; } // Coptic Epact Numbers: U+102E0. - if (character == 0xf0908ba0) { + if (sequence == 0xf0908ba0) { return F_true; } // Old Permic: U+10376 to U+1037A. - if (character >= 0xf0908db6 && character <= 0xf0908dba) { + if (sequence >= 0xf0908db6 && sequence <= 0xf0908dba) { return F_true; } // Kharoshthi: U+10A01 to U+10A03. - if (character >= 0xf090a881 && character <= 0xf090a883) { + if (sequence >= 0xf090a881 && sequence <= 0xf090a883) { return F_true; } // Kharoshthi: U+10A01, U+10A03, U+10A05, U+10A06. - if (character == 0xf090a881 || character == 0xf090a883 || character == 0xf090a885 || character == 0xf090a886) { + if (sequence == 0xf090a881 || sequence == 0xf090a883 || sequence == 0xf090a885 || sequence == 0xf090a886) { return F_true; } // Kharoshthi: U+10A0C to U+10A0F. - if (character >= 0xf090a88c && character <= 0xf090a88f) { + if (sequence >= 0xf090a88c && sequence <= 0xf090a88f) { return F_true; } // Kharoshthi: U+10A38 to U+10A3A. - if (character >= 0xf090a8b8 && character <= 0xf090a8ba) { + if (sequence >= 0xf090a8b8 && sequence <= 0xf090a8ba) { return F_true; } // Kharoshthi: U+10A3F. - if (character == 0xf090a8bf) { + if (sequence == 0xf090a8bf) { return F_true; } // Manichaean: U+10AE5, U+10AE6. - if (character == 0xf090aba5 || character == 0xf090aba6) { + if (sequence == 0xf090aba5 || sequence == 0xf090aba6) { return F_true; } // Brahmi: U+11001. - if (character == 0xf0918081) { + if (sequence == 0xf0918081) { return F_true; } // Brahmi: U+11038 to U+11046. - if (character >= 0xf09180b8 && character <= 0xf0918186) { + if (sequence >= 0xf09180b8 && sequence <= 0xf0918186) { return F_true; } // Brahmi .. Kaithi: U+1107F to U+11081. - if (character >= 0xf09181bf && character <= 0xf0918281) { + if (sequence >= 0xf09181bf && sequence <= 0xf0918281) { return F_true; } // Kaithi: U+110B3 to U+110B6. - if (character >= 0xf09182b3 && character <= 0xf09182b6) { + if (sequence >= 0xf09182b3 && sequence <= 0xf09182b6) { return F_true; } // Kaithi: U+110B9, U+110BA. - if (character == 0xf09182b9 || character == 0xf09182ba) { + if (sequence == 0xf09182b9 || sequence == 0xf09182ba) { return F_true; } // Chakma: U+11100 to U+11102. - if (character >= 0xf0918480 && character <= 0xf0918482) { + if (sequence >= 0xf0918480 && sequence <= 0xf0918482) { return F_true; } // Chakma: U+11127 to U+1112B. - if (character >= 0xf09184a7 && character <= 0xf09184ab) { + if (sequence >= 0xf09184a7 && sequence <= 0xf09184ab) { return F_true; } // Chakma: U+1112D to U+11134. - if (character >= 0xf09184ad && character <= 0xf09184b4) { + if (sequence >= 0xf09184ad && sequence <= 0xf09184b4) { return F_true; } // Mahajani: U+11173. - if (character == 0xf09185b3) { + if (sequence == 0xf09185b3) { return F_true; } // Sharada: U+11180 to U+11181. - if (character >= 0xf0918680 && character <= 0xf0918681) { + if (sequence >= 0xf0918680 && sequence <= 0xf0918681) { return F_true; } // Sharada: U+111B6 to U+111BE. - if (character >= 0xf09186b6 && character <= 0xf09186be) { + if (sequence >= 0xf09186b6 && sequence <= 0xf09186be) { return F_true; } // Sharada: U+111CA to U+111CC. - if (character >= 0xf091878a && character <= 0xf091878c) { + if (sequence >= 0xf091878a && sequence <= 0xf091878c) { return F_true; } // Sharada: U+111CA to U+111CC. - if (character >= 0xf091878a && character <= 0xf091878c) { + if (sequence >= 0xf091878a && sequence <= 0xf091878c) { return F_true; } // Khojki: U+1122F to U+11231. - if (character >= 0xf09188af && character <= 0xf09188b1) { + if (sequence >= 0xf09188af && sequence <= 0xf09188b1) { return F_true; } // Khojki: U+11234, U+11236, U+11237. - if (character == 0xf09188b4 || character == 0xf09188b6 || character == 0xf09188b7) { + if (sequence == 0xf09188b4 || sequence == 0xf09188b6 || sequence == 0xf09188b7) { return F_true; } // Khudawadi: U+112DF, U+112DF. - if (character == 0xf0918b9f || character == 0xf0918b9f) { + if (sequence == 0xf0918b9f || sequence == 0xf0918b9f) { return F_true; } // Khojki: U+112E3 to U+112EA. - if (character >= 0xf0918ba3 && character <= 0xf0918baa) { + if (sequence >= 0xf0918ba3 && sequence <= 0xf0918baa) { return F_true; } // Grantha: U+11300, U+11301, U+1133C, U+11340. - if (character == 0xf0918c80 || character == 0xf0918c81 || character == 0xf0918cbc || character == 0xf0918d80) { + if (sequence == 0xf0918c80 || sequence == 0xf0918c81 || sequence == 0xf0918cbc || sequence == 0xf0918d80) { return F_true; } // Grantha: U+11366 to U+1136C. - if (character >= 0xf0918da6 && character <= 0xf0918dac) { + if (sequence >= 0xf0918da6 && sequence <= 0xf0918dac) { return F_true; } // Grantha: U+11370 to U+11374. - if (character >= 0xf0918db0 && character <= 0xf0918db4) { + if (sequence >= 0xf0918db0 && sequence <= 0xf0918db4) { return F_true; } // Tirhuta: U+114B3 to U+114B8. - if (character >= 0xf09192b3 && character <= 0xf09192b8) { + if (sequence >= 0xf09192b3 && sequence <= 0xf09192b8) { return F_true; } // Tirhuta: U+114BA, U+114BF, U+114C0, U+114C2. - if (character == 0xf09192ba || character == 0xf09192bf || character == 0xf0919380 || character == 0xf0919382) { + if (sequence == 0xf09192ba || sequence == 0xf09192bf || sequence == 0xf0919380 || sequence == 0xf0919382) { return F_true; } // Tirhuta: U+114C3. - if (character == 0xf0919383) { + if (sequence == 0xf0919383) { return F_true; } // Siddham: U+115B2 to U+115B5. - if (character >= 0xf09196b2 && character <= 0xf09196b5) { + if (sequence >= 0xf09196b2 && sequence <= 0xf09196b5) { return F_true; } // Siddham: U+115BC to U+115BD. - if (character >= 0xf09196bc && character <= 0xf09196bd) { + if (sequence >= 0xf09196bc && sequence <= 0xf09196bd) { return F_true; } // Siddham: U+115BF, U+115C0, U+115DC, U+115DD. - if (character == 0xf09196bf || character == 0xf0919780 || character == 0xf091979c || character == 0xf091979d) { + if (sequence == 0xf09196bf || sequence == 0xf0919780 || sequence == 0xf091979c || sequence == 0xf091979d) { return F_true; } // Modi: U+11633 to U+1163A. - if (character >= 0xf09198b3 && character <= 0xf09198ba) { + if (sequence >= 0xf09198b3 && sequence <= 0xf09198ba) { return F_true; } // Modi: U+1163D to U+11640. - if (character >= 0xf09198bd && character <= 0xf0919980) { + if (sequence >= 0xf09198bd && sequence <= 0xf0919980) { return F_true; } // Takri: U+116AB, U+116AD. - if (character == 0xf0919aab || character == 0xf0919aad) { + if (sequence == 0xf0919aab || sequence == 0xf0919aad) { return F_true; } // Takri: U+116B0 to U+116B5. - if (character >= 0xf0919ab0 && character <= 0xf0919ab5) { + if (sequence >= 0xf0919ab0 && sequence <= 0xf0919ab5) { return F_true; } // Takri: U+116B7. - if (character == 0xf0919ab7) { + if (sequence == 0xf0919ab7) { return F_true; } // Ahom: U+1171D to U+1171F. - if (character >= 0xf0919c9d && character <= 0xf0919c9f) { + if (sequence >= 0xf0919c9d && sequence <= 0xf0919c9f) { return F_true; } // Ahom: U+11722 to U+11725. - if (character >= 0xf0919ca2 && character <= 0xf0919ca5) { + if (sequence >= 0xf0919ca2 && sequence <= 0xf0919ca5) { return F_true; } // Ahom: U+11727 to U+1172B. - if (character >= 0xf0919ca7 && character <= 0xf0919cab) { + if (sequence >= 0xf0919ca7 && sequence <= 0xf0919cab) { return F_true; } // Bassa Vah: U+16AF0 to U+16AF4. - if (character >= 0xf096abb0 && character <= 0xf096abb4) { + if (sequence >= 0xf096abb0 && sequence <= 0xf096abb4) { return F_true; } // Pahawh Hmong: U+16B30 to U+16B36. - if (character >= 0xf096acb0 && character <= 0xf096acb6) { + if (sequence >= 0xf096acb0 && sequence <= 0xf096acb6) { return F_true; } // Miao: U+16F8F to U+16F92. - if (character >= 0xf096be8f && character <= 0xf096be92) { + if (sequence >= 0xf096be8f && sequence <= 0xf096be92) { return F_true; } // Duployan: U+1BC9D to U+1BC9E. - if (character >= 0xf09bb29d && character <= 0xf09bb29e) { + if (sequence >= 0xf09bb29d && sequence <= 0xf09bb29e) { return F_true; } // Musical Symbols: U+1D167 to U+1D169. - if (character >= 0xf09d85a7 && character <= 0xf09d85a9) { + if (sequence >= 0xf09d85a7 && sequence <= 0xf09d85a9) { return F_true; } // Musical Symbols: U+1D17B to U+1D182. - if (character >= 0xf09d85bb && character <= 0xf09d8682) { + if (sequence >= 0xf09d85bb && sequence <= 0xf09d8682) { return F_true; } // Musical Symbols: U+1D185 to U+1D18B. - if (character >= 0xf09d8685 && character <= 0xf09d868b) { + if (sequence >= 0xf09d8685 && sequence <= 0xf09d868b) { return F_true; } // Musical Symbols: U+1D1AA to U+1D1AD. - if (character >= 0xf09d86aa && character <= 0xf09d86ad) { + if (sequence >= 0xf09d86aa && sequence <= 0xf09d86ad) { return F_true; } // Ancient Greek Musical Notation: U+1D242 to U+1D244. - if (character >= 0xf09d8982 && character <= 0xf09d8984) { + if (sequence >= 0xf09d8982 && sequence <= 0xf09d8984) { return F_true; } // Sutton SignWriting: U+1DA00 to U+1DA36. - if (character >= 0xf09da880 && character <= 0xf09da8b6) { + if (sequence >= 0xf09da880 && sequence <= 0xf09da8b6) { return F_true; } // Sutton SignWriting: U+1DA3B to U+1DA6C. - if (character >= 0xf09da8bb && character <= 0xf09da9ac) { + if (sequence >= 0xf09da8bb && sequence <= 0xf09da9ac) { return F_true; } // Sutton SignWriting: U+1DA75, U+1DA84. - if (character == 0xf09da9b5 || character == 0xf09daa84) { + if (sequence == 0xf09da9b5 || sequence == 0xf09daa84) { return F_true; } // Sutton SignWriting: U+1DA9B to U+1DA9F. - if (character >= 0xf09daa9b && character <= 0xf09daa9f) { + if (sequence >= 0xf09daa9b && sequence <= 0xf09daa9f) { return F_true; } // Sutton SignWriting: U+1DAA1 to U+1DAAF. - if (character >= 0xf09daaa1 && character <= 0xf09daaaf) { + if (sequence >= 0xf09daaa1 && sequence <= 0xf09daaaf) { return F_true; } // Mende Kikakui: U+1E8D0 to U+1E8D6. - if (character >= 0xf09ea390 && character <= 0xf09ea396) { + if (sequence >= 0xf09ea390 && sequence <= 0xf09ea396) { return F_true; } // Variation Selectors Supplement: U+E0100 to U+E01EF. - if (character >= 0xf3a08480 && character <= 0xf3a087af) { + if (sequence >= 0xf3a08480 && sequence <= 0xf3a087af) { return F_true; } diff --git a/level_0/f_utf/c/private-utf_combining.h b/level_0/f_utf/c/private-utf_combining.h index c5a23e7..02c16fc 100644 --- a/level_0/f_utf/c/private-utf_combining.h +++ b/level_0/f_utf/c/private-utf_combining.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 combining character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_combining() */ #if !defined(_di_f_utf_character_is_combining_) || !defined(_di_f_utf_is_combining_) - extern f_status_t private_f_utf_character_is_combining(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_combining(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_combining_) || !defined(_di_f_utf_is_combining_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_control.c b/level_0/f_utf/c/private-utf_control.c index 0e8fda5..a1a201b 100644 --- a/level_0/f_utf/c/private-utf_control.c +++ b/level_0/f_utf/c/private-utf_control.c @@ -7,83 +7,83 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_control_) || !defined(_di_f_utf_is_control_) - f_status_t private_f_utf_character_is_control(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_control(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { // Control Codes. // Latin-1 Supplement: U+0080 to U+009F. - if (character >= 0xc2800000 && character <= 0xc29f0000) { + if (sequence >= 0xc2800000 && sequence <= 0xc29f0000) { return F_true; } // Control Formats. // Latin-1 Supplement: U+00AD. - if (character == 0xc2ad0000) { + if (sequence == 0xc2ad0000) { return F_true; } // Arabic: U+0600 to U+0605. - if (character >= 0xd8800000 && character <= 0xd8850000) { + if (sequence >= 0xd8800000 && sequence <= 0xd8850000) { return F_true; } // Arabic: U+061C, U+06DD. - if (character == 0xd89c0000 || character == 0xdb9d0000) { + if (sequence == 0xd89c0000 || sequence == 0xdb9d0000) { return F_true; } // Syriac: U+070F. - if (character == 0xdc8f0000) { + if (sequence == 0xdc8f0000) { return F_true; } return F_false; } - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { // Control Formats. // Arabic Extended-A: U+08E2. - if (character == 0xe0a3a200) { + if (sequence == 0xe0a3a200) { return F_true; } // Mongolian: U+180E. - if (character == 0xe1a08e00) { + if (sequence == 0xe1a08e00) { return F_true; } // General Punctuation: U+200B to U+200F. - if (character >= 0xe2808b00 && character <= 0xe2808f00) { + if (sequence >= 0xe2808b00 && sequence <= 0xe2808f00) { return F_true; } // General Punctuation: U+202A to U+202E. - if (character >= 0xe280aa00 && character <= 0xe280ae00) { + if (sequence >= 0xe280aa00 && sequence <= 0xe280ae00) { return F_true; } // General Punctuation: U+2060 to U+2064. - if (character >= 0xe281a000 && character <= 0xe281a400) { + if (sequence >= 0xe281a000 && sequence <= 0xe281a400) { return F_true; } // General Punctuation: U+2066 to U+206F. - if (character >= 0xe281a600 && character <= 0xe281af00) { + if (sequence >= 0xe281a600 && sequence <= 0xe281af00) { return F_true; } // Arabic Presentation Forms-B: U+FEFF. - if (character == 0xefbbbf00) { + if (sequence == 0xefbbbf00) { return F_true; } // Specials: U+FFF9 to U+FFFB. - if (character >= 0xefbfb900 && character <= 0xefbfbb00) { + if (sequence >= 0xefbfb900 && sequence <= 0xefbfbb00) { return F_true; } @@ -93,32 +93,32 @@ extern "C" { // Control Formats. // Kaithi: U+110BD, U+110CD. - if (character == 0xf09182bd || character == 0xf091838d) { + if (sequence == 0xf09182bd || sequence == 0xf091838d) { return F_true; } // Egyptian Hieroglyphics: U+13430 to U+13438. - if (character >= 0xf09390b0 && character <= 0xf09390b8) { + if (sequence >= 0xf09390b0 && sequence <= 0xf09390b8) { return F_true; } // Shorthand Format Controls: U+1BCA0 to U+1BCA3. - if (character >= 0xf09bb2a0 && character <= 0xf09bb2a3) { + if (sequence >= 0xf09bb2a0 && sequence <= 0xf09bb2a3) { return F_true; } // Music Symbols: U+1D173 to U+1D17A. - if (character >= 0xf09d85b3 && character <= 0xf09d85ba) { + if (sequence >= 0xf09d85b3 && sequence <= 0xf09d85ba) { return F_true; } // Tags: U+E0001. - if (character == 0xf3a08081) { + if (sequence == 0xf3a08081) { return F_true; } // Tags: U+E0020 to U+E007F. - if (character >= 0xf3a080a0 && character <= 0xf3a081bf) { + if (sequence >= 0xf3a080a0 && sequence <= 0xf3a081bf) { return F_true; } @@ -127,12 +127,12 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_control_) || !defined(_di_f_utf_is_control_) #if !defined(_di_f_utf_character_is_control_code_) || !defined(_di_f_utf_is_control_code_) - f_status_t private_f_utf_character_is_control_code(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_control_code(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { // Latin-1 Supplement: U+0080 to U+009F. - if (character >= 0xc2800000 && character <= 0xc29f0000) { + if (sequence >= 0xc2800000 && sequence <= 0xc29f0000) { return F_true; } } @@ -142,72 +142,72 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_control_code_) || !defined(_di_f_utf_is_contro_codel_) #if !defined(_di_f_utf_character_is_control_format_) || !defined(_di_f_utf_is_control_format_) - f_status_t private_f_utf_character_is_control_format(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_control_format(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { // Latin-1 Supplement: U+00AD. - if (character == 0xc2ad0000) { + if (sequence == 0xc2ad0000) { return F_true; } // Arabic: U+0600 to U+0605. - if (character >= 0xd8800000 && character <= 0xd8850000) { + if (sequence >= 0xd8800000 && sequence <= 0xd8850000) { return F_true; } // Arabic: U+061C, U+06DD. - if (character == 0xd89c0000 || character == 0xdb9d0000) { + if (sequence == 0xd89c0000 || sequence == 0xdb9d0000) { return F_true; } // Syriac: U+070F. - if (character == 0xdc8f0000) { + if (sequence == 0xdc8f0000) { return F_true; } return F_false; } - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { // Arabic Extended-A: U+08E2. - if (character == 0xe0a3a200) { + if (sequence == 0xe0a3a200) { return F_true; } // Mongolian: U+180E. - if (character == 0xe1a08e00) { + if (sequence == 0xe1a08e00) { return F_true; } // General Punctuation: U+200B to U+200F. - if (character >= 0xe2808b00 && character <= 0xe2808f00) { + if (sequence >= 0xe2808b00 && sequence <= 0xe2808f00) { return F_true; } // General Punctuation: U+202A to U+202E. - if (character >= 0xe280aa00 && character <= 0xe280ae00) { + if (sequence >= 0xe280aa00 && sequence <= 0xe280ae00) { return F_true; } // General Punctuation: U+2060 to U+2064. - if (character >= 0xe281a000 && character <= 0xe281a400) { + if (sequence >= 0xe281a000 && sequence <= 0xe281a400) { return F_true; } // General Punctuation: U+2066 to U+206F. - if (character >= 0xe281a600 && character <= 0xe281af00) { + if (sequence >= 0xe281a600 && sequence <= 0xe281af00) { return F_true; } // Arabic Presentation Forms-B: U+FEFF. - if (character == 0xefbbbf00) { + if (sequence == 0xefbbbf00) { return F_true; } // Specials: U+FFF9 to U+FFFB. - if (character >= 0xefbfb900 && character <= 0xefbfbb00) { + if (sequence >= 0xefbfb900 && sequence <= 0xefbfbb00) { return F_true; } @@ -215,32 +215,32 @@ extern "C" { } // Kaithi: U+110BD, U+110CD. - if (character == 0xf09182bd || character == 0xf091838d) { + if (sequence == 0xf09182bd || sequence == 0xf091838d) { return F_true; } // Egyptian Hieroglyphics: U+13430 to U+13438. - if (character >= 0xf09390b0 && character <= 0xf09390b8) { + if (sequence >= 0xf09390b0 && sequence <= 0xf09390b8) { return F_true; } // Shothand Format Controls: U+1BCA0 to U+1BCA3. - if (character >= 0xf09bb2a0 && character <= 0xf09bb2a3) { + if (sequence >= 0xf09bb2a0 && sequence <= 0xf09bb2a3) { return F_true; } // Music Symbols: U+1D173 to U+1D17A. - if (character >= 0xf09d85b3 && character <= 0xf09d85ba) { + if (sequence >= 0xf09d85b3 && sequence <= 0xf09d85ba) { return F_true; } // Tags: U+E0001. - if (character == 0xf3a08081) { + if (sequence == 0xf3a08081) { return F_true; } // Tags: U+E0020 to U+E007F. - if (character >= 0xf3a080a0 && character <= 0xf3a081bf) { + if (sequence >= 0xf3a080a0 && sequence <= 0xf3a081bf) { return F_true; } @@ -249,17 +249,17 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_control_format_) || !defined(_di_f_utf_is_control_format_) #if !defined(_di_f_utf_character_is_control_picture_) || !defined(_di_f_utf_is_control_picture_) - f_status_t private_f_utf_character_is_control_picture(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_control_picture(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { // Control Pictures: U+2400 to U+2426. - if (character >= 0xe2908000 && character <= 0xe290a600) { + if (sequence >= 0xe2908000 && sequence <= 0xe290a600) { return F_true; } // Specials: U+FFFC to U+FFFD. - if (character == 0xefbfbc00 || character == 0xefbfbd00) { + if (sequence == 0xefbfbc00 || sequence == 0xefbfbd00) { return F_true; } } diff --git a/level_0/f_utf/c/private-utf_control.h b/level_0/f_utf/c/private-utf_control.h index dd30c54..580086c 100644 --- a/level_0/f_utf/c/private-utf_control.h +++ b/level_0/f_utf/c/private-utf_control.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 control character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_control() */ #if !defined(_di_f_utf_character_is_control_) || !defined(_di_f_utf_is_control_) - extern f_status_t private_f_utf_character_is_control(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_control(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_control_) || !defined(_di_f_utf_is_control_) /** @@ -48,8 +48,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 control character. @@ -62,7 +62,7 @@ extern "C" { * @see f_utf_is_control_code() */ #if !defined(_di_f_utf_character_is_control_code_) || !defined(_di_f_utf_is_control_code_) - extern f_status_t private_f_utf_character_is_control_code(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_control_code(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_control_code_) || !defined(_di_f_utf_is_control_code_) /** @@ -72,8 +72,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 control character. @@ -86,7 +86,7 @@ extern "C" { * @see f_utf_is_control_format() */ #if !defined(_di_f_utf_character_is_control_format_) || !defined(_di_f_utf_is_control_format_) - extern f_status_t private_f_utf_character_is_control_format(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_control_format(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_control_format_) || !defined(_di_f_utf_is_control_format_) /** @@ -96,8 +96,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 control picture character. @@ -110,7 +110,7 @@ extern "C" { * @see f_utf_is_control_picture() */ #if !defined(_di_f_utf_character_is_control_picture_) || !defined(_di_f_utf_is_control_picture_) - extern f_status_t private_f_utf_character_is_control_picture(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_control_picture(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_control_picture_) || !defined(_di_f_utf_is_control_picture_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_digit.c b/level_0/f_utf/c/private-utf_digit.c index 5b29d9f..71b637a 100644 --- a/level_0/f_utf/c/private-utf_digit.c +++ b/level_0/f_utf/c/private-utf_digit.c @@ -7,200 +7,200 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_digit_) || !defined(_di_f_utf_is_digit_) - f_status_t private_f_utf_character_is_digit(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_digit(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { // Arabic: U+0660 to U+0669. - if (character >= 0xd9a00000 && character <= 0xd9a90000) { + if (sequence >= 0xd9a00000 && sequence <= 0xd9a90000) { return F_true; } // Extended Arabic: U+06F0 to U+06F9. - if (character >= 0xdbb00000 && character <= 0xdbb90000) { + if (sequence >= 0xdbb00000 && sequence <= 0xdbb90000) { return F_true; } // NKo: U+07C0 to U+07C9. - if (character >= 0xdf800000 && character <= 0xdf890000) { + if (sequence >= 0xdf800000 && sequence <= 0xdf890000) { return F_true; } return F_false; } - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { - if (macro_f_utf_char_t_to_char_1(character) == 0xe0) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xe0) { // Devanagari: U+0966 to U+096F. - if (character >= 0xe0a5a600 && character <= 0xe0a5af00) { + if (sequence >= 0xe0a5a600 && sequence <= 0xe0a5af00) { return F_true; } // Bengali: U+09E6 to U+09EF. - if (character >= 0xe0a7a600 && character <= 0xe0a7af00) { + if (sequence >= 0xe0a7a600 && sequence <= 0xe0a7af00) { return F_true; } // Gurmukhi: U+0A66 to U+0A6F. - if (character >= 0xe0a9a600 && character <= 0xe0a9af00) { + if (sequence >= 0xe0a9a600 && sequence <= 0xe0a9af00) { return F_true; } // Gujarati: U+0AE6 to U+0AEF. - if (character >= 0xe0aba600 && character <= 0xe0abaf00) { + if (sequence >= 0xe0aba600 && sequence <= 0xe0abaf00) { return F_true; } // Oriya: U+0B66 to U+0B6F. - if (character >= 0xe0ada600 && character <= 0xe0adaf00) { + if (sequence >= 0xe0ada600 && sequence <= 0xe0adaf00) { return F_true; } // Tamil: U+0BE6 to U+0BEF. - if (character >= 0xe0afa600 && character <= 0xe0afaf00) { + if (sequence >= 0xe0afa600 && sequence <= 0xe0afaf00) { return F_true; } // Telugu: U+0C66 to U+0C6F. - if (character >= 0xe0b1a600 && character <= 0xe0b1af00) { + if (sequence >= 0xe0b1a600 && sequence <= 0xe0b1af00) { return F_true; } // Kannada: U+0CE6 to U+0CEF. - if (character >= 0xe0b3a600 && character <= 0xe0b3af00) { + if (sequence >= 0xe0b3a600 && sequence <= 0xe0b3af00) { return F_true; } // Malayalam: U+0D66 to U+0D6F. - if (character >= 0xe0b5a600 && character <= 0xe0b5af00) { + if (sequence >= 0xe0b5a600 && sequence <= 0xe0b5af00) { return F_true; } // Sinhala: U+0DE6 to U+0DEF. - if (character >= 0xe0b7a600 && character <= 0xe0b7af00) { + if (sequence >= 0xe0b7a600 && sequence <= 0xe0b7af00) { return F_true; } // Thai: U+0E50 to U+0E59. - if (character >= 0xe0b99000 && character <= 0xe0b99900) { + if (sequence >= 0xe0b99000 && sequence <= 0xe0b99900) { return F_true; } // Lao: U+0ED0 to U+0ED9. - if (character >= 0xe0bb9000 && character <= 0xe0bb9900) { + if (sequence >= 0xe0bb9000 && sequence <= 0xe0bb9900) { return F_true; } // Tibetan: U+0F20 to U+0F29. - if (character >= 0xe0bca000 && character <= 0xe0bca900) { + if (sequence >= 0xe0bca000 && sequence <= 0xe0bca900) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe1) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe1) { // Myanmar: U+1040 to U+1049. - if (character >= 0xe1818000 && character <= 0xe1818900) { + if (sequence >= 0xe1818000 && sequence <= 0xe1818900) { return F_true; } // Myanmar (Shan): U+1090 to U+1099. - if (character >= 0xe1829000 && character <= 0xe1829900) { + if (sequence >= 0xe1829000 && sequence <= 0xe1829900) { return F_true; } // Khmer: U+17E0 to U+17E9. - if (character >= 0xe19fa000 && character <= 0xe19fa900) { + if (sequence >= 0xe19fa000 && sequence <= 0xe19fa900) { return F_true; } // Mongolian: U+1810 to U+1819. - if (character >= 0xe1a09000 && character <= 0xe1a09900) { + if (sequence >= 0xe1a09000 && sequence <= 0xe1a09900) { return F_true; } // Limbu: U+1946 to U+194F. - if (character >= 0xe1a58600 && character <= 0xe1a58f00) { + if (sequence >= 0xe1a58600 && sequence <= 0xe1a58f00) { return F_true; } // New Tai Lue: U+19D0 to U+19D9. - if (character >= 0xe1a79000 && character <= 0xe1a79900) { + if (sequence >= 0xe1a79000 && sequence <= 0xe1a79900) { return F_true; } // Tai Tham (Hora): U+1A80 to U+1A89. - if (character >= 0xe1aa8000 && character <= 0xe1aa8900) { + if (sequence >= 0xe1aa8000 && sequence <= 0xe1aa8900) { return F_true; } // Tai Tham (Tham): U+1A90 to U+1A99. - if (character >= 0xe1aa9000 && character <= 0xe1aa9900) { + if (sequence >= 0xe1aa9000 && sequence <= 0xe1aa9900) { return F_true; } // Balinese: U+1B50 to U+1B59. - if (character >= 0xe1ad9000 && character <= 0xe1ad9900) { + if (sequence >= 0xe1ad9000 && sequence <= 0xe1ad9900) { return F_true; } // Sundanese: U+1BB0 to U+1BB9. - if (character >= 0xe1aeb000 && character <= 0xe1aeb900) { + if (sequence >= 0xe1aeb000 && sequence <= 0xe1aeb900) { return F_true; } // Lepcha: U+1C40 to U+1C49. - if (character >= 0xe1b18000 && character <= 0xe1b18900) { + if (sequence >= 0xe1b18000 && sequence <= 0xe1b18900) { return F_true; } // Ol Chiki: U+1C50 to U+1C59. - if (character >= 0xe1b19000 && character <= 0xe1b19900) { + if (sequence >= 0xe1b19000 && sequence <= 0xe1b19900) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xea) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xea) { // Vai: U+A620 to U+A629. - if (character >= 0xea98a000 && character <= 0xea98a900) { + if (sequence >= 0xea98a000 && sequence <= 0xea98a900) { return F_true; } // Saurashtra: U+A8D0 to U+A8D9. - if (character >= 0xeaa39000 && character <= 0xeaa39900) { + if (sequence >= 0xeaa39000 && sequence <= 0xeaa39900) { return F_true; } // Kayah Li: U+A900 to U+A909. - if (character >= 0xeaa48000 && character <= 0xeaa48900) { + if (sequence >= 0xeaa48000 && sequence <= 0xeaa48900) { return F_true; } // Javanese: U+A9D0 to U+A9D9. - if (character >= 0xeaa79000 && character <= 0xeaa79900) { + if (sequence >= 0xeaa79000 && sequence <= 0xeaa79900) { return F_true; } // Myanmar Extended-B: U+A9F0 to U+A9F9. - if (character >= 0xeaa7b000 && character <= 0xeaa7b900) { + if (sequence >= 0xeaa7b000 && sequence <= 0xeaa7b900) { return F_true; } // Cham: U+AA50 to U+AA59. - if (character >= 0xeaa99000 && character <= 0xeaa99900) { + if (sequence >= 0xeaa99000 && sequence <= 0xeaa99900) { return F_true; } // Meetei Mayek: U+ABF0 to U+ABF9. - if (character >= 0xeaafb000 && character <= 0xeaafb900) { + if (sequence >= 0xeaafb000 && sequence <= 0xeaafb900) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xef) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xef) { // Halfwidth and Fullwidth Forms: U+FF10 to U+FF19. - if (character >= 0xefbc9000 && character <= 0xefbc9900) { + if (sequence >= 0xefbc9000 && sequence <= 0xefbc9900) { return F_true; } } @@ -208,157 +208,157 @@ extern "C" { return F_false; } - if (macro_f_utf_char_t_to_char_1(character) == 0xf0) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xf0) { - if (macro_f_utf_char_t_to_char_2(character) == 0x90) { + if (macro_f_utf_char_t_to_char_2(sequence) == 0x90) { // Osmanya: U+104A0 to U+104A9. - if (character >= 0xf09092a0 && character <= 0xf09092a9) { + if (sequence >= 0xf09092a0 && sequence <= 0xf09092a9) { return F_true; } // Hanifi Rohingya: U+10D30 to U+10D39. - if (character >= 0xf090b4b0 && character <= 0xf090b4b9) { + if (sequence >= 0xf090b4b0 && sequence <= 0xf090b4b9) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x91) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x91) { // Brahmi: U+11066 to U+1106F. - if (character >= 0xf09181a6 && character <= 0xf09181af) { + if (sequence >= 0xf09181a6 && sequence <= 0xf09181af) { return F_true; } // Sora Sompeng: U+110F0 to U+110F9. - if (character >= 0xf09183b0 && character <= 0xf09183b9) { + if (sequence >= 0xf09183b0 && sequence <= 0xf09183b9) { return F_true; } // Chakma: U+11136 to U+1113F. - if (character >= 0xf09184b6 && character <= 0xf09184bf) { + if (sequence >= 0xf09184b6 && sequence <= 0xf09184bf) { return F_true; } // Sharada: U+111D0 to U+111D9. - if (character >= 0xf0918790 && character <= 0xf0918799) { + if (sequence >= 0xf0918790 && sequence <= 0xf0918799) { return F_true; } // Khudawadi: U+112F0 to U+112F9. - if (character >= 0xf0918bb0 && character <= 0xf0918bb9) { + if (sequence >= 0xf0918bb0 && sequence <= 0xf0918bb9) { return F_true; } // Newa: U+11450 to U+11459. - if (character >= 0xf0919190 && character <= 0xf0919199) { + if (sequence >= 0xf0919190 && sequence <= 0xf0919199) { return F_true; } // Tirhuta: U+114D0 to U+114D9. - if (character >= 0xf0919390 && character <= 0xf0919399) { + if (sequence >= 0xf0919390 && sequence <= 0xf0919399) { return F_true; } // Modi: U+11650 to U+11659. - if (character >= 0xf0919990 && character <= 0xf0919999) { + if (sequence >= 0xf0919990 && sequence <= 0xf0919999) { return F_true; } // Takri: U+116C0 to U+116C9. - if (character >= 0xf0919b80 && character <= 0xf0919b89) { + if (sequence >= 0xf0919b80 && sequence <= 0xf0919b89) { return F_true; } // Ahom: U+11730 to U+11739. - if (character >= 0xf0919cb0 && character <= 0xf0919cb9) { + if (sequence >= 0xf0919cb0 && sequence <= 0xf0919cb9) { return F_true; } // Warang Citi: U+118E0 to U+118E9. - if (character >= 0xf091a3a0 && character <= 0xf091a3a9) { + if (sequence >= 0xf091a3a0 && sequence <= 0xf091a3a9) { return F_true; } // Dives Akuru: U+11950 to U+11959. - if (character >= 0xf091a590 && character <= 0xf091a599) { + if (sequence >= 0xf091a590 && sequence <= 0xf091a599) { return F_true; } // Bhaiksuki: U+11C50 to U+11C59. - if (character >= 0xf091b190 && character <= 0xf091b199) { + if (sequence >= 0xf091b190 && sequence <= 0xf091b199) { return F_true; } // Masaram Gondi: U+11D50 to U+11D59. - if (character >= 0xf091b590 && character <= 0xf091b599) { + if (sequence >= 0xf091b590 && sequence <= 0xf091b599) { return F_true; } // Gunjala Gondi: U+11DA0 to U+11DA9. - if (character >= 0xf091b6a0 && character <= 0xf091b6a9) { + if (sequence >= 0xf091b6a0 && sequence <= 0xf091b6a9) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x96) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x96) { // Mro: U+16A60 to U+16A69. - if (character >= 0xf096a9a0 && character <= 0xf096a9a9) { + if (sequence >= 0xf096a9a0 && sequence <= 0xf096a9a9) { return F_true; } // Pahawh Hmong: U+16B50 to U+16B59. - if (character >= 0xf096ad90 && character <= 0xf096ad99) { + if (sequence >= 0xf096ad90 && sequence <= 0xf096ad99) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x9d) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x9d) { // Mathematical Alphanumeric (Bold) Symbols: U+1D7CE to U+1D7D7. - if (character >= 0xf09d9f8e && character <= 0xf09d9f97) { + if (sequence >= 0xf09d9f8e && sequence <= 0xf09d9f97) { return F_true; } // Mathematical Alphanumeric (Double-Struck) Symbols: U+1D7D8 to U+1D7E1. - if (character >= 0xf09d9f98 && character <= 0xf09d9fa1) { + if (sequence >= 0xf09d9f98 && sequence <= 0xf09d9fa1) { return F_true; } // Mathematical Alphanumeric (Sans-Serif) Symbols: U+1D7E2 to U+1D7EB. - if (character >= 0xf09d9fa2 && character <= 0xf09d9fab) { + if (sequence >= 0xf09d9fa2 && sequence <= 0xf09d9fab) { return F_true; } // Mathematical Alphanumeric (Sans-Serif Bold) Symbols: U+1D7EC to U+1D7F5. - if (character >= 0xf09d9fac && character <= 0xf09d9fb5) { + if (sequence >= 0xf09d9fac && sequence <= 0xf09d9fb5) { return F_true; } // Mathematical Alphanumeric (Monospace) Symbols: U+1D7F6 to U+1D7FF. - if (character >= 0xf09d9fb6 && character <= 0xf09d9fbf) { + if (sequence >= 0xf09d9fb6 && sequence <= 0xf09d9fbf) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x9e) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x9e) { // Nyiakeng Puachue Hmong: U+1E140 to U+1E149. - if (character >= 0xf09e8580 && character <= 0xf09e8589) { + if (sequence >= 0xf09e8580 && sequence <= 0xf09e8589) { return F_true; } // Wancho: U+1E2F0 to U+1E2F9. - if (character >= 0xf09e8bb0 && character <= 0xf09e8bb9) { + if (sequence >= 0xf09e8bb0 && sequence <= 0xf09e8bb9) { return F_true; } // Adlam: U+1E950 to U+1E959. - if (character >= 0xf09ea590 && character <= 0xf09ea599) { + if (sequence >= 0xf09ea590 && sequence <= 0xf09ea599) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x9f) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x9f) { // Symbols for Legacy Computing (Segmented): U+1FBF0 to U+1FBF9. - if (character >= 0xf09fafb0 && character <= 0xf09fafb9) { + if (sequence >= 0xf09fafb0 && sequence <= 0xf09fafb9) { return F_true; } } diff --git a/level_0/f_utf/c/private-utf_digit.h b/level_0/f_utf/c/private-utf_digit.h index 575617c..8ceddc6 100644 --- a/level_0/f_utf/c/private-utf_digit.h +++ b/level_0/f_utf/c/private-utf_digit.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 digit character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_digit() */ #if !defined(_di_f_utf_character_is_digit_) || !defined(_di_f_utf_is_digit_) - extern f_status_t private_f_utf_character_is_digit(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_digit(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_digit_) || !defined(_di_f_utf_is_digit_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_emoji.c b/level_0/f_utf/c/private-utf_emoji.c index 994183b..6c47d3e 100644 --- a/level_0/f_utf/c/private-utf_emoji.c +++ b/level_0/f_utf/c/private-utf_emoji.c @@ -7,251 +7,251 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_emoji_) || !defined(_di_f_utf_is_emoji_) - f_status_t private_f_utf_character_is_emoji(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_emoji(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { // Latin-1 Supplement: U+00A9, U+00AE. - if (character == 0xc2a90000 || character == 0xc2ae0000) { + if (sequence == 0xc2a90000 || sequence == 0xc2ae0000) { return F_true; } return F_false; } - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { - if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xe2) { // General Punctuation: U+203C, U+2049. - if (character == 0xe280bc00 || character == 0xe2818900) { + if (sequence == 0xe280bc00 || sequence == 0xe2818900) { return F_true; } // Letterlike Symbols: U+2122, U+2139 - if (character == 0xe284a200 || character == 0xe284b900) { + if (sequence == 0xe284a200 || sequence == 0xe284b900) { return F_true; } // Arrows: U+2194 to U+2199. - if (character >= 0xe2869400 && character <= 0xe2869900) { + if (sequence >= 0xe2869400 && sequence <= 0xe2869900) { return F_true; } // Arrows: U+21A9, U+21AA. - if (character == 0xe286a900 || character == 0xe286aa00) { + if (sequence == 0xe286a900 || sequence == 0xe286aa00) { return F_true; } // Miscellaneous Technical: U+231A, U+231B. - if (character == 0xe28c9a00 || character == 0xe28c9b00) { + if (sequence == 0xe28c9a00 || sequence == 0xe28c9b00) { return F_true; } // Miscellaneous Technical: U+2328, U+23CF. - if (character == 0xe28ca800 || character == 0xe28f8f00) { + if (sequence == 0xe28ca800 || sequence == 0xe28f8f00) { return F_true; } // Miscellaneous Technical: U+23E9 to U+23F3. - if (character >= 0xe28fa900 && character <= 0xe28fb300) { + if (sequence >= 0xe28fa900 && sequence <= 0xe28fb300) { return F_true; } // Miscellaneous Technical: U+23F8 to U+23FA. - if (character >= 0xe28fb800 && character <= 0xe28fba00) { + if (sequence >= 0xe28fb800 && sequence <= 0xe28fba00) { return F_true; } // Enclosed Alphanumerics: U+24C2. - if (character == 0xe2938200) { + if (sequence == 0xe2938200) { return F_true; } // Geometric Shapes: U+25AA, U+25AB, U+25B6, U+25C0. - if (character == 0xe296aa00 || character == 0xe296ab00 || character == 0xe296b600 || character == 0xe2978000) { + if (sequence == 0xe296aa00 || sequence == 0xe296ab00 || sequence == 0xe296b600 || sequence == 0xe2978000) { return F_true; } // Geometric Shapes: U+25FB to U+25FE. - if (character >= 0xe297bb00 && character <= 0xe297be00) { + if (sequence >= 0xe297bb00 && sequence <= 0xe297be00) { return F_true; } // Miscellaneous Symbols: U+2600 to U+2604. - if (character >= 0xe2988000 && character <= 0xe2988400) { + if (sequence >= 0xe2988000 && sequence <= 0xe2988400) { return F_true; } // Miscellaneous Symbols: U+260E, U+2611, U+2614, U+2615. - if (character == 0xe2988e00 || character == 0xe2989100 || character == 0xe2989400 || character == 0xe2989500) { + if (sequence == 0xe2988e00 || sequence == 0xe2989100 || sequence == 0xe2989400 || sequence == 0xe2989500) { return F_true; } // Miscellaneous Symbols: U+2618, U+261D, U+2620, U+2622. - if (character == 0xe2989800 || character == 0xe2989d00 || character == 0xe298a000 || character == 0xe298a200) { + if (sequence == 0xe2989800 || sequence == 0xe2989d00 || sequence == 0xe298a000 || sequence == 0xe298a200) { return F_true; } // Miscellaneous Symbols: U+2623, U+2626, U+262A, U+262E. - if (character == 0xe298a300 || character == 0xe298a600 || character == 0xe298aa00 || character == 0xe298ae00) { + if (sequence == 0xe298a300 || sequence == 0xe298a600 || sequence == 0xe298aa00 || sequence == 0xe298ae00) { return F_true; } // Miscellaneous Symbols: U+262F. - if (character == 0xe298af00) { + if (sequence == 0xe298af00) { return F_true; } // Miscellaneous Symbols: U+2638 to U+263A. - if (character >= 0xe298b800 && character <= 0xe298ba00) { + if (sequence >= 0xe298b800 && sequence <= 0xe298ba00) { return F_true; } // Miscellaneous Symbols: U+2640, U+2642. - if (character == 0xe2998000 || character == 0xe2998200) { + if (sequence == 0xe2998000 || sequence == 0xe2998200) { return F_true; } // Miscellaneous Symbols: U+2648 to U+2653. - if (character >= 0xe2998800 && character <= 0xe2999300) { + if (sequence >= 0xe2998800 && sequence <= 0xe2999300) { return F_true; } // Miscellaneous Symbols: U+265F, U+2660, U+2663, U+2665. - if (character == 0xe2999f00 || character == 0xe299a000 || character == 0xe299a300 || character == 0xe299a500) { + if (sequence == 0xe2999f00 || sequence == 0xe299a000 || sequence == 0xe299a300 || sequence == 0xe299a500) { return F_true; } // Miscellaneous Symbols: U+2666, U+2668, U+267B, U+267E. - if (character == 0xe299a600 || character == 0xe299a800 || character == 0xe299bb00 || character == 0xe299be00) { + if (sequence == 0xe299a600 || sequence == 0xe299a800 || sequence == 0xe299bb00 || sequence == 0xe299be00) { return F_true; } // Miscellaneous Symbols: U+267F. - if (character == 0xe299bf00) { + if (sequence == 0xe299bf00) { return F_true; } // Miscellaneous Symbols: U+2692 to U+2697. - if (character >= 0xe29a9200 && character <= 0xe29a9700) { + if (sequence >= 0xe29a9200 && sequence <= 0xe29a9700) { return F_true; } // Miscellaneous Symbols: U+2699, U+269B, U+269C, U+26A0. - if (character == 0xe29a9900 || character == 0xe29a9b00 || character == 0xe29a9c00 || character == 0xe29aa000) { + if (sequence == 0xe29a9900 || sequence == 0xe29a9b00 || sequence == 0xe29a9c00 || sequence == 0xe29aa000) { return F_true; } // Miscellaneous Symbols: U+26A1, U+26A7, U+26AA, U+26AB. - if (character == 0xe29aa100 || character == 0xe29aa700 || character == 0xe29aaa00 || character == 0xe29aab00) { + if (sequence == 0xe29aa100 || sequence == 0xe29aa700 || sequence == 0xe29aaa00 || sequence == 0xe29aab00) { return F_true; } // Miscellaneous Symbols: U+26B0, U+26B1, U+26BD, U+26BE. - if (character == 0xe29ab000 || character == 0xe29ab100 || character == 0xe29abd00 || character == 0xe29abe00) { + if (sequence == 0xe29ab000 || sequence == 0xe29ab100 || sequence == 0xe29abd00 || sequence == 0xe29abe00) { return F_true; } // Miscellaneous Symbols: U+26C4, U+26C5, U+26C8, U+26CE. - if (character == 0xe29b8400 || character == 0xe29b8500 || character == 0xe29b8800 || character == 0xe29b8e00) { + if (sequence == 0xe29b8400 || sequence == 0xe29b8500 || sequence == 0xe29b8800 || sequence == 0xe29b8e00) { return F_true; } // Miscellaneous Symbols: U+26CF, U+26D1, U+26D3, U+26D4. - if (character == 0xe29b8f00 || character == 0xe29b9100 || character == 0xe29b9300 || character == 0xe29b9400) { + if (sequence == 0xe29b8f00 || sequence == 0xe29b9100 || sequence == 0xe29b9300 || sequence == 0xe29b9400) { return F_true; } // Miscellaneous Symbols: U+26E9, U+26EA. - if (character == 0xe29ba900 || character == 0xe29baa00) { + if (sequence == 0xe29ba900 || sequence == 0xe29baa00) { return F_true; } // Miscellaneous Symbols: U+26F0 to U+26F5. - if (character >= 0xe29bb000 && character <= 0xe29bb500) { + if (sequence >= 0xe29bb000 && sequence <= 0xe29bb500) { return F_true; } // Miscellaneous Symbols: U+26F7 to U+26FA. - if (character >= 0xe29bb700 && character <= 0xe29bba00) { + if (sequence >= 0xe29bb700 && sequence <= 0xe29bba00) { return F_true; } // Miscellaneous Symbols: U+26FD. - if (character == 0xe29bbd00) { + if (sequence == 0xe29bbd00) { return F_true; } // Dingbats: U+2702, U+2705. - if (character == 0xe29c8200 || character == 0xe29c8500) { + if (sequence == 0xe29c8200 || sequence == 0xe29c8500) { return F_true; } // Dingbats: U+2708 to U+270D. - if (character >= 0xe29c8800 && character <= 0xe29c8d00) { + if (sequence >= 0xe29c8800 && sequence <= 0xe29c8d00) { return F_true; } // Dingbats: U+270F, U+2712, U+2714, U+2716. - if (character == 0xe29c8f00 || character == 0xe29c9200 || character == 0xe29c9400 || character == 0xe29c9600) { + if (sequence == 0xe29c8f00 || sequence == 0xe29c9200 || sequence == 0xe29c9400 || sequence == 0xe29c9600) { return F_true; } // Dingbats: U+271D, U+2721, U+2728, U+2733. - if (character == 0xe29c9d00 || character == 0xe29ca100 || character == 0xe29ca800 || character == 0xe29cb300) { + if (sequence == 0xe29c9d00 || sequence == 0xe29ca100 || sequence == 0xe29ca800 || sequence == 0xe29cb300) { return F_true; } // Dingbats: U+2734, U+2744, U+2747, U+274C. - if (character == 0xe29cb400 || character == 0xe29d8400 || character == 0xe29d8700 || character == 0xe29d8c00) { + if (sequence == 0xe29cb400 || sequence == 0xe29d8400 || sequence == 0xe29d8700 || sequence == 0xe29d8c00) { return F_true; } // Dingbats: U+274E. - if (character == 0xe29d8e00) { + if (sequence == 0xe29d8e00) { return F_true; } // Dingbats: U+2753 to U+2755. - if (character >= 0xe29d9300 && character <= 0xe29d9500) { + if (sequence >= 0xe29d9300 && sequence <= 0xe29d9500) { return F_true; } // Dingbats: U+2757, U+2763, U+2764. - if (character == 0xe29d9700 || character == 0xe29da300 || character == 0xe29da400) { + if (sequence == 0xe29d9700 || sequence == 0xe29da300 || sequence == 0xe29da400) { return F_true; } // Dingbats: U+2795 to U+2797. - if (character >= 0xe29e9500 && character <= 0xe29e9700) { + if (sequence >= 0xe29e9500 && sequence <= 0xe29e9700) { return F_true; } // Dingbats: U+27A1, U+27B0, U+27BF, U+2934. - if (character == 0xe29ea100 || character == 0xe29eb000 || character == 0xe29ebf00 || character == 0xe2a4b400) { + if (sequence == 0xe29ea100 || sequence == 0xe29eb000 || sequence == 0xe29ebf00 || sequence == 0xe2a4b400) { return F_true; } // Supplemental Arrows-B: U+2935. - if (character == 0xe2a4b500) { + if (sequence == 0xe2a4b500) { return F_true; } // Miscellaneous Symbols and Arrows: U+2B05 to U+2B07. - if (character >= 0xe2ac8500 && character <= 0xe2ac8700) { + if (sequence >= 0xe2ac8500 && sequence <= 0xe2ac8700) { return F_true; } // U+2B1B, U+2B1C, U+2B50, U+2B55. - if (character == 0xe2ac9b00 || character == 0xe2ac9c00 || character == 0xe2ad9000 || character == 0xe2ad9500) { + if (sequence == 0xe2ac9b00 || sequence == 0xe2ac9c00 || sequence == 0xe2ad9000 || sequence == 0xe2ad9500) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe3) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe3) { // CJK Symbols and Punctuation: U+3030, U+303D, U+3297, U+3299. - if (character == 0xe380b000 || character == 0xe380bd00 || character == 0xe38a9700 || character == 0xe38a9900) { + if (sequence == 0xe380b000 || sequence == 0xe380bd00 || sequence == 0xe38a9700 || sequence == 0xe38a9900) { return F_true; } } @@ -259,262 +259,262 @@ extern "C" { return F_false; } - if (macro_f_utf_char_t_to_char_1(character) == 0xf0) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xf0) { - if (macro_f_utf_char_t_to_char_2(character) == 0x9f) { + if (macro_f_utf_char_t_to_char_2(sequence) == 0x9f) { // Mahjong Tiles: U+1F004. - if (character == 0xf09f8084) { + if (sequence == 0xf09f8084) { return F_true; } // Playing Cards: U+1F0CF to U+1F171. - if (character >= 0xf09f8084 && character <= 0xf09f85b1) { + if (sequence >= 0xf09f8084 && sequence <= 0xf09f85b1) { return F_true; } // Enclosed Alphanumeric Supplement: U+1F17E, U+1F17F, U+1F18E. - if (character == 0xf09f85be || character == 0xf09f85bf || character == 0xf09f868e) { + if (sequence == 0xf09f85be || sequence == 0xf09f85bf || sequence == 0xf09f868e) { return F_true; } // Enclosed Alphanumeric Supplement: U+1F191 to U+1F19A. - if (character >= 0xf09f8691 && character <= 0xf09f869a) { + if (sequence >= 0xf09f8691 && sequence <= 0xf09f869a) { return F_true; } // Enclosed Alphanumeric Supplement: U+1F1E6. - if (character == 0xf09f87a6) { + if (sequence == 0xf09f87a6) { return F_true; } // Enclosed Ideographic Supplement: U+1F201, U+1F202, U+1F21A, U+1F22F. - if (character == 0xf09f8881 || character == 0xf09f8882 || character == 0xf09f889a || character == 0xf09f88af) { + if (sequence == 0xf09f8881 || sequence == 0xf09f8882 || sequence == 0xf09f889a || sequence == 0xf09f88af) { return F_true; } // Enclosed Ideographic Supplement: U+1F232 to U+1F23A. - if (character >= 0xf09f88b2 && character <= 0xf09f88ba) { + if (sequence >= 0xf09f88b2 && sequence <= 0xf09f88ba) { return F_true; } // Enclosed Ideographic Supplement: U+1F250, U+1F251. - if (character == 0xf09f8990 || character == 0xf09f8991) { + if (sequence == 0xf09f8990 || sequence == 0xf09f8991) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F300 to U+1F321. - if (character >= 0xf09f8c80 && character <= 0xf09f8ca1) { + if (sequence >= 0xf09f8c80 && sequence <= 0xf09f8ca1) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F324 to U+1F393. - if (character >= 0xf09f8ca4 && character <= 0xf09f8e93) { + if (sequence >= 0xf09f8ca4 && sequence <= 0xf09f8e93) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F396, U+1F397. - if (character == 0xf09f8e96 || character == 0xf09f8e97) { + if (sequence == 0xf09f8e96 || sequence == 0xf09f8e97) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F399 to U+1F39B. - if (character >= 0xf09f8e99 && character <= 0xf09f8e9b) { + if (sequence >= 0xf09f8e99 && sequence <= 0xf09f8e9b) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F39E to U+1F3F0. - if (character >= 0xf09f8e9e && character <= 0xf09f8fb0) { + if (sequence >= 0xf09f8e9e && sequence <= 0xf09f8fb0) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F3F3 to U+1F3F5. - if (character >= 0xf09f8fb3 && character <= 0xf09f8fb5) { + if (sequence >= 0xf09f8fb3 && sequence <= 0xf09f8fb5) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F3F7 to U+1F4FD. - if (character >= 0xf09f8fb7 && character <= 0xf09f93bd) { + if (sequence >= 0xf09f8fb7 && sequence <= 0xf09f93bd) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F4FF to U+1F53D. - if (character >= 0xf09f93bf && character <= 0xf09f94bd) { + if (sequence >= 0xf09f93bf && sequence <= 0xf09f94bd) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F549 to U+1F54E. - if (character >= 0xf09f9589 && character <= 0xf09f958e) { + if (sequence >= 0xf09f9589 && sequence <= 0xf09f958e) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F550 to U+1F567. - if (character >= 0xf09f9590 && character <= 0xf09f95a7) { + if (sequence >= 0xf09f9590 && sequence <= 0xf09f95a7) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F56F, U+1F570. - if (character == 0xf09f95af || character == 0xf09f95b0) { + if (sequence == 0xf09f95af || sequence == 0xf09f95b0) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F573 to U+1F57A. - if (character >= 0xf09f95b3 && character <= 0xf09f95ba) { + if (sequence >= 0xf09f95b3 && sequence <= 0xf09f95ba) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F587. - if (character == 0xf09f9687) { + if (sequence == 0xf09f9687) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F58A to U+1F58D. - if (character >= 0xf09f968a && character <= 0xf09f968d) { + if (sequence >= 0xf09f968a && sequence <= 0xf09f968d) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F590, U+1F595, U+1F596, U+1F5A4. - if (character == 0xf09f9690 || character == 0xf09f9695 || character == 0xf09f9696 || character == 0xf09f96a4) { + if (sequence == 0xf09f9690 || sequence == 0xf09f9695 || sequence == 0xf09f9696 || sequence == 0xf09f96a4) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F5A5, U+1F5A8, U+1F5B1, U+1F5B2. - if (character == 0xf09f96a5 || character == 0xf09f96a8 || character == 0xf09f96b1 || character == 0xf09f96b2) { + if (sequence == 0xf09f96a5 || sequence == 0xf09f96a8 || sequence == 0xf09f96b1 || sequence == 0xf09f96b2) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F5BC. - if (character == 0xf09f96bc) { + if (sequence == 0xf09f96bc) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F5C2 to U+1F5C4. - if (character >= 0xf09f9782 && character <= 0xf09f9784) { + if (sequence >= 0xf09f9782 && sequence <= 0xf09f9784) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F5D1 to U+1F5D3. - if (character >= 0xf09f9791 && character <= 0xf09f9793) { + if (sequence >= 0xf09f9791 && sequence <= 0xf09f9793) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F5DC to U+1F5DE. - if (character >= 0xf09f979c && character <= 0xf09f979e) { + if (sequence >= 0xf09f979c && sequence <= 0xf09f979e) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F5E1, U+1F5E3, U+1F5E8, U+1F5EF. - if (character == 0xf09f97a1 || character == 0xf09f97a3 || character == 0xf09f97a8 || character == 0xf09f97af) { + if (sequence == 0xf09f97a1 || sequence == 0xf09f97a3 || sequence == 0xf09f97a8 || sequence == 0xf09f97af) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F5F3. - if (character == 0xf09f97b3) { + if (sequence == 0xf09f97b3) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F5FA to U+1F6C5. - if (character >= 0xf09f97ba && character <= 0xf09f9b85) { + if (sequence >= 0xf09f97ba && sequence <= 0xf09f9b85) { return F_true; } // Transport and Map Symbols: U+1F6CB to U+1F6D2. - if (character >= 0xf09f9b8b && character <= 0xf09f9b92) { + if (sequence >= 0xf09f9b8b && sequence <= 0xf09f9b92) { return F_true; } // Transport and Map Symbols: U+1F6D5 to U+1F6D7. - if (character >= 0xf09f9b95 && character <= 0xf09f9b97) { + if (sequence >= 0xf09f9b95 && sequence <= 0xf09f9b97) { return F_true; } // Transport and Map Symbols: U+1F6DD to U+1F6DF. - if (character >= 0xf09f9b9d && character <= 0xf09f9b9f) { + if (sequence >= 0xf09f9b9d && sequence <= 0xf09f9b9f) { return F_true; } // Transport and Map Symbols: U+1F6E0 to U+1F6E5. - if (character >= 0xf09f9ba0 && character <= 0xf09f9ba5) { + if (sequence >= 0xf09f9ba0 && sequence <= 0xf09f9ba5) { return F_true; } // Transport and Map Symbols: U+1F6E9, U+1F6EB, U+1F6EC, U+1F6F0. - if (character == 0xf09f9ba9 || character == 0xf09f9bab || character == 0xf09f9bac || character == 0xf09f9bb0) { + if (sequence == 0xf09f9ba9 || sequence == 0xf09f9bab || sequence == 0xf09f9bac || sequence == 0xf09f9bb0) { return F_true; } // Transport and Map Symbols: U+1F6F3 to U+1F6FC. - if (character >= 0xf09f9bb3 && character <= 0xf09f9bbc) { + if (sequence >= 0xf09f9bb3 && sequence <= 0xf09f9bbc) { return F_true; } // Geometric Shapes Extended: U+1F7E0 to U+1F7EB. - if (character >= 0xf09f9fa0 && character <= 0xf09f9fab) { + if (sequence >= 0xf09f9fa0 && sequence <= 0xf09f9fab) { return F_true; } // Geometric Shapes Extended: U+1F7F0. - if (character == 0xf09f9fb0) { + if (sequence == 0xf09f9fb0) { return F_true; } // Supplemental Symbols and Pictographs: U+1F90C to U+1F93A. - if (character >= 0xf09fa48c && character <= 0xf09fa4ba) { + if (sequence >= 0xf09fa48c && sequence <= 0xf09fa4ba) { return F_true; } // Supplemental Symbols and Pictographs: U+1F93C to U+1F945. - if (character >= 0xf09fa4bc && character <= 0xf09fa585) { + if (sequence >= 0xf09fa4bc && sequence <= 0xf09fa585) { return F_true; } // Supplemental Symbols and Pictographs to Symbols and Pictographs Extended-A: U+1F947 to U+U+1FA74. - if (character >= 0xf09fa587 && character <= 0xf09fa9b4) { + if (sequence >= 0xf09fa587 && sequence <= 0xf09fa9b4) { return F_true; } // Symbols and Pictographs Extended-A: U+1FA70 to U+1FA74. - if (character >= 0xf09fa9b0 && character <= 0xf09fa9b4) { + if (sequence >= 0xf09fa9b0 && sequence <= 0xf09fa9b4) { return F_true; } // Symbols and Pictographs Extended-A: U+1FA78 to U+1FA7C. - if (character >= 0xf09fa9b8 && character <= 0xf09fa9bc) { + if (sequence >= 0xf09fa9b8 && sequence <= 0xf09fa9bc) { return F_true; } // Symbols and Pictographs Extended-A: U+1FA80 to U+1FA86. - if (character >= 0xf09faa80 && character <= 0xf09faa86) { + if (sequence >= 0xf09faa80 && sequence <= 0xf09faa86) { return F_true; } // Symbols and Pictographs Extended-A: U+1FA90 to U+1FAAC. - if (character >= 0xf09faa90 && character <= 0xf09faaac) { + if (sequence >= 0xf09faa90 && sequence <= 0xf09faaac) { return F_true; } // Symbols and Pictographs Extended-A: U+1FAB0 to U+1FABA. - if (character >= 0xf09faab0 && character <= 0xf09faaba) { + if (sequence >= 0xf09faab0 && sequence <= 0xf09faaba) { return F_true; } // Symbols and Pictographs Extended-A: U+1FAC0 to U+1FAC5. - if (character >= 0xf09fab80 && character <= 0xf09fab85) { + if (sequence >= 0xf09fab80 && sequence <= 0xf09fab85) { return F_true; } // Symbols and Pictographs Extended-A: U+1FAD0 to U+1FAD9. - if (character >= 0xf09fab90 && character <= 0xf09fab99) { + if (sequence >= 0xf09fab90 && sequence <= 0xf09fab99) { return F_true; } // Symbols and Pictographs Extended-A: U+1FAE0 to U+1FAE7. - if (character >= 0xf09faba0 && character <= 0xf09faba7) { + if (sequence >= 0xf09faba0 && sequence <= 0xf09faba7) { return F_true; } // Symbols and Pictographs Extended-A: U+1FAF0 to U+1FAF6. - if (character >= 0xf09fabb0 && character <= 0xf09fabb6) { + if (sequence >= 0xf09fabb0 && sequence <= 0xf09fabb6) { return F_true; } } diff --git a/level_0/f_utf/c/private-utf_emoji.h b/level_0/f_utf/c/private-utf_emoji.h index 24759d4..43743e2 100644 --- a/level_0/f_utf/c/private-utf_emoji.h +++ b/level_0/f_utf/c/private-utf_emoji.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 emoji character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_emoji() */ #if !defined(_di_f_utf_character_is_emoji_) || !defined(_di_f_utf_is_emoji_) - extern f_status_t private_f_utf_character_is_emoji(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_emoji(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_emoji_) || !defined(_di_f_utf_is_emoji_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_numeric.c b/level_0/f_utf/c/private-utf_numeric.c index 2f9b2fd..36926be 100644 --- a/level_0/f_utf/c/private-utf_numeric.c +++ b/level_0/f_utf/c/private-utf_numeric.c @@ -8,9 +8,9 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_numeric_) || !defined(_di_f_utf_is_numeric_) - f_status_t private_f_utf_character_is_numeric(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_numeric(const f_utf_char_t sequence) { - if (private_f_utf_character_is_digit(character)) { + if (private_f_utf_character_is_digit(sequence)) { return F_true; } @@ -18,17 +18,17 @@ extern "C" { // @todo add other UTF-8 numbers. // @todo provide functions to identify each number. - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { // Number Forms: U+2150 to U+218B. - if (character >= 0xe2859000 && character <= 0xe2868b00) { + if (sequence >= 0xe2859000 && sequence <= 0xe2868b00) { return F_true; } } - else if (macro_f_utf_char_t_width_is(character) == 4) { + else if (macro_f_utf_char_t_width_is(sequence) == 4) { // Coptic Epact Numbers: U+102E1 to U+102FB. - if (character >= 0xf0908ba1 && character <= 0xf0908bbb) { + if (sequence >= 0xf0908ba1 && sequence <= 0xf0908bbb) { return F_true; } } diff --git a/level_0/f_utf/c/private-utf_numeric.h b/level_0/f_utf/c/private-utf_numeric.h index ec6aa7d..ea79d12 100644 --- a/level_0/f_utf/c/private-utf_numeric.h +++ b/level_0/f_utf/c/private-utf_numeric.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 numeric character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_numeric() */ #if !defined(_di_f_utf_character_is_numeric_) || !defined(_di_f_utf_is_numeric_) - extern f_status_t private_f_utf_character_is_numeric(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_numeric(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_numeric_) || !defined(_di_f_utf_is_numeric_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_phonetic.c b/level_0/f_utf/c/private-utf_phonetic.c index 2c69c3f..b123a32 100644 --- a/level_0/f_utf/c/private-utf_phonetic.c +++ b/level_0/f_utf/c/private-utf_phonetic.c @@ -7,12 +7,12 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_phonetic_) || !defined(_di_f_utf_is_phonetic_) - f_status_t private_f_utf_character_is_phonetic(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_phonetic(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { // Phonetic Extensions to Phonetic Extensions Supplement: U+1D00 to U+1DBF. - if (character >= 0xe1b48000 && character <= 0xe1b6bf00) { + if (sequence >= 0xe1b48000 && sequence <= 0xe1b6bf00) { return F_true; } } diff --git a/level_0/f_utf/c/private-utf_phonetic.h b/level_0/f_utf/c/private-utf_phonetic.h index 022aea8..5d80d9f 100644 --- a/level_0/f_utf/c/private-utf_phonetic.h +++ b/level_0/f_utf/c/private-utf_phonetic.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 phonetic character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_phonetic() */ #if !defined(_di_f_utf_character_is_phonetic_) || !defined(_di_f_utf_is_phonetic_) - extern f_status_t private_f_utf_character_is_phonetic(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_phonetic(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_phonetic_) || !defined(_di_f_utf_is_phonetic_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_private.c b/level_0/f_utf/c/private-utf_private.c index 598273c..8bc9174 100644 --- a/level_0/f_utf/c/private-utf_private.c +++ b/level_0/f_utf/c/private-utf_private.c @@ -7,21 +7,16 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_private_) || !defined(_di_f_utf_is_private_) - f_status_t private_f_utf_character_is_private(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_private(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { return F_false; } - if (macro_f_utf_char_t_width_is(character) == 3) { - - // High Private Use Surrogates: U+DB80 to U+DBFF. - if (character >= 0xedae8000 && character <= 0xedafbf00) { - return F_true; - } + if (macro_f_utf_char_t_width_is(sequence) == 3) { // Private Use: U+E000 to U+F8FF. - if (character >= 0xee808000 && character <= 0xefa3bf00) { + if (sequence >= 0xee808000 && sequence <= 0xefa3bf00) { return F_true; } @@ -29,12 +24,12 @@ extern "C" { } // Supplementary Private Use Area - A: U+F0000 to U+FFFFF. - if (character >= 0xf3b08080 && character <= 0xf3bfbfbf) { + if (sequence >= 0xf3b08080 && sequence <= 0xf3bfbfbf) { return F_true; } // Supplementary Private Use Area - B: U+100000 to U+10FFFF. - if (character >= 0xf4808080 && character <= 0xf48fbfbf) { + if (sequence >= 0xf4808080 && sequence <= 0xf48fbfbf) { return F_true; } diff --git a/level_0/f_utf/c/private-utf_private.h b/level_0/f_utf/c/private-utf_private.h index 5a5b674..b6b4efd 100644 --- a/level_0/f_utf/c/private-utf_private.h +++ b/level_0/f_utf/c/private-utf_private.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 private character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_private() */ #if !defined(_di_f_utf_character_is_private_) || !defined(_di_f_utf_is_private_) - extern f_status_t private_f_utf_character_is_private(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_private(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_private_) || !defined(_di_f_utf_is_private_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_punctuation.c b/level_0/f_utf/c/private-utf_punctuation.c index 39b7008..8f6275a 100644 --- a/level_0/f_utf/c/private-utf_punctuation.c +++ b/level_0/f_utf/c/private-utf_punctuation.c @@ -7,109 +7,109 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_punctuation_) || !defined(_di_f_utf_is_punctuation_) - f_status_t private_f_utf_character_is_punctuation(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_punctuation(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { - if (macro_f_utf_char_t_to_char_1(character) == 0xc2) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xc2) { // Latin-1 Supplement: U+00A1, U+00A7, U+00AB, U+00B6. - if (character == 0xc2a10000 || character == 0xc2a70000 || character == 0xc2ab0000 || character == 0xc2b60000) { + if (sequence == 0xc2a10000 || sequence == 0xc2a70000 || sequence == 0xc2ab0000 || sequence == 0xc2b60000) { return F_true; } // Latin-1 Supplement: U+00B7, U+00BB, U+00BF. - if (character == 0xc2b70000 || character == 0xc2bb0000 || character == 0xc2bf0000) { + if (sequence == 0xc2b70000 || sequence == 0xc2bb0000 || sequence == 0xc2bf0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xcd) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xcd) { // Greek and Coptic: U+037E. - if (character == 0xcdbe0000) { + if (sequence == 0xcdbe0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xce) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xce) { // Greek and Coptic: U+0387. - if (character == 0xce870000) { + if (sequence == 0xce870000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xd5) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xd5) { // Armenian: U+055A to U+055F. - if (character >= 0xd59a0000 && character <= 0xd59f0000) { + if (sequence >= 0xd59a0000 && sequence <= 0xd59f0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xd6) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xd6) { // Armenian: U+0589, U+058A. - if (character == 0xd6890000 || character == 0xd68a0000) { + if (sequence == 0xd6890000 || sequence == 0xd68a0000) { return F_true; } // Hebrew: U+05BE. - if (character == 0xd6be0000) { + if (sequence == 0xd6be0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xd7) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xd7) { // Hebrew: U+05C0, U+05C3, U+05C6. - if (character == 0xd7800000 || character == 0xd7830000 || character == 0xd7860000) { + if (sequence == 0xd7800000 || sequence == 0xd7830000 || sequence == 0xd7860000) { return F_true; } // Hebrew: U+05F3, U+05F4. - if (character == 0xd7b30000 || character == 0xd7b40000) { + if (sequence == 0xd7b30000 || sequence == 0xd7b40000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xd8) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xd8) { // Arabic: U+0609, U+060A, U+060C, U+060D. - if (character == 0xd8890000 || character == 0xd88a0000 || character == 0xd88c0000 || character == 0xd88d0000) { + if (sequence == 0xd8890000 || sequence == 0xd88a0000 || sequence == 0xd88c0000 || sequence == 0xd88d0000) { return F_true; } // Arabic: U+061B. - if (character == 0xd89b0000) { + if (sequence == 0xd89b0000) { return F_true; } // Arabic: U+061D to U+061F. - if (character >= 0xd89d0000 && character <= 0xd89f0000) { + if (sequence >= 0xd89d0000 && sequence <= 0xd89f0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xdb) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xdb) { // Arabic: U+06D4. - if (character == 0xdb940000) { + if (sequence == 0xdb940000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xd9) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xd9) { // Arabic: U+066A to U+066D. - if (character >= 0xd9aa0000 && character <= 0xd9ad0000) { + if (sequence >= 0xd9aa0000 && sequence <= 0xd9ad0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xdc) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xdc) { // Syriac: U+0700 to U+070D. - if (character >= 0xdc800000 && character <= 0xdc8d0000) { + if (sequence >= 0xdc800000 && sequence <= 0xdc8d0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xdf) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xdf) { // NKo: U+07F7 to U+07F9. - if (character >= 0xdfb70000 && character <= 0xdfb90000) { + if (sequence >= 0xdfb70000 && sequence <= 0xdfb90000) { return F_true; } } @@ -117,452 +117,452 @@ extern "C" { return F_false; } - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { - if (macro_f_utf_char_t_to_char_1(character) == 0xe0) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xe0) { // Samaritan: U+0830 to U+083E. - if (character >= 0xe0a0b000 && character <= 0xe0a0be00) { + if (sequence >= 0xe0a0b000 && sequence <= 0xe0a0be00) { return F_true; } // Mandaic: U+085E. - if (character == 0xe0a19e00) { + if (sequence == 0xe0a19e00) { return F_true; } // Devanagari: U+0964, U+0965, U+0970. - if (character == 0xe0a5a400 || character == 0xe0a5a500 || character == 0xe0a5b000) { + if (sequence == 0xe0a5a400 || sequence == 0xe0a5a500 || sequence == 0xe0a5b000) { return F_true; } // Bengali: U+09FD. - if (character == 0xe0a7bd00) { + if (sequence == 0xe0a7bd00) { return F_true; } // Gurmukhi: U+0A64, U+0A65, U+0A76. - if (character == 0xe0a9a400 || character == 0xe0a9a500 || character == 0xe0a9b600) { + if (sequence == 0xe0a9a400 || sequence == 0xe0a9a500 || sequence == 0xe0a9b600) { return F_true; } // Gujarati: U+0AF0. - if (character == 0xe0abb000) { + if (sequence == 0xe0abb000) { return F_true; } // Telugu: U+0C77. - if (character == 0xe0b1b700) { + if (sequence == 0xe0b1b700) { return F_true; } // Kannada: U+0C84. - if (character == 0xe0b28400) { + if (sequence == 0xe0b28400) { return F_true; } // Sinhala: U+0DF4. - if (character == 0xe0b7b400) { + if (sequence == 0xe0b7b400) { return F_true; } // Thai: U+0E4F, U+0E5A, U+0E5B. - if (character == 0xe0b98f00 || character == 0xe0b99a00 || character == 0xe0b99b00) { + if (sequence == 0xe0b98f00 || sequence == 0xe0b99a00 || sequence == 0xe0b99b00) { return F_true; } // Tibetan: U+0F04 to U+0F12. - if (character >= 0xe0bc8400 && character <= 0xe0bc9200) { + if (sequence >= 0xe0bc8400 && sequence <= 0xe0bc9200) { return F_true; } // Tibetan: U+0F14, U+0F85. - if (character == 0xe0bc9400 || character == 0xe0be8500) { + if (sequence == 0xe0bc9400 || sequence == 0xe0be8500) { return F_true; } // Tibetan: U+0F3A to U+0F3D. - if (character >= 0xe0bcba00 && character <= 0xe0bcbd00) { + if (sequence >= 0xe0bcba00 && sequence <= 0xe0bcbd00) { return F_true; } // Tibetan: U+0FD0 to U+0FD4. - if (character >= 0xe0bf9000 && character <= 0xe0bf9400) { + if (sequence >= 0xe0bf9000 && sequence <= 0xe0bf9400) { return F_true; } // Tibetan: U+0FD9 to U+0FDA. - if (character >= 0xe0bf9900 && character <= 0xe0bf9a00) { + if (sequence >= 0xe0bf9900 && sequence <= 0xe0bf9a00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe1) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe1) { // Myanmar: U+104A to U+104F. - if (character >= 0xe1818a00 && character <= 0xe1818f00) { + if (sequence >= 0xe1818a00 && sequence <= 0xe1818f00) { return F_true; } // Georgian: U+10FB. - if (character == 0xe183bb00) { + if (sequence == 0xe183bb00) { return F_true; } // Ethiopic: U+1360 to U+1368. - if (character >= 0xe18da000 && character <= 0xe18da800) { + if (sequence >= 0xe18da000 && sequence <= 0xe18da800) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+1400, U+166E. - if (character == 0xe1908000 || character == 0xe199ae00) { + if (sequence == 0xe1908000 || sequence == 0xe199ae00) { return F_true; } // Ogham: U+169B, U+169C. - if (character == 0xe19a9b00 || character == 0xe19a9c00) { + if (sequence == 0xe19a9b00 || sequence == 0xe19a9c00) { return F_true; } // Runic: U+16EB to U+16ED. - if (character >= 0xe19bab00 && character <= 0xe19bad00) { + if (sequence >= 0xe19bab00 && sequence <= 0xe19bad00) { return F_true; } // Hanunoo: U+1735, U+1736. - if (character == 0xe19cb500 || character == 0xe19cb600) { + if (sequence == 0xe19cb500 || sequence == 0xe19cb600) { return F_true; } // Khmer: U+17D4 to U+17D6. - if (character >= 0xe19f9400 && character <= 0xe19f9600) { + if (sequence >= 0xe19f9400 && sequence <= 0xe19f9600) { return F_true; } // Khmer: U+17D8 to U+17DA. - if (character >= 0xe19f9800 && character <= 0xe19f9a00) { + if (sequence >= 0xe19f9800 && sequence <= 0xe19f9a00) { return F_true; } // Mongolian: U+1800 to U+180A. - if (character >= 0xe1a08000 && character <= 0xe1a08a00) { + if (sequence >= 0xe1a08000 && sequence <= 0xe1a08a00) { return F_true; } // Limbu: U+1944, U+1945. - if (character == 0xe1a58400 || character == 0xe1a58500) { + if (sequence == 0xe1a58400 || sequence == 0xe1a58500) { return F_true; } // Buginese: U+1A1E, U+1A1F. - if (character == 0xe1a89e00 || character == 0xe1a89f00) { + if (sequence == 0xe1a89e00 || sequence == 0xe1a89f00) { return F_true; } // Tai Tham: U+1AA0 to U+1AA6. - if (character >= 0xe1aaa000 && character <= 0xe1aaa600) { + if (sequence >= 0xe1aaa000 && sequence <= 0xe1aaa600) { return F_true; } // Tai Tham: U+1AA8 to U+1AAD. - if (character >= 0xe1aaa800 && character <= 0xe1aaad00) { + if (sequence >= 0xe1aaa800 && sequence <= 0xe1aaad00) { return F_true; } // Balinese: U+1B5A to U+1B60. - if (character >= 0xe1ad9a00 && character <= 0xe1ada000) { + if (sequence >= 0xe1ad9a00 && sequence <= 0xe1ada000) { return F_true; } // Balinese: U+1B7D to U+1B7E. - if (character == 0xe1adbd00 || character == 0xe1adbe00) { + if (sequence == 0xe1adbd00 || sequence == 0xe1adbe00) { return F_true; } // Batak: U+1BFC to U+1BFF. - if (character >= 0xe1afbc00 && character <= 0xe1afbf00) { + if (sequence >= 0xe1afbc00 && sequence <= 0xe1afbf00) { return F_true; } // Lepcha: U+1C3B to U+1C3F. - if (character >= 0xe1b0bb00 && character <= 0xe1b0bf00) { + if (sequence >= 0xe1b0bb00 && sequence <= 0xe1b0bf00) { return F_true; } // Ol Chiki: U+1C7E, U+1C7F. - if (character == 0xe1b1be00 || character == 0xe1b0bf00) { + if (sequence == 0xe1b1be00 || sequence == 0xe1b0bf00) { return F_true; } // Sundanese Supplement: U+1CC0 to U+1CC7. - if (character >= 0xe1b38000 && character <= 0xe1b38700) { + if (sequence >= 0xe1b38000 && sequence <= 0xe1b38700) { return F_true; } // Ol Chiki: U+1C7E, U+1C7F. - if (character == 0xe1b1be00 || character == 0xe1b1bf00) { + if (sequence == 0xe1b1be00 || sequence == 0xe1b1bf00) { return F_true; } // Vedic Extensions: U+1CD3. - if (character == 0xe1b39300) { + if (sequence == 0xe1b39300) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe2) { // Superscripts and Subscripts: U+207D, U+207E, U+208D, U+208E. - if (character == 0xe281bd00 || character == 0xe281be00 || character == 0xe2828d00 || character == 0xe2828e00) { + if (sequence == 0xe281bd00 || sequence == 0xe281be00 || sequence == 0xe2828d00 || sequence == 0xe2828e00) { return F_true; } // General Punctuation: U+2010 to U+2027. - if (character >= 0xe2809000 && character <= 0xe280a700) { + if (sequence >= 0xe2809000 && sequence <= 0xe280a700) { return F_true; } // General Punctuation: U+2030 to U+205E. - if (character >= 0xe280b000 && character <= 0xe2819e00) { + if (sequence >= 0xe280b000 && sequence <= 0xe2819e00) { return F_true; } // Miscellaneous Technical: U+2308 to U+230B. - if (character >= 0xe28c8800 && character <= 0xe28c8b00) { + if (sequence >= 0xe28c8800 && sequence <= 0xe28c8b00) { return F_true; } // Miscellaneous Technical: U+2329, U+232A. - if (character == 0xe28ca900 || character == 0xe28caa00) { + if (sequence == 0xe28ca900 || sequence == 0xe28caa00) { return F_true; } // Dingbats: U+2768 to U+2775. - if (character >= 0xe29da800 && character <= 0xe29db500) { + if (sequence >= 0xe29da800 && sequence <= 0xe29db500) { return F_true; } // Miscellaneous Mathematical Symbols-A: U+27C5, U+27C6. - if (character == 0xe29f8500 || character == 0xe29f8600) { + if (sequence == 0xe29f8500 || sequence == 0xe29f8600) { return F_true; } // Miscellaneous Mathematical Symbols-A: U+27E6 to U+27EF. - if (character >= 0xe29fa600 && character <= 0xe29faf00) { + if (sequence >= 0xe29fa600 && sequence <= 0xe29faf00) { return F_true; } // Miscellaneous Mathematical Symbols-B: U+2983 to U+2998. - if (character >= 0xe2a68300 && character <= 0xe2a69800) { + if (sequence >= 0xe2a68300 && sequence <= 0xe2a69800) { return F_true; } // Miscellaneous Mathematical Symbols-B: U+29D8 to U+29DB. - if (character >= 0xe2a79800 && character <= 0xe2a79b00) { + if (sequence >= 0xe2a79800 && sequence <= 0xe2a79b00) { return F_true; } // Miscellaneous Mathematical Symbols-B: U+29FC to U+29FD. - if (character >= 0xe2a7bc00 && character <= 0xe2a7bd00) { + if (sequence >= 0xe2a7bc00 && sequence <= 0xe2a7bd00) { return F_true; } // Coptic: U+2CF9 to U+2CFC. - if (character >= 0xe2b3b900 && character <= 0xe2b3bc00) { + if (sequence >= 0xe2b3b900 && sequence <= 0xe2b3bc00) { return F_true; } // Coptic: U+2CFE to U+2CFF. - if (character >= 0xe2b3be00 && character <= 0xe2b3bf00) { + if (sequence >= 0xe2b3be00 && sequence <= 0xe2b3bf00) { return F_true; } // Tifinagh: U+2D70. - if (character == 0xe2b5b000) { + if (sequence == 0xe2b5b000) { return F_true; } // Supplemental Punctuation: U+2E00 to U+2E2E. - if (character >= 0xe2b88000 && character <= 0xe2b8ae00) { + if (sequence >= 0xe2b88000 && sequence <= 0xe2b8ae00) { return F_true; } // Supplemental Punctuation: U+2E30 to U+2E4F. - if (character >= 0xe2b8b000 && character <= 0xe2b98f00) { + if (sequence >= 0xe2b8b000 && sequence <= 0xe2b98f00) { return F_true; } // Supplemental Punctuation: U+2E52 to U+2E5D. - if (character >= 0xe2b99200 && character <= 0xe2b99d00) { + if (sequence >= 0xe2b99200 && sequence <= 0xe2b99d00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe3) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe3) { // CJK Symbols and Punctuation: U+3001 to U+3003. - if (character >= 0xe3808100 && character <= 0xe3808300) { + if (sequence >= 0xe3808100 && sequence <= 0xe3808300) { return F_true; } // CJK Symbols and Punctuation: U+3008 to U+3011. - if (character >= 0xe3808800 && character <= 0xe3809100) { + if (sequence >= 0xe3808800 && sequence <= 0xe3809100) { return F_true; } // CJK Symbols and Punctuation: U+3014 to U+301F. - if (character >= 0xe3809400 && character <= 0xe3809f00) { + if (sequence >= 0xe3809400 && sequence <= 0xe3809f00) { return F_true; } // CJK Symbols and Punctuation: U+3030, U+303D. - if (character == 0xe380b000 || character == 0xe380bd00) { + if (sequence == 0xe380b000 || sequence == 0xe380bd00) { return F_true; } // Katakana: U+30A0, U+30FB. - if (character == 0xe382a000 || character == 0xe383bb00) { + if (sequence == 0xe382a000 || sequence == 0xe383bb00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xea) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xea) { // Lisu: U+A4FE, U+A4FF. - if (character == 0xea93be00 || character == 0xea93bf00) { + if (sequence == 0xea93be00 || sequence == 0xea93bf00) { return F_true; } // Vai: U+A60D to U+A60F. - if (character >= 0xea988d00 && character <= 0xea988f00) { + if (sequence >= 0xea988d00 && sequence <= 0xea988f00) { return F_true; } // Cyrillic Extended-B: U+A673, U+A67E. - if (character == 0xea99b300 || character == 0xea99be00) { + if (sequence == 0xea99b300 || sequence == 0xea99be00) { return F_true; } // Bamum: U+A6F2 to U+A6F7. - if (character >= 0xea9bb200 && character <= 0xea9bb700) { + if (sequence >= 0xea9bb200 && sequence <= 0xea9bb700) { return F_true; } // Phags-pa: U+A874 to U+A877. - if (character >= 0xeaa1b400 && character <= 0xeaa1b700) { + if (sequence >= 0xeaa1b400 && sequence <= 0xeaa1b700) { return F_true; } // Saurashtra: U+A8CE, U+A8CF. - if (character == 0xeaa38e00 || character == 0xeaa38f00) { + if (sequence == 0xeaa38e00 || sequence == 0xeaa38f00) { return F_true; } // Devanagari Extended: U+A8F8 to U+A8FA. - if (character >= 0xeaa3b800 && character <= 0xeaa3ba00) { + if (sequence >= 0xeaa3b800 && sequence <= 0xeaa3ba00) { return F_true; } // Devanagari Extended: U+A8FC to U+A8FF. - if (character >= 0xeaa3bc00 && character <= 0xeaa3bf00) { + if (sequence >= 0xeaa3bc00 && sequence <= 0xeaa3bf00) { return F_true; } // Kayah Li: U+A92E, U+A92F. - if (character == 0xeaa4ae00 || character == 0xeaa4af00) { + if (sequence == 0xeaa4ae00 || sequence == 0xeaa4af00) { return F_true; } // Rejang: U+A95F. - if (character == 0xeaa59f00) { + if (sequence == 0xeaa59f00) { return F_true; } // Javanese: U+A9C1 to U+A9DF. - if (character >= 0xeaa78100 && character <= 0xeaa79f00) { + if (sequence >= 0xeaa78100 && sequence <= 0xeaa79f00) { return F_true; } // Cham: U+AA5C to U+AA5F. - if (character >= 0xeaa99c00 && character <= 0xeaa99f00) { + if (sequence >= 0xeaa99c00 && sequence <= 0xeaa99f00) { return F_true; } // Tai Viet: U+AADE, U+AADF. - if (character == 0xeaab9e00 || character == 0xeaab9f00) { + if (sequence == 0xeaab9e00 || sequence == 0xeaab9f00) { return F_true; } // Meetei Mayek Extensions: U+AAF0, U+AAF1. - if (character == 0xeaabb000 || character == 0xeaabb100) { + if (sequence == 0xeaabb000 || sequence == 0xeaabb100) { return F_true; } // Meetei Mayek: U+ABEB. - if (character == 0xeaafab00) { + if (sequence == 0xeaafab00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xef) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xef) { // Alphabetic Presentation Forms-A: U+FD3E, U+FD3F. - if (character == 0xefb4be00 || character == 0xefb4bf00) { + if (sequence == 0xefb4be00 || sequence == 0xefb4bf00) { return F_true; } // Vertical Forms: U+FE10 to U+FE19. - if (character >= 0xefb89000 && character <= 0xefb89900) { + if (sequence >= 0xefb89000 && sequence <= 0xefb89900) { return F_true; } // CJK Compatibility Forms: U+FE30 to U+FE52. - if (character >= 0xefb8b000 && character <= 0xefb99200) { + if (sequence >= 0xefb8b000 && sequence <= 0xefb99200) { return F_true; } // Small Form Variants: U+FE54 to U+FE63. - if (character >= 0xefb99400 && character <= 0xefb9a300) { + if (sequence >= 0xefb99400 && sequence <= 0xefb9a300) { return F_true; } // Small Form Variants: U+FE63, U+FE68, U+FE6A, U+FE6B. - if (character == 0xefb9a300 || character == 0xefb9a800 || character == 0xefb9aa00 || character == 0xefb9ab00) { + if (sequence == 0xefb9a300 || sequence == 0xefb9a800 || sequence == 0xefb9aa00 || sequence == 0xefb9ab00) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF01 to U+FF03. - if (character >= 0xefbc8100 && character <= 0xefbc8300) { + if (sequence >= 0xefbc8100 && sequence <= 0xefbc8300) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF05 to U+FF0A. - if (character >= 0xefbc8500 && character <= 0xefbc8a00) { + if (sequence >= 0xefbc8500 && sequence <= 0xefbc8a00) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF0C to U+FF0F. - if (character >= 0xefbc8c00 && character <= 0xefbc8f00) { + if (sequence >= 0xefbc8c00 && sequence <= 0xefbc8f00) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF1A to U+FF1B. - if (character >= 0xefbc9a00 && character <= 0xefbc9b00) { + if (sequence >= 0xefbc9a00 && sequence <= 0xefbc9b00) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF1F, U+FF20. - if (character == 0xefbc9f00 || character == 0xefbca000) { + if (sequence == 0xefbc9f00 || sequence == 0xefbca000) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF3B to U+FF3D. - if (character >= 0xefbcbb00 && character <= 0xefbcbd00) { + if (sequence >= 0xefbcbb00 && sequence <= 0xefbcbd00) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF3F, U+FF5B, U+FF5D. - if (character == 0xefbcbf00 || character == 0xefbd9b00 || character == 0xefbd9d00) { + if (sequence == 0xefbcbf00 || sequence == 0xefbd9b00 || sequence == 0xefbd9d00) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF5F to U+FF65. - if (character >= 0xefbd9f00 && character <= 0xefbda500) { + if (sequence >= 0xefbd9f00 && sequence <= 0xefbda500) { return F_true; } } @@ -570,293 +570,293 @@ extern "C" { return F_false; } - if (macro_f_utf_char_t_to_char_1(character) == 0xf0) { - if (macro_f_utf_char_t_to_char_2(character) == 0x90) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xf0) { + if (macro_f_utf_char_t_to_char_2(sequence) == 0x90) { // Aegean Numbers: U+10100 to U+10102. - if (character >= 0xf0908480 && character <= 0xf0908482) { + if (sequence >= 0xf0908480 && sequence <= 0xf0908482) { return F_true; } // Ugaritic: U+1039F, U+103D0. - if (character == 0xf0908e9f || character == 0xf0908f90) { + if (sequence == 0xf0908e9f || sequence == 0xf0908f90) { return F_true; } // Caucasian Albanian: U+1056F. - if (character == 0xf09095af) { + if (sequence == 0xf09095af) { return F_true; } // Imperial Aramaic: U+10857. - if (character == 0xf090a197) { + if (sequence == 0xf090a197) { return F_true; } // Phoenician: U+1091F. - if (character == 0xf090a49f) { + if (sequence == 0xf090a49f) { return F_true; } // Lydian: U+1093F. - if (character == 0xf090a4bf) { + if (sequence == 0xf090a4bf) { return F_true; } // Kharoshthi: U+10A50 to U+10A58. - if (character >= 0xf090a990 && character <= 0xf090a998) { + if (sequence >= 0xf090a990 && sequence <= 0xf090a998) { return F_true; } // Old South Arabian: U+10A7F. - if (character == 0xf090a9bf) { + if (sequence == 0xf090a9bf) { return F_true; } // Manichaean: U+10AF0 to U+10AF6. - if (character >= 0xf090abb0 && character <= 0xf090abb6) { + if (sequence >= 0xf090abb0 && sequence <= 0xf090abb6) { return F_true; } // Avestan: U+10B39. - if (character == 0xf090acb9) { + if (sequence == 0xf090acb9) { return F_true; } // Avestan: U+10B3A to U+10B3F. - if (character >= 0xf090acba && character <= 0xf090acbf) { + if (sequence >= 0xf090acba && sequence <= 0xf090acbf) { return F_true; } // Psalter Pahlavi: U+10B99 to U+10B9C. - if (character >= 0xf090ae99 && character <= 0xf090ae9c) { + if (sequence >= 0xf090ae99 && sequence <= 0xf090ae9c) { return F_true; } // Yezidi: U+10EAD. - if (character == 0xf090baad) { + if (sequence == 0xf090baad) { return F_true; } // Sogdian: U+10F55 to U+10F59. - if (character >= 0xf090bd95 && character <= 0xf090bd99) { + if (sequence >= 0xf090bd95 && sequence <= 0xf090bd99) { return F_true; } // Old Uyghur: U+10F86 to U+10F89. - if (character >= 0xf090be86 && character <= 0xf090be89) { + if (sequence >= 0xf090be86 && sequence <= 0xf090be89) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x91) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x91) { // Brahmi: U+11047 to U+1104D. - if (character >= 0xf0918187 && character <= 0xf091818d) { + if (sequence >= 0xf0918187 && sequence <= 0xf091818d) { return F_true; } // Kaithi: U+110BB to U+110C1. - if (character >= 0xf09182bb && character <= 0xf0918381) { + if (sequence >= 0xf09182bb && sequence <= 0xf0918381) { return F_true; } // Chakma: U+11140 to U+11143. - if (character >= 0xf0918580 && character <= 0xf0918583) { + if (sequence >= 0xf0918580 && sequence <= 0xf0918583) { return F_true; } // Mahajani: U+11174 to U+11175. - if (character == 0xf09185b4 || character == 0xf09185b5) { + if (sequence == 0xf09185b4 || sequence == 0xf09185b5) { return F_true; } // Sharada: U+111C5 to U+111C8. - if (character >= 0xf0918785 && character <= 0xf0918785) { + if (sequence >= 0xf0918785 && sequence <= 0xf0918785) { return F_true; } // Sharada: U+111CD. - if (character == 0xf091878d) { + if (sequence == 0xf091878d) { return F_true; } // Sharada: U+111DB to U+111DF. - if (character >= 0xf091879b && character <= 0xf091879f) { + if (sequence >= 0xf091879b && sequence <= 0xf091879f) { return F_true; } // Khojki: U+11238 to U+1123D. - if (character >= 0xf09188b8 && character <= 0xf09188bd) { + if (sequence >= 0xf09188b8 && sequence <= 0xf09188bd) { return F_true; } // Multani: U+112A9. - if (character == 0xf0918aa9) { + if (sequence == 0xf0918aa9) { return F_true; } // Newa: U+1144B to U+1144F. - if (character >= 0xf091918b && character <= 0xf091918f) { + if (sequence >= 0xf091918b && sequence <= 0xf091918f) { return F_true; } // Newa: U+1145A. - if (character == 0xf091919a) { + if (sequence == 0xf091919a) { return F_true; } // Tirhuta: U+114C6. - if (character == 0xf0919386) { + if (sequence == 0xf0919386) { return F_true; } // Siddham: U+115C1 to U+115D7. - if (character >= 0xf0919781 && character <= 0xf0919797) { + if (sequence >= 0xf0919781 && sequence <= 0xf0919797) { return F_true; } // Modi: U+11641 to U+11643. - if (character >= 0xf0919981 && character <= 0xf0919983) { + if (sequence >= 0xf0919981 && sequence <= 0xf0919983) { return F_true; } // Mongolian Supplement: U+11660 to U+1166C. - if (character >= 0xf09199a0 && character <= 0xf09199ac) { + if (sequence >= 0xf09199a0 && sequence <= 0xf09199ac) { return F_true; } // Ahom: U+1173C to U+1173E. - if (character >= 0xf0919cbc && character <= 0xf0919cbe) { + if (sequence >= 0xf0919cbc && sequence <= 0xf0919cbe) { return F_true; } // Dogra: U+1183B. - if (character == 0xf091a0bb) { + if (sequence == 0xf091a0bb) { return F_true; } // Dives Akuru: U+11944 to U+11946. - if (character >= 0xf091a584 && character <= 0xf091a586) { + if (sequence >= 0xf091a584 && sequence <= 0xf091a586) { return F_true; } // Nandinagari: U+119E2. - if (character == 0xf091a7a2) { + if (sequence == 0xf091a7a2) { return F_true; } // Zanabazar Square: U+11A3F to U+11A46. - if (character >= 0xd806de3f && character <= 0xf091a986) { + if (sequence >= 0xd806de3f && sequence <= 0xf091a986) { return F_true; } // Soyombo: U+11A9A to U+11A9C. - if (character >= 0xd806de9a && character <= 0xf091aa9c) { + if (sequence >= 0xd806de9a && sequence <= 0xf091aa9c) { return F_true; } // Soyombo: U+11A9E to U+11AA2. - if (character >= 0xf091aa9e && character <= 0xf091aaa2) { + if (sequence >= 0xf091aa9e && sequence <= 0xf091aaa2) { return F_true; } // Bhaiksuki: U+11C41 to U+11C45. - if (character >= 0xf091b181 && character <= 0xf091b185) { + if (sequence >= 0xf091b181 && sequence <= 0xf091b185) { return F_true; } // Marchen: U+11C70, U+11C71. - if (character == 0xf091b1b0 || character == 0xf091b1b1) { + if (sequence == 0xf091b1b0 || sequence == 0xf091b1b1) { return F_true; } // Makasar: U+11EF7, U+11EF8. - if (character == 0xf091bbb7 || character == 0xf091bbb8) { + if (sequence == 0xf091bbb7 || sequence == 0xf091bbb8) { return F_true; } // Tamil Supplement: U+11FFF. - if (character == 0xf091bfbf) { + if (sequence == 0xf091bfbf) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x92) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x92) { // Cuneiform Numbers and Punctuation: U+12470 to U+12474. - if (character >= 0xf09291b0 && character <= 0xf09291b4) { + if (sequence >= 0xf09291b0 && sequence <= 0xf09291b4) { return F_true; } // Cypro-Minoan: U+12FF1, U+12FF1. - if (character == 0xf092bfb1 || character == 0xf092bfb2) { + if (sequence == 0xf092bfb1 || sequence == 0xf092bfb2) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x96) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x96) { // Mro: U+16A6E, U+16A6F. - if (character == 0xf096a9ae || character == 0xf096a9af) { + if (sequence == 0xf096a9ae || sequence == 0xf096a9af) { return F_true; } // Bassa Vah: U+16AF5. - if (character == 0xf096abb5) { + if (sequence == 0xf096abb5) { return F_true; } // Pahawh Hmong: U+16B37 to U+16B3B. - if (character >= 0xf096acb7 && character <= 0xf096acbb) { + if (sequence >= 0xf096acb7 && sequence <= 0xf096acbb) { return F_true; } // Pahawh Hmong: U+16B44. - if (character >= 0xf096ad84) { + if (sequence >= 0xf096ad84) { return F_true; } // Medefaidrin: U+16E97 to U+16E9A. - if (character >= 0xf096ba97 && character <= 0xf096ba9a) { + if (sequence >= 0xf096ba97 && sequence <= 0xf096ba9a) { return F_true; } // Ideographic Symbols and Punctuation: U+16FE2. - if (character == 0xf096bfa2) { + if (sequence == 0xf096bfa2) { return F_true; } // Duployan: U+1BC9F. - if (character == 0xf09bb29f) { + if (sequence == 0xf09bb29f) { return F_true; } // Sutton SignWriting: U+1DA87 to U+1DA8B. - if (character >= 0xf09daa87 && character <= 0xf09daa8b) { + if (sequence >= 0xf09daa87 && sequence <= 0xf09daa8b) { return F_true; } // Adlam: U+1E95E, U+1E95F. - if (character == 0xf09ea59e || character == 0xf09ea59f) { + if (sequence == 0xf09ea59e || sequence == 0xf09ea59f) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x9b) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x9b) { // Duployan: U+1BC9F. - if (character == 0xf09bb29f) { + if (sequence == 0xf09bb29f) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x9d) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x9d) { // Sutton SignWriting: U+1DA87 to U+1DA8B. - if (character >= 0xf09daa87 && character <= 0xf09daa8b) { + if (sequence >= 0xf09daa87 && sequence <= 0xf09daa8b) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x9e) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x9e) { // Adlam: U+1E95E to U+1E95F. - if (character >= 0xf09ea59e && character <= 0xf09ea59f) { + if (sequence >= 0xf09ea59e && sequence <= 0xf09ea59f) { return F_true; } } diff --git a/level_0/f_utf/c/private-utf_punctuation.h b/level_0/f_utf/c/private-utf_punctuation.h index cbca527..c907312 100644 --- a/level_0/f_utf/c/private-utf_punctuation.h +++ b/level_0/f_utf/c/private-utf_punctuation.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 punctuation character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_punctuation() */ #if !defined(_di_f_utf_character_is_punctuation_) || !defined(_di_f_utf_is_punctuation_) - extern f_status_t private_f_utf_character_is_punctuation(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_punctuation(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_punctuation_) || !defined(_di_f_utf_is_punctuation_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_subscript.c b/level_0/f_utf/c/private-utf_subscript.c index 6e3b435..ee09479 100644 --- a/level_0/f_utf/c/private-utf_subscript.c +++ b/level_0/f_utf/c/private-utf_subscript.c @@ -7,27 +7,27 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_subscript_) || !defined(_di_f_utf_is_subscript_) - f_status_t private_f_utf_character_is_subscript(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_subscript(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { // Phonetic Extensions: U+1D62 to U+1D6A. - if (character >= 0xe1b5a200 && character <= 0xe1b5aa00) { + if (sequence >= 0xe1b5a200 && sequence <= 0xe1b5aa00) { return F_true; } // Superscripts and Subscripts: U+2080 to U+208E. - if (character >= 0xe2828000 && character <= 0xe2828e00) { + if (sequence >= 0xe2828000 && sequence <= 0xe2828e00) { return F_true; } // Superscripts and Subscripts: U+2090 to U+209C. - if (character >= 0xe2829000 && character <= 0xe2829c00) { + if (sequence >= 0xe2829000 && sequence <= 0xe2829c00) { return F_true; } // Latin Extended-C: U+2C7C. - if (character == 0xe2b1bc00) { + if (sequence == 0xe2b1bc00) { return F_true; } } diff --git a/level_0/f_utf/c/private-utf_subscript.h b/level_0/f_utf/c/private-utf_subscript.h index 4a85b6b..ccfe2f2 100644 --- a/level_0/f_utf/c/private-utf_subscript.h +++ b/level_0/f_utf/c/private-utf_subscript.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 subscript character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_subscript() */ #if !defined(_di_f_utf_character_is_subscript_) || !defined(_di_f_utf_is_subscript_) - extern f_status_t private_f_utf_character_is_subscript(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_subscript(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_subscript_) || !defined(_di_f_utf_is_subscript_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_superscript.c b/level_0/f_utf/c/private-utf_superscript.c index 10d7886..80aa684 100644 --- a/level_0/f_utf/c/private-utf_superscript.c +++ b/level_0/f_utf/c/private-utf_superscript.c @@ -7,33 +7,33 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_superscript_) || !defined(_di_f_utf_is_superscript_) - f_status_t private_f_utf_character_is_superscript(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_superscript(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { - if (macro_f_utf_char_t_to_char_1(character) == 0xc2) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xc2) { // Latin-1 Supplement: U+00A8, U+00AA, U+00B2, U+00B3. - if (character == 0xc2a80000 || character == 0xc2aa0000 || character == 0xc2b20000 || character == 0xc2b30000) { + if (sequence == 0xc2a80000 || sequence == 0xc2aa0000 || sequence == 0xc2b20000 || sequence == 0xc2b30000) { return F_true; } // Latin-1 Supplement: U+00B9, U+00BA. - if (character == 0xc2b90000 || character == 0xc2ba0000) { + if (sequence == 0xc2b90000 || sequence == 0xc2ba0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xca) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xca) { // Spacing Modifier Letters: U+02B0 to U+02B8. - if (character >= 0xcab00000 && character <= 0xcab80000) { + if (sequence >= 0xcab00000 && sequence <= 0xcab80000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xcb) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xcb) { // Spacing Modifier Letters: U+02E0 to U+02E4. - if (character >= 0xcba00000 && character <= 0xcba40000) { + if (sequence >= 0xcba00000 && sequence <= 0xcba40000) { return F_true; } } @@ -41,158 +41,158 @@ extern "C" { return F_false; } - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { - if (macro_f_utf_char_t_to_char_1(character) == 0xe1) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xe1) { // Georgian: U+10FC. - if (character == 0xe183bc00) { + if (sequence == 0xe183bc00) { return F_true; } - if (macro_f_utf_char_t_to_char_2(character) >= 0x90 && macro_f_utf_char_t_to_char_2(character) <= 0x99) { + if (macro_f_utf_char_t_to_char_2(sequence) >= 0x90 && macro_f_utf_char_t_to_char_2(sequence) <= 0x99) { // Unified Canadian Aboriginal Syllabics: U+141C to U+142A. - if (character >= 0xe1909c00 && character <= 0xe190aa00) { + if (sequence >= 0xe1909c00 && sequence <= 0xe190aa00) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+1449 to U+144B. - if (character >= 0xe1918900 && character <= 0xe1918b00) { + if (sequence >= 0xe1918900 && sequence <= 0xe1918b00) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+1483, U+1484, U+14A1, U+14A2. - if (character == 0xe1928300 || character == 0xe1928400 || character == 0xe192a100 || character == 0xe192a200) { + if (sequence == 0xe1928300 || sequence == 0xe1928400 || sequence == 0xe192a100 || sequence == 0xe192a200) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+14BB to U+14BE. - if (character >= 0xe192bb00 && character <= 0xe192be00) { + if (sequence >= 0xe192bb00 && sequence <= 0xe192be00) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+14D0 to U+14D2. - if (character >= 0xe1939000 && character <= 0xe1939200) { + if (sequence >= 0xe1939000 && sequence <= 0xe1939200) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+14EA, U+14EB. - if (character == 0xe193aa00 || character == 0xe193ab00) { + if (sequence == 0xe193aa00 || sequence == 0xe193ab00) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+1505 to U+150B. - if (character >= 0xe1948500 && character <= 0xe1948b00) { + if (sequence >= 0xe1948500 && sequence <= 0xe1948b00) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+1525. - if (character == 0xe194a500) { + if (sequence == 0xe194a500) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+153E to U+1541. - if (character >= 0xe194be00 && character <= 0xe1958100) { + if (sequence >= 0xe194be00 && sequence <= 0xe1958100) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+1550, U+1551, U+155D, U+156A. - if (character == 0xe1959000 || character == 0xe1959100 || character == 0xe1959d00 || character == 0xe195aa00) { + if (sequence == 0xe1959000 || sequence == 0xe1959100 || sequence == 0xe1959d00 || sequence == 0xe195aa00) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+157B, U+156F, U+157D, U+1585. - if (character == 0xe195bb00 || character == 0xe195af00 || character == 0xe195bd00 || character == 0xe1968500) { + if (sequence == 0xe195bb00 || sequence == 0xe195af00 || sequence == 0xe195bd00 || sequence == 0xe1968500) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+1595, U+1596, U+159F, U+15A6. - if (character == 0xe1969500 || character == 0xe1969600 || character == 0xe1969f00 || character == 0xe196a600) { + if (sequence == 0xe1969500 || sequence == 0xe1969600 || sequence == 0xe1969f00 || sequence == 0xe196a600) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+15AE, U+15EE, U+1601, U+1646. - if (character == 0xe196ae00 || character == 0xe197ae00 || character == 0xe1988100 || character == 0xe1998600) { + if (sequence == 0xe196ae00 || sequence == 0xe197ae00 || sequence == 0xe1988100 || sequence == 0xe1998600) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+1647, U+165A, U+167E, U+167F. - if (character == 0xe1998700 || character == 0xe1999a00 || character == 0xe199be00 || character == 0xe199bf00) { + if (sequence == 0xe1998700 || sequence == 0xe1999a00 || sequence == 0xe199be00 || sequence == 0xe199bf00) { return F_true; } } else { // Phonetic Extensions: U+1D2C to U+1D61. - if (character >= 0xe1b4ac00 && character <= 0xe1b5a100) { + if (sequence >= 0xe1b4ac00 && sequence <= 0xe1b5a100) { return F_true; } // Phonetic Extensions: U+1D78. - if (character == 0xe1b5b800) { + if (sequence == 0xe1b5b800) { return F_true; } // Phonetic Extensions Supplement: U+1D9B to U+1DBF. - if (character >= 0xe1b69b00 && character <= 0xe1b6bf00) { + if (sequence >= 0xe1b69b00 && sequence <= 0xe1b6bf00) { return F_true; } } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe2) { // Superscripts and Subscripts: U+2070, U+2071. - if (character == 0xe281b000 || character == 0xe281b100) { + if (sequence == 0xe281b000 || sequence == 0xe281b100) { return F_true; } // Superscripts and Subscripts: U+2074 to U+207F. - if (character >= 0xe281b400 && character <= 0xe281bf00) { + if (sequence >= 0xe281b400 && sequence <= 0xe281bf00) { return F_true; } // Latin Extended-C: U+2C7D. - if (character == 0xe2b1bd00) { + if (sequence == 0xe2b1bd00) { return F_true; } // Tifinagh: U+2D6F. - if (character == 0xe2b5af00) { + if (sequence == 0xe2b5af00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe3) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe3) { // Kanbun: U+3191 to U+319F. - if (character >= 0xe3869100 && character <= 0xe3869f00) { + if (sequence >= 0xe3869100 && sequence <= 0xe3869f00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xea) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xea) { // Cyrillic Extended-B: U+A69C, U+A69D. - if (character == 0xea9a9c00 || character == 0xea9a9d00) { + if (sequence == 0xea9a9c00 || sequence == 0xea9a9d00) { return F_true; } // Latin Extended-D: U+A770. - if (character == 0xea9db000) { + if (sequence == 0xea9db000) { return F_true; } // Latin Extended-D: U+A7F2 to U+A7F4. - if (character >= 0xea9fb200 && character <= 0xea9fb400) { + if (sequence >= 0xea9fb200 && sequence <= 0xea9fb400) { return F_true; } // Latin Extended-D: U+A7F8, U+A7F9. - if (character == 0xea9fb800 || character == 0xea9fb900) { + if (sequence == 0xea9fb800 || sequence == 0xea9fb900) { return F_true; } // Latin Extended-E: U+AB5C to U+AB5F. - if (character >= 0xeaad9c00 && character <= 0xeaad9f00) { + if (sequence >= 0xeaad9c00 && sequence <= 0xeaad9f00) { return F_true; } } @@ -200,22 +200,22 @@ extern "C" { return F_false; } - if (macro_f_utf_char_t_to_char_1(character) == 0xf0) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xf0) { - if (macro_f_utf_char_t_to_char_2(character) == 0x90) { + if (macro_f_utf_char_t_to_char_2(sequence) == 0x90) { // Latin Extended-F: U+10780 to U+10785. - if (character >= 0xf0909e80 && character <= 0xf0909e85) { + if (sequence >= 0xf0909e80 && sequence <= 0xf0909e85) { return F_true; } // Latin Extended-F: U+10787 to U+107B0. - if (character >= 0xf0909e87 && character <= 0xf0909eb0) { + if (sequence >= 0xf0909e87 && sequence <= 0xf0909eb0) { return F_true; } // Latin Extended-F: U+107B2 to U+107BA. - if (character >= 0xf0909eb2 && character <= 0xf0909eba) { + if (sequence >= 0xf0909eb2 && sequence <= 0xf0909eba) { return F_true; } } diff --git a/level_0/f_utf/c/private-utf_superscript.h b/level_0/f_utf/c/private-utf_superscript.h index 60cb6e3..28740d0 100644 --- a/level_0/f_utf/c/private-utf_superscript.h +++ b/level_0/f_utf/c/private-utf_superscript.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 superscript character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_superscript() */ #if !defined(_di_f_utf_character_is_superscript_) || !defined(_di_f_utf_is_superscript_) - extern f_status_t private_f_utf_character_is_superscript(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_superscript(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_superscript_) || !defined(_di_f_utf_is_superscript_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_surrogate.c b/level_0/f_utf/c/private-utf_surrogate.c deleted file mode 100644 index 8a251cb..0000000 --- a/level_0/f_utf/c/private-utf_surrogate.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "utf.h" -#include "private-utf.h" -#include "private-utf_surrogate.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_utf_character_is_surrogate_) || !defined(_di_f_utf_is_surrogate_) - f_status_t private_f_utf_character_is_surrogate(const f_utf_char_t character) { - - if (macro_f_utf_char_t_width_is(character) == 3) { - - if (macro_f_utf_char_t_to_char_1(character) == 0xed) { - - // High Surrogates: U+D800 to U+DB7F. - if (character >= 0xeda08000 && character <= 0xedadbf00) { - return F_true; - } - - // High Private Use Surrogates: U+DB80 to U+DBFF. - if (character >= 0xedae8000 && character <= 0xedafbf00) { - return F_true; - } - - // Low Surrogates: U+DC00 to U+DFFF. - if (character >= 0xedb08000 && character <= 0xedbfbf00) { - return F_true; - } - } - } - - return F_false; - } -#endif // !defined(_di_f_utf_character_is_surrogate_) || !defined(_di_f_utf_is_surrogate_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_utf/c/private-utf_surrogate.h b/level_0/f_utf/c/private-utf_surrogate.h deleted file mode 100644 index 794630d..0000000 --- a/level_0/f_utf/c/private-utf_surrogate.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: UTF - * API Version: 0.5 - * Licenses: lgpl-2.1-or-later - * - * Provides UTF-8 capabilities. - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_utf_surrogate_h -#define _PRIVATE_F_utf_surrogate_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation of f_utf_character_is_surrogate(). - * - * Intended to be shared to each of the different implementation variations. - * - * This expects the character width to be of at least size 2. - * - * @param character - * The character to validate. - * - * @return - * F_true if a UTF-8 surrogate character. - * F_false if not a UTF-8 surrogate character. - * - * F_utf_fragment (with error bit) if character is a UTF-8 fragment. - * F_utf_not (with error bit) if unicode is an invalid Unicode character. - * - * @see f_utf_character_is_surrogate() - * @see f_utf_is_surrogate() - */ -#if !defined(_di_f_utf_character_is_surrogate_) || !defined(_di_f_utf_is_surrogate_) - extern f_status_t private_f_utf_character_is_surrogate(const f_utf_char_t character) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_utf_character_is_surrogate_) || !defined(_di_f_utf_is_surrogate_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_utf_surrogate_h diff --git a/level_0/f_utf/c/private-utf_symbol.c b/level_0/f_utf/c/private-utf_symbol.c index 5497abc..c3a38e8 100644 --- a/level_0/f_utf/c/private-utf_symbol.c +++ b/level_0/f_utf/c/private-utf_symbol.c @@ -7,119 +7,119 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_symbol_) || !defined(_di_f_utf_is_symbol_) - f_status_t private_f_utf_character_is_symbol(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_symbol(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { - if (macro_f_utf_char_t_to_char_1(character) == 0xc2) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xc2) { // Latin-1 Supplement: U+00A2 to U+00A6. - if (character >= 0xc2a20000 && character <= 0xc2a60000) { + if (sequence >= 0xc2a20000 && sequence <= 0xc2a60000) { return F_true; } // Latin-1 Supplement: U+00A8, U+00A9, U+00AC, U+00AE. - if (character == 0xc2a80000 || character == 0xc2a90000 || character == 0xc2ac0000 || character == 0xc2ae0000) { + if (sequence == 0xc2a80000 || sequence == 0xc2a90000 || sequence == 0xc2ac0000 || sequence == 0xc2ae0000) { return F_true; } // Latin-1 Supplement: U+00AF, U+00B0, U+00B1, U+00B4. - if (character == 0xc2af0000 || character == 0xc2b00000 || character == 0xc2b10000 || character == 0xc2b40000) { + if (sequence == 0xc2af0000 || sequence == 0xc2b00000 || sequence == 0xc2b10000 || sequence == 0xc2b40000) { return F_true; } // Latin-1 Supplement: U+00B8. - if (character == 0xc2b80000) { + if (sequence == 0xc2b80000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xc3) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xc3) { // Latin-1 Supplement: U+00D7, U+00F7. - if (character == 0xc3970000 || character == 0xc3b70000) { + if (sequence == 0xc3970000 || sequence == 0xc3b70000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xcb) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xcb) { // Spacing Modifier Letters: U+02C2 to U+02C5. - if (character >= 0xcb820000 && character <= 0xcb850000) { + if (sequence >= 0xcb820000 && sequence <= 0xcb850000) { return F_true; } // Spacing Modifier Letters: U+02D2 to U+02DF. - if (character >= 0xcb920000 && character <= 0xcb9f0000) { + if (sequence >= 0xcb920000 && sequence <= 0xcb9f0000) { return F_true; } // Spacing Modifier Letters: U+02E5 to U+02EB. - if (character >= 0xcba50000 && character <= 0xcbab0000) { + if (sequence >= 0xcba50000 && sequence <= 0xcbab0000) { return F_true; } // Spacing Modifier Letters: U+02ED to U+02FF. - if (character >= 0xcbad0000 && character <= 0xcbbf0000) { + if (sequence >= 0xcbad0000 && sequence <= 0xcbbf0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xcd) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xcd) { // Greek and Coptic: U+0375. - if (character == 0xcdb50000) { + if (sequence == 0xcdb50000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xce) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xce) { // Greek and Coptic: U+0384, U+0385. - if (character == 0xce840000 || character == 0xce850000) { + if (sequence == 0xce840000 || sequence == 0xce850000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xcf) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xcf) { // Greek and Coptic: U+03F6. - if (character == 0xcfb60000) { + if (sequence == 0xcfb60000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xd2) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xd2) { // Cyrillic: U+0482. - if (character == 0xd2820000) { + if (sequence == 0xd2820000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xd6) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xd6) { // Armenian: U+058D to U+058F. - if (character >= 0xd68d0000 && character <= 0xd68f0000) { + if (sequence >= 0xd68d0000 && sequence <= 0xd68f0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xd8) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xd8) { // Arabic: U+0606 to U+0608. - if (character >= 0xd8860000 && character <= 0xd8880000) { + if (sequence >= 0xd8860000 && sequence <= 0xd8880000) { return F_true; } // Arabic: U+060B, U+060E, U+060F. - if (character == 0xd88b0000 || character == 0xd88e0000 || character == 0xd88f0000) { + if (sequence == 0xd88b0000 || sequence == 0xd88e0000 || sequence == 0xd88f0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xdb) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xdb) { // Arabic: U+06DE, U+06E9, U+06FD, U+06FE. - if (character == 0xdb9e0000 || character == 0xdba90000 || character == 0xdbbd0000 || character == 0xdbbe0000) { + if (sequence == 0xdb9e0000 || sequence == 0xdba90000 || sequence == 0xdbbd0000 || sequence == 0xdbbe0000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xdf) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xdf) { // NKo: U+07F6, U+07FE, U+07FF. - if (character == 0xdfb60000 || character == 0xdfbe0000 || character == 0xdfbf0000) { + if (sequence == 0xdfb60000 || sequence == 0xdfbe0000 || sequence == 0xdfbf0000) { return F_true; } } @@ -127,554 +127,554 @@ extern "C" { return F_false; } - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { - if (macro_f_utf_char_t_to_char_1(character) == 0xe0) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xe0) { // Arabic Extended-B: U+0888. - if (character == 0xe0a28800) { + if (sequence == 0xe0a28800) { return F_true; } // Bengali: U+09F2, U+09F3, U+09FA, U+09FB. - if (character == 0xe0a7b200 || character == 0xe0a7b300 || character == 0xe0a7ba00 || character == 0xe0a7bb00) { + if (sequence == 0xe0a7b200 || sequence == 0xe0a7b300 || sequence == 0xe0a7ba00 || sequence == 0xe0a7bb00) { return F_true; } // Gujarati: U+0AF1. - if (character == 0xe0abb100) { + if (sequence == 0xe0abb100) { return F_true; } // Oriya: U+0B70. - if (character == 0xe0adb000) { + if (sequence == 0xe0adb000) { return F_true; } // Tamil: U+0BF3 to U+0BFA. - if (character >= 0xe0afb300 && character <= 0xe0afba00) { + if (sequence >= 0xe0afb300 && sequence <= 0xe0afba00) { return F_true; } // Telugu: U+0C7F. - if (character == 0xe0b1bf00) { + if (sequence == 0xe0b1bf00) { return F_true; } // Malayalam: U+0D4F, U+0D79. - if (character == 0xe0b58f00 || character == 0xe0b5b900) { + if (sequence == 0xe0b58f00 || sequence == 0xe0b5b900) { return F_true; } // Thai: U+0E3F. - if (character == 0xe0b8bf00) { + if (sequence == 0xe0b8bf00) { return F_true; } // Tibetan: U+0F01 to U+0F03. - if (character >= 0xe0bc8100 && character <= 0xe0bc8300) { + if (sequence >= 0xe0bc8100 && sequence <= 0xe0bc8300) { return F_true; } // Tibetan: U+0F13. - if (character == 0xe0bc9300) { + if (sequence == 0xe0bc9300) { return F_true; } // Tibetan: U+0F15 to U+0F17. - if (character >= 0xe0bc9500 && character <= 0xe0bc9700) { + if (sequence >= 0xe0bc9500 && sequence <= 0xe0bc9700) { return F_true; } // Tibetan: U+0F1A to U+0F1F. - if (character >= 0xe0bc9a00 && character <= 0xe0bc9f00) { + if (sequence >= 0xe0bc9a00 && sequence <= 0xe0bc9f00) { return F_true; } // Tibetan: U+0F34, U+0F36, U+0F38. - if (character == 0xe0bcb400 || character == 0xe0bcb600 || character == 0xe0bcb800) { + if (sequence == 0xe0bcb400 || sequence == 0xe0bcb600 || sequence == 0xe0bcb800) { return F_true; } // Tibetan: U+0FBE to U+0FC5. - if (character >= 0xe0bebe00 && character <= 0xe0bf8500) { + if (sequence >= 0xe0bebe00 && sequence <= 0xe0bf8500) { return F_true; } // Tibetan: U+0FC7 to U+0FCC. - if (character >= 0xe0bf8700 && character <= 0xe0bf8c00) { + if (sequence >= 0xe0bf8700 && sequence <= 0xe0bf8c00) { return F_true; } // Tibetan: U+0FCE, U+0FCF. - if (character == 0xe0bf8e00 || character == 0xe0bf8f00) { + if (sequence == 0xe0bf8e00 || sequence == 0xe0bf8f00) { return F_true; } // Tibetan: U+0FD5 to U+0FD8. - if (character >= 0xe0bf9500 && character <= 0xe0bf9800) { + if (sequence >= 0xe0bf9500 && sequence <= 0xe0bf9800) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe1) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe1) { // Myanmar: U+109E, U+109F. - if (character == 0xe1829e00 || character == 0xe1829f00) { + if (sequence == 0xe1829e00 || sequence == 0xe1829f00) { return F_true; } // Ethiopic Supplement: U+1390 to U+1399. - if (character >= 0xe18e9000 && character <= 0xe18e9900) { + if (sequence >= 0xe18e9000 && sequence <= 0xe18e9900) { return F_true; } // Unified Canadian Aboriginal Syllabics: U+166D. - if (character == 0xe199ad00) { + if (sequence == 0xe199ad00) { return F_true; } // Khmer: U+17DB. - if (character == 0xe19f9b00) { + if (sequence == 0xe19f9b00) { return F_true; } // Limbu: U+1940. - if (character == 0xe1a58000) { + if (sequence == 0xe1a58000) { return F_true; } // New Tai Lue to Khmer Symbols: U+19DE to U+19FF. - if (character >= 0xe1a79e00 && character <= 0xe1a7bf00) { + if (sequence >= 0xe1a79e00 && sequence <= 0xe1a7bf00) { return F_true; } // Balinese: U+1B61 to U+1B6A. - if (character >= 0xe1ada100 && character <= 0xe1adaa00) { + if (sequence >= 0xe1ada100 && sequence <= 0xe1adaa00) { return F_true; } // Balinese: U+1B74 to U+1B7C. - if (character >= 0xe1adb400 && character <= 0xe1adbc00) { + if (sequence >= 0xe1adb400 && sequence <= 0xe1adbc00) { return F_true; } // Greek Extended: U+1FBD, U+1FBF, U+1FC0, U+1FC1. - if (character == 0xe1bebd00 || character == 0xe1bebf00 || character == 0xe1bf8000 || character == 0xe1bf8100) { + if (sequence == 0xe1bebd00 || sequence == 0xe1bebf00 || sequence == 0xe1bf8000 || sequence == 0xe1bf8100) { return F_true; } // Greek Extended: U+1FCD to U+1FCF. - if (character >= 0xe1bf8d00 && character <= 0xe1bf8f00) { + if (sequence >= 0xe1bf8d00 && sequence <= 0xe1bf8f00) { return F_true; } // Greek Extended: U+1FDD to U+1FDF. - if (character >= 0xe1bf9d00 && character <= 0xe1bf9f00) { + if (sequence >= 0xe1bf9d00 && sequence <= 0xe1bf9f00) { return F_true; } // Greek Extended: U+1FED to U+1FEF. - if (character >= 0xe1bfad00 && character <= 0xe1bfaf00) { + if (sequence >= 0xe1bfad00 && sequence <= 0xe1bfaf00) { return F_true; } // Greek Extended: U+1FFD, U+1FFE. - if (character == 0xe1bfbd00 || character == 0xe1bfbe00) { + if (sequence == 0xe1bfbd00 || sequence == 0xe1bfbe00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe2) { // General Punctuation: U+2044, U+2052. - if (character == 0xe2818400 || character == 0xe2819200) { + if (sequence == 0xe2818400 || sequence == 0xe2819200) { return F_true; } // Superscripts and Subscripts: U+207A to U+207C. - if (character >= 0xe281ba00 && character <= 0xe281bc00) { + if (sequence >= 0xe281ba00 && sequence <= 0xe281bc00) { return F_true; } // Superscripts and Subscripts: U+208A to U+208C. - if (character >= 0xe2828a00 && character <= 0xe2828c00) { + if (sequence >= 0xe2828a00 && sequence <= 0xe2828c00) { return F_true; } // Currency Symbols: U+20A0 to U+20C0. - if (character >= 0xe282a000 && character <= 0xe2838000) { + if (sequence >= 0xe282a000 && sequence <= 0xe2838000) { return F_true; } // Letterlike Symbols: U+2100, U+2101. - if (character == 0xe2848000 || character == 0xe2848100) { + if (sequence == 0xe2848000 || sequence == 0xe2848100) { return F_true; } // Letterlike Symbols: U+2103 to U+2106. - if (character >= 0xe2848300 && character <= 0xe2848600) { + if (sequence >= 0xe2848300 && sequence <= 0xe2848600) { return F_true; } // Letterlike Symbols: U+2108, U+2109, U+2114. - if (character == 0xe2848800 || character == 0xe2848900 || character == 0xe2849400) { + if (sequence == 0xe2848800 || sequence == 0xe2848900 || sequence == 0xe2849400) { return F_true; } // Letterlike Symbols: U+2116 to U+2118. - if (character >= 0xe2849600 && character <= 0xe2849800) { + if (sequence >= 0xe2849600 && sequence <= 0xe2849800) { return F_true; } // Letterlike Symbols: U+211E to U+2123. - if (character >= 0xe2849e00 && character <= 0xe284a300) { + if (sequence >= 0xe2849e00 && sequence <= 0xe284a300) { return F_true; } // Letterlike Symbols: U+2140 to U+2144. - if (character >= 0xe2858000 && character <= 0xe2858400) { + if (sequence >= 0xe2858000 && sequence <= 0xe2858400) { return F_true; } // Letterlike Symbols: U+214B. - if (character == 0xe2858b00) { + if (sequence == 0xe2858b00) { return F_true; } // Arrows: U+2190 to U+2194. - if (character >= 0xe2869000 && character <= 0xe2869400) { + if (sequence >= 0xe2869000 && sequence <= 0xe2869400) { return F_true; } // Arrows: U+219A, U+219B, U+21A0, U+21A3. - if (character == 0xe2869a00 || character == 0xe2869b00 || character == 0xe286a000 || character == 0xe286a300) { + if (sequence == 0xe2869a00 || sequence == 0xe2869b00 || sequence == 0xe286a000 || sequence == 0xe286a300) { return F_true; } // Arrows: U+21A6, U+21AE, U+21CE, U+21CF. - if (character == 0xe286a600 || character == 0xe286ae00 || character == 0xe2878e00 || character == 0xe2878f00) { + if (sequence == 0xe286a600 || sequence == 0xe286ae00 || sequence == 0xe2878e00 || sequence == 0xe2878f00) { return F_true; } // Arrows: U+21D2, U+21D4. - if (character == 0xe2879200 || character == 0xe2879400) { + if (sequence == 0xe2879200 || sequence == 0xe2879400) { return F_true; } // Arrows to Mathematical Operators: U+21F4 to U+22FF. - if (character >= 0xe287b400 && character <= 0xe28bbf00) { + if (sequence >= 0xe287b400 && sequence <= 0xe28bbf00) { return F_true; } // Letterlike Symbols: U+2125, U+2127, U+2129, U+212E. - if (character == 0xe284a500 || character == 0xe284a700 || character == 0xe284a900 || character == 0xe284ae00) { + if (sequence == 0xe284a500 || sequence == 0xe284a700 || sequence == 0xe284a900 || sequence == 0xe284ae00) { return F_true; } // Letterlike Symbols: U+213A, U+213B. - if (character == 0xe284ba00 || character == 0xe284bb00) { + if (sequence == 0xe284ba00 || sequence == 0xe284bb00) { return F_true; } // Letterlike Symbols: U+2140 to U+2144. - if (character >= 0xe2858000 && character <= 0xe2858400) { + if (sequence >= 0xe2858000 && sequence <= 0xe2858400) { return F_true; } // Letterlike Symbols: U+214A to U+214D. - if (character >= 0xe2858a00 && character <= 0xe2858d00) { + if (sequence >= 0xe2858a00 && sequence <= 0xe2858d00) { return F_true; } // Letterlike Symbols: U+214F. - if (character == 0xe2858f00) { + if (sequence == 0xe2858f00) { return F_true; } // Number Forms: U+218A, U+218B. - if (character == 0xe2868a00 || character == 0xe2868b00) { + if (sequence == 0xe2868a00 || sequence == 0xe2868b00) { return F_true; } // Arrows to Miscellaneous Technical: U+2190 to U+2328. - if (character >= 0xe2869000 && character <= 0xe28ca800) { + if (sequence >= 0xe2869000 && sequence <= 0xe28ca800) { return F_true; } // Miscellaneous Technical: U+232B to U+2426. - if (character >= 0xe28cab00 && character <= 0xe290a600) { + if (sequence >= 0xe28cab00 && sequence <= 0xe290a600) { return F_true; } // Optical Character Recognition: U+2440 to U+244A. - if (character >= 0xe2918000 && character <= 0xe2918a00) { + if (sequence >= 0xe2918000 && sequence <= 0xe2918a00) { return F_true; } // Enclosed Alphanumerics: U+249C to U+24E9. - if (character >= 0xe2929c00 && character <= 0xe293a900) { + if (sequence >= 0xe2929c00 && sequence <= 0xe293a900) { return F_true; } // Box Drawing to Geometric Shapes: U+2500 to U+2767. - if (character >= 0xe2948000 && character <= 0xe29da700) { + if (sequence >= 0xe2948000 && sequence <= 0xe29da700) { return F_true; } // Dingbats to Miscellaneous Mathematical Symbols-A: U+2794 to U+27C4. - if (character >= 0xe29e9400 && character <= 0xe29f8400) { + if (sequence >= 0xe29e9400 && sequence <= 0xe29f8400) { return F_true; } // Miscellaneous Mathematical Symbols-A: U+27C7 to U+27E5. - if (character >= 0xe29f8700 && character <= 0xe29fa500) { + if (sequence >= 0xe29f8700 && sequence <= 0xe29fa500) { return F_true; } // Supplemental Arrows-A: U+27F0 to U+27FF. - if (character >= 0xe29fb000 && character <= 0xe29fbf00) { + if (sequence >= 0xe29fb000 && sequence <= 0xe29fbf00) { return F_true; } // Braille Patterns to Miscellaneous Mathematical Symbols-B: U+2800 to U+2982. - if (character >= 0xe2a08000 && character <= 0xe2a68200) { + if (sequence >= 0xe2a08000 && sequence <= 0xe2a68200) { return F_true; } // Miscellaneous Mathematical Symbols-B: U+2999 to U+29D7. - if (character >= 0xe2a69900 && character <= 0xe2a79700) { + if (sequence >= 0xe2a69900 && sequence <= 0xe2a79700) { return F_true; } // Miscellaneous Mathematical Symbols-B: U+29DC to U+29FB. - if (character >= 0xe2a79c00 && character <= 0xe2a7bb00) { + if (sequence >= 0xe2a79c00 && sequence <= 0xe2a7bb00) { return F_true; } // Miscellaneous Mathematical Symbols-B to Supplemental Mathematical Operators: U+29FE to U+2B73. - if (character >= 0xe2a7be00 && character <= 0xe2adb300) { + if (sequence >= 0xe2a7be00 && sequence <= 0xe2adb300) { return F_true; } // Miscellaneous Symbols and Arrows: U+2B76 to U+2B95. - if (character >= 0xe2adb600 && character <= 0xe2ae9500) { + if (sequence >= 0xe2adb600 && sequence <= 0xe2ae9500) { return F_true; } // Miscellaneous Symbols and Arrows: U+2B97 to U+2BFF. - if (character >= 0xe2ae9700 && character <= 0xe2afbf00) { + if (sequence >= 0xe2ae9700 && sequence <= 0xe2afbf00) { return F_true; } // Coptic: U+2CE5 to U+2CEA. - if (character >= 0xe2b3a500 && character <= 0xe2b3aa00) { + if (sequence >= 0xe2b3a500 && sequence <= 0xe2b3aa00) { return F_true; } // Supplemental Punctuation: U+2E50, U+2E51. - if (character == 0xe2b99000 || character == 0xe2b99100) { + if (sequence == 0xe2b99000 || sequence == 0xe2b99100) { return F_true; } // CJK Radicals Supplement: U+2E80 to U+2E99. - if (character >= 0xe2ba8000 && character <= 0xe2ba9900) { + if (sequence >= 0xe2ba8000 && sequence <= 0xe2ba9900) { return F_true; } // CJK Radicals Supplement: U+2E9B to U+2EF3. - if (character >= 0xe2ba9b00 && character <= 0xe2bbb300) { + if (sequence >= 0xe2ba9b00 && sequence <= 0xe2bbb300) { return F_true; } // Kangxi Radicals: U+2F00 to U+2FD5. - if (character >= 0xe2bc8000 && character <= 0xe2bf9500) { + if (sequence >= 0xe2bc8000 && sequence <= 0xe2bf9500) { return F_true; } // Ideographic Description Characters: U+2FF0 to U+2FFB. - if (character >= 0xe2bfb000 && character <= 0xe2bfbb00) { + if (sequence >= 0xe2bfb000 && sequence <= 0xe2bfbb00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe3) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe3) { // CJK Symbols and Punctuation: U+3004, U+3012, U+3013, U+3020. - if (character == 0xe3808400 || character == 0xe3809200 || character == 0xe3809300 || character == 0xe380a000) { + if (sequence == 0xe3808400 || sequence == 0xe3809200 || sequence == 0xe3809300 || sequence == 0xe380a000) { return F_true; } // CJK Symbols and Punctuation: U+3036, U+3037, U+303E, U+303F. - if (character == 0xe380b600 || character == 0xe380b700 || character == 0xe380be00 || character == 0xe380bf00) { + if (sequence == 0xe380b600 || sequence == 0xe380b700 || sequence == 0xe380be00 || sequence == 0xe380bf00) { return F_true; } // Hiragana: U+309B, U+309C. - if (character == 0xe3829b00 || character == 0xe3829c00) { + if (sequence == 0xe3829b00 || sequence == 0xe3829c00) { return F_true; } // Kanbun: U+3190, U+3191. - if (character == 0xe3869000 || character == 0xe3869100) { + if (sequence == 0xe3869000 || sequence == 0xe3869100) { return F_true; } // Kanbun to CJK Strokes: U+3196 to U+31E3. - if (character >= 0xe3869600 && character <= 0xe387a300) { + if (sequence >= 0xe3869600 && sequence <= 0xe387a300) { return F_true; } // Enclosed CJK Letters and Months: U+3200 to U+321E. - if (character >= 0xe3888000 && character <= 0xe3889e00) { + if (sequence >= 0xe3888000 && sequence <= 0xe3889e00) { return F_true; } // Enclosed CJK Letters and Months: U+322A to U+3247. - if (character >= 0xe388aa00 && character <= 0xe3898700) { + if (sequence >= 0xe388aa00 && sequence <= 0xe3898700) { return F_true; } // Enclosed CJK Letters and Months: U+3250. - if (character == 0xe3899000) { + if (sequence == 0xe3899000) { return F_true; } // Enclosed CJK Letters and Months: U+3260 to U+327F. - if (character >= 0xe389a000 && character <= 0xe389bf00) { + if (sequence >= 0xe389a000 && sequence <= 0xe389bf00) { return F_true; } // Enclosed CJK Letters and Months: U+328A to U+32B0. - if (character >= 0xe38a8a00 && character <= 0xe38ab000) { + if (sequence >= 0xe38a8a00 && sequence <= 0xe38ab000) { return F_true; } // Enclosed CJK Letters and Months to CJK Compatibility: U+32C0 to U+33FF. - if (character >= 0xe38b8000 && character <= 0xe38fbf00) { + if (sequence >= 0xe38b8000 && sequence <= 0xe38fbf00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe4) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe4) { // Yijing Hexagram Symbols: U+4DC0 to U+4DFF. - if (character >= 0xe4b78000 && character <= 0xe4b7bf00) { + if (sequence >= 0xe4b78000 && sequence <= 0xe4b7bf00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xea) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xea) { // Yi Radicals: U+A490 to U+A4C6. - if (character >= 0xea929000 && character <= 0xea938600) { + if (sequence >= 0xea929000 && sequence <= 0xea938600) { return F_true; } // Modifier Tone Letters: U+A700 to U+A716. - if (character >= 0xea9c8000 && character <= 0xea9c9600) { + if (sequence >= 0xea9c8000 && sequence <= 0xea9c9600) { return F_true; } // Modifier Tone Letters: U+A720, U+A721. - if (character == 0xea9ca000 || character == 0xea9ca100) { + if (sequence == 0xea9ca000 || sequence == 0xea9ca100) { return F_true; } // Latin Extended-D: U+A789, U+A78A. - if (character == 0xea9e8900 || character == 0xea9e8a00) { + if (sequence == 0xea9e8900 || sequence == 0xea9e8a00) { return F_true; } // Syloti Nagri: U+A828 to U+A82B. - if (character >= 0xeaa0a800 && character <= 0xeaa0ab00) { + if (sequence >= 0xeaa0a800 && sequence <= 0xeaa0ab00) { return F_true; } // Common Indic Number Forms: U+A836 to U+A839. - if (character >= 0xeaa0b600 && character <= 0xeaa0b900) { + if (sequence >= 0xeaa0b600 && sequence <= 0xeaa0b900) { return F_true; } // Myanmar Extended-A: U+AA77 to U+AA79. - if (character >= 0xeaa9b700 && character <= 0xeaa9b900) { + if (sequence >= 0xeaa9b700 && sequence <= 0xeaa9b900) { return F_true; } // Latin Extended-E: U+AB5B, U+AB6A, U+AB6B. - if (character == 0xeaad9b00 || character == 0xeaadaa00 || character == 0xeaadab00) { + if (sequence == 0xeaad9b00 || sequence == 0xeaadaa00 || sequence == 0xeaadab00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xef) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xef) { // Alphabetic Presentation Forms: U+FB29. - if (character == 0xefaca900) { + if (sequence == 0xefaca900) { return F_true; } // Arabic Presentation Forms-A: U+FBB2 to U+FBC2. - if (character >= 0xefaeb200 && character <= 0xefaf8200) { + if (sequence >= 0xefaeb200 && sequence <= 0xefaf8200) { return F_true; } // Arabic Presentation Forms-A: U+FD40 to U+FD4F. - if (character >= 0xefb58000 && character <= 0xefb58f00) { + if (sequence >= 0xefb58000 && sequence <= 0xefb58f00) { return F_true; } // Arabic Presentation Forms-A: U+FDCF. - if (character == 0xefb78f00) { + if (sequence == 0xefb78f00) { return F_true; } // Arabic Presentation Forms-A: U+FDFC to U+FDFF. - if (character >= 0xefb7bc00 && character <= 0xefb7bf00) { + if (sequence >= 0xefb7bc00 && sequence <= 0xefb7bf00) { return F_true; } // Small Form Variants: U+FE62. - if (character == 0xefb9a200) { + if (sequence == 0xefb9a200) { return F_true; } // Small Form Variants: U+FE64 to U+FE66. - if (character >= 0xefb9a400 && character <= 0xefb9a600) { + if (sequence >= 0xefb9a400 && sequence <= 0xefb9a600) { return F_true; } // Small Form Variants: U+FE69. - if (character == 0xefb9a900) { + if (sequence == 0xefb9a900) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF04, U+FF0B. - if (character == 0xefbc8400 || character == 0xefbc8b00) { + if (sequence == 0xefbc8400 || sequence == 0xefbc8b00) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF1C to U+FF1E. - if (character >= 0xefbc9c00 && character <= 0xefbc9e00) { + if (sequence >= 0xefbc9c00 && sequence <= 0xefbc9e00) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF3E, U+FF40. - if (character == 0xefbcbe00 || character == 0xefbd8000) { + if (sequence == 0xefbcbe00 || sequence == 0xefbd8000) { return F_true; } // Halfwidth and Fullwidth Forms: U+FFE0 to U+FFE6. - if (character >= 0xefbfa000 && character <= 0xefbfa600) { + if (sequence >= 0xefbfa000 && sequence <= 0xefbfa600) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF5C, U+FF5E, U+FFE2. - if (character == 0xefbd9c00 || character == 0xefbd9e00 || character == 0xefbfa200) { + if (sequence == 0xefbd9c00 || sequence == 0xefbd9e00 || sequence == 0xefbfa200) { return F_true; } // Halfwidth and Fullwidth Forms: U+FFE8 to U+FFEE. - if (character >= 0xefbfa800 && character <= 0xefbfae00) { + if (sequence >= 0xefbfa800 && sequence <= 0xefbfae00) { return F_true; } // Specials: U+FFFC, U+FFFD. - if (character == 0xefbfbc00 || character == 0xefbfbd00) { + if (sequence == 0xefbfbc00 || sequence == 0xefbfbd00) { return F_true; } } @@ -682,341 +682,341 @@ extern "C" { return F_false; } - if (macro_f_utf_char_t_to_char_1(character) == 0xf0) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xf0) { - if (macro_f_utf_char_t_to_char_2(character) == 0x90) { + if (macro_f_utf_char_t_to_char_2(sequence) == 0x90) { // Aegean Numbers: U+10137 to U+1013F. - if (character >= 0xf09084b7 && character <= 0xf09084bf) { + if (sequence >= 0xf09084b7 && sequence <= 0xf09084bf) { return F_true; } // Ancient Greek Numbers: U+10179 to U+10189. - if (character >= 0xf09085b9 && character <= 0xf0908689) { + if (sequence >= 0xf09085b9 && sequence <= 0xf0908689) { return F_true; } // Ancient Greek Numbers: U+1018C to U+1018E. - if (character >= 0xf090868c && character <= 0xf090868e) { + if (sequence >= 0xf090868c && sequence <= 0xf090868e) { return F_true; } // Ancient Symbols: U+10190 to U+1019C. - if (character >= 0xf0908690 && character <= 0xf090869c) { + if (sequence >= 0xf0908690 && sequence <= 0xf090869c) { return F_true; } // Ancient Symbols: U+10190 to U+1019C. - if (character >= 0xf0908690 && character <= 0xf090869c) { + if (sequence >= 0xf0908690 && sequence <= 0xf090869c) { return F_true; } // Ancient Symbols: U+101A0. - if (character == 0xf09086a0) { + if (sequence == 0xf09086a0) { return F_true; } // Phaistos Disc: U+101D0 to U+101FC. - if (character >= 0xf0908790 && character <= 0xf09087bc) { + if (sequence >= 0xf0908790 && sequence <= 0xf09087bc) { return F_true; } // Palmyrene: U+10877, U+10878. - if (character == 0xf090a1b7 || character == 0xf090a1b8) { + if (sequence == 0xf090a1b7 || sequence == 0xf090a1b8) { return F_true; } // Manichaean: U+10AC8. - if (character == 0xf090ab88) { + if (sequence == 0xf090ab88) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x91) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x91) { // Ahom: U+1173F. - if (character == 0xf0919cbf) { + if (sequence == 0xf0919cbf) { return F_true; } // Tamil Supplement: U+11FD5 to U+11FF1. - if (character >= 0xf091bf95 && character <= 0xf091bfb1) { + if (sequence >= 0xf091bf95 && sequence <= 0xf091bfb1) { return F_true; } // Mathematical Alphanumeric Symbols: U+1D6C1, U+1D6FB, U+1D715, U+1D735. - if (character == 0xf09d9b81 || character == 0xf09d9bbb || character == 0x09d9c95 || character == 0xf09d9cb5) { + if (sequence == 0xf09d9b81 || sequence == 0xf09d9bbb || sequence == 0x09d9c95 || sequence == 0xf09d9cb5) { return F_true; } // Mathematical Alphanumeric Symbols: U+1D74F, U+1D76F, U+1D789, U+1D7A9. - if (character == 0xf09d9d8f || character == 0xf09d9daf || character == 0xf09d9e89 || character == 0xf09d9ea9) { + if (sequence == 0xf09d9d8f || sequence == 0xf09d9daf || sequence == 0xf09d9e89 || sequence == 0xf09d9ea9) { return F_true; } // Mathematical Alphanumeric Symbols: U+1D7C3, U+1EEF0, U+1EEF1. - if (character == 0xf09d9f83 || character == 0xf09ebbb0 || character == 0xf09ebbb1) { + if (sequence == 0xf09d9f83 || sequence == 0xf09ebbb0 || sequence == 0xf09ebbb1) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x96) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x96) { // Pahawh Hmong: U+16B3C to U+16B3F. - if (character >= 0xf096acbc && character <= 0xf096acbf) { + if (sequence >= 0xf096acbc && sequence <= 0xf096acbf) { return F_true; } // Pahawh Hmong: U+16B45. - if (character == 0xf096ad85) { + if (sequence == 0xf096ad85) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x9b) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x9b) { // Duployan: U+1BC9C. - if (character == 0xf09bb29c) { + if (sequence == 0xf09bb29c) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x9c) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x9c) { // Znamenny Musical Notation: U+1CF50 to U+1CFC3. - if (character >= 0xf09cbd90 && character <= 0xf09cbf83) { + if (sequence >= 0xf09cbd90 && sequence <= 0xf09cbf83) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x9d) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x9d) { // Byzantine Musical Notation: U+1D000 to U+1D1EA. - if (character >= 0xf09d8080 && character <= 0xf09d87aa) { + if (sequence >= 0xf09d8080 && sequence <= 0xf09d87aa) { return F_true; } // Ancient Greek Musical Notation: U+1D200 to U+1D245. - if (character >= 0xf09d8080 && character <= 0xf09d8985) { + if (sequence >= 0xf09d8080 && sequence <= 0xf09d8985) { return F_true; } // Tai Xuan Jing Symbols: U+1D300 to U+1D356. - if (character >= 0xf09d8c80 && character <= 0xf09d8d96) { + if (sequence >= 0xf09d8c80 && sequence <= 0xf09d8d96) { return F_true; } // Mathematical Alphanumeric Symbols: U+1D6C1, U+1D6DB, U+1D6FB, U+1D715. - if (character == 0xf09d9b81 || character == 0xf09d9b9b || character == 0xf09d9bbb || character == 0xf09d9c95) { + if (sequence == 0xf09d9b81 || sequence == 0xf09d9b9b || sequence == 0xf09d9bbb || sequence == 0xf09d9c95) { return F_true; } // Mathematical Alphanumeric Symbols: U+1D735, U+1D74F, U+1D76F, U+1D789. - if (character == 0xf09d9cb5 || character == 0xf09d9d8f || character == 0xf09d9daf || character == 0xf09d9e89) { + if (sequence == 0xf09d9cb5 || sequence == 0xf09d9d8f || sequence == 0xf09d9daf || sequence == 0xf09d9e89) { return F_true; } // Mathematical Alphanumeric Symbols: U+1D7A9, U+1D7C3. - if (character == 0xf09d9ea9 || character == 0xf09d9f83) { + if (sequence == 0xf09d9ea9 || sequence == 0xf09d9f83) { return F_true; } // Sutton SignWriting: U+1D800 to U+1D9FF. - if (character >= 0xf09da080 && character <= 0xf09da7bf) { + if (sequence >= 0xf09da080 && sequence <= 0xf09da7bf) { return F_true; } // Sutton SignWriting: U+1DA37 to U+1DA3A. - if (character >= 0xf09da8b7 && character <= 0xf09da8ba) { + if (sequence >= 0xf09da8b7 && sequence <= 0xf09da8ba) { return F_true; } // Sutton SignWriting: U+1DA6D to U+1DA86. - if (character >= 0xf09da9ad && character <= 0xf09daa86) { + if (sequence >= 0xf09da9ad && sequence <= 0xf09daa86) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x9e) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x9e) { // Nyiakeng Puachue Hmong: U+1E14F. - if (character == 0xf09e858f) { + if (sequence == 0xf09e858f) { return F_true; } // Wancho: U+1E2FF. - if (character == 0xf09e8bbf) { + if (sequence == 0xf09e8bbf) { return F_true; } // Indic Siyaq Numbers: U+1ECAC, U+ECB0. - if (character == 0xf09eb2ac || character == 0xf09eb2b0) { + if (sequence == 0xf09eb2ac || sequence == 0xf09eb2b0) { return F_true; } // Ottoman Siyaq Numbers: U+1ED2E. - if (character == 0xf09eb4ae) { + if (sequence == 0xf09eb4ae) { return F_true; } // Arabic Mathematical Alphabetic Symbols: U+1EEF0, U+1EEF1. - if (character == 0xf09ebbb0 || character == 0xf09ebbb1) { + if (sequence == 0xf09ebbb0 || sequence == 0xf09ebbb1) { return F_true; } } - else if (macro_f_utf_char_t_to_char_2(character) == 0x9f) { + else if (macro_f_utf_char_t_to_char_2(sequence) == 0x9f) { // Mahjong Tiles to Domino Tiles: U+1F000 to U+1F093. - if (character >= 0xf09f8080 && character <= 0xf09f8293) { + if (sequence >= 0xf09f8080 && sequence <= 0xf09f8293) { return F_true; } // Playing Cards: U+1F0A0 to U+1F0AE. - if (character >= 0xf09f82a0 && character <= 0xf09f82ae) { + if (sequence >= 0xf09f82a0 && sequence <= 0xf09f82ae) { return F_true; } // Playing Cards: U+1F0B1 to U+1F0BF. - if (character >= 0xf09f82b1 && character <= 0xf09f82bf) { + if (sequence >= 0xf09f82b1 && sequence <= 0xf09f82bf) { return F_true; } // Playing Cards: U+1F0C1 to U+1F0CF. - if (character >= 0xf09f8381 && character <= 0xf09f838f) { + if (sequence >= 0xf09f8381 && sequence <= 0xf09f838f) { return F_true; } // Enclosed Alphanumeric Supplement: U+1F0D1 to U+1F1AD. - if (character >= 0xf09f8391 && character <= 0xf09f86ad) { + if (sequence >= 0xf09f8391 && sequence <= 0xf09f86ad) { return F_true; } // Enclosed Alphanumeric Supplement: U+1F10D to U+1F1AD. - if (character >= 0xf09f848d && character <= 0xf09f86ad) { + if (sequence >= 0xf09f848d && sequence <= 0xf09f86ad) { return F_true; } // Enclosed Alphanumeric Supplement to Enclosed Ideographic Supplement: U+1F1E6 to U+1F202. - if (character >= 0xf09f87a6 && character <= 0xf09f8882) { + if (sequence >= 0xf09f87a6 && sequence <= 0xf09f8882) { return F_true; } // Enclosed Ideographic Supplement: U+1F210 to U+1F23B. - if (character >= 0xf09f8890 && character <= 0xf09f88bb) { + if (sequence >= 0xf09f8890 && sequence <= 0xf09f88bb) { return F_true; } // Enclosed Ideographic Supplement: U+1F240 to U+1F248. - if (character >= 0xf09f8980 && character <= 0xf09f8988) { + if (sequence >= 0xf09f8980 && sequence <= 0xf09f8988) { return F_true; } // Enclosed Ideographic Supplement: U+1F250, U+1F251. - if (character == 0xf09f8990 || character == 0xf09f8991) { + if (sequence == 0xf09f8990 || sequence == 0xf09f8991) { return F_true; } // Enclosed Ideographic Supplement: U+1F260 to U+1F265. - if (character >= 0xf09f89a0 && character <= 0xf09f89a5) { + if (sequence >= 0xf09f89a0 && sequence <= 0xf09f89a5) { return F_true; } // Miscellaneous Symbols and Pictographs: U+1F300 to U+1F6EC. - if (character >= 0xf09f8c80 && character <= 0xf09f9bac) { + if (sequence >= 0xf09f8c80 && sequence <= 0xf09f9bac) { return F_true; } // Transport and Map Symbols: U+1F6F0 to U+1F6FC. - if (character >= 0xf09f9bb0 && character <= 0xf09f9bbc) { + if (sequence >= 0xf09f9bb0 && sequence <= 0xf09f9bbc) { return F_true; } // Alchemical Symbols: U+1F6F0 to U+1F773. - if (character >= 0xf09f9c80 && character <= 0xf09f9db3) { + if (sequence >= 0xf09f9c80 && sequence <= 0xf09f9db3) { return F_true; } // Geometric Shapes Extended: U+1F780 to U+1F7D8. - if (character >= 0xf09f9e80 && character <= 0xf09f9f98) { + if (sequence >= 0xf09f9e80 && sequence <= 0xf09f9f98) { return F_true; } // Geometric Shapes Extended: U+1F7E0 to U+1F7EB. - if (character >= 0xf09f9fa0 && character <= 0xf09f9fab) { + if (sequence >= 0xf09f9fa0 && sequence <= 0xf09f9fab) { return F_true; } // Geometric Shapes Extended: U+1F7F0. - if (character == 0xf09f9fb0) { + if (sequence == 0xf09f9fb0) { return F_true; } // Supplemental Arrows-C: U+1F800 to U+1F80B. - if (character >= 0xf09fa080 && character <= 0xf09fa08b) { + if (sequence >= 0xf09fa080 && sequence <= 0xf09fa08b) { return F_true; } // Supplemental Arrows-C: U+1F810 to U+1F847. - if (character >= 0xf09fa090 && character <= 0xf09fa187) { + if (sequence >= 0xf09fa090 && sequence <= 0xf09fa187) { return F_true; } // Supplemental Arrows-C: U+1F850 to U+1F887. - if (character >= 0xf09fa190 && character <= 0xf09fa287) { + if (sequence >= 0xf09fa190 && sequence <= 0xf09fa287) { return F_true; } // Supplemental Arrows-C: U+1F890 to U+1F8AD. - if (character >= 0xf09fa290 && character <= 0xf09fa2ad) { + if (sequence >= 0xf09fa290 && sequence <= 0xf09fa2ad) { return F_true; } // Supplemental Arrows-C: U+1F8B0, U+1F8B1. - if (character == 0xf09fa2b0 || character == 0xf09fa2b1) { + if (sequence == 0xf09fa2b0 || sequence == 0xf09fa2b1) { return F_true; } // Supplemental Symbols and Pictographs to Chess Symbols: U+1F900 to U+1FA53. - if (character >= 0xf09fa480 && character <= 0xf09fa993) { + if (sequence >= 0xf09fa480 && sequence <= 0xf09fa993) { return F_true; } // Chess Symbols: U+1FA60 to U+1FA6D. - if (character >= 0xf09fa9a0 && character <= 0xf09fa9ad) { + if (sequence >= 0xf09fa9a0 && sequence <= 0xf09fa9ad) { return F_true; } // Symbols and Pictographs Extended-A: U+1FA70 to U+1FA74. - if (character >= 0xf09fa9b0 && character <= 0xf09fa9b4) { + if (sequence >= 0xf09fa9b0 && sequence <= 0xf09fa9b4) { return F_true; } // Symbols and Pictographs Extended-A: U+1FA78 to U+1FA7C. - if (character >= 0xf09fa9b8 && character <= 0xf09fa9bc) { + if (sequence >= 0xf09fa9b8 && sequence <= 0xf09fa9bc) { return F_true; } // Symbols and Pictographs Extended-A: U+1FA80 to U+1FA86. - if (character >= 0xf09faa80 && character <= 0xf09faa86) { + if (sequence >= 0xf09faa80 && sequence <= 0xf09faa86) { return F_true; } // Symbols and Pictographs Extended-A: U+1FA90 to U+1FAAC. - if (character >= 0xf09faa90 && character <= 0xf09faaac) { + if (sequence >= 0xf09faa90 && sequence <= 0xf09faaac) { return F_true; } // Symbols and Pictographs Extended-A: U+1FAB0 to U+1FAC5. - if (character >= 0xf09faab0 && character <= 0xf09fab85) { + if (sequence >= 0xf09faab0 && sequence <= 0xf09fab85) { return F_true; } // Symbols and Pictographs Extended-A: U+1FAD0 to U+1FAE7. - if (character >= 0xf09fab90 && character <= 0xf09faba7) { + if (sequence >= 0xf09fab90 && sequence <= 0xf09faba7) { return F_true; } // Symbols and Pictographs Extended-A: U+1FAF0 to U+1FAF6. - if (character >= 0xf09fabb0 && character <= 0xf09fabb6) { + if (sequence >= 0xf09fabb0 && sequence <= 0xf09fabb6) { return F_true; } // Symbols for Legacy Computing: U+1FB00 to U+1FBCA. - if (character >= 0xf09fac80 && character <= 0xf09faf8a) { + if (sequence >= 0xf09fac80 && sequence <= 0xf09faf8a) { return F_true; } } diff --git a/level_0/f_utf/c/private-utf_symbol.h b/level_0/f_utf/c/private-utf_symbol.h index c936c0d..b31e3a8 100644 --- a/level_0/f_utf/c/private-utf_symbol.h +++ b/level_0/f_utf/c/private-utf_symbol.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 symbol character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_symbol() */ #if !defined(_di_f_utf_character_is_symbol_) || !defined(_di_f_utf_is_symbol_) - extern f_status_t private_f_utf_character_is_symbol(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_symbol(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_symbol_) || !defined(_di_f_utf_is_symbol_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_valid.c b/level_0/f_utf/c/private-utf_valid.c index 5404abb..8e5b786 100644 --- a/level_0/f_utf/c/private-utf_valid.c +++ b/level_0/f_utf/c/private-utf_valid.c @@ -7,25 +7,36 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_valid_) || !defined(_di_f_utf_is_valid_) - f_status_t private_f_utf_character_is_valid(const f_utf_char_t character) { - - // All characters with data after the width bytes is invalid. - if (macro_f_utf_char_t_width(character) == 2 && (macro_f_utf_char_t_to_char_3(character) || macro_f_utf_char_t_to_char_4(character))) { - return F_false; - } - - if (macro_f_utf_char_t_width(character) == 3 && macro_f_utf_char_t_to_char_4(character)) { - return F_false; - } + f_status_t private_f_utf_character_is_valid(const f_utf_char_t sequence) { // Invalid: 11111xxx xxxxxxxx xxxxxxxx xxxxxxxx. - if ((macro_f_utf_char_t_to_char_1(character) & 0b11111000) == 0b11111000) { + if ((macro_f_utf_char_t_to_char_1(sequence) & 0b11111000) == 0b11111000) { return F_false; } // Valid: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. - if ((macro_f_utf_char_t_to_char_1(character) & 0b11111000) == 0b11110000) { - if ((macro_f_utf_char_t_to_char_2(character) & 0b11000000) == 0b10000000 && (macro_f_utf_char_t_to_char_3(character) & 0b11000000) == 0b10000000 && (macro_f_utf_char_t_to_char_4(character) & 0b11000000) == 0b10000000) { + if ((macro_f_utf_char_t_to_char_1(sequence) & 0b11111000) == 0b11110000) { + + // For first byte 0xf0, only second byte ranges 0x90 to 0xbf are valid. + if (macro_f_utf_char_t_to_char_1(sequence) == 0xf0) { + if (macro_f_utf_char_t_to_char_2(sequence) < 0x90 || macro_f_utf_char_t_to_char_2(sequence) > 0xbf) { + return F_false; + } + } + + // For first byte 0xf4, only second byte ranges 0x80 to 0x8f are valid. + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xf4) { + if (macro_f_utf_char_t_to_char_2(sequence) < 0x80 || macro_f_utf_char_t_to_char_2(sequence) > 0x8f) { + return F_false; + } + } + + // For first byte greater than 0xf4 are all invalid. + else if (macro_f_utf_char_t_to_char_1(sequence) > 0xf4) { + return F_false; + } + + if ((macro_f_utf_char_t_to_char_2(sequence) & 0b11000000) == 0b10000000 && (macro_f_utf_char_t_to_char_3(sequence) & 0b11000000) == 0b10000000 && (macro_f_utf_char_t_to_char_4(sequence) & 0b11000000) == 0b10000000) { return F_true; } @@ -33,8 +44,29 @@ extern "C" { } // Valid: 1110xxxx 10xxxxxx 10xxxxxx ????????. - else if ((macro_f_utf_char_t_to_char_1(character) & 0b11110000) == 0b11100000) { - if ((macro_f_utf_char_t_to_char_2(character) & 0b11000000) == 0b10000000 && (macro_f_utf_char_t_to_char_3(character) & 0b11000000) == 0b10000000) { + if ((macro_f_utf_char_t_to_char_1(sequence) & 0b11110000) == 0b11100000) { + + // For first byte 0xe0, only second byte ranges 0xa0 to 0xbf are valid. + if (macro_f_utf_char_t_to_char_1(sequence) == 0xe0) { + if (macro_f_utf_char_t_to_char_2(sequence) < 0xa0 || macro_f_utf_char_t_to_char_2(sequence) > 0xbf) { + return F_false; + } + } + + // For first byte 0xed, only second byte ranges 0x80 to 0x9f are valid. + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xed) { + if (macro_f_utf_char_t_to_char_2(sequence) < 0x80 || macro_f_utf_char_t_to_char_2(sequence) > 0x9f) { + return F_false; + } + } + + if ((macro_f_utf_char_t_to_char_2(sequence) & 0b11000000) == 0b10000000 && (macro_f_utf_char_t_to_char_3(sequence) & 0b11000000) == 0b10000000) { + + // All characters with data after the width bytes is invalid. + if (macro_f_utf_char_t_to_char_4(sequence)) { + return F_false; + } + return F_true; } @@ -42,8 +74,20 @@ extern "C" { } // Valid: 110xxxxx 10xxxxxx ???????? ????????. - else if ((macro_f_utf_char_t_to_char_1(character) & 0b11100000) == 0b11000000) { - if ((macro_f_utf_char_t_to_char_2(character) & 0b11000000) == 0b10000000) { + if ((macro_f_utf_char_t_to_char_1(sequence) & 0b11100000) == 0b11000000) { + + // Only first byte ranges 0xc3 or greater are valid. + if (macro_f_utf_char_t_to_char_2(sequence) < 0xc3) { + return F_false; + } + + if ((macro_f_utf_char_t_to_char_2(sequence) & 0b11000000) == 0b10000000) { + + // All characters with data after the width bytes is invalid. + if (macro_f_utf_char_t_to_char_3(sequence) || macro_f_utf_char_t_to_char_4(sequence)) { + return F_false; + } + return F_true; } @@ -51,16 +95,22 @@ extern "C" { } // Invalid (UTF Fragment): 10xxxxxx ???????? ???????? ????????. - else if ((macro_f_utf_char_t_to_char_1(character) & 0b11000000) == 0b10000000) { + if ((macro_f_utf_char_t_to_char_1(sequence) & 0b11000000) == 0b10000000) { return F_status_set_error(F_utf_fragment); } - // Valid: 0xxxxxxx ???????? ???????? ????????. - else if (macro_f_utf_char_t_to_char_1(character) & 0b10000000) { + // All characters with data after the width bytes is invalid. + if (macro_f_utf_char_t_to_char_2(sequence) || macro_f_utf_char_t_to_char_3(sequence) || macro_f_utf_char_t_to_char_4(sequence)) { return F_false; } - return F_true; + // Valid: 0xxxxxxx ???????? ???????? ????????. + if (macro_f_utf_char_t_to_char_1(sequence) < 0x80) { + return F_true; + } + + // All other values > 0x7f are invalid. + return F_false; } #endif // !defined(_di_f_utf_character_is_valid_) || !defined(_di_f_utf_is_valid_) diff --git a/level_0/f_utf/c/private-utf_valid.h b/level_0/f_utf/c/private-utf_valid.h index 30599db..8e753e3 100644 --- a/level_0/f_utf/c/private-utf_valid.h +++ b/level_0/f_utf/c/private-utf_valid.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a valid UTF-8 character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_valid() */ #if !defined(_di_f_utf_character_is_valid_) || !defined(_di_f_utf_is_valid_) - extern f_status_t private_f_utf_character_is_valid(const f_utf_char_t characterh) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_valid(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_valid_) || !defined(_di_f_utf_is_valid_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_whitespace.c b/level_0/f_utf/c/private-utf_whitespace.c index b8e8211..0cd621d 100644 --- a/level_0/f_utf/c/private-utf_whitespace.c +++ b/level_0/f_utf/c/private-utf_whitespace.c @@ -7,36 +7,36 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_whitespace_) || !defined(_di_f_utf_is_whitespace_) - f_status_t private_f_utf_character_is_whitespace(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_whitespace(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { // Latin-1 Supplement: U+00A0. - if (character == 0xc2a00000) { + if (sequence == 0xc2a00000) { return F_true; } return F_false; } - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { - if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xe2) { // General Punctuation: U+2000 to U+200A. - if (character >= 0xe2808000 && character <= 0xe2808a00) { + if (sequence >= 0xe2808000 && sequence <= 0xe2808a00) { return F_true; } // General Punctuation: U+2028, U+2029, U+202F, U+205F. - if (character == 0xe280a800 || character == 0xe280a900 || character == 0xe2819f00 || character == 0xe280af00) { + if (sequence == 0xe280a800 || sequence == 0xe280a900 || sequence == 0xe2819f00 || sequence == 0xe280af00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe3) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe3) { // CJK Symbols and Punctuation: U+3000. - if (character == 0xe3808000) { + if (sequence == 0xe3808000) { return F_true; } } @@ -49,12 +49,12 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_whitespace_) || !defined(_di_f_utf_is_whitespace_) #if !defined(_di_f_utf_character_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_modifier_) - f_status_t private_f_utf_character_is_whitespace_modifier(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_whitespace_modifier(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { // Spacing Modifier Letters: U+02B0 to U+02FF. - if (character >= 0xcab00000 && character <= 0xcbbf0000) { + if (sequence >= 0xcab00000 && sequence <= 0xcbbf0000) { return F_true; } } @@ -64,10 +64,10 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_modifier_) #if !defined(_di_f_utf_character_is_whitespace_other_) || !defined(_di_f_utf_is_whitespace_other_) - f_status_t private_f_utf_character_is_whitespace_other(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_whitespace_other(const f_utf_char_t sequence) { // Ogham: U+1680 (isn't whitespace but is technically considered one: ( )). - if (character == 0xe19a8000) { + if (sequence == 0xe19a8000) { return F_true; } diff --git a/level_0/f_utf/c/private-utf_whitespace.h b/level_0/f_utf/c/private-utf_whitespace.h index e32a918..8420c6b 100644 --- a/level_0/f_utf/c/private-utf_whitespace.h +++ b/level_0/f_utf/c/private-utf_whitespace.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 white space. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_whitespace() */ #if !defined(_di_f_utf_character_is_whitespace_) || !defined(_di_f_utf_is_whitespace_) - extern f_status_t private_f_utf_character_is_whitespace(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_whitespace(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_whitespace_) || !defined(_di_f_utf_is_whitespace_) /** @@ -48,8 +48,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 white space modifier. @@ -62,7 +62,7 @@ extern "C" { * @see f_utf_is_whitespace_modifier() */ #if !defined(_di_f_utf_character_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_modifier_) - extern f_status_t private_f_utf_character_is_whitespace_modifier(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_whitespace_modifier(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_modifier_) /** @@ -72,8 +72,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 white space other. @@ -86,7 +86,7 @@ extern "C" { * @see f_utf_is_whitespace_other() */ #if !defined(_di_f_utf_character_is_whitespace_other_) || !defined(_di_f_utf_is_whitespace_other_) - extern f_status_t private_f_utf_character_is_whitespace_other(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_whitespace_other(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_whitespace_other_) || !defined(_di_f_utf_is_whitespace_other_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_wide.c b/level_0/f_utf/c/private-utf_wide.c index e1f7b7b..3ecc9fc 100644 --- a/level_0/f_utf/c/private-utf_wide.c +++ b/level_0/f_utf/c/private-utf_wide.c @@ -7,111 +7,111 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_wide_) || !defined(_di_f_utf_is_wide_) - f_status_t private_f_utf_character_is_wide(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_wide(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(sequence) == 2) { return F_false; } - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { // Hangul Jamo: U+1100 to U+115F. - if (character >= 0xe1848000 && character <= 0xe1859f00) { + if (sequence >= 0xe1848000 && sequence <= 0xe1859f00) { return F_true; } // Miscellaneous Technical: U+2329, U+232A. - if (character == 0xe28ca900 || character == 0xe28caa00) { + if (sequence == 0xe28ca900 || sequence == 0xe28caa00) { return F_true; } // CJK Radicals Supplement: U+2E80 to U+2EF3. - if (character >= 0xe2ba8000 && character <= 0xe2bbb300) { + if (sequence >= 0xe2ba8000 && sequence <= 0xe2bbb300) { return F_true; } // Kangxi Radicals: U+2F00 to U+2FD5. - if (character >= 0xe2bc8000 && character <= 0xe2bf9500) { + if (sequence >= 0xe2bc8000 && sequence <= 0xe2bf9500) { return F_true; } // Ideographic Description Characters: U+2FF0 to U+2FFB. - if (character >= 0xe2bfb000 && character <= 0xe2bfbb00) { + if (sequence >= 0xe2bfb000 && sequence <= 0xe2bfbb00) { return F_true; } // CJK Symbols and Punctuation: U+3000 to U+303E. - if (character >= 0xe3808000 && character <= 0xe380be00) { + if (sequence >= 0xe3808000 && sequence <= 0xe380be00) { return F_true; } // Hiragana .. Katakana: U+3041 to U+30FF. - if (character >= 0xe3818100 && character <= 0xe383bf00) { + if (sequence >= 0xe3818100 && sequence <= 0xe383bf00) { return F_true; } // Bopomofo .. Enclosed CJK Letters and Months: U+3105 to U+3247. - if (character >= 0xe3848500 && character <= 0xe3898700) { + if (sequence >= 0xe3848500 && sequence <= 0xe3898700) { return F_true; } // .. Enclosed CJK Letters and Months: U+3250 to U+32FE. - if (character >= 0xe3899000 && character <= 0xe38bfe00) { + if (sequence >= 0xe3899000 && sequence <= 0xe38bfe00) { return F_true; } // CJK Compatibility .. CJK Unified Ideographs Extension A: U+3300 to U+4DB5. - if (character >= 0xe38c8000 && character <= 0xe4b6b500) { + if (sequence >= 0xe38c8000 && sequence <= 0xe4b6b500) { return F_true; } // CJK Unified Ideographs: U+4E00 to U+9FD5. - if (character >= 0xe4b88000 && character <= 0xe9bf9500) { + if (sequence >= 0xe4b88000 && sequence <= 0xe9bf9500) { return F_true; } // Yi Syllables: U+A000 to U+A48C. - if (character >= 0xea808000 && character <= 0xea928c00) { + if (sequence >= 0xea808000 && sequence <= 0xea928c00) { return F_true; } // Yi Radicals: U+A490 to U+A4C6. - if (character >= 0xea929000 && character <= 0xea938600) { + if (sequence >= 0xea929000 && sequence <= 0xea938600) { return F_true; } // Hangul Jamo Extended-A: U+A960 to U+A97C. - if (character >= 0xeaa5a000 && character <= 0xeaa5bc00) { + if (sequence >= 0xeaa5a000 && sequence <= 0xeaa5bc00) { return F_true; } // Hangul Syllables: U+AC00 to U+D7A3. - if (character >= 0xeab08000 && character <= 0xed9ea300) { + if (sequence >= 0xeab08000 && sequence <= 0xed9ea300) { return F_true; } // CJK Compatibility Ideographs: U+F900 to U+FA6D. - if (character >= 0xefa48000 && character <= 0xefa9ad00) { + if (sequence >= 0xefa48000 && sequence <= 0xefa9ad00) { return F_true; } // CJK Compatibility Ideographs: U+FA70 to U+FAD9. - if (character >= 0xefa9b000 && character <= 0xefab9900) { + if (sequence >= 0xefa9b000 && sequence <= 0xefab9900) { return F_true; } // Vertical Forms .. Small Form Variants: U+FE10 to U+FE6B. - if (character >= 0xefb89000 && character <= 0xefb9ab00) { + if (sequence >= 0xefb89000 && sequence <= 0xefb9ab00) { return F_true; } // Half Width and Full Width Forms: U+FF01 to U+FF60. - if (character >= 0xefbc8100 && character <= 0xefbda000) { + if (sequence >= 0xefbc8100 && sequence <= 0xefbda000) { return F_true; } // Half Width and Full Width Forms: U+FFE0 to U+FFE6. - if (character >= 0xefbfa000 && character <= 0xefbfa600) { + if (sequence >= 0xefbfa000 && sequence <= 0xefbfa600) { return F_true; } @@ -119,12 +119,12 @@ extern "C" { } // CJK Unified Ideographs Extension C .. CJK Unified Ideographs Extension E: U+2A700 to U+2CEA1. - if (character >= 0xf0aa9c80 && character <= 0xf0acbaa1) { + if (sequence >= 0xf0aa9c80 && sequence <= 0xf0acbaa1) { return F_true; } // CJK Compatibility Ideographs Supplement: U+2F800 to U+2FA1D. - if (character >= 0xf0afa080 && character <= 0xf0afa89d) { + if (sequence >= 0xf0afa080 && sequence <= 0xf0afa89d) { return F_true; } diff --git a/level_0/f_utf/c/private-utf_wide.h b/level_0/f_utf/c/private-utf_wide.h index 6ec3e78..7bdab2b 100644 --- a/level_0/f_utf/c/private-utf_wide.h +++ b/level_0/f_utf/c/private-utf_wide.h @@ -24,7 +24,7 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character + * @param sequence * The (UTF-8) character. * * @return @@ -35,7 +35,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #if !defined(_di_f_utf_character_is_wide_) || !defined(_di_f_utf_is_wide_) - extern f_status_t private_f_utf_character_is_wide(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_wide(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_wide_) || !defined(_di_f_utf_is_wide_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_word.c b/level_0/f_utf/c/private-utf_word.c index 497ad24..08008ad 100644 --- a/level_0/f_utf/c/private-utf_word.c +++ b/level_0/f_utf/c/private-utf_word.c @@ -8,36 +8,36 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_is_word_) - f_status_t private_f_utf_character_is_word(const f_utf_char_t character, const bool strict) { + f_status_t private_f_utf_character_is_word(const f_utf_char_t sequence, const bool strict) { - if (private_f_utf_character_is_alphabetic_digit(character)) { + if (private_f_utf_character_is_alphabetic_digit(sequence)) { return F_true; } - if (macro_f_utf_char_t_width_is(character) == 3) { - if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xe2) { // General Punctuation: U+203F (‿), U+203E (‾), U+2040 (⁀), U+2054 (⁔). - if (character == 0xe280bf00 || character == 0xe280be00 || character == 0xe2818000 || character == 0xe2819400) { + if (sequence == 0xe280bf00 || sequence == 0xe280be00 || sequence == 0xe2818000 || sequence == 0xe2819400) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xef) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xef) { // CJK Compatibility Forms: U+FE4D (﹍), U+FE4E (﹎), U+FE4F (﹏). - if (character == 0xefb98d00 || character == 0xefb98e00 || character == 0xefb98f00) { + if (sequence == 0xefb98d00 || sequence == 0xefb98e00 || sequence == 0xefb98f00) { return F_true; } // Halfwidth and Fullwidth Forms: U+FF3F (_). - if (character == 0xefbcbf00) { + if (sequence == 0xefbcbf00) { return F_true; } if (strict) { // Halfwidth and Fullwidth Forms: U+FE33 (︳), U+FE34 (︴). - if (character == 0xefbcbf00 || character == 0xefbcbf00) { + if (sequence == 0xefbcbf00 || sequence == 0xefbcbf00) { return F_true; } } @@ -49,16 +49,16 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_is_word_) #if !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_is_word_dash_) - f_status_t private_f_utf_character_is_word_dash(const f_utf_char_t character, const bool strict) { + f_status_t private_f_utf_character_is_word_dash(const f_utf_char_t sequence, const bool strict) { - if (private_f_utf_character_is_word(character, strict)) { + if (private_f_utf_character_is_word(sequence, strict)) { return F_true; } - if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(sequence) == 3) { // General Punctuation: U+2010, U+2011. - if (character == 0xe2809000 || character == 0xe2809100) { + if (sequence == 0xe2809000 || sequence == 0xe2809100) { return F_true; } } @@ -68,16 +68,16 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_is_word_dash_) #if !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_is_word_dash_plus_) - f_status_t private_f_utf_character_is_word_dash_plus(const f_utf_char_t character, const bool strict) { + f_status_t private_f_utf_character_is_word_dash_plus(const f_utf_char_t sequence, const bool strict) { - if (private_f_utf_character_is_word_dash(character, strict)) { + if (private_f_utf_character_is_word_dash(sequence, strict)) { return F_true; } if (strict) { // General Punctuation: U+2064. - if (character == 0xe281a400) { + if (sequence == 0xe281a400) { return F_true; } } diff --git a/level_0/f_utf/c/private-utf_word.h b/level_0/f_utf/c/private-utf_word.h index 419d7f1..2ac4aba 100644 --- a/level_0/f_utf/c/private-utf_word.h +++ b/level_0/f_utf/c/private-utf_word.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * @param strict * When TRUE, include all appropriate characters by type as per Unicode. * When FALSE, non-inline punctuation connectors are not considered a character (such as U+FE33 '︳'). @@ -42,7 +42,7 @@ extern "C" { * @see f_utf_is_word() */ #if !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_is_word_) - extern f_status_t private_f_utf_character_is_word(const f_utf_char_t character, const bool strict) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_word(const f_utf_char_t sequence, const bool strict) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_is_word_) /** @@ -52,8 +52,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * @param strict * When TRUE, include all appropriate characters by type as per Unicode. * When FALSE, non-inline punctuation connectors are not considered a character (such as U+FE33 '︳'). @@ -70,7 +70,7 @@ extern "C" { * @see f_utf_is_word_dash() */ #if !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_is_word_dash_) - extern f_status_t private_f_utf_character_is_word_dash(const f_utf_char_t character, const bool strict) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_word_dash(const f_utf_char_t sequence, const bool strict) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_is_word_dash_) /** @@ -80,8 +80,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * @param strict * When TRUE, include all appropriate characters by type as per Unicode. * When FALSE, non-inline punctuation connectors are not considered a character (such as U+FE33 '︳'). @@ -98,7 +98,7 @@ extern "C" { * @see f_utf_is_word_dash_plus() */ #if !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_is_word_dash_plus_) - extern f_status_t private_f_utf_character_is_word_dash_plus(const f_utf_char_t character, const bool strict) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_word_dash_plus(const f_utf_char_t sequence, const bool strict) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_is_word_dash_plus_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/private-utf_zero_width.c b/level_0/f_utf/c/private-utf_zero_width.c index edefca7..47787af 100644 --- a/level_0/f_utf/c/private-utf_zero_width.c +++ b/level_0/f_utf/c/private-utf_zero_width.c @@ -7,26 +7,26 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_zero_width_) - f_status_t private_f_utf_character_is_zero_width(const f_utf_char_t character) { + f_status_t private_f_utf_character_is_zero_width(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_to_char_1(character) == 0xe1) { + if (macro_f_utf_char_t_to_char_1(sequence) == 0xe1) { // Mongolian: U+180E. - if (character == 0xe1a08e00) { + if (sequence == 0xe1a08e00) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xe2) { // General Punctuation: U+200B, U+200C, U+200D, U+2060. - if (character == 0xe2808b00 || character == 0xe2808c00 || character == 0xe2808d00 || character == 0xe281a000) { + if (sequence == 0xe2808b00 || sequence == 0xe2808c00 || sequence == 0xe2808d00 || sequence == 0xe281a000) { return F_true; } } - else if (macro_f_utf_char_t_to_char_1(character) == 0xef) { + else if (macro_f_utf_char_t_to_char_1(sequence) == 0xef) { // Arabic Presentation Forms-B: U+FEFF. - if (character == 0xefbbbf00) { + if (sequence == 0xefbbbf00) { return F_true; } } diff --git a/level_0/f_utf/c/private-utf_zero_width.h b/level_0/f_utf/c/private-utf_zero_width.h index 181eedc..93ceb6b 100644 --- a/level_0/f_utf/c/private-utf_zero_width.h +++ b/level_0/f_utf/c/private-utf_zero_width.h @@ -24,8 +24,8 @@ extern "C" { * * This expects the character width to be of at least size 2. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 non-printing or zero-width character. @@ -38,7 +38,7 @@ extern "C" { * @see f_utf_is_zero_width() */ #if !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_zero_width_) - extern f_status_t private_f_utf_character_is_zero_width(const f_utf_char_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_zero_width(const f_utf_char_t sequence) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_zero_width_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/utf/common.c b/level_0/f_utf/c/utf/common.c index 554b9af..fb8d6a4 100644 --- a/level_0/f_utf/c/utf/common.c +++ b/level_0/f_utf/c/utf/common.c @@ -11,42 +11,42 @@ extern "C" { #endif // _di_f_utf_char_t_codes_ #ifndef _di_f_utf_space_ - const uint8_t f_utf_space_em_s[F_utf_space_em_s_length] = { 0xe2, 0x80, 0x83 }; - const uint8_t f_utf_space_em_quad_s[F_utf_space_em_quad_s_length] = { 0xe2, 0x80, 0x81 }; - const uint8_t f_utf_space_em_per_three_s[F_utf_space_em_per_three_s_length] = { 0xe2, 0x80, 0x84 }; - const uint8_t f_utf_space_em_per_four_s[F_utf_space_em_per_four_s_length] = { 0xe2, 0x80, 0x85 }; - const uint8_t f_utf_space_em_per_six_s[F_utf_space_em_per_six_s_length] = { 0xe2, 0x80, 0x86 }; + const f_char_t f_utf_space_em_s[F_utf_space_em_s_length] = { 0xe2, 0x80, 0x83 }; + const f_char_t f_utf_space_em_quad_s[F_utf_space_em_quad_s_length] = { 0xe2, 0x80, 0x81 }; + const f_char_t f_utf_space_em_per_three_s[F_utf_space_em_per_three_s_length] = { 0xe2, 0x80, 0x84 }; + const f_char_t f_utf_space_em_per_four_s[F_utf_space_em_per_four_s_length] = { 0xe2, 0x80, 0x85 }; + const f_char_t f_utf_space_em_per_six_s[F_utf_space_em_per_six_s_length] = { 0xe2, 0x80, 0x86 }; - const uint8_t f_utf_space_en_s[F_utf_space_en_s_length] = { 0xe2, 0x80, 0x82 }; - const uint8_t f_utf_space_en_quad_s[F_utf_space_en_quad_s_length] = { 0xe2, 0x80, 0x80 }; + const f_char_t f_utf_space_en_s[F_utf_space_en_s_length] = { 0xe2, 0x80, 0x82 }; + const f_char_t f_utf_space_en_quad_s[F_utf_space_en_quad_s_length] = { 0xe2, 0x80, 0x80 }; - const uint8_t f_utf_space_line_feed_reverse_s[F_utf_space_line_feed_reverse_s_length] = { 0xc2, 0x8d }; - const uint8_t f_utf_space_line_next_s[F_utf_space_line_next_s_length] = { 0xc2, 0x85 }; + const f_char_t f_utf_space_line_feed_reverse_s[F_utf_space_line_feed_reverse_s_length] = { 0xc2, 0x8d }; + const f_char_t f_utf_space_line_next_s[F_utf_space_line_next_s_length] = { 0xc2, 0x85 }; - const uint8_t f_utf_space_medium_mathematical_s[F_utf_space_medium_mathematical_s_length] = { 0xe2, 0x81, 0x9f }; + const f_char_t f_utf_space_medium_mathematical_s[F_utf_space_medium_mathematical_s_length] = { 0xe2, 0x81, 0x9f }; - const uint8_t f_utf_space_no_break_s[F_utf_space_no_break_s_length] = { 0xc2, 0xa0 }; - const uint8_t f_utf_space_no_break_narrow_s[F_utf_space_no_break_narrow_s_length] = { 0xe2, 0x80, 0xaf }; + const f_char_t f_utf_space_no_break_s[F_utf_space_no_break_s_length] = { 0xc2, 0xa0 }; + const f_char_t f_utf_space_no_break_narrow_s[F_utf_space_no_break_narrow_s_length] = { 0xe2, 0x80, 0xaf }; - const uint8_t f_utf_space_ogham_s[F_utf_space_ogham_s_length] = { 0xe1, 0x9a, 0x80 }; - const uint8_t f_utf_space_figure_s[F_utf_space_figure_s_length] = { 0xe2, 0x80, 0x87 }; - const uint8_t f_utf_space_punctuation_s[F_utf_space_punctuation_s_length] = { 0xe2, 0x80, 0x88 }; - const uint8_t f_utf_space_thin_s[F_utf_space_thin_s_length] = { 0xe2, 0x80, 0x89 }; - const uint8_t f_utf_space_hair_s[F_utf_space_hair_s_length] = { 0xe2, 0x80, 0x8a }; - const uint8_t f_utf_space_ideographic_s[F_utf_space_ideographic_s_length] = { 0xe3, 0x80, 0x80 }; + const f_char_t f_utf_space_ogham_s[F_utf_space_ogham_s_length] = { 0xe1, 0x9a, 0x80 }; + const f_char_t f_utf_space_figure_s[F_utf_space_figure_s_length] = { 0xe2, 0x80, 0x87 }; + const f_char_t f_utf_space_punctuation_s[F_utf_space_punctuation_s_length] = { 0xe2, 0x80, 0x88 }; + const f_char_t f_utf_space_thin_s[F_utf_space_thin_s_length] = { 0xe2, 0x80, 0x89 }; + const f_char_t f_utf_space_hair_s[F_utf_space_hair_s_length] = { 0xe2, 0x80, 0x8a }; + const f_char_t f_utf_space_ideographic_s[F_utf_space_ideographic_s_length] = { 0xe3, 0x80, 0x80 }; - const uint8_t f_utf_space_separator_line_s[F_utf_space_separator_line_s_length] = { 0xe2, 0x80, 0xa8 }; - const uint8_t f_utf_space_separator_paragraph_s[F_utf_space_separator_paragraph_s_length] = { 0xe2, 0x80, 0xa8 }; + const f_char_t f_utf_space_separator_line_s[F_utf_space_separator_line_s_length] = { 0xe2, 0x80, 0xa8 }; + const f_char_t f_utf_space_separator_paragraph_s[F_utf_space_separator_paragraph_s_length] = { 0xe2, 0x80, 0xa8 }; #endif // _di_f_utf_space_ #ifndef _di_f_utf_substitute_ - const uint8_t f_utf_substitute_symbol_blank_s[F_utf_substitute_symbol_blank_s_length] = { 0xe2, 0x90, 0xa2 }; - const uint8_t f_utf_substitute_symbol_space_s[F_utf_substitute_symbol_space_s_length] = { 0xe2, 0x90, 0xa0 }; + const f_char_t f_utf_substitute_symbol_blank_s[F_utf_substitute_symbol_blank_s_length] = { 0xe2, 0x90, 0xa2 }; + const f_char_t f_utf_substitute_symbol_space_s[F_utf_substitute_symbol_space_s_length] = { 0xe2, 0x90, 0xa0 }; - const uint8_t f_utf_substitute_middle_dot_s[F_utf_substitute_middle_dot_s_length] = { 0xc2, 0xb7 }; + const f_char_t f_utf_substitute_middle_dot_s[F_utf_substitute_middle_dot_s_length] = { 0xc2, 0xb7 }; - const uint8_t f_utf_substitute_open_box_s[F_utf_substitute_open_box_s_length] = { 0xe2, 0x90, 0xa3 }; - const uint8_t f_utf_substitute_open_box_shouldered_s[F_utf_substitute_open_box_shouldered_s_length] = { 0xe2, 0x8d, 0xbd }; + const f_char_t f_utf_substitute_open_box_s[F_utf_substitute_open_box_s_length] = { 0xe2, 0x90, 0xa3 }; + const f_char_t f_utf_substitute_open_box_shouldered_s[F_utf_substitute_open_box_shouldered_s_length] = { 0xe2, 0x8d, 0xbd }; #endif // _di_f_utf_substitute_ #ifdef __cplusplus diff --git a/level_0/f_utf/c/utf/common.h b/level_0/f_utf/c/utf/common.h index 9af76f5..a7f868c 100644 --- a/level_0/f_utf/c/utf/common.h +++ b/level_0/f_utf/c/utf/common.h @@ -90,32 +90,32 @@ extern "C" { #define F_utf_space_separator_line_s_length 3 #define F_utf_space_separator_paragraph_s_length 3 - extern const uint8_t f_utf_space_em_s[]; - extern const uint8_t f_utf_space_em_quad_s[]; - extern const uint8_t f_utf_space_em_per_three_s[]; - extern const uint8_t f_utf_space_em_per_four_s[]; - extern const uint8_t f_utf_space_em_per_six_s[]; + extern const f_char_t f_utf_space_em_s[]; + extern const f_char_t f_utf_space_em_quad_s[]; + extern const f_char_t f_utf_space_em_per_three_s[]; + extern const f_char_t f_utf_space_em_per_four_s[]; + extern const f_char_t f_utf_space_em_per_six_s[]; - extern const uint8_t f_utf_space_en_s[]; - extern const uint8_t f_utf_space_en_quad_s[]; + extern const f_char_t f_utf_space_en_s[]; + extern const f_char_t f_utf_space_en_quad_s[]; - extern const uint8_t f_utf_space_line_feed_reverse_s[]; - extern const uint8_t f_utf_space_line_next_s[]; + extern const f_char_t f_utf_space_line_feed_reverse_s[]; + extern const f_char_t f_utf_space_line_next_s[]; - extern const uint8_t f_utf_space_medium_mathematical_s[]; + extern const f_char_t f_utf_space_medium_mathematical_s[]; - extern const uint8_t f_utf_space_no_break_s[]; - extern const uint8_t f_utf_space_no_break_narrow_s[]; + extern const f_char_t f_utf_space_no_break_s[]; + extern const f_char_t f_utf_space_no_break_narrow_s[]; - extern const uint8_t f_utf_space_ogham_s[]; - extern const uint8_t f_utf_space_figure_s[]; - extern const uint8_t f_utf_space_punctuation_s[]; - extern const uint8_t f_utf_space_thin_s[]; - extern const uint8_t f_utf_space_hair_s[]; - extern const uint8_t f_utf_space_ideographic_s[]; + extern const f_char_t f_utf_space_ogham_s[]; + extern const f_char_t f_utf_space_figure_s[]; + extern const f_char_t f_utf_space_punctuation_s[]; + extern const f_char_t f_utf_space_thin_s[]; + extern const f_char_t f_utf_space_hair_s[]; + extern const f_char_t f_utf_space_ideographic_s[]; - extern const uint8_t f_utf_space_separator_line_s[]; - extern const uint8_t f_utf_space_separator_paragraph_s[]; + extern const f_char_t f_utf_space_separator_line_s[]; + extern const f_char_t f_utf_space_separator_paragraph_s[]; #endif // _di_f_utf_space_ /** @@ -136,13 +136,13 @@ extern "C" { #define F_utf_substitute_open_box_s_length 3 #define F_utf_substitute_open_box_shouldered_s_length 3 - extern const uint8_t f_utf_substitute_symbol_blank_s[]; - extern const uint8_t f_utf_substitute_symbol_space_s[]; + extern const f_char_t f_utf_substitute_symbol_blank_s[]; + extern const f_char_t f_utf_substitute_symbol_space_s[]; - extern const uint8_t f_utf_substitute_middle_dot_s[]; + extern const f_char_t f_utf_substitute_middle_dot_s[]; - extern const uint8_t f_utf_substitute_open_box_s[]; - extern const uint8_t f_utf_substitute_open_box_shouldered_s[]; + extern const f_char_t f_utf_substitute_open_box_s[]; + extern const f_char_t f_utf_substitute_open_box_shouldered_s[]; #endif // _di_f_utf_substitute_ /** @@ -218,9 +218,9 @@ extern "C" { #define F_utf_char_mask_char_4_le_d 0xff000000 // 1111 1111, 0000 0000, 0000 0000, 0000 0000 #define macro_f_utf_char_t_to_char_1_le(character) ((character) & F_utf_char_mask_char_1_le_d) // Grab first byte. - #define macro_f_utf_char_t_to_char_2_le(character) (((character) & F_utf_char_mask_char_2_le_d) << 8) // Grab second byte. - #define macro_f_utf_char_t_to_char_3_le(character) (((character) & F_utf_char_mask_char_3_le_d) << 16) // Grab third byte. - #define macro_f_utf_char_t_to_char_4_le(character) (((character) & F_utf_char_mask_char_4_le_d) << 24) // Grab fourth byte. + #define macro_f_utf_char_t_to_char_2_le(character) (((character) & F_utf_char_mask_char_2_le_d) >> 8) // Grab second byte. + #define macro_f_utf_char_t_to_char_3_le(character) (((character) & F_utf_char_mask_char_3_le_d) >> 16) // Grab third byte. + #define macro_f_utf_char_t_to_char_4_le(character) (((character) & F_utf_char_mask_char_4_le_d) >> 24) // Grab fourth byte. #define macro_f_utf_char_t_from_char_1_le(character) ((character) & F_utf_char_mask_char_1_le_d) // Shift to first byte. #define macro_f_utf_char_t_from_char_2_le(character) (((character) << 8) & F_utf_char_mask_char_2_le_d) // Shift to second byte. diff --git a/level_0/f_utf/c/utf/convert.c b/level_0/f_utf/c/utf/convert.c index 3c8c7ad..6dff6c8 100644 --- a/level_0/f_utf/c/utf/convert.c +++ b/level_0/f_utf/c/utf/convert.c @@ -25,64 +25,67 @@ extern "C" { #endif // _di_f_utf_char_to_character_ #ifndef _di_f_utf_char_to_char_ - f_status_t f_utf_char_to_char(const f_utf_char_t utf_character, f_string_t *character, f_array_length_t *width_max) { + f_status_t f_utf_char_to_char(const f_utf_char_t unicode, f_string_t *character, f_array_length_t *width_max) { #ifndef _di_level_0_parameter_checking_ if (!character) return F_status_set_error(F_parameter); if (!width_max) return F_status_set_error(F_parameter); if (!*width_max) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (macro_f_utf_char_t_width_is(utf_character)) { - if (macro_f_utf_char_t_width_is(utf_character) == 1) { + if (macro_f_utf_char_t_width_is(unicode)) { + if (macro_f_utf_char_t_width_is(unicode) == 1) { return F_status_set_error(F_utf_fragment); } - #if __BYTE_ORDER == __LITTLE_ENDIAN + memcpy(*character, &unicode, sizeof(f_char_t) * macro_f_utf_char_t_width_is(unicode)); + /*#if __BYTE_ORDER == __LITTLE_ENDIAN f_utf_char_t utf = 0; - switch (macro_f_utf_char_t_width_is(utf_character)) { + switch (macro_f_utf_char_t_width_is(unicode)) { case 1: - utf = macro_f_utf_char_t_to_char_1(utf_character) << 24; + utf = macro_f_utf_char_t_from_char_1(macro_f_utf_char_t_to_char_1(unicode)); break; case 2: - utf = (macro_f_utf_char_t_to_char_2(utf_character) << 24) | (macro_f_utf_char_t_to_char_1(utf_character) << 16); + utf = macro_f_utf_char_t_from_char_1(macro_f_utf_char_t_to_char_2(unicode)) | macro_f_utf_char_t_from_char_2(macro_f_utf_char_t_to_char_1(unicode)); break; case 3: - utf = (macro_f_utf_char_t_to_char_3(utf_character) << 24) | (macro_f_utf_char_t_to_char_2(utf_character) << 16) | (macro_f_utf_char_t_to_char_1(utf_character) << 8); + utf = macro_f_utf_char_t_from_char_1(macro_f_utf_char_t_to_char_3(unicode)) | macro_f_utf_char_t_from_char_2(macro_f_utf_char_t_to_char_2(unicode)) | macro_f_utf_char_t_from_char_3(macro_f_utf_char_t_to_char_1(unicode)); break; case 4: - utf = (macro_f_utf_char_t_to_char_4(utf_character) << 24) | (macro_f_utf_char_t_to_char_3(utf_character) << 16) | (macro_f_utf_char_t_to_char_2(utf_character) << 8) | macro_f_utf_char_t_to_char_1(utf_character); + utf = macro_f_utf_char_t_from_char_1(macro_f_utf_char_t_to_char_4(unicode)) | macro_f_utf_char_t_from_char_2(macro_f_utf_char_t_to_char_3(unicode)) | macro_f_utf_char_t_from_char_3(macro_f_utf_char_t_to_char_2(unicode)) | macro_f_utf_char_t_from_char_4(macro_f_utf_char_t_to_char_1(unicode)); break; default: return F_status_set_error(F_failure); } - memcpy(*character, &utf, sizeof(f_char_t) * macro_f_utf_char_t_width_is(utf_character)); + memcpy(*character, &utf, sizeof(f_char_t) * macro_f_utf_char_t_width_is(unicode)); #else - memcpy(*character, &utf_character, sizeof(f_char_t) * macro_f_utf_char_t_width_is(utf_character)); - #endif // __BYTE_ORDER == __LITTLE_ENDIAN + memcpy(*character, &unicode, sizeof(f_char_t) * macro_f_utf_char_t_width_is(unicode)); + #endif // __BYTE_ORDER == __LITTLE_ENDIAN*/ return F_none; } - #if __BYTE_ORDER == __LITTLE_ENDIAN - f_utf_char_t utf = macro_f_utf_char_t_to_char_1(utf_character) << 24; + memcpy(*character, &unicode, sizeof(f_char_t)); + + /*#if __BYTE_ORDER == __LITTLE_ENDIAN + f_utf_char_t utf = macro_f_utf_char_t_to_char_1(unicode) << 24; memcpy(*character, &utf, sizeof(f_char_t)); #else - memcpy(*character, &utf_character, sizeof(f_char_t)); - #endif // __BYTE_ORDER == __LITTLE_ENDIAN + memcpy(*character, &unicode, sizeof(f_char_t)); + #endif // __BYTE_ORDER == __LITTLE_ENDIAN*/ return F_none; } #endif // _di_f_utf_char_to_char_ #ifndef _di_f_utf_character_unicode_to_ - f_status_t f_utf_character_unicode_to(const f_utf_char_t character, f_utf_char_t *unicode) { + f_status_t f_utf_character_unicode_to(const f_utf_char_t character, uint32_t *unicode) { #ifndef _di_level_0_parameter_checking_ if (!unicode) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -92,7 +95,7 @@ extern "C" { #endif // _di_f_utf_character_unicode_to_ #ifndef _di_f_utf_character_unicode_from_ - f_status_t f_utf_character_unicode_from(const f_utf_char_t unicode, f_utf_char_t *character) { + f_status_t f_utf_character_unicode_from(const uint32_t unicode, f_utf_char_t *character) { #ifndef _di_level_0_parameter_checking_ if (!character) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -135,9 +138,9 @@ extern "C" { #endif // _di_f_utf_character_unicode_from_ #ifndef _di_f_utf_character_unicode_string_to_ - f_status_t f_utf_character_unicode_string_to(const f_utf_string_t string, const f_array_length_t length, f_utf_char_t *unicode) { + f_status_t f_utf_character_unicode_string_to(const f_utf_string_t string, const f_array_length_t length, f_utf_char_t *codepoint) { #ifndef _di_level_0_parameter_checking_ - if (!unicode) return F_status_set_error(F_parameter); + if (!codepoint) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_array_length_t i = 0; @@ -174,7 +177,7 @@ extern "C" { } f_utf_char_t value = 0; - uint8_t character = 0; + f_char_t character = 0; for (; i < length; ++i) { @@ -202,26 +205,26 @@ extern "C" { } } // for - *unicode = value; + *codepoint = value; return F_none; } #endif // _di_f_utf_character_unicode_string_to_ #ifndef _di_f_utf_unicode_from_ - f_status_t f_utf_unicode_from(const f_utf_char_t unicode, const f_array_length_t width_max, f_string_t *character) { + f_status_t f_utf_unicode_from(const f_utf_char_t codepoint, const f_array_length_t width_max, f_string_t *character) { #ifndef _di_level_0_parameter_checking_ if (width_max < 1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (unicode > 0x10ffff) { + if (codepoint > 0x10ffff) { return F_status_set_error(F_utf_not); } - if (unicode < 0x80) { + if (codepoint < 0x80) { // U+0000 -> U+007F - (*character)[0] = (uint8_t) unicode; + (*character)[0] = (f_char_t) codepoint; if (width_max > 1) { (*character)[1] = 0; @@ -235,32 +238,32 @@ extern "C" { } } } - else if (unicode < 0x800) { + else if (codepoint < 0x800) { if (width_max < 2) { return F_status_set_error(F_utf_not); } // U+0080 -> U+07FF - (*character)[0] = F_utf_byte_2_d | ((uint8_t) ((unicode & 0x7c0) >> 6)); - (*character)[1] = F_utf_byte_1_d | ((uint8_t) (unicode & 0x3f)); + (*character)[0] = F_utf_byte_2_d | ((f_char_t) ((codepoint & 0x7c0) >> 6)); + (*character)[1] = F_utf_byte_1_d | ((f_char_t) (codepoint & 0x3f)); if (width_max > 2) { (*character)[2] = 0; - if (width_max > 2) { - (*character)[2] = 0; + if (width_max > 3) { + (*character)[3] = 0; } } } - else if (unicode < 0x10000) { + else if (codepoint < 0x10000) { if (width_max < 3) { return F_status_set_error(F_utf_not); } // U+0800 -> U+FFFF - (*character)[0] = F_utf_byte_3_d | ((uint8_t) ((unicode & 0xf000) >> 12)); - (*character)[1] = F_utf_byte_1_d | ((uint8_t) ((unicode & 0xfc0) >> 6)); - (*character)[2] = F_utf_byte_1_d | ((uint8_t) (unicode & 0x3f)); + (*character)[0] = F_utf_byte_3_d | ((f_char_t) ((codepoint & 0xf000) >> 12)); + (*character)[1] = F_utf_byte_1_d | ((f_char_t) ((codepoint & 0xfc0) >> 6)); + (*character)[2] = F_utf_byte_1_d | ((f_char_t) (codepoint & 0x3f)); if (width_max > 3) { character[3] = 0; @@ -272,10 +275,10 @@ extern "C" { } // U+10000 -> U+10FFFF - (*character)[0] = F_utf_byte_4_d | ((uint8_t) ((unicode & 0x1c0000) >> 18)); - (*character)[1] = F_utf_byte_1_d | ((uint8_t) ((unicode & 0x3f000) >> 12)); - (*character)[2] = F_utf_byte_1_d | ((uint8_t) ((unicode & 0xfc0) >> 6)); - (*character)[3] = F_utf_byte_1_d | ((uint8_t) (unicode & 0x3f)); + (*character)[0] = F_utf_byte_4_d | ((f_char_t) ((codepoint & 0x1c0000) >> 18)); + (*character)[1] = F_utf_byte_1_d | ((f_char_t) ((codepoint & 0x3f000) >> 12)); + (*character)[2] = F_utf_byte_1_d | ((f_char_t) ((codepoint & 0xfc0) >> 6)); + (*character)[3] = F_utf_byte_1_d | ((f_char_t) (codepoint & 0x3f)); } return F_none; @@ -283,7 +286,7 @@ extern "C" { #endif // _di_f_utf_unicode_from_ #ifndef _di_f_utf_unicode_to_ - f_status_t f_utf_unicode_to(const f_string_t character, const f_array_length_t width_max, f_utf_char_t *unicode) { + f_status_t f_utf_unicode_to(const f_string_t character, const f_array_length_t width_max, uint32_t *unicode) { #ifndef _di_level_0_parameter_checking_ if (width_max < 1) return F_status_set_error(F_parameter); if (!unicode) return F_status_set_error(F_parameter); diff --git a/level_0/f_utf/c/utf/convert.h b/level_0/f_utf/c/utf/convert.h index 0a0a0a8..700a919 100644 --- a/level_0/f_utf/c/utf/convert.h +++ b/level_0/f_utf/c/utf/convert.h @@ -65,7 +65,7 @@ extern "C" { * @see f_utf_character_is_valid() */ #ifndef _di_f_utf_character_unicode_to_ - extern f_status_t f_utf_character_unicode_to(const f_utf_char_t character, f_utf_char_t *unicode); + extern f_status_t f_utf_character_unicode_to(const f_utf_char_t character, uint32_t *unicode); #endif // _di_f_utf_character_unicode_to_ /** @@ -88,7 +88,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_unicode_from_ - extern f_status_t f_utf_character_unicode_from(const f_utf_char_t unicode, f_utf_char_t *character); + extern f_status_t f_utf_character_unicode_from(const uint32_t unicode, f_utf_char_t *character); #endif // _di_f_utf_character_unicode_from_ /** @@ -103,7 +103,7 @@ extern "C" { * The string representing a Unicode sequence. * @param length * The maximum number of characters. - * @param unicode + * @param codepoint * A 32-bit integer representing the Unicode (such as U+0001). * Does not need to be interpretted like UTF-8, this is a number from 0 onto max supported Unicode integer value (U+10FFFF). * @@ -115,7 +115,7 @@ extern "C" { * F_valid_not (with error bit) if string is not a valid Unicode string. */ #ifndef _di_f_utf_character_unicode_string_to_ - extern f_status_t f_utf_character_unicode_string_to(const f_utf_string_t string, const f_array_length_t length, f_utf_char_t *unicode); + extern f_status_t f_utf_character_unicode_string_to(const f_utf_string_t string, const f_array_length_t length, f_utf_char_t *codepoint); #endif // _di_f_utf_character_unicode_string_to_ /** @@ -146,16 +146,16 @@ extern "C" { /** * Convert a given Unicode into a string block representing a single character. * - * @param character - * The (UTF-8) character. - * The f_utf_char_t is a 32-bit integer containing UTF-8 sequences, unchanged. + * @param unicode + * A 32-bit integer representing the Unicode (such as U+0001). + * Does not need to be interpretted like UTF-8, this is a number from 0 onto max supported Unicode integer value (U+10FFFF). * @param width_max * The max width available for representing the UTF-8 character. * There must be enough space in the character buffer to handle the Unicode width. * It is recommended to always have 4 characters (4 uint8_t) of space available in character. - * @param unicode - * A 32-bit integer representing the Unicode (such as U+0001). - * Does not need to be interpretted like UTF-8, this is a number from 0 onto max supported Unicode integer value (U+10FFFF). + * @param character + * The (UTF-8) character. + * The f_utf_char_t is a 32-bit integer containing UTF-8 sequences. * * @return * F_none on success. @@ -166,7 +166,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_unicode_from_ - extern f_status_t f_utf_unicode_from(const f_utf_char_t unicode, const f_array_length_t width_max, f_string_t *character); + extern f_status_t f_utf_unicode_from(const uint32_t unicode, const f_array_length_t width_max, f_string_t *character); #endif // _di_f_utf_unicode_from_ /** @@ -194,7 +194,7 @@ extern "C" { * @see f_utf_character_is_valid() */ #ifndef _di_f_utf_unicode_to_ - extern f_status_t f_utf_unicode_to(const f_string_t character, const f_array_length_t width_max, f_utf_char_t *unicode); + extern f_status_t f_utf_unicode_to(const f_string_t character, const f_array_length_t width_max, uint32_t *unicode); #endif // _di_f_utf_unicode_to_ /** diff --git a/level_0/f_utf/c/utf/is.c b/level_0/f_utf/c/utf/is.c index c0825b3..635119d 100644 --- a/level_0/f_utf/c/utf/is.c +++ b/level_0/f_utf/c/utf/is.c @@ -11,7 +11,6 @@ #include "../private-utf_punctuation.h" #include "../private-utf_subscript.h" #include "../private-utf_superscript.h" -#include "../private-utf_surrogate.h" #include "../private-utf_symbol.h" #include "../private-utf_valid.h" #include "../private-utf_whitespace.h" @@ -685,36 +684,6 @@ extern "C" { } #endif // _di_f_utf_is_symbol_ -#ifndef _di_f_utf_is_surrogate_ - f_status_t f_utf_is_surrogate(const f_string_t character, const f_array_length_t width_max) { - #ifndef _di_level_0_parameter_checking_ - if (width_max < 1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (macro_f_utf_byte_width_is(*character)) { - if (macro_f_utf_byte_width_is(*character) > width_max) { - return F_status_set_error(F_complete_not_utf); - } - - if (macro_f_utf_byte_width_is(*character) == 1) { - return F_status_set_error(F_utf_fragment); - } - - f_utf_char_t character_utf = 0; - - { - const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); - if (F_status_is_error(status)) return status; - } - - return private_f_utf_character_is_surrogate(character_utf); - } - - // ASCII are never surrogate. - return F_false; - } -#endif // _di_f_utf_is_surrogate_ - #ifndef _di_f_utf_is_unassigned_ f_status_t f_utf_is_unassigned(const f_string_t character, const f_array_length_t width_max) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_utf/c/utf/is.h b/level_0/f_utf/c/utf/is.h index 9968eb9..c75f85b 100644 --- a/level_0/f_utf/c/utf/is.h +++ b/level_0/f_utf/c/utf/is.h @@ -21,8 +21,8 @@ extern "C" { * * This does not check the validity of the character, for that instead use f_utf_is_valid(). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * * @return @@ -30,14 +30,14 @@ extern "C" { * F_false if not a UTF-8 character. */ #ifndef _di_f_utf_is_ - extern f_status_t f_utf_is(const f_string_t character); + extern f_status_t f_utf_is(const f_string_t sequence); #endif // _di_f_utf_is_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 alphabet character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -54,7 +54,7 @@ extern "C" { * @see isalpha() */ #ifndef _di_f_utf_is_alphabetic_ - extern f_status_t f_utf_is_alphabetic(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_alphabetic(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_alphabetic_ /** @@ -64,8 +64,8 @@ extern "C" { * * This does not include number-like, such as 1/2 (½) or superscript 2 (²). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -82,7 +82,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_is_alphabetic_digit_ - extern f_status_t f_utf_is_alphabetic_digit(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_alphabetic_digit(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_alphabetic_digit_ /** @@ -90,8 +90,8 @@ extern "C" { * * Numeric characters are decimal digits, letter numbers, and number-like, such as 1/2 (½) or superscript 2 (²). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -108,14 +108,14 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_is_alphabetic_numeric_ - extern f_status_t f_utf_is_alphabetic_numeric(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_alphabetic_numeric(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_alphabetic_numeric_ /** * Check to see if the entire byte block of the character is an ASCII character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -130,14 +130,14 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_ascii_ - extern f_status_t f_utf_is_ascii(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_ascii(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_ascii_ /** * Check to see if the entire byte block of the character is a UTF-8 combining character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -152,7 +152,7 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_combining_ - extern f_status_t f_utf_is_combining(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_combining(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_combining_ /** @@ -160,8 +160,8 @@ extern "C" { * * This includes control code and control format characters. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -178,7 +178,7 @@ extern "C" { * @see iscntrl() */ #ifndef _di_f_utf_is_control_ - extern f_status_t f_utf_is_control(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_control(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_control_ /** @@ -186,8 +186,8 @@ extern "C" { * * Control Code characters are the traditional control characters, such as "\n" as well as some newer Unicode ones. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -202,7 +202,7 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_control_code_ - extern f_status_t f_utf_is_control_code(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_control_code(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_control_code_ /** @@ -211,8 +211,8 @@ extern "C" { * Control Format characters are special characters used for formatting. * These are considered control characters. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -227,7 +227,7 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_control_format_ - extern f_status_t f_utf_is_control_format(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_control_format(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_control_format_ /** @@ -235,8 +235,8 @@ extern "C" { * * Control Picture characters are placeholders for special ASCII characters and therefore there are no ASCII Control Picture characters. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -251,14 +251,14 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_control_picture_ - extern f_status_t f_utf_is_control_picture(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_control_picture(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_control_picture_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 digit character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -275,14 +275,14 @@ extern "C" { * @see isdigit() */ #ifndef _di_f_utf_is_digit_ - extern f_status_t f_utf_is_digit(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_digit(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_digit_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 emoji character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -297,7 +297,7 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_emoji_ - extern f_status_t f_utf_is_emoji(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_emoji(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_emoji_ /** @@ -319,8 +319,8 @@ extern "C" { * %xF4 %x80-8F 2( UTF8-tail ) * UTF8-tail = %x80-BF * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * * @return @@ -328,14 +328,14 @@ extern "C" { * F_false if not a UTF-8 character. */ #ifndef _di_f_utf_is_fragment_ - extern f_status_t f_utf_is_fragment(const f_string_t character); + extern f_status_t f_utf_is_fragment(const f_string_t sequence); #endif // _di_f_utf_is_fragment_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 printable character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -354,7 +354,7 @@ extern "C" { * @see isgraph() */ #ifndef _di_f_utf_is_graph_ - extern f_status_t f_utf_is_graph(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_graph(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_graph_ /** @@ -362,8 +362,8 @@ extern "C" { * * Numeric characters are decimal digits, letter numbers, and number-like, such as 1/2 (½) or superscript 2 (²). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -380,14 +380,14 @@ extern "C" { * @see isdigit() */ #ifndef _di_f_utf_is_numeric_ - extern f_status_t f_utf_is_numeric(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_numeric(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_numeric_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 phonetic character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -402,14 +402,14 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_phonetic_ - extern f_status_t f_utf_is_phonetic(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_phonetic(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_phonetic_ /** * Check to see if the entire byte block of the character is a UTF-8 private character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -424,14 +424,14 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_private_ - extern f_status_t f_utf_is_private(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_private(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_private_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 punctuation character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -446,14 +446,14 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_punctuation_ - extern f_status_t f_utf_is_punctuation(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_punctuation(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_punctuation_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 subscript character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -468,14 +468,14 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_subscript_ - extern f_status_t f_utf_is_subscript(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_subscript(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_subscript_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 superscript character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -490,36 +490,14 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_superscript_ - extern f_status_t f_utf_is_superscript(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_superscript(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_superscript_ /** - * Check to see if the entire byte block of the character is a surrogate UTF-8 character. - * - * @param character - * The character to validate. - * There must be enough space allocated to compare against, as limited by width_max. - * @param width_max - * The maximum width available for checking. - * Can be anything greater than 0. - * - * @return - * F_true if a UTF-8 symbol character. - * F_false if not a UTF-8 symbol character. - * - * F_complete_not_utf (with error bit set) if character is an incomplete UTF-8 sequence. - * F_utf_fragment (with error bit) if character is a UTF-8 fragment. - * F_utf_not (with error bit) if Unicode is an invalid Unicode character. - */ -#ifndef _di_f_utf_is_surrogate_ - extern f_status_t f_utf_is_surrogate(const f_string_t character, const f_array_length_t width_max); -#endif // _di_f_utf_is_surrogate_ - -/** * Check to see if the entire byte block of the character is an ASCII or UTF-8 symbol character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -534,14 +512,14 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_symbol_ - extern f_status_t f_utf_is_symbol(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_symbol(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_symbol_ /** * Check to see if the entire byte block of the character is a unassigned UTF-8 character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -557,7 +535,7 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_unassigned_ - extern f_status_t f_utf_is_unassigned(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_unassigned(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_unassigned_ /** @@ -570,8 +548,8 @@ extern "C" { * * Codes U+FDD0 to U+FDEF and any character ending in FFFE or FFFF are non-characters, and are therefore invalid. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -587,7 +565,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is a UTF-8 fragment. */ #ifndef _di_f_utf_is_valid_ - extern f_status_t f_utf_is_valid(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_valid(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_valid_ /** @@ -601,8 +579,8 @@ extern "C" { * Phonetic spaces are white spaces with additional phonetic meaning associated with them. * However, because they are not renderred as white space, they are technically not white space. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -621,7 +599,7 @@ extern "C" { * @see isspace() */ #ifndef _di_f_utf_is_whitespace_ - extern f_status_t f_utf_is_whitespace(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_whitespace(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_whitespace_ /** @@ -632,8 +610,8 @@ extern "C" { * Phonetic spaces are whitespaces with additional phonetic meaning associated with them. * Therefore, these are valid spaces in the technical sense, even if they are not visibly white space. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -650,7 +628,7 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_whitespace_modifier_ - extern f_status_t f_utf_is_whitespace_modifier(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_whitespace_modifier(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_whitespace_modifier_ /** @@ -658,8 +636,8 @@ extern "C" { * * This is a list of white space that are not actual white space (because they are graph characters) but are considered white space, such as Ogham Space Mark ' ' (U+1680). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -676,7 +654,7 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_whitespace_other_ - extern f_status_t f_utf_is_whitespace_other(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_whitespace_other(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_whitespace_other_ /** @@ -687,7 +665,7 @@ extern "C" { * When "wide" characters that take up either 2 characters on render. * When "narrow" characters that take up either 1 character on render. * - * @param character + * @param sequence * The (UTF-8) character. * @param width_max * The max width available for representing the UTF-8 character. @@ -704,7 +682,7 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_wide_ - extern f_status_t f_utf_is_wide(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_wide(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_wide_ /** @@ -712,8 +690,8 @@ extern "C" { * * A word character is alpha-digit or an underscore '_'. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -734,7 +712,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_is_word_ - extern f_status_t f_utf_is_word(const f_string_t character, const f_array_length_t width_max, const bool strict); + extern f_status_t f_utf_is_word(const f_string_t sequence, const f_array_length_t width_max, const bool strict); #endif // _di_f_utf_is_word_ /** @@ -747,8 +725,8 @@ extern "C" { * All other dash-like Unicode characters are not considered a dash here. * The dash here is intended for combining words, which matches the context of the Unicode "hyphen". * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -769,7 +747,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_is_word_dash_ - extern f_status_t f_utf_is_word_dash(const f_string_t character, const f_array_length_t width_max, const bool strict); + extern f_status_t f_utf_is_word_dash(const f_string_t sequence, const f_array_length_t width_max, const bool strict); #endif // _di_f_utf_is_word_dash_ /** @@ -784,8 +762,8 @@ extern "C" { * * This does not include zero-width punctuation, such as "invisible plus" (U+2064) (even in strict mode). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -806,7 +784,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_is_word_dash_plus_ - extern f_status_t f_utf_is_word_dash_plus(const f_string_t character, const f_array_length_t width_max, const bool strict); + extern f_status_t f_utf_is_word_dash_plus(const f_string_t sequence, const f_array_length_t width_max, const bool strict); #endif // _di_f_utf_is_word_dash_plus_ /** @@ -814,8 +792,8 @@ extern "C" { * * Only characters that do not print, which are generally called zero-width. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * There must be enough space allocated to compare against, as limited by width_max. * @param width_max * The maximum width available for checking. @@ -832,7 +810,7 @@ extern "C" { * F_utf_not (with error bit) if Unicode is an invalid Unicode character. */ #ifndef _di_f_utf_is_zero_width_ - extern f_status_t f_utf_is_zero_width(const f_string_t character, const f_array_length_t width_max); + extern f_status_t f_utf_is_zero_width(const f_string_t sequence, const f_array_length_t width_max); #endif // _di_f_utf_is_zero_width_ #ifdef __cplusplus diff --git a/level_0/f_utf/c/utf/is_character.c b/level_0/f_utf/c/utf/is_character.c index 5b78ffd..53f8192 100644 --- a/level_0/f_utf/c/utf/is_character.c +++ b/level_0/f_utf/c/utf/is_character.c @@ -11,7 +11,6 @@ #include "../private-utf_punctuation.h" #include "../private-utf_subscript.h" #include "../private-utf_superscript.h" -#include "../private-utf_surrogate.h" #include "../private-utf_symbol.h" #include "../private-utf_valid.h" #include "../private-utf_whitespace.h" @@ -25,10 +24,10 @@ extern "C" { #endif #ifndef _di_f_utf_character_is_ - f_status_t f_utf_character_is(const f_utf_char_t character) { + f_status_t f_utf_character_is(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_utf_fragment; } @@ -40,17 +39,17 @@ extern "C" { #endif // _di_f_utf_character_is_ #ifndef _di_f_utf_character_is_alphabetic_ - f_status_t f_utf_character_is_alphabetic(const f_utf_char_t character) { + f_status_t f_utf_character_is_alphabetic(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_alphabetic(character); + return private_f_utf_character_is_alphabetic(sequence); } - if (isalpha(macro_f_utf_char_t_to_char_1(character))) { + if (isalpha(macro_f_utf_char_t_to_char_1(sequence))) { return F_true; } @@ -59,17 +58,17 @@ extern "C" { #endif // _di_f_utf_character_is_alphabetic_ #ifndef _di_f_utf_character_is_alphabetic_digit_ - f_status_t f_utf_character_is_alpha_digit(const f_utf_char_t character) { + f_status_t f_utf_character_is_alpha_digit(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_alphabetic_digit(character); + return private_f_utf_character_is_alphabetic_digit(sequence); } - if (isalnum(macro_f_utf_char_t_to_char_1(character))) { + if (isalnum(macro_f_utf_char_t_to_char_1(sequence))) { return F_true; } @@ -78,17 +77,17 @@ extern "C" { #endif // _di_f_utf_character_is_alphabetic_digit_ #ifndef _di_f_utf_character_is_alphabetic_numeric_ - f_status_t f_utf_character_is_alphabetic_numeric(const f_utf_char_t character) { + f_status_t f_utf_character_is_alphabetic_numeric(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_alphabetic_numeric(character); + return private_f_utf_character_is_alphabetic_numeric(sequence); } - if (isalnum(macro_f_utf_char_t_to_char_1(character))) { + if (isalnum(macro_f_utf_char_t_to_char_1(sequence))) { return F_true; } @@ -97,9 +96,9 @@ extern "C" { #endif // _di_f_utf_character_is_alphabetic_numeric_ #ifndef _di_f_utf_character_is_ascii_ - f_status_t f_utf_character_is_ascii(const f_utf_char_t character) { + f_status_t f_utf_character_is_ascii(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { + if (macro_f_utf_char_t_width_is(sequence)) { return F_false; } @@ -108,14 +107,14 @@ extern "C" { #endif // _di_f_utf_character_is_ascii_ #ifndef _di_f_utf_character_is_combining_ - f_status_t f_utf_character_is_combining(const f_utf_char_t character) { + f_status_t f_utf_character_is_combining(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_combining(character); + return private_f_utf_character_is_combining(sequence); } // There are no combining characters in ASCII. @@ -124,17 +123,17 @@ extern "C" { #endif // _di_f_utf_character_is_combining_ #ifndef _di_f_utf_character_is_control_ - f_status_t f_utf_character_is_control(const f_utf_char_t character) { + f_status_t f_utf_character_is_control(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_control(character); + return private_f_utf_character_is_control(sequence); } - if (iscntrl(macro_f_utf_char_t_to_char_1(character))) { + if (iscntrl(macro_f_utf_char_t_to_char_1(sequence))) { return F_true; } @@ -143,17 +142,17 @@ extern "C" { #endif // _di_f_utf_character_is_control_ #ifndef _di_f_utf_character_is_control_code_ - f_status_t f_utf_character_is_control_code(const f_utf_char_t character) { + f_status_t f_utf_character_is_control_code(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_control_code(character); + return private_f_utf_character_is_control_code(sequence); } - if (iscntrl(macro_f_utf_char_t_to_char_1(character))) { + if (iscntrl(macro_f_utf_char_t_to_char_1(sequence))) { return F_true; } @@ -162,14 +161,14 @@ extern "C" { #endif // _di_f_utf_character_is_control_code_ #ifndef _di_f_utf_character_is_control_picture_ - f_status_t character_is_control_format(const f_utf_char_t character) { + f_status_t character_is_control_format(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_control_format(character); + return private_f_utf_character_is_control_format(sequence); } // There are no control format characters in ASCII. @@ -178,14 +177,14 @@ extern "C" { #endif // _di_f_utf_character_is_control_format_ #ifndef _di_f_utf_character_is_control_picture_ - f_status_t f_utf_character_is_control_picture(const f_utf_char_t character) { + f_status_t f_utf_character_is_control_picture(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_control_picture(character); + return private_f_utf_character_is_control_picture(sequence); } // There are no control picture characters in ASCII. @@ -194,17 +193,17 @@ extern "C" { #endif // _di_f_utf_character_is_control_picture_ #ifndef _di_f_utf_character_is_digit_ - f_status_t f_utf_character_is_digit(const f_utf_char_t character) { + f_status_t f_utf_character_is_digit(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_digit(character); + return private_f_utf_character_is_digit(sequence); } - if (isdigit(macro_f_utf_char_t_to_char_1(character))) { + if (isdigit(macro_f_utf_char_t_to_char_1(sequence))) { return F_true; } @@ -213,14 +212,14 @@ extern "C" { #endif // _di_f_utf_character_is_digit_ #ifndef _di_f_utf_character_is_emoji_ - f_status_t f_utf_character_is_emoji(const f_utf_char_t character) { + f_status_t f_utf_character_is_emoji(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_emoji(character); + return private_f_utf_character_is_emoji(sequence); } return F_false; @@ -228,36 +227,36 @@ extern "C" { #endif // _di_f_utf_character_is_emoji_ #ifndef _di_f_utf_character_is_fragment_ - f_status_t f_utf_character_is_fragment(const f_utf_char_t character) { + f_status_t f_utf_character_is_fragment(const f_utf_char_t sequence) { - return macro_f_utf_char_t_width_is(character) == 1; + return macro_f_utf_char_t_width_is(sequence) == 1; } #endif // _di_f_utf_character_is_fragment_ #ifndef _di_f_utf_character_is_graph_ - f_status_t f_utf_character_is_graph(const f_utf_char_t character) { + f_status_t f_utf_character_is_graph(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - if (private_f_utf_character_is_control(character)) { + if (private_f_utf_character_is_control(sequence)) { return F_false; } - if (private_f_utf_character_is_whitespace(character)) { + if (private_f_utf_character_is_whitespace(sequence)) { return F_false; } - if (private_f_utf_character_is_zero_width(character)) { + if (private_f_utf_character_is_zero_width(sequence)) { return F_false; } return F_true; } - if (isgraph(macro_f_utf_char_t_to_char_1(character))) { + if (isgraph(macro_f_utf_char_t_to_char_1(sequence))) { return F_true; } @@ -266,17 +265,17 @@ extern "C" { #endif // _di_f_utf_character_is_graph_ #ifndef _di_f_utf_character_is_numeric_ - f_status_t f_utf_character_is_numeric(const f_utf_char_t character) { + f_status_t f_utf_character_is_numeric(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_numeric(character); + return private_f_utf_character_is_numeric(sequence); } - if (isdigit(macro_f_utf_char_t_to_char_1(character))) { + if (isdigit(macro_f_utf_char_t_to_char_1(sequence))) { return F_true; } @@ -285,14 +284,14 @@ extern "C" { #endif // _di_f_utf_character_is_numeric_ #ifndef _di_f_utf_character_is_phonetic_ - f_status_t f_utf_character_is_phonetic(const f_utf_char_t character) { + f_status_t f_utf_character_is_phonetic(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_phonetic(character); + return private_f_utf_character_is_phonetic(sequence); } // There are no ASCII phonetic characters. @@ -301,14 +300,14 @@ extern "C" { #endif // _di_f_utf_character_is_phonetic_ #ifndef _di_f_utf_character_is_private_ - f_status_t f_utf_character_is_private(const f_utf_char_t character) { + f_status_t f_utf_character_is_private(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_private(character); + return private_f_utf_character_is_private(sequence); } // There are no ASCII private characters. @@ -317,43 +316,43 @@ extern "C" { #endif // _di_f_utf_character_is_phonetic_ #ifndef _di_f_utf_character_is_punctuation_ - f_status_t f_utf_character_is_punctuation(const f_utf_char_t character) { + f_status_t f_utf_character_is_punctuation(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_punctuation(character); + return private_f_utf_character_is_punctuation(sequence); } // ASCII: U+0021 '!' to U+0023 '#'. - if (character > 0x20000000 && character < 0x24000000) { + if (sequence > 0x20000000 && sequence < 0x24000000) { return F_true; } // ASCII: U+0025 '%' to U+002A '*'. - if (character > 0x24000000 && character < 0x2b000000) { + if (sequence > 0x24000000 && sequence < 0x2b000000) { return F_true; } // ASCII: U+002C ',' to U+002F '/'. - if (character > 0x2b000000 && character < 0x30000000) { + if (sequence > 0x2b000000 && sequence < 0x30000000) { return F_true; } // ASCII: U+003A ':', U+003B ';', U+003F '?', or U+0040 '@'. - if (character == 0x3a000000 || character == 0x3b000000 || character == 0x3f000000 || character == 0x40000000) { + if (sequence == 0x3a000000 || sequence == 0x3b000000 || sequence == 0x3f000000 || sequence == 0x40000000) { return F_true; } // ASCII: U+005B '[' to U+005D ']'. - if (character > 0x5a000000 && character < 0x5e000000) { + if (sequence > 0x5a000000 && sequence < 0x5e000000) { return F_true; } // ASCII: U+005F '_', U+007B '{', or U+007D '}'. - if (character == 0x5f000000 || character == 0x7b000000 || character == 0x7d000000) { + if (sequence == 0x5f000000 || sequence == 0x7b000000 || sequence == 0x7d000000) { return F_true; } @@ -362,14 +361,14 @@ extern "C" { #endif // _di_f_utf_character_is_punctuation_ #ifndef _di_f_utf_character_is_subscript_ - f_status_t f_utf_character_is_subscript(const f_utf_char_t character) { + f_status_t f_utf_character_is_subscript(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_subscript(character); + return private_f_utf_character_is_subscript(sequence); } return F_false; @@ -377,58 +376,43 @@ extern "C" { #endif // _di_f_utf_character_is_subscript_ #ifndef _di_f_utf_character_is_superscript_ - f_status_t f_utf_character_is_superscript(const f_utf_char_t character) { + f_status_t f_utf_character_is_superscript(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_superscript(character); + return private_f_utf_character_is_superscript(sequence); } return F_false; } #endif // _di_f_utf_character_is_superscript_ -#ifndef _di_f_utf_character_is_surrogate_ - f_status_t f_utf_character_is_surrogate(const f_utf_char_t character) { - - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { - return F_status_set_error(F_utf_fragment); - } - - return private_f_utf_character_is_surrogate(character); - } - - return F_false; - } -#endif // _di_f_utf_character_is_surrogate_ - #ifndef _di_f_utf_character_is_symbol_ - f_status_t f_utf_character_is_symbol(const f_utf_char_t character) { + f_status_t f_utf_character_is_symbol(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_symbol(character); + return private_f_utf_character_is_symbol(sequence); } // ASCII: U+0024 ('$') or U+002B ('+'). - if (character == 0x24000000 || character == 0x2b000000) { + if (sequence == 0x24000000 || sequence == 0x2b000000) { return F_true; } // ASCII: U+003C ('<') to U+003E ('>'). - if (character >= 0x3c000000 && character <= 0x3e000000) { + if (sequence >= 0x3c000000 && sequence <= 0x3e000000) { return F_true; } // ASCII: U+005E ('^'), U+0060 ('`'), U+007C ('|'), or U+007E ('~'). - if (character == 0x5e000000 || character == 0x60000000 || character == 0x7c000000 || character == 0x7e000000) { + if (sequence == 0x5e000000 || sequence == 0x60000000 || sequence == 0x7c000000 || sequence == 0x7e000000) { return F_true; } @@ -437,14 +421,14 @@ extern "C" { #endif // _di_f_utf_character_is_symbol_ #ifndef _di_f_utf_character_is_unassigned_ - f_status_t f_utf_character_is_unassigned(const f_utf_char_t character) { + f_status_t f_utf_character_is_unassigned(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_unassigned(character); + return private_f_utf_character_is_unassigned(sequence); } return F_false; @@ -452,37 +436,25 @@ extern "C" { #endif // _di_f_utf_character_is_unassigned_ #ifndef _di_f_utf_character_is_valid_ - f_status_t f_utf_character_is_valid(const f_utf_char_t character) { + f_status_t f_utf_character_is_valid(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { - return F_status_set_error(F_utf_fragment); - } - - return private_f_utf_character_is_valid(character); - } - - // All characters with data after the width bytes is invalid. - if (macro_f_utf_char_t_from_char_1(macro_f_utf_char_t_to_char_1(character)) == character) { - return F_true; - } - - return F_false; + // The is valid check handles fragment checks and other validity checks. + return private_f_utf_character_is_valid(sequence); } #endif // _di_f_utf_character_is_valid_ #ifndef _di_f_utf_character_is_whitespace_ - f_status_t f_utf_character_is_whitespace(const f_utf_char_t character) { + f_status_t f_utf_character_is_whitespace(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_whitespace(character); + return private_f_utf_character_is_whitespace(sequence); } - if (isspace(macro_f_utf_char_t_to_char_1(character))) { + if (isspace(macro_f_utf_char_t_to_char_1(sequence))) { return F_true; } @@ -491,14 +463,14 @@ extern "C" { #endif // _di_f_utf_character_is_whitespace_ #ifndef _di_f_utf_character_is_whitespace_modifier_ - f_status_t f_utf_character_is_whitespace_modifier(const f_utf_char_t character) { + f_status_t f_utf_character_is_whitespace_modifier(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_whitespace_modifier(character); + return private_f_utf_character_is_whitespace_modifier(sequence); } // There are no ASCII whitespace modifiers. @@ -507,14 +479,14 @@ extern "C" { #endif // _di_f_utf_character_is_whitespace_modifier_ #ifndef _di_f_utf_character_is_whitespace_other_ - f_status_t f_utf_character_is_whitespace_other(const f_utf_char_t character) { + f_status_t f_utf_character_is_whitespace_other(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_whitespace_other(character); + return private_f_utf_character_is_whitespace_other(sequence); } // There are no ASCII whitespace other. @@ -523,14 +495,14 @@ extern "C" { #endif // _di_f_utf_character_is_whitespace_other_ #ifndef _di_f_utf_character_is_wide_ - f_status_t f_utf_character_is_wide(const f_utf_char_t character) { + f_status_t f_utf_character_is_wide(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_wide(character); + return private_f_utf_character_is_wide(sequence); } // There are no wide ASCII characters. @@ -539,17 +511,17 @@ extern "C" { #endif // _di_f_utf_character_is_wide_ #ifndef _di_f_utf_character_is_word_ - f_status_t f_utf_character_is_word(const f_utf_char_t character, const bool strict) { + f_status_t f_utf_character_is_word(const f_utf_char_t sequence, const bool strict) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_word(character, strict); + return private_f_utf_character_is_word(sequence, strict); } - if (isalnum(macro_f_utf_char_t_to_char_1(character)) || character == f_string_ascii_underscore_s.string[0]) { + if (isalnum(macro_f_utf_char_t_to_char_1(sequence)) || sequence == f_string_ascii_underscore_s.string[0]) { return F_true; } @@ -558,17 +530,17 @@ extern "C" { #endif // _di_f_utf_character_is_word_ #ifndef _di_f_utf_character_is_word_dash_ - f_status_t f_utf_character_is_word_dash(const f_utf_char_t character, const bool strict) { + f_status_t f_utf_character_is_word_dash(const f_utf_char_t sequence, const bool strict) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_word_dash(character, strict); + return private_f_utf_character_is_word_dash(sequence, strict); } - if (isalnum(macro_f_utf_char_t_to_char_1(character)) || character == f_string_ascii_underscore_s.string[0] || character == f_string_ascii_minus_s.string[0]) { + if (isalnum(macro_f_utf_char_t_to_char_1(sequence)) || sequence == f_string_ascii_underscore_s.string[0] || sequence == f_string_ascii_minus_s.string[0]) { return F_true; } @@ -577,17 +549,17 @@ extern "C" { #endif // _di_f_utf_character_is_word_dash_ #ifndef _di_f_utf_character_is_word_dash_plus_ - f_status_t f_utf_character_is_word_dash_plus(const f_utf_char_t character, const bool strict) { + f_status_t f_utf_character_is_word_dash_plus(const f_utf_char_t sequence, const bool strict) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_word_dash_plus(character, strict); + return private_f_utf_character_is_word_dash_plus(sequence, strict); } - if (isalnum(macro_f_utf_char_t_to_char_1(character)) || character == f_string_ascii_underscore_s.string[0] || character == f_string_ascii_minus_s.string[0] || character == f_string_ascii_plus_s.string[0]) { + if (isalnum(macro_f_utf_char_t_to_char_1(sequence)) || sequence == f_string_ascii_underscore_s.string[0] || sequence == f_string_ascii_minus_s.string[0] || sequence == f_string_ascii_plus_s.string[0]) { return F_true; } @@ -596,17 +568,17 @@ extern "C" { #endif // _di_f_utf_character_is_word_dash_plus_ #ifndef _di_f_utf_character_is_zero_width_ - f_status_t f_utf_character_is_zero_width(const f_utf_char_t character) { + f_status_t f_utf_character_is_zero_width(const f_utf_char_t sequence) { - if (macro_f_utf_char_t_width_is(character)) { - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(sequence)) { + if (macro_f_utf_char_t_width_is(sequence) == 1) { return F_status_set_error(F_utf_fragment); } - return private_f_utf_character_is_zero_width(character); + return private_f_utf_character_is_zero_width(sequence); } - const uint8_t ascii = macro_f_utf_char_t_to_char_1(character); + const uint8_t ascii = macro_f_utf_char_t_to_char_1(sequence); // These control characters are considered zero-width spaces. if (ascii >= 0x00 && ascii <= 0x08) { diff --git a/level_0/f_utf/c/utf/is_character.h b/level_0/f_utf/c/utf/is_character.h index 08c71ce..6c331ac 100644 --- a/level_0/f_utf/c/utf/is_character.h +++ b/level_0/f_utf/c/utf/is_character.h @@ -21,8 +21,8 @@ extern "C" { * * This does not validate if the UTF-8 character is a valid UTF-8 character, for that use f_utf_character_is_valid(). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 character. @@ -32,14 +32,14 @@ extern "C" { * @see f_utf_character_is_valid() */ #ifndef _di_f_utf_character_is_ - extern f_status_t f_utf_character_is(const f_utf_char_t character); + extern f_status_t f_utf_character_is(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 alphabet character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 alphabet character. @@ -51,7 +51,7 @@ extern "C" { * @see isalpha() */ #ifndef _di_f_utf_character_is_alphabetic_ - extern f_status_t f_utf_character_is_alphabetic(const f_utf_char_t character); + extern f_status_t f_utf_character_is_alphabetic(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_alphabetic_ /** @@ -61,8 +61,8 @@ extern "C" { * * This does not include number-like, such as 1/2 (½) or superscript 2 (²). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 alpha-digit character. @@ -74,7 +74,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_character_is_alphabetic_digit_ - extern f_status_t f_utf_character_is_alpha_digit(const f_utf_char_t character); + extern f_status_t f_utf_character_is_alpha_digit(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_alphabetic_digit_ /** @@ -82,8 +82,8 @@ extern "C" { * * Numeric characters are decimal digits, letter numbers, and number-like, such as 1/2 (½) or superscript 2 (²). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 alpha-numeric character. @@ -95,7 +95,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_character_is_alphabetic_numeric_ - extern f_status_t f_utf_character_is_alphabetic_numeric(const f_utf_char_t character); + extern f_status_t f_utf_character_is_alphabetic_numeric(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_alphabetic_numeric_ /** @@ -103,22 +103,22 @@ extern "C" { * * This does not validate whether the UTF-8 character is valid or not. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if an ASCII character. * F_false if not an ASCII character. */ #ifndef _di_f_utf_character_is_ascii_ - extern f_status_t f_utf_character_is_ascii(const f_utf_char_t character); + extern f_status_t f_utf_character_is_ascii(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_ascii_ /** * Check to see if the entire byte block of the character is a UTF-8 combining character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 combining character. @@ -128,7 +128,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_combining_ - extern f_status_t f_utf_character_is_combining(const f_utf_char_t character); + extern f_status_t f_utf_character_is_combining(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_combining_ /** @@ -136,8 +136,8 @@ extern "C" { * * This includes control code and control format characters. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 control character. @@ -149,7 +149,7 @@ extern "C" { * @see iscntrl() */ #ifndef _di_f_utf_character_is_control_ - extern f_status_t f_utf_character_is_control(const f_utf_char_t character); + extern f_status_t f_utf_character_is_control(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_control_ /** @@ -159,8 +159,8 @@ extern "C" { * * This does not include Control format characters. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 control code character. @@ -172,7 +172,7 @@ extern "C" { * @see iscntrl() */ #ifndef _di_f_utf_character_is_control_code_ - extern f_status_t f_utf_character_is_control_code(const f_utf_char_t character); + extern f_status_t f_utf_character_is_control_code(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_control_code_ /** @@ -181,8 +181,8 @@ extern "C" { * Control Format characters are special characters used for formatting. * These are considered control characters. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 control format character. @@ -192,7 +192,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_control_format_ - extern f_status_t f_utf_character_is_control_format(const f_utf_char_t character); + extern f_status_t f_utf_character_is_control_format(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_control_format_ /** @@ -200,8 +200,8 @@ extern "C" { * * Control Picture characters are placeholders for special ASCII characters and therefore there are no ASCII Control Picture characters. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 control picture character. @@ -211,7 +211,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_control_picture_ - extern f_status_t f_utf_character_is_control_picture(const f_utf_char_t character); + extern f_status_t f_utf_character_is_control_picture(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_control_picture_ /** @@ -221,8 +221,8 @@ extern "C" { * * This does not include number-like, such as 1/2 (½) or superscript 2 (²). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 digit character. @@ -234,14 +234,14 @@ extern "C" { * @see isdigit() */ #ifndef _di_f_utf_character_is_digit_ - extern f_status_t f_utf_character_is_digit(const f_utf_char_t character); + extern f_status_t f_utf_character_is_digit(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_digit_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 emoji character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 emoji character. @@ -251,7 +251,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_emoji_ - extern f_status_t f_utf_character_is_emoji(const f_utf_char_t character); + extern f_status_t f_utf_character_is_emoji(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_emoji_ /** @@ -273,8 +273,8 @@ extern "C" { * %xF4 %x80-8F 2( UTF8-tail ) * UTF8-tail = %x80-BF * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 character. @@ -287,14 +287,14 @@ extern "C" { * @see f_utf_character_is_valid() */ #ifndef _di_f_utf_character_is_fragment_ - extern f_status_t f_utf_character_is_fragment(const f_utf_char_t character); + extern f_status_t f_utf_character_is_fragment(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_fragment_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 printable character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 graph. @@ -306,7 +306,7 @@ extern "C" { * @see isgraph() */ #ifndef _di_f_utf_character_is_graph_ - extern f_status_t f_utf_character_is_graph(const f_utf_char_t character); + extern f_status_t f_utf_character_is_graph(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_graph_ /** @@ -314,8 +314,8 @@ extern "C" { * * Numeric characters are decimal digits, letter numbers, and number-like, such as 1/2 (½) or superscript 2 (²). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 numeric character. @@ -327,14 +327,14 @@ extern "C" { * @see isdigit() */ #ifndef _di_f_utf_character_is_numeric_ - extern f_status_t f_utf_character_is_numeric(const f_utf_char_t character); + extern f_status_t f_utf_character_is_numeric(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_numeric_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 phonetic character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 phonetic character. @@ -344,14 +344,14 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_phonetic_ - extern f_status_t f_utf_character_is_phonetic(const f_utf_char_t character); + extern f_status_t f_utf_character_is_phonetic(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_phonetic_ /** * Check to see if the entire byte block of the character is a UTF-8 private character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 private character. @@ -361,14 +361,14 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_private_ - extern f_status_t f_utf_character_is_private(const f_utf_char_t character); + extern f_status_t f_utf_character_is_private(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_private_ /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 punctuation character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 punctuation character. @@ -378,7 +378,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_punctuation_ - extern f_status_t f_utf_character_is_punctuation(const f_utf_char_t character); + extern f_status_t f_utf_character_is_punctuation(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_punctuation_ /** @@ -386,8 +386,8 @@ extern "C" { * * This does not treat any combining character as a subscript. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 subscript character. @@ -397,7 +397,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_subscript_ - extern f_status_t f_utf_character_is_subscript(const f_utf_char_t character); + extern f_status_t f_utf_character_is_subscript(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_subscript_ /** @@ -405,8 +405,8 @@ extern "C" { * * This does not treat any combining character as a superscript. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 superscript character. @@ -416,31 +416,14 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_superscript_ - extern f_status_t f_utf_character_is_superscript(const f_utf_char_t character); + extern f_status_t f_utf_character_is_superscript(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_superscript_ /** - * Check to see if the entire byte block of the character is a UTF-8 surrogate character. - * - * @param character - * The character to validate. - * - * @return - * F_true if a UTF-8 superscript character. - * F_false if not a UTF-8 superscript character. - * - * F_utf_fragment (with error bit) if character is a UTF-8 fragment. - * F_utf_not (with error bit) if unicode is an invalid Unicode character. - */ -#ifndef _di_f_utf_character_is_surrogate_ - extern f_status_t f_utf_character_is_surrogate(const f_utf_char_t character); -#endif // _di_f_utf_character_is_surrogate_ - -/** * Check to see if the entire byte block of the character is an ASCII or UTF-8 symbol character. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 symbol character. @@ -450,18 +433,18 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_symbol_ - extern f_status_t f_utf_character_is_symbol(const f_utf_char_t character); + extern f_status_t f_utf_character_is_symbol(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_symbol_ /** * Check to see if the entire byte block of the character is a unassigned (well-formed) UTF-8 character. * - * The Surrogates and Private Use are not considered unassigned. + * The Surrogates (which are not valid UTF-8) and Private Use are not considered unassigned. * * This does validate if the UTF-8 character is a unassigned UTF-8 character. * To not do this, use f_utf_character_is(). * - * @param character + * @param sequence * The character to unassignedate. * * @return @@ -475,7 +458,7 @@ extern "C" { * @see f_utf_character_is_fragment() */ #ifndef _di_f_utf_character_is_unassigned_ - extern f_status_t f_utf_character_is_unassigned(const f_utf_char_t character); + extern f_status_t f_utf_character_is_unassigned(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_value_ /** @@ -488,21 +471,20 @@ extern "C" { * * Codes U+FDD0 to U+FDEF and any character ending in FFFE or FFFF are non-characters, and are therefore invalid. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 character. * F_false if not a UTF-8 character. * * F_utf_fragment (with error bit) if character is a UTF-8 fragment. - * F_utf_not (with error bit) if unicode is an invalid Unicode character. * * @see f_utf_character_is() * @see f_utf_character_is_fragment() */ #ifndef _di_f_utf_character_is_valid_ - extern f_status_t f_utf_character_is_valid(const f_utf_char_t character); + extern f_status_t f_utf_character_is_valid(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_value_ /** @@ -516,8 +498,8 @@ extern "C" { * Phonetic spaces are whitespaces with additional phonetic meaning associated with them. * However, because they are not renderred as white space, they are technically not white space. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 white space. @@ -529,7 +511,7 @@ extern "C" { * @see isspace() */ #ifndef _di_f_utf_character_is_whitespace_ - extern f_status_t f_utf_character_is_whitespace(const f_utf_char_t character); + extern f_status_t f_utf_character_is_whitespace(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_whitespace_ /** @@ -540,8 +522,8 @@ extern "C" { * Phonetic spaces are whitespaces with additional phonetic meaning associated with them. * Therefore, these are valid spaces in the technical sense, even if they are not visibly white space. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 modifier character. @@ -551,7 +533,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_whitespace_modifier_ - extern f_status_t f_utf_character_is_whitespace_modifier(const f_utf_char_t character); + extern f_status_t f_utf_character_is_whitespace_modifier(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_whitespace_modifier_ /** @@ -559,8 +541,8 @@ extern "C" { * * This is a list of white space that are not actual white space (because they are graph characters) but are considered white space, such as Ogham Space Mark ' ' (U+1680). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 (other) white space. @@ -572,7 +554,7 @@ extern "C" { * @see isspace() */ #ifndef _di_f_utf_character_is_whitespace_other_ - extern f_status_t f_utf_character_is_whitespace_other(const f_utf_char_t character); + extern f_status_t f_utf_character_is_whitespace_other(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_whitespace_other_ /** @@ -583,7 +565,7 @@ extern "C" { * When "wide" characters that take up either 2 characters on render. * When "narrow" characters that take up either 1 character on render. * - * @param character + * @param sequence * The (UTF-8) character. * * @return @@ -595,7 +577,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_wide_ - extern f_status_t f_utf_character_is_wide(const f_utf_char_t character); + extern f_status_t f_utf_character_is_wide(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_wide_ /** @@ -603,8 +585,8 @@ extern "C" { * * A word character is alpha-numeric or an underscore '_'. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * @param strict * When TRUE, include all appropriate characters by type as per Unicode. * When FALSE, non-inline punctuation connectors are not considered a character (such as U+FE33 '︳'). @@ -620,7 +602,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_character_is_word_ - extern f_status_t f_utf_character_is_word(const f_utf_char_t character, const bool strict); + extern f_status_t f_utf_character_is_word(const f_utf_char_t sequence, const bool strict); #endif // _di_f_utf_character_is_word_ /** @@ -633,8 +615,8 @@ extern "C" { * All other dash-like Unicode characters are not considered a dash here. * The dash here is intended for combining words, which matches the context of the Unicode "hyphen". * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * @param strict * When TRUE, include all appropriate characters by type as per Unicode. * When FALSE, non-inline punctuation connectors are not considered a character (such as U+FE33 '︳'). @@ -650,7 +632,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_character_is_word_dash_ - extern f_status_t f_utf_character_is_word_dash(const f_utf_char_t character, const bool strict); + extern f_status_t f_utf_character_is_word_dash(const f_utf_char_t sequence, const bool strict); #endif // _di_f_utf_character_is_word_dash_ /** @@ -665,8 +647,8 @@ extern "C" { * * This does not include zero-width punctuation, such as "invisible plus" (U+2064) (even in strict mode). * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * @param strict * When TRUE, include all appropriate characters by type as per Unicode. * When FALSE, non-inline punctuation connectors are not considered a character (such as U+FE33 '︳'). @@ -682,7 +664,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_character_is_word_dash_plus_ - extern f_status_t f_utf_character_is_word_dash_plus(const f_utf_char_t character, const bool strict); + extern f_status_t f_utf_character_is_word_dash_plus(const f_utf_char_t sequence, const bool strict); #endif // _di_f_utf_character_is_word_dash_plus_ /** @@ -690,8 +672,8 @@ extern "C" { * * Only characters that do not print, which are generally called zero-width. * - * @param character - * The character to validate. + * @param sequence + * The byte sequence to validate as a character. * * @return * F_true if a UTF-8 non-printing or zero-width character. @@ -701,7 +683,7 @@ extern "C" { * F_utf_not (with error bit) if unicode is an invalid Unicode character. */ #ifndef _di_f_utf_character_is_zero_width_ - extern f_status_t f_utf_character_is_zero_width(const f_utf_char_t character); + extern f_status_t f_utf_character_is_zero_width(const f_utf_char_t sequence); #endif // _di_f_utf_character_is_zero_width_ #ifdef __cplusplus diff --git a/level_0/f_utf/data/build/settings b/level_0/f_utf/data/build/settings index ddf3db6..716f9b4 100644 --- a/level_0/f_utf/data/build/settings +++ b/level_0/f_utf/data/build/settings @@ -20,7 +20,7 @@ build_language c build_libraries -lc build_libraries-individual -lf_memory -lf_string -build_sources_library utf.c private-utf.c private-utf_alphabetic.c private-utf_combining.c private-utf_control.c private-utf_digit.c private-utf_emoji.c private-utf_numeric.c private-utf_phonetic.c private-utf_private.c private-utf_punctuation.c private-utf_subscript.c private-utf_superscript.c private-utf_surrogate.c private-utf_symbol.c private-utf_valid.c private-utf_whitespace.c private-utf_wide.c private-utf_word.c private-utf_zero_width.c +build_sources_library utf.c private-utf.c private-utf_alphabetic.c private-utf_combining.c private-utf_control.c private-utf_digit.c private-utf_emoji.c private-utf_numeric.c private-utf_phonetic.c private-utf_private.c private-utf_punctuation.c private-utf_subscript.c private-utf_superscript.c private-utf_symbol.c private-utf_valid.c private-utf_whitespace.c private-utf_wide.c private-utf_word.c private-utf_zero_width.c build_sources_library utf/common.c utf/convert.c utf/dynamic.c utf/is.c utf/is_character.c utf/map.c utf/map_multi.c utf/static.c utf/string.c utf/triple.c build_sources_library utf/private-is_unassigned.c utf/private-dynamic.c utf/private-map.c utf/private-map_multi.c utf/private-string.c utf/private-triple.c diff --git a/level_0/f_utf/data/build/settings-tests b/level_0/f_utf/data/build/settings-tests index 092ee4d..e1b5557 100644 --- a/level_0/f_utf/data/build/settings-tests +++ b/level_0/f_utf/data/build/settings-tests @@ -37,7 +37,6 @@ build_sources_program test-utf-character_is_private.c test-utf-is_private.c build_sources_program test-utf-character_is_punctuation.c test-utf-is_punctuation.c build_sources_program test-utf-character_is_subscript.c test-utf-is_subscript.c build_sources_program test-utf-character_is_superscript.c test-utf-is_superscript.c -build_sources_program test-utf-character_is_surrogate.c test-utf-is_surrogate.c build_sources_program test-utf-character_is_symbol.c test-utf-is_symbol.c build_sources_program test-utf-character_is_valid.c test-utf-is_valid.c build_sources_program test-utf-character_is_whitespace.c test-utf-is_whitespace.c diff --git a/level_0/f_utf/tests/unit/c/data-utf.c b/level_0/f_utf/tests/unit/c/data-utf.c index 193dfef..0f83782 100644 --- a/level_0/f_utf/tests/unit/c/data-utf.c +++ b/level_0/f_utf/tests/unit/c/data-utf.c @@ -59,11 +59,6 @@ FILE *data__bytesequence_file_open__superscript(void) { return fopen("./data/tests/bytesequences/superscript-all.txt", "r"); } -FILE *data__bytesequence_file_open__surrogate(void) { - - return fopen("./data/tests/bytesequences/superscript-surrogate.txt", "r"); -} - FILE *data__bytesequence_file_open__symbol(void) { return fopen("./data/tests/bytesequences/symbol-all.txt", "r"); diff --git a/level_0/f_utf/tests/unit/c/data-utf.h b/level_0/f_utf/tests/unit/c/data-utf.h index 0fc4b0f..31b7c50 100644 --- a/level_0/f_utf/tests/unit/c/data-utf.h +++ b/level_0/f_utf/tests/unit/c/data-utf.h @@ -188,21 +188,6 @@ extern FILE *data__bytesequence_file_open__subscript(void); extern FILE *data__bytesequence_file_open__superscript(void); /** - * Open the "surrogate" bytesequence file. - * - * This assumes the following: - * - The file path is relative to the current working directory (tests are run from project root). - * - The file path is "data/tests/bytesequences/surrogate-all.txt". - * - * @return - * Non-zero on success. - * 0 on failure. - * - * @see fopen() - */ -extern FILE *data__bytesequence_file_open__surrogate(void); - -/** * Open the "symbols" bytesequence file. * * This assumes the following: diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_alphabetic.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_alphabetic.c index dca994a..9f234c5 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_alphabetic.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_alphabetic.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_alphabetic__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_alphabetic(character); + const f_status_t status = f_utf_character_is_alphabetic(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_combining.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_combining.c index fed1e1f..6862757 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_combining.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_combining.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_combining__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_combining(character); + const f_status_t status = f_utf_character_is_combining(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_control.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_control.c index 0b3dc6c..093dfca 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_control.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_control.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_control__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_control(character); + const f_status_t status = f_utf_character_is_control(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_digit.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_digit.c index 52d7882..37dd1aa 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_digit.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_digit.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_digit__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_digit(character); + const f_status_t status = f_utf_character_is_digit(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_emoji.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_emoji.c index 478d744..f12a764 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_emoji.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_emoji.c @@ -12,15 +12,15 @@ void test__f_utf_character_is_emoji__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_emoji(character); + const f_status_t status = f_utf_character_is_emoji(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_numeric.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_numeric.c index 397e328..b260134 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_numeric.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_numeric.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_numeric__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_numeric(character); + const f_status_t status = f_utf_character_is_numeric(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_phonetic.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_phonetic.c index f9e26ea..44b0fdc 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_phonetic.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_phonetic.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_phonetic__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_phonetic(character); + const f_status_t status = f_utf_character_is_phonetic(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_private.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_private.c index 3cb4b9e..3b75033 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_private.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_private.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_private__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_private(character); + const f_status_t status = f_utf_character_is_private(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_punctuation.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_punctuation.c index b4c642c..75ea00d 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_punctuation.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_punctuation.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_punctuation__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_punctuation(character); + const f_status_t status = f_utf_character_is_punctuation(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_subscript.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_subscript.c index de1a1cb..dbf2cef 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_subscript.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_subscript.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_subscript__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_subscript(character); + const f_status_t status = f_utf_character_is_subscript(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_superscript.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_superscript.c index 23f3926..7c22ad1 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_superscript.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_superscript.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_superscript__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_superscript(character); + const f_status_t status = f_utf_character_is_superscript(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_surrogate.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_surrogate.c deleted file mode 100644 index e7bf61a..0000000 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_surrogate.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "test-utf.h" -#include "test-utf-character_is_surrogate.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_utf_character_is_surrogate__works(void **state) { - - { - FILE *file = data__bytesequence_file_open__surrogate(); - - assert_non_null(file); - - f_utf_char_t character = 0; - ssize_t bytes = 0; - - f_array_length_t line = 0; - - do { - bytes = data__bytesequence_get_line(file, &character); - - if (bytes > 0) { - const f_status_t status = f_utf_character_is_surrogate(character); - - assert_int_equal(status, F_true); - } - - ++line; - - } while (bytes > 0); - - fclose(file); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_surrogate.h b/level_0/f_utf/tests/unit/c/test-utf-character_is_surrogate.h deleted file mode 100644 index b26f110..0000000 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_surrogate.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: UTF - * API Version: 0.5 - * Licenses: lgpl-2.1-or-later - * - * Test the function in the utf project. - */ -#ifndef _TEST__F_utf_character_is_surrogate_h -#define _TEST__F_utf_character_is_surrogate_h - -/** - * Test that the function works. - * - * @see f_utf_character_is_surrogate() - */ -extern void test__f_utf_character_is_surrogate__works(void **state); - -#endif // _TEST__F_utf_character_is_surrogate_h diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_symbol.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_symbol.c index ee7c8a9..5ee9b20 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_symbol.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_symbol.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_symbol__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_symbol(character); + const f_status_t status = f_utf_character_is_symbol(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_valid.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_valid.c index 06b0058..3b448d3 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_valid.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_valid.c @@ -7,77 +7,156 @@ extern "C" { void test__f_utf_character_is_valid__works(void **state) { - for (f_utf_char_t character = 0; character < UINT32_MAX; ++character) { + for (f_utf_char_t sequence = 0; sequence < UINT32_MAX; ++sequence) { - const uint8_t first = macro_f_utf_char_t_to_char_1(character); - const uint8_t second = macro_f_utf_char_t_to_char_2(character); - const uint8_t third = macro_f_utf_char_t_to_char_3(character); - const uint8_t fourth = macro_f_utf_char_t_to_char_4(character); - const uint8_t width = macro_f_utf_char_t_width_is(character); + const uint8_t first = macro_f_utf_char_t_to_char_1(sequence); + const uint8_t second = macro_f_utf_char_t_to_char_2(sequence); + const uint8_t third = macro_f_utf_char_t_to_char_3(sequence); + const uint8_t fourth = macro_f_utf_char_t_to_char_4(sequence); + const uint8_t width = macro_f_utf_char_t_width_is(sequence); - const f_status_t status = f_utf_character_is_valid(character); + const f_status_t status = f_utf_character_is_valid(sequence); - // All remaining bytes after width must be zero for valid character. + // All remaining bytes after width must be zero for valid sequence. if (width == 0 && (second || third || fourth)) { assert_int_equal(status, F_false); + + continue; } - else if (width == 1) { + + if (width == 1) { assert_int_equal(status, F_status_set_error(F_utf_fragment)); + + continue; } - else if (width == 2 && (third || fourth)) { + + if (width == 2 && (third || fourth)) { assert_int_equal(status, F_false); + + continue; } - else if (width == 3 && fourth) { + + if (width == 3 && fourth) { assert_int_equal(status, F_false); + + continue; } - else { - // Valid: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. - if ((first & 0b11111000) == 0b11111000) { - assert_int_equal(status, F_false); - } - else if ((first & 0b11111000) == 0b11110000) { - if ((second & 0b11000000) == 0b10000000 && (third & 0b11000000) == 0b10000000 && (fourth & 0b11000000) == 0b10000000) { - assert_int_equal(status, F_true); - } - else { + // Invalid: 11111xxx xxxxxxxx xxxxxxxx xxxxxxxx. + if ((first & 0b11111000) == 0b11111000) { + assert_int_equal(status, F_false); + + continue; + } + + // Valid: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. + if ((first & 0b11111000) == 0b11110000) { + + // For first byte 0xf0, only second byte ranges 0x90 to 0xbf are valid. + if (first == 0xf0) { + if (second < 0x90 || second > 0xbf) { assert_int_equal(status, F_false); + + continue; } } - // Valid: 1110xxxx 10xxxxxx 10xxxxxx 00000000. - else if ((first & 0b11110000) == 0b11100000) { - if ((second & 0b11000000) == 0b10000000 && (third & 0b11000000) == 0b10000000) { - assert_int_equal(status, F_true); - } - else { + // For first byte 0xf4, only second byte ranges 0x80 to 0x8f are valid. + else if (first == 0xf4) { + if (second < 0x80 || second > 0x8f) { assert_int_equal(status, F_false); + + continue; } } - // Valid: 110xxxxx 10xxxxxx 00000000 00000000. - else if ((first & 0b11100000) == 0b11000000) { - if ((second & 0b11000000) == 0b10000000) { - assert_int_equal(status, F_true); + // For first byte greater than 0xf4 are all invalid. + else if (first > 0xf4) { + assert_int_equal(status, F_false); + + continue; + } + + if ((second & 0b11000000) == 0b10000000 && (third & 0b11000000) == 0b10000000 && (fourth & 0b11000000) == 0b10000000) { + assert_int_equal(status, F_true); + + continue; + } + + assert_int_equal(status, F_false); + + continue; + } + + // Valid: 1110xxxx 10xxxxxx 10xxxxxx ????????. + if ((first & 0b11110000) == 0b11100000) { + + // For first byte 0xe0, only second byte ranges 0xa0 to 0xbf are valid. + if (first == 0xe0) { + if (second < 0xa0 || second > 0xbf) { + assert_int_equal(status, F_false); + + continue; } - else { + } + + // For first byte 0xed, only second byte ranges 0x80 to 0x9f are valid. + else if (first == 0xed) { + if (second < 0x80 || second > 0x9f) { assert_int_equal(status, F_false); + + continue; } } - // Invalid (UTF Fragment): 10xxxxxx 00000000 00000000 00000000. - else if ((first & 0b11000000) == 0b10000000) { - assert_int_equal(status, F_status_set_error(F_utf_fragment)); + if ((second & 0b11000000) == 0b10000000 && (third & 0b11000000) == 0b10000000) { + assert_int_equal(status, F_true); + + continue; } - // Valid: 0xxxxxxx 00000000 00000000 00000000. - else if (first & 0b10000000) { + assert_int_equal(status, F_false); + + continue; + } + + // Valid: 110xxxxx 10xxxxxx ???????? ????????. + if ((first & 0b11100000) == 0b11000000) { + + // Only first byte ranges 0xc3 or greater are valid. + if (second < 0xc3) { assert_int_equal(status, F_false); + + continue; } - else { + + if ((second & 0b11000000) == 0b10000000) { assert_int_equal(status, F_true); + + continue; } + + assert_int_equal(status, F_false); + + continue; + } + + // Invalid (UTF Fragment): 10xxxxxx ???????? ???????? ????????. + if ((first & 0b11000000) == 0b10000000) { + assert_int_equal(status, F_status_set_error(F_utf_fragment)); + + continue; } + + // Valid: 0xxxxxxx ???????? ???????? ????????. + if (first < 0x80) { + assert_int_equal(status, F_true); + + continue; + } + + // All other values > 0x7f are invalid. + assert_int_equal(status, F_false); } // for } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace.c index 546c1b1..bc8e964 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_whitespace__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_whitespace(character); + const f_status_t status = f_utf_character_is_whitespace(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_wide.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_wide.c index ca9905b..6f937a5 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_wide.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_wide.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_wide__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_wide(character); + const f_status_t status = f_utf_character_is_wide(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_word.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_word.c index 941cc6b..459ad04 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_word.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_word.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_word__strict_is_false(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_word(character, F_false); + const f_status_t status = f_utf_character_is_word(sequence, F_false); // @todo provide an array of codes that should return false when not strict. assert_int_equal(status, F_true); @@ -42,16 +42,16 @@ void test__f_utf_character_is_word__strict_is_true(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_word(character, F_true); + const f_status_t status = f_utf_character_is_word(sequence, F_true); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_zero_width.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_zero_width.c index d6a3917..a1d8f6c 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-character_is_zero_width.c +++ b/level_0/f_utf/tests/unit/c/test-utf-character_is_zero_width.c @@ -12,16 +12,16 @@ void test__f_utf_character_is_zero_width__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes > 0) { - const f_status_t status = f_utf_character_is_zero_width(character); + const f_status_t status = f_utf_character_is_zero_width(sequence); assert_int_equal(status, F_true); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_alphabetic.c b/level_0/f_utf/tests/unit/c/test-utf-is_alphabetic.c index 1e00c6b..c96ec84 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_alphabetic.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_alphabetic.c @@ -12,28 +12,28 @@ void test__f_utf_is_alphabetic__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_combining.c b/level_0/f_utf/tests/unit/c/test-utf-is_combining.c index bd782f6..9173f10 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_combining.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_combining.c @@ -12,28 +12,28 @@ void test__f_utf_is_combining__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_control.c b/level_0/f_utf/tests/unit/c/test-utf-is_control.c index 34624c2..5d8189e 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_control.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_control.c @@ -12,28 +12,28 @@ void test__f_utf_is_control__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_digit.c b/level_0/f_utf/tests/unit/c/test-utf-is_digit.c index 83e8568..5db8d58 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_digit.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_digit.c @@ -12,28 +12,28 @@ void test__f_utf_is_digit__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_emoji.c b/level_0/f_utf/tests/unit/c/test-utf-is_emoji.c index d477440..054eaf4 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_emoji.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_emoji.c @@ -12,28 +12,28 @@ void test__f_utf_is_emoji__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_numeric.c b/level_0/f_utf/tests/unit/c/test-utf-is_numeric.c index 90c5b6c..5801e81 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_numeric.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_numeric.c @@ -12,28 +12,28 @@ void test__f_utf_is_numeric__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_phonetic.c b/level_0/f_utf/tests/unit/c/test-utf-is_phonetic.c index ddeb0ac..88902b2 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_phonetic.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_phonetic.c @@ -12,28 +12,28 @@ void test__f_utf_is_phonetic__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_private.c b/level_0/f_utf/tests/unit/c/test-utf-is_private.c index e3bc846..b5fdbef 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_private.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_private.c @@ -12,28 +12,28 @@ void test__f_utf_is_private__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_punctuation.c b/level_0/f_utf/tests/unit/c/test-utf-is_punctuation.c index 5275c0b..54166b2 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_punctuation.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_punctuation.c @@ -12,28 +12,28 @@ void test__f_utf_is_punctuation__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_subscript.c b/level_0/f_utf/tests/unit/c/test-utf-is_subscript.c index aa5965f..e04d93f 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_subscript.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_subscript.c @@ -12,28 +12,28 @@ void test__f_utf_is_subscript__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_superscript.c b/level_0/f_utf/tests/unit/c/test-utf-is_superscript.c index cc15d2a..2fec11b 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_superscript.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_superscript.c @@ -12,28 +12,28 @@ void test__f_utf_is_superscript__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_surrogate.c b/level_0/f_utf/tests/unit/c/test-utf-is_surrogate.c deleted file mode 100644 index 403a662..0000000 --- a/level_0/f_utf/tests/unit/c/test-utf-is_surrogate.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "test-utf.h" -#include "test-utf-is_surrogate.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_utf_is_surrogate__works(void **state) { - - { - FILE *file = data__bytesequence_file_open__surrogate(); - - assert_non_null(file); - - f_utf_char_t character = 0; - ssize_t bytes = 0; - - f_array_length_t line = 0; - - do { - bytes = data__bytesequence_get_line(file, &character); - - if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); - char buffer[5] = { 0, 0, 0, 0, 0 }; - - buffer[0] = macro_f_utf_char_t_to_char_1(character); - - if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); - - if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); - - if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); - } - } - } - - const f_status_t status = f_utf_is_surrogate(buffer, 5); - - assert_int_equal(status, F_true); - } - - ++line; - - } while (bytes > 0); - - fclose(file); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_surrogate.h b/level_0/f_utf/tests/unit/c/test-utf-is_surrogate.h deleted file mode 100644 index 9e40807..0000000 --- a/level_0/f_utf/tests/unit/c/test-utf-is_surrogate.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: UTF - * API Version: 0.5 - * Licenses: lgpl-2.1-or-later - * - * Test the function in the utf project. - */ -#ifndef _TEST__F_utf_is_surrogate_h -#define _TEST__F_utf_is_surrogate_h - -/** - * Test that the function works. - * - * @see f_utf_is_surrogate() - */ -extern void test__f_utf_is_surrogate__works(void **state); - -#endif // _TEST__F_utf_is_surrogate_h diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_symbol.c b/level_0/f_utf/tests/unit/c/test-utf-is_symbol.c index 8986f10..cac93b6 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_symbol.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_symbol.c @@ -12,28 +12,28 @@ void test__f_utf_is_symbol__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_valid.c b/level_0/f_utf/tests/unit/c/test-utf-is_valid.c index 32857d9..584c471 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_valid.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_valid.c @@ -7,63 +7,133 @@ extern "C" { void test__f_utf_is_valid__works(void **state) { - for (uint32_t character = 0; character < UINT32_MAX; ++character) { + for (uint32_t sequence = 0; sequence < UINT32_MAX; ++sequence) { - const uint8_t first = macro_f_utf_char_t_to_char_1(character); - const uint8_t second = macro_f_utf_char_t_to_char_2(character); - const uint8_t third = macro_f_utf_char_t_to_char_3(character); - const uint8_t fourth = macro_f_utf_char_t_to_char_4(character); + const uint8_t first = macro_f_utf_char_t_to_char_1(sequence); + const uint8_t second = macro_f_utf_char_t_to_char_2(sequence); + const uint8_t third = macro_f_utf_char_t_to_char_3(sequence); + const uint8_t fourth = macro_f_utf_char_t_to_char_4(sequence); char buffer[5] = { first, second, third, fourth, 0 }; // This function only checks validity based on width and does not look at unknown data. const f_status_t status = f_utf_is_valid(buffer, 5); - // Valid: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. + // Invalid: 11111xxx xxxxxxxx xxxxxxxx xxxxxxxx. if ((first & 0b11111000) == 0b11111000) { assert_int_equal(status, F_false); + + continue; } - else if ((first & 0b11111000) == 0b11110000) { - if ((second & 0b11000000) == 0b10000000 && (third & 0b11000000) == 0b10000000 && (fourth & 0b11000000) == 0b10000000) { - assert_int_equal(status, F_true); + + // Valid: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. + if ((first & 0b11111000) == 0b11110000) { + + // For first byte 0xf0, only second byte ranges 0x90 to 0xbf are valid. + if (first == 0xf0) { + if (second < 0x90 || second > 0xbf) { + assert_int_equal(status, F_false); + + continue; + } + } + + // For first byte 0xf4, only second byte ranges 0x80 to 0x8f are valid. + else if (first == 0xf4) { + if (second < 0x80 || second > 0x8f) { + assert_int_equal(status, F_false); + + continue; + } } - else { + + // For first byte greater than 0xf4 are all invalid. + else if (first > 0xf4) { assert_int_equal(status, F_false); + + continue; + } + + if ((second & 0b11000000) == 0b10000000 && (third & 0b11000000) == 0b10000000 && (fourth & 0b11000000) == 0b10000000) { + assert_int_equal(status, F_true); + + continue; } + + assert_int_equal(status, F_false); + + continue; } - // Valid: 1110xxxx 10xxxxxx 10xxxxxx 00000000. - else if ((first & 0b11110000) == 0b11100000) { + // Valid: 1110xxxx 10xxxxxx 10xxxxxx ????????. + if ((first & 0b11110000) == 0b11100000) { + + // For first byte 0xe0, only second byte ranges 0xa0 to 0xbf are valid. + if (first == 0xe0) { + if (second < 0xa0 || second > 0xbf) { + assert_int_equal(status, F_false); + + continue; + } + } + + // For first byte 0xed, only second byte ranges 0x80 to 0x9f are valid. + else if (first == 0xed) { + if (second < 0x80 || second > 0x9f) { + assert_int_equal(status, F_false); + + continue; + } + } + if ((second & 0b11000000) == 0b10000000 && (third & 0b11000000) == 0b10000000) { assert_int_equal(status, F_true); + + continue; } - else { + + assert_int_equal(status, F_false); + + continue; + } + + // Valid: 110xxxxx 10xxxxxx ???????? ????????. + if ((first & 0b11100000) == 0b11000000) { + + // Only first byte ranges 0xc3 or greater are valid. + if (second < 0xc3) { assert_int_equal(status, F_false); + + continue; } - } - // Valid: 110xxxxx 10xxxxxx 00000000 00000000. - else if ((first & 0b11100000) == 0b11000000) { if ((second & 0b11000000) == 0b10000000) { assert_int_equal(status, F_true); + + continue; } - else { - assert_int_equal(status, F_false); - } + + assert_int_equal(status, F_false); + + continue; } - // Invalid (UTF Fragment): 10xxxxxx 00000000 00000000 00000000. - else if ((first & 0b11000000) == 0b10000000) { + // Invalid (UTF Fragment): 10xxxxxx ???????? ???????? ????????. + if ((first & 0b11000000) == 0b10000000) { assert_int_equal(status, F_status_set_error(F_utf_fragment)); + + continue; } - // Valid: 0xxxxxxx 00000000 00000000 00000000. - else if (!(first & 0b10000000)) { + // Valid: 0xxxxxxx ???????? ???????? ????????. + if (first < 0x80) { assert_int_equal(status, F_true); + + continue; } - else { - assert_int_equal(status, F_false); - } + + // All other values > 0x7f are invalid. + assert_int_equal(status, F_false); } // for } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_whitespace.c b/level_0/f_utf/tests/unit/c/test-utf-is_whitespace.c index 66e70d9..c449727 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_whitespace.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_whitespace.c @@ -12,28 +12,28 @@ void test__f_utf_is_whitespace__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_wide.c b/level_0/f_utf/tests/unit/c/test-utf-is_wide.c index 36ca32e..d2efc6f 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_wide.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_wide.c @@ -12,28 +12,28 @@ void test__f_utf_is_wide__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_word.c b/level_0/f_utf/tests/unit/c/test-utf-is_word.c index bfdbfeb..f9d5e0b 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_word.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_word.c @@ -12,28 +12,28 @@ void test__f_utf_is_word__strict_is_false(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } @@ -59,28 +59,28 @@ void test__f_utf_is_word__strict_is_true(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_zero_width.c b/level_0/f_utf/tests/unit/c/test-utf-is_zero_width.c index 83195a3..00f6329 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-is_zero_width.c +++ b/level_0/f_utf/tests/unit/c/test-utf-is_zero_width.c @@ -12,28 +12,28 @@ void test__f_utf_is_zero_width__works(void **state) { assert_non_null(file); - f_utf_char_t character = 0; + f_utf_char_t sequence = 0; ssize_t bytes = 0; f_array_length_t line = 0; do { - bytes = data__bytesequence_get_line(file, &character); + bytes = data__bytesequence_get_line(file, &sequence); if (bytes) { - const uint8_t width = macro_f_utf_char_t_width(character); + const uint8_t width = macro_f_utf_char_t_width(sequence); char buffer[5] = { 0, 0, 0, 0, 0 }; - buffer[0] = macro_f_utf_char_t_to_char_1(character); + buffer[0] = macro_f_utf_char_t_to_char_1(sequence); if (width > 1) { - buffer[1] = macro_f_utf_char_t_to_char_2(character); + buffer[1] = macro_f_utf_char_t_to_char_2(sequence); if (width > 2) { - buffer[2] = macro_f_utf_char_t_to_char_3(character); + buffer[2] = macro_f_utf_char_t_to_char_3(sequence); if (width > 3) { - buffer[3] = macro_f_utf_char_t_to_char_4(character); + buffer[3] = macro_f_utf_char_t_to_char_4(sequence); } } } diff --git a/level_0/f_utf/tests/unit/c/test-utf.c b/level_0/f_utf/tests/unit/c/test-utf.c index d8e31d5..3661bdb 100644 --- a/level_0/f_utf/tests/unit/c/test-utf.c +++ b/level_0/f_utf/tests/unit/c/test-utf.c @@ -35,7 +35,6 @@ int main(void) { cmocka_unit_test(test__f_utf_character_is_punctuation__works), cmocka_unit_test(test__f_utf_character_is_subscript__works), cmocka_unit_test(test__f_utf_character_is_superscript__works), - //cmocka_unit_test(test__f_utf_character_is_surrogate__works), cmocka_unit_test(test__f_utf_character_is_symbol__works), cmocka_unit_test(test__f_utf_character_is_valid__works), //cmocka_unit_test(test__f_utf_character_is_whitespace__works), @@ -144,7 +143,6 @@ int main(void) { cmocka_unit_test(test__f_utf_is_punctuation__works), cmocka_unit_test(test__f_utf_is_subscript__works), cmocka_unit_test(test__f_utf_is_superscript__works), - //cmocka_unit_test(test__f_utf_is_surrogate__works), cmocka_unit_test(test__f_utf_is_symbol__works), cmocka_unit_test(test__f_utf_is_valid__works), //cmocka_unit_test(test__f_utf_is_whitespace__works), diff --git a/level_0/f_utf/tests/unit/c/test-utf.h b/level_0/f_utf/tests/unit/c/test-utf.h index 5d7bdbf..8deda57 100644 --- a/level_0/f_utf/tests/unit/c/test-utf.h +++ b/level_0/f_utf/tests/unit/c/test-utf.h @@ -44,7 +44,6 @@ #include "test-utf-character_is_punctuation.h" #include "test-utf-character_is_subscript.h" #include "test-utf-character_is_superscript.h" -#include "test-utf-character_is_surrogate.h" #include "test-utf-character_is_symbol.h" #include "test-utf-character_is_valid.h" #include "test-utf-character_is_whitespace.h" @@ -113,7 +112,6 @@ #include "test-utf-is_punctuation.h" #include "test-utf-is_subscript.h" #include "test-utf-is_superscript.h" -#include "test-utf-is_surrogate.h" #include "test-utf-is_symbol.h" #include "test-utf-is_valid.h" #include "test-utf-is_whitespace.h" diff --git a/level_1/fl_conversion/c/conversion.c b/level_1/fl_conversion/c/conversion.c index e73a09c..391e08a 100644 --- a/level_1/fl_conversion/c/conversion.c +++ b/level_1/fl_conversion/c/conversion.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_fl_conversion_dynamic_partial_to_binary_signed_ - f_status_t fl_conversion_dynamic_partial_to_binary_signed(const f_string_static_t buffer, const f_string_range_t range, const bool negative, f_number_signed_t * const number) { +#ifndef _di_fl_conversion_dynamic_partial_to_signed_ + f_status_t fl_conversion_dynamic_partial_to_signed(const fl_conversion_data_t data, const f_string_static_t buffer, const f_string_range_t range, f_number_signed_t * const number) { #ifndef _di_level_1_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -15,82 +15,19 @@ extern "C" { return F_data_not; } - return private_fl_conversion_dynamic_to_binary_signed(buffer.string + range.start, (range.stop - range.start) + 1, negative, number); - } -#endif // _di_fl_conversion_dynamic_partial_to_binary_signed_ - -#ifndef _di_fl_conversion_dynamic_partial_to_binary_unsigned_ - f_status_t fl_conversion_dynamic_partial_to_binary_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used || range.start > range.stop) { - return F_data_not; - } - - return private_fl_conversion_dynamic_to_binary_unsigned(buffer.string + range.start, (range.stop - range.start) + 1, number); - } -#endif // _di_fl_conversion_dynamic_partial_to_binary_unsigned_ - -#ifndef _di_fl_conversion_dynamic_partial_to_decimal_signed_ - f_status_t fl_conversion_dynamic_partial_to_decimal_signed(const f_string_static_t buffer, const f_string_range_t range, const bool negative, f_number_signed_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used || range.start > range.stop) { - return F_data_not; - } - - return private_fl_conversion_dynamic_to_decimal_signed(buffer.string + range.start, (range.stop - range.start) + 1, negative, number); - } -#endif // _di_fl_conversion_dynamic_partial_to_decimal_signed_ - -#ifndef _di_fl_conversion_dynamic_partial_to_decimal_unsigned_ - f_status_t fl_conversion_dynamic_partial_to_decimal_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used || range.start > range.stop) { - return F_data_not; - } - - return private_fl_conversion_dynamic_to_decimal_unsigned(buffer.string + range.start, (range.stop - range.start) + 1, number); - } -#endif // _di_fl_conversion_dynamic_partial_to_decimal_unsigned_ - -#ifndef _di_fl_conversion_dynamic_partial_to_duodecimal_signed_ - f_status_t fl_conversion_dynamic_partial_to_duodecimal_signed(const f_string_static_t buffer, const f_string_range_t range, const bool negative, f_number_signed_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used || range.start > range.stop) { - return F_data_not; + if (data.base == 10 || data.base == 16 || data.base == 12 || data.base == 8) { + return private_fl_conversion_dynamic_to_base_signed(data, buffer.string + range.start, (range.stop - range.start) + 1, number); } - - return private_fl_conversion_dynamic_to_duodecimal_signed(buffer.string + range.start, (range.stop - range.start) + 1, negative, number); - } -#endif // _di_fl_conversion_dynamic_partial_to_duodecimal_signed_ - -#ifndef _di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_ - f_status_t fl_conversion_dynamic_partial_to_duodecimal_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used || range.start > range.stop) { - return F_data_not; + else if (data.base == 2) { + return private_fl_conversion_dynamic_to_binary_signed(data.flag, buffer.string + range.start, (range.stop - range.start) + 1, number); } - return private_fl_conversion_dynamic_to_duodecimal_unsigned(buffer.string + range.start, (range.stop - range.start) + 1, number); + return F_status_set_error(F_base_not); } -#endif // _di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_ +#endif // _di_fl_conversion_dynamic_partial_to_signed_ -#ifndef _di_fl_conversion_dynamic_partial_to_hexidecimal_signed_ - f_status_t fl_conversion_dynamic_partial_to_hexidecimal_signed(const f_string_static_t buffer, const f_string_range_t range, const bool negative, f_number_signed_t * const number) { +#ifndef _di_fl_conversion_dynamic_partial_to_unsigned_ + f_status_t fl_conversion_dynamic_partial_to_unsigned(const fl_conversion_data_t data, const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number) { #ifndef _di_level_1_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -99,54 +36,19 @@ extern "C" { return F_data_not; } - return private_fl_conversion_dynamic_to_hexidecimal_signed(buffer.string + range.start, (range.stop - range.start) + 1, negative, number); - } -#endif // _di_fl_conversion_dynamic_partial_to_hexidecimal_signed_ - -#ifndef _di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_ - f_status_t fl_conversion_dynamic_partial_to_hexidecimal_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used || range.start > range.stop) { - return F_data_not; + if (data.base == 10 || data.base == 16 || data.base == 12 || data.base == 8) { + return private_fl_conversion_dynamic_to_base_unsigned(data, buffer.string + range.start, (range.stop - range.start) + 1, number); } - - return private_fl_conversion_dynamic_to_hexidecimal_unsigned(buffer.string + range.start, (range.stop - range.start) + 1, number); - } -#endif // _di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_ - -#ifndef _di_fl_conversion_dynamic_partial_to_octal_signed_ - f_status_t fl_conversion_dynamic_partial_to_octal_signed(const f_string_static_t buffer, const f_string_range_t range, const bool negative, f_number_signed_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used || range.start > range.stop) { - return F_data_not; - } - - return private_fl_conversion_dynamic_to_octal_signed(buffer.string + range.start, (range.stop - range.start) + 1, negative, number); - } -#endif // _di_fl_conversion_dynamic_partial_to_octal_signed_ - -#ifndef _di_fl_conversion_dynamic_partial_to_octal_unsigned_ - f_status_t fl_conversion_dynamic_partial_to_octal_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used || range.start > range.stop) { - return F_data_not; + else if (data.base == 2) { + return private_fl_conversion_dynamic_to_binary_unsigned(data.flag, buffer.string + range.start, (range.stop - range.start) + 1, number); } - return private_fl_conversion_dynamic_to_octal_unsigned(buffer.string + range.start, (range.stop - range.start) + 1, number); + return F_status_set_error(F_base_not); } -#endif // _di_fl_conversion_dynamic_partial_to_octal_unsigned_ +#endif // _di_fl_conversion_dynamic_partial_to_unsigned_ -#ifndef _di_fl_conversion_dynamic_partial_to_number_signed_ - f_status_t fl_conversion_dynamic_partial_to_number_signed(const f_string_static_t buffer, const f_string_range_t range, f_number_signed_t * const number) { +#ifndef _di_fl_conversion_dynamic_partial_to_signed_detect_ + f_status_t fl_conversion_dynamic_partial_to_signed_detect(const fl_conversion_data_t data, const f_string_static_t buffer, const f_string_range_t range, f_number_signed_t * const number) { #ifndef _di_level_1_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -155,12 +57,12 @@ extern "C" { return F_data_not; } - return private_fl_conversion_dynamic_to_number_signed(buffer.string + range.start, (range.stop - range.start) + 1, number); + return private_fl_conversion_dynamic_to_signed_detect(data.flag, buffer.string + range.start, (range.stop - range.start) + 1, number); } -#endif // _di_fl_conversion_dynamic_partial_to_number_signed_ +#endif // _di_fl_conversion_dynamic_partial_to_signed_detect_ -#ifndef _di_fl_conversion_dynamic_partial_to_number_unsigned_ - f_status_t fl_conversion_dynamic_partial_to_number_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number) { +#ifndef _di_fl_conversion_dynamic_partial_to_unsigned_detect_ + f_status_t fl_conversion_dynamic_partial_to_unsigned_detect(const fl_conversion_data_t data, const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number) { #ifndef _di_level_1_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -169,12 +71,12 @@ extern "C" { return F_data_not; } - return private_fl_conversion_dynamic_to_number_unsigned(buffer.string + range.start, (range.stop - range.start) + 1, number); + return private_fl_conversion_dynamic_to_unsigned_detect(data.flag, buffer.string + range.start, (range.stop - range.start) + 1, number); } -#endif // _di_fl_conversion_dynamic_partial_to_number_unsigned_ +#endif // _di_fl_conversion_dynamic_partial_to_unsigned_detect_ -#ifndef _di_fl_conversion_dynamic_to_binary_signed_ - f_status_t fl_conversion_dynamic_to_binary_signed(const f_string_static_t buffer, const bool negative, f_number_signed_t * const number) { +#ifndef _di_fl_conversion_dynamic_to_signed_ + f_status_t fl_conversion_dynamic_to_signed(const fl_conversion_data_t data, const f_string_static_t buffer, f_number_signed_t * const number) { #ifndef _di_level_1_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -183,82 +85,19 @@ extern "C" { return F_data_not; } - return private_fl_conversion_dynamic_to_binary_signed(buffer.string, buffer.used, negative, number); - } -#endif // _di_fl_conversion_dynamic_to_binary_signed_ - -#ifndef _di_fl_conversion_dynamic_to_binary_unsigned_ - f_status_t fl_conversion_dynamic_to_binary_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used) { - return F_data_not; - } - - return private_fl_conversion_dynamic_to_binary_unsigned(buffer.string, buffer.used, number); - } -#endif // _di_fl_conversion_dynamic_to_binary_unsigned_ - -#ifndef _di_fl_conversion_dynamic_to_decimal_signed_ - f_status_t fl_conversion_dynamic_to_decimal_signed(const f_string_static_t buffer, const bool negative, f_number_signed_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used) { - return F_data_not; - } - - return private_fl_conversion_dynamic_to_decimal_signed(buffer.string, buffer.used, negative, number); - } -#endif // _di_fl_conversion_dynamic_to_decimal_signed_ - -#ifndef _di_fl_conversion_dynamic_to_decimal_unsigned_ - f_status_t fl_conversion_dynamic_to_decimal_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used) { - return F_data_not; - } - - return private_fl_conversion_dynamic_to_decimal_unsigned(buffer.string, buffer.used, number); - } -#endif // _di_fl_conversion_dynamic_to_decimal_unsigned_ - -#ifndef _di_fl_conversion_dynamic_to_duodecimal_signed_ - f_status_t fl_conversion_dynamic_to_duodecimal_signed(const f_string_static_t buffer, const bool negative, f_number_signed_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used) { - return F_data_not; + if (data.base == 10 || data.base == 16 || data.base == 12 || data.base == 8) { + return private_fl_conversion_dynamic_to_base_signed(data, buffer.string, buffer.used, number); } - - return private_fl_conversion_dynamic_to_duodecimal_signed(buffer.string, buffer.used, negative, number); - } -#endif // _di_fl_conversion_dynamic_to_duodecimal_signed_ - -#ifndef _di_fl_conversion_dynamic_to_duodecimal_unsigned_ - f_status_t fl_conversion_dynamic_to_duodecimal_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used) { - return F_data_not; + else if (data.base == 2) { + return private_fl_conversion_dynamic_to_binary_signed(data.flag, buffer.string, buffer.used, number); } - return private_fl_conversion_dynamic_to_duodecimal_unsigned(buffer.string, buffer.used, number); + return F_status_set_error(F_base_not); } -#endif // _di_fl_conversion_dynamic_to_duodecimal_unsigned_ +#endif // _di_fl_conversion_dynamic_to_signed_ -#ifndef _di_fl_conversion_dynamic_to_hexidecimal_signed_ - f_status_t fl_conversion_dynamic_to_hexidecimal_signed(const f_string_static_t buffer, const bool negative, f_number_signed_t * const number) { +#ifndef _di_fl_conversion_dynamic_to_unsigned_ + f_status_t fl_conversion_dynamic_to_unsigned(const fl_conversion_data_t data, const f_string_static_t buffer, f_number_unsigned_t * const number) { #ifndef _di_level_1_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -267,54 +106,19 @@ extern "C" { return F_data_not; } - return private_fl_conversion_dynamic_to_hexidecimal_signed(buffer.string, buffer.used, negative, number); - } -#endif // _di_fl_conversion_dynamic_to_hexidecimal_signed_ - -#ifndef _di_fl_conversion_dynamic_to_hexidecimal_unsigned_ - f_status_t fl_conversion_dynamic_to_hexidecimal_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used) { - return F_data_not; + if (data.base == 10 || data.base == 16 || data.base == 12 || data.base == 8) { + return private_fl_conversion_dynamic_to_base_unsigned(data, buffer.string, buffer.used, number); } - - return private_fl_conversion_dynamic_to_hexidecimal_unsigned(buffer.string, buffer.used, number); - } -#endif // _di_fl_conversion_dynamic_to_hexidecimal_unsigned_ - -#ifndef _di_fl_conversion_dynamic_to_octal_signed_ - f_status_t fl_conversion_dynamic_to_octal_signed(const f_string_static_t buffer, const bool negative, f_number_signed_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used) { - return F_data_not; - } - - return private_fl_conversion_dynamic_to_octal_signed(buffer.string, buffer.used, negative, number); - } -#endif // _di_fl_conversion_dynamic_to_octal_signed_ - -#ifndef _di_fl_conversion_dynamic_to_octal_unsigned_ - f_status_t fl_conversion_dynamic_to_octal_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number) { - #ifndef _di_level_1_parameter_checking_ - if (!number) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - if (!buffer.used) { - return F_data_not; + else if (data.base == 2) { + return private_fl_conversion_dynamic_to_binary_unsigned(data.flag, buffer.string, buffer.used, number); } - return private_fl_conversion_dynamic_to_octal_unsigned(buffer.string, buffer.used, number); + return F_status_set_error(F_base_not); } -#endif // _di_fl_conversion_dynamic_to_octal_unsigned_ +#endif // _di_fl_conversion_dynamic_to_unsigned_ -#ifndef _di_fl_conversion_dynamic_to_number_signed_ - f_status_t fl_conversion_dynamic_to_number_signed(const f_string_static_t buffer, f_number_signed_t * const number) { +#ifndef _di_fl_conversion_dynamic_to_signed_detect_ + f_status_t fl_conversion_dynamic_to_signed_detect(const fl_conversion_data_t data, const f_string_static_t buffer, f_number_signed_t * const number) { #ifndef _di_level_1_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -323,12 +127,12 @@ extern "C" { return F_data_not; } - return private_fl_conversion_dynamic_to_number_signed(buffer.string, buffer.used, number); + return private_fl_conversion_dynamic_to_signed_detect(data.flag, buffer.string, buffer.used, number); } -#endif // _di_fl_conversion_dynamic_to_number_signed_ +#endif // _di_fl_conversion_dynamic_to_signed_detect_ -#ifndef _di_fl_conversion_dynamic_to_number_unsigned_ - f_status_t fl_conversion_dynamic_to_number_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number) { +#ifndef _di_fl_conversion_dynamic_to_unsigned_detect_ + f_status_t fl_conversion_dynamic_to_unsigned_detect(const fl_conversion_data_t data, const f_string_static_t buffer, f_number_unsigned_t * const number) { #ifndef _di_level_1_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -337,9 +141,9 @@ extern "C" { return F_data_not; } - return private_fl_conversion_dynamic_to_number_unsigned(buffer.string, buffer.used, number); + return private_fl_conversion_dynamic_to_unsigned_detect(data.flag, buffer.string, buffer.used, number); } -#endif // _di_fl_conversion_dynamic_to_number_unsigned_ +#endif // _di_fl_conversion_dynamic_to_unsigned_detect_ #ifdef __cplusplus } // extern "C" #endif diff --git a/level_1/fl_conversion/c/conversion.h b/level_1/fl_conversion/c/conversion.h index e96d720..d22ffbc 100644 --- a/level_1/fl_conversion/c/conversion.h +++ b/level_1/fl_conversion/c/conversion.h @@ -22,23 +22,26 @@ #include #include +// FLL-1 conversion includes. +#include + #ifdef __cplusplus extern "C" { #endif /** - * Convert a series of positive or negative binary number characters into a f_number_signed_t. + * Convert a series of number characters into a f_number_signed_t. * * 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 data + * Conversion data for specifying things such as treating this as a negative number. * @param buffer * The string to convert. * @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. * @param number * This will store the value of the converted string. * This value is only changed on success. @@ -47,258 +50,73 @@ extern "C" { * 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_base_not (with error bit) if no supported or valid base unit is provided. * F_number (with error bit) if no conversion was made due to non-binary values being found. * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_dynamic_partial_to_binary_signed_ - extern f_status_t fl_conversion_dynamic_partial_to_binary_signed(const f_string_static_t buffer, const f_string_range_t range, const bool negative, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_binary_signed_ - -/** - * Convert a series of positive binary number characters into a f_number_unsigned_t. - * - * 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 buffer - * The string to convert. - * @param range - * The start/stop range to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the binary string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-binary values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_partial_to_binary_unsigned_ - extern f_status_t fl_conversion_dynamic_partial_to_binary_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_binary_unsigned_ - -/** - * Convert a series of positive or negative decimal number characters into an f_number_signed_t. - * - * 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 buffer - * The string to convert. - * @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. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the decimal string was converted to an signed long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-decimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_number_underflow (with error bit) on integer underflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_partial_to_decimal_signed_ - extern f_status_t fl_conversion_dynamic_partial_to_decimal_signed(const f_string_static_t buffer, const f_string_range_t range, const bool negative, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_decimal_signed_ - -/** - * Convert a series of positive decimal number characters into an f_number_unsigned_t. - * - * 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 buffer - * The string to convert. - * @param range - * The start/stop range to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the decimal string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-decimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_partial_to_decimal_unsigned_ - extern f_status_t fl_conversion_dynamic_partial_to_decimal_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_decimal_unsigned_ - -/** - * Convert a series of positive or negative duodecimal number characters into an f_number_signed_t. - * - * 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 buffer - * The string to convert. - * @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. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the duodecimal string was converted to an signed long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-duodecimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_number_underflow (with error bit) on integer underflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_partial_to_duodecimal_signed_ - extern f_status_t fl_conversion_dynamic_partial_to_duodecimal_signed(const f_string_static_t buffer, const f_string_range_t range, const bool negative, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_duodecimal_signed_ +#ifndef _di_fl_conversion_dynamic_partial_to_signed_ + extern f_status_t fl_conversion_dynamic_partial_to_signed(const fl_conversion_data_t data, const f_string_static_t buffer, const f_string_range_t range, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_signed_ /** - * Convert a series of positive duodecimal number characters into an f_number_unsigned_t. + * Convert a series of positive or negative number characters into an f_number_signed_t. * * 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 buffer - * The string to convert. - * @param range - * The start/stop range to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the duodecimal string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). + * 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. * - * F_number (with error bit) if no conversion was made due to non-duodecimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_ - extern f_status_t fl_conversion_dynamic_partial_to_duodecimal_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_ - -/** - * Convert a series of positive or negative hexidecimal number characters into an f_number_signed_t. + * Leading 0's and whitespace are ignored. + * Whitespace after the first digit is considered invalid. * - * 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 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 data + * Conversion data for specifying things such as treating this as a negative number. * @param buffer * The string to convert. * @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. * @param number * This will store the value of the converted string. * This value is only changed on success. * * @return - * F_none if the hexidecimal string was converted to an signed long. + * F_none on success. * 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_base_not (with error bit) if no supported or valid base unit is provided. + * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found. + * F_number (with error bit) if parameter is not a number. * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_partial_to_hexidecimal_signed_ - extern f_status_t fl_conversion_dynamic_partial_to_hexidecimal_signed(const f_string_static_t buffer, const f_string_range_t range, const bool negative, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_hexidecimal_signed_ - -/** - * Convert a series of positive hexidecimal number characters into an f_number_unsigned_t. - * - * 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 buffer - * The string to convert. - * @param range - * The start/stop range to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the hexidecimal string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-hexidecimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_ - extern f_status_t fl_conversion_dynamic_partial_to_hexidecimal_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_ - -/** - * Convert a series of positive or negative octal number characters into an f_number_signed_t. - * - * 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 buffer - * The string to convert. - * @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. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the octal string was converted to an signed long. - * F_data_not if string starts with a null (length is 0). * - * F_number (with error bit) if no conversion was made due to non-octal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. + * @see strtoll() */ -#ifndef _di_fl_conversion_dynamic_partial_to_octal_signed_ - extern f_status_t fl_conversion_dynamic_partial_to_octal_signed(const f_string_static_t buffer, const f_string_range_t range, const bool negative, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_octal_signed_ +#ifndef _di_fl_conversion_dynamic_partial_to_signed_detect_ + extern f_status_t fl_conversion_dynamic_partial_to_signed_detect(const fl_conversion_data_t data, const f_string_static_t buffer, const f_string_range_t range, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_signed_detect_ /** - * Convert a series of positive octal number characters into an f_number_unsigned_t. + * Convert a series of number characters into a f_number_unsigned_t. * * 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 data + * Conversion data for specifying things such as treating this as a negative number. * @param buffer * The string to convert. * @param range @@ -308,61 +126,18 @@ extern "C" { * This value is only changed on success. * * @return - * F_none if the octal string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-octal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_partial_to_octal_unsigned_ - extern f_status_t fl_conversion_dynamic_partial_to_octal_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_octal_unsigned_ - -/** - * Convert a series of positive or negative number characters into an f_number_signed_t. - * - * 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 buffer - * The string to convert. - * @param range - * The start/stop range to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none on success. + * F_none if the binary string was converted to an unsigned long. * F_data_not if string starts with a null (length is 0). * - * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found. - * F_number (with error bit) if parameter is not a number. + * F_base_not (with error bit) if no supported or valid base unit is provided. + * F_number (with error bit) if no conversion was made due to non-binary values being found. * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. - * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. - * - * @see strtoll() */ -#ifndef _di_fl_conversion_dynamic_partial_to_number_signed_ - extern f_status_t fl_conversion_dynamic_partial_to_number_signed(const f_string_static_t buffer, const f_string_range_t range, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_number_signed_ +#ifndef _di_fl_conversion_dynamic_partial_to_unsigned_ + extern f_status_t fl_conversion_dynamic_partial_to_unsigned(const fl_conversion_data_t data, const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_unsigned_ /** * Convert a series of positive number characters into an f_number_unsigned_t. @@ -384,6 +159,9 @@ extern "C" { * In particular, octals are specified here with '0b' prefix or '0B' prefix instead of the ridiculous '0' prefix. * Negative values are reported as such instead of being converted into the unsigned equivalent. * + * @param data + * Conversion data for specifying things such as treating this as a negative number. + * This auto-detects the base and negative, ignoring the base number and negative flag. * @param buffer * The string to convert. * @param range @@ -396,6 +174,7 @@ extern "C" { * F_none on success. * F_data_not if string starts with a null (length is 0). * + * F_base_not (with error bit) if no supported or valid base unit is provided. * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found. * F_number (with error bit) if parameter is not a number. * F_number_decimal (with error bit) if number has a decimal digit. @@ -406,45 +185,19 @@ extern "C" { * * @see strtoull() */ -#ifndef _di_fl_conversion_dynamic_partial_to_number_unsigned_ - extern f_status_t fl_conversion_dynamic_partial_to_number_unsigned(const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_partial_to_number_unsigned_ -/** - * Convert a series of positive or negative binary number characters into a f_number_signed_t. - * - * This will stop at one of the following: a non-digit. - * This will ignore NULL values. - * This will not process signed statuses (+/-). - * - * @param buffer - * The string to convert. - * @param negative - * Set to 0 to treat string as a positive number, 1 for as a negative number. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the binary string was converted to an signed long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-binary values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_number_underflow (with error bit) on integer underflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_to_binary_signed_ - extern f_status_t fl_conversion_dynamic_to_binary_signed(const f_string_static_t buffer, const bool negative, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_to_binary_signed_ +#ifndef _di_fl_conversion_dynamic_partial_to_unsigned_detect_ + extern f_status_t fl_conversion_dynamic_partial_to_unsigned_detect(const fl_conversion_data_t data, const f_string_static_t buffer, const f_string_range_t range, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_partial_to_unsigned_detect_ /** - * Convert a series of positive binary number characters into a f_number_unsigned_t. + * Convert a series of number characters into a f_number_signed_t. * * This will stop at one of the following: a non-digit. * This will ignore NULL values. * This will not process signed statuses (+/-). * + * @param data + * Conversion data for specifying things such as treating this as a negative number. * @param buffer * The string to convert. * @param number @@ -452,218 +205,75 @@ extern "C" { * This value is only changed on success. * * @return - * F_none if the binary string was converted to an unsigned long. + * 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_base_not (with error bit) if no supported or valid base unit is provided. * F_number (with error bit) if no conversion was made due to non-binary values being found. * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_to_binary_unsigned_ - extern f_status_t fl_conversion_dynamic_to_binary_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_to_binary_unsigned_ - -/** - * Convert a series of positive or negative decimal number characters into an f_number_signed_t. - * - * This will stop at one of the following: a non-digit. - * This will ignore NULL values. - * This will not process signed statuses (+/-). - * - * @param buffer - * The string to convert. - * @param negative - * Set to 0 to treat string as a positive number, 1 for as a negative number. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the decimal string was converted to an signed long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-decimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_conversion_dynamic_to_decimal_signed_ - extern f_status_t fl_conversion_dynamic_to_decimal_signed(const f_string_static_t buffer, const bool negative, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_to_decimal_signed_ +#ifndef _di_fl_conversion_dynamic_to_signed_ + extern f_status_t fl_conversion_dynamic_to_signed(const fl_conversion_data_t data, const f_string_static_t buffer, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_to_signed_ /** - * Convert a series of positive decimal number characters into an f_number_unsigned_t. - * - * This will stop at one of the following: a non-digit. - * This will ignore NULL values. - * This will not process signed statuses (+/-). - * - * @param buffer - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the decimal string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-decimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_to_decimal_unsigned_ - extern f_status_t fl_conversion_dynamic_to_decimal_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_to_decimal_unsigned_ - -/** - * Convert a series of positive or negative duodecimal number characters into an f_number_signed_t. - * - * This will stop at one of the following: a non-digit. - * This will ignore NULL values. - * This will not process signed statuses (+/-). - * - * @param buffer - * The string to convert. - * @param negative - * Set to 0 to treat string as a positive number, 1 for as a negative number. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the duodecimal string was converted to an signed long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-duodecimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_number_underflow (with error bit) on integer underflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_to_duodecimal_signed_ - extern f_status_t fl_conversion_dynamic_to_duodecimal_signed(const f_string_static_t buffer, const bool negative, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_to_duodecimal_signed_ - -/** - * Convert a series of positive duodecimal number characters into an f_number_unsigned_t. + * Convert a series of positive or negative number characters into an f_number_signed_t. * * This will stop at one of the following: a non-digit. * This will ignore NULL values. - * This will not process signed statuses (+/-). - * - * @param buffer - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the duodecimal string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). + * 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. * - * F_number (with error bit) if no conversion was made due to non-duodecimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_to_duodecimal_unsigned_ - extern f_status_t fl_conversion_dynamic_to_duodecimal_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_to_duodecimal_unsigned_ - -/** - * Convert a series of positive or negative hexidecimal number characters into an f_number_signed_t. + * Leading 0's and whitespace are ignored. + * Whitespace after the first digit is considered invalid. * - * This will stop at one of the following: a non-digit. - * This will ignore NULL values. - * This will not process signed statuses (+/-). + * 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 data + * Conversion data for specifying things such as treating this as a negative number. + * This auto-detects the base and negative, ignoring the base number and negative flag. * @param buffer * The string to convert. - * @param negative - * Set to 0 to treat string as a positive number, 1 for as a negative number. * @param number * This will store the value of the converted string. * This value is only changed on success. * * @return - * F_none if the hexidecimal string was converted to an signed long. + * F_none on success. * 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_base_not (with error bit) if no supported or valid base unit is provided. + * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found. + * F_number (with error bit) if parameter is not a number. * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_to_hexidecimal_signed_ - extern f_status_t fl_conversion_dynamic_to_hexidecimal_signed(const f_string_static_t buffer, const bool negative, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_to_hexidecimal_signed_ - -/** - * Convert a series of positive hexidecimal number characters into an f_number_unsigned_t. - * - * This will stop at one of the following: a non-digit. - * This will ignore NULL values. - * This will not process signed statuses (+/-). - * - * @param buffer - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the hexidecimal string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-hexidecimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_to_hexidecimal_unsigned_ - extern f_status_t fl_conversion_dynamic_to_hexidecimal_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_to_hexidecimal_unsigned_ - -/** - * Convert a series of positive or negative octal number characters into an f_number_signed_t. - * - * This will stop at one of the following: a non-digit. - * This will ignore NULL values. - * This will not process signed statuses (+/-). - * - * @param buffer - * The string to convert. - * @param negative - * Set to 0 to treat string as a positive number, 1 for as a negative number. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the octal string was converted to an signed long. - * F_data_not if string starts with a null (length is 0). * - * F_number (with error bit) if no conversion was made due to non-octal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. + * @see strtoll() */ -#ifndef _di_fl_conversion_dynamic_to_octal_signed_ - extern f_status_t fl_conversion_dynamic_to_octal_signed(const f_string_static_t buffer, const bool negative, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_to_octal_signed_ +#ifndef _di_fl_conversion_dynamic_to_signed_detect_ + extern f_status_t fl_conversion_dynamic_to_signed_detect(const fl_conversion_data_t data, const f_string_static_t buffer, f_number_signed_t * const number); +#endif // _di_fl_conversion_dynamic_to_signed_detect_ /** - * Convert a series of positive octal number characters into an f_number_unsigned_t. + * Convert a series of number characters into a f_number_unsigned_t. * * This will stop at one of the following: a non-digit. * This will ignore NULL values. * This will not process signed statuses (+/-). * + * @param data + * Conversion data for specifying things such as treating this as a negative number. * @param buffer * The string to convert. * @param number @@ -671,59 +281,18 @@ extern "C" { * This value is only changed on success. * * @return - * F_none if the octal string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-octal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fl_conversion_dynamic_to_octal_unsigned_ - extern f_status_t fl_conversion_dynamic_to_octal_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_to_octal_unsigned_ - -/** - * Convert a series of positive or negative number characters into an f_number_signed_t. - * - * This will stop at one of the following: a non-digit. - * This will ignore NULL values. - * This will process signed statuses (+/-). - * This will detect based types as follows: - * - hexidecimals begin with either '0x' or '0X'. - * - duodecimals begin with either '0d' or '0D'. - * - octals begin with either '0o' or '0O'. - * - binaries begin with either '0b' or '0B'. - * - decimal is used for all other cases. - * - * Leading 0's and whitespace are ignored. - * Whitespace after the first digit is considered invalid. - * - * This function is similar to strtoll(), but the behavior of error handling and special bases are different. - * In particular, octals are specified here with '0b' prefix or '0B' prefix instead of the ridiculous '0' prefix. - * - * @param buffer - * The string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none on success. + * F_none if the binary string was converted to an unsigned long. * F_data_not if string starts with a null (length is 0). * - * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found. - * F_number (with error bit) if parameter is not a number. + * F_base_not (with error bit) if no supported or valid base unit is provided. + * F_number (with error bit) if no conversion was made due to non-binary values being found. * F_number_decimal (with error bit) if number has a decimal digit. * F_number_overflow (with error bit) on integer overflow. - * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. - * - * @see strtoll() */ -#ifndef _di_fl_conversion_dynamic_to_number_signed_ - extern f_status_t fl_conversion_dynamic_to_number_signed(const f_string_static_t buffer, f_number_signed_t * const number); -#endif // _di_fl_conversion_dynamic_to_number_signed_ +#ifndef _di_fl_conversion_dynamic_to_unsigned_ + extern f_status_t fl_conversion_dynamic_to_unsigned(const fl_conversion_data_t data, const f_string_static_t buffer, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_to_unsigned_ /** * Convert a series of positive number characters into an f_number_unsigned_t. @@ -745,6 +314,9 @@ extern "C" { * In particular, octals are specified here with '0b' prefix or '0B' prefix instead of the ridiculous '0' prefix. * Negative values are reported as such instead of being converted into the unsigned equivalent. * + * @param data + * Conversion data for specifying things such as treating this as a negative number. + * This auto-detects the base and negative, ignoring the base number and negative flag. * @param buffer * The string to convert. * @param number @@ -755,6 +327,7 @@ extern "C" { * F_none on success. * F_data_not if string starts with a null (length is 0). * + * F_base_not (with error bit) if no supported or valid base unit is provided. * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found. * F_number (with error bit) if parameter is not a number. * F_number_decimal (with error bit) if number has a decimal digit. @@ -765,9 +338,9 @@ extern "C" { * * @see strtoull() */ -#ifndef _di_fl_conversion_dynamic_to_number_unsigned_ - extern f_status_t fl_conversion_dynamic_to_number_unsigned(const f_string_static_t buffer, f_number_unsigned_t * const number); -#endif // _di_fl_conversion_dynamic_to_number_unsigned_ +#ifndef _di_fl_conversion_dynamic_to_unsigned_detect_ + extern f_status_t fl_conversion_dynamic_to_unsigned_detect(const fl_conversion_data_t data, const f_string_static_t buffer, f_number_unsigned_t * const number); +#endif // _di_fl_conversion_dynamic_to_unsigned_detect_ #ifdef __cplusplus } // extern "C" diff --git a/level_1/fl_conversion/c/conversion/common.c b/level_1/fl_conversion/c/conversion/common.c new file mode 100644 index 0000000..4da2963 --- /dev/null +++ b/level_1/fl_conversion/c/conversion/common.c @@ -0,0 +1,19 @@ +#include "../conversion.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fl_conversion_data_t_defines_ + const fl_conversion_data_t fl_conversion_data_base_2_c = macro_fl_conversion_data_t_initialize(2, 0); + const fl_conversion_data_t fl_conversion_data_base_8_c = macro_fl_conversion_data_t_initialize(8, 0); + const fl_conversion_data_t fl_conversion_data_base_10_c = macro_fl_conversion_data_t_initialize(10, 0); + const fl_conversion_data_t fl_conversion_data_base_12_c = macro_fl_conversion_data_t_initialize(12, 0); + const fl_conversion_data_t fl_conversion_data_base_16_c = macro_fl_conversion_data_t_initialize(16, 0); + const fl_conversion_data_t fl_conversion_data_endian_big_c = macro_fl_conversion_data_t_initialize(10, FL_conversion_data_flag_endian_big_d); + const fl_conversion_data_t fl_conversion_data_endian_little_c = macro_fl_conversion_data_t_initialize(10, FL_conversion_data_flag_endian_little_d); +#endif // _di_fl_conversion_data_t_defines_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_conversion/c/conversion/common.h b/level_1/fl_conversion/c/conversion/common.h new file mode 100644 index 0000000..26ed488 --- /dev/null +++ b/level_1/fl_conversion/c/conversion/common.h @@ -0,0 +1,82 @@ +/** + * FLL - Level 1 + * + * Project: Conversion + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Defines common data to be used for/by project conversion. + * + * This is auto-included by conversion.h and should not need to be explicitly included. + */ +#ifndef _FL_conversion_common_h +#define _FL_conversion_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Provide a structure for customizing conversion settings for a conversion function to use. + * + * base: The base unit the number is to be represented as, only the numbers 2 through 16 are supported as a base. + * flag: Store flags from fl_conversion_data_flag_*. + */ +#ifndef _di_fl_conversion_data_t_ + typedef struct { + uint8_t base; + uint16_t flag; + } fl_conversion_data_t; + + #define fl_conversion_data_t_initialize { 10, 0 } + + #define macro_fl_conversion_data_t_initialize(base, flag) { base, flag } + + #define macro_fl_conversion_data_t_clear(data) \ + data.base = 0; \ + data.flag = 0; +#endif // _di_fl_conversion_data_t_ + +/** + * The defines for conversion data. + * + * fl_conversion_data_*: + * - base_2: Basic base-2 conversion structure. + * - base_8: Basic base-8 conversion structure. + * - base_10: Basic base-10 conversion structure. + * - base_12: Basic base-12 conversion structure. + * - base_16: Basic base-16 conversion structure. + * - endian_big: Basic base-10 conversion with big-endian flag. + * - endian_little: Basic base-10 conversion with little-endian flag. + * - shift_left: Basic base-10 conversion with shift left flag. + */ +#ifndef _di_fl_conversion_data_t_defines_ + extern const fl_conversion_data_t fl_conversion_data_base_2_c; + extern const fl_conversion_data_t fl_conversion_data_base_8_c; + extern const fl_conversion_data_t fl_conversion_data_base_10_c; + extern const fl_conversion_data_t fl_conversion_data_base_12_c; + extern const fl_conversion_data_t fl_conversion_data_base_16_c; + extern const fl_conversion_data_t fl_conversion_data_endian_big_c; + extern const fl_conversion_data_t fl_conversion_data_endian_little_c; + extern const fl_conversion_data_t fl_conversion_data_shift_left_c; +#endif // _di_fl_conversion_data_t_defines_ + +/** + * Define flags used by fl_conversion_data_t. + * + * fl_conversion_data_flag_*: + * - endian_big: Use big-endian rather than host byte order or little-endian when converting. + * - endian_little: Use little-endian rather than host byte order or big-endian when converting. + * - negative: Treat the string as a negative number. + */ +#ifndef _di_fl_conversion_data_flag_ + #define FL_conversion_data_flag_endian_big_d 0x1 + #define FL_conversion_data_flag_endian_little_d 0x2 + #define FL_conversion_data_flag_negative_d 0x4 +#endif // _di_fl_conversion_data_flag_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _FL_conversion_common_h diff --git a/level_1/fl_conversion/c/private-conversion.c b/level_1/fl_conversion/c/private-conversion.c index 4a3fad1..2e51f6b 100644 --- a/level_1/fl_conversion/c/private-conversion.c +++ b/level_1/fl_conversion/c/private-conversion.c @@ -5,8 +5,8 @@ extern "C" { #endif -#if !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - f_status_t private_fl_conversion_dynamic_to_binary_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) { +#if !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_signed_detect_) + f_status_t private_fl_conversion_dynamic_to_binary_signed(const uint16_t flag, const f_string_t string, const f_array_length_t length, f_number_signed_t * const number) { uint8_t digits = 0; uint8_t digit = 0; @@ -14,7 +14,7 @@ extern "C" { for (f_array_length_t i = 0; i < length; ++i) { - if (string[i] == 0x2e) { + if (string[i] == f_string_ascii_period_s.string[0]) { return F_status_set_error(F_number_decimal); } @@ -22,12 +22,25 @@ extern "C" { if (digits) { ++digits; - if (negative) { + if (flag & FL_conversion_data_flag_negative_d) { if (digits > F_conversion_digits_binary_signed_d) { return F_status_set_error(F_number_underflow); } - converted <<= 1; + if (flag & FL_conversion_data_flag_endian_big_d) { + converted >>= 1; + } + else if (flag & FL_conversion_data_flag_endian_little_d) { + converted <<= 1; + } + else { + #ifdef _is_F_endian_big + converted >>= 1; + #else + converted <<= 1; + #endif // _is_F_endian_big + } + converted -= digit; } else { @@ -35,14 +48,27 @@ extern "C" { return F_status_set_error(F_number_overflow); } - converted <<= 1; + if (flag & FL_conversion_data_flag_endian_big_d) { + converted >>= 1; + } + else if (flag & FL_conversion_data_flag_endian_little_d) { + converted <<= 1; + } + else { + #ifdef _is_F_endian_big + converted >>= 1; + #else + converted <<= 1; + #endif // _is_F_endian_big + } + converted += digit; } } else if (digit) { digits = 1; - if (negative) { + if (flag & FL_conversion_data_flag_negative_d) { converted = (f_number_unsigned_t) (0 - digit); } else { @@ -59,10 +85,10 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) +#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_signed_detect_) -#if !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - f_status_t private_fl_conversion_dynamic_to_binary_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { +#if !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) + f_status_t private_fl_conversion_dynamic_to_binary_unsigned(const uint16_t flag, const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { uint8_t digits = 0; uint8_t digit = 0; @@ -70,7 +96,7 @@ extern "C" { for (f_array_length_t i = 0; i < length; ++i) { - if (string[i] == 0x2e) { + if (string[i] == f_string_ascii_period_s.string[0]) { return F_status_set_error(F_number_decimal); } @@ -82,111 +108,20 @@ extern "C" { return F_status_set_error(F_number_overflow); } - converted <<= 1; - converted += digit; - } - else if (digit) { - digits = 1; - converted = (f_number_unsigned_t) digit; - } - } - else if (string[i]) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - - return F_none; - } -#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - -#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - f_status_t private_fl_conversion_dynamic_to_decimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) { - - uint8_t digits = 0; - uint8_t digit = 0; - f_number_unsigned_t converted = 0; - - for (f_array_length_t i = 0; i < length; ++i) { - - if (string[i] == 0x2e) { - return F_status_set_error(F_number_decimal); - } - - if (f_conversion_character_to_decimal(string[i], &digit) == F_none) { - - if (digits) { - ++digits; - - if (negative) { - if (digits > F_conversion_digits_decimal_signed_d) { - if ((converted * 10) - digit < F_number_t_size_negative_d || (converted * 10) - digit > converted) { - return F_status_set_error(F_number_underflow); - } - } - - converted *= 10; - converted -= digit; - } - else { - if (digits > F_conversion_digits_decimal_signed_d) { - if ((converted * 10) + digit > F_number_t_size_positive_d || (converted * 10) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted *= 10; - converted += digit; + if (flag & FL_conversion_data_flag_endian_big_d) { + converted >>= 1; } - } - else if (digit) { - digits = 1; - - if (negative) { - converted = (f_number_unsigned_t) (0 - digit); + else if (flag & FL_conversion_data_flag_endian_little_d) { + converted <<= 1; } else { - converted = (f_number_unsigned_t) digit; - } - } - } - else if (string[i]) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - - return F_none; - } -#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - -#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - f_status_t private_fl_conversion_dynamic_to_decimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { - - uint8_t digits = 0; - uint8_t digit = 0; - f_number_unsigned_t converted = 0; - - for (f_array_length_t i = 0; i < length; ++i) { - - if (string[i] == 0x2e) { - return F_status_set_error(F_number_decimal); - } - - if (f_conversion_character_to_decimal(string[i], &digit) == F_none) { - - if (digits) { - ++digits; - - if (digits > F_conversion_digits_decimal_unsigned_d) { - if ((converted * 10) + digit > F_number_t_size_unsigned_d || (converted * 10) + digit < converted) { - return F_status_set_error(F_number_overflow); - } + #ifdef _is_F_endian_big + converted >>= 1; + #else + converted <<= 1; + #endif // _is_F_endian_big } - converted *= 10; converted += digit; } else if (digit) { @@ -203,51 +138,65 @@ extern "C" { return F_none; } -#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) +#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) -#if !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - f_status_t private_fl_conversion_dynamic_to_duodecimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) { +#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_signed_detect_) + f_status_t private_fl_conversion_dynamic_to_base_signed(const fl_conversion_data_t data, const f_string_t string, const f_array_length_t length, f_number_signed_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; + f_status_t (*character_to_digit)(const f_char_t character, uint8_t * const number) = 0; + + if (data.base == 10) { + character_to_digit = f_conversion_character_to_decimal; + } + else if (data.base == 16) { + character_to_digit = f_conversion_character_to_hexidecimal; + } + else if (data.base == 12) { + character_to_digit = f_conversion_character_to_duodecimal; + } + else if (data.base == 8) { + character_to_digit = f_conversion_character_to_octal; + } + for (f_array_length_t i = 0; i < length; ++i) { - if (string[i] == 0x2e) { + if (string[i] == f_string_ascii_period_s.string[0]) { return F_status_set_error(F_number_decimal); } - if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) { - + if (character_to_digit(string[i], &digit) == F_none) { if (digits) { ++digits; - if (negative) { - if (digits > F_conversion_digits_duodecimal_signed_d) { - if ((converted * 12) - digit < F_number_t_size_negative_d || (converted * 12) - digit > converted) { + if (data.flag & FL_conversion_data_flag_negative_d) { + if (digits > F_conversion_digits_decimal_signed_d) { + if ((converted * data.base) - digit < F_number_t_size_negative_d || (converted * data.base) - digit > converted) { return F_status_set_error(F_number_underflow); } } - converted *= 12; + converted *= data.base; converted -= digit; } else { - if (digits > F_conversion_digits_duodecimal_signed_d) { - if ((converted * 12) + digit > F_number_t_size_positive_d || (converted * 12) + digit < converted) { + if (digits > F_conversion_digits_decimal_signed_d) { + if ((converted * data.base) + digit > F_number_t_size_positive_d || (converted * data.base) + digit < converted) { return F_status_set_error(F_number_overflow); } } - converted *= 12; + converted *= data.base; converted += digit; } } else if (digit) { digits = 1; - if (negative) { + if (data.flag & FL_conversion_data_flag_negative_d) { converted = (f_number_unsigned_t) (0 - digit); } else { @@ -260,141 +209,72 @@ extern "C" { } } // for - *number = converted; + // Ensure bytes are in correct order by reversing bytes if requested byte order is different than the host byte order. + #ifdef _is_F_endian_big + if (data.flag & FL_conversion_data_flag_endian_little_d) { + *number = macro_f_utf_char_t_from_char_1_le(macro_f_utf_char_t_to_char_1_be(converted)) + | macro_f_utf_char_t_from_char_2_le(macro_f_utf_char_t_to_char_2_be(converted)) + | macro_f_utf_char_t_from_char_3_le(macro_f_utf_char_t_to_char_3_be(converted)) + | macro_f_utf_char_t_from_char_4_le(macro_f_utf_char_t_to_char_4_be(converted)); - return F_none; - } -#endif // !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - -#if !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - f_status_t private_fl_conversion_dynamic_to_duodecimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { - - uint8_t digits = 0; - uint8_t digit = 0; - f_number_unsigned_t converted = 0; - - for (f_array_length_t i = 0; i < length; ++i) { - - if (string[i] == 0x2e) { - return F_status_set_error(F_number_decimal); + return F_none; } + #else + if (data.flag & FL_conversion_data_flag_endian_big_d) { + *number = macro_f_utf_char_t_from_char_1_be(macro_f_utf_char_t_to_char_1_le(converted)) + | macro_f_utf_char_t_from_char_2_be(macro_f_utf_char_t_to_char_2_le(converted)) + | macro_f_utf_char_t_from_char_3_be(macro_f_utf_char_t_to_char_3_le(converted)) + | macro_f_utf_char_t_from_char_4_be(macro_f_utf_char_t_to_char_4_le(converted)); - if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) { - - if (digits) { - ++digits; - - if (digits > F_conversion_digits_duodecimal_unsigned_d) { - if ((converted * 12) + digit > F_number_t_size_unsigned_d || (converted * 12) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted *= 12; - converted += digit; - } - else if (digit) { - digits = 1; - converted = (f_number_unsigned_t) digit; - } - } - else if (string[i]) { - return F_status_set_error(F_number); + return F_none; } - } // for + #endif // _is_F_endian_big *number = converted; return F_none; } -#endif // !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) +#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_signed_detect_) -#if !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - f_status_t private_fl_conversion_dynamic_to_hexidecimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) { +#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) + f_status_t private_fl_conversion_dynamic_to_base_unsigned(const fl_conversion_data_t data, const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { uint8_t digits = 0; uint8_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = 0; i < length; ++i) { - - if (string[i] == 0x2e) { - return F_status_set_error(F_number_decimal); - } - - if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) { - - if (digits) { - ++digits; - - if (negative) { - if (digits > F_conversion_digits_hexidecimal_signed_d) { - if ((converted << 4) - digit < F_number_t_size_negative_d || (converted << 4) - digit > converted) { - return F_status_set_error(F_number_underflow); - } - } - - converted <<= 4; - converted -= digit; - } - else { - if (digits > F_conversion_digits_hexidecimal_signed_d) { - if ((converted << 4) + digit > F_number_t_size_positive_d || (converted << 4) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted <<= 4; - converted += digit; - } - } - else if (digit) { - digits = 1; - - if (negative) { - converted = (f_number_unsigned_t) (0 - digit); - } - else { - converted = (f_number_unsigned_t) digit; - } - } - } - else if (string[i]) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - - return F_none; - } -#endif // !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) + f_status_t (*character_to_digit)(const f_char_t character, uint8_t * const number) = 0; -#if !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - f_status_t private_fl_conversion_dynamic_to_hexidecimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { - - uint8_t digits = 0; - uint8_t digit = 0; - f_number_unsigned_t converted = 0; + if (data.base == 10) { + character_to_digit = f_conversion_character_to_decimal; + } + else if (data.base == 16) { + character_to_digit = f_conversion_character_to_hexidecimal; + } + else if (data.base == 12) { + character_to_digit = f_conversion_character_to_duodecimal; + } + else if (data.base == 8) { + character_to_digit = f_conversion_character_to_octal; + } for (f_array_length_t i = 0; i < length; ++i) { - if (string[i] == 0x2e) { + if (string[i] == f_string_ascii_period_s.string[0]) { return F_status_set_error(F_number_decimal); } - if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) { - + if (character_to_digit(string[i], &digit) == F_none) { if (digits) { ++digits; - if (digits > F_conversion_digits_hexidecimal_unsigned_d) { - if ((converted << 4) + digit > F_number_t_size_unsigned_d || (converted << 4) + digit < converted) { + if (digits > F_conversion_digits_decimal_unsigned_d) { + if ((converted * data.base) + digit > F_number_t_size_unsigned_d || (converted * data.base) + digit < converted) { return F_status_set_error(F_number_overflow); } } - converted <<= 4; + converted *= data.base; converted += digit; } else if (digit) { @@ -407,118 +287,35 @@ extern "C" { } } // for - *number = converted; - - return F_none; - } -#endif // !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - -#if !defined(_di_fl_conversion_dynamic_partial_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - f_status_t private_fl_conversion_dynamic_to_octal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) { - - uint8_t digits = 0; - uint8_t digit = 0; - f_number_unsigned_t converted = 0; - - for (f_array_length_t i = 0; i < length; ++i) { - - if (string[i] == 0x2e) { - return F_status_set_error(F_number_decimal); - } - - if (f_conversion_character_to_octal(string[i], &digit) == F_none) { - - if (digits) { - ++digits; - - if (negative) { - if (digits > F_conversion_digits_octal_signed_d) { - if ((converted << 3) - digit < F_number_t_size_negative_d || (converted << 3) - digit > converted) { - return F_status_set_error(F_number_underflow); - } - } - - converted <<= 3; - converted -= digit; - } - else { - if (digits > F_conversion_digits_octal_signed_d) { - if ((converted << 3) + digit > F_number_t_size_positive_d || (converted << 3) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted <<= 3; - converted += digit; - } - } - else if (digit) { - digits = 1; - - if (negative) { - converted = (f_number_unsigned_t) (0 - digit); - } - else { - converted = (f_number_unsigned_t) digit; - } - } - } - else if (string[i]) { - return F_status_set_error(F_number); - } - } // for - - *number = converted; - - return F_none; - } -#endif // !defined(_di_fl_conversion_dynamic_partial_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - -#if !defined(_di_fl_conversion_dynamic_partial_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - f_status_t private_fl_conversion_dynamic_to_octal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { - - uint8_t digits = 0; - uint8_t digit = 0; - f_number_unsigned_t converted = 0; - - for (f_array_length_t i = 0; i < length; ++i) { + // Ensure bytes are in correct order by reversing bytes if requested byte order is different than the host byte order. + #ifdef _is_F_endian_big + if (data.flag & FL_conversion_data_flag_endian_little_d) { + *number = macro_f_utf_char_t_from_char_1_le(macro_f_utf_char_t_to_char_1_be(converted)) + | macro_f_utf_char_t_from_char_2_le(macro_f_utf_char_t_to_char_2_be(converted)) + | macro_f_utf_char_t_from_char_3_le(macro_f_utf_char_t_to_char_3_be(converted)) + | macro_f_utf_char_t_from_char_4_le(macro_f_utf_char_t_to_char_4_be(converted)); - if (string[i] == 0x2e) { - return F_status_set_error(F_number_decimal); + return F_none; } + #else + if (data.flag & FL_conversion_data_flag_endian_big_d) { + *number = macro_f_utf_char_t_from_char_1_be(macro_f_utf_char_t_to_char_1_le(converted)) + | macro_f_utf_char_t_from_char_2_be(macro_f_utf_char_t_to_char_2_le(converted)) + | macro_f_utf_char_t_from_char_3_be(macro_f_utf_char_t_to_char_3_le(converted)) + | macro_f_utf_char_t_from_char_4_be(macro_f_utf_char_t_to_char_4_le(converted)); - if (f_conversion_character_to_octal(string[i], &digit) == F_none) { - - if (digits) { - ++digits; - - if (digits > F_conversion_digits_octal_unsigned_d) { - if ((converted << 3) + digit > F_number_t_size_unsigned_d || (converted << 3) + digit < converted) { - return F_status_set_error(F_number_overflow); - } - } - - converted <<= 3; - converted += digit; - } - else if (digit) { - digits = 1; - converted = (f_number_unsigned_t) digit; - } - } - else if (string[i]) { - return F_status_set_error(F_number); + return F_none; } - } // for + #endif // _is_F_endian_big *number = converted; return F_none; } -#endif // !defined(_di_fl_conversion_dynamic_partial_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) +#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) -#if !defined(_di_fl_conversion_dynamic_to_number_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) - f_status_t private_fl_conversion_dynamic_to_number_signed(const f_string_t string, const f_array_length_t length, f_number_signed_t * const number) { +#if !defined(_di_fl_conversion_dynamic_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) + f_status_t private_fl_conversion_dynamic_to_signed_detect(const uint16_t flag, const f_string_t string, const f_array_length_t length, f_number_signed_t * const number) { uint8_t width = 0; f_array_length_t width_max = 0; @@ -567,38 +364,44 @@ extern "C" { return F_status_set_error(F_number); } - if (string[i] == 0x30) { + if (string[i] == f_string_ascii_0_s.string[0]) { // Skip past all NULLs. for (j = i + 1; j < length; ++j) { if (string[j]) break; } // for - // Immediate next value must be either a number, 'x', 'X', 'd', 'D', 'o', 'O', 'b', or 'B'. + // Immediate next value must be either a number, 't', 'T', 'x', 'X', 'd', 'D', 'o', 'O', 'b', or 'B'. if (j >= length) { *number = 0; + return F_none; } - else if (string[j] > 0x2f && string[j] < 0x3a) { + + if (string[j] > f_string_ascii_slash_backward_s.string[0] && string[j] < f_string_ascii_colon_s.string[0]) { mode = 10; } - else if (string[j] == 0x78 || string[j] == 0x58) { + else if (string[j] == f_string_ascii_t_s.string[0] || string[j] == f_string_ascii_t_s.string[0]) { + mode = 10; + offset += 2; + } + else if (string[j] == f_string_ascii_x_s.string[0] || string[j] == f_string_ascii_X_s.string[0]) { mode = 16; offset += 2; } - else if (string[j] == 0x44 || string[j] == 0x64) { + else if (string[j] == f_string_ascii_d_s.string[0] || string[j] == f_string_ascii_D_s.string[0]) { mode = 12; offset += 2; } - else if (string[j] == 0x6f || string[j] == 0x4f) { + else if (string[j] == f_string_ascii_o_s.string[0] || string[j] == f_string_ascii_O_s.string[0]) { mode = 8; offset += 2; } - else if (string[j] == 0x62 || string[j] == 0x42) { + else if (string[j] == f_string_ascii_b_s.string[0] || string[j] == f_string_ascii_B_s.string[0]) { mode = 2; offset += 2; } - else if (string[j] == 0x2e) { + else if (string[j] == f_string_ascii_period_s.string[0]) { return F_status_set_error(F_number_decimal); } else { @@ -609,7 +412,7 @@ extern "C" { } // Plus sign is only allowed as the first non-whitespace character. - if (string[i] == 0x2b) { + if (string[i] == f_string_ascii_plus_s.string[0]) { if (!mode && !vector) { vector = 1; ++offset; @@ -620,7 +423,7 @@ extern "C" { } // Negative sign is not allowed. - if (string[i] == 0x2d) { + if (string[i] == f_string_ascii_minus_s.string[0]) { if (!mode && !vector) { vector = -1; ++offset; @@ -632,6 +435,7 @@ extern "C" { if (f_conversion_character_is_decimal(string[i]) == F_true) { mode = 10; + break; } @@ -646,28 +450,29 @@ extern "C" { return F_status_set_error(F_number); } - if (mode == 10) { - return private_fl_conversion_dynamic_to_decimal_signed(string + offset, length - offset, vector == -1, number); - } + fl_conversion_data_t data = macro_fl_conversion_data_t_initialize(mode, flag); - if (mode == 16) { - return private_fl_conversion_dynamic_to_hexidecimal_signed(string + offset, length - offset, vector == -1, number); + if (vector == -1) { + data.flag |= FL_conversion_data_flag_negative_d; + } + else if (data.flag & FL_conversion_data_flag_negative_d) { + data.flag -= FL_conversion_data_flag_negative_d; } - if (mode == 12) { - return private_fl_conversion_dynamic_to_duodecimal_signed(string + offset, length - offset, vector == -1, number); + if (mode == 10 || mode == 16 || mode == 12 || mode == 8) { + return private_fl_conversion_dynamic_to_base_signed(data, string + offset, length - offset, number); } - if (mode == 8) { - return private_fl_conversion_dynamic_to_octal_signed(string + offset, length - offset, vector == -1, number); + if (mode == 2) { + return private_fl_conversion_dynamic_to_binary_signed(data.flag, string + offset, length - offset, number); } - return private_fl_conversion_dynamic_to_binary_signed(string + offset, length - offset, vector == -1, number); + return F_status_set_error(F_base_not); } -#endif // !defined(_di_fl_conversion_dynamic_to_number_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) +#endif // !defined(_di_fl_conversion_dynamic_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) -#if !defined(_di_fl_conversion_dynamic_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) - f_status_t private_fl_conversion_dynamic_to_number_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { +#if !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) + f_status_t private_fl_conversion_dynamic_to_unsigned_detect(const uint16_t flag, const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) { uint8_t width = 0; f_array_length_t width_max = 0; @@ -716,39 +521,43 @@ extern "C" { return F_status_set_error(F_number); } - if (string[i] == 0x30) { + if (string[i] == f_string_ascii_0_s.string[0]) { // Skip past all NULLs. for (j = i + 1; j < length; ++j) { if (string[j]) break; } // for - // Immediate next value must be either a number, 'x', 'X', 'd', 'D', 'o', 'O', 'b', or 'B'. + // Immediate next value must be either a number, 't', 'T', 'x', 'X', 'd', 'D', 'o', 'O', 'b', or 'B'. if (j >= length) { *number = 0; return F_none; } - else if (string[j] > 0x2f && string[j] < 0x3a) { + else if (string[j] > f_string_ascii_slash_backward_s.string[0] && string[j] < f_string_ascii_colon_s.string[0]) { + mode = 10; + } + else if (string[j] == f_string_ascii_t_s.string[0] || string[j] == f_string_ascii_t_s.string[0]) { mode = 10; + offset += 2; } - else if (string[j] == 0x78 || string[j] == 0x58) { + else if (string[j] == f_string_ascii_x_s.string[0] || string[j] == f_string_ascii_X_s.string[0]) { mode = 16; offset += 2; } - else if (string[j] == 0x44 || string[j] == 0x64) { + else if (string[j] == f_string_ascii_d_s.string[0] || string[j] == f_string_ascii_D_s.string[0]) { mode = 12; offset += 2; } - else if (string[j] == 0x6f || string[j] == 0x4f) { + else if (string[j] == f_string_ascii_o_s.string[0] || string[j] == f_string_ascii_O_s.string[0]) { mode = 8; offset += 2; } - else if (string[j] == 0x62 || string[j] == 0x42) { + else if (string[j] == f_string_ascii_b_s.string[0] || string[j] == f_string_ascii_B_s.string[0]) { mode = 2; offset += 2; } - else if (string[j] == 0x2e) { + else if (string[j] == f_string_ascii_period_s.string[0]) { return F_status_set_error(F_number_decimal); } else { @@ -758,18 +567,19 @@ extern "C" { break; } - if (string[i] == 0x2b) { + if (string[i] == f_string_ascii_plus_s.string[0]) { ++offset; sign_found = 1; } - if (string[i] == 0x2d) { + if (string[i] == f_string_ascii_minus_s.string[0]) { ++offset; sign_found = -1; } if (f_conversion_character_is_decimal(string[i]) == F_true) { mode = 10; + break; } @@ -784,23 +594,23 @@ extern "C" { return F_status_set_error(F_number); } - if (mode == 10) { - status = private_fl_conversion_dynamic_to_decimal_unsigned(string + offset, length - offset, number); - } - else if (mode == 16) { - status = private_fl_conversion_dynamic_to_hexidecimal_unsigned(string + offset, length - offset, number); + fl_conversion_data_t data = macro_fl_conversion_data_t_initialize(mode, flag); + + if (data.flag & FL_conversion_data_flag_negative_d) { + data.flag -= FL_conversion_data_flag_negative_d; } - else if (mode == 12) { - status = private_fl_conversion_dynamic_to_duodecimal_unsigned(string + offset, length - offset, number); + + if (mode == 10 || mode == 16 || mode == 12 || mode == 8) { + status = private_fl_conversion_dynamic_to_base_unsigned(data, string + offset, length - offset, number); } - else if (mode == 8) { - status = private_fl_conversion_dynamic_to_octal_unsigned(string + offset, length - offset, number); + else if (mode == 2) { + status = private_fl_conversion_dynamic_to_binary_unsigned(data.flag, string + offset, length - offset, number); } else { - status = private_fl_conversion_dynamic_to_binary_unsigned(string + offset, length - offset, number); + return F_status_set_error(F_base_not); } - // +/- signs are not allowed. + // The +/- signs are not allowed. if (sign_found) { if (status == F_none) { if (sign_found == -1) { @@ -815,7 +625,7 @@ extern "C" { return status; } -#endif // !defined(_di_fl_conversion_dynamic_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) +#endif // !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) #ifdef __cplusplus } // extern "C" diff --git a/level_1/fl_conversion/c/private-conversion.h b/level_1/fl_conversion/c/private-conversion.h index d9c1b79..1b298a7 100644 --- a/level_1/fl_conversion/c/private-conversion.h +++ b/level_1/fl_conversion/c/private-conversion.h @@ -20,12 +20,12 @@ extern "C" { * * Intended to be shared to each of the different implementation variations. * + * @param flag + * Conversion data flags. * @param string * The string to convert. * @param length * The length of the string to convert. - * @param negative - * Set to 0 to treat string as a positive number, 1 for as a negative number. * @param number * This will store the value of the converted string. * This value is only changed on success. @@ -41,19 +41,21 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * @see fl_conversion_dynamic_partial_to_binary_signed() - * @see fl_conversion_dynamic_partial_to_number_signed() + * @see fl_conversion_dynamic_partial_to_signed_detect() * @see fl_conversion_dynamic_to_binary_signed() - * @see fl_conversion_dynamic_to_number_signed() + * @see fl_conversion_dynamic_to_signed_detect() */ -#if !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - extern f_status_t private_fl_conversion_dynamic_to_binary_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) +#if !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_signed_detect_) + extern f_status_t private_fl_conversion_dynamic_to_binary_signed(const uint16_t flag, const f_string_t string, const f_array_length_t length, f_number_signed_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_to_binary_signed_) || !defined(_di_fl_conversion_dynamic_to_signed_detect_) /** * Private implementation of fl_conversion_dynamic_to_binary_unsigned(). * * Intended to be shared to each of the different implementation variations. * + * @param flag + * Conversion data flags. * @param string * The string to convert. * @param length @@ -72,25 +74,25 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * @see fl_conversion_dynamic_partial_to_binary_unsigned() - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * @see fl_conversion_dynamic_to_binary_unsigned() - * @see fl_conversion_dynamic_to_number_unsigned() + * @see fl_conversion_dynamic_to_unsigned_detect() */ -#if !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - extern f_status_t private_fl_conversion_dynamic_to_binary_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) +#if !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) + extern f_status_t private_fl_conversion_dynamic_to_binary_unsigned(const uint16_t flag, const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_to_binary_unsigned_) || !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) /** - * Private implementation of fl_conversion_dynamic_to_decimal_signed(). + * Private implementation for converting for some given base unit. * * Intended to be shared to each of the different implementation variations. * + * @param data + * Conversion data base unit and flags. * @param string * The string to convert. * @param length * The length of the string to convert. - * @param negative - * Set to 0 to treat string as a positive number, 1 for as a negative number. * @param number * This will store the value of the converted string. * This value is only changed on success. @@ -105,20 +107,22 @@ extern "C" { * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. * - * @see fl_conversion_dynamic_partial_to_decimal_unsigned() - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * @see fl_conversion_dynamic_to_decimal_unsigned() - * @see fl_conversion_dynamic_to_number_unsigned() + * @see fl_conversion_dynamic_to_unsigned_detect() */ -#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - extern f_status_t private_fl_conversion_dynamic_to_decimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) +#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_signed_detect_) + extern f_status_t private_fl_conversion_dynamic_to_base_signed(const fl_conversion_data_t data, const f_string_t string, const f_array_length_t length, f_number_signed_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_to_decimal_signed_) || !defined(_di_fl_conversion_dynamic_to_signed_detect_) /** * Private implementation of fl_conversion_dynamic_to_decimal_unsigned(). * * Intended to be shared to each of the different implementation variations. * + * @param data + * Conversion data base unit and flags. * @param string * The string to convert. * @param length @@ -136,214 +140,22 @@ extern "C" { * F_number_overflow (with error bit) on integer overflow. * F_parameter (with error bit) if a parameter is invalid. * - * @see fl_conversion_dynamic_partial_to_decimal_unsigned() - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * @see fl_conversion_dynamic_to_decimal_unsigned() - * @see fl_conversion_dynamic_to_number_unsigned() + * @see fl_conversion_dynamic_to_unsigned_detect() */ -#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - extern f_status_t private_fl_conversion_dynamic_to_decimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) +#if !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) + extern f_status_t private_fl_conversion_dynamic_to_base_unsigned(const fl_conversion_data_t data, const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_partial_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_to_decimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) /** - * Private implementation of fl_conversion_dynamic_to_duodecimal_signed(). - * - * Intended to be shared to each of the different implementation variations. - * - * @param string - * The string to convert. - * @param length - * The length of the string to convert. - * @param negative - * Set to 0 to treat string as a positive number, 1 for as a negative number. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the duodecimal string was converted to an signed long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-duodecimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_number_underflow (with error bit) on integer underflow. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_conversion_dynamic_partial_to_duodecimal_signed() - * @see fl_conversion_dynamic_partial_to_number_signed() - * @see fl_conversion_dynamic_to_duodecimal_signed() - * @see fl_conversion_dynamic_to_number_signed() - */ -#if !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - extern f_status_t private_fl_conversion_dynamic_to_duodecimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - -/** - * Private implementation of fl_conversion_dynamic_to_duodecimal_unsigned(). - * - * Intended to be shared to each of the different implementation variations. - * - * @param string - * The string to convert. - * @param length - * The length of the string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the duodecimal string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-duodecimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_conversion_dynamic_partial_to_duodecimal_unsigned() - * @see fl_conversion_dynamic_partial_to_number_unsigned() - * @see fl_conversion_dynamic_to_duodecimal_unsigned() - * @see fl_conversion_dynamic_to_number_unsigned() - */ -#if !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - extern f_status_t private_fl_conversion_dynamic_to_duodecimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_partial_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_duodecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - -/** - * Private implementation of fl_conversion_dynamic_to_hexidecimal_signed(). - * - * Intended to be shared to each of the different implementation variations. - * - * @param string - * The string to convert. - * @param length - * The length of the string to convert. - * @param negative - * Set to 0 to treat string as a positive number, 1 for as a negative number. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the hexidecimal string was converted to an signed long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-hexidecimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_number_underflow (with error bit) on integer underflow. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_conversion_dynamic_partial_to_hexidecimal_signed() - * @see fl_conversion_dynamic_partial_to_number_signed() - * @see fl_conversion_dynamic_to_hexidecimal_signed() - * @see fl_conversion_dynamic_to_number_signed() - */ -#if !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - extern f_status_t private_fl_conversion_dynamic_to_hexidecimal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - -/** - * Private implementation of fl_conversion_dynamic_to_hexidecimal_unsigned(). - * - * Intended to be shared to each of the different implementation variations. - * - * @param string - * The string to convert. - * @param length - * The length of the string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the hexidecimal string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-hexidecimal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_conversion_dynamic_partial_to_hexidecimal_unsigned() - * @see fl_conversion_dynamic_partial_to_number_unsigned() - * @see fl_conversion_dynamic_to_hexidecimal_unsigned() - * @see fl_conversion_dynamic_to_number_unsigned() - */ -#if !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - extern f_status_t private_fl_conversion_dynamic_to_hexidecimal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_partial_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_hexidecimal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - -/** - * Private implementation of fl_conversion_dynamic_to_octal_signed(). - * - * Intended to be shared to each of the different implementation variations. - * - * @param string - * The string to convert. - * @param length - * The length of the string to convert. - * @param negative - * Set to 0 to treat string as a positive number, 1 for as a negative number. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the octal string was converted to an signed long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-octal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_conversion_dynamic_partial_to_octal_signed() - * @see fl_conversion_dynamic_partial_to_number_signed() - * @see fl_conversion_dynamic_to_octal_signed() - * @see fl_conversion_dynamic_to_number_signed() - */ -#if !defined(_di_fl_conversion_dynamic_partial_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - extern f_status_t private_fl_conversion_dynamic_to_octal_signed(const f_string_t string, const f_array_length_t length, const bool negative, f_number_signed_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_partial_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) || !defined(_di_fl_conversion_dynamic_to_octal_signed_) || !defined(_di_fl_conversion_dynamic_to_number_signed_) - -/** - * Private implementation of fl_conversion_dynamic_to_octal_unsigned(). - * - * Intended to be shared to each of the different implementation variations. - * - * @param string - * The string to convert. - * @param length - * The length of the string to convert. - * @param number - * This will store the value of the converted string. - * This value is only changed on success. - * - * @return - * F_none if the octal string was converted to an unsigned long. - * F_data_not if string starts with a null (length is 0). - * - * F_number (with error bit) if no conversion was made due to non-octal values being found. - * F_number_decimal (with error bit) if number has a decimal digit. - * F_number_overflow (with error bit) on integer overflow. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_conversion_dynamic_partial_to_octal_unsigned() - * @see fl_conversion_dynamic_partial_to_number_unsigned() - * @see fl_conversion_dynamic_to_octal_unsigned() - * @see fl_conversion_dynamic_to_number_unsigned() - */ -#if !defined(_di_fl_conversion_dynamic_partial_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - extern f_status_t private_fl_conversion_dynamic_to_octal_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_partial_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_to_octal_unsigned_) || !defined(_di_fl_conversion_dynamic_to_number_unsigned_) - -/** - * Private implementation of fl_conversion_dynamic_to_number_signed(). + * Private implementation of fl_conversion_dynamic_to_signed_detect(). * * Intended to be shared to each of the different implementation variations. * + * @param flag + * Conversion data flags. * @param string * The string to convert. * @param length @@ -363,15 +175,18 @@ extern "C" { * F_number_underflow (with error bit) on integer underflow. * F_parameter (with error bit) if a parameter is invalid. */ -#if !defined(_di_fl_conversion_dynamic_to_number_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) - extern f_status_t private_fl_conversion_dynamic_to_number_signed(const f_string_t string, const f_array_length_t length, f_number_signed_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_to_number_signed_) || !defined(_di_fl_conversion_dynamic_partial_to_number_signed_) +#if !defined(_di_fl_conversion_dynamic_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) + extern f_status_t private_fl_conversion_dynamic_to_signed_detect(const uint16_t flag, const f_string_t string, const f_array_length_t length, f_number_signed_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_to_signed_detect_) || !defined(_di_fl_conversion_dynamic_partial_to_signed_detect_) /** - * Private implementation of fl_conversion_dynamic_to_number_unsigned(). + * Private implementation of fl_conversion_dynamic_to_unsigned_detect(). * * Intended to be shared to each of the different implementation variations. * + * @param flag + * Conversion data flags. + * This auto-detects the base and negative, ignoring the base number and negative flag. * @param string * The string to convert. * @param range @@ -394,9 +209,9 @@ extern "C" { * * @see strtoull() */ -#if !defined(_di_fl_conversion_dynamic_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) - extern f_status_t private_fl_conversion_dynamic_to_number_unsigned(const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; -#endif // !defined(_di_fl_conversion_dynamic_to_number_unsigned_) || !defined(_di_fl_conversion_dynamic_partial_to_number_unsigned_) +#if !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) + extern f_status_t private_fl_conversion_dynamic_to_unsigned_detect(const uint16_t flag, const f_string_t string, const f_array_length_t length, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; +#endif // !defined(_di_fl_conversion_dynamic_to_unsigned_detect_) || !defined(_di_fl_conversion_dynamic_partial_to_unsigned_detect_) #ifdef __cplusplus } // extern "C" diff --git a/level_1/fl_conversion/data/build/settings b/level_1/fl_conversion/data/build/settings index f855d08..ec1385f 100644 --- a/level_1/fl_conversion/data/build/settings +++ b/level_1/fl_conversion/data/build/settings @@ -20,9 +20,9 @@ build_language c build_libraries -lc build_libraries-individual -lf_conversion -lf_memory -lf_string -lf_utf -build_sources_library conversion.c private-conversion.c +build_sources_library conversion.c private-conversion.c conversion/common.c -build_sources_headers conversion.h +build_sources_headers conversion.h conversion/common.h build_script yes build_shared yes diff --git a/level_2/fll_status_string/c/status_string.c b/level_2/fll_status_string/c/status_string.c index 69b6a00..8b7a1bc 100644 --- a/level_2/fll_status_string/c/status_string.c +++ b/level_2/fll_status_string/c/status_string.c @@ -492,14 +492,14 @@ extern "C" { return F_none; } - if (fl_string_dynamic_compare(name, f_status_body_s) == F_equal_to) { - *code = F_body; + if (fl_string_dynamic_compare(name, f_status_base_s) == F_equal_to) { + *code = F_base; return F_none; } - if (fl_string_dynamic_compare(name, f_status_body_not_s) == F_equal_to) { - *code = F_body_not; + if (fl_string_dynamic_compare(name, f_status_base_not_s) == F_equal_to) { + *code = F_base_not; return F_none; } @@ -528,6 +528,18 @@ extern "C" { return F_none; } + if (fl_string_dynamic_compare(name, f_status_body_s) == F_equal_to) { + *code = F_body; + + return F_none; + } + + if (fl_string_dynamic_compare(name, f_status_body_not_s) == F_equal_to) { + *code = F_body_not; + + return F_none; + } + if (fl_string_dynamic_compare(name, f_status_bound_s) == F_equal_to) { *code = F_bound; diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index f583ec9..d7f9257 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -263,7 +263,7 @@ extern "C" { const f_array_length_t index = main->parameters.array[byte_dump_parameter_width_e].values.array[main->parameters.array[byte_dump_parameter_width_e].values.used - 1]; f_number_unsigned_t number = 0; - status = fl_conversion_dynamic_to_number_unsigned(data.argv[index], &number); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number); if (F_status_is_error(status) || number < 1 || number >= 0xfb) { flockfile(main->error.to.stream); @@ -302,7 +302,7 @@ extern "C" { const f_array_length_t index = main->parameters.array[byte_dump_parameter_first_e].values.array[main->parameters.array[byte_dump_parameter_first_e].values.used - 1]; f_number_unsigned_t number = 0; - status = fl_conversion_dynamic_to_number_unsigned(data.argv[index], &number); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number); if (F_status_is_error(status) || number > F_number_t_size_unsigned_d) { flockfile(main->error.to.stream); @@ -341,7 +341,7 @@ extern "C" { const f_array_length_t index = main->parameters.array[byte_dump_parameter_last_e].values.array[main->parameters.array[byte_dump_parameter_last_e].values.used - 1]; f_number_unsigned_t number = 0; - status = fl_conversion_dynamic_to_number_unsigned(data.argv[index], &number); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number); if (F_status_is_error(status) || number < 0 || number > F_number_t_size_unsigned_d) { flockfile(main->error.to.stream); diff --git a/level_3/control/c/private-control.c b/level_3/control/c/private-control.c index 4ac63d9..ce8f28e 100644 --- a/level_3/control/c/private-control.c +++ b/level_3/control/c/private-control.c @@ -461,7 +461,7 @@ extern "C" { control_print_debug_packet_header_object_and_content(main, control_length_s, data->cache.large, data->cache.header_contents.array[i].array[0]); - status = fl_conversion_dynamic_partial_to_number_unsigned(data->cache.large, data->cache.header_contents.array[i].array[0], &number); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, data->cache.large, data->cache.header_contents.array[i].array[0], &number); if (F_status_is_error(status)) { control_print_debug_packet_message(main, "Failed to process number for %[" CONTROL_length_s "%] in the response packet, number is:", &data->cache.large, &data->cache.header_contents.array[i].array[0], &status); @@ -489,7 +489,7 @@ extern "C" { control_print_debug_packet_header_object_and_content(main, control_status_s, data->cache.large, data->cache.header_contents.array[i].array[0]); // Attempt to get status as a number. - status = fl_conversion_dynamic_partial_to_number_unsigned(data->cache.large, data->cache.header_contents.array[i].array[0], &number); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, data->cache.large, data->cache.header_contents.array[i].array[0], &number); if (F_status_set_fine(status) == F_number) { diff --git a/level_3/control/c/private-control.h b/level_3/control/c/private-control.h index bf0ca0b..d5e4c22 100644 --- a/level_3/control/c/private-control.h +++ b/level_3/control/c/private-control.h @@ -111,13 +111,13 @@ extern "C" { * * Errors (with error bit) from: f_socket_read(). * Errors (with error bit) from: f_string_dynamic_increase_by(). - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * Errors (with error bit) from: fll_fss_extended_read(). * Errors (with error bit) from: fll_fss_basic_list_read(). * * @see f_socket_read() * @see f_string_dynamic_increase_by() - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * @see f_fss_apply_delimit() * @see fll_fss_extended_read() * @see fll_fss_basic_list_read() diff --git a/level_3/controller/c/controller/private-controller.c b/level_3/controller/c/controller/private-controller.c index fc59a7a..36be1b1 100644 --- a/level_3/controller/c/controller/private-controller.c +++ b/level_3/controller/c/controller/private-controller.c @@ -217,7 +217,7 @@ extern "C" { if (!isspace(pid_buffer.string[range.stop])) break; } // for - status = fl_conversion_dynamic_partial_to_decimal_unsigned(pid_buffer, range, &number); + status = fl_conversion_dynamic_partial_to_unsigned(fl_conversion_data_base_10_c, pid_buffer, range, &number); if (F_status_is_error_not(status) && number == pid) { status = f_file_remove(path); @@ -270,7 +270,7 @@ extern "C" { if (!isspace(pid_buffer.string[range.stop])) break; } // for - status = fl_conversion_dynamic_partial_to_decimal_unsigned(pid_buffer, range, &number); + status = fl_conversion_dynamic_partial_to_unsigned(fl_conversion_data_base_10_c, pid_buffer, range, &number); if (F_status_is_error_not(status)) { *pid = (pid_t) number; @@ -288,7 +288,7 @@ extern "C" { f_number_unsigned_t number = 0; - f_status_t status = fl_conversion_dynamic_partial_to_number_unsigned(buffer, range, &number); + f_status_t status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, buffer, range, &number); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_number) { @@ -323,7 +323,7 @@ extern "C" { f_number_unsigned_t number = 0; - f_status_t status = fl_conversion_dynamic_partial_to_number_unsigned(buffer, range, &number); + f_status_t status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, buffer, range, &number); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_number) { diff --git a/level_3/controller/c/controller/private-controller.h b/level_3/controller/c/controller/private-controller.h index f4bf26f..a853151 100644 --- a/level_3/controller/c/controller/private-controller.h +++ b/level_3/controller/c/controller/private-controller.h @@ -113,7 +113,7 @@ extern "C" { * Errors (with error bit) from: f_file_stream_close(). * Errors (with error bit) from: f_file_stream_open(). * Errors (with error bit) from: f_file_stream_read(). - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_decimal_unsigned() + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned() */ #ifndef _di_controller_file_pid_delete_ f_status_t controller_file_pid_delete(const pid_t pid, const f_string_static_t path) F_attribute_visibility_internal_d; @@ -133,7 +133,7 @@ extern "C" { * Errors (with error bit) from: f_file_stream_close(). * Errors (with error bit) from: f_file_stream_open(). * Errors (with error bit) from: f_file_stream_read(). - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_decimal_unsigned() + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned() */ #ifndef _di_controller_file_pid_read_ f_status_t controller_file_pid_read(const f_string_static_t path, pid_t * const pid) F_attribute_visibility_internal_d; @@ -157,10 +157,10 @@ extern "C" { * F_number_too_large (with error bit) if the given ID is too large. * * Errors (with error bit) from: f_account_id_by_name(). - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * * @see f_account_id_by_name() - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() */ #ifndef _di_controller_get_id_user_ f_status_t controller_get_id_user(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, uid_t * const id) F_attribute_visibility_internal_d; @@ -184,10 +184,10 @@ extern "C" { * F_number_too_large (with error bit) if the given ID is too large. * * Errors (with error bit) from: f_account_group_id_by_name(). - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * * @see f_account_group_id_by_name() - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() */ #ifndef _di_controller_get_id_group_ f_status_t controller_get_id_group(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, gid_t * const id) F_attribute_visibility_internal_d; diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index a50fc05..507c10f 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -525,7 +525,7 @@ extern "C" { } if (action->status == F_none) { - status = fl_conversion_dynamic_to_number_unsigned(action->parameters.array[1], &action->number); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, action->parameters.array[1], &action->number); if (F_status_is_error(status) || status == F_data_not) { action->number = 0; @@ -538,7 +538,7 @@ extern "C" { } if (F_status_set_fine(status) == F_memory_not) { - controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, global.thread); + controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, global.thread); status_action = status; diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index 3a76b20..b628104 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -681,10 +681,10 @@ extern "C" { status = F_status_set_error(F_valid_not); } else { - status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, cache->content_action.array[++(*index)], &parsed); + status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_action.array[++(*index)], &parsed); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_action.array[*index]), &parsed); + status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_action.array[*index]), &parsed); } if (status == F_data_not) { @@ -3955,10 +3955,10 @@ extern "C" { break; } - status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, cache->content_actions.array[i].array[j], &number); + status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_actions.array[i].array[j], &number); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number); + status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number); // Restore error on parameter problem. if (F_status_set_fine(status) == F_parameter) { @@ -3987,7 +3987,7 @@ extern "C" { } } else { - controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_signed", F_true, F_false); + controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false); status = F_status_set_error(status); @@ -4349,10 +4349,10 @@ extern "C" { for (j = 1; j < 3; ++j, number = 0) { - status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, cache->content_actions.array[i].array[j], &number); + status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_actions.array[i].array[j], &number); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number); + status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number); // Restore error on parameter problem. if (F_status_set_fine(status) == F_parameter) { @@ -4381,7 +4381,7 @@ extern "C" { } } else { - controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_signed", F_true, F_false); + controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false); status = F_status_set_error(status); @@ -4592,10 +4592,10 @@ extern "C" { f_number_signed_t number = 0; - status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, cache->content_actions.array[i].array[1], &number); + status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_actions.array[i].array[1], &number); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number); + status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number); // Restore error on parameter problem. if (F_status_set_fine(status) == F_parameter) { @@ -4642,7 +4642,7 @@ extern "C" { } } else { - controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_dynamic_partial_to_number_signed", F_true, F_false); + controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false); status = F_status_set_error(status); if (F_status_is_error_not(status_return)) { @@ -4714,10 +4714,10 @@ extern "C" { f_number_unsigned_t number = 0; - status = fl_conversion_dynamic_partial_to_number_unsigned(cache->buffer_item, cache->content_actions.array[i].array[1], &number); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_actions.array[i].array[1], &number); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_dynamic_partial_to_number_unsigned(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number); // Restore error on parameter problem. if (F_status_set_fine(status) == F_parameter) { @@ -4742,7 +4742,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_dynamic_partial_to_number_signed", F_true, F_false); + controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false); } if (F_status_is_error_not(status_return)) { @@ -4868,10 +4868,10 @@ extern "C" { else if (type == controller_rule_setting_type_nice_e) { f_number_signed_t number = 0; - status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, cache->content_actions.array[i].array[0], &number); + status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_actions.array[i].array[0], &number); if (F_status_set_fine(status) == F_number_positive) { - status = fl_conversion_dynamic_partial_to_number_signed(cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[0]), &number); + status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[0]), &number); // Restore error on parameter problem. if (F_status_set_fine(status) == F_parameter) { @@ -4911,7 +4911,7 @@ extern "C" { } } else { - controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_dynamic_partial_to_number_signed", F_true, F_false); + controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false); status = F_status_set_error(status); if (F_status_is_error_not(status_return)) { diff --git a/level_3/controller/c/rule/private-rule.h b/level_3/controller/c/rule/private-rule.h index e6a5616..f912acb 100644 --- a/level_3/controller/c/rule/private-rule.h +++ b/level_3/controller/c/rule/private-rule.h @@ -668,10 +668,10 @@ extern "C" { * * F_valid_not (with error bit) on failure due to invalid value. * - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_signed(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_signed_detect(). * * @see controller_rule_action_read() - * @see fl_conversion_dynamic_partial_to_number_signed() + * @see fl_conversion_dynamic_partial_to_signed_detect() */ #ifndef _di_controller_rule_action_read_rerun_number_ extern f_status_t controller_rule_action_read_rerun_number(const controller_global_t global, const f_string_t name, controller_cache_t * const cache, f_array_length_t * const index, f_number_unsigned_t * const number) F_attribute_visibility_internal_d; diff --git a/level_3/fake/c/private-make-operate.c b/level_3/fake/c/private-make-operate.c index 40c7c9f..e214dc0 100644 --- a/level_3/fake/c/private-make-operate.c +++ b/level_3/fake/c/private-make-operate.c @@ -632,7 +632,7 @@ extern "C" { if (status == F_equal_to) { unmatched = F_false; - status = f_conversion_number_unsigned_to_string(uint8_value[i], f_conversion_data_base_10_s, &value); + status = f_conversion_number_unsigned_to_string(uint8_value[i], f_conversion_data_base_10_c, &value); break; } diff --git a/level_3/fake/c/private-make-operate_process.c b/level_3/fake/c/private-make-operate_process.c index 6157397..fcec4a2 100644 --- a/level_3/fake/c/private-make-operate_process.c +++ b/level_3/fake/c/private-make-operate_process.c @@ -616,7 +616,7 @@ extern "C" { if (return_code) { f_string_dynamic_t number = f_string_dynamic_t_initialize; - status = f_conversion_number_signed_to_string(WEXITSTATUS(return_code), f_conversion_data_base_10_s, &number); + status = f_conversion_number_signed_to_string(WEXITSTATUS(return_code), f_conversion_data_base_10_c, &number); if (F_status_is_error(status)) { fll_error_print(data_make->error, F_status_set_fine(status), "f_conversion_number_signed_to_string", F_true); diff --git a/level_3/fake/c/private-make-operate_process_type.c b/level_3/fake/c/private-make-operate_process_type.c index 1ebf270..9383685 100644 --- a/level_3/fake/c/private-make-operate_process_type.c +++ b/level_3/fake/c/private-make-operate_process_type.c @@ -680,7 +680,7 @@ extern "C" { status = F_status_set_error(F_failure); } else { - status = fl_conversion_dynamic_partial_to_number_unsigned(arguments.array[i], range, &number_left); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, arguments.array[i], range, &number_left); } if (F_status_is_error_not(status)) { @@ -704,7 +704,7 @@ extern "C" { status = F_status_set_error(F_failure); } else { - status = fl_conversion_dynamic_partial_to_number_unsigned(arguments.array[i], range, &number_right); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, arguments.array[i], range, &number_right); } } else { diff --git a/level_3/fake/c/private-make-operate_process_type.h b/level_3/fake/c/private-make-operate_process_type.h index bdc1ed4..7a2c17a 100644 --- a/level_3/fake/c/private-make-operate_process_type.h +++ b/level_3/fake/c/private-make-operate_process_type.h @@ -166,9 +166,9 @@ extern "C" { * @return * F_none on success. * - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() */ #ifndef _di_fake_make_operate_process_type_if_greater_if_lesser_ extern f_status_t fake_make_operate_process_type_if_greater_if_lesser(fake_make_data_t * const data_make, const f_string_dynamics_t arguments, fake_state_process_t *state_process) F_attribute_visibility_internal_d; diff --git a/level_3/fake/c/private-make-operate_validate.c b/level_3/fake/c/private-make-operate_validate.c index 773e65a..ad82d21 100644 --- a/level_3/fake/c/private-make-operate_validate.c +++ b/level_3/fake/c/private-make-operate_validate.c @@ -1027,7 +1027,7 @@ extern "C" { status_number = F_status_set_error(F_failure); } else { - status_number = fl_conversion_dynamic_partial_to_number_unsigned(arguments.array[i], range, &number); + status_number = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, arguments.array[i], range, &number); } } else { diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index 71255c8..a717c96 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -52,7 +52,7 @@ extern "C" { f_number_unsigned_t number = 0; - f_status_t status = fl_conversion_dynamic_to_number_unsigned(buffer, &number); + f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, buffer, &number); if (F_status_is_error(status)) { status = F_status_set_fine(status); @@ -83,7 +83,7 @@ extern "C" { return F_none; } - fll_error_print(print, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true); + fll_error_print(print, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true); return F_status_set_error(status); } @@ -145,7 +145,7 @@ extern "C" { f_number_unsigned_t number = 0; - f_status_t status = fl_conversion_dynamic_to_number_unsigned(buffer, &number); + f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, buffer, &number); if (F_status_is_error(status)) { status = F_status_set_fine(status); @@ -176,7 +176,7 @@ extern "C" { return F_none; } - fll_error_print(print, status, "fl_conversion_dynamic_to_number_unsigned", F_true); + fll_error_print(print, status, "fl_conversion_dynamic_to_unsigned_detect", F_true); return F_status_set_error(status); } diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index 849ccda..81fbb09 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -430,10 +430,10 @@ extern "C" { ++range.start; } - status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_basic_list_read_long_delimit_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_unsigned_detect", F_true, fss_basic_list_read_long_delimit_s, data.argv[index]); break; } diff --git a/level_3/fss_basic_list_read/c/private-read.c b/level_3/fss_basic_list_read/c/private-read.c index 05001e4..0a47cd3 100644 --- a/level_3/fss_basic_list_read/c/private-read.c +++ b/level_3/fss_basic_list_read/c/private-read.c @@ -109,10 +109,10 @@ extern "C" { else { position_depth = main->parameters.array[fss_basic_list_read_parameter_depth_e].values.array[i]; - status = fl_conversion_dynamic_to_number_unsigned(data->argv[position_depth], &data->depths.array[i].depth); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[position_depth], &data->depths.array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_basic_list_read_long_depth_s, data->argv[position_depth]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_basic_list_read_long_depth_s, data->argv[position_depth]); return status; } @@ -131,10 +131,10 @@ extern "C" { data->depths.array[i].index_at = main->parameters.array[fss_basic_list_read_parameter_at_e].values.array[position_at]; - status = fl_conversion_dynamic_to_number_unsigned(data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_basic_list_read_long_at_s, data->argv[data->depths.array[i].index_at]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_basic_list_read_long_at_s, data->argv[data->depths.array[i].index_at]); return status; } @@ -284,10 +284,10 @@ extern "C" { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; - const f_status_t status = fl_conversion_dynamic_to_number_unsigned(data->argv[index], number); + const f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[index], number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, name, data->argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, name, data->argv[index]); return status; } diff --git a/level_3/fss_basic_list_read/c/private-read.h b/level_3/fss_basic_list_read/c/private-read.h index f46472c..c9e0082 100644 --- a/level_3/fss_basic_list_read/c/private-read.h +++ b/level_3/fss_basic_list_read/c/private-read.h @@ -60,13 +60,13 @@ extern "C" { * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. * * Errors (with error bit) from: f_string_append(). - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * Errors (with error bit) from: fl_string_dynamic_rip(). * * Errors (with error bit) from: fss_basic_list_read_depths_resize(). * * @see f_string_append() - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * @see fl_string_dynamic_rip() * * @see fss_basic_list_read_depths_resize() @@ -139,9 +139,9 @@ extern "C" { * F_true on success and the parameter was found (and is valid). * F_false on success and the parameter was not found. * - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * * @see fss_basic_list_read_depths_resize() */ diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index 81e0c0d..1fdf288 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -429,10 +429,10 @@ extern "C" { ++range.start; } - status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_basic_read_long_delimit_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_unsigned_detect", F_true, fss_basic_read_long_delimit_s, data.argv[index]); break; } diff --git a/level_3/fss_basic_read/c/private-read.c b/level_3/fss_basic_read/c/private-read.c index 388a68c..28760fc 100644 --- a/level_3/fss_basic_read/c/private-read.c +++ b/level_3/fss_basic_read/c/private-read.c @@ -86,10 +86,10 @@ extern "C" { else { position_depth = main->parameters.array[fss_basic_read_parameter_depth_e].values.array[i]; - status = fl_conversion_dynamic_to_number_unsigned(data->argv[position_depth], &data->depths.array[i].depth); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[position_depth], &data->depths.array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_basic_read_long_depth_s, data->argv[position_depth]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_basic_read_long_depth_s, data->argv[position_depth]); return status; } @@ -108,10 +108,10 @@ extern "C" { data->depths.array[i].index_at = main->parameters.array[fss_basic_read_parameter_at_e].values.array[position_at]; - status = fl_conversion_dynamic_to_number_unsigned(data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_basic_read_long_at_s, data->argv[data->depths.array[i].index_at]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_basic_read_long_at_s, data->argv[data->depths.array[i].index_at]); return status; } @@ -265,10 +265,10 @@ extern "C" { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; - const f_status_t status = fl_conversion_dynamic_to_number_unsigned(data->argv[index], number); + const f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[index], number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, name, data->argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, name, data->argv[index]); return status; } diff --git a/level_3/fss_basic_read/c/private-read.h b/level_3/fss_basic_read/c/private-read.h index 1c96181..2c273d7 100644 --- a/level_3/fss_basic_read/c/private-read.h +++ b/level_3/fss_basic_read/c/private-read.h @@ -44,13 +44,13 @@ extern "C" { * F_none on success. * * Errors (with error bit) from: f_string_append(). - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * Errors (with error bit) from: fl_string_dynamic_rip(). * * Errors (with error bit) from: fss_basic_read_depths_resize(). * * @see f_string_append() - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * @see fl_string_dynamic_rip() * * @see fss_basic_read_depths_resize() @@ -123,9 +123,9 @@ extern "C" { * F_true on success and the parameter was found (and is valid). * F_false on success and the parameter was not found. * - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * * @see fss_basic_read_depths_resize() */ diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c index 6f70e97..f8abddd 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c @@ -351,10 +351,10 @@ extern "C" { ++range.start; } - status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_embedded_list_read_long_delimit_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_unsigned_detect", F_true, fss_embedded_list_read_long_delimit_s, data.argv[index]); } } } diff --git a/level_3/fss_embedded_list_read/c/private-read.c b/level_3/fss_embedded_list_read/c/private-read.c index 8bfad4c..c013d58 100644 --- a/level_3/fss_embedded_list_read/c/private-read.c +++ b/level_3/fss_embedded_list_read/c/private-read.c @@ -140,10 +140,10 @@ extern "C" { } if (values_type[i] == fss_embedded_list_read_parameter_depth_e || values_type[i] == fss_embedded_list_read_parameter_at_e) { - status = fl_conversion_dynamic_to_number_unsigned(argv[values_order[i]], &number); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, argv[values_order[i]], &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_depth_s, argv[values_order[i]]); + fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_embedded_list_read_long_depth_s, argv[values_order[i]]); return status; } @@ -301,10 +301,10 @@ extern "C" { if (data->main->parameters.array[fss_embedded_list_read_parameter_select_e].result == f_console_result_additional_e) { const f_array_length_t index = data->main->parameters.array[fss_embedded_list_read_parameter_select_e].values.array[data->main->parameters.array[fss_embedded_list_read_parameter_select_e].values.used - 1]; - status = fl_conversion_dynamic_to_number_unsigned(data->main->parameters.arguments.array[index], &select); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->main->parameters.arguments.array[index], &select); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_select_s, data->main->parameters.arguments.array[index]); + fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_embedded_list_read_long_select_s, data->main->parameters.arguments.array[index]); return status; } @@ -321,10 +321,10 @@ extern "C" { if (data->main->parameters.array[fss_embedded_list_read_parameter_line_e].result == f_console_result_additional_e) { const f_array_length_t index = data->main->parameters.array[fss_embedded_list_read_parameter_line_e].values.array[data->main->parameters.array[fss_embedded_list_read_parameter_line_e].values.used - 1]; - status = fl_conversion_dynamic_to_number_unsigned(data->main->parameters.arguments.array[index], &line); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->main->parameters.arguments.array[index], &line); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_line_s, data->main->parameters.arguments.array[index]); + fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_embedded_list_read_long_line_s, data->main->parameters.arguments.array[index]); return status; } diff --git a/level_3/fss_embedded_list_write/c/private-write.c b/level_3/fss_embedded_list_write/c/private-write.c index 7687590..2526241 100644 --- a/level_3/fss_embedded_list_write/c/private-write.c +++ b/level_3/fss_embedded_list_write/c/private-write.c @@ -432,10 +432,10 @@ extern "C" { range.start = 1; } - status = fl_conversion_dynamic_partial_to_number_unsigned(argv[index], range, &number); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_unsigned_detect", F_true, fss_embedded_list_write_long_ignore_s, argv[index]); return status; } @@ -452,10 +452,10 @@ extern "C" { range.start = 1; } - status = fl_conversion_dynamic_partial_to_number_unsigned(argv[index], range, &number); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_unsigned_detect", F_true, fss_embedded_list_write_long_ignore_s, argv[index]); return status; } diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index 2afd8d9..e813f42 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -429,10 +429,10 @@ extern "C" { ++range.start; } - status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_extended_list_read_long_delimit_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_unsigned_detect", F_true, fss_extended_list_read_long_delimit_s, data.argv[index]); break; } diff --git a/level_3/fss_extended_list_read/c/private-read.c b/level_3/fss_extended_list_read/c/private-read.c index 0b669e7..90c10ef 100644 --- a/level_3/fss_extended_list_read/c/private-read.c +++ b/level_3/fss_extended_list_read/c/private-read.c @@ -109,10 +109,10 @@ extern "C" { else { position_depth = main->parameters.array[fss_extended_list_read_parameter_depth_e].values.array[i]; - status = fl_conversion_dynamic_to_number_unsigned(data->argv[position_depth], &data->depths.array[i].depth); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[position_depth], &data->depths.array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_extended_list_read_long_depth_s, data->argv[position_depth]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_extended_list_read_long_depth_s, data->argv[position_depth]); return status; } @@ -131,10 +131,10 @@ extern "C" { data->depths.array[i].index_at = main->parameters.array[fss_extended_list_read_parameter_at_e].values.array[position_at]; - status = fl_conversion_dynamic_to_number_unsigned(data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_extended_list_read_long_at_s, data->argv[data->depths.array[i].index_at]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_extended_list_read_long_at_s, data->argv[data->depths.array[i].index_at]); return status; } @@ -281,10 +281,10 @@ extern "C" { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; - const f_status_t status = fl_conversion_dynamic_to_number_unsigned(data->argv[index], number); + const f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[index], number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, name, data->argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, name, data->argv[index]); return status; } diff --git a/level_3/fss_extended_list_read/c/private-read.h b/level_3/fss_extended_list_read/c/private-read.h index d1eb42b..0131f3b 100644 --- a/level_3/fss_extended_list_read/c/private-read.h +++ b/level_3/fss_extended_list_read/c/private-read.h @@ -58,13 +58,13 @@ extern "C" { * F_none on success. * * Errors (with error bit) from: f_string_append(). - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * Errors (with error bit) from: fl_string_dynamic_rip(). * * Errors (with error bit) from: fss_extended_list_read_depths_resize(). * * @see f_string_append() - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * @see fl_string_dynamic_rip() * * @see fss_extended_list_read_depths_resize() @@ -137,9 +137,9 @@ extern "C" { * F_true on success and the parameter was found (and is valid). * F_false on success and the parameter was not found. * - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * * @see fss_extended_list_read_depths_resize() */ diff --git a/level_3/fss_extended_list_write/c/private-write.c b/level_3/fss_extended_list_write/c/private-write.c index 88d4e7e..97b6bbe 100644 --- a/level_3/fss_extended_list_write/c/private-write.c +++ b/level_3/fss_extended_list_write/c/private-write.c @@ -429,10 +429,10 @@ extern "C" { range.start = 1; } - status = fl_conversion_dynamic_partial_to_number_unsigned(argv[index], range, &number); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_extended_list_write_long_ignore_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_unsigned_detect", F_true, fss_extended_list_write_long_ignore_s, argv[index]); return status; } @@ -449,10 +449,10 @@ extern "C" { range.start = 1; } - status = fl_conversion_dynamic_partial_to_number_unsigned(argv[index], range, &number); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_extended_list_write_long_ignore_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_unsigned_detect", F_true, fss_extended_list_write_long_ignore_s, argv[index]); return status; } diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index bc17a8b..ba30941 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -428,10 +428,10 @@ extern "C" { ++range.start; } - status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_extended_read_long_delimit_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_unsigned_detect", F_true, fss_extended_read_long_delimit_s, data.argv[index]); break; } diff --git a/level_3/fss_extended_read/c/private-read.c b/level_3/fss_extended_read/c/private-read.c index 773d4be..d4f7950 100644 --- a/level_3/fss_extended_read/c/private-read.c +++ b/level_3/fss_extended_read/c/private-read.c @@ -113,10 +113,10 @@ extern "C" { else { position_depth = main->parameters.array[fss_extended_read_parameter_depth_e].values.array[i]; - status = fl_conversion_dynamic_to_number_unsigned(data->argv[position_depth], &data->depths.array[i].depth); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[position_depth], &data->depths.array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_extended_read_long_depth_s, data->argv[position_depth]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_extended_read_long_depth_s, data->argv[position_depth]); return status; } @@ -135,10 +135,10 @@ extern "C" { data->depths.array[i].index_at = main->parameters.array[fss_extended_read_parameter_at_e].values.array[position_at]; - status = fl_conversion_dynamic_to_number_unsigned(data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_extended_read_long_at_s, data->argv[data->depths.array[i].index_at]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_extended_read_long_at_s, data->argv[data->depths.array[i].index_at]); return status; } @@ -287,10 +287,10 @@ extern "C" { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; - const f_status_t status = fl_conversion_dynamic_to_number_unsigned(data->argv[index], number); + const f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[index], number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, name, data->argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, name, data->argv[index]); return status; } diff --git a/level_3/fss_extended_read/c/private-read.h b/level_3/fss_extended_read/c/private-read.h index fcebadc..348da60 100644 --- a/level_3/fss_extended_read/c/private-read.h +++ b/level_3/fss_extended_read/c/private-read.h @@ -58,13 +58,13 @@ extern "C" { * F_none on success. * * Errors (with error bit) from: f_string_append(). - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * Errors (with error bit) from: fl_string_dynamic_rip(). * * Errors (with error bit) from: fss_extended_read_depths_resize(). * * @see f_string_append() - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * @see fl_string_dynamic_rip() * * @see fss_extended_read_depths_resize() @@ -137,9 +137,9 @@ extern "C" { * F_true on success and the parameter was found (and is valid). * F_false on success and the parameter was not found. * - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * * @see fss_extended_read_depths_resize() */ diff --git a/level_3/fss_identify/c/fss_identify.c b/level_3/fss_identify/c/fss_identify.c index 09516bb..155954c 100644 --- a/level_3/fss_identify/c/fss_identify.c +++ b/level_3/fss_identify/c/fss_identify.c @@ -162,10 +162,10 @@ extern "C" { else if (main->parameters.array[fss_identify_parameter_line_e].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[fss_identify_parameter_line_e].values.array[main->parameters.array[fss_identify_parameter_line_e].values.used - 1]; - status = fl_conversion_dynamic_to_number_unsigned(data.argv[index], &data.line); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &data.line); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_identify_long_line_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_identify_long_line_s, data.argv[index]); } } } diff --git a/level_3/fss_identify/c/private-identify.c b/level_3/fss_identify/c/private-identify.c index 9ed6f4b..73a07e5 100644 --- a/level_3/fss_identify/c/private-identify.c +++ b/level_3/fss_identify/c/private-identify.c @@ -169,7 +169,7 @@ extern "C" { } // for { - const f_status_t status = fl_conversion_dynamic_partial_to_hexidecimal_unsigned(data->name, range, &number); + const f_status_t status = fl_conversion_dynamic_partial_to_unsigned(fl_conversion_data_base_16_c, data->name, range, &number); if (F_status_is_error(status)) return status; } diff --git a/level_3/fss_payload_read/c/fss_payload_read.c b/level_3/fss_payload_read/c/fss_payload_read.c index fc3fe33..6caf3a6 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.c +++ b/level_3/fss_payload_read/c/fss_payload_read.c @@ -447,10 +447,10 @@ extern "C" { ++range.start; } - status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth); + status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_payload_read_long_delimit_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_unsigned_detect", F_true, fss_payload_read_long_delimit_s, data.argv[index]); break; } diff --git a/level_3/fss_payload_read/c/private-read.c b/level_3/fss_payload_read/c/private-read.c index 8679d80..5d24bbf 100644 --- a/level_3/fss_payload_read/c/private-read.c +++ b/level_3/fss_payload_read/c/private-read.c @@ -109,10 +109,10 @@ extern "C" { else { position_depth = main->parameters.array[fss_payload_read_parameter_depth_e].values.array[i]; - status = fl_conversion_dynamic_to_number_unsigned(data->argv[position_depth], &data->depths.array[i].depth); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[position_depth], &data->depths.array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_payload_read_long_depth_s, data->argv[position_depth]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_payload_read_long_depth_s, data->argv[position_depth]); return status; } @@ -131,10 +131,10 @@ extern "C" { data->depths.array[i].index_at = main->parameters.array[fss_payload_read_parameter_at_e].values.array[position_at]; - status = fl_conversion_dynamic_to_number_unsigned(data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_payload_read_long_at_s, data->argv[data->depths.array[i].index_at]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_payload_read_long_at_s, data->argv[data->depths.array[i].index_at]); return status; } @@ -318,10 +318,10 @@ extern "C" { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; - const f_status_t status = fl_conversion_dynamic_to_number_unsigned(data->argv[index], number); + const f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[index], number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, name, data->argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, name, data->argv[index]); return status; } diff --git a/level_3/fss_payload_read/c/private-read.h b/level_3/fss_payload_read/c/private-read.h index ce6b6c7..688c172 100644 --- a/level_3/fss_payload_read/c/private-read.h +++ b/level_3/fss_payload_read/c/private-read.h @@ -62,13 +62,13 @@ extern "C" { * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. * * Errors (with error bit) from: f_string_append(). - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * Errors (with error bit) from: fl_string_dynamic_rip(). * * Errors (with error bit) from: fss_payload_read_depths_resize(). * * @see f_string_append() - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * @see fl_string_dynamic_rip() * * @see fss_payload_read_depths_resize() @@ -141,9 +141,9 @@ extern "C" { * F_true on success and the parameter was found (and is valid). * F_false on success and the parameter was not found. * - * Errors (with error bit) from: fl_conversion_dynamic_partial_to_number_unsigned(). + * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). * - * @see fl_conversion_dynamic_partial_to_number_unsigned() + * @see fl_conversion_dynamic_partial_to_unsigned_detect() * * @see fss_payload_read_depths_resize() */ diff --git a/level_3/fss_status_code/c/private-fss_status_code.c b/level_3/fss_status_code/c/private-fss_status_code.c index 12866ef..7ee3d6c 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 @@ -59,7 +59,7 @@ extern "C" { { f_number_unsigned_t number = 0; - status = fl_conversion_dynamic_to_number_unsigned(value, &number); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, value, &number); if (status == F_none) { fl_print_format("%[invalid name%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -147,7 +147,7 @@ extern "C" { #ifndef _di_fss_status_code_convert_number_ f_status_t fss_status_code_convert_number(fll_program_data_t * const main, const f_string_static_t value, f_number_unsigned_t *number) { - f_status_t status = fl_conversion_dynamic_to_number_unsigned(value, number); + f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, value, number); if (*number > F_status_size_max_with_bits_d) { fl_print_format("%[out of range%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index 81b84fd..b3c7b11 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -217,10 +217,10 @@ extern "C" { f_number_unsigned_t number = 0; - status = fl_conversion_dynamic_to_number_unsigned(data.argv[index], &number); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, iki_read_long_at_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, iki_read_long_at_s, data.argv[index]); status = F_status_set_error(F_parameter); } @@ -254,10 +254,10 @@ extern "C" { f_number_unsigned_t number = 0; - status = fl_conversion_dynamic_to_number_unsigned(data.argv[index], &number); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, iki_read_long_line_s, data.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, iki_read_long_line_s, data.argv[index]); status = F_status_set_error(F_parameter); } diff --git a/level_3/status_code/c/private-status_code.c b/level_3/status_code/c/private-status_code.c index 185a041..5054717 100644 --- a/level_3/status_code/c/private-status_code.c +++ b/level_3/status_code/c/private-status_code.c @@ -57,7 +57,7 @@ extern "C" { { f_number_unsigned_t number = 0; - status = fl_conversion_dynamic_to_number_unsigned(value, &number); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, value, &number); if (status == F_none) { fl_print_format("%[invalid name%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); @@ -139,7 +139,7 @@ extern "C" { #ifndef _di_status_code_convert_number_ f_status_t status_code_convert_number(fll_program_data_t * const main, const f_string_static_t value, f_number_unsigned_t *number) { - f_status_t status = fl_conversion_dynamic_to_number_unsigned(value, number); + f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, value, number); if (*number > F_status_size_max_with_bits_d) { fl_print_format("%[out of range%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s); diff --git a/level_3/utf8/c/private-print.c b/level_3/utf8/c/private-print.c index ea02bfe..c816a07 100644 --- a/level_3/utf8/c/private-print.c +++ b/level_3/utf8/c/private-print.c @@ -7,34 +7,34 @@ extern "C" { #endif #ifndef _di_utf8_print_bytesequence_ - void utf8_print_bytesequence(utf8_data_t * const data, const f_string_static_t character) { + void utf8_print_bytesequence(utf8_data_t * const data, const f_string_static_t sequence) { - fl_print_format("%r%r%r", data->file.stream, data->prepend, character, data->append); + fl_print_format("%r%r%r", data->file.stream, data->prepend, sequence, data->append); } #endif // _di_utf8_print_bytesequence_ #ifndef _di_utf8_print_character_invalid_ - void utf8_print_character_invalid(utf8_data_t * const data, const f_string_static_t character) { + void utf8_print_character_invalid(utf8_data_t * const data, const f_string_static_t invalid) { if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_found_e) return; if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return; - if (!character.used) return; + if (!invalid.used) return; if ((data->mode & utf8_mode_to_combining_d) || (data->mode & utf8_mode_to_width_d)) { - utf8_print_combining_or_width(data, character); + utf8_print_combining_or_width(data, invalid); } else if (data->mode & utf8_mode_to_bytesequence_d) { - fl_print_format("%r%[%r%]%r", data->file.stream, data->prepend, data->valid_not, character, data->valid_not, data->append); + fl_print_format("%r%[%r%]%r", data->file.stream, data->prepend, data->valid_not, invalid, data->valid_not, data->append); } else if (data->mode & utf8_mode_from_codepoint_d) { - fl_print_format("%r%[%Q%]%r", data->file.stream, data->prepend, data->valid_not, character, data->valid_not, data->append); + fl_print_format("%r%[%Q%]%r", data->file.stream, data->prepend, data->valid_not, invalid, data->valid_not, data->append); } else { fl_print_format("%r%[0x", data->file.stream, data->prepend, data->valid_not); - for (uint8_t i = 0; i < character.used; ++i) { - fl_print_format("%02_uii", data->file.stream, (uint8_t) character.string[i]); + for (uint8_t i = 0; i < invalid.used; ++i) { + fl_print_format("%02_uii", data->file.stream, (uint8_t) invalid.string[i]); } // for fl_print_format("%]%r", data->file.stream, data->valid_not, data->append); @@ -43,9 +43,9 @@ extern "C" { #endif // _di_utf8_print_character_invalid_ #ifndef _di_utf8_print_codepoint_ - void utf8_print_codepoint(utf8_data_t * const data, const uint32_t codepoint) { + void utf8_print_codepoint(utf8_data_t * const data, const f_utf_char_t codepoint) { - if (codepoint < 0xffff) { + if (codepoint < 0x10000) { fl_print_format("%rU+%04_U%r", data->file.stream, data->prepend, codepoint, data->append); } else if (codepoint < 0x100000) { @@ -58,24 +58,24 @@ extern "C" { #endif // _di_utf8_print_codepoint_ #ifndef _di_utf8_print_combining_or_width_ - void utf8_print_combining_or_width(utf8_data_t * const data, const f_string_static_t character) { + void utf8_print_combining_or_width(utf8_data_t * const data, const f_string_static_t sequence) { f_status_t status = F_none; if (data->mode & utf8_mode_to_combining_d) { - status = f_utf_is_combining(character.string, character.used); + status = f_utf_is_combining(sequence.string, sequence.used); if (status == F_true) { fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_combining_is_s, data->append); } else if (status == F_false) { - status = f_utf_is_private(character.string, character.used); + status = f_utf_is_private(sequence.string, sequence.used); if (status == F_true) { fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_unknown_s, data->append); } else if (data->mode & utf8_mode_to_width_d) { - utf8_print_width(data, character); + utf8_print_width(data, sequence); } else { fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_combining_not_s, data->append); @@ -86,7 +86,7 @@ extern "C" { } } else if (data->mode & utf8_mode_to_width_d) { - utf8_print_width(data, character); + utf8_print_width(data, sequence); } } #endif // _di_utf8_print_combining_or_width_ @@ -102,7 +102,7 @@ extern "C" { #endif // _di_utf8_print_error_combining_or_width_ #ifndef _di_utf8_print_error_decode_ - void utf8_print_error_decode(utf8_data_t * const data, const f_status_t status, const f_string_static_t character) { + void utf8_print_error_decode(utf8_data_t * const data, const f_status_t status, const f_string_static_t invalid) { if (data->main->error.verbosity == f_console_verbosity_quiet_e) return; if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_found_e) return; @@ -110,11 +110,11 @@ extern "C" { fl_print_format("%r%[%QFailed to decode character code '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error); - if (character.used) { + if (invalid.used) { fl_print_format("%[0x", data->main->error.to.stream, data->main->context.set.notable); - for (uint8_t i = 0; i < character.used; ++i) { - fl_print_format("%02_uii", data->main->error.to.stream, (uint8_t) character.string[i]); + for (uint8_t i = 0; i < invalid.used; ++i) { + fl_print_format("%02_uii", data->main->error.to.stream, (uint8_t) invalid.string[i]); } // for fl_print_format("%]", data->main->error.to.stream, data->main->context.set.notable); @@ -138,7 +138,7 @@ extern "C" { #endif // _di_utf8_print_error_decode_ #ifndef _di_utf8_print_error_encode_ - void utf8_print_error_encode(utf8_data_t * const data, const f_status_t status, const uint32_t codepoint) { + void utf8_print_error_encode(utf8_data_t * const data, const f_status_t status, const f_utf_char_t codepoint) { if (data->main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -227,49 +227,32 @@ extern "C" { f_string_static_t character = macro_f_string_static_t_initialize(0, 0, width); - uint8_t byte[character.used]; + f_char_t byte[character.used + 1]; character.string = byte; + byte[character.used] = 0; if (raw) { if (width == 1) { - byte[0] = (uint8_t) (raw & 0xff); + byte[0] = macro_f_utf_char_t_to_char_4_be(raw); } else if (width == 2) { - #ifdef _is_F_endian_big - byte[0] = (uint8_t) (raw & 0xff); - byte[1] = (uint8_t) ((raw & 0xff00) << 8); - #else - byte[0] = (uint8_t) ((raw & 0xff00) >> 8); - byte[1] = (uint8_t) (raw & 0xff); - #endif // _is_F_endian_big + byte[0] = macro_f_utf_char_t_to_char_3_be(raw); + byte[1] = macro_f_utf_char_t_to_char_4_be(raw); } else if (width == 3) { - #ifdef _is_F_endian_big - byte[0] = (uint8_t) (raw & 0xff); - byte[1] = (uint8_t) ((raw & 0xff00) << 8); - byte[2] = (uint8_t) ((raw & 0xff0000) << 16); - #else - byte[0] = (uint8_t) ((raw & 0xff0000) >> 16); - byte[1] = (uint8_t) ((raw & 0xff00) >> 8); - byte[2] = (uint8_t) (raw & 0xff); - #endif // _is_F_endian_big + byte[0] = macro_f_utf_char_t_to_char_2_be(raw); + byte[1] = macro_f_utf_char_t_to_char_3_be(raw); + byte[2] = macro_f_utf_char_t_to_char_4_be(raw); } else { - #ifdef _is_F_endian_big - byte[0] = (uint8_t) (raw & 0xff); - byte[1] = (uint8_t) ((raw & 0xff00) << 8); - byte[2] = (uint8_t) ((raw & 0xff0000) << 16); - byte[3] = (uint8_t) ((raw & 0xff000000) << 24); - #else - byte[0] = (uint8_t) ((raw & 0xff000000) >> 24); - byte[1] = (uint8_t) ((raw & 0xff0000) >> 16); - byte[2] = (uint8_t) ((raw & 0xff00) >> 8); - byte[3] = (uint8_t) (raw & 0xff); - #endif // _is_F_endian_big + byte[0] = macro_f_utf_char_t_to_char_1_be(raw); + byte[1] = macro_f_utf_char_t_to_char_2_be(raw); + byte[2] = macro_f_utf_char_t_to_char_3_be(raw); + byte[3] = macro_f_utf_char_t_to_char_4_be(raw); } } else { - memset(byte, 0, sizeof(uint8_t) * width); + memset(byte, 0, sizeof(f_char_t) * width); } fl_print_format("%r%[%r%]%r", data->file.stream, data->prepend, data->valid_not, character, data->valid_not, data->append); @@ -391,9 +374,9 @@ extern "C" { #endif // _di_utf8_print_signal_received_ #ifndef _di_utf8_print_width_ - void utf8_print_width(utf8_data_t * const data, const f_string_static_t character) { + void utf8_print_width(utf8_data_t * const data, const f_string_static_t sequence) { - f_status_t status = f_utf_is_wide(character.string, character.used); + f_status_t status = f_utf_is_wide(sequence.string, sequence.used); if (status == F_true) { fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_width_2_s, data->append); @@ -402,38 +385,7 @@ extern "C" { } if (status == F_false) { - status = f_utf_is_graph(character.string, character.used); - - if (status == F_true) { - fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_width_1_s, data->append); - - return; - } - - if (status == F_false) { - fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_width_0_s, data->append); - - return; - } - } - - utf8_print_error_combining_or_width(data); - } -#endif // _di_utf8_print_width_ - -#ifndef _di_utf8_print_width_codepoint_ - void utf8_print_width_codepoint(utf8_data_t * const data, const f_string_static_t character) { - - f_status_t status = f_utf_is_wide(character.string, character.used); - - if (status == F_true) { - fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_width_2_s, data->append); - - return; - } - - if (status == F_false) { - status = f_utf_is_graph(character.string, character.used); + status = f_utf_is_graph(sequence.string, sequence.used); if (status == F_true) { fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_width_1_s, data->append); diff --git a/level_3/utf8/c/private-print.h b/level_3/utf8/c/private-print.h index 8afd76b..dcf2ff6 100644 --- a/level_3/utf8/c/private-print.h +++ b/level_3/utf8/c/private-print.h @@ -13,32 +13,31 @@ extern "C" { #endif /** - * Print the bytesequence character (such as '豸'). + * Print the byte sequence character (such as '豸'). * * @param data * The program data. - * @param character - * The character to print. - * This is a string that represents a single character. + * @param sequence + * A byte sequences representing a single character to print. */ #ifndef _di_utf8_print_bytesequence_ - extern void utf8_print_bytesequence(utf8_data_t * const data, const f_string_static_t character) F_attribute_visibility_internal_d; + extern void utf8_print_bytesequence(utf8_data_t * const data, const f_string_static_t sequence) F_attribute_visibility_internal_d; #endif // _di_utf8_print_bytesequence_ /** - * Print an invalid character either as a Unicode codeblock or as a bytesequence. + * Print an invalid character either as a Unicode codeblock or as a byte sequence. * * This handles whether or not the invalid character should be printed or not based on program parameters. * * @param data * The program data. - * @param character - * The character block to print. + * @param invalid + * The byte sequence string or unicode codepoint string representing a single character to print. * * @see utf8_print_combining_or_width() */ #ifndef _di_utf8_print_character_invalid_ - extern void utf8_print_character_invalid(utf8_data_t * const data, const f_string_static_t character) F_attribute_visibility_internal_d; + extern void utf8_print_character_invalid(utf8_data_t * const data, const f_string_static_t invalid) F_attribute_visibility_internal_d; #endif // _di_utf8_print_character_invalid_ /** @@ -51,7 +50,7 @@ extern "C" { * This is the code that represents a single character. */ #ifndef _di_utf8_print_codepoint_ - extern void utf8_print_codepoint(utf8_data_t * const data, const uint32_t codepoint) F_attribute_visibility_internal_d; + extern void utf8_print_codepoint(utf8_data_t * const data, const f_utf_char_t codepoint) F_attribute_visibility_internal_d; #endif // _di_utf8_print_codepoint_ /** @@ -59,13 +58,13 @@ extern "C" { * * @param data * The program data. - * @param character - * The character block whose width or combining state is to be printed. + * @param sequence + * A byte sequences representing a single character to print. * * @see utf8_print_width() */ #ifndef _di_utf8_print_combining_or_width_ - extern void utf8_print_combining_or_width(utf8_data_t * const data, const f_string_static_t character) F_attribute_visibility_internal_d; + extern void utf8_print_combining_or_width(utf8_data_t * const data, const f_string_static_t sequence) F_attribute_visibility_internal_d; #endif // _di_utf8_print_combining_or_width_ /** @@ -83,11 +82,11 @@ extern "C" { * * @param data * The program data. - * @param character - * The character that is invalid. + * @param invalid + * The byte sequence string or unicode codepoint string representing a single character to print. */ #ifndef _di_utf8_print_error_decode_ - extern void utf8_print_error_decode(utf8_data_t * const data, const f_status_t status, const f_string_static_t character) F_attribute_visibility_internal_d; + extern void utf8_print_error_decode(utf8_data_t * const data, const f_status_t status, const f_string_static_t invalid) F_attribute_visibility_internal_d; #endif // _di_utf8_print_error_decode_ /** @@ -99,7 +98,7 @@ extern "C" { * The codepoint that is invalid. */ #ifndef _di_utf8_print_error_encode_ - extern void utf8_print_error_encode(utf8_data_t * const data, const f_status_t status, const uint32_t codepoint) F_attribute_visibility_internal_d; + extern void utf8_print_error_encode(utf8_data_t * const data, const f_status_t status, const f_utf_char_t codepoint) F_attribute_visibility_internal_d; #endif // _di_utf8_print_error_encode_ /** @@ -117,7 +116,7 @@ extern "C" { * * @param data * The program data. - * @param parameter_1 + * @param parameter * The long parameter name. */ #ifndef _di_utf8_print_error_no_value_ @@ -162,7 +161,7 @@ extern "C" { #endif // _di_utf8_print_error_parameter_file_to_too_many_ /** - * Print the raw character data (binary / bytesequence). + * Print the raw character data (binary / byte sequence). * * @param data * The program data. @@ -252,11 +251,11 @@ extern "C" { * * @param data * The program data. - * @param character - * The character block whose width is to be printed. + * @param sequence + * A byte sequences representing a single character whose width is to be printed. */ #ifndef _di_utf8_print_width_ - extern void utf8_print_width(utf8_data_t * const data, const f_string_static_t character) F_attribute_visibility_internal_d; + extern void utf8_print_width(utf8_data_t * const data, const f_string_static_t sequence) F_attribute_visibility_internal_d; #endif // _di_utf8_print_width_ #ifdef __cplusplus diff --git a/level_3/utf8/c/private-utf8.c b/level_3/utf8/c/private-utf8.c index 939b601..65b2e5b 100644 --- a/level_3/utf8/c/private-utf8.c +++ b/level_3/utf8/c/private-utf8.c @@ -12,9 +12,7 @@ extern "C" { #ifndef _di_utf8_process_text_ f_status_t utf8_process_text(utf8_data_t * const data, f_string_static_t text) { - if (!text.used) { - return F_true; - } + if (!text.used) return F_true; f_status_t status = F_none; bool valid = F_true; @@ -112,9 +110,7 @@ extern "C" { #ifndef _di_utf8_process_text_width_ void utf8_process_text_width(f_string_static_t *text) { - if (!text->string[0]) { - return; - } + if (!text->string[0]) return; text->used = 0; text->size = macro_f_utf_byte_width(text->string[0]); diff --git a/level_3/utf8/c/private-utf8_bytesequence.c b/level_3/utf8/c/private-utf8_bytesequence.c index 1024121..0266d14 100644 --- a/level_3/utf8/c/private-utf8_bytesequence.c +++ b/level_3/utf8/c/private-utf8_bytesequence.c @@ -10,15 +10,15 @@ extern "C" { #endif #ifndef _di_utf8_convert_bytesequence_ - f_status_t utf8_convert_bytesequence(utf8_data_t * const data, const f_string_static_t character) { + f_status_t utf8_convert_bytesequence(utf8_data_t * const data, const f_string_static_t sequence) { f_status_t status = F_none; bool valid_not = F_false; - uint32_t codepoint = 0; + f_utf_char_t codepoint = 0; - if (character.used) { - status = f_utf_unicode_to(character.string, character.used, &codepoint); + if (sequence.used) { + status = f_utf_unicode_to(sequence.string, sequence.used, &codepoint); } else { status = F_status_set_error(F_utf_not); @@ -30,25 +30,25 @@ extern "C" { if (status == F_failure || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_valid_not) { valid_not = F_true; - utf8_print_character_invalid(data, character); + utf8_print_character_invalid(data, sequence); } else { status = F_status_set_error(status); - utf8_print_error_decode(data, status, character); + utf8_print_error_decode(data, status, sequence); return status; } } else if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_none_e) { if (data->mode & utf8_mode_to_bytesequence_d) { - utf8_print_bytesequence(data, character); + utf8_print_bytesequence(data, sequence); } else if (data->mode & utf8_mode_to_codepoint_d) { utf8_print_codepoint(data, codepoint); } else { - utf8_print_combining_or_width(data, character); + utf8_print_combining_or_width(data, sequence); } } @@ -72,8 +72,8 @@ extern "C" { f_array_length_t i = 0; f_array_length_t j = 0; - f_char_t block_character[4] = { 0, 0, 0, 0 }; - f_string_static_t character = macro_f_string_static_t_initialize(block_character, 0, 4); + f_char_t block[4] = { 0, 0, 0, 0 }; + f_string_static_t sequence = macro_f_string_static_t_initialize(block, 0, 4); do { status = f_file_read_block(file, &data->buffer); @@ -98,23 +98,23 @@ extern "C" { // Get the current width only when processing a new block. if (next) { - character.used = macro_f_utf_byte_width(data->buffer.string[i]); + sequence.used = macro_f_utf_byte_width(data->buffer.string[i]); next = F_false; } - for (; j < character.used && i < data->buffer.used; ++j, ++i) { - character.string[j] = data->buffer.string[i]; + for (; j < sequence.used && i < data->buffer.used; ++j, ++i) { + sequence.string[j] = data->buffer.string[i]; } // for - if (j == character.used) { + if (j == sequence.used) { if (data->mode & utf8_mode_from_bytesequence_d) { - status = utf8_convert_bytesequence(data, character); + status = utf8_convert_bytesequence(data, sequence); } else { - status = utf8_detect_codepoint(data, character, &mode_codepoint); + status = utf8_detect_codepoint(data, sequence, &mode_codepoint); if (F_status_is_fine(status) && status != F_next) { - status = utf8_convert_codepoint(data, character, &mode_codepoint); + status = utf8_convert_codepoint(data, sequence, &mode_codepoint); } } @@ -132,18 +132,18 @@ extern "C" { } while (F_status_is_fine(status) && status != F_interrupt); - // Handle last (incomplete) character when the buffer ended before the character is supposed to end. + // Handle last (incomplete) sequence when the buffer ended before the sequence is supposed to end. if (F_status_is_error_not(status) && status != F_interrupt && next == F_false) { - character.used = j; + sequence.used = j; if (data->mode & utf8_mode_from_bytesequence_d) { - status = utf8_convert_bytesequence(data, character); + status = utf8_convert_bytesequence(data, sequence); } else { - status = utf8_detect_codepoint(data, character, &mode_codepoint); + status = utf8_detect_codepoint(data, sequence, &mode_codepoint); if (F_status_is_fine(status) && status != F_next) { - status = utf8_convert_codepoint(data, character, &mode_codepoint); + status = utf8_convert_codepoint(data, sequence, &mode_codepoint); } } diff --git a/level_3/utf8/c/private-utf8_bytesequence.h b/level_3/utf8/c/private-utf8_bytesequence.h index 127d6b2..b68cfe4 100644 --- a/level_3/utf8/c/private-utf8_bytesequence.h +++ b/level_3/utf8/c/private-utf8_bytesequence.h @@ -13,15 +13,15 @@ extern "C" { #endif /** - * Convert a bytesequence character to another format. + * Convert a byte sequence character to another format. * * This automatically determines the output format and is also handles the verify process. * * @param data * The program data. - * @param character - * The a single character to convert. - * This does not stop on NULL and will process all text until character.used. + * @param sequence + * A byte sequences representing a single character to convert. + * This does not stop on NULL and will process all text until sequence.used. * * @return * F_none on success. @@ -32,7 +32,7 @@ extern "C" { * Errors (with error bit) from: f_utf_unicode_to() */ #ifndef _di_utf8_convert_bytesequence_ - extern f_status_t utf8_convert_bytesequence(utf8_data_t * const data, const f_string_static_t character) F_attribute_visibility_internal_d; + extern f_status_t utf8_convert_bytesequence(utf8_data_t * const data, const f_string_static_t sequence) F_attribute_visibility_internal_d; #endif // _di_utf8_convert_bytesequence_ /** diff --git a/level_3/utf8/c/private-utf8_codepoint.c b/level_3/utf8/c/private-utf8_codepoint.c index fcf8427..ad09c7f 100644 --- a/level_3/utf8/c/private-utf8_codepoint.c +++ b/level_3/utf8/c/private-utf8_codepoint.c @@ -10,24 +10,24 @@ extern "C" { #endif #ifndef _di_utf8_convert_codepoint_ - f_status_t utf8_convert_codepoint(utf8_data_t * const data, const f_string_static_t character, uint8_t *mode) { + f_status_t utf8_convert_codepoint(utf8_data_t * const data, const f_string_static_t unicode, uint8_t *mode) { f_status_t status = F_none; bool valid_not = F_false; if (*mode != utf8_codepoint_mode_end_e) { - if (data->text.used + character.used >= data->text.size) { + if (data->text.used + unicode.used >= data->text.size) { status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &data->text); if (F_status_is_error(status)) return status; } - for (f_array_length_t i = 0; i < character.used; ++i) { - data->text.string[data->text.used++] = character.string[i]; + for (f_array_length_t i = 0; i < unicode.used; ++i) { + data->text.string[data->text.used++] = unicode.string[i]; } // for } if (*mode == utf8_codepoint_mode_end_e) { - uint32_t codepoint = 0; + f_utf_char_t codepoint = 0; status = f_utf_unicode_string_to(data->text.string, data->text.used, &codepoint); @@ -37,12 +37,12 @@ extern "C" { if (status == F_failure || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_valid_not) { valid_not = F_true; - utf8_print_character_invalid(data, character); + utf8_print_character_invalid(data, unicode); } else { status = F_status_set_error(status); - utf8_print_error_decode(data, status, character); + utf8_print_error_decode(data, status, unicode); return status; } @@ -53,9 +53,9 @@ extern "C" { } else { f_char_t byte[4] = { 0, 0, 0, 0 }; - f_string_static_t character = macro_f_string_static_t_initialize(byte, 0, 4); + f_string_static_t unicode = macro_f_string_static_t_initialize(byte, 0, 4); - status = f_utf_unicode_from(codepoint, 4, &character.string); + status = f_utf_unicode_from(codepoint, 4, &unicode.string); if (F_status_is_error(status)) { if (data->mode & utf8_mode_to_bytesequence_d) { @@ -67,14 +67,14 @@ extern "C" { } else if (data->mode & utf8_mode_to_bytesequence_d) { status = F_none; - character.used = macro_f_utf_byte_width(character.string[0]); + unicode.used = macro_f_utf_byte_width(unicode.string[0]); - utf8_print_bytesequence(data, character); + utf8_print_bytesequence(data, unicode); } else { status = F_none; - utf8_print_combining_or_width(data, character); + utf8_print_combining_or_width(data, unicode); } } } @@ -82,7 +82,7 @@ extern "C" { else if (*mode == utf8_codepoint_mode_bad_end_e) { status = F_none; - utf8_print_character_invalid(data, character); + utf8_print_character_invalid(data, unicode); } else { return F_none; @@ -100,19 +100,19 @@ extern "C" { #endif // _di_utf8_convert_codepoint_ #ifndef _di_utf8_convert_raw_ - f_status_t utf8_convert_raw(utf8_data_t * const data, const f_string_static_t character, uint8_t *mode) { + f_status_t utf8_convert_raw(utf8_data_t * const data, const f_string_static_t hex, uint8_t *mode) { f_status_t status = F_none; bool valid_not = F_false; if (*mode != utf8_codepoint_mode_raw_end_e) { - if (data->text.used + character.used >= data->text.size) { + if (data->text.used + hex.used >= data->text.size) { status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &data->text); if (F_status_is_error(status)) return status; } - for (f_array_length_t i = 0; i < character.used; ++i) { - data->text.string[data->text.used++] = character.string[i]; + for (f_array_length_t i = 0; i < hex.used; ++i) { + data->text.string[data->text.used++] = hex.string[i]; } // for } @@ -122,7 +122,7 @@ extern "C" { { f_number_unsigned_t number = 0; - status = fl_conversion_dynamic_to_number_unsigned(data->text, &number); + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->text, &number); raw = (f_utf_char_t) number; } @@ -133,12 +133,12 @@ extern "C" { if (status == F_number || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_number_decimal || status == F_number_negative || status == F_number_positive || status == F_number_overflow) { valid_not = F_true; - utf8_print_character_invalid(data, character); + utf8_print_character_invalid(data, hex); } else { status = F_status_set_error(status); - utf8_print_error_decode(data, status, character); + utf8_print_error_decode(data, status, hex); return status; } @@ -166,7 +166,7 @@ extern "C" { else if (*mode == utf8_codepoint_mode_bad_end_e) { status = F_none; - utf8_print_character_invalid(data, character); + utf8_print_character_invalid(data, hex); } else { return F_none; @@ -184,26 +184,26 @@ extern "C" { #endif // _di_utf8_convert_raw_ #ifndef _di_utf8_detect_codepoint_ - f_status_t utf8_detect_codepoint(utf8_data_t * const data, const f_string_static_t character, uint8_t *mode) { + f_status_t utf8_detect_codepoint(utf8_data_t * const data, const f_string_static_t unicode, uint8_t *mode) { // Skip past NULL. - if (!character.string[0]) { + if (!unicode.string[0]) { return F_next; } f_status_t status = F_none; - if (character.string[0] == f_string_ascii_u_s.string[0] || character.string[0] == f_string_ascii_U_s.string[0] || character.string[0] == f_string_ascii_plus_s.string[0]) { + if (unicode.string[0] == f_string_ascii_u_s.string[0] || unicode.string[0] == f_string_ascii_U_s.string[0] || unicode.string[0] == f_string_ascii_plus_s.string[0]) { // Do nothing. } - else if (character.string[0] == f_string_ascii_0_s.string[0] || character.string[0] == f_string_ascii_x_s.string[0] || character.string[0] == f_string_ascii_X_s.string[0]) { + else if (unicode.string[0] == f_string_ascii_0_s.string[0] || unicode.string[0] == f_string_ascii_x_s.string[0] || unicode.string[0] == f_string_ascii_X_s.string[0]) { // Do nothing. } - else if (character.string[0] == f_string_ascii_space_s.string[0]) { + else if (unicode.string[0] == f_string_ascii_space_s.string[0]) { status = F_space; } - else if (macro_f_utf_byte_width_is(*character.string)) { - status = f_utf_is_whitespace(character.string, 4); + else if (macro_f_utf_byte_width_is(*unicode.string)) { + status = f_utf_is_whitespace(unicode.string, 4); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_complete_not_utf || F_status_set_fine(status) == F_utf_fragment) { @@ -222,8 +222,8 @@ extern "C" { } } else { - if (character.string[0] < 0x30 || character.string[0] > (0x39 && character.string[0] < 0x41) || (character.string[0] > 0x46 && character.string[0] < 0x61) || character.string[0] > 0x66) { - status = f_utf_is_whitespace(character.string, 4); + if (unicode.string[0] < 0x30 || unicode.string[0] > (0x39 && unicode.string[0] < 0x41) || (unicode.string[0] > 0x46 && unicode.string[0] < 0x61) || unicode.string[0] > 0x66) { + status = f_utf_is_whitespace(unicode.string, 4); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_complete_not_utf || F_status_set_fine(status) == F_utf_fragment) { @@ -263,11 +263,11 @@ extern "C" { if (status == F_space) { status = F_next; } - else if (character.string[0] == f_string_ascii_u_s.string[0] || character.string[0] == f_string_ascii_U_s.string[0]) { + else if (unicode.string[0] == f_string_ascii_u_s.string[0] || unicode.string[0] == f_string_ascii_U_s.string[0]) { *mode = utf8_codepoint_mode_begin_e; data->text.used = 0; } - else if (character.string[0] == f_string_ascii_0_s.string[0]) { + else if (unicode.string[0] == f_string_ascii_0_s.string[0]) { *mode = utf8_codepoint_mode_raw_begin_e; data->text.used = 0; } @@ -276,7 +276,7 @@ extern "C" { } } else if (*mode == utf8_codepoint_mode_begin_e) { - if (character.string[0] == f_string_ascii_plus_s.string[0]) { + if (unicode.string[0] == f_string_ascii_plus_s.string[0]) { *mode = utf8_codepoint_mode_number_e; } else { @@ -284,7 +284,7 @@ extern "C" { } } else if (*mode == utf8_codepoint_mode_raw_begin_e) { - if (character.string[0] == f_string_ascii_x_s.string[0] || character.string[0] == f_string_ascii_X_s.string[0]) { + if (unicode.string[0] == f_string_ascii_x_s.string[0] || unicode.string[0] == f_string_ascii_X_s.string[0]) { *mode = utf8_codepoint_mode_raw_number_e; } else { @@ -319,7 +319,7 @@ extern "C" { f_array_length_t j = 0; f_char_t block[5] = { 0, 0, 0, 0, 0 }; - f_string_static_t character = macro_f_string_static_t_initialize(block, 0, 0); + f_string_static_t sequence = macro_f_string_static_t_initialize(block, 0, 0); do { status = f_file_read_block(file, &data->buffer); @@ -331,12 +331,12 @@ extern "C" { if (mode_codepoint == utf8_codepoint_mode_number_e) { mode_codepoint = utf8_codepoint_mode_end_e; - status = utf8_convert_codepoint(data, character, &mode_codepoint); + status = utf8_convert_codepoint(data, sequence, &mode_codepoint); } else if (mode_codepoint == utf8_codepoint_mode_raw_number_e) { mode_codepoint = utf8_codepoint_mode_raw_end_e; - status = utf8_convert_raw(data, character, &mode_codepoint); + status = utf8_convert_raw(data, sequence, &mode_codepoint); // Raw mode represents an invalid Unicode sequence. valid = F_false; @@ -369,30 +369,30 @@ extern "C" { // Get the current width only when processing a new block. if (next) { - character.used = macro_f_utf_byte_width(data->buffer.string[i]); + sequence.used = macro_f_utf_byte_width(data->buffer.string[i]); next = F_false; } - for (; j < character.used && i < data->buffer.used; ++j, ++i) { - character.string[j] = data->buffer.string[i]; + for (; j < sequence.used && i < data->buffer.used; ++j, ++i) { + sequence.string[j] = data->buffer.string[i]; } // for - if (j >= character.used) { + if (j >= sequence.used) { if (data->mode & utf8_mode_from_bytesequence_d) { - status = utf8_convert_bytesequence(data, character); + status = utf8_convert_bytesequence(data, sequence); } else { - status = utf8_detect_codepoint(data, character, &mode_codepoint); + status = utf8_detect_codepoint(data, sequence, &mode_codepoint); if (F_status_is_fine(status) && status != F_next) { if (mode_codepoint == utf8_codepoint_mode_raw_begin_e || mode_codepoint == utf8_codepoint_mode_raw_number_e || mode_codepoint == utf8_codepoint_mode_raw_end_e) { - status = utf8_convert_raw(data, character, &mode_codepoint); + status = utf8_convert_raw(data, sequence, &mode_codepoint); // Raw mode represents an invalid Unicode sequence. valid = F_false; } else { - status = utf8_convert_codepoint(data, character, &mode_codepoint); + status = utf8_convert_codepoint(data, sequence, &mode_codepoint); } } } @@ -412,23 +412,23 @@ extern "C" { // Handle last (incomplete) character when the buffer ended before the character is supposed to end. if (F_status_is_error_not(status) && status != F_interrupt && next == F_false) { - character.used = j; + sequence.used = j; if (data->mode & utf8_mode_from_bytesequence_d) { - status = utf8_convert_bytesequence(data, character); + status = utf8_convert_bytesequence(data, sequence); } else { - status = utf8_detect_codepoint(data, character, &mode_codepoint); + status = utf8_detect_codepoint(data, sequence, &mode_codepoint); if (F_status_is_fine(status) && status != F_next) { if (mode_codepoint == utf8_codepoint_mode_raw_begin_e || mode_codepoint == utf8_codepoint_mode_raw_number_e || mode_codepoint == utf8_codepoint_mode_raw_end_e) { - status = utf8_convert_raw(data, character, &mode_codepoint); + status = utf8_convert_raw(data, sequence, &mode_codepoint); // Raw mode represents an invalid Unicode sequence. valid = F_false; } else { - status = utf8_convert_codepoint(data, character, &mode_codepoint); + status = utf8_convert_codepoint(data, sequence, &mode_codepoint); } } } diff --git a/level_3/utf8/c/private-utf8_codepoint.h b/level_3/utf8/c/private-utf8_codepoint.h index 2954022..13298d9 100644 --- a/level_3/utf8/c/private-utf8_codepoint.h +++ b/level_3/utf8/c/private-utf8_codepoint.h @@ -19,8 +19,8 @@ extern "C" { * * @param data * The program data. - * @param character - * The a single character currently being processed. + * @param unicode + * A set of bytes representing a single codepoint character to process. * @param mode * The codepoint mode the text is currently in. * @@ -35,7 +35,7 @@ extern "C" { * @see f_utf_unicode_to() */ #ifndef _di_utf8_convert_codepoint_ - extern f_status_t utf8_convert_codepoint(utf8_data_t * const data, const f_string_static_t character, uint8_t *mode) F_attribute_visibility_internal_d; + extern f_status_t utf8_convert_codepoint(utf8_data_t * const data, const f_string_static_t unicode, uint8_t *mode) F_attribute_visibility_internal_d; #endif // _di_utf8_convert_codepoint_ /** @@ -45,8 +45,8 @@ extern "C" { * * @param data * The program data. - * @param character - * The a single character currently being processed. + * @param hex + * A set of bytes representing hexidecimal digits of a character to process. * @param mode * The codepoint mode the text is currently in. * @@ -56,12 +56,12 @@ extern "C" { * * F_valid_not (with error bit) if not verifying and the raw value is invalid. * - * Errors (with error bit) from: fl_conversion_dynamic_to_number_unsigned() + * Errors (with error bit) from: fl_conversion_dynamic_to_unsigned_detect() * - * @see fl_conversion_dynamic_to_number_unsigned() + * @see fl_conversion_dynamic_to_unsigned_detect() */ #ifndef _di_utf8_convert_raw_ - extern f_status_t utf8_convert_raw(utf8_data_t * const data, const f_string_static_t character, uint8_t *mode) F_attribute_visibility_internal_d; + extern f_status_t utf8_convert_raw(utf8_data_t * const data, const f_string_static_t hex, uint8_t *mode) F_attribute_visibility_internal_d; #endif // _di_utf8_convert_raw_ /** @@ -69,8 +69,8 @@ extern "C" { * * @param data * The program data. - * @param character - * The a single character to analyze. + * @param unicode + * A set of bytes representing a single codepoint character to process. * @param mode * Designate the mode in which the curent state is being processed. * @@ -82,7 +82,7 @@ extern "C" { * Errors (with error bit) from: f_utf_is_whitespace() */ #ifndef _di_utf8_detect_codepoint_ - extern f_status_t utf8_detect_codepoint(utf8_data_t * const data, const f_string_static_t character, uint8_t *mode) F_attribute_visibility_internal_d; + extern f_status_t utf8_detect_codepoint(utf8_data_t * const data, const f_string_static_t unicode, uint8_t *mode) F_attribute_visibility_internal_d; #endif // _di_utf8_detect_codepoint_ /** -- 1.8.3.1