From d6183c78a6b978356ac09dac3662ab4306ae36cb Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 19 Apr 2020 23:48:41 -0500 Subject: [PATCH] Update: experimentally switch to uint8_t to UTF-8 character processing --- level_0/f_utf/c/utf.c | 20 ++++++++++---------- level_0/f_utf/c/utf.h | 18 +++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/level_0/f_utf/c/utf.c b/level_0/f_utf/c/utf.c index 045f6c4..5a0faa2 100644 --- a/level_0/f_utf/c/utf.c +++ b/level_0/f_utf/c/utf.c @@ -2507,7 +2507,7 @@ extern "C" { #endif // _di_f_utf_character_is_whitespace_ #ifndef _di_f_utf_character_to_char_ - f_return_status f_utf_character_to_char(const f_utf_character utf_character, f_string *character, unsigned short *max_width) { + f_return_status f_utf_character_to_char(const f_utf_character utf_character, f_string *character, uint8_t *max_width) { #ifndef _di_level_0_parameter_checking_ if (utf_character == 0) return f_status_set_error(f_invalid_parameter); if (max_width == 0 && *character != 0) return f_status_set_error(f_invalid_parameter); @@ -2576,12 +2576,12 @@ extern "C" { #endif // _di_f_utf_is_big_endian_ #ifndef _di_f_utf_is_ - f_return_status f_utf_is(const f_string character, const unsigned short max_width) { + f_return_status f_utf_is(const f_string character, const uint8_t max_width) { #ifndef _di_level_0_parameter_checking_ if (max_width < 1) return f_status_set_error(f_invalid_parameter); #endif // _di_level_0_parameter_checking_ - unsigned short width = f_macro_utf_byte_width_is(*character); + uint8_t width = f_macro_utf_byte_width_is(*character); if (width == 0) { return f_false; @@ -2596,7 +2596,7 @@ extern "C" { #endif // _di_f_utf_is_ #ifndef _di_f_utf_is_control_ - f_return_status f_utf_is_control(const f_string character, const unsigned short max_width) { + f_return_status f_utf_is_control(const f_string character, const uint8_t max_width) { #ifndef _di_level_0_parameter_checking_ if (max_width < 1) return f_status_set_error(f_invalid_parameter); #endif // _di_level_0_parameter_checking_ @@ -2627,7 +2627,7 @@ extern "C" { #endif // _di_f_utf_is_control_ #ifndef _di_f_utf_is_control_picture_ - f_return_status f_utf_is_control_picture(const f_string character, const unsigned short max_width) { + f_return_status f_utf_is_control_picture(const f_string character, const uint8_t max_width) { #ifndef _di_level_0_parameter_checking_ if (max_width < 1) return f_status_set_error(f_invalid_parameter); #endif // _di_level_0_parameter_checking_ @@ -2655,7 +2655,7 @@ extern "C" { #endif // _di_f_utf_is_control_picture_ #ifndef _di_f_utf_is_graph_ - f_return_status f_utf_is_graph(const f_string character, const unsigned short max_width) { + f_return_status f_utf_is_graph(const f_string character, const uint8_t max_width) { #ifndef _di_level_0_parameter_checking_ if (max_width < 1) return f_status_set_error(f_invalid_parameter); #endif // _di_level_0_parameter_checking_ @@ -2686,12 +2686,12 @@ extern "C" { #endif // _di_f_utf_is_graph_ #ifndef _di_f_utf_is_whitespace_ - f_return_status f_utf_is_whitespace(const f_string character, const unsigned short max_width) { + f_return_status f_utf_is_whitespace(const f_string character, const uint8_t max_width) { #ifndef _di_level_0_parameter_checking_ if (max_width < 1) return f_status_set_error(f_invalid_parameter); #endif // _di_level_0_parameter_checking_ - unsigned short width = f_macro_utf_byte_width_is(*character); + uint8_t width = f_macro_utf_byte_width_is(*character); if (width == 0) { if (isspace(*character)) { @@ -2717,13 +2717,13 @@ extern "C" { #endif // _di_f_utf_is_whitespace_ #ifndef _di_f_utf_char_to_character_ - f_return_status f_utf_char_to_character(const f_string character, const unsigned short max_width, f_utf_character *character_utf) { + f_return_status f_utf_char_to_character(const f_string character, const uint8_t max_width, f_utf_character *character_utf) { #ifndef _di_level_0_parameter_checking_ if (max_width < 1) return f_status_set_error(f_invalid_parameter); if (character_utf == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_0_parameter_checking_ - unsigned short width = f_macro_utf_byte_width_is(*character); + uint8_t width = f_macro_utf_byte_width_is(*character); if (width == 0) { *character_utf = f_macro_utf_character_from_char_1(character[0]); diff --git a/level_0/f_utf/c/utf.h b/level_0/f_utf/c/utf.h index 5dd5ebb..6cf3a73 100644 --- a/level_0/f_utf/c/utf.h +++ b/level_0/f_utf/c/utf.h @@ -657,7 +657,7 @@ extern "C" { * f_failure (with error bit) if width is not long enough to convert. */ #ifndef _di_f_utf_character_to_char_ - extern f_return_status f_utf_character_to_char(const f_utf_character utf_character, f_string *character, unsigned short *max_width); + extern f_return_status f_utf_character_to_char(const f_utf_character utf_character, f_string *character, uint8_t *max_width); #endif // _di_f_utf_character_to_char_ /** @@ -694,7 +694,7 @@ extern "C" { * @see f_utf_is_valid() */ #ifndef _di_f_utf_is_ - extern f_return_status f_utf_is(const f_string character, const unsigned short max_width); + extern f_return_status f_utf_is(const f_string character, const uint8_t max_width); #endif // _di_f_utf_is_ /** @@ -715,7 +715,7 @@ extern "C" { * @see iscntrl() */ #ifndef _di_f_utf_is_control_ - extern f_return_status f_utf_is_control(const f_string character, const unsigned short max_width); + extern f_return_status f_utf_is_control(const f_string character, const uint8_t max_width); #endif // _di_f_utf_is_control_ /** @@ -736,7 +736,7 @@ extern "C" { * f_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_is_control_picture_ - extern f_return_status f_utf_is_control_picture(const f_string character, const unsigned short max_width); + extern f_return_status f_utf_is_control_picture(const f_string character, const uint8_t max_width); #endif // _di_f_utf_is_control_picture_ /** @@ -773,7 +773,7 @@ extern "C" { * @see f_utf_character_is_valid() */ #ifndef _di_f_utf_is_fragment_ - extern f_return_status f_utf_is_fragment(const f_string character, const unsigned short max_width); + extern f_return_status f_utf_is_fragment(const f_string character, const uint8_t max_width); #endif // _di_f_utf_is_fragment_ /** @@ -797,7 +797,7 @@ extern "C" { * @see iscntrl() */ #ifndef _di_f_utf_is_graph_ - extern f_return_status f_utf_is_graph(const f_string character, const unsigned short max_width); + extern f_return_status f_utf_is_graph(const f_string character, const uint8_t max_width); #endif // _di_f_utf_is_graph_ /** @@ -826,7 +826,7 @@ extern "C" { * @see f_utf_is_fragment() */ #ifndef _di_f_utf_is_valid_ - extern f_return_status f_utf_is_valid(const f_string character, const unsigned short max_width); + extern f_return_status f_utf_is_valid(const f_string character, const uint8_t max_width); #endif // _di_f_utf_is_valid_ /** @@ -850,7 +850,7 @@ extern "C" { * @see iscntrl() */ #ifndef _di_f_utf_is_whitespace_ - extern f_return_status f_utf_is_whitespace(const f_string character, const unsigned short max_width); + extern f_return_status f_utf_is_whitespace(const f_string character, const uint8_t max_width); #endif // _di_f_utf_is_whitespace_ /** @@ -873,7 +873,7 @@ extern "C" { * f_invalid_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_utf_char_to_character_ - extern f_return_status f_utf_char_to_character(const f_string character, const unsigned short max_width, f_utf_character *character_utf); + extern f_return_status f_utf_char_to_character(const f_string character, const uint8_t max_width, f_utf_character *character_utf); #endif // _di_f_utf_char_to_character_ #ifdef __cplusplus -- 1.8.3.1