From dda60cc8d9cad69b55e7d79b4c052677b03b4413 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 28 Mar 2022 22:38:43 -0500 Subject: [PATCH] Update: Finish writing tests, fix endianness, simplify some code. Now that f_char_t exists and is in use, rename f_utf_character_t to f_utf_char_t to be consistent (and simpler). The endianness detection is incorrect. The BIG_ENDIAN is not represented as expected. Change the detection to use GCC's __BYTE_ORDER__ macros. Fallback to little endian if those macros are not available. It took a while to figure out this was the problem and I got rather confused going back and forth between byte orders. I think the changes I made are correct, but I need additional better testing on the byte orders. --- level_0/f_console/c/console.c | 4 +- level_0/f_conversion/c/private-conversion.c | 2 +- level_0/f_print/c/print.c | 6 +- level_0/f_print/c/print/private-to.c | 16 +- level_0/f_print/c/print/to.c | 2 +- level_0/f_print/c/private-print.c | 18 +- level_0/f_status/c/status.h | 14 +- level_0/f_string/c/private-string.c | 10 +- .../c/test-string-dynamic_partial_append_assure.c | 2 - level_0/f_utf/c/private-utf.c | 300 ++++++++++----------- level_0/f_utf/c/private-utf.h | 62 ++--- level_0/f_utf/c/utf/common.h | 133 +++++---- level_0/f_utf/c/utf/convert.c | 58 ++-- level_0/f_utf/c/utf/convert.h | 36 +-- level_0/f_utf/c/utf/dynamic.c | 10 +- level_0/f_utf/c/utf/is.c | 54 ++-- level_0/f_utf/c/utf/is_character.c | 198 +++++++------- level_0/f_utf/c/utf/is_character.h | 58 ++-- level_0/f_utf/c/utf/private-dynamic.c | 4 +- level_0/f_utf/c/utf/private-is_unassigned.c | 8 +- level_0/f_utf/c/utf/private-is_unassigned.h | 2 +- level_0/f_utf/c/utf/private-string.c | 22 +- level_0/f_utf/c/utf/string.c | 10 +- level_0/f_utf/tests/unit/c/test-utf-append.c | 7 +- .../f_utf/tests/unit/c/test-utf-append_assure.c | 12 +- .../tests/unit/c/test-utf-append_assure_nulless.c | 12 +- .../f_utf/tests/unit/c/test-utf-append_nulless.c | 8 +- .../f_utf/tests/unit/c/test-utf-dynamic_append.c | 7 +- .../tests/unit/c/test-utf-dynamic_append_assure.c | 12 +- .../c/test-utf-dynamic_append_assure_nulless.c | 12 +- .../tests/unit/c/test-utf-dynamic_append_nulless.c | 8 +- level_0/f_utf/tests/unit/c/test-utf-dynamic_mash.c | 21 +- .../tests/unit/c/test-utf-dynamic_mash_nulless.c | 20 +- level_0/f_utf/tests/unit/c/test-utf-dynamic_mish.c | 21 +- .../tests/unit/c/test-utf-dynamic_mish_nulless.c | 20 +- .../tests/unit/c/test-utf-dynamic_partial_append.c | 13 +- .../c/test-utf-dynamic_partial_append_assure.c | 18 +- ...est-utf-dynamic_partial_append_assure_nulless.c | 16 +- .../c/test-utf-dynamic_partial_append_nulless.c | 12 +- .../tests/unit/c/test-utf-dynamic_partial_mash.c | 27 +- .../unit/c/test-utf-dynamic_partial_mash_nulless.c | 24 +- .../tests/unit/c/test-utf-dynamic_partial_mish.c | 27 +- .../unit/c/test-utf-dynamic_partial_mish_nulless.c | 24 +- .../unit/c/test-utf-dynamic_partial_prepend.c | 13 +- .../c/test-utf-dynamic_partial_prepend_assure.c | 18 +- ...st-utf-dynamic_partial_prepend_assure_nulless.c | 16 +- .../c/test-utf-dynamic_partial_prepend_nulless.c | 12 +- .../f_utf/tests/unit/c/test-utf-dynamic_prepend.c | 7 +- .../tests/unit/c/test-utf-dynamic_prepend_assure.c | 12 +- .../c/test-utf-dynamic_prepend_assure_nulless.c | 12 +- .../unit/c/test-utf-dynamic_prepend_nulless.c | 8 +- .../tests/unit/c/test-utf-dynamic_seek_line.c | 18 +- .../tests/unit/c/test-utf-dynamic_seek_line_to.c | 34 +-- .../f_utf/tests/unit/c/test-utf-dynamic_seek_to.c | 28 +- .../tests/unit/c/test-utf-dynamic_terminate.c | 2 +- .../unit/c/test-utf-dynamic_terminate_after.c | 2 +- .../f_utf/tests/unit/c/test-utf-dynamics_append.c | 7 +- .../tests/unit/c/test-utf-dynamics_append_all.c | 15 +- .../f_utf/tests/unit/c/test-utf-dynamicss_append.c | 15 +- .../tests/unit/c/test-utf-dynamicss_append_all.c | 13 +- .../tests/unit/c/test-utf-map_multis_append.c | 32 ++- .../tests/unit/c/test-utf-map_multis_append_all.c | 6 +- .../tests/unit/c/test-utf-map_multiss_append.c | 12 +- .../tests/unit/c/test-utf-map_multiss_append_all.c | 12 +- level_0/f_utf/tests/unit/c/test-utf-maps_append.c | 4 +- .../f_utf/tests/unit/c/test-utf-maps_append_all.c | 4 +- level_0/f_utf/tests/unit/c/test-utf-mapss_append.c | 8 +- .../f_utf/tests/unit/c/test-utf-mapss_append_all.c | 8 +- level_0/f_utf/tests/unit/c/test-utf-mash.c | 21 +- level_0/f_utf/tests/unit/c/test-utf-mash_nulless.c | 20 +- level_0/f_utf/tests/unit/c/test-utf-mish.c | 21 +- level_0/f_utf/tests/unit/c/test-utf-mish_nulless.c | 20 +- level_0/f_utf/tests/unit/c/test-utf-prepend.c | 7 +- .../f_utf/tests/unit/c/test-utf-prepend_assure.c | 12 +- .../tests/unit/c/test-utf-prepend_assure_nulless.c | 12 +- .../f_utf/tests/unit/c/test-utf-prepend_nulless.c | 8 +- level_0/f_utf/tests/unit/c/test-utf-seek_line.c | 14 +- level_0/f_utf/tests/unit/c/test-utf-seek_line_to.c | 28 +- level_0/f_utf/tests/unit/c/test-utf-seek_to.c | 22 +- .../f_utf/tests/unit/c/test-utf-triples_append.c | 6 +- .../tests/unit/c/test-utf-triples_append_all.c | 12 +- .../f_utf/tests/unit/c/test-utf-tripless_append.c | 12 +- .../tests/unit/c/test-utf-tripless_append_all.c | 24 +- level_1/fl_string/c/string.c | 24 +- level_1/fl_string/c/string.h | 8 +- level_1/fl_utf/c/utf.c | 58 ++-- level_1/fl_utf/c/utf.h | 8 +- level_1/fl_utf_file/c/private-utf_file.c | 24 +- level_3/byte_dump/c/private-byte_dump.c | 54 ++-- 89 files changed, 1119 insertions(+), 964 deletions(-) diff --git a/level_0/f_console/c/console.c b/level_0/f_console/c/console.c index 1b0aaa1..bfaac29 100644 --- a/level_0/f_console/c/console.c +++ b/level_0/f_console/c/console.c @@ -333,8 +333,8 @@ extern "C" { if (arguments.argv[location][sub_location] != *parameters->array[i].symbol_short) continue; if (width > 0) { - f_utf_character_t character_argument_utf = 0; - f_utf_character_t character_console_utf = 0; + f_utf_char_t character_argument_utf = 0; + f_utf_char_t character_console_utf = 0; f_number_unsigned_t width_max = parameters->arguments.array[location].used - sub_location; diff --git a/level_0/f_conversion/c/private-conversion.c b/level_0/f_conversion/c/private-conversion.c index c8e7576..7d92665 100644 --- a/level_0/f_conversion/c/private-conversion.c +++ b/level_0/f_conversion/c/private-conversion.c @@ -109,7 +109,7 @@ extern "C" { } #ifdef _is_F_endian_big - work <<= 1; // @todo review this and see if there is more that needs to be done. + work <<= 1; #else work >>= 1; #endif // _is_F_endian_big diff --git a/level_0/f_print/c/print.c b/level_0/f_print/c/print.c index 0baa021..49bd6c3 100644 --- a/level_0/f_print/c/print.c +++ b/level_0/f_print/c/print.c @@ -44,12 +44,12 @@ extern "C" { return F_none; } } - else if (macro_f_utf_character_t_width_is(character) == 1) { + else if (macro_f_utf_char_t_width_is(character) == 1) { if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, output) == f_print_sequence_unknown_s.used) { return F_none; } } - else if (macro_f_utf_character_t_width_is(character) > 1 || character > 0x1f) { + else if (macro_f_utf_char_t_width_is(character) > 1 || character > 0x1f) { if (fwrite_unlocked(&character, 1, 1, output)) { return F_utf; } @@ -659,7 +659,7 @@ extern "C" { for (register f_array_length_t i = 0; string[i]; ) { safe.used = 0; - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); if (width > 1) { if (string[i + 1]) { diff --git a/level_0/f_print/c/print/private-to.c b/level_0/f_print/c/print/private-to.c index 8bf31fc..ca5da00 100644 --- a/level_0/f_print/c/print/private-to.c +++ b/level_0/f_print/c/print/private-to.c @@ -72,12 +72,12 @@ static inline f_status_t private_inline_f_print_to_error(void) { return F_none; } } - else if (macro_f_utf_character_t_width_is(character) == 1) { + else if (macro_f_utf_char_t_width_is(character) == 1) { if (write(id, f_print_sequence_unknown_s.string, f_print_sequence_unknown_s.used) != -1) { return F_none; } } - else if (macro_f_utf_character_t_width_is(character) > 1 || character > 0x1f) { + else if (macro_f_utf_char_t_width_is(character) > 1 || character > 0x1f) { if (write(id, &character, 1) != -1) { return F_none; } @@ -216,7 +216,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { } if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -292,7 +292,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { } if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -553,7 +553,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { } if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -659,7 +659,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { } if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -777,7 +777,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { while (i < length) { if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -844,7 +844,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { while (i < length) { if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } diff --git a/level_0/f_print/c/print/to.c b/level_0/f_print/c/print/to.c index 0506161..45f93d4 100644 --- a/level_0/f_print/c/print/to.c +++ b/level_0/f_print/c/print/to.c @@ -516,7 +516,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { for (register f_array_length_t i = 0; string[i]; ) { safe = f_string_empty_s; - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); if (width > 1) { if (string[i + 1]) { diff --git a/level_0/f_print/c/private-print.c b/level_0/f_print/c/private-print.c index c06505f..8cb5c09 100644 --- a/level_0/f_print/c/private-print.c +++ b/level_0/f_print/c/private-print.c @@ -55,11 +55,11 @@ extern "C" { return f_print_sequence_delete_s; } - if (macro_f_utf_character_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(character) == 1) { return f_print_sequence_unknown_s; } - if (macro_f_utf_character_t_width_is(character) > 1 || character > 0x1f) { + if (macro_f_utf_char_t_width_is(character) > 1 || character > 0x1f) { return f_string_empty_s; } @@ -403,7 +403,7 @@ extern "C" { } if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -555,7 +555,7 @@ extern "C" { } if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -761,7 +761,7 @@ extern "C" { } if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -871,7 +871,7 @@ extern "C" { } if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -1027,7 +1027,7 @@ extern "C" { while (i < length) { if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -1125,7 +1125,7 @@ extern "C" { while (i < length) { if (string[i]) { - width = macro_f_utf_character_t_width(string[i]); + width = macro_f_utf_char_t_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -1227,7 +1227,7 @@ extern "C" { return f_print_sequence_delete_s; } - if (macro_f_utf_character_t_width_is(character[0])) { + if (macro_f_utf_char_t_width_is(character[0])) { if (f_utf_is_valid(character, width_max) != F_true || f_utf_is_control(character, width_max)) { return f_print_sequence_unknown_s; } diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index 9feaaa5..02827ca 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -25,13 +25,21 @@ extern "C" { * This is placed here because status is first and endianness must be set before everything else. * * Define either _is_F_endian_big or _is_F_endian_little (but not both) to override compiler detected endianness or to manually set endianness if not detected. + * + * Fallback to little endian if unable to detect. + * + * Manually define _is_F_endian_big or _is_F_endian_little to control this rather than relying on autodetection. */ #if !defined(_is_F_endian_big) && !defined(_is_F_endian_little) - #ifdef BIG_ENDIAN - #define _is_F_endian_big + #ifdef __BYTE_ORDER__ + #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + #define _is_F_endian_big + #else + #define _is_F_endian_little + #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #else #define _is_F_endian_little - #endif // BIG_ENDIAN + #endif // __BYTE_ORDER__ #endif // !defined(_is_F_endian_big) && !defined(_is_F_endian_little) /** diff --git a/level_0/f_string/c/private-string.c b/level_0/f_string/c/private-string.c index 8636c97..3c4ca5a 100644 --- a/level_0/f_string/c/private-string.c +++ b/level_0/f_string/c/private-string.c @@ -86,7 +86,7 @@ extern "C" { } if (destination->used) { - memmove(destination->string + length, destination->string, destination->used); + memmove(destination->string + length, destination->string, sizeof(f_char_t) * destination->used); memcpy(destination->string, source, sizeof(f_char_t) * length); } else { @@ -94,6 +94,7 @@ extern "C" { } destination->used += length; + return F_none; } #endif // !defined(_di_f_string_dynamic_mish_) || !defined(_di_f_string_dynamic_partial_mish_) || !defined(_di_f_string_dynamic_partial_prepend_assure_) || !defined(_di_f_string_dynamic_partial_prepend_) || !defined(_di_f_string_dynamic_prepend_assure_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_mish_) || !defined(_di_f_string_prepend_assure_) || !defined(_di_f_string_prepend_) @@ -123,8 +124,8 @@ extern "C" { if (F_status_is_error(status)) return status; } - memmove(destination->string + offset + size, destination->string + offset, destination->used - offset); - memcpy(destination->string + offset, source + first, size); + memmove(destination->string + offset + size, destination->string + offset, sizeof(f_char_t) * (destination->used - offset)); + memcpy(destination->string + offset, source + first, sizeof(f_char_t) * size); destination->used += size; offset += size; @@ -143,7 +144,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - memmove(destination->string + offset + size, destination->string + offset, destination->used - offset); + memmove(destination->string + offset + size, destination->string + offset, sizeof(f_char_t) * (destination->used - offset)); memcpy(destination->string + offset, source + first, sizeof(f_char_t) * size); destination->used += size; @@ -156,6 +157,7 @@ extern "C" { } // while first = i + 1; + continue; } } // for diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_partial_append_assure.c b/level_0/f_string/tests/unit/c/test-string-dynamic_partial_append_assure.c index 9ef06cc..bea0174 100644 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_partial_append_assure.c +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_partial_append_assure.c @@ -26,8 +26,6 @@ void test__f_string_dynamic_partial_append_assure__works(void **state) { { const f_status_t status = f_string_dynamic_partial_append_assure(source, partial, &destination); - printf("\nDEBUG: [%d]='%s %s'\n", destination.used, destination.string, destination.string + 3); - assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); diff --git a/level_0/f_utf/c/private-utf.c b/level_0/f_utf/c/private-utf.c index bd80c9b..5ba9cd9 100644 --- a/level_0/f_utf/c/private-utf.c +++ b/level_0/f_utf/c/private-utf.c @@ -6,10 +6,10 @@ extern "C" { #endif #if !defined(_di_f_utf_char_to_character_) || !defined(_di_f_utf_is_alpha_) || !defined(_di_f_utf_is_alpha_digit_) || !defined(_di_f_utf_is_alpha_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_character_t *character_utf) { + 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 (!macro_f_utf_byte_width_is(*character)) { - *character_utf = macro_f_utf_character_t_from_char_1(character[0]); + *character_utf = macro_f_utf_char_t_from_char_1(character[0]); return F_none; } @@ -22,32 +22,32 @@ extern "C" { return F_status_set_error(F_failure); } - *character_utf = macro_f_utf_character_t_from_char_1(character[0]); + *character_utf = macro_f_utf_char_t_from_char_1(character[0]); if (macro_f_utf_byte_width_is(*character) < 2) { return F_none; } - *character_utf |= macro_f_utf_character_t_from_char_2(character[1]); + *character_utf |= macro_f_utf_char_t_from_char_2(character[1]); if (macro_f_utf_byte_width_is(*character) == 2) { return F_none; } - *character_utf |= macro_f_utf_character_t_from_char_3(character[2]); + *character_utf |= macro_f_utf_char_t_from_char_3(character[2]); if (macro_f_utf_byte_width_is(*character) == 3) { return F_none; } - *character_utf |= macro_f_utf_character_t_from_char_4(character[3]); + *character_utf |= macro_f_utf_char_t_from_char_4(character[3]); return F_none; } #endif // !defined(_di_f_utf_char_to_character_) || !defined(_di_f_utf_is_alpha_) || !defined(_di_f_utf_is_alpha_digit_) || !defined(_di_f_utf_is_alpha_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_character_is_alpha_) || !defined(_di_f_utf_is_alpha_) - f_status_t private_f_utf_character_is_alpha(const f_utf_character_t character) { + f_status_t private_f_utf_character_is_alpha(const f_utf_char_t character) { if (private_f_utf_character_is_zero_width(character)) { return F_false; @@ -95,7 +95,7 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_alpha_) || !defined(_di_f_utf_is_alpha_) #if !defined(_di_f_utf_character_is_alpha_digit_) || !defined(_di_f_utf_is_alpha_digit_) - f_status_t private_f_utf_character_is_alpha_digit(const f_utf_character_t character) { + f_status_t private_f_utf_character_is_alpha_digit(const f_utf_char_t character) { if (private_f_utf_character_is_digit(character)) { return F_true; @@ -143,7 +143,7 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_alpha_digit_) || !defined(_di_f_utf_is_alpha_digit_) #if !defined(_di_f_utf_character_is_alpha_numeric_) || !defined(_di_f_utf_is_alpha_numeric_) - f_status_t private_f_utf_character_is_alpha_numeric(const f_utf_character_t character) { + f_status_t private_f_utf_character_is_alpha_numeric(const f_utf_char_t character) { if (private_f_utf_character_is_numeric(character)) { return F_true; @@ -187,10 +187,10 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_alpha_numeric_) || !defined(_di_f_utf_is_alpha_numeric_) #if !defined(_di_f_utf_character_is_ascii_) || !defined(_di_f_utf_is_ascii_) - f_status_t private_f_utf_character_is_ascii(const f_utf_character_t character) { + f_status_t private_f_utf_character_is_ascii(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) < 2) { - if (macro_f_utf_character_t_to_char_1(character) >= 0x00 && macro_f_utf_character_t_to_char_1(character) <= 0x7f) { + if (macro_f_utf_char_t_width_is(character) < 2) { + if (macro_f_utf_char_t_to_char_1(character) >= 0x00 && macro_f_utf_char_t_to_char_1(character) <= 0x7f) { return F_true; } } @@ -200,9 +200,9 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_ascii_) || !defined(_di_f_utf_is_ascii_) #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_character_t character) { + f_status_t private_f_utf_character_is_combining(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(character) == 2) { // Diacritical Marks: U+0300 to U+036F. if (character >= 0xcc800000 && character <= 0xcdaf0000) { @@ -287,7 +287,7 @@ extern "C" { return F_false; } - if (macro_f_utf_character_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(character) == 3) { // Samaritan: U+0816 to U+0819. if (character >= 0xe0a09600 && character <= 0xe0a09900) { @@ -1337,9 +1337,9 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_combining_) || !defined(_di_f_utf_is_combining_) #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_character_t character) { + f_status_t private_f_utf_character_is_control(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(character) == 2) { // Control Codes. @@ -1370,7 +1370,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_width_is(character) == 3) { + else if (macro_f_utf_char_t_width_is(character) == 3) { // Control Formats. @@ -1414,7 +1414,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_width_is(character) == 4) { + else if (macro_f_utf_char_t_width_is(character) == 4) { // Control Formats. @@ -1454,9 +1454,9 @@ 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_character_t character) { + f_status_t private_f_utf_character_is_control_code(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(character) == 2) { // Latin-1 Supplement: U+0080 to U+009F. if (character >= 0xc2800000 && character <= 0xc29f0000) { @@ -1469,9 +1469,9 @@ 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_character_t character) { + f_status_t private_f_utf_character_is_control_format(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(character) == 2) { // Latin-1 Supplement: U+00AD. if (character == 0xc2ad0000) { @@ -1493,7 +1493,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_width_is(character) == 3) { + else if (macro_f_utf_char_t_width_is(character) == 3) { // Arabic Extended-A: U+08E2. if (character == 0xe0a3a200) { @@ -1535,7 +1535,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_width_is(character) == 4) { + else if (macro_f_utf_char_t_width_is(character) == 4) { // Kaithi: U+110BD, U+110CD. if (character == 0xf09182bd || character == 0xf091838d) { @@ -1573,9 +1573,9 @@ 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_character_t character) { + f_status_t private_f_utf_character_is_control_picture(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(character) == 3) { // Control Pictures: U+2400 to U+2426. if (character >= 0xe2908000 && character <= 0xe290a600) { @@ -1593,9 +1593,9 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_control_picture_) || !defined(_di_f_utf_is_control_picture_) #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_character_t character) { + f_status_t private_f_utf_character_is_digit(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(character) == 2) { uint16_t bytes = (uint16_t) ((character & 0xffff0000) >> 16); // Arabic: U+0660 to U+0669. @@ -1616,10 +1616,10 @@ extern "C" { return F_false; } - if (macro_f_utf_character_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(character) == 3) { uint16_t bytes = (uint16_t) ((character & 0x00ffff00) >> 8); - if (macro_f_utf_character_t_to_char_1(character) == 0xe0) { + if (macro_f_utf_char_t_to_char_1(character) == 0xe0) { // Devanagari: U+0966 to U+096F. if (bytes >= 0xa5a6 && bytes <= 0xa5af) { @@ -1696,7 +1696,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xe1) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xe1) { // Khmer: U+17E0 to U+17E9. if (bytes >= 0x9fa0 && bytes <= 0x9fa9) { @@ -1748,7 +1748,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xea) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xea) { // Vai: U+A620 to U+A629. if (bytes >= 0x98a0 && bytes <= 0x98a9) { @@ -1785,7 +1785,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xef) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xef) { // Halfwidth and Fullwidth Forms: U+FF10 to U+FF19. if (bytes >= 0xbc90 && bytes <= 0xbc99) { @@ -1796,11 +1796,11 @@ extern "C" { return F_false; } - if (macro_f_utf_character_t_width_is(character) == 4) { + if (macro_f_utf_char_t_width_is(character) == 4) { uint16_t bytes = (uint16_t) ((character & 0xffff0000) >> 16); - if (macro_f_utf_character_t_to_char_1(character) == 0xf0) { - if (macro_f_utf_character_t_to_char_2(character) == 0x90) { + if (macro_f_utf_char_t_to_char_1(character) == 0xf0) { + if (macro_f_utf_char_t_to_char_2(character) == 0x90) { // Osmanya: U+104A0 to U+104A9. if (bytes >= 0x92a0 && bytes <= 0x92a9) { @@ -1812,7 +1812,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_2(character) == 0x91) { + else if (macro_f_utf_char_t_to_char_2(character) == 0x91) { // Brahmi: U+11066 to U+1106F. if (bytes >= 0x81a6 && bytes <= 0x81af) { @@ -1889,7 +1889,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_2(character) == 0x96) { + else if (macro_f_utf_char_t_to_char_2(character) == 0x96) { // Mro: U+16A60 to U+16A69. if (bytes >= 0xa9a0 && bytes <= 0xa9a9) { @@ -1901,7 +1901,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_2(character) == 0x9d) { + else if (macro_f_utf_char_t_to_char_2(character) == 0x9d) { // Mathematical Alphanumeric (Bold) Symbols: U+1D7CE to U+1D7D7. if (bytes >= 0x9f8e && bytes <= 0x9f97) { @@ -1928,7 +1928,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_2(character) == 0x9e) { + else if (macro_f_utf_char_t_to_char_2(character) == 0x9e) { // Nyiakeng Puachue Hmong: U+1E140 to U+1E149. if (bytes >= 0x8580 && bytes <= 0x8589) { @@ -1945,7 +1945,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_2(character) == 0x9f) { + else if (macro_f_utf_char_t_to_char_2(character) == 0x9f) { // Symbols for Legacy Computing (Segmented): U+1FBF0 to U+1FBF9. if (bytes >= 0xafb0 && bytes <= 0xafb9) { @@ -1960,9 +1960,9 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_digit_) || !defined(_di_f_utf_is_digit_) #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_character_t character) { + f_status_t private_f_utf_character_is_emoji(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(character) == 2) { // Latin-1 Supplement: U+00A9, U+00AE. if (character == 0xc2a90000 || character == 0xc2ae0000) { @@ -1972,7 +1972,7 @@ extern "C" { return F_false; } - if (macro_f_utf_character_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(character) == 3) { // General Punctuation: U+203C, U+2049. if (character == 0xe280bc00 || character == 0xe2818900) { @@ -2207,7 +2207,7 @@ extern "C" { return F_false; } - if (macro_f_utf_character_t_width_is(character) == 4) { + if (macro_f_utf_char_t_width_is(character) == 4) { // U+1F0CF to U+1F171. if (character >= 0xf09f8084 && character <= 0xf09f85b1) { @@ -2450,7 +2450,7 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_emoji_) || !defined(_di_f_utf_is_emoji_) #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_character_t character) { + f_status_t private_f_utf_character_is_numeric(const f_utf_char_t character) { if (private_f_utf_character_is_digit(character)) { return F_true; @@ -2459,14 +2459,14 @@ extern "C" { // @todo add letter UTF-8 numbers. // @todo add other UTF-8 numbers. - if (macro_f_utf_character_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(character) == 3) { // Number Forms: U+2150 to U+218B. if (character >= 0xe2859000 && character <= 0xe2868b00) { return F_true; } } - else if (macro_f_utf_character_t_width_is(character) == 4) { + else if (macro_f_utf_char_t_width_is(character) == 4) { // Coptic Epact Numbers: U+102E1 to U+102FB. if (character >= 0xf0908ba1 && character <= 0xf0908bbb) { @@ -2479,9 +2479,9 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_numeric_) || !defined(_di_f_utf_is_numeric_) #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_character_t character) { + f_status_t private_f_utf_character_is_phonetic(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(character) == 3) { // Phonetic Extensions: U+1D00 to U+1D7F. if (character >= 0xe1b48000 && character <= 0xe1b5bf00) { @@ -2499,13 +2499,13 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_phonetic_) || !defined(_di_f_utf_is_phonetic_) #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_character_t character) { + f_status_t private_f_utf_character_is_private(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) < 3) { + if (macro_f_utf_char_t_width_is(character) < 3) { return F_false; } - if (macro_f_utf_character_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(character) == 3) { // High Private Use Surrogates: U+DB80 to U+DBFF. if (character >= 0xedae8000 && character <= 0xedafbf00) { @@ -2535,11 +2535,11 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_private_) || !defined(_di_f_utf_is_private_) #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_character_t character) { + f_status_t private_f_utf_character_is_punctuation(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(character) == 2) { - if (macro_f_utf_character_t_to_char_1(character) == 0xc2) { + if (macro_f_utf_char_t_to_char_1(character) == 0xc2) { // Latin-1 Supplement: U+00A1, U+00A7, U+00B6, U+00B7. if (character == 0xc2a10000 || character == 0xc2a70000 || character == 0xc2b60000 || character == 0xc2b70000) { return F_true; @@ -2550,35 +2550,35 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xcd) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xcd) { // Greek and Coptic: U+037E if (character == 0xcdbe0000) { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xce) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xce) { // Greek and Coptic: U+0387 if (character == 0xce870000) { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xd5) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xd5) { // Armenian: U+055A to U+055 if (character >= 0xd59a0000 && character <= 0xd59f0000) { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xd6) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xd6) { // Armenian: U+0589 if (character == 0xd6890000) { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xd7) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xd7) { // Hebrew: U+05C0, U+05C3, U+05C6, U+05F3. if (character == 0xd7800000 || character == 0xd7830000 || character == 0xd7860000 || character == 0xd7b30000) { @@ -2590,14 +2590,14 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xd8) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xd8) { // Arabic: U+0609, U+060A, U+060C, U+060D. if (character == 0xd8890000 || character == 0xd88a0000 || character == 0xd88c0000 || character == 0xd88d0000) { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xd9) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xd9) { // Arabic: U+061B, U+061E, U+061F, U+06D4. if (character == 0xd89b0000 || character == 0xd89e0000 || character == 0xd89f0000 || character == 0xdb940000) { @@ -2609,14 +2609,14 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xdc) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xdc) { // Syriac: U+0700 to U+070D. if (character >= 0xdc800000 && character <= 0xdc8d0000) { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xdf) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xdf) { // NKo: U+07F7 to U+07F9. if (character >= 0xdfb70000 && character <= 0xdfb90000) { @@ -2624,9 +2624,9 @@ extern "C" { } } } - else if (macro_f_utf_character_t_width_is(character) == 3) { + else if (macro_f_utf_char_t_width_is(character) == 3) { - if (macro_f_utf_character_t_to_char_1(character) == 0xe0) { + if (macro_f_utf_char_t_to_char_1(character) == 0xe0) { // Samaritan: U+0830 to U+083E. if (character >= 0xe0a0b000 && character <= 0xe0a0be00) { @@ -2693,7 +2693,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xe1) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xe1) { // Myanmar: U+104A to U+104F. if (character >= 0xe1818a00 && character <= 0xe1818f00) { @@ -2790,7 +2790,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xe2) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { // General Punctuation: U+2010 to U+2027. if (character >= 0xe2809000 && character <= 0xe280a700) { @@ -2817,7 +2817,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xe3) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xe3) { // CJK Symbols and Punctuation: U+3001 to U+3003. if (character >= 0xe3808100 && character <= 0xe3808300) { @@ -2829,7 +2829,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xea) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xea) { // Lisu: U+A4FE, U+A4FF. if (character == 0xea93be00 || character == 0xea93bf00) { @@ -2901,7 +2901,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xef) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xef) { // Vertical Forms: U+FE10 to U+FE19. if (character >= 0xefb89000 && character <= 0xefb89900) { @@ -2959,9 +2959,9 @@ extern "C" { } } } - else if (macro_f_utf_character_t_width_is(character) == 4) { - if (macro_f_utf_character_t_to_char_1(character) == 0xf0) { - if (macro_f_utf_character_t_to_char_2(character) == 0x90) { + else if (macro_f_utf_char_t_width_is(character) == 4) { + if (macro_f_utf_char_t_to_char_1(character) == 0xf0) { + if (macro_f_utf_char_t_to_char_2(character) == 0x90) { // Aegean Numbers: U+10100 to U+10102. if (character >= 0xf0908480 && character <= 0xf0908482) { @@ -3028,7 +3028,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_2(character) == 0x91) { + else if (macro_f_utf_char_t_to_char_2(character) == 0x91) { // Brahmi: U+11047 to U+1104D. if (character >= 0xf0918187 && character <= 0xf091818d) { @@ -3140,14 +3140,14 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_2(character) == 0x92) { + else if (macro_f_utf_char_t_to_char_2(character) == 0x92) { // Cuneiform Numbers and Punctuation: U+12470 to U+12474. if (character >= 0xf09291b0 && character <= 0xf09291b4) { return F_true; } } - else if (macro_f_utf_character_t_to_char_2(character) == 0x96) { + else if (macro_f_utf_char_t_to_char_2(character) == 0x96) { // Mro: U+16A6E, U+16A6F. if (character == 0xf096a9ae || character == 0xf096a9af) { @@ -3197,9 +3197,9 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_punctuation_) || !defined(_di_f_utf_is_punctuation_) #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_character_t character) { + f_status_t private_f_utf_character_is_surrogate(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(character) == 3) { // High Surrogates: U+D800 to U+DB7F. if (character >= 0xeda08000 && character <= 0xedadbf00) { @@ -3222,7 +3222,7 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_surrogate_) || !defined(_di_f_utf_is_surrogate_) #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_character_t character) { + f_status_t private_f_utf_character_is_symbol(const f_utf_char_t character) { // @todo handle all Unicode "symbol". @@ -3231,69 +3231,69 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_symbol_) || !defined(_di_f_utf_is_symbol_) #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_character_t character) { + f_status_t private_f_utf_character_is_valid(const f_utf_char_t character) { // @todo Check to see if this logic handles U+FDD0 to U+FDEF and any character ending in FFFE or FFFF. // Codes U+FDD0 to U+FDEF are: 0xefb79000 to 0xefb7af00. - if (macro_f_utf_character_t_width_is(character) < 2) { - if (macro_f_utf_character_t_to_char_1(character) >= 0x00 && macro_f_utf_character_t_to_char_1(character) <= 0x7f) { + if (macro_f_utf_char_t_width_is(character) < 2) { + if (macro_f_utf_char_t_to_char_1(character) >= 0x00 && macro_f_utf_char_t_to_char_1(character) <= 0x7f) { return F_true; } } - else if (macro_f_utf_character_t_width_is(character) == 2) { - if (macro_f_utf_character_t_to_char_1(character) >= 0xc2 && macro_f_utf_character_t_to_char_1(character) <= 0xdf) { - if (macro_f_utf_character_t_to_char_2(character) >= 0x80 && macro_f_utf_character_t_to_char_2(character) <= 0xbf) { + else if (macro_f_utf_char_t_width_is(character) == 2) { + if (macro_f_utf_char_t_to_char_1(character) >= 0xc2 && macro_f_utf_char_t_to_char_1(character) <= 0xdf) { + if (macro_f_utf_char_t_to_char_2(character) >= 0x80 && macro_f_utf_char_t_to_char_2(character) <= 0xbf) { return F_true; } } } - else if (macro_f_utf_character_t_width_is(character) == 3) { - if (macro_f_utf_character_t_to_char_1(character) == 0xe0) { - if (macro_f_utf_character_t_to_char_2(character) >= 0xa0 && macro_f_utf_character_t_to_char_2(character) <= 0xbf) { - if (macro_f_utf_character_t_to_char_3(character) >= 0x80 && macro_f_utf_character_t_to_char_3(character) <= 0xbf) { + else if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_to_char_1(character) == 0xe0) { + if (macro_f_utf_char_t_to_char_2(character) >= 0xa0 && macro_f_utf_char_t_to_char_2(character) <= 0xbf) { + if (macro_f_utf_char_t_to_char_3(character) >= 0x80 && macro_f_utf_char_t_to_char_3(character) <= 0xbf) { return F_true; } } } - else if ((macro_f_utf_character_t_to_char_1(character) >= 0xe1 && macro_f_utf_character_t_to_char_1(character) <= 0xec) || (macro_f_utf_character_t_to_char_1(character) >= 0xee && macro_f_utf_character_t_to_char_1(character) <= 0xef)) { - if (macro_f_utf_character_t_to_char_2(character) >= 0x80 && macro_f_utf_character_t_to_char_2(character) <= 0xbf) { - if (macro_f_utf_character_t_to_char_3(character) >= 0x80 && macro_f_utf_character_t_to_char_3(character) <= 0xbf) { + else if ((macro_f_utf_char_t_to_char_1(character) >= 0xe1 && macro_f_utf_char_t_to_char_1(character) <= 0xec) || (macro_f_utf_char_t_to_char_1(character) >= 0xee && macro_f_utf_char_t_to_char_1(character) <= 0xef)) { + if (macro_f_utf_char_t_to_char_2(character) >= 0x80 && macro_f_utf_char_t_to_char_2(character) <= 0xbf) { + if (macro_f_utf_char_t_to_char_3(character) >= 0x80 && macro_f_utf_char_t_to_char_3(character) <= 0xbf) { return F_true; } } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xed) { - if (macro_f_utf_character_t_to_char_2(character) >= 0x80 && macro_f_utf_character_t_to_char_2(character) <= 0x9f) { - if (macro_f_utf_character_t_to_char_3(character) >= 0x80 && macro_f_utf_character_t_to_char_3(character) <= 0xbf) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xed) { + if (macro_f_utf_char_t_to_char_2(character) >= 0x80 && macro_f_utf_char_t_to_char_2(character) <= 0x9f) { + if (macro_f_utf_char_t_to_char_3(character) >= 0x80 && macro_f_utf_char_t_to_char_3(character) <= 0xbf) { return F_true; } } } } - else if (macro_f_utf_character_t_width_is(character) == 4) { - if (macro_f_utf_character_t_to_char_1(character) == 0xf0) { - if (macro_f_utf_character_t_to_char_2(character) >= 0x90 && macro_f_utf_character_t_to_char_2(character) <= 0xbf) { - if (macro_f_utf_character_t_to_char_3(character) >= 0x80 && macro_f_utf_character_t_to_char_3(character) <= 0xbf) { - if (macro_f_utf_character_t_to_char_4(character) >= 0x80 && macro_f_utf_character_t_to_char_4(character) <= 0xbf) { + else if (macro_f_utf_char_t_width_is(character) == 4) { + if (macro_f_utf_char_t_to_char_1(character) == 0xf0) { + if (macro_f_utf_char_t_to_char_2(character) >= 0x90 && macro_f_utf_char_t_to_char_2(character) <= 0xbf) { + if (macro_f_utf_char_t_to_char_3(character) >= 0x80 && macro_f_utf_char_t_to_char_3(character) <= 0xbf) { + if (macro_f_utf_char_t_to_char_4(character) >= 0x80 && macro_f_utf_char_t_to_char_4(character) <= 0xbf) { return F_true; } } } } - else if (macro_f_utf_character_t_to_char_1(character) >= 0xf1 && macro_f_utf_character_t_to_char_1(character) <= 0xf3) { - if (macro_f_utf_character_t_to_char_2(character) >= 0x80 && macro_f_utf_character_t_to_char_2(character) <= 0xbf) { - if (macro_f_utf_character_t_to_char_3(character) >= 0x80 && macro_f_utf_character_t_to_char_3(character) <= 0xbf) { - if (macro_f_utf_character_t_to_char_4(character) >= 0x80 && macro_f_utf_character_t_to_char_4(character) <= 0xbf) { + else if (macro_f_utf_char_t_to_char_1(character) >= 0xf1 && macro_f_utf_char_t_to_char_1(character) <= 0xf3) { + if (macro_f_utf_char_t_to_char_2(character) >= 0x80 && macro_f_utf_char_t_to_char_2(character) <= 0xbf) { + if (macro_f_utf_char_t_to_char_3(character) >= 0x80 && macro_f_utf_char_t_to_char_3(character) <= 0xbf) { + if (macro_f_utf_char_t_to_char_4(character) >= 0x80 && macro_f_utf_char_t_to_char_4(character) <= 0xbf) { return F_true; } } } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xf4) { - if (macro_f_utf_character_t_to_char_2(character) >= 0x80 && macro_f_utf_character_t_to_char_2(character) <= 0x8f) { - if (macro_f_utf_character_t_to_char_3(character) >= 0x80 && macro_f_utf_character_t_to_char_3(character) <= 0xbf) { - if (macro_f_utf_character_t_to_char_4(character) >= 0x80 && macro_f_utf_character_t_to_char_4(character) <= 0xbf) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xf4) { + if (macro_f_utf_char_t_to_char_2(character) >= 0x80 && macro_f_utf_char_t_to_char_2(character) <= 0x8f) { + if (macro_f_utf_char_t_to_char_3(character) >= 0x80 && macro_f_utf_char_t_to_char_3(character) <= 0xbf) { + if (macro_f_utf_char_t_to_char_4(character) >= 0x80 && macro_f_utf_char_t_to_char_4(character) <= 0xbf) { return F_true; } } @@ -3306,17 +3306,17 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_valid_) || !defined(_di_f_utf_is_valid_) #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_character_t character) { + f_status_t private_f_utf_character_is_whitespace(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(character) == 2) { // Latin-1 Supplement: U+00A0. if (character == 0xc2a00000) { return F_true; } } - else if (macro_f_utf_character_t_width_is(character) == 3) { - if (macro_f_utf_character_t_to_char_1(character) == 0xe2) { + else if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { // General Punctuation: U+2000 to U+200A. if (character >= 0xe2808000 && character <= 0xe2808a00) { @@ -3328,7 +3328,7 @@ extern "C" { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xe3) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xe3) { // CJK Symbols and Punctuation: U+3000. if (character == 0xe3808000) { @@ -3342,9 +3342,9 @@ 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_character_t character) { + f_status_t private_f_utf_character_is_whitespace_modifier(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(character) == 2) { // Spacing Modifier Letters: U+02B0 to U+02FF. if (character >= 0xcab00000 && character <= 0xcbbf0000) { @@ -3357,7 +3357,7 @@ 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_character_t character) { + f_status_t private_f_utf_character_is_whitespace_other(const f_utf_char_t character) { // Ogham: U+1680 (isn't whitespace but is technically considered one: ( )). if (character == 0xe19a8000) { @@ -3369,20 +3369,20 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_whitespace_other_) || !defined(_di_f_utf_is_whitespace_other_) #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_character_t character) { + f_status_t private_f_utf_character_is_wide(const 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_ - if (macro_f_utf_character_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(character) == 1) { return F_status_set_error(F_utf_fragment); } - if (macro_f_utf_character_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(character) == 2) { return F_false; } - if (macro_f_utf_character_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(character) == 3) { // Hangul Jamo: U+1100 to U+115F. if (character >= 0xe1848000 && character <= 0xe1859f00) { @@ -3502,21 +3502,21 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_wide_) || !defined(_di_f_utf_is_wide_) #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_character_t character, const bool strict) { + f_status_t private_f_utf_character_is_word(const f_utf_char_t character, const bool strict) { if (private_f_utf_character_is_alpha_digit(character)) { return F_true; } - if (macro_f_utf_character_t_width_is(character) == 3) { - if (macro_f_utf_character_t_to_char_1(character) == 0xe2) { + if (macro_f_utf_char_t_width_is(character) == 3) { + if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { // General Punctuation: U+203F (‿), U+203E (‾), U+2040 (⁀), U+2054 (⁔). if (character == 0xe280bf00 || character == 0xe280be00 || character == 0xe2818000 || character == 0xe2819400) { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xef) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xef) { // General Punctuation: U+FE4D (﹍), U+FE4E (﹎), U+FE4F (﹏). if (character == 0xefb98d00 || character == 0xefb98e00 || character == 0xefb98f00) { @@ -3542,13 +3542,13 @@ 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_character_t character, const bool strict) { + f_status_t private_f_utf_character_is_word_dash(const f_utf_char_t character, const bool strict) { if (private_f_utf_character_is_word(character, strict)) { return F_true; } - if (macro_f_utf_character_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(character) == 3) { // General Punctuation: U+2010, U+2011. if (character == 0xe2809000 || character == 0xe2809100) { @@ -3561,7 +3561,7 @@ 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_character_t character, const bool strict) { + f_status_t private_f_utf_character_is_word_dash_plus(const f_utf_char_t character, const bool strict) { if (private_f_utf_character_is_word_dash(character, strict)) { return F_true; @@ -3580,23 +3580,23 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_is_word_dash_plus_) #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_character_t character) { + f_status_t private_f_utf_character_is_zero_width(const f_utf_char_t character) { - if (macro_f_utf_character_t_to_char_1(character) == 0xe1) { + if (macro_f_utf_char_t_to_char_1(character) == 0xe1) { // Mongolian: U+180E. if (character == 0xe1a08e00) { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xe2) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xe2) { // General Punctuation: U+200B, U+200C, U+200D, U+2060. if (character == 0xe2808b00 || character == 0xe2808c00 || character == 0xe2808d00 || character == 0xe281a000) { return F_true; } } - else if (macro_f_utf_character_t_to_char_1(character) == 0xef) { + else if (macro_f_utf_char_t_to_char_1(character) == 0xef) { // Arabic Presentation Forms-B: U+FEFF. if (character == 0xefbbbf00) { @@ -3609,9 +3609,9 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_zero_width_) #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_character_t character, uint32_t *unicode) { + f_status_t private_f_utf_character_unicode_to(const f_utf_char_t character, uint32_t *unicode) { - if (macro_f_utf_character_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(character) == 1) { return F_status_set_error(F_utf_fragment); } @@ -3620,29 +3620,29 @@ extern "C" { } // U+0000 -> U+007F (ASCII). - if (macro_f_utf_character_t_width(character) == 1) { - *unicode = macro_f_utf_character_t_to_char_1(character) & 0x7f; + if (macro_f_utf_char_t_width(character) == 1) { + *unicode = macro_f_utf_char_t_to_char_1(character) & 0x7f; } // U+0080 -> U+07FF. - else if (macro_f_utf_character_t_width(character) == 2) { - *unicode = (macro_f_utf_character_t_to_char_1(character) & 0x1f) << 6; - *unicode |= macro_f_utf_character_t_to_char_2(character) & 0x3f; + 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; } // U+0800 -> U+FFFF. - else if (macro_f_utf_character_t_width(character) == 3) { - *unicode = (macro_f_utf_character_t_to_char_1(character) & 0xf) << 12; - *unicode |= (macro_f_utf_character_t_to_char_2(character) & 0x3f) << 6; - *unicode |= macro_f_utf_character_t_to_char_3(character) & 0x3f; + 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; } // U+10000 -> U+10FFFF. - else if (macro_f_utf_character_t_width(character) == 4) { - *unicode = (macro_f_utf_character_t_to_char_1(character) & 0x7) << 18; - *unicode |= (macro_f_utf_character_t_to_char_2(character) & 0x3f) << 12; - *unicode |= (macro_f_utf_character_t_to_char_2(character) & 0x3f) << 6; - *unicode |= macro_f_utf_character_t_to_char_4(character) & 0x3f; + 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_2(character) & 0x3f) << 6; + *unicode |= macro_f_utf_char_t_to_char_4(character) & 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 9636cc7..379e6ad 100644 --- a/level_0/f_utf/c/private-utf.h +++ b/level_0/f_utf/c/private-utf.h @@ -23,13 +23,13 @@ extern "C" { * Intended to be shared to each of the different implementation variations. * * @param character - * The character string to be converted to the f_utf_character_t type. + * 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 - * The generated character of type f_utf_character_t. + * The generated character of type f_utf_char_t. * This value may be cleared, even on error. * * @return @@ -72,7 +72,7 @@ extern "C" { * @see f_utf_unicode_to() */ #if !defined(_di_f_utf_char_to_character_) || !defined(_di_f_utf_is_alpha_) || !defined(_di_f_utf_is_alpha_digit_) || !defined(_di_f_utf_is_alpha_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) - extern f_status_t private_f_utf_char_to_character(const f_string_t character, const f_array_length_t width_max, f_utf_character_t *character_utf) F_attribute_visibility_internal_d; + 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_alpha_) || !defined(_di_f_utf_is_alpha_digit_) || !defined(_di_f_utf_is_alpha_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) /** @@ -94,7 +94,7 @@ extern "C" { * @see f_utf_is_alpha() */ #if !defined(_di_f_utf_character_is_alpha_) || !defined(_di_f_utf_is_alpha_) - extern f_status_t private_f_utf_character_is_alpha(const f_utf_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_alpha(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_alpha_) || !defined(_di_f_utf_is_alpha_) /** @@ -116,7 +116,7 @@ extern "C" { * @see f_utf_is_alpha_digit() */ #if !defined(_di_f_utf_character_is_alpha_digit_) || !defined(_di_f_utf_is_alpha_digit_) - extern f_status_t private_f_utf_character_is_alpha_digit(const f_utf_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_alpha_digit(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_alpha_digit_) || !defined(_di_f_utf_is_alpha_digit_) /** @@ -138,7 +138,7 @@ extern "C" { * @see f_utf_is_alpha_numeric() */ #if !defined(_di_f_utf_character_is_alpha_numeric_) || !defined(_di_f_utf_is_alpha_numeric_) - extern f_status_t private_f_utf_character_is_alpha_numeric(const f_utf_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_alpha_numeric(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_alpha_numeric_) || !defined(_di_f_utf_is_alpha_numeric_) /** @@ -160,7 +160,7 @@ extern "C" { * @see f_utf_is_ascii() */ #if !defined(_di_f_utf_character_is_ascii_) || !defined(_di_f_utf_is_ascii_) - extern f_status_t private_f_utf_character_is_ascii(const f_utf_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_ascii(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_ascii_) || !defined(_di_f_utf_is_ascii_) /** @@ -182,7 +182,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_combining(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_combining_) || !defined(_di_f_utf_is_combining_) /** @@ -204,7 +204,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_control(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_control_) || !defined(_di_f_utf_is_control_) /** @@ -226,7 +226,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_control_code(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_control_code_) || !defined(_di_f_utf_is_control_code_) /** @@ -248,7 +248,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_control_format(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_control_format_) || !defined(_di_f_utf_is_control_format_) /** @@ -270,7 +270,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_control_picture(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_control_picture_) || !defined(_di_f_utf_is_control_picture_) /** @@ -292,7 +292,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_digit(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_digit_) || !defined(_di_f_utf_is_digit_) /** @@ -314,7 +314,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_emoji(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_emoji_) || !defined(_di_f_utf_is_emoji_) /** @@ -336,7 +336,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_numeric(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_numeric_) || !defined(_di_f_utf_is_numeric_) /** @@ -358,7 +358,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_phonetic(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_phonetic_) || !defined(_di_f_utf_is_phonetic_) /** @@ -380,7 +380,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_private(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_private_) || !defined(_di_f_utf_is_private_) /** @@ -402,7 +402,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_punctuation(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_punctuation_) || !defined(_di_f_utf_is_punctuation_) /** @@ -424,7 +424,7 @@ extern "C" { * @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_character_t character) F_attribute_visibility_internal_d; + 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_) /** @@ -446,7 +446,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_symbol(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_symbol_) || !defined(_di_f_utf_is_symbol_) /** @@ -468,7 +468,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_character_t characterh) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_valid(const f_utf_char_t characterh) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_valid_) || !defined(_di_f_utf_is_valid_) /** @@ -490,7 +490,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_whitespace(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_whitespace_) || !defined(_di_f_utf_is_whitespace_) /** @@ -512,7 +512,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_whitespace_modifier(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_modifier_) /** @@ -534,7 +534,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_whitespace_other(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_whitespace_other_) || !defined(_di_f_utf_is_whitespace_other_) /** @@ -554,7 +554,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_wide(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_wide_) || !defined(_di_f_utf_is_wide_) /** @@ -580,7 +580,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_character_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 character, const bool strict) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_is_word_) /** @@ -606,7 +606,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_character_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 character, const bool strict) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_is_word_dash_) /** @@ -632,7 +632,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_character_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 character, 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_) /** @@ -654,7 +654,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_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_zero_width(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_zero_width_) /** @@ -664,7 +664,7 @@ extern "C" { * * @param character * The (UTF-8) character to convert to the Unicode representation. - * The f_utf_character_t is a 32-bit integer containing UTF-8 sequences, unchanged. + * 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). @@ -681,7 +681,7 @@ extern "C" { * @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_character_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 character, uint32_t *unicode) 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/utf/common.h b/level_0/f_utf/c/utf/common.h index 1d6fb5f..eae155b 100644 --- a/level_0/f_utf/c/utf/common.h +++ b/level_0/f_utf/c/utf/common.h @@ -148,17 +148,6 @@ extern "C" { #endif // _di_f_utf_substitute_ /** - * Defines type for representing the UTF-8 code as a 32-bit unsigned integer. - */ -#ifndef _di_f_utf_t_ - typedef uint32_t f_utf_t; - - #define f_utf_t_initialize 0 - - #define macro_f_utf_initialize(code) code -#endif // _di_f_utf_t_ - -/** * Provide a basic UTF-8 character as a single 4-byte variable. * * This is intended to be used when a single variable is desired to represent a 1-byte, 2-byte, 3-byte, or even 4-byte character. @@ -166,56 +155,94 @@ extern "C" { * This "character" type is stored as a big-endian 4-byte integer (32-bits). * A helper function, f_utf_is_big_endian(), is provided to detect system endianness so that character arrays (uint8_t []) can be correctly processed. * - * The byte structure is intended to be read left to right. + * The byte structure is intended to be read left to right in memory regardless of system endianness. + * This is done so that the first character (the left most) can be read naturally as a string, such as string[0] = first character. * - * The macro_f_utf_character_t_mask_byte_* are used to get the entire character set fo a given width. + * The macro_f_utf_char_t_mask_byte_* are used to get the entire character set fo a given width. * - * The macro_f_utf_character_t_mask_char_* are used to get a specific UTF-8 block as a single character range. + * The macro_f_utf_char_t_mask_char_* are used to get a specific UTF-8 block as a single character range. * - * The macro_f_utf_character_t_to_char_* are used to convert a f_utf_character_t into a uint8_t, for a given 8-bit block. + * The macro_f_utf_char_t_to_char_* are used to convert a f_utf_char_t into a uint8_t, for a given 8-bit block. * - * The macro_f_utf_character_t_from_char_* are used to convert a uint8_t into part of a f_utf_character_t, for a given 8-bit block. + * The macro_f_utf_char_t_from_char_* are used to convert a uint8_t into part of a f_utf_char_t, for a given 8-bit block. * - * The macro_f_utf_character_t_width is used to determine the width of the UTF-8 character based on macro_f_utf_byte_width. - * The macro_f_utf_character_t_width_is is used to determine the width of the UTF-8 character based on macro_f_utf_byte_width_is. + * The macro_f_utf_char_t_width is used to determine the width of the UTF-8 character based on macro_f_utf_byte_width. + * The macro_f_utf_char_t_width_is is used to determine the width of the UTF-8 character based on macro_f_utf_byte_width_is. * - * The macro_f_utf_character_t_width macro determines a width of the UTF-8 character based on macro_f_utf_byte_width. - * The macro_f_utf_character_t_width_is is identical to macro_f_utf_character_t_width, except it returns 0 when character is ASCII. + * The macro_f_utf_char_t_width macro determines a width of the UTF-8 character based on macro_f_utf_byte_width. + * The macro_f_utf_char_t_width_is is identical to macro_f_utf_char_t_width, except it returns 0 when character is ASCII. * * @see f_utf_is_big_endian() */ -#ifndef _di_f_utf_character_t_ - typedef uint32_t f_utf_character_t; - - #define F_utf_character_mask_byte_1_d 0xff000000u // 1111 1111, 0000 0000, 0000 0000, 0000 0000 - #define F_utf_character_mask_byte_2_d 0xffff0000u // 1111 1111, 1111 1111, 0000 0000, 0000 0000 - #define F_utf_character_mask_byte_3_d 0xffffff00u // 1111 1111, 1111 1111, 1111 1111, 0000 0000 - #define F_utf_character_mask_byte_4_d 0xffffffffu // 1111 1111, 1111 1111, 1111 1111, 1111 1111 - - #define F_utf_character_mask_char_1_d 0xff000000u // 1111 1111, 0000 0000, 0000 0000, 0000 0000 - #define F_utf_character_mask_char_2_d 0x00ff0000u // 0000 0000, 1111 1111, 0000 0000, 0000 0000 - #define F_utf_character_mask_char_3_d 0x0000ff00u // 0000 0000, 0000 0000, 1111 1111, 0000 0000 - #define F_utf_character_mask_char_4_d 0x000000ffu // 0000 0000, 0000 0000, 0000 0000, 1111 1111 - - #define macro_f_utf_character_t_to_char_1(character) (((character) & F_utf_character_mask_char_1_d) >> 24u) // grab first byte. - #define macro_f_utf_character_t_to_char_2(character) (((character) & F_utf_character_mask_char_2_d) >> 16u) // grab second byte. - #define macro_f_utf_character_t_to_char_3(character) (((character) & F_utf_character_mask_char_3_d) >> 8u) // grab third byte. - #define macro_f_utf_character_t_to_char_4(character) ((character) & F_utf_character_mask_char_4_d) // grab fourth byte. - - #define macro_f_utf_character_t_from_char_1(character) (((character) << 24u) & F_utf_character_mask_char_1_d) // shift to first byte. - #define macro_f_utf_character_t_from_char_2(character) (((character) << 16u) & F_utf_character_mask_char_2_d) // shift to second byte. - #define macro_f_utf_character_t_from_char_3(character) (((character) << 8u) & F_utf_character_mask_char_3_d) // shift to third byte. - #define macro_f_utf_character_t_from_char_4(character) ((character) & F_utf_character_mask_char_4_d) // shift to fourth byte. - - #define macro_f_utf_character_t_width(character) (macro_f_utf_byte_width(macro_f_utf_character_t_to_char_1(character))) - #define macro_f_utf_character_t_width_is(character) (macro_f_utf_byte_width_is(macro_f_utf_character_t_to_char_1(character))) -#endif // _di_f_utf_character_t_ - -#ifndef _di_f_utf_character_t_codes_ - #define F_utf_character_t_eol_d 0x0a000000u // 0000 1010, 0000 0000, 0000 0000, 0000 0000 - #define F_utf_character_t_eos_d 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 - #define F_utf_character_t_placeholder_d 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 -#endif // _di_f_utf_character_t_codes_ +#ifndef _di_f_utf_char_t_ + typedef uint32_t f_utf_char_t; + + #define f_utf_char_t_initialize 0 + + #define macro_f_utf_char_t_initialize(code) code + + #ifdef _is_F_endian_big + #define F_utf_char_mask_byte_1_d 0xff000000u // 1111 1111, 0000 0000, 0000 0000, 0000 0000 + #define F_utf_char_mask_byte_2_d 0xffff0000u // 1111 1111, 1111 1111, 0000 0000, 0000 0000 + #define F_utf_char_mask_byte_3_d 0xffffff00u // 1111 1111, 1111 1111, 1111 1111, 0000 0000 + #define F_utf_char_mask_byte_4_d 0xffffffffu // 1111 1111, 1111 1111, 1111 1111, 1111 1111 + + #define F_utf_char_mask_char_1_d 0xff000000u // 1111 1111, 0000 0000, 0000 0000, 0000 0000 + #define F_utf_char_mask_char_2_d 0x00ff0000u // 0000 0000, 1111 1111, 0000 0000, 0000 0000 + #define F_utf_char_mask_char_3_d 0x0000ff00u // 0000 0000, 0000 0000, 1111 1111, 0000 0000 + #define F_utf_char_mask_char_4_d 0x000000ffu // 0000 0000, 0000 0000, 0000 0000, 1111 1111 + + #define macro_f_utf_char_t_to_char_1(character) (((character) & F_utf_char_mask_char_1_d) >> 24u) // Grab first byte. + #define macro_f_utf_char_t_to_char_2(character) (((character) & F_utf_char_mask_char_2_d) >> 16u) // Grab second byte. + #define macro_f_utf_char_t_to_char_3(character) (((character) & F_utf_char_mask_char_3_d) >> 8u) // Grab third byte. + #define macro_f_utf_char_t_to_char_4(character) ((character) & F_utf_char_mask_char_4_d) // Grab fourth byte. + + #define macro_f_utf_char_t_from_char_1(character) (((character) << 24u) & F_utf_char_mask_char_1_d) // Shift to first byte. + #define macro_f_utf_char_t_from_char_2(character) (((character) << 16u) & F_utf_char_mask_char_2_d) // Shift to second byte. + #define macro_f_utf_char_t_from_char_3(character) (((character) << 8u) & F_utf_char_mask_char_3_d) // Shift to third byte. + #define macro_f_utf_char_t_from_char_4(character) ((character) & F_utf_char_mask_char_4_d) // Shift to fourth byte. + #else + #define F_utf_char_mask_byte_1_d 0x000000ffu // 0000 0000, 0000 0000, 0000 0000, 1111 1111 + #define F_utf_char_mask_byte_2_d 0x0000ffffu // 0000 0000, 0000 0000, 1111 1111, 1111 1111 + #define F_utf_char_mask_byte_3_d 0x00ffffffu // 0000 0000, 1111 1111, 1111 1111, 1111 1111 + #define F_utf_char_mask_byte_4_d 0xffffffffu // 1111 1111, 1111 1111, 1111 1111, 1111 1111 + + #define F_utf_char_mask_char_1_d 0x000000ffu // 0000 0000, 0000 0000, 0000 0000, 1111 1111 + #define F_utf_char_mask_char_2_d 0x0000ff00u // 0000 0000, 0000 0000, 1111 1111, 0000 0000 + #define F_utf_char_mask_char_3_d 0x00ff0000u // 0000 0000, 1111 1111, 0000 0000, 0000 0000 + #define F_utf_char_mask_char_4_d 0xff000000u // 1111 1111, 0000 0000, 0000 0000, 0000 0000 + + #define macro_f_utf_char_t_to_char_1(character) (((character) & F_utf_char_mask_char_1_d)) // Grab first byte. + #define macro_f_utf_char_t_to_char_2(character) (((character) & F_utf_char_mask_char_2_d) >> 8u) // Grab second byte. + #define macro_f_utf_char_t_to_char_3(character) (((character) & F_utf_char_mask_char_3_d) >> 16u) // Grab third byte. + #define macro_f_utf_char_t_to_char_4(character) (((character) & F_utf_char_mask_char_4_d) >> 24u) // Grab fourth byte. + + #define macro_f_utf_char_t_from_char_1(character) (((character)) & F_utf_char_mask_char_1_d) // Shift to first byte. + #define macro_f_utf_char_t_from_char_2(character) (((character) << 8u) & F_utf_char_mask_char_2_d) // Shift to second byte. + #define macro_f_utf_char_t_from_char_3(character) (((character) << 16u) & F_utf_char_mask_char_3_d) // Shift to third byte. + #define macro_f_utf_char_t_from_char_4(character) (((character) << 24u) & F_utf_char_mask_char_4_d) // Shift to fourth byte. + #endif // _is_F_endian_big + + #define macro_f_utf_char_t_width(character) (macro_f_utf_byte_width(macro_f_utf_char_t_to_char_1(character))) + #define macro_f_utf_char_t_width_is(character) (macro_f_utf_byte_width_is(macro_f_utf_char_t_to_char_1(character))) +#endif // _di_f_utf_char_t_ + +/** + * Provide an integer that represents special characters. + * + * Because this is an integer, the byte order matters. + */ +#ifndef _di_f_utf_char_t_codes_ + #ifdef _is_F_endian_big + #define F_utf_char_t_eol_d 0x0a000000u // 0000 1010, 0000 0000, 0000 0000, 0000 0000 + #define F_utf_char_t_eos_d 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 + #define F_utf_char_t_placeholder_d 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 + #else + #define F_utf_char_t_eol_d 0x0000000au // 0000 0000, 0000 0000, 0000 0000, 0000 1010 + #define F_utf_char_t_eos_d 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 + #define F_utf_char_t_placeholder_d 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 + #endif // _is_F_endian_big +#endif // _di_f_utf_char_t_codes_ /** * Define the basic string type. @@ -223,7 +250,7 @@ extern "C" { * Dynamic allocation macros are provided, but it is recommended to utilize the f_utf_string_dynamic_t for dynamic allocation. */ #ifndef _di_f_utf_string_t_ - typedef f_utf_character_t *f_utf_string_t; + typedef f_utf_char_t *f_utf_string_t; #define f_utf_string_t_initialize 0 diff --git a/level_0/f_utf/c/utf/convert.c b/level_0/f_utf/c/utf/convert.c index 15b6f9a..a213139 100644 --- a/level_0/f_utf/c/utf/convert.c +++ b/level_0/f_utf/c/utf/convert.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_f_utf_char_to_character_ - f_status_t f_utf_char_to_character(const f_string_t character, const f_array_length_t width_max, f_utf_character_t *character_utf) { + f_status_t f_utf_char_to_character(const f_string_t character, const f_array_length_t width_max, f_utf_char_t *character_utf) { #ifndef _di_level_0_parameter_checking_ if (width_max < 1) return F_status_set_error(F_parameter); if (!character_utf) return F_status_set_error(F_parameter); @@ -24,8 +24,8 @@ extern "C" { } #endif // _di_f_utf_char_to_character_ -#ifndef _di_f_utf_character_to_char_ - f_status_t f_utf_character_to_char(const f_utf_character_t utf_character, f_string_t *character, f_array_length_t *width_max) { +#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) { #ifndef _di_level_0_parameter_checking_ if (!utf_character) return F_status_set_error(F_parameter); if (!character) return F_status_set_error(F_parameter); @@ -33,45 +33,45 @@ extern "C" { if (!*width_max) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (macro_f_utf_character_t_width_is(utf_character)) { - if (macro_f_utf_character_t_width_is(utf_character) == 1) { + if (macro_f_utf_char_t_width_is(utf_character)) { + if (macro_f_utf_char_t_width_is(utf_character) == 1) { return F_status_set_error(F_utf_fragment); } #if __BYTE_ORDER == __LITTLE_ENDIAN - f_utf_t utf = 0; + f_utf_char_t utf = 0; - switch (macro_f_utf_character_t_width_is(utf_character)) { + switch (macro_f_utf_char_t_width_is(utf_character)) { case 1: - utf = macro_f_utf_character_t_to_char_1(utf_character) << 24; + utf = macro_f_utf_char_t_to_char_1(utf_character) << 24; break; case 2: - utf = (macro_f_utf_character_t_to_char_2(utf_character) << 24) | (macro_f_utf_character_t_to_char_1(utf_character) << 16); + utf = (macro_f_utf_char_t_to_char_2(utf_character) << 24) | (macro_f_utf_char_t_to_char_1(utf_character) << 16); break; case 3: - utf = (macro_f_utf_character_t_to_char_3(utf_character) << 24) | (macro_f_utf_character_t_to_char_2(utf_character) << 16) | (macro_f_utf_character_t_to_char_1(utf_character) << 8); + 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); break; case 4: - utf = (macro_f_utf_character_t_to_char_4(utf_character) << 24) | (macro_f_utf_character_t_to_char_3(utf_character) << 16) | (macro_f_utf_character_t_to_char_2(utf_character) << 8) | macro_f_utf_character_t_to_char_1(utf_character); + 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); break; default: return F_status_set_error(F_failure); } - memcpy(*character, &utf, sizeof(f_char_t) * macro_f_utf_character_t_width_is(utf_character)); + memcpy(*character, &utf, sizeof(f_char_t) * macro_f_utf_char_t_width_is(utf_character)); #else - memcpy(*character, &utf_character, sizeof(f_char_t) * macro_f_utf_character_t_width_is(utf_character)); + memcpy(*character, &utf_character, sizeof(f_char_t) * macro_f_utf_char_t_width_is(utf_character)); #endif // __BYTE_ORDER == __LITTLE_ENDIAN return F_none; } #if __BYTE_ORDER == __LITTLE_ENDIAN - f_utf_t utf = macro_f_utf_character_t_to_char_1(utf_character) << 24; + f_utf_char_t utf = macro_f_utf_char_t_to_char_1(utf_character) << 24; memcpy(*character, &utf, sizeof(f_char_t)); #else @@ -80,10 +80,10 @@ extern "C" { return F_none; } -#endif // _di_f_utf_character_to_char_ +#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_character_t character, f_utf_t *unicode) { + f_status_t f_utf_character_unicode_to(const f_utf_char_t character, f_utf_char_t *unicode) { #ifndef _di_level_0_parameter_checking_ if (!unicode) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -93,7 +93,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_t unicode, f_utf_character_t *character) { + f_status_t f_utf_character_unicode_from(const f_utf_char_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_ @@ -136,7 +136,7 @@ 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_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 *unicode) { #ifndef _di_level_0_parameter_checking_ if (!string) return F_status_set_error(F_parameter); if (!unicode) return F_status_set_error(F_parameter); @@ -149,16 +149,16 @@ extern "C" { } // while if (i < length) { - if (macro_f_utf_character_t_width_is(string[i])) { + if (macro_f_utf_char_t_width_is(string[i])) { i = length; } else { - if (macro_f_utf_character_t_to_char_1(string[i]) == f_string_ascii_u_s.string[0] || macro_f_utf_character_t_to_char_1(string[i]) == f_string_ascii_U_s.string[0]) { + if (macro_f_utf_char_t_to_char_1(string[i]) == f_string_ascii_u_s.string[0] || macro_f_utf_char_t_to_char_1(string[i]) == f_string_ascii_U_s.string[0]) { do { ++i; } while (i < length && !string[i]); - if (i < length && !macro_f_utf_character_t_width_is(string[i]) && macro_f_utf_character_t_to_char_1(string[i]) == f_string_ascii_plus_s.string[0]) { + if (i < length && !macro_f_utf_char_t_width_is(string[i]) && macro_f_utf_char_t_to_char_1(string[i]) == f_string_ascii_plus_s.string[0]) { ++i; } else { @@ -175,7 +175,7 @@ extern "C" { return F_status_set_error(F_valid_not); } - f_utf_t value = 0; + f_utf_char_t value = 0; uint8_t character = 0; for (; i < length; ++i) { @@ -183,12 +183,12 @@ extern "C" { if (!string[i]) continue; // Only ASCII character numbers are allowed to represent - if (macro_f_utf_character_t_width_is(string[i])) { + if (macro_f_utf_char_t_width_is(string[i])) { return F_status_set_error(F_valid_not); } value *= 16; - character = macro_f_utf_character_t_to_char_1(string[i]); + character = macro_f_utf_char_t_to_char_1(string[i]); if (character > 0x2f && character < 0x3a) { value += character - 0x30; @@ -211,7 +211,7 @@ extern "C" { #endif // _di_f_utf_character_unicode_string_to_ #ifndef _di_f_utf_unicode_from_ - f_status_t f_utf_unicode_from(const f_utf_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 unicode, 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); if (!unicode) return F_status_set_error(F_parameter); @@ -287,13 +287,13 @@ 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_t *unicode) { + f_status_t f_utf_unicode_to(const f_string_t character, const f_array_length_t width_max, f_utf_char_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); #endif // _di_level_0_parameter_checking_ - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -305,7 +305,7 @@ extern "C" { #endif // _di_f_utf_unicode_to_ #ifndef _di_f_utf_unicode_string_to_f_ - f_status_t f_utf_unicode_string_to(const f_string_t string, const f_array_length_t length, f_utf_t *unicode) { + f_status_t f_utf_unicode_string_to(const f_string_t string, const f_array_length_t length, f_utf_char_t *unicode) { #ifndef _di_level_0_parameter_checking_ if (!unicode) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -338,7 +338,7 @@ extern "C" { return F_status_set_error(F_valid_not); } - f_utf_t value = 0; + f_utf_char_t value = 0; for (; i < length; ++i) { diff --git a/level_0/f_utf/c/utf/convert.h b/level_0/f_utf/c/utf/convert.h index 007da72..a9de7a8 100644 --- a/level_0/f_utf/c/utf/convert.h +++ b/level_0/f_utf/c/utf/convert.h @@ -17,7 +17,7 @@ extern "C" { #endif /** - * Convert a specialized f_utf_character_t type to a uint8_t, stored as a string (character buffer). + * Convert a specialized f_utf_char_t type to a uint8_t, stored as a string (character buffer). * * This will also convert ASCII characters stored in the utf_character array. * This will not resize character. @@ -39,14 +39,14 @@ extern "C" { * F_utf (with error bit) if unicode is an invalid Unicode character. * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ -#ifndef _di_f_utf_character_to_char_ - extern f_status_t f_utf_character_to_char(const f_utf_character_t utf_character, f_string_t *character, f_array_length_t *width_max); -#endif // _di_f_utf_character_to_char_ +#ifndef _di_f_utf_char_to_char_ + extern 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); +#endif // _di_f_utf_char_to_char_ /** * Convert a given (UTF-8) character into Unicode. * - * The f_utf_character_t is a 32-bit integer containing UTF-8 sequences, unchanged. + * The f_utf_char_t is a 32-bit integer containing UTF-8 sequences, unchanged. * The Unicode is a 32-bit integer representing the Unicode (such as U+0001). * The Unciode does not need to be interpretted like UTF-8, it simple is a sequence of number from 0 onto max supported Unicode integer value (U+10FFFF). * @@ -65,13 +65,13 @@ 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_character_t character, f_utf_t *unicode); + extern f_status_t f_utf_character_unicode_to(const f_utf_char_t character, f_utf_char_t *unicode); #endif // _di_f_utf_character_unicode_to_ /** * Convert a given Unicode into (UTF-8) character. * - * The f_utf_character_t is a 32-bit integer containing UTF-8 sequences, unchanged. + * The f_utf_char_t is a 32-bit integer containing UTF-8 sequences, unchanged. * The Unicode is a 32-bit integer representing the Unicode (such as U+0001). * The Unciode does not need to be interpretted like UTF-8, it simple is a sequence of number from 0 onto max supported Unicode integer value (U+10FFFF). * @@ -88,7 +88,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_unicode_from_ - extern f_status_t f_utf_character_unicode_from(const f_utf_t unicode, f_utf_character_t *character); + extern f_status_t f_utf_character_unicode_from(const f_utf_char_t unicode, f_utf_char_t *character); #endif // _di_f_utf_character_unicode_from_ /** @@ -115,20 +115,20 @@ 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_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 *unicode); #endif // _di_f_utf_character_unicode_string_to_ /** - * Convert an ASCII or UTF-8 character, stored as a string (character buffer), to the specialized f_utf_character_t type. + * Convert an ASCII or UTF-8 character, stored as a string (character buffer), to the specialized f_utf_char_t type. * * @param character - * The character string to be converted to the f_utf_character_t type. + * 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 - * The generated character of type f_utf_character_t. + * The generated character of type f_utf_char_t. * This value may be cleared, even on error. * * @return @@ -140,7 +140,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_char_to_character_ - extern f_status_t f_utf_char_to_character(const f_string_t character, const f_array_length_t width_max, f_utf_character_t *character_utf); + extern f_status_t f_utf_char_to_character(const f_string_t character, const f_array_length_t width_max, f_utf_char_t *character_utf); #endif // _di_f_utf_char_to_character_ /** @@ -148,7 +148,7 @@ extern "C" { * * @param character * The (UTF-8) character. - * The f_utf_character_t is a 32-bit integer containing UTF-8 sequences, unchanged. + * The f_utf_char_t is a 32-bit integer containing UTF-8 sequences, unchanged. * @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. @@ -166,7 +166,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_unicode_from_ - extern f_status_t f_utf_unicode_from(const f_utf_t unicode, const f_array_length_t width_max, f_string_t *character); + 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); #endif // _di_f_utf_unicode_from_ /** @@ -174,7 +174,7 @@ extern "C" { * * @param character * The (UTF-8) character to convert to the Unicode representation. - * The f_utf_character_t is a 32-bit integer containing UTF-8 sequences, unchanged. + * The f_utf_char_t is a 32-bit integer containing UTF-8 sequences, unchanged. * @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. @@ -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_t *unicode); + 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); #endif // _di_f_utf_unicode_to_ /** @@ -221,7 +221,7 @@ extern "C" { * F_valid_not (with error bit) if string is not a valid Unicode string. */ #ifndef _di_f_utf_unicode_string_to_ - extern f_status_t f_utf_unicode_string_to(const f_string_t string, const f_array_length_t length, f_utf_t *unicode); + extern f_status_t f_utf_unicode_string_to(const f_string_t string, const f_array_length_t length, f_utf_char_t *unicode); #endif // _di_f_utf_unicode_string_to_ #ifdef __cplusplus diff --git a/level_0/f_utf/c/utf/dynamic.c b/level_0/f_utf/c/utf/dynamic.c index ec8bf7b..9e946ed 100644 --- a/level_0/f_utf/c/utf/dynamic.c +++ b/level_0/f_utf/c/utf/dynamic.c @@ -679,9 +679,9 @@ extern "C" { if (!buffer.used) return F_data_not; if (range->start > range->stop) return F_data_not_stop; - while (buffer.string[range->start] != F_utf_character_t_eol_d) { + while (buffer.string[range->start] != F_utf_char_t_eol_d) { - if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -706,11 +706,11 @@ extern "C" { while (buffer.string[range->start] != seek_to_this) { - if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } - if (buffer.string[range->start] == F_utf_character_t_eol_d) return F_none_eol; + if (buffer.string[range->start] == F_utf_char_t_eol_d) return F_none_eol; ++range->start; @@ -733,7 +733,7 @@ extern "C" { while (buffer.string[range->start] != seek_to_this) { - if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } diff --git a/level_0/f_utf/c/utf/is.c b/level_0/f_utf/c/utf/is.c index 114dba0..2a63837 100644 --- a/level_0/f_utf/c/utf/is.c +++ b/level_0/f_utf/c/utf/is.c @@ -28,7 +28,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -61,7 +61,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -94,7 +94,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -149,7 +149,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -179,7 +179,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -208,7 +208,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -241,7 +241,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -275,7 +275,7 @@ extern "C" { return F_false; } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -305,7 +305,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -338,7 +338,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -382,7 +382,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -428,7 +428,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -461,7 +461,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -491,7 +491,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -521,7 +521,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -580,7 +580,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -624,7 +624,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -654,7 +654,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -684,7 +684,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -714,7 +714,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -747,7 +747,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -777,7 +777,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -804,7 +804,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -834,7 +834,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -867,7 +867,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -900,7 +900,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); @@ -933,7 +933,7 @@ extern "C" { return F_status_set_error(F_utf_fragment); } - f_utf_character_t character_utf = 0; + f_utf_char_t character_utf = 0; { const f_status_t status = private_f_utf_char_to_character(character, width_max, &character_utf); diff --git a/level_0/f_utf/c/utf/is_character.c b/level_0/f_utf/c/utf/is_character.c index d7f9bc1..7457981 100644 --- a/level_0/f_utf/c/utf/is_character.c +++ b/level_0/f_utf/c/utf/is_character.c @@ -7,10 +7,10 @@ extern "C" { #endif #ifndef _di_f_utf_character_is_ - f_status_t f_utf_character_is(const f_utf_character_t character) { + f_status_t f_utf_character_is(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + if (macro_f_utf_char_t_width_is(character)) { + if (macro_f_utf_char_t_width_is(character) == 1) { return F_utf_fragment; } @@ -22,17 +22,17 @@ extern "C" { #endif // _di_f_utf_character_is_ #ifndef _di_f_utf_character_is_alpha_ - f_status_t f_utf_character_is_alpha(const f_utf_character_t character) { + f_status_t f_utf_character_is_alpha(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_alpha(character); } - if (isalpha(macro_f_utf_character_t_to_char_1(character))) { + if (isalpha(macro_f_utf_char_t_to_char_1(character))) { return F_true; } @@ -41,17 +41,17 @@ extern "C" { #endif // _di_f_utf_character_is_alpha_ #ifndef _di_f_utf_character_is_alpha_digit_ - f_status_t f_utf_character_is_alpha_digit(const f_utf_character_t character) { + f_status_t f_utf_character_is_alpha_digit(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_alpha_digit(character); } - if (isalnum(macro_f_utf_character_t_to_char_1(character))) { + if (isalnum(macro_f_utf_char_t_to_char_1(character))) { return F_true; } @@ -60,17 +60,17 @@ extern "C" { #endif // _di_f_utf_character_is_alpha_digit_ #ifndef _di_f_utf_character_is_alpha_numeric_ - f_status_t f_utf_character_is_alpha_numeric(const f_utf_character_t character) { + f_status_t f_utf_character_is_alpha_numeric(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_alpha_numeric(character); } - if (isalnum(macro_f_utf_character_t_to_char_1(character))) { + if (isalnum(macro_f_utf_char_t_to_char_1(character))) { return F_true; } @@ -79,9 +79,9 @@ extern "C" { #endif // _di_f_utf_character_is_alpha_numeric_ #ifndef _di_f_utf_character_is_ascii_ - f_status_t f_utf_character_is_ascii(const f_utf_character_t character) { + f_status_t f_utf_character_is_ascii(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { + if (macro_f_utf_char_t_width_is(character)) { return F_false; } @@ -90,10 +90,10 @@ 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_character_t character) { + f_status_t f_utf_character_is_combining(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -106,17 +106,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_character_t character) { + f_status_t f_utf_character_is_control(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_control(character); } - if (iscntrl(macro_f_utf_character_t_to_char_1(character))) { + if (iscntrl(macro_f_utf_char_t_to_char_1(character))) { return F_true; } @@ -125,17 +125,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_character_t character) { + f_status_t f_utf_character_is_control_code(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_control_code(character); } - if (iscntrl(macro_f_utf_character_t_to_char_1(character))) { + if (iscntrl(macro_f_utf_char_t_to_char_1(character))) { return F_true; } @@ -144,10 +144,10 @@ 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_character_t character) { + f_status_t character_is_control_format(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -160,10 +160,10 @@ 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_character_t character) { + f_status_t f_utf_character_is_control_picture(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -176,17 +176,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_character_t character) { + f_status_t f_utf_character_is_digit(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_digit(character); } - if (isdigit(macro_f_utf_character_t_to_char_1(character))) { + if (isdigit(macro_f_utf_char_t_to_char_1(character))) { return F_true; } @@ -195,17 +195,17 @@ 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_character_t character) { + f_status_t f_utf_character_is_emoji(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_emoji(character); } - if (isdigit(macro_f_utf_character_t_to_char_1(character))) { + if (isdigit(macro_f_utf_char_t_to_char_1(character))) { return F_true; } @@ -214,17 +214,17 @@ 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_character_t character) { + f_status_t f_utf_character_is_fragment(const f_utf_char_t character) { - return macro_f_utf_character_t_width_is(character) == 1; + return macro_f_utf_char_t_width_is(character) == 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_character_t character) { + f_status_t f_utf_character_is_graph(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -243,7 +243,7 @@ extern "C" { return F_true; } - if (isgraph(macro_f_utf_character_t_to_char_1(character))) { + if (isgraph(macro_f_utf_char_t_to_char_1(character))) { return F_true; } @@ -252,17 +252,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_character_t character) { + f_status_t f_utf_character_is_numeric(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_numeric(character); } - if (isdigit(macro_f_utf_character_t_to_char_1(character))) { + if (isdigit(macro_f_utf_char_t_to_char_1(character))) { return F_true; } @@ -271,10 +271,10 @@ 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_character_t character) { + f_status_t f_utf_character_is_phonetic(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -287,10 +287,10 @@ 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_character_t character) { + f_status_t f_utf_character_is_private(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -303,10 +303,10 @@ 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_character_t character) { + f_status_t f_utf_character_is_punctuation(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -348,10 +348,10 @@ extern "C" { #endif // _di_f_utf_character_is_punctuation_ #ifndef _di_f_utf_character_is_symbol_ - f_status_t f_utf_character_is_symbol(const f_utf_character_t character) { + f_status_t f_utf_character_is_symbol(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -378,10 +378,10 @@ 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_character_t character) { + f_status_t f_utf_character_is_unassigned(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -393,10 +393,10 @@ 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_character_t character) { + f_status_t f_utf_character_is_valid(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -408,17 +408,17 @@ extern "C" { #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_character_t character) { + f_status_t f_utf_character_is_whitespace(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_whitespace(character); } - if (isspace(macro_f_utf_character_t_to_char_1(character))) { + if (isspace(macro_f_utf_char_t_to_char_1(character))) { return F_true; } @@ -427,10 +427,10 @@ 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_character_t character) { + f_status_t f_utf_character_is_whitespace_modifier(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -443,10 +443,10 @@ 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_character_t character) { + f_status_t f_utf_character_is_whitespace_other(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -459,10 +459,10 @@ 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_character_t character) { + f_status_t f_utf_character_is_wide(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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); } @@ -475,17 +475,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_character_t character, const bool strict) { + f_status_t f_utf_character_is_word(const f_utf_char_t character, const bool strict) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_word(character, strict); } - if (isalnum(macro_f_utf_character_t_to_char_1(character)) || character == f_string_ascii_underscore_s.string[0]) { + if (isalnum(macro_f_utf_char_t_to_char_1(character)) || character == f_string_ascii_underscore_s.string[0]) { return F_true; } @@ -494,17 +494,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_character_t character, const bool strict) { + f_status_t f_utf_character_is_word_dash(const f_utf_char_t character, const bool strict) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_word_dash(character, strict); } - if (isalnum(macro_f_utf_character_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(character)) || character == f_string_ascii_underscore_s.string[0] || character == f_string_ascii_minus_s.string[0]) { return F_true; } @@ -513,17 +513,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_character_t character, const bool strict) { + f_status_t f_utf_character_is_word_dash_plus(const f_utf_char_t character, const bool strict) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_word_dash_plus(character, strict); } - if (isalnum(macro_f_utf_character_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(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]) { return F_true; } @@ -532,17 +532,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_character_t character) { + f_status_t f_utf_character_is_zero_width(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character)) { - if (macro_f_utf_character_t_width_is(character) == 1) { + 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_zero_width(character); } - const uint8_t ascii = macro_f_utf_character_t_to_char_1(character); + const uint8_t ascii = macro_f_utf_char_t_to_char_1(character); // 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 a56870d..5abd4d3 100644 --- a/level_0/f_utf/c/utf/is_character.h +++ b/level_0/f_utf/c/utf/is_character.h @@ -32,7 +32,7 @@ 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_character_t character); + extern f_status_t f_utf_character_is(const f_utf_char_t character); #endif // _di_f_utf_character_is_ /** @@ -51,7 +51,7 @@ extern "C" { * @see isalpha() */ #ifndef _di_f_utf_character_is_alpha_ - extern f_status_t f_utf_character_is_alpha(const f_utf_character_t character); + extern f_status_t f_utf_character_is_alpha(const f_utf_char_t character); #endif // _di_f_utf_character_is_alpha_ /** @@ -74,7 +74,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_character_is_alpha_digit_ - extern f_status_t f_utf_character_is_alpha_digit(const f_utf_character_t character); + extern f_status_t f_utf_character_is_alpha_digit(const f_utf_char_t character); #endif // _di_f_utf_character_is_alpha_digit_ /** @@ -95,7 +95,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_character_is_alpha_numeric_ - extern f_status_t f_utf_character_is_alpha_numeric(const f_utf_character_t character); + extern f_status_t f_utf_character_is_alpha_numeric(const f_utf_char_t character); #endif // _di_f_utf_character_is_alpha_numeric_ /** @@ -111,7 +111,7 @@ extern "C" { * 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_character_t character); + extern f_status_t f_utf_character_is_ascii(const f_utf_char_t character); #endif // _di_f_utf_character_is_ascii_ /** @@ -128,7 +128,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_is_combining_ - extern f_status_t f_utf_character_is_combining(const f_utf_character_t character); + extern f_status_t f_utf_character_is_combining(const f_utf_char_t character); #endif // _di_f_utf_character_is_combining_ /** @@ -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_character_t character); + extern f_status_t f_utf_character_is_control(const f_utf_char_t character); #endif // _di_f_utf_character_is_control_ /** @@ -170,7 +170,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_character_t character); + extern f_status_t f_utf_character_is_control_code(const f_utf_char_t character); #endif // _di_f_utf_character_is_control_code_ /** @@ -190,7 +190,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_is_control_format_ - extern f_status_t f_utf_character_is_control_format(const f_utf_character_t character); + extern f_status_t f_utf_character_is_control_format(const f_utf_char_t character); #endif // _di_f_utf_character_is_control_format_ /** @@ -209,7 +209,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_is_control_picture_ - extern f_status_t f_utf_character_is_control_picture(const f_utf_character_t character); + extern f_status_t f_utf_character_is_control_picture(const f_utf_char_t character); #endif // _di_f_utf_character_is_control_picture_ /** @@ -232,7 +232,7 @@ extern "C" { * @see isdigit() */ #ifndef _di_f_utf_character_is_digit_ - extern f_status_t f_utf_character_is_digit(const f_utf_character_t character); + extern f_status_t f_utf_character_is_digit(const f_utf_char_t character); #endif // _di_f_utf_character_is_digit_ /** @@ -251,7 +251,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_is_emoji_ - extern f_status_t f_utf_character_is_emoji(const f_utf_character_t character); + extern f_status_t f_utf_character_is_emoji(const f_utf_char_t character); #endif // _di_f_utf_character_is_emoji_ /** @@ -287,7 +287,7 @@ 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_character_t character); + extern f_status_t f_utf_character_is_fragment(const f_utf_char_t character); #endif // _di_f_utf_character_is_fragment_ /** @@ -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_character_t character); + extern f_status_t f_utf_character_is_graph(const f_utf_char_t character); #endif // _di_f_utf_character_is_graph_ /** @@ -327,7 +327,7 @@ extern "C" { * @see isdigit() */ #ifndef _di_f_utf_character_is_numeric_ - extern f_status_t f_utf_character_is_numeric(const f_utf_character_t character); + extern f_status_t f_utf_character_is_numeric(const f_utf_char_t character); #endif // _di_f_utf_character_is_numeric_ /** @@ -344,7 +344,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_is_phonetic_ - extern f_status_t f_utf_character_is_phonetic(const f_utf_character_t character); + extern f_status_t f_utf_character_is_phonetic(const f_utf_char_t character); #endif // _di_f_utf_character_is_phonetic_ /** @@ -361,7 +361,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_is_private_ - extern f_status_t f_utf_character_is_private(const f_utf_character_t character); + extern f_status_t f_utf_character_is_private(const f_utf_char_t character); #endif // _di_f_utf_character_is_private_ /** @@ -380,7 +380,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_is_punctuation_ - extern f_status_t f_utf_character_is_punctuation(const f_utf_character_t character); + extern f_status_t f_utf_character_is_punctuation(const f_utf_char_t character); #endif // _di_f_utf_character_is_punctuation_ /** @@ -399,7 +399,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_is_symbol_ - extern f_status_t f_utf_character_is_symbol(const f_utf_character_t character); + extern f_status_t f_utf_character_is_symbol(const f_utf_char_t character); #endif // _di_f_utf_character_is_symbol_ /** @@ -424,7 +424,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_character_t character); + extern f_status_t f_utf_character_is_unassigned(const f_utf_char_t character); #endif // _di_f_utf_character_is_value_ /** @@ -451,7 +451,7 @@ extern "C" { * @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_character_t character); + extern f_status_t f_utf_character_is_valid(const f_utf_char_t character); #endif // _di_f_utf_character_is_value_ /** @@ -478,7 +478,7 @@ extern "C" { * @see isspace() */ #ifndef _di_f_utf_character_is_whitespace_ - extern f_status_t f_utf_character_is_whitespace(const f_utf_character_t character); + extern f_status_t f_utf_character_is_whitespace(const f_utf_char_t character); #endif // _di_f_utf_character_is_whitespace_ /** @@ -500,7 +500,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_is_whitespace_modifier_ - extern f_status_t f_utf_character_is_whitespace_modifier(const f_utf_character_t character); + extern f_status_t f_utf_character_is_whitespace_modifier(const f_utf_char_t character); #endif // _di_f_utf_character_is_whitespace_modifier_ /** @@ -521,7 +521,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_character_t character); + extern f_status_t f_utf_character_is_whitespace_other(const f_utf_char_t character); #endif // _di_f_utf_character_is_whitespace_other_ /** @@ -544,7 +544,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_is_wide_ - extern f_status_t f_utf_character_is_wide(const f_utf_character_t character); + extern f_status_t f_utf_character_is_wide(const f_utf_char_t character); #endif // _di_f_utf_character_is_wide_ /** @@ -569,7 +569,7 @@ extern "C" { * @see isalnum() */ #ifndef _di_f_utf_character_is_word_ - extern f_status_t f_utf_character_is_word(const f_utf_character_t character, const bool strict); + extern f_status_t f_utf_character_is_word(const f_utf_char_t character, const bool strict); #endif // _di_f_utf_character_is_word_ /** @@ -599,7 +599,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_character_t character, const bool strict); + extern f_status_t f_utf_character_is_word_dash(const f_utf_char_t character, const bool strict); #endif // _di_f_utf_character_is_word_dash_ /** @@ -631,7 +631,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_character_t character, const bool strict); + extern f_status_t f_utf_character_is_word_dash_plus(const f_utf_char_t character, const bool strict); #endif // _di_f_utf_character_is_word_dash_plus_ /** @@ -650,7 +650,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_character_is_zero_width_ - extern f_status_t f_utf_character_is_zero_width(const f_utf_character_t character); + extern f_status_t f_utf_character_is_zero_width(const f_utf_char_t character); #endif // _di_f_utf_character_is_zero_width_ #ifdef __cplusplus diff --git a/level_0/f_utf/c/utf/private-dynamic.c b/level_0/f_utf/c/utf/private-dynamic.c index ea502db..41aa631 100644 --- a/level_0/f_utf/c/utf/private-dynamic.c +++ b/level_0/f_utf/c/utf/private-dynamic.c @@ -9,7 +9,7 @@ extern "C" { #if !defined(_di_f_utf_string_dynamic_adjust_) || !defined(_di_f_utf_string_dynamic_decimate_by_) || !defined(_di_f_utf_string_dynamics_adjust_) || !defined(_di_f_utf_string_dynamics_append_) || !defined(_di_f_utf_string_dynamics_decimate_by_) || !defined(_di_f_utf_string_map_multis_adjust_) || !defined(_di_f_utf_string_map_multis_append_) || !defined(_di_f_utf_string_triples_adjust_) || !defined(_di_f_utf_string_triples_decimate_by_) f_status_t private_f_utf_string_dynamic_adjust(const f_array_length_t length, f_utf_string_dynamic_t * const dynamic) { - const f_status_t status = f_memory_adjust(dynamic->size, length, sizeof(f_char_t), (void **) & dynamic->string); + const f_status_t status = f_memory_adjust(dynamic->size, length, sizeof(f_utf_char_t), (void **) & dynamic->string); if (F_status_is_error(status)) return status; dynamic->size = length; @@ -40,7 +40,7 @@ extern "C" { #if !defined(_di_f_utf_string_append_) || !defined(_di_f_utf_string_append_assure_) || !defined(_di_f_utf_string_append_mash_) || !defined(_di_f_utf_string_append_nulless_) || !defined(_di_f_utf_string_dynamic_append_) || !defined(_di_f_utf_string_dynamic_append_assure_) || !defined(_di_f_utf_string_dynamic_append_nulless_) || !defined(_di_f_utf_string_dynamic_decrease_by_) || !defined(_di_f_utf_string_dynamic_increase_) || !defined(_di_f_utf_string_dynamic_increase_by_) || !defined(_di_f_utf_string_dynamic_mash_) || !defined(_di_f_utf_string_dynamic_mash_nulless_) || !defined(f_utf_string_dynamic_partial_append) || !defined(_di_f_utf_string_dynamic_partial_append_assure_) || !defined(_di_f_utf_string_dynamic_partial_mash_) || !defined(_di_f_utf_string_dynamic_prepend_) || !defined(_di_f_utf_string_dynamic_prepend_nulless_) || !defined(_di_f_utf_string_dynamic_terminate_) || !defined(_di_f_utf_string_dynamic_terminate_after_) || !defined(_di_f_utf_string_dynamics_append_) || !defined(_di_f_utf_string_map_multis_append_) || !defined(_di_f_utf_string_mash_nulless_) || !defined(_di_f_utf_string_mash_) || !defined(_di_f_utf_string_maps_append_) || !defined(_di_f_utf_string_prepend_) || !defined(_di_f_utf_string_prepend_nulless_) || !defined(_di_f_utf_string_triples_append_) f_status_t private_f_utf_string_dynamic_resize(const f_array_length_t length, f_utf_string_dynamic_t * const dynamic) { - const f_status_t status = f_memory_resize(dynamic->size, length, sizeof(f_char_t), (void **) & dynamic->string); + const f_status_t status = f_memory_resize(dynamic->size, length, sizeof(f_utf_char_t), (void **) & dynamic->string); if (F_status_is_error(status)) return status; dynamic->size = length; diff --git a/level_0/f_utf/c/utf/private-is_unassigned.c b/level_0/f_utf/c/utf/private-is_unassigned.c index 6965e07..a9a7635 100644 --- a/level_0/f_utf/c/utf/private-is_unassigned.c +++ b/level_0/f_utf/c/utf/private-is_unassigned.c @@ -7,13 +7,13 @@ extern "C" { #endif #if !defined(_di_f_utf_character_is_unassigned_) || !defined(_di_f_utf_is_unassigned_) - f_status_t private_f_utf_character_is_unassigned(const f_utf_character_t character) { + f_status_t private_f_utf_character_is_unassigned(const f_utf_char_t character) { - if (macro_f_utf_character_t_width_is(character) < 2) { + if (macro_f_utf_char_t_width_is(character) < 2) { return F_false; } - if (macro_f_utf_character_t_width_is(character) == 2) { + if (macro_f_utf_char_t_width_is(character) == 2) { // Greek and Coptic: U+0378 to U+0379. if (character >= 0xcdb80000 && character <= 0xcdb90000) { @@ -83,7 +83,7 @@ extern "C" { return F_false; } - if (macro_f_utf_character_t_width_is(character) == 3) { + if (macro_f_utf_char_t_width_is(character) == 3) { // Samaritan: U+082E, U+082F, U+083F. if (character == 0xe0a0ae00 || character == 0xe0a0af00 || character == 0xe0a0bf00) { diff --git a/level_0/f_utf/c/utf/private-is_unassigned.h b/level_0/f_utf/c/utf/private-is_unassigned.h index 05ed8da..a44244d 100644 --- a/level_0/f_utf/c/utf/private-is_unassigned.h +++ b/level_0/f_utf/c/utf/private-is_unassigned.h @@ -36,7 +36,7 @@ extern "C" { * @see f_utf_is_unassigned() */ #if !defined(_di_f_utf_character_is_unassigned_) || !defined(_di_f_utf_is_unassigned_) - extern f_status_t private_f_utf_character_is_unassigned(const f_utf_character_t character) F_attribute_visibility_internal_d; + extern f_status_t private_f_utf_character_is_unassigned(const f_utf_char_t character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_utf_character_is_unassigned_) || !defined(_di_f_utf_is_unassigned_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/utf/private-string.c b/level_0/f_utf/c/utf/private-string.c index e15b5d3..eeb35d4 100644 --- a/level_0/f_utf/c/utf/private-string.c +++ b/level_0/f_utf/c/utf/private-string.c @@ -14,7 +14,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - memcpy(destination->string + destination->used, source, sizeof(f_utf_character_t) * length); + memcpy(destination->string + destination->used, source, sizeof(f_utf_char_t) * length); destination->used += length; destination->string[destination->used] = 0; @@ -49,7 +49,7 @@ extern "C" { if (i && i > first) { size = i - first; - memcpy(destination->string + destination->used, source + first, sizeof(f_utf_character_t) * size); + memcpy(destination->string + destination->used, source + first, sizeof(f_utf_char_t) * size); destination->used += size; } @@ -63,7 +63,7 @@ extern "C" { if (i > first) { size = i - first; - memcpy(destination->string + destination->used, source + first, sizeof(f_utf_character_t) * size); + memcpy(destination->string + destination->used, source + first, sizeof(f_utf_char_t) * size); destination->used += size; } @@ -86,14 +86,15 @@ extern "C" { } if (destination->used) { - memmove(destination->string + length, destination->string, destination->used); - memcpy(destination->string, source, sizeof(f_utf_character_t) * length); + memmove(destination->string + length, destination->string, sizeof(f_utf_char_t) * destination->used); + memcpy(destination->string, source, sizeof(f_utf_char_t) * length); } else { - memcpy(destination->string, source, sizeof(f_utf_character_t) * length); + memcpy(destination->string, source, sizeof(f_utf_char_t) * length); } destination->used += length; + return F_none; } #endif // !defined(_di_f_utf_string_dynamic_mish_) || !defined(_di_f_utf_string_dynamic_partial_mish_) || !defined(_di_f_utf_string_dynamic_partial_prepend_assure_) || !defined(_di_f_utf_string_dynamic_partial_prepend_) || !defined(_di_f_utf_string_dynamic_prepend_assure_) || !defined(_di_f_utf_string_dynamic_prepend_) || !defined(_di_f_utf_string_mish_) || !defined(_di_f_utf_string_prepend_assure_) || !defined(_di_f_utf_string_prepend_) @@ -123,8 +124,8 @@ extern "C" { if (F_status_is_error(status)) return status; } - memmove(destination->string + offset + size, destination->string + offset, destination->used - offset); - memcpy(destination->string + offset, source + first, size); + memmove(destination->string + offset + size, destination->string + offset, sizeof(f_utf_char_t) * (destination->used - offset)); + memcpy(destination->string + offset, source + first, sizeof(f_utf_char_t) * size); destination->used += size; offset += size; @@ -143,8 +144,8 @@ extern "C" { if (F_status_is_error(status)) return status; } - memmove(destination->string + offset + size, destination->string + offset, destination->used - offset); - memcpy(destination->string + offset, source + first, sizeof(f_utf_character_t) * size); + memmove(destination->string + offset + size, destination->string + offset, sizeof(f_utf_char_t) * (destination->used - offset)); + memcpy(destination->string + offset, source + first, sizeof(f_utf_char_t) * size); destination->used += size; offset += size; @@ -156,6 +157,7 @@ extern "C" { } // while first = i + 1; + continue; } } // for diff --git a/level_0/f_utf/c/utf/string.c b/level_0/f_utf/c/utf/string.c index f836462..81f2431 100644 --- a/level_0/f_utf/c/utf/string.c +++ b/level_0/f_utf/c/utf/string.c @@ -298,9 +298,9 @@ extern "C" { return F_data_not_stop; } - while (string[range->start] != F_utf_character_t_eol_d) { + while (string[range->start] != F_utf_char_t_eol_d) { - if (macro_f_utf_character_t_width_is(string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf_fragment); } @@ -327,11 +327,11 @@ extern "C" { while (string[range->start] != seek_to) { - if (macro_f_utf_character_t_width_is(string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf_fragment); } - if (string[range->start] == F_utf_character_t_eol_d) { + if (string[range->start] == F_utf_char_t_eol_d) { return F_none_eol; } @@ -358,7 +358,7 @@ extern "C" { while (string[range->start] != seek_to) { - if (macro_f_utf_character_t_width_is(string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf_fragment); } diff --git a/level_0/f_utf/tests/unit/c/test-utf-append.c b/level_0/f_utf/tests/unit/c/test-utf-append.c index 95bcd92..f9ad946 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-append.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_append__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -16,8 +16,9 @@ void test__f_utf_append__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-append_assure.c b/level_0/f_utf/tests/unit/c/test-utf-append_assure.c index 49a22b3..144501f 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-append_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-append_assure.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_append_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -16,8 +16,9 @@ void test__f_utf_append_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -27,8 +28,9 @@ void test__f_utf_append_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-append_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-append_assure_nulless.c index 350b089..b47ecb8 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-append_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-append_assure_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_append_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -17,7 +17,9 @@ void test__f_utf_append_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -27,7 +29,9 @@ void test__f_utf_append_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-append_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-append_nulless.c index 0169d3e..e25db2b 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-append_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-append_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_append_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -17,7 +17,9 @@ void test__f_utf_append_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append.c index af7e4e6..15aa0ed 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_dynamic_append__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -16,8 +16,9 @@ void test__f_utf_dynamic_append__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure.c index 8240ec0..b74c8a8 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_dynamic_append_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -16,8 +16,9 @@ void test__f_utf_dynamic_append_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -27,8 +28,9 @@ void test__f_utf_dynamic_append_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure_nulless.c index 978a8e1..91b36b7 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_append_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -17,7 +17,9 @@ void test__f_utf_dynamic_append_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -27,7 +29,9 @@ void test__f_utf_dynamic_append_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_nulless.c index c4dc1f6..86a5923 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_append_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -17,7 +17,9 @@ void test__f_utf_dynamic_append_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash.c index b0772dd..1481647 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_mash__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("te\0st:te\0st", 0, 11); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,8 +18,9 @@ void test__f_utf_dynamic_mash__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } // Check that the glue is added. @@ -29,9 +30,9 @@ void test__f_utf_dynamic_mash__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); - assert_string_equal(destination.string + 3, expected.string + 3); - assert_string_equal(destination.string + 9, expected.string + 9); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); @@ -39,8 +40,8 @@ void test__f_utf_dynamic_mash__works(void **state) { void test__f_utf_dynamic_mash__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); { const f_status_t status = f_utf_string_dynamic_mash(glue, source, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash_nulless.c index ad27a0c..9b14aa6 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash_nulless.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_dynamic_mash_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize("test", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize("test:test", 0, 9); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -19,7 +19,9 @@ void test__f_utf_dynamic_mash_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected1.used); - assert_string_equal(destination.string, expected1.string); + for (f_array_length_t i = 0; i < expected1.used; ++i) { + assert_int_equal(destination.string[i], expected1.string[i]); + } // for } // Check that the glue is added. @@ -29,7 +31,9 @@ void test__f_utf_dynamic_mash_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected2.used); - assert_string_equal(destination.string, expected2.string); + for (f_array_length_t i = 0; i < expected2.used; ++i) { + assert_int_equal(destination.string[i], expected2.string[i]); + } // for } free((void *) destination.string); @@ -37,8 +41,8 @@ void test__f_utf_dynamic_mash_nulless__works(void **state) { void test__f_utf_dynamic_mash_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); { const f_status_t status = f_utf_string_dynamic_mash_nulless(glue, source, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish.c index 7dc482d..ea7fa96 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_mish__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("te\0st:te\0st", 0, 11); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,8 +18,9 @@ void test__f_utf_dynamic_mish__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } // Check that the glue is added. @@ -29,9 +30,9 @@ void test__f_utf_dynamic_mish__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); - assert_string_equal(destination.string + 3, expected.string + 3); - assert_string_equal(destination.string + 9, expected.string + 9); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); @@ -39,8 +40,8 @@ void test__f_utf_dynamic_mish__works(void **state) { void test__f_utf_dynamic_mish__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); { const f_status_t status = f_utf_string_dynamic_mish(glue, source, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish_nulless.c index b50121e..19f765d 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish_nulless.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_dynamic_mish_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize("test", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize("test:test", 0, 9); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -19,7 +19,9 @@ void test__f_utf_dynamic_mish_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected1.used); - assert_string_equal(destination.string, expected1.string); + for (f_array_length_t i = 0; i < expected1.used; ++i) { + assert_int_equal(destination.string[i], expected1.string[i]); + } // for } // Check that the glue is added. @@ -29,7 +31,9 @@ void test__f_utf_dynamic_mish_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected2.used); - assert_string_equal(destination.string, expected2.string); + for (f_array_length_t i = 0; i < expected2.used; ++i) { + assert_int_equal(destination.string[i], expected2.string[i]); + } // for } free((void *) destination.string); @@ -37,8 +41,8 @@ void test__f_utf_dynamic_mish_nulless__works(void **state) { void test__f_utf_dynamic_mish_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); { const f_status_t status = f_utf_string_dynamic_mish_nulless(glue, source, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append.c index 50d94d8..1f351f9 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_partial_append__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,8 +18,9 @@ void test__f_utf_dynamic_partial_append__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); - assert_string_equal(destination.string + 3, expected.string + 3); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); @@ -28,7 +29,7 @@ void test__f_utf_dynamic_partial_append__works(void **state) { void test__f_utf_dynamic_partial_append__parameter_checking(void **state) { const f_utf_string_dynamic_t data = f_utf_string_dynamic_t_initialize; - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_append(data, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure.c index e30e6f5..8f49da4 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_partial_append_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,8 +18,9 @@ void test__f_utf_dynamic_partial_append_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); - assert_string_equal(destination.string + 3, expected.string + 3); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -29,8 +30,9 @@ void test__f_utf_dynamic_partial_append_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); - assert_string_equal(destination.string + 3, expected.string + 3); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); @@ -39,7 +41,7 @@ void test__f_utf_dynamic_partial_append_assure__works(void **state) { void test__f_utf_dynamic_partial_append_assure__parameter_checking(void **state) { const f_utf_string_dynamic_t data = f_utf_string_dynamic_t_initialize; - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_append_assure(data, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure_nulless.c index 2a245ee..81efb73 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure_nulless.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_partial_append_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,7 +18,9 @@ void test__f_utf_dynamic_partial_append_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -28,7 +30,9 @@ void test__f_utf_dynamic_partial_append_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); @@ -37,7 +41,7 @@ void test__f_utf_dynamic_partial_append_assure_nulless__works(void **state) { void test__f_utf_dynamic_partial_append_assure_nulless__parameter_checking(void **state) { const f_utf_string_dynamic_t data = f_utf_string_dynamic_t_initialize; - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_append_assure_nulless(data, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_nulless.c index 485f5dc..46917ea 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_nulless.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_partial_append_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,7 +18,9 @@ void test__f_utf_dynamic_partial_append_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); @@ -27,7 +29,7 @@ void test__f_utf_dynamic_partial_append_nulless__works(void **state) { void test__f_utf_dynamic_partial_append_nulless__parameter_checking(void **state) { const f_utf_string_dynamic_t data = f_utf_string_dynamic_t_initialize; - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_append_nulless(data, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash.c index eda4a16..85095eb 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash.c @@ -7,11 +7,11 @@ extern "C" { void test__f_utf_dynamic_partial_mash__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize("te\0st:te\0st", 0, 11); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -20,8 +20,9 @@ void test__f_utf_dynamic_partial_mash__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected1.used); - assert_string_equal(destination.string, expected1.string); - assert_string_equal(destination.string + 3, expected1.string + 3); + for (f_array_length_t i = 0; i < expected1.used; ++i) { + assert_int_equal(destination.string[i], expected1.string[i]); + } // for } // Check that the glue is added. @@ -31,9 +32,9 @@ void test__f_utf_dynamic_partial_mash__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected2.used); - assert_string_equal(destination.string, expected2.string); - assert_string_equal(destination.string + 3, expected2.string + 3); - assert_string_equal(destination.string + 9, expected2.string + 9); + for (f_array_length_t i = 0; i < expected2.used; ++i) { + assert_int_equal(destination.string[i], expected2.string[i]); + } // for } free((void *) destination.string); @@ -41,9 +42,9 @@ void test__f_utf_dynamic_partial_mash__works(void **state) { void test__f_utf_dynamic_partial_mash__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_mash(glue, source, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash_nulless.c index ccbe0da..04b0bc0 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash_nulless.c @@ -7,11 +7,11 @@ extern "C" { void test__f_utf_dynamic_partial_mash_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize("test", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize("test:test", 0, 9); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -20,7 +20,9 @@ void test__f_utf_dynamic_partial_mash_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected1.used); - assert_string_equal(destination.string, expected1.string); + for (f_array_length_t i = 0; i < expected1.used; ++i) { + assert_int_equal(destination.string[i], expected1.string[i]); + } // for } // Check that the glue is added. @@ -30,7 +32,9 @@ void test__f_utf_dynamic_partial_mash_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected2.used); - assert_string_equal(destination.string, expected2.string); + for (f_array_length_t i = 0; i < expected2.used; ++i) { + assert_int_equal(destination.string[i], expected2.string[i]); + } // for } free((void *) destination.string); @@ -38,9 +42,9 @@ void test__f_utf_dynamic_partial_mash_nulless__works(void **state) { void test__f_utf_dynamic_partial_mash_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_mash_nulless(glue, source, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish.c index ff68bb3..0e60cca 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish.c @@ -7,11 +7,11 @@ extern "C" { void test__f_utf_dynamic_partial_mish__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize("te\0st:te\0st", 0, 11); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -20,8 +20,9 @@ void test__f_utf_dynamic_partial_mish__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected1.used); - assert_string_equal(destination.string, expected1.string); - assert_string_equal(destination.string + 3, expected1.string + 3); + for (f_array_length_t i = 0; i < expected1.used; ++i) { + assert_int_equal(destination.string[i], expected1.string[i]); + } // for } // Check that the glue is added. @@ -31,9 +32,9 @@ void test__f_utf_dynamic_partial_mish__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected2.used); - assert_string_equal(destination.string, expected2.string); - assert_string_equal(destination.string + 3, expected2.string + 3); - assert_string_equal(destination.string + 9, expected2.string + 9); + for (f_array_length_t i = 0; i < expected2.used; ++i) { + assert_int_equal(destination.string[i], expected2.string[i]); + } // for } free((void *) destination.string); @@ -41,9 +42,9 @@ void test__f_utf_dynamic_partial_mish__works(void **state) { void test__f_utf_dynamic_partial_mish__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_mish(glue, source, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish_nulless.c index cbc62db..f789563 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish_nulless.c @@ -7,11 +7,11 @@ extern "C" { void test__f_utf_dynamic_partial_mish_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize("test", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize("test:test", 0, 9); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -20,7 +20,9 @@ void test__f_utf_dynamic_partial_mish_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected1.used); - assert_string_equal(destination.string, expected1.string); + for (f_array_length_t i = 0; i < expected1.used; ++i) { + assert_int_equal(destination.string[i], expected1.string[i]); + } // for } // Check that the glue is added. @@ -30,7 +32,9 @@ void test__f_utf_dynamic_partial_mish_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected2.used); - assert_string_equal(destination.string, expected2.string); + for (f_array_length_t i = 0; i < expected2.used; ++i) { + assert_int_equal(destination.string[i], expected2.string[i]); + } // for } free((void *) destination.string); @@ -38,9 +42,9 @@ void test__f_utf_dynamic_partial_mish_nulless__works(void **state) { void test__f_utf_dynamic_partial_mish_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_mish_nulless(glue, source, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend.c index 5e60c6c..737ebee 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_partial_prepend__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,8 +18,9 @@ void test__f_utf_dynamic_partial_prepend__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); - assert_string_equal(destination.string + 3, expected.string + 3); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); @@ -28,7 +29,7 @@ void test__f_utf_dynamic_partial_prepend__works(void **state) { void test__f_utf_dynamic_partial_prepend__parameter_checking(void **state) { const f_utf_string_dynamic_t data = f_utf_string_dynamic_t_initialize; - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_prepend(data, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure.c index 12fd2c5..e486905 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_partial_prepend_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,8 +18,9 @@ void test__f_utf_dynamic_partial_prepend_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); - assert_string_equal(destination.string + 3, expected.string + 3); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -29,8 +30,9 @@ void test__f_utf_dynamic_partial_prepend_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); - assert_string_equal(destination.string + 3, expected.string + 3); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); @@ -39,7 +41,7 @@ void test__f_utf_dynamic_partial_prepend_assure__works(void **state) { void test__f_utf_dynamic_partial_prepend_assure__parameter_checking(void **state) { const f_utf_string_dynamic_t data = f_utf_string_dynamic_t_initialize; - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_prepend_assure(data, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure_nulless.c index a2a3a88..0c39395 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure_nulless.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_partial_prepend_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,7 +18,9 @@ void test__f_utf_dynamic_partial_prepend_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -28,7 +30,9 @@ void test__f_utf_dynamic_partial_prepend_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); @@ -37,7 +41,7 @@ void test__f_utf_dynamic_partial_prepend_assure_nulless__works(void **state) { void test__f_utf_dynamic_partial_prepend_assure_nulless__parameter_checking(void **state) { const f_utf_string_dynamic_t data = f_utf_string_dynamic_t_initialize; - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_prepend_assure_nulless(data, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_nulless.c index c8f50d0..c161ed2 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_nulless.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_partial_prepend_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("_te\0st_", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); - const f_string_range_t partial = macro_f_utf_string_range_t_initialize(1, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,7 +18,9 @@ void test__f_utf_dynamic_partial_prepend_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); @@ -27,7 +29,7 @@ void test__f_utf_dynamic_partial_prepend_nulless__works(void **state) { void test__f_utf_dynamic_partial_prepend_nulless__parameter_checking(void **state) { const f_utf_string_dynamic_t data = f_utf_string_dynamic_t_initialize; - const f_string_range_t partial = f_utf_string_range_t_initialize; + const f_string_range_t partial = f_string_range_t_initialize; { const f_status_t status = f_utf_string_dynamic_partial_prepend_nulless(data, partial, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend.c index 1cc88b4..8864852 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_dynamic_prepend__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -16,8 +16,9 @@ void test__f_utf_dynamic_prepend__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure.c index e6ee446..f3ce21c 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_dynamic_prepend_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -16,8 +16,9 @@ void test__f_utf_dynamic_prepend_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -27,8 +28,9 @@ void test__f_utf_dynamic_prepend_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure_nulless.c index 8a5a39a..37499a9 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_prepend_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -17,7 +17,9 @@ void test__f_utf_dynamic_prepend_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -27,7 +29,9 @@ void test__f_utf_dynamic_prepend_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_nulless.c index ba61a9a..7737631 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_prepend_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -17,7 +17,9 @@ void test__f_utf_dynamic_prepend_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line.c index 708952a..03a4987 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_dynamic_seek_line__returns_data_not_stop(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test\nafter", 0, 10); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); { - f_string_range_t range = f_utf_string_range_t_initialize; + f_string_range_t range = f_string_range_t_initialize; const f_status_t status = f_utf_string_dynamic_seek_line(source, &range); @@ -20,10 +20,10 @@ void test__f_utf_dynamic_seek_line__returns_data_not_stop(void **state) { void test__f_utf_dynamic_seek_line__returns_none_eos(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_dynamic_seek_line(source, &range); @@ -36,10 +36,10 @@ void test__f_utf_dynamic_seek_line__returns_none_eos(void **state) { void test__f_utf_dynamic_seek_line__returns_none_stop(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 2); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 2); const f_status_t status = f_utf_string_dynamic_seek_line(source, &range); @@ -52,10 +52,10 @@ void test__f_utf_dynamic_seek_line__returns_none_stop(void **state) { void test__f_utf_dynamic_seek_line__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test\nafter", 0, 10); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_dynamic_seek_line(source, &range); @@ -68,7 +68,7 @@ void test__f_utf_dynamic_seek_line__works(void **state) { void test__f_utf_dynamic_seek_line__parameter_checking(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("teX\nst", 0, 6); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); { const f_status_t status = f_utf_string_dynamic_seek_line(source, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.c index 9587891..9d6ac86 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.c @@ -7,11 +7,11 @@ extern "C" { void test__f_utf_dynamic_seek_line_to__at_newline(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\nXst", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t\0\0\0", 0, 6); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_dynamic_seek_line_to(source, to.string[0], &range); @@ -24,11 +24,11 @@ void test__f_utf_dynamic_seek_line_to__at_newline(void **state) { void test__f_utf_dynamic_seek_line_to__returns_data_not_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test\nafter", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); { - f_string_range_t range = f_utf_string_range_t_initialize; + f_string_range_t range = f_string_range_t_initialize; const f_status_t status = f_utf_string_dynamic_seek_line_to(source, to.string[0], &range); @@ -38,11 +38,11 @@ void test__f_utf_dynamic_seek_line_to__returns_data_not_stop(void **state) { void test__f_utf_dynamic_seek_line_to__returns_none_eos(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_dynamic_seek_line_to(source, to.string[0], &range); @@ -55,11 +55,11 @@ void test__f_utf_dynamic_seek_line_to__returns_none_eos(void **state) { void test__f_utf_dynamic_seek_line_to__returns_none_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 2); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 2); const f_status_t status = f_utf_string_dynamic_seek_line_to(source, to.string[0], &range); @@ -72,11 +72,11 @@ void test__f_utf_dynamic_seek_line_to__returns_none_stop(void **state) { void test__f_utf_dynamic_seek_line_to__works(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("teX\nst", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_dynamic_seek_line_to(source, to.string[0], &range); @@ -89,8 +89,8 @@ void test__f_utf_dynamic_seek_line_to__works(void **state) { void test__f_utf_dynamic_seek_line_to__parameter_checking(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("teX\nst", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); { const f_status_t status = f_utf_string_dynamic_seek_line_to(source, to.string[0], 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.c index 532b55e..d47e680 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.c @@ -7,11 +7,11 @@ extern "C" { void test__f_utf_dynamic_seek_to__returns_data_not_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test\nafter", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); { - f_string_range_t range = f_utf_string_range_t_initialize; + f_string_range_t range = f_string_range_t_initialize; const f_status_t status = f_utf_string_dynamic_seek_to(source, to.string[0], &range); @@ -21,11 +21,11 @@ void test__f_utf_dynamic_seek_to__returns_data_not_stop(void **state) { void test__f_utf_dynamic_seek_to__returns_none_eos(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test\nafter", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_dynamic_seek_to(source, to.string[0], &range); @@ -38,11 +38,11 @@ void test__f_utf_dynamic_seek_to__returns_none_eos(void **state) { void test__f_utf_dynamic_seek_to__returns_none_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test\nafter", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 2); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 2); const f_status_t status = f_utf_string_dynamic_seek_to(source, to.string[0], &range); @@ -55,11 +55,11 @@ void test__f_utf_dynamic_seek_to__returns_none_stop(void **state) { void test__f_utf_dynamic_seek_to__works(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\nXst", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t\0\0\0", 0, 6); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_dynamic_seek_to(source, to.string[0], &range); @@ -72,8 +72,8 @@ void test__f_utf_dynamic_seek_to__works(void **state) { void test__f_utf_dynamic_seek_to__parameter_checking(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("teX\nst", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); { const f_status_t status = f_utf_string_dynamic_seek_to(source, to.string[0], 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_terminate.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_terminate.c index 026749d..5cbb469 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_terminate.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_terminate.c @@ -16,7 +16,7 @@ void test__f_utf_dynamic_terminate__appends_null(void **state) { assert_int_equal(status, F_none); - data.string[0] = 'X'; + data.string[0] = (f_utf_char_t) 'X'; } { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_terminate_after.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_terminate_after.c index 3c83f1e..42d8ce9 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_terminate_after.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_terminate_after.c @@ -15,7 +15,7 @@ void test__f_utf_dynamic_terminate_after__appends_null(void **state) { assert_int_equal(status, F_none); - data.string[0] = 'X'; + data.string[0] = (f_utf_char_t) 'X'; } { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamics_append.c b/level_0/f_utf/tests/unit/c/test-utf-dynamics_append.c index 1fccbed..bd415da 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamics_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamics_append.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_dynamics_append__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); f_utf_string_dynamics_t destination = f_utf_string_dynamics_t_initialize; { @@ -17,8 +17,9 @@ void test__f_utf_dynamics_append__works(void **state) { assert_int_equal(destination.used, 1); assert_int_equal(destination.array[0].used, source.used); - assert_string_equal(destination.array[0].string, source.string); - assert_string_equal(destination.array[0].string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[0].string[i], source.string[i]); + } // for } free((void *) destination.array[0].string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamics_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-dynamics_append_all.c index 5c7ee66..21bca4c 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamics_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamics_append_all.c @@ -12,8 +12,8 @@ void test__f_utf_dynamics_append_all__works(void **state) { f_utf_string_dynamics_t destination = f_utf_string_dynamics_t_initialize; const f_utf_string_static_t test_sources[] = { - macro_f_utf_string_static_t_initialize("te\0st1", 0, 6), - macro_f_utf_string_static_t_initialize("test2", 0, 5), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\01\0\0\0", 0, 6), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\02\0\0\0", 0, 5), }; { @@ -29,8 +29,9 @@ void test__f_utf_dynamics_append_all__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(source.array[source.used].used, test_sources[source.used].used); - assert_string_equal(source.array[source.used].string, test_sources[source.used].string); - assert_string_equal(source.array[source.used].string + 3, test_sources[source.used].string + 3); + for (f_array_length_t i = 0; i < source.array[source.used].used; ++i) { + assert_int_equal(source.array[source.used].string[i], test_sources[source.used].string[i]); + } // for } // for } @@ -41,11 +42,13 @@ void test__f_utf_dynamics_append_all__works(void **state) { assert_int_equal(destination.used, source.used); assert_int_equal(destination.size, source.used); - for (f_array_length_t i = 0; i < length_inner; ++i) { + for (f_array_length_t i = 0; i < source.used; ++i) { assert_int_equal(destination.array[i].used, source.array[i].used); - assert_string_equal(destination.array[i].string, source.array[i].string); + for (f_array_length_t j = 0; j < destination.array[i].used; ++j) { + assert_int_equal(destination.array[i].string[j], source.array[i].string[j]); + } // for } // for } diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamicss_append.c b/level_0/f_utf/tests/unit/c/test-utf-dynamicss_append.c index 1f56ed7..fbd4e4c 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamicss_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamicss_append.c @@ -12,8 +12,8 @@ void test__f_utf_dynamicss_append__works(void **state) { f_utf_string_dynamicss_t destination = f_utf_string_dynamicss_t_initialize; const f_utf_string_static_t test_names[] = { - macro_f_utf_string_static_t_initialize("test1", 0, 5), - macro_f_utf_string_static_t_initialize("test2", 0, 5), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\01\0\0\0", 0, 5), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\02\0\0\0", 0, 5), }; { @@ -27,8 +27,11 @@ void test__f_utf_dynamicss_append__works(void **state) { status = f_utf_string_dynamic_append(test_names[source.used], &source.array[source.used]); assert_int_equal(status, F_none); - assert_string_equal(source.array[source.used].string, test_names[source.used].string); assert_int_equal(source.array[source.used].used, test_names[source.used].used); + + for (f_array_length_t i = 0; i < source.array[source.used].used; ++i) { + assert_int_equal(source.array[source.used].string[i], test_names[source.used].string[i]); + } // for } // for } @@ -41,7 +44,10 @@ void test__f_utf_dynamicss_append__works(void **state) { for (f_array_length_t i = 0; i < length_inner; ++i) { assert_int_equal(destination.array[0].array[i].used, test_names[i].used); - assert_string_equal(destination.array[0].array[i].string, test_names[i].string); + + for (f_array_length_t j = 0; j < destination.array[0].array[i].used; ++j) { + assert_int_equal(destination.array[0].array[i].string[j], test_names[i].string[j]); + } // for } // for } @@ -49,7 +55,6 @@ void test__f_utf_dynamicss_append__works(void **state) { free((void *) source.array[i].string); } // for - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { free((void *) destination.array[0].array[i].string); } // for diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamicss_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-dynamicss_append_all.c index 7f701dd..66b2b6a 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamicss_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamicss_append_all.c @@ -14,8 +14,8 @@ void test__f_utf_dynamicss_append_all__works(void **state) { f_utf_string_dynamicss_t destination = f_utf_string_dynamicss_t_initialize; const f_utf_string_static_t test_names[] = { - macro_f_utf_string_static_t_initialize("test1", 0, 5), - macro_f_utf_string_static_t_initialize("test2", 0, 5), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\01\0\0\0", 0, 5), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\02\0\0\0", 0, 5), }; { @@ -41,8 +41,11 @@ void test__f_utf_dynamicss_append_all__works(void **state) { status = f_utf_string_dynamic_append(test_names[i], &source.array[source.used].array[i]); assert_int_equal(status, F_none); - assert_string_equal(source.array[source.used].array[i].string, test_names[i].string); assert_int_equal(source.array[source.used].array[i].used, test_names[i].used); + + for (f_array_length_t j = 0; j < source.array[source.used].array[i].used; ++j) { + assert_int_equal(source.array[source.used].array[i].string[j], test_names[i].string[j]); + } // for } // for source.array[source.used].used = length_inner; @@ -61,7 +64,9 @@ void test__f_utf_dynamicss_append_all__works(void **state) { assert_int_equal(destination.array[j].array[i].used, test_names[i].used); - assert_string_equal(destination.array[j].array[i].string, test_names[i].string); + for (f_array_length_t k = 0; k < destination.array[j].array[i].used; ++k) { + assert_int_equal(destination.array[j].array[i].string[k], test_names[i].string[k]); + } // for } // for } // for } diff --git a/level_0/f_utf/tests/unit/c/test-utf-map_multis_append.c b/level_0/f_utf/tests/unit/c/test-utf-map_multis_append.c index c3e2b91..0de5838 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-map_multis_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-map_multis_append.c @@ -12,11 +12,11 @@ void test__f_utf_map_multis_append__works(void **state) { f_utf_string_map_multis_t destination = f_utf_string_map_multis_t_initialize; f_utf_string_static_t test_value_array[] = { - macro_f_utf_string_static_t_initialize("test_value1", 0, 11), - macro_f_utf_string_static_t_initialize("test_value2", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\01\0\0\0", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\02\0\0\0", 0, 11), }; - const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize("test_name", 0, 9); + const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\0", 0, 9); const f_utf_string_statics_t test_value = macro_f_utf_string_statics_t_initialize(test_value_array, 0, length_values); { @@ -24,7 +24,10 @@ void test__f_utf_map_multis_append__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(source.name.used, test_name.used); - assert_string_equal(source.name.string, test_name.string); + + for (f_array_length_t i = 0; i < source.name.used; ++i) { + assert_int_equal(source.name.string[i], test_name.string[i]); + } // for status = f_utf_string_dynamics_append_all(test_value, &source.value); @@ -33,8 +36,13 @@ void test__f_utf_map_multis_append__works(void **state) { assert_int_equal(source.value.array[0].used, test_value.array[0].used); assert_int_equal(source.value.array[1].used, test_value.array[1].used); - assert_string_equal(source.value.array[0].string, test_value.array[0].string); - assert_string_equal(source.value.array[1].string, test_value.array[1].string); + for (f_array_length_t i = 0; i < source.value.array[0].used; ++i) { + assert_int_equal(source.value.array[0].string[i], test_value.array[0].string[i]); + } // for + + for (f_array_length_t i = 0; i < source.value.array[1].used; ++i) { + assert_int_equal(source.value.array[1].string[i], test_value.array[1].string[i]); + } // for } { @@ -50,6 +58,18 @@ void test__f_utf_map_multis_append__works(void **state) { assert_string_equal(destination.array[0].name.string, source.name.string); assert_string_equal(destination.array[0].value.array[0].string, source.value.array[0].string); assert_string_equal(destination.array[0].value.array[1].string, source.value.array[1].string); + + for (f_array_length_t j = 0; j < destination.array[0].name.used; ++j) { + assert_int_equal(destination.array[0].name.string[j], source.name.string[j]); + } // for + + for (f_array_length_t j = 0; j < destination.array[0].value.array[0].used; ++j) { + assert_int_equal(destination.array[0].value.array[0].string[j], source.value.array[0].string[j]); + } // for + + for (f_array_length_t j = 0; j < destination.array[0].value.array[1].used; ++j) { + assert_int_equal(destination.array[0].value.array[1].string[j], source.value.array[1].string[j]); + } // for } free((void *) source.name.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-map_multis_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-map_multis_append_all.c index 74b9468..92a83d3 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-map_multis_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-map_multis_append_all.c @@ -13,11 +13,11 @@ void test__f_utf_map_multis_append_all__works(void **state) { f_utf_string_map_multis_t destination = f_utf_string_map_multis_t_initialize; f_utf_string_static_t test_value_array[] = { - macro_f_utf_string_static_t_initialize("test_value1", 0, 11), - macro_f_utf_string_static_t_initialize("test_value2", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\01\0\0\0", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\02\0\0\0", 0, 11), }; - const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize("test_name", 0, 9); + const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\0", 0, 9); const f_utf_string_statics_t test_value = macro_f_utf_string_statics_t_initialize(test_value_array, 0, length_values); { diff --git a/level_0/f_utf/tests/unit/c/test-utf-map_multiss_append.c b/level_0/f_utf/tests/unit/c/test-utf-map_multiss_append.c index 3c4db13..1c5fdd7 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-map_multiss_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-map_multiss_append.c @@ -14,18 +14,18 @@ void test__f_utf_map_multiss_append__works(void **state) { f_utf_string_map_multiss_t destination = f_utf_string_map_multiss_t_initialize; f_utf_string_static_t test_value_array1[] = { - macro_f_utf_string_static_t_initialize("test_value1", 0, 11), - macro_f_utf_string_static_t_initialize("test_value2", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\01\0\0\0", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\02\0\0\0", 0, 11), }; f_utf_string_static_t test_value_array2[] = { - macro_f_utf_string_static_t_initialize("test_value3", 0, 11), - macro_f_utf_string_static_t_initialize("test_value4", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\03\0\0\0", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\04\0\0\0", 0, 11), }; const f_utf_string_static_t test_names[] = { - macro_f_utf_string_static_t_initialize("test_name1", 0, 10), - macro_f_utf_string_static_t_initialize("test_name2", 0, 10), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\01\0\0\0", 0, 10), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\02\0\0\0", 0, 10), }; const f_utf_string_statics_t test_values[] = { diff --git a/level_0/f_utf/tests/unit/c/test-utf-map_multiss_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-map_multiss_append_all.c index fe6dc69..8e596b6 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-map_multiss_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-map_multiss_append_all.c @@ -15,18 +15,18 @@ void test__f_utf_map_multiss_append_all__works(void **state) { f_utf_string_map_multiss_t destination = f_utf_string_map_multiss_t_initialize; f_utf_string_static_t test_value_array1[] = { - macro_f_utf_string_static_t_initialize("test_value1", 0, 11), - macro_f_utf_string_static_t_initialize("test_value2", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\01\0\0\0", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\02\0\0\0", 0, 11), }; f_utf_string_static_t test_value_array2[] = { - macro_f_utf_string_static_t_initialize("test_value3", 0, 11), - macro_f_utf_string_static_t_initialize("test_value4", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\03\0\0\0", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\04\0\0\0", 0, 11), }; const f_utf_string_static_t test_names[] = { - macro_f_utf_string_static_t_initialize("test_name1", 0, 10), - macro_f_utf_string_static_t_initialize("test_name2", 0, 10), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\01\0\0\0", 0, 10), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\02\0\0\0", 0, 10), }; const f_utf_string_statics_t test_values[] = { diff --git a/level_0/f_utf/tests/unit/c/test-utf-maps_append.c b/level_0/f_utf/tests/unit/c/test-utf-maps_append.c index 23f79b9..efb1437 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-maps_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-maps_append.c @@ -10,8 +10,8 @@ void test__f_utf_maps_append__works(void **state) { f_utf_string_map_t source = f_utf_string_map_t_initialize; f_utf_string_maps_t destination = f_utf_string_maps_t_initialize; - const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize("test_name", 0, 9); - const f_utf_string_static_t test_value = macro_f_utf_string_static_t_initialize("test_value", 0, 10); + const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\0", 0, 9); + const f_utf_string_static_t test_value = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\0", 0, 10); { f_status_t status = f_utf_string_dynamic_append(test_name, &source.name); diff --git a/level_0/f_utf/tests/unit/c/test-utf-maps_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-maps_append_all.c index a33d488..4d7e9a6 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-maps_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-maps_append_all.c @@ -12,8 +12,8 @@ void test__f_utf_maps_append_all__works(void **state) { f_utf_string_maps_t source = f_utf_string_maps_t_initialize; f_utf_string_maps_t destination = f_utf_string_maps_t_initialize; - const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize("test_name", 0, 9); - const f_utf_string_static_t test_value = macro_f_utf_string_static_t_initialize("test_value", 0, 10); + const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\0", 0, 9); + const f_utf_string_static_t test_value = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\0", 0, 10); { f_status_t status = f_utf_string_maps_resize(length_inner, &source); diff --git a/level_0/f_utf/tests/unit/c/test-utf-mapss_append.c b/level_0/f_utf/tests/unit/c/test-utf-mapss_append.c index b508517..6b7eb41 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-mapss_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-mapss_append.c @@ -12,13 +12,13 @@ void test__f_utf_mapss_append__works(void **state) { f_utf_string_mapss_t destination = f_utf_string_mapss_t_initialize; const f_utf_string_static_t test_names[] = { - macro_f_utf_string_static_t_initialize("test_name1", 0, 10), - macro_f_utf_string_static_t_initialize("test_name2", 0, 10), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\01\0\0\0", 0, 10), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\02\0\0\0", 0, 10), }; const f_utf_string_static_t test_values[] = { - macro_f_utf_string_static_t_initialize("test_value1", 0, 11), - macro_f_utf_string_static_t_initialize("test_value2", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\01\0\0\0", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\02\0\0\0", 0, 11), }; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-mapss_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-mapss_append_all.c index 16d8e5e..0205c2d 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-mapss_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-mapss_append_all.c @@ -14,13 +14,13 @@ void test__f_utf_mapss_append_all__works(void **state) { f_utf_string_mapss_t destination = f_utf_string_mapss_t_initialize; const f_utf_string_static_t test_names[] = { - macro_f_utf_string_static_t_initialize("test_name1", 0, 10), - macro_f_utf_string_static_t_initialize("test_name2", 0, 10), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\01\0\0\0", 0, 10), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\02\0\0\0", 0, 10), }; const f_utf_string_static_t test_values[] = { - macro_f_utf_string_static_t_initialize("test_value1", 0, 11), - macro_f_utf_string_static_t_initialize("test_value2", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\01\0\0\0", 0, 11), + macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\02\0\0\0", 0, 11), }; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-mash.c b/level_0/f_utf/tests/unit/c/test-utf-mash.c index 9161476..b82af6d 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-mash.c +++ b/level_0/f_utf/tests/unit/c/test-utf-mash.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_mash__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("te\0st:te\0st", 0, 11); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,8 +18,9 @@ void test__f_utf_mash__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } // Check that the glue is added. @@ -29,9 +30,9 @@ void test__f_utf_mash__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); - assert_string_equal(destination.string + 3, expected.string + 3); - assert_string_equal(destination.string + 9, expected.string + 9); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } free((void *) destination.string); @@ -39,8 +40,8 @@ void test__f_utf_mash__works(void **state) { void test__f_utf_mash__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); { const f_status_t status = f_utf_string_mash(glue.string, glue.used, source.string, source.used, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-mash_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-mash_nulless.c index 9f62c60..a2bfee5 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-mash_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-mash_nulless.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_mash_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize("test", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize("test:test", 0, 9); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -19,7 +19,9 @@ void test__f_utf_mash_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected1.used); - assert_string_equal(destination.string, expected1.string); + for (f_array_length_t i = 0; i < expected1.used; ++i) { + assert_int_equal(destination.string[i], expected1.string[i]); + } // for } // Check that the glue is added. @@ -29,7 +31,9 @@ void test__f_utf_mash_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected2.used); - assert_string_equal(destination.string, expected2.string); + for (f_array_length_t i = 0; i < expected2.used; ++i) { + assert_int_equal(destination.string[i], expected2.string[i]); + } // for } free((void *) destination.string); @@ -37,8 +41,8 @@ void test__f_utf_mash_nulless__works(void **state) { void test__f_utf_mash_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); { const f_status_t status = f_utf_string_mash_nulless(glue.string, glue.used, source.string, source.used, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-mish.c b/level_0/f_utf/tests/unit/c/test-utf-mish.c index 8eae1e4..d8b79b3 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-mish.c +++ b/level_0/f_utf/tests/unit/c/test-utf-mish.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_mish__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("te\0st:te\0st", 0, 11); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -18,8 +18,9 @@ void test__f_utf_mish__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } // Check that the glue is added. @@ -29,9 +30,9 @@ void test__f_utf_mish__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); - assert_string_equal(destination.string + 3, expected.string + 3); - assert_string_equal(destination.string + 9, expected.string + 9); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); @@ -39,8 +40,8 @@ void test__f_utf_mish__works(void **state) { void test__f_utf_mish__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); { const f_status_t status = f_utf_string_mish(glue.string, glue.used, source.string, source.used, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-mish_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-mish_nulless.c index f03a9b1..7e7377a 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-mish_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-mish_nulless.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_mish_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize("test", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize("test:test", 0, 9); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -19,7 +19,9 @@ void test__f_utf_mish_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected1.used); - assert_string_equal(destination.string, expected1.string); + for (f_array_length_t i = 0; i < expected1.used; ++i) { + assert_int_equal(destination.string[i], expected1.string[i]); + } // for } // Check that the glue is added. @@ -29,7 +31,9 @@ void test__f_utf_mish_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected2.used); - assert_string_equal(destination.string, expected2.string); + for (f_array_length_t i = 0; i < expected2.used; ++i) { + assert_int_equal(destination.string[i], expected2.string[i]); + } // for } free((void *) destination.string); @@ -37,8 +41,8 @@ void test__f_utf_mish_nulless__works(void **state) { void test__f_utf_mish_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize(":", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); { const f_status_t status = f_utf_string_mish_nulless(glue.string, glue.used, source.string, source.used, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-prepend.c b/level_0/f_utf/tests/unit/c/test-utf-prepend.c index 716d4fe..0ae815b 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-prepend.c +++ b/level_0/f_utf/tests/unit/c/test-utf-prepend.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_prepend__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -16,8 +16,9 @@ void test__f_utf_prepend__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-prepend_assure.c b/level_0/f_utf/tests/unit/c/test-utf-prepend_assure.c index 29423d4..a254a12 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-prepend_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-prepend_assure.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_prepend_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -16,8 +16,9 @@ void test__f_utf_prepend_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -27,8 +28,9 @@ void test__f_utf_prepend_assure__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, source.used); - assert_string_equal(destination.string, source.string); - assert_string_equal(destination.string + 3, source.string + 3); + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.string[i], source.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-prepend_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-prepend_assure_nulless.c index ac313e6..b6cc3b1 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-prepend_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-prepend_assure_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_prepend_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -17,7 +17,9 @@ void test__f_utf_prepend_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } // The string already exists, so destination should be unchanged. @@ -27,7 +29,9 @@ void test__f_utf_prepend_assure_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-prepend_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-prepend_nulless.c index a1554cc..4b77225 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-prepend_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-prepend_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_prepend_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\0st", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -17,7 +17,9 @@ void test__f_utf_prepend_nulless__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(destination.used, expected.used); - assert_string_equal(destination.string, expected.string); + for (f_array_length_t i = 0; i < expected.used; ++i) { + assert_int_equal(destination.string[i], expected.string[i]); + } // for } free((void *) destination.string); diff --git a/level_0/f_utf/tests/unit/c/test-utf-seek_line.c b/level_0/f_utf/tests/unit/c/test-utf-seek_line.c index 4ace602..216c2c7 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-seek_line.c +++ b/level_0/f_utf/tests/unit/c/test-utf-seek_line.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_seek_line__returns_data_not_stop(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test\nafter", 0, 10); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); { - f_string_range_t range = f_utf_string_range_t_initialize; + f_string_range_t range = f_string_range_t_initialize; const f_status_t status = f_utf_string_seek_line(source.string, &range); @@ -20,10 +20,10 @@ void test__f_utf_seek_line__returns_data_not_stop(void **state) { void test__f_utf_seek_line__returns_none_stop(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_line(source.string, &range); @@ -36,10 +36,10 @@ void test__f_utf_seek_line__returns_none_stop(void **state) { void test__f_utf_seek_line__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test\nafter", 0, 10); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_line(source.string, &range); @@ -52,7 +52,7 @@ void test__f_utf_seek_line__works(void **state) { void test__f_utf_seek_line__parameter_checking(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("teX\nst", 0, 6); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); { const f_status_t status = f_utf_string_seek_line(source.string, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.c b/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.c index 96b8da4..27eb516 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.c +++ b/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.c @@ -7,11 +7,11 @@ extern "C" { void test__f_utf_seek_line_to__at_newline(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\nXst", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t\0\0\0", 0, 6); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_line_to(source.string, to.string[0], &range); @@ -24,11 +24,11 @@ void test__f_utf_seek_line_to__at_newline(void **state) { void test__f_utf_seek_line_to__returns_data_not_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test\nafter", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); { - f_string_range_t range = f_utf_string_range_t_initialize; + f_string_range_t range = f_string_range_t_initialize; const f_status_t status = f_utf_string_seek_line_to(source.string, to.string[0], &range); @@ -38,11 +38,11 @@ void test__f_utf_seek_line_to__returns_data_not_stop(void **state) { void test__f_utf_seek_line_to__returns_none_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test", 0, 4); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_line_to(source.string, to.string[0], &range); @@ -55,11 +55,11 @@ void test__f_utf_seek_line_to__returns_none_stop(void **state) { void test__f_utf_seek_line_to__works(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("teX\nst", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_line_to(source.string, to.string[0], &range); @@ -72,8 +72,8 @@ void test__f_utf_seek_line_to__works(void **state) { void test__f_utf_seek_line_to__parameter_checking(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("teX\nst", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); { const f_status_t status = f_utf_string_seek_line_to(source.string, to.string[0], 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-seek_to.c b/level_0/f_utf/tests/unit/c/test-utf-seek_to.c index 09bd1e1..8a6f740 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-seek_to.c +++ b/level_0/f_utf/tests/unit/c/test-utf-seek_to.c @@ -7,11 +7,11 @@ extern "C" { void test__f_utf_seek_to__returns_data_not_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test\nafter", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); { - f_string_range_t range = f_utf_string_range_t_initialize; + f_string_range_t range = f_string_range_t_initialize; const f_status_t status = f_utf_string_seek_to(source.string, to.string[0], &range); @@ -21,11 +21,11 @@ void test__f_utf_seek_to__returns_data_not_stop(void **state) { void test__f_utf_seek_to__returns_none_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("test\nafter", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_to(source.string, to.string[0], &range); @@ -38,11 +38,11 @@ void test__f_utf_seek_to__returns_none_stop(void **state) { void test__f_utf_seek_to__works(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("te\nXst", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t\0\0\0", 0, 6); { - f_string_range_t range = macro_f_utf_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_to(source.string, to.string[0], &range); @@ -55,8 +55,8 @@ void test__f_utf_seek_to__works(void **state) { void test__f_utf_seek_to__parameter_checking(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize("X", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize("teX\nst", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); { const f_status_t status = f_utf_string_seek_to(source.string, to.string[0], 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-triples_append.c b/level_0/f_utf/tests/unit/c/test-utf-triples_append.c index 0b9a55a..3a03f41 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-triples_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-triples_append.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_triples_append__works(void **state) { - const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize("a", 0, 1); - const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize("b", 0, 1); - const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize("c", 0, 1); + const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "a\0\0\0", 0, 1); + const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "b\0\0\0", 0, 1); + const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "c\0\0\0", 0, 1); const f_utf_string_triple_t source = macro_f_utf_string_triple_t_initialize(test_a, test_b, test_c); f_utf_string_triples_t destination = f_utf_string_triples_t_initialize; diff --git a/level_0/f_utf/tests/unit/c/test-utf-triples_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-triples_append_all.c index 9b6a642..4bf351a 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-triples_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-triples_append_all.c @@ -9,13 +9,13 @@ void test__f_utf_triples_append_all__works(void **state) { const int length_sources = 2; - const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize("a", 0, 1); - const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize("b", 0, 1); - const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize("c", 0, 1); + const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "a\0\0\0", 0, 1); + const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "b\0\0\0", 0, 1); + const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "c\0\0\0", 0, 1); - const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize("d", 0, 1); - const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize("e", 0, 1); - const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize("f", 0, 1); + const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize((f_utf_string_t) "d\0\0\0", 0, 1); + const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize((f_utf_string_t) "e\0\0\0", 0, 1); + const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize((f_utf_string_t) "f\0\0\0", 0, 1); f_utf_string_triple_t sources_array[] = { macro_f_utf_string_triple_t_initialize(test_a, test_b, test_c), diff --git a/level_0/f_utf/tests/unit/c/test-utf-tripless_append.c b/level_0/f_utf/tests/unit/c/test-utf-tripless_append.c index 0a6b4ac..8f273aa 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-tripless_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-tripless_append.c @@ -9,13 +9,13 @@ void test__f_utf_tripless_append__works(void **state) { const int length_sources = 2; - const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize("a", 0, 1); - const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize("b", 0, 1); - const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize("c", 0, 1); + const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "a\0\0\0", 0, 1); + const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "b\0\0\0", 0, 1); + const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "c\0\0\0", 0, 1); - const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize("d", 0, 1); - const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize("e", 0, 1); - const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize("f", 0, 1); + const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize((f_utf_string_t) "d\0\0\0", 0, 1); + const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize((f_utf_string_t) "e\0\0\0", 0, 1); + const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize((f_utf_string_t) "f\0\0\0", 0, 1); f_utf_string_triple_t sources_array[] = { macro_f_utf_string_triple_t_initialize(test_a, test_b, test_c), diff --git a/level_0/f_utf/tests/unit/c/test-utf-tripless_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-tripless_append_all.c index 1104d40..e7d3535 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-tripless_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-tripless_append_all.c @@ -10,21 +10,21 @@ void test__f_utf_tripless_append_all__works(void **state) { const int length_sources = 2; const int length_sources_set = 2; - const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize("a", 0, 1); - const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize("b", 0, 1); - const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize("c", 0, 1); + const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "a\0\0\0", 0, 1); + const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "b\0\0\0", 0, 1); + const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "c\0\0\0", 0, 1); - const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize("d", 0, 1); - const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize("e", 0, 1); - const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize("f", 0, 1); + const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize((f_utf_string_t) "d\0\0\0", 0, 1); + const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize((f_utf_string_t) "e\0\0\0", 0, 1); + const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize((f_utf_string_t) "f\0\0\0", 0, 1); - const f_utf_string_static_t test_g = macro_f_utf_string_static_t_initialize("g", 0, 1); - const f_utf_string_static_t test_h = macro_f_utf_string_static_t_initialize("h", 0, 1); - const f_utf_string_static_t test_i = macro_f_utf_string_static_t_initialize("i", 0, 1); + const f_utf_string_static_t test_g = macro_f_utf_string_static_t_initialize((f_utf_string_t) "g\0\0\0", 0, 1); + const f_utf_string_static_t test_h = macro_f_utf_string_static_t_initialize((f_utf_string_t) "h\0\0\0", 0, 1); + const f_utf_string_static_t test_i = macro_f_utf_string_static_t_initialize((f_utf_string_t) "i\0\0\0", 0, 1); - const f_utf_string_static_t test_j = macro_f_utf_string_static_t_initialize("j", 0, 1); - const f_utf_string_static_t test_k = macro_f_utf_string_static_t_initialize("k", 0, 1); - const f_utf_string_static_t test_l = macro_f_utf_string_static_t_initialize("l", 0, 1); + const f_utf_string_static_t test_j = macro_f_utf_string_static_t_initialize((f_utf_string_t) "j\0\0\0", 0, 1); + const f_utf_string_static_t test_k = macro_f_utf_string_static_t_initialize((f_utf_string_t) "k\0\0\0", 0, 1); + const f_utf_string_static_t test_l = macro_f_utf_string_static_t_initialize((f_utf_string_t) "l\0\0\0", 0, 1); f_utf_string_triple_t sources_array1[] = { macro_f_utf_string_triple_t_initialize(test_a, test_b, test_c), diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index 7bd2497..aae950c 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -489,7 +489,7 @@ extern "C" { #endif // _di_fl_string_dynamic_rip_nulless_ #ifndef _di_fl_string_dynamic_seek_line_to_utf_character_ - f_status_t fl_string_dynamic_seek_line_to_utf_character(const f_string_static_t buffer, const f_utf_character_t seek_to_this, f_string_range_t * const range) { + f_status_t fl_string_dynamic_seek_line_to_utf_character(const f_string_static_t buffer, const f_utf_char_t seek_to_this, f_string_range_t * const range) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -502,7 +502,7 @@ extern "C" { return F_data_not_stop; } - const unsigned short seek_width = macro_f_utf_character_t_width(seek_to_this); + const unsigned short seek_width = macro_f_utf_char_t_width(seek_to_this); f_status_t status = F_none; @@ -537,7 +537,7 @@ extern "C" { } if (width == seek_width) { - f_utf_character_t character = 0; + f_utf_char_t character = 0; status = f_utf_char_to_character(buffer.string + range->start, width_max, &character); if (F_status_is_error(status)) return status; @@ -676,7 +676,7 @@ extern "C" { #endif // _di_fl_string_dynamic_seek_line_until_graph_non_ #ifndef _di_fl_string_dynamic_seek_to_utf_character_ - f_status_t fl_string_dynamic_seek_to_utf_character(const f_string_static_t buffer, const f_utf_character_t seek_to_this, f_string_range_t * const range) { + f_status_t fl_string_dynamic_seek_to_utf_character(const f_string_static_t buffer, const f_utf_char_t seek_to_this, f_string_range_t * const range) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -689,7 +689,7 @@ extern "C" { return F_data_not_stop; } - const unsigned short seek_width = macro_f_utf_character_t_width(seek_to_this); + const unsigned short seek_width = macro_f_utf_char_t_width(seek_to_this); f_status_t status = F_none; @@ -721,7 +721,7 @@ extern "C" { } if (width == seek_width) { - f_utf_character_t character = 0; + f_utf_char_t character = 0; status = f_utf_char_to_character(buffer.string + range->start, width_max, &character); if (F_status_is_error(status)) return status; @@ -1049,7 +1049,7 @@ extern "C" { #endif // _di_fl_string_rip_nulless_ #ifndef _di_fl_string_seek_line_to_utf_character_ - f_status_t fl_string_seek_line_to_utf_character(const f_string_t string, const f_utf_character_t seek_to, f_string_range_t * const range) { + f_status_t fl_string_seek_line_to_utf_character(const f_string_t string, const f_utf_char_t seek_to, f_string_range_t * const range) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -1058,7 +1058,7 @@ extern "C" { return F_data_not_stop; } - const unsigned short seek_width = macro_f_utf_character_t_width(seek_to); + const unsigned short seek_width = macro_f_utf_char_t_width(seek_to); f_status_t status = F_none; @@ -1094,7 +1094,7 @@ extern "C" { } if (width == seek_width) { - f_utf_character_t character = 0; + f_utf_char_t character = 0; status = f_utf_char_to_character(string + range->start, width_max, &character); if (F_status_is_error(status)) return status; @@ -1219,7 +1219,7 @@ extern "C" { #endif // _di_fl_string_seek_line_until_graph_non_ #ifndef _di_fl_string_seek_to_utf_character_ - f_status_t fl_string_seek_to_utf_character(const f_string_t string, const f_utf_character_t seek_to, f_string_range_t * const range) { + f_status_t fl_string_seek_to_utf_character(const f_string_t string, const f_utf_char_t seek_to, f_string_range_t * const range) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -1228,7 +1228,7 @@ extern "C" { return F_data_not_stop; } - const unsigned short seek_width = macro_f_utf_character_t_width(seek_to); + const unsigned short seek_width = macro_f_utf_char_t_width(seek_to); f_status_t status = F_none; @@ -1260,7 +1260,7 @@ extern "C" { } if (width == seek_width) { - f_utf_character_t character = 0; + f_utf_char_t character = 0; status = f_utf_char_to_character(string + range->start, width_max, &character); if (F_status_is_error(status)) return status; diff --git a/level_1/fl_string/c/string.h b/level_1/fl_string/c/string.h index 2339f37..e077327 100644 --- a/level_1/fl_string/c/string.h +++ b/level_1/fl_string/c/string.h @@ -874,7 +874,7 @@ extern "C" { * @see f_utf_char_to_character() */ #ifndef _di_fl_string_dynamic_seek_line_to_utf_character_ - extern f_status_t fl_string_dynamic_seek_line_to_utf_character(const f_string_static_t buffer, const f_utf_character_t seek_to_this, f_string_range_t * const range); + extern f_status_t fl_string_dynamic_seek_line_to_utf_character(const f_string_static_t buffer, const f_utf_char_t seek_to_this, f_string_range_t * const range); #endif // _di_fl_string_dynamic_seek_line_to_utf_character_ /** @@ -964,7 +964,7 @@ extern "C" { * @see f_utf_char_to_character() */ #ifndef _di_fl_string_dynamic_seek_to_utf_character_ - extern f_status_t fl_string_dynamic_seek_to_utf_character(const f_string_static_t buffer, const f_utf_character_t seek_to_this, f_string_range_t * const range); + extern f_status_t fl_string_dynamic_seek_to_utf_character(const f_string_static_t buffer, const f_utf_char_t seek_to_this, f_string_range_t * const range); #endif // _di_fl_string_dynamic_seek_to_utf_character_ /** @@ -1105,7 +1105,7 @@ extern "C" { * @see f_utf_char_to_character() */ #ifndef _di_fl_string_seek_line_to_utf_character_ - extern f_status_t fl_string_seek_line_to_utf_character(const f_string_t string, const f_utf_character_t seek_to, f_string_range_t * const range); + extern f_status_t fl_string_seek_line_to_utf_character(const f_string_t string, const f_utf_char_t seek_to, f_string_range_t * const range); #endif // _di_fl_string_seek_line_to_utf_character_ /** @@ -1193,7 +1193,7 @@ extern "C" { * @see f_utf_char_to_character() */ #ifndef _di_fl_string_seek_to_utf_character_ - extern f_status_t fl_string_seek_to_utf_character(const f_string_t string, const f_utf_character_t seek_to, f_string_range_t * const range); + extern f_status_t fl_string_seek_to_utf_character(const f_string_t string, const f_utf_char_t seek_to, f_string_range_t * const range); #endif // _di_fl_string_seek_to_utf_character_ #ifdef __cplusplus diff --git a/level_1/fl_utf/c/utf.c b/level_1/fl_utf/c/utf.c index 1189803..2a2c5fd 100644 --- a/level_1/fl_utf/c/utf.c +++ b/level_1/fl_utf/c/utf.c @@ -106,19 +106,19 @@ extern "C" { return F_data_not_stop; } - f_utf_character_t seek_to_character = seek_to_this << 24; + f_utf_char_t seek_to_character = seek_to_this << 24; - if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } while (buffer.string[range->start] != seek_to_character) { - if (buffer.string[range->start++] == F_utf_character_t_eol_d) { + if (buffer.string[range->start++] == F_utf_char_t_eol_d) { return F_none_eol; } - if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -136,7 +136,7 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_seek_line_to_char_ #ifndef _di_fl_utf_string_dynamic_seek_line_until_graph_ - f_status_t fl_utf_string_dynamic_seek_line_until_graph(const f_utf_string_static_t buffer, f_string_range_t * const range, const f_utf_character_t placeholder) { + f_status_t fl_utf_string_dynamic_seek_line_until_graph(const f_utf_string_static_t buffer, f_string_range_t * const range, const f_utf_char_t placeholder) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); if (buffer.used <= range->start) return F_status_set_error(F_parameter); @@ -152,7 +152,7 @@ extern "C" { f_status_t status = F_none; - if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -162,11 +162,11 @@ extern "C" { return status; } - if (buffer.string[range->start++] == F_utf_character_t_eol_d) { + if (buffer.string[range->start++] == F_utf_char_t_eol_d) { return F_none_eol; } - if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -188,7 +188,7 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_seek_line_until_graph_ #ifndef _di_fl_utf_string_dynamic_seek_line_until_graph_non_ - f_status_t fl_utf_string_dynamic_seek_line_until_graph_non(const f_utf_string_static_t buffer, f_string_range_t * const range, const f_utf_character_t placeholder) { + f_status_t fl_utf_string_dynamic_seek_line_until_graph_non(const f_utf_string_static_t buffer, f_string_range_t * const range, const f_utf_char_t placeholder) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); if (buffer.used <= range->start) return F_status_set_error(F_parameter); @@ -199,18 +199,18 @@ extern "C" { f_status_t status = F_none; - if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } while (buffer.string[range->start] == placeholder || (status = f_utf_character_is_whitespace(buffer.string[range->start])) == F_false) { if (F_status_is_error(status)) return status; - if (buffer.string[range->start] == F_utf_character_t_eol_d) return F_none_eol; + if (buffer.string[range->start] == F_utf_char_t_eol_d) return F_none_eol; ++range->start; - if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -239,9 +239,9 @@ extern "C" { return F_data_not_stop; } - f_utf_character_t seek_to_character = seek_to_this << 24; + f_utf_char_t seek_to_character = seek_to_this << 24; - if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -249,7 +249,7 @@ extern "C" { ++range->start; - if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -330,15 +330,15 @@ extern "C" { return F_data_not_stop; } - f_utf_character_t seek_to_character = seek_to_this << 24; + f_utf_char_t seek_to_character = seek_to_this << 24; for (; range->start <= range->stop; ++range->start) { - if (macro_f_utf_character_t_width_is(string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf); } - if (string[range->start] == F_utf_character_t_eol_d) { + if (string[range->start] == F_utf_char_t_eol_d) { return F_none_eol; } @@ -352,7 +352,7 @@ extern "C" { #endif // _di_fl_utf_string_seek_line_to_char_ #ifndef _di_fl_utf_string_seek_line_until_graph_ - f_status_t fl_utf_string_seek_line_until_graph(const f_utf_string_t string, f_string_range_t * const range, const f_utf_character_t placeholder) { + f_status_t fl_utf_string_seek_line_until_graph(const f_utf_string_t string, f_string_range_t * const range, const f_utf_char_t placeholder) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -363,7 +363,7 @@ extern "C" { f_status_t status = F_none; - if (macro_f_utf_character_t_width_is(string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -373,11 +373,11 @@ extern "C" { return status; } - if (string[range->start++] == F_utf_character_t_eol_d) { + if (string[range->start++] == F_utf_char_t_eol_d) { return F_none_eol; } - if (macro_f_utf_character_t_width_is(string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -395,7 +395,7 @@ extern "C" { #endif // _di_fl_utf_string_seek_line_until_graph_ #ifndef _di_fl_utf_string_seek_line_until_graph_non_ - f_status_t fl_utf_string_seek_line_until_graph_non(const f_utf_string_t string, f_string_range_t * const range, const f_utf_character_t placeholder) { + f_status_t fl_utf_string_seek_line_until_graph_non(const f_utf_string_t string, f_string_range_t * const range, const f_utf_char_t placeholder) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -406,7 +406,7 @@ extern "C" { f_status_t status = F_none; - if (macro_f_utf_character_t_width_is(string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -416,11 +416,11 @@ extern "C" { return status; } - if (string[range->start++] == F_utf_character_t_eol_d) { + if (string[range->start++] == F_utf_char_t_eol_d) { return F_none_eol; } - if (macro_f_utf_character_t_width_is(string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -447,9 +447,9 @@ extern "C" { return F_data_not_stop; } - const f_utf_character_t seek_to_character = seek_to_this << 24; + const f_utf_char_t seek_to_character = seek_to_this << 24; - if (macro_f_utf_character_t_width_is(string[0]) == 1) { + if (macro_f_utf_char_t_width_is(string[0]) == 1) { return F_status_set_error(F_utf); } @@ -459,7 +459,7 @@ extern "C" { return F_none; } - if (macro_f_utf_character_t_width_is(string[range->start]) == 1) { + if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf); } } // while diff --git a/level_1/fl_utf/c/utf.h b/level_1/fl_utf/c/utf.h index ff75721..a218c6a 100644 --- a/level_1/fl_utf/c/utf.h +++ b/level_1/fl_utf/c/utf.h @@ -296,7 +296,7 @@ extern "C" { * @see f_utf_character_is_graph() */ #ifndef _di_fl_utf_string_dynamic_seek_line_until_graph_ - extern f_status_t fl_utf_string_dynamic_seek_line_until_graph(const f_utf_string_static_t buffer, f_string_range_t * const range, const f_utf_character_t placeholder); + extern f_status_t fl_utf_string_dynamic_seek_line_until_graph(const f_utf_string_static_t buffer, f_string_range_t * const range, const f_utf_char_t placeholder); #endif // _di_fl_utf_string_dynamic_seek_line_until_graph_ /** @@ -325,7 +325,7 @@ extern "C" { * @see f_utf_character_is_graph() */ #ifndef _di_fl_utf_string_dynamic_seek_line_until_graph_non_ - extern f_status_t fl_utf_string_dynamic_seek_line_until_graph_non(const f_utf_string_static_t buffer, f_string_range_t * const range, const f_utf_character_t placeholder); + extern f_status_t fl_utf_string_dynamic_seek_line_until_graph_non(const f_utf_string_static_t buffer, f_string_range_t * const range, const f_utf_char_t placeholder); #endif // _di_fl_utf_string_dynamic_seek_line_until_graph_non_ /** @@ -462,7 +462,7 @@ extern "C" { * @see f_utf_character_is_graph() */ #ifndef _di_fl_utf_string_seek_line_until_graph_ - extern f_status_t fl_utf_string_seek_line_until_graph(const f_utf_string_t string, f_string_range_t * const range, const f_utf_character_t placeholder); + extern f_status_t fl_utf_string_seek_line_until_graph(const f_utf_string_t string, f_string_range_t * const range, const f_utf_char_t placeholder); #endif // _di_fl_utf_string_seek_line_until_graph_ /** @@ -493,7 +493,7 @@ extern "C" { * @see f_utf_character_is_graph() */ #ifndef _di_fl_utf_string_seek_line_until_graph_non_ - extern f_status_t fl_utf_string_seek_line_until_graph_non(const f_utf_string_t string, f_string_range_t * const range, const f_utf_character_t placeholder); + extern f_status_t fl_utf_string_seek_line_until_graph_non(const f_utf_string_t string, f_string_range_t * const range, const f_utf_char_t placeholder); #endif // _di_fl_utf_string_seek_line_until_graph_non_ /** diff --git a/level_1/fl_utf_file/c/private-utf_file.c b/level_1/fl_utf_file/c/private-utf_file.c index 84891c5..13053f8 100644 --- a/level_1/fl_utf_file/c/private-utf_file.c +++ b/level_1/fl_utf_file/c/private-utf_file.c @@ -48,16 +48,16 @@ extern "C" { } if (*width_last == *width) { - buffer->string[buffer->used] = macro_f_utf_character_t_from_char_1((buffer_char[0])); + buffer->string[buffer->used] = macro_f_utf_char_t_from_char_1((buffer_char[0])); if (*width > 1) { - buffer->string[buffer->used] |= macro_f_utf_character_t_from_char_2((buffer_char[1])); + buffer->string[buffer->used] |= macro_f_utf_char_t_from_char_2((buffer_char[1])); if (*width > 2) { - buffer->string[buffer->used] |= macro_f_utf_character_t_from_char_3((buffer_char[2])); + buffer->string[buffer->used] |= macro_f_utf_char_t_from_char_3((buffer_char[2])); if (*width > 3) { - buffer->string[buffer->used] |= macro_f_utf_character_t_from_char_4((buffer_char[3])); + buffer->string[buffer->used] |= macro_f_utf_char_t_from_char_4((buffer_char[3])); } } } @@ -99,19 +99,19 @@ extern "C" { if (width_written < width) { if (width_written < 2) { - buffer_write[used] = macro_f_utf_character_t_to_char_2(string[*written + i]); + buffer_write[used] = macro_f_utf_char_t_to_char_2(string[*written + i]); ++width_written; ++used; } if (width > 2 && width_written < 3) { - buffer_write[used + 1] = macro_f_utf_character_t_to_char_3(string[*written + i]); + buffer_write[used + 1] = macro_f_utf_char_t_to_char_3(string[*written + i]); ++width_written; ++used; } if (width == 4 && width_written < 4) { - buffer_write[used + 2] = macro_f_utf_character_t_to_char_4(string[*written + i]); + buffer_write[used + 2] = macro_f_utf_char_t_to_char_4(string[*written + i]); ++width_written; ++used; } @@ -119,14 +119,14 @@ extern "C" { width = 0; } else { - width = macro_f_utf_character_t_width(string[*written + i]); + width = macro_f_utf_char_t_width(string[*written + i]); width_written = width; if (*written + width > write_max) { return F_complete_not_utf_stop; } - buffer_write[used] = macro_f_utf_character_t_to_char_1(string[*written + i]); + buffer_write[used] = macro_f_utf_char_t_to_char_1(string[*written + i]); if (width > 1) { if (used == write_size) { @@ -135,7 +135,7 @@ extern "C" { break; } - buffer_write[used + 1] = macro_f_utf_character_t_to_char_2(string[*written + i]); + buffer_write[used + 1] = macro_f_utf_char_t_to_char_2(string[*written + i]); if (width > 2) { if (used + 2 > write_size) { @@ -144,7 +144,7 @@ extern "C" { break; } - buffer_write[used + 2] = macro_f_utf_character_t_to_char_3(string[*written + i]); + buffer_write[used + 2] = macro_f_utf_char_t_to_char_3(string[*written + i]); if (width == 4) { if (used + 3 > write_size) { @@ -153,7 +153,7 @@ extern "C" { break; } - buffer_write[used + 3] = macro_f_utf_character_t_to_char_4(string[*written + i]); + buffer_write[used + 3] = macro_f_utf_char_t_to_char_4(string[*written + i]); } } } diff --git a/level_3/byte_dump/c/private-byte_dump.c b/level_3/byte_dump/c/private-byte_dump.c index 7a3ce5f..202d81e 100644 --- a/level_3/byte_dump/c/private-byte_dump.c +++ b/level_3/byte_dump/c/private-byte_dump.c @@ -28,7 +28,7 @@ extern "C" { // Store the current character main until it can be printed. f_utf_string_dynamic_t characters = f_utf_string_dynamic_t_initialize; - f_utf_character_t character_array[main->width]; + f_utf_char_t character_array[main->width]; f_array_length_t character_current = 0; // The row starts based on the first byte starting point and how many columns of bytes are displayed per row. @@ -47,7 +47,7 @@ extern "C" { } } - memset(&character_array, 0, sizeof(f_utf_character_t) * main->width); + memset(&character_array, 0, sizeof(f_utf_char_t) * main->width); characters.string = character_array; characters.used = 0; characters.size = main->width; @@ -91,7 +91,7 @@ extern "C" { // When width_count == 0, then this is that start of a new character sequence. if (!width_count) { - characters.string[character_current] = macro_f_utf_character_t_from_char_1(byte); + characters.string[character_current] = macro_f_utf_char_t_from_char_1(byte); width_count = 1; // The first character in a UTF-8 sequence cannot have a width of 1. @@ -109,13 +109,13 @@ extern "C" { width_current = macro_f_utf_byte_width_is(byte); if (width_count == 1) { - characters.string[character_current] |= macro_f_utf_character_t_from_char_2(byte); + characters.string[character_current] |= macro_f_utf_char_t_from_char_2(byte); } else if (width_count == 2) { - characters.string[character_current] |= macro_f_utf_character_t_from_char_3(byte); + characters.string[character_current] |= macro_f_utf_char_t_from_char_3(byte); } else if (width_count == 3) { - characters.string[character_current] |= macro_f_utf_character_t_from_char_4(byte); + characters.string[character_current] |= macro_f_utf_char_t_from_char_4(byte); } ++width_count; @@ -313,16 +313,16 @@ extern "C" { f_array_length_t character_current = characters.used - 1; if (byte_current == 1) { - byte = macro_f_utf_character_t_to_char_1(characters.string[character_current]); + byte = macro_f_utf_char_t_to_char_1(characters.string[character_current]); } else if (byte_current == 2) { - byte = macro_f_utf_character_t_to_char_2(characters.string[character_current]); + byte = macro_f_utf_char_t_to_char_2(characters.string[character_current]); } else if (byte_current == 3) { - byte = macro_f_utf_character_t_to_char_3(characters.string[character_current]); + byte = macro_f_utf_char_t_to_char_3(characters.string[character_current]); } else if (byte_current == 4) { - byte = macro_f_utf_character_t_to_char_4(characters.string[character_current]); + byte = macro_f_utf_char_t_to_char_4(characters.string[character_current]); } if (!cell->column) { @@ -400,28 +400,28 @@ extern "C" { if (width_utf < 2) { // 1 == U+0000 -> U+007F. - unicode = macro_f_utf_character_t_to_char_1(characters.string[character_current]) & 0x7f; + unicode = macro_f_utf_char_t_to_char_1(characters.string[character_current]) & 0x7f; } else if (width_utf == 2) { // 2 == U+0080 -> U+07FF. - unicode = (macro_f_utf_character_t_to_char_1(characters.string[character_current]) & 0x1f) << 6; - unicode |= macro_f_utf_character_t_to_char_2(characters.string[character_current]) & 0x3f; + unicode = (macro_f_utf_char_t_to_char_1(characters.string[character_current]) & 0x1f) << 6; + unicode |= macro_f_utf_char_t_to_char_2(characters.string[character_current]) & 0x3f; } else if (width_utf == 3) { // 3 == U+0800 -> U+FFFF. - unicode = (macro_f_utf_character_t_to_char_1(characters.string[character_current]) & 0xf) << 12; - unicode |= (macro_f_utf_character_t_to_char_2(characters.string[character_current]) & 0x3f) << 6; - unicode |= macro_f_utf_character_t_to_char_3(characters.string[character_current]) & 0x3f; + unicode = (macro_f_utf_char_t_to_char_1(characters.string[character_current]) & 0xf) << 12; + unicode |= (macro_f_utf_char_t_to_char_2(characters.string[character_current]) & 0x3f) << 6; + unicode |= macro_f_utf_char_t_to_char_3(characters.string[character_current]) & 0x3f; } else if (width_utf == 4) { // 4 == U+10000 -> U+10FFFF. - unicode = (macro_f_utf_character_t_to_char_1(characters.string[character_current]) & 0x7) << 18; - unicode |= (macro_f_utf_character_t_to_char_2(characters.string[character_current]) & 0x3f) << 12; - unicode |= (macro_f_utf_character_t_to_char_2(characters.string[character_current]) & 0x3f) << 6; - unicode |= macro_f_utf_character_t_to_char_4(characters.string[character_current]) & 0x3f; + unicode = (macro_f_utf_char_t_to_char_1(characters.string[character_current]) & 0x7) << 18; + unicode |= (macro_f_utf_char_t_to_char_2(characters.string[character_current]) & 0x3f) << 12; + unicode |= (macro_f_utf_char_t_to_char_2(characters.string[character_current]) & 0x3f) << 6; + unicode |= macro_f_utf_char_t_to_char_4(characters.string[character_current]) & 0x3f; } if (width_utf < 4) { @@ -664,7 +664,7 @@ extern "C" { for (uint8_t i = 0; i < characters.used && at < main->width; ++i, ++at) { - c = macro_f_utf_character_t_to_char_1(characters.string[i]); + c = macro_f_utf_char_t_to_char_1(characters.string[i]); width_utf = macro_f_utf_byte_width_is(c); if (invalid[i]) { @@ -682,13 +682,13 @@ extern "C" { byte[0] = c; if (width_utf > 1) { - byte[1] = macro_f_utf_character_t_to_char_2(characters.string[i]); + byte[1] = macro_f_utf_char_t_to_char_2(characters.string[i]); if (width_utf > 2) { - byte[2] = macro_f_utf_character_t_to_char_3(characters.string[i]); + byte[2] = macro_f_utf_char_t_to_char_3(characters.string[i]); if (width_utf > 3) { - byte[3] = macro_f_utf_character_t_to_char_4(characters.string[i]); + byte[3] = macro_f_utf_char_t_to_char_4(characters.string[i]); } else { byte[3] = 0; @@ -840,13 +840,13 @@ extern "C" { f_print_character(c, main->output.to.stream); if (width_utf > 1) { - f_print_character(macro_f_utf_character_t_to_char_2(characters.string[i]), main->output.to.stream); + f_print_character(macro_f_utf_char_t_to_char_2(characters.string[i]), main->output.to.stream); if (width_utf > 2) { - f_print_character(macro_f_utf_character_t_to_char_3(characters.string[i]), main->output.to.stream); + f_print_character(macro_f_utf_char_t_to_char_3(characters.string[i]), main->output.to.stream); if (width_utf > 3) { - f_print_character(macro_f_utf_character_t_to_char_4(characters.string[i]), main->output.to.stream); + f_print_character(macro_f_utf_char_t_to_char_4(characters.string[i]), main->output.to.stream); } } } -- 1.8.3.1