From 703a3617e24dd6412da4c99182c6d2e738d776ce Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 21 Jun 2020 18:43:01 -0500 Subject: [PATCH] Update: UTF-8 improvements Move some FSS UTF-8 processing code into UTF-8 as it should be more generic. Add more UTF-8 functions (or at least the stubs). Begin adding emoji, which is all over the place. Staring at so many codes, it will be easy to make a mistake. After all of the UTF-8 functions are believed to be fully implemented an extensive review needs to happen. --- level_0/f_fss/c/fss.c | 73 ---- level_0/f_fss/c/fss.h | 57 --- level_0/f_utf/c/private-utf.c | 691 ++++++++++++++++++++++++++++++++++- level_0/f_utf/c/private-utf.h | 126 ++++++- level_0/f_utf/c/utf.c | 304 ++++++++++++++- level_0/f_utf/c/utf.h | 293 ++++++++++++--- level_1/fl_fss/c/fss_basic.c | 22 +- level_1/fl_fss/c/fss_basic.h | 8 +- level_1/fl_fss/c/fss_basic_list.c | 68 ++-- level_1/fl_fss/c/fss_basic_list.h | 8 +- level_1/fl_fss/c/fss_extended.c | 94 ++--- level_1/fl_fss/c/fss_extended.h | 8 +- level_1/fl_fss/c/fss_extended_list.c | 74 ++-- level_1/fl_fss/c/fss_extended_list.h | 8 +- level_1/fl_fss/c/fss_macro.h | 22 +- level_1/fl_fss/c/private-fss.c | 50 +-- level_1/fl_fss/c/private-fss.h | 2 +- 17 files changed, 1523 insertions(+), 385 deletions(-) diff --git a/level_0/f_fss/c/fss.c b/level_0/f_fss/c/fss.c index 157fc1f..0b14eb9 100644 --- a/level_0/f_fss/c/fss.c +++ b/level_0/f_fss/c/fss.c @@ -55,79 +55,6 @@ extern "C" { } #endif // _di_f_fss_count_lines_range_ -#ifndef _di_f_fss_decrement_buffer_ - f_return_status f_fss_decrement_buffer(const f_string_static buffer, f_string_range *range, const f_string_length step) { - #ifndef _di_level_0_parameter_checking_ - if (buffer.used <= 0) return F_status_set_error(F_parameter); - if (range->stop < range->start) return F_status_set_error(F_parameter); - if (range->start >= buffer.used) return F_status_set_error(F_parameter); - if (step < 1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (range->start < 1) return F_none_eos; - - f_string_length i = 0; - unsigned short width = 0; - - do { - width = f_macro_utf_byte_width(buffer.string[range->start - 1]); - - if (width > range->start) { - if (width > 1) { - return F_status_set_error(F_incomplete_utf_eos); - } - - return F_none_eos; - } - - i++; - range->start -= width; - } while (i < step); - - return F_none; - } -#endif // _di_f_fss_decrement_buffer_ - -#ifndef _di_f_fss_increment_buffer_ - f_return_status f_fss_increment_buffer(const f_string_static buffer, f_string_range *range, const f_string_length step) { - #ifndef _di_level_0_parameter_checking_ - if (buffer.used <= 0) return F_status_set_error(F_parameter); - if (range->stop < range->start) return F_status_set_error(F_parameter); - if (range->start >= buffer.used) return F_status_set_error(F_parameter); - if (step < 1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - f_string_length i = 0; - unsigned short width = 0; - - do { - width = f_macro_utf_byte_width(buffer.string[range->start]); - - if (range->start + width > range->stop) { - if (width > 1) { - return F_status_set_error(F_incomplete_utf_stop); - } - - range->start += width; - return F_none_stop; - } - else if (range->start + width >= buffer.used) { - if (width > 1) { - return F_status_set_error(F_incomplete_utf_eos); - } - - range->start += width; - return F_none_eos; - } - - i++; - range->start += width; - } while (i < step); - - return F_none; - } -#endif // _di_f_fss_increment_buffer_ - #ifndef _di_f_fss_is_graph_ f_return_status f_fss_is_graph(const f_string_static buffer, const f_string_range range) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_fss/c/fss.h b/level_0/f_fss/c/fss.h index 7e8261c..412f215 100644 --- a/level_0/f_fss/c/fss.h +++ b/level_0/f_fss/c/fss.h @@ -77,63 +77,6 @@ extern "C" { #endif // _di_f_fss_count_lines_range_ /** - * Continue to the previous character, based on step and character width. - * - * The start position must be at the start of a valid UTF-8 block. - * - * @param buffer - * The string to process. - * @param range - * The start and stop positions to be incremented. - * The start position will be incremented by step. - * @param step - * The number of steps to decrement the start position. - * The steps refer to characters and not integers. - * Essentially this number is considered against the width of every character found. - * (For ASCII each step would be (sizeof(int8_t), which is 1). - * (For UTF-8 character of width 3, each step would be (3 * sizeof(int8_t)). - * - * @return - * F_none on success. - * F_none_stop if the stop range is reached before all steps are completed. - * F_none_eos if the end of buffer is reached before all steps are completed. - * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_decrement_buffer_ - extern f_return_status f_fss_decrement_buffer(const f_string_static buffer, f_string_range *range, const f_string_length step); -#endif // _di_f_fss_decrement_buffer_ - -/** - * Continue to the next character, based on step and character width. - * - * The start position must be at the start of a valid UTF-8 block. - * - * @param buffer - * The string to process. - * @param range - * The start and stop positions to be incremented. - * The start position will be incremented by step. - * @param step - * The number of steps to increment the start position. - * The steps refer to characters and not integers. - * Essentially this number is considered against the width of every character found. - * (For ASCII each step would be (sizeof(int8_t), which is 1). - * (For UTF-8 character of width 3, each step would be (3 * sizeof(int8_t)). - * - * @return - * F_none on success. - * F_none_stop if the stop range is reached before all steps are completed. - * F_none_eos if the end of buffer is reached before all steps are completed. - * F_incomplete_utf_stop (with error bit) if the stop range is reached before the complete UTF-8 character can be processed. - * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_increment_buffer_ - extern f_return_status f_fss_increment_buffer(const f_string_static buffer, f_string_range *range, const f_string_length step); -#endif // _di_f_fss_increment_buffer_ - -/** * Identify whether or not a character in the buffer is a graph (ASCII or UTF-8) character. * * @param buffer diff --git a/level_0/f_utf/c/private-utf.c b/level_0/f_utf/c/private-utf.c index d38b3cf..7b1ea9b 100644 --- a/level_0/f_utf/c/private-utf.c +++ b/level_0/f_utf/c/private-utf.c @@ -8,23 +8,143 @@ extern "C" { #if !defined(_di_f_utf_character_is_alpha_) || !defined(_di_f_utf_is_alpha_) f_return_status private_f_utf_character_is_alpha(const f_utf_character character, const uint8_t width) { - // @todo: handle all Unicode "alpha". + if (private_f_utf_character_is_zero_width(character, width)) { + return F_false; + } - return F_false; + if (private_f_utf_character_is_control(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_control_picture(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_combining(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_whitespace(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_whitespace_modifier(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_numeric(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_punctuation(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_symbol(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_emoji(character, width)) { + return F_false; + } + + return F_true; } #endif // !defined(_di_f_utf_character_is_alpha_) || !defined(_di_f_utf_is_alpha_) #if !defined(_di_f_utf_character_is_alpha_numeric_) || !defined(_di_f_utf_is_alpha_numeric_) f_return_status private_f_utf_character_is_alpha_numeric(const f_utf_character character, const uint8_t width) { - // @todo: handle all Unicode "alpha_numeric". + if (private_f_utf_character_is_numeric(character, width)) { + return F_true; + } + + if (private_f_utf_character_is_zero_width(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_control(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_control_picture(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_whitespace(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_whitespace_modifier(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_punctuation(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_symbol(character, width)) { + return F_false; + } + + if (private_f_utf_character_is_emoji(character, width)) { + return F_false; + } return F_false; } #endif // !defined(_di_f_utf_character_is_alpha_numeric_) || !defined(_di_f_utf_is_alpha_numeric_) +#if !defined(_di_f_utf_character_is_combining_) || !defined(_di_f_utf_is_combining_) + f_return_status private_f_utf_character_is_combining(const f_utf_character character, const uint8_t width) { + + if (width == 2) { + + // Diacritical Marks: U+0300 to U+036F. + if (character >= 0xcc800000 && character <= 0xcdaf0000) { + return F_true; + } + + return F_false; + } + + if (width == 3) { + + // Diacritical Marks Extended: U+1AB0 to U+1AC0. + if (character >= 0xe1aab000 && character <= 0xe1ab8000) { + return F_true; + } + + // Diacritical Marks Supplement: U+1DC0 to U+1DF9. + if (character >= 0xe1b78000 && character <= 0xe1b7b900) { + return F_true; + } + + // Diacritical Marks Supplement: U+1DFB to U+1DFF. + if (character >= 0xe1b7bb00 && character <= 0xe1b7bf00) { + return F_true; + } + + // Diacritical Marks For Symbols: U+20D0 to U+20F0. + if (character >= 0xe2839000 && character <= 0xe283b000) { + return F_true; + } + + // Combining Half Marks: U+FE20 to U+FE2F. + if (character >= 0xefb8a000 && character <= 0xefb8af00) { + return F_true; + } + + return F_false; + } + + return F_false; + } +#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_return_status private_f_utf_character_is_control(const f_utf_character character, const uint8_t width) { + if (width == 2) { // Latin-1 Supplement: U+0080 to U+009F. if (character >= 0xc2800000 && character <= 0xc29f0000) { @@ -35,7 +155,6 @@ extern "C" { } if (width == 3) { - // @todo these might not be "control characters" and instead be "marking characters" or "combining characters". // Special: U+FFF9 to U+FFFB. if (character >= 0xefbfb900 && character <= 0xefbfbb00) { return F_true; @@ -56,30 +175,539 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_control_) || !defined(_di_f_utf_is_control_) #if !defined(_di_f_utf_character_is_control_picture_) || !defined(_di_f_utf_is_control_picture_) - f_return_status private_f_utf_character_is_control_picture(const f_utf_character character) { - // Control Pictures: U+2400 to U+2426. + f_return_status private_f_utf_character_is_control_picture(const f_utf_character character, const uint8_t width) { + + if (width == 3) { + // Control Pictures: U+2400 to U+2426. + if (character >= 0xe2908000 && character <= 0xe290a600) { + return F_true; + } + + // Specials: U+FFFC to U+FFFD. + if (character == 0xefbfbc00 || character == 0xefbfbd00) { + return F_true; + } + } + + return F_false; + } +#endif // !defined(_di_f_utf_character_is_control_picture_) || !defined(_di_f_utf_is_control_picture_) + +#if !defined(_di_f_utf_character_is_emoji_) || !defined(_di_f_utf_is_emoji_) + f_return_status private_f_utf_character_is_emoji(const f_utf_character character, const uint8_t width) { + + // @todo ugh..emojis are all over the place, I only got as far as creating a list of Unicodes, convert these Unicodes to UTF-8 codes. (be sure too use width == comparisons.) +/* + // reduce the number of checks by grouping checks by first byte. + uint8_t byte_first = f_macro_utf_character_to_char_1(character); + + // U+00A9, U+00AE, U+203C, U+2049. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+2042, U+2122, U+2139. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+2194 to U+2199. if (character >= 0xe2908000 && character <= 0xe290a600) { return F_true; } - // Specials: U+FFFC to U+FFFD. - if (character == 0xefbfbc00 || character == 0xefbfbd00) { + // U+21A9, U+21AA, U+231A, U+231B. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+2328, U+23CF. + if (character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+23E9 to U+23F3. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+23F8 to U+23FA. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+24C2, U+25AA, U+25AB, U+25B6. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+25C0. + if (character == 0x00000000) { + return F_true; + } + + // U+25FB to U+25FE. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+2600 to U+2604. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+260E, U+2611, U+2614, U+2615. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+2618, U+261D, U+2620, U+2622. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+2623, U+2626, U+262A, U+262E. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+262F. + if (character == 0x00000000) { + return F_true; + } + + // U+2638 to U+263A. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+2640, U+2642. + if (character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+2648 to U+2653. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+265F, U+2660, U+2663, U+2665. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { return F_true; } + // U+2666, U+2668, U+267B, U+267E. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+267F. + if (character == 0x00000000) { + return F_true; + } + + // U+2692 to U+2697. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+2699, U+269B, U+269C, U+26A0. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+26A1, U+26A7, U+26AA, U+26AB. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+26B0, U+26B1, U+26BD, U+26BE. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+26C4, U+26C5, U+26C8, U+26CE. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+26CF, U+26D1, U+26D3, U+26D4. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+26E9, U+26EA. + if (character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+26F0 to U+26F5. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+26F7 to U+26FA. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+26FD, U+2702, U+2705. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+2708 to U+270D. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+270F, U+2712, U+2714, U+2716. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+271D, U+2721, U+2728, U+2733. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+2734, U+2744, U+2747, U+274C. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+274E. + if (character == 0x00000000) { + return F_true; + } + + // U+2753 to U+2755. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+2757, U+2763, U+2764. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+2795 to U+2797. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+27A1, U+27B0, U+27BF, U+2934. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+2935. + if (character == 0x00000000) { + return F_true; + } + + // U+2B05 to U+2B07. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+2B1B, U+2B1C, U+2B50, U+2B55. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+3030, U+303D, U+303D, U+3297. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+3299, U+1F004. + if (character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+1F0CF to U+1F171. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F17E, U+1F17F, U+1F18E. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+1F191 to U+1F19A. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F201, U+1F202, U+1F21A, U+1F22F. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+1F232 to U+1F23A. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F250, U+1F251. + if (character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+1F300 to U+1F321. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F324 to U+1F393. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F396, U+1F397. + if (character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+1F399 to U+1F39B. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F39E to U+1F3F0. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F3F3 to U+1F3F5. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F3F7 to U+1F4FD. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F4FF to U+1F53D. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F549 to U+1F54E. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F550 to U+1F567. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F56F, U+1F570. + if (character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+1F573 to U+1F57A. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F587. + if (character == 0x00000000) { + return F_true; + } + + // U+1F58A to U+1F58D. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F590, U+1F595, U+1F596, U+1F5A4. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+1F5A5, U+1F5A8, U+1F5B1, U+1F5B2. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+1F5BC. + if (character == 0x00000000) { + return F_true; + } + + // U+1F5C2 to U+1F5C4. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F5D1 to U+1F5D3. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F5DC to U+1F5DE. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F5E1, U+1F5E3, U+1F5E8, U+1F5EF. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+1F5F3. + if (character == 0x00000000) { + return F_true; + } + + // U+1F5FA to U+1F6C5. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F6CB to U+1F6D2. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F6D5 to U+1F6D7. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F6E0 to U+1F6E5. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F6E9, U+1F6EB, U+1F6EC, U+1F6F0. + if (character == 0x00000000 || character == 0x00000000 || character == 0x00000000 || character == 0x00000000) { + return F_true; + } + + // U+1F6F3 to U+1F6FC. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F7E0 to U+1F7EB. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F90C to U+1F93A. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F93C to U+1F945. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F947 to U+1F978. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F97A to U+1F9CB. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1F9CD to U+1FA74. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1FA70 to U+1FA74. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1FA78 to U+1FA7A. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1FA80 to U+1FA86. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1FA90 to U+1FAA8. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1FAB0 to U+1FAB6. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1FAC0 to U+1FAC2. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } + + // U+1FAD0 to U+1FAD6. + if (character >= 0x00000000 && character <= 0x00000000) { + return F_true; + } +*/ return F_false; } -#endif // !defined(_di_f_utf_character_is_control_picture_) || !defined(_di_f_utf_is_control_picture_) +#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_return_status private_f_utf_character_is_numeric(const f_utf_character character, const uint8_t width) { - // @todo: handle all Unicode "numeric". + if (width == 3) { + + // U+2150 to U+218b. + if (character >= 0xe2859000 && character <= 0xe2868b00) { + return F_true; + } + + return F_false; + } + + if (width == 4) { + + // U+102E0 to U+102FB. + if (character >= 0xf0908ba0 && character <= 0xf0908bbb) { + return F_true; + } + } return F_false; } #endif // !defined(_di_f_utf_character_is_numeric_) || !defined(_di_f_utf_is_numeric_) +#if !defined(_di_f_utf_character_is_punctuation_) || !defined(_di_f_utf_is_punctuation_) + f_return_status private_f_utf_character_is_punctuation(const f_utf_character character, const uint8_t width) { + + // @todo UTF-8 punctuation. + + return F_false; + } +#endif // !defined(_di_f_utf_character_is_punctuation_) || !defined(_di_f_utf_is_punctuation_) + +#if !defined(_di_f_utf_character_is_symbol_) || !defined(_di_f_utf_is_symbol_) + f_return_status private_f_utf_character_is_symbol(const f_utf_character character, const uint8_t width) { + + // @todo: handle all Unicode "symbol". + + return F_false; + } +#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_return_status private_f_utf_character_is_valid(const f_utf_character character, const uint8_t width) { // reduce the number of checks by grouping checks by first byte. @@ -684,8 +1312,8 @@ extern "C" { return F_false; } - // Combining Diacritical Marks Supplement: U+1ABF to U+1AFF. - if (bytes >= 0xaabf && bytes <= 0xabbf) { + // Diacritical Marks Supplement: U+1AC1 to U+1AFF. + if (bytes >= 0xab81 && bytes <= 0xabbf) { return F_false; } @@ -925,7 +1553,7 @@ extern "C" { return F_false; } - // Combining Diacritical Marks for Symbols: U+20F1 to U+20FF. + // Diacritical Marks for Symbols: U+20F1 to U+20FF. if (bytes >= 0x83b1 && bytes <= 0x83bf) { return F_false; } @@ -2410,7 +3038,8 @@ 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_return_status private_f_utf_character_is_whitespace(const f_utf_character character) { + f_return_status private_f_utf_character_is_whitespace(const f_utf_character character, const uint8_t width) { + // reduce the number of checks by grouping checks by first byte. uint8_t byte_first = f_macro_utf_character_to_char_1(character); @@ -2452,10 +3081,28 @@ 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_return_status private_f_utf_character_is_whitespace_modifier(const f_utf_character character, const uint8_t width) { + + // U+02B0 to U+02FF. + if (width == 2) { + if (character >= 0xcab00000 && character <= 0xcbbf0000) { + return F_true; + } + } + + return F_false; + } +#endif // !defined(_di_f_utf_character_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_modifier_) + #if !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_is_word_) f_return_status private_f_utf_character_is_word(const f_utf_character character, const uint8_t width) { - // @todo: handle all Unicode "word". + if (private_f_utf_character_is_alpha_numeric(character, width)) { + return F_true; + } + + // @todo UTF-8 underscores? return F_false; } @@ -2464,7 +3111,11 @@ extern "C" { #if !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_is_word_dash_) f_return_status private_f_utf_character_is_word_dash(const f_utf_character character, const uint8_t width) { - // @todo: handle all Unicode "word_dash". + if (private_f_utf_character_is_word(character, width)) { + return F_true; + } + + // @todo UTF-8 dashes? return F_false; } @@ -2473,14 +3124,18 @@ extern "C" { #if !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_is_word_dash_plus_) f_return_status private_f_utf_character_is_word_dash_plus(const f_utf_character character, const uint8_t width) { - // @todo: handle all Unicode "word_dash_plus". + if (private_f_utf_character_is_word_dash(character, width)) { + return F_true; + } + + // @todo UTF-8 pluses? return F_false; } #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_return_status private_f_utf_character_is_zero_width(const f_utf_character character) { + f_return_status private_f_utf_character_is_zero_width(const f_utf_character character, const uint8_t width) { // reduce the number of checks by grouping checks by first byte. uint8_t byte_first = f_macro_utf_character_to_char_1(character); diff --git a/level_0/f_utf/c/private-utf.h b/level_0/f_utf/c/private-utf.h index 2ecfb77..9c9b581 100644 --- a/level_0/f_utf/c/private-utf.h +++ b/level_0/f_utf/c/private-utf.h @@ -64,6 +64,28 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_alpha_numeric_) || !defined(_di_f_utf_is_alpha_numeric_) /** + * Private implementation of f_utf_character_is_combining(). + * + * Intended to be shared to each of the different implementation variations. + * + * @param character + * The character to validate. + * @param width + * The number of bytes repesenting the character width. + * + * @return + * F_true if a UTF-8 control picture character. + * F_false if not a UTF-8 control picture character. + * F_utf (with error bit) if character is an invalid UTF-8 character. + * + * @see f_utf_character_is_combining() + * @see f_utf_is_combining() + */ +#if !defined(_di_f_utf_character_is_combining_) || !defined(_di_f_utf_is_combining_) + extern f_return_status private_f_utf_character_is_combining(const f_utf_character character, const uint8_t width) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_utf_character_is_combining_) || !defined(_di_f_utf_is_combining_) + +/** * Private implementation of f_utf_character_is_control(). * * Intended to be shared to each of the different implementation variations. @@ -93,6 +115,8 @@ extern "C" { * * @param character * The character to validate. + * @param width + * The number of bytes repesenting the character width. * * @return * F_true if a UTF-8 control picture character. @@ -103,10 +127,33 @@ 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_return_status private_f_utf_character_is_control_picture(const f_utf_character character) f_gcc_attribute_visibility_internal; + extern f_return_status private_f_utf_character_is_control_picture(const f_utf_character character, const uint8_t width) f_gcc_attribute_visibility_internal; #endif // !defined(_di_f_utf_character_is_control_picture_) || !defined(_di_f_utf_is_control_picture_) /** + * Private implementation of f_utf_character_is_emoji(). + * + * Intended to be shared to each of the different implementation variations. + * + * @param character + * The character to validate. + * @param width + * The number of bytes repesenting the character width. + * + * @return + * F_true if a UTF-8 control character. + * F_false if not a UTF-8 control character. + * F_utf (with error bit) if character is an invalid UTF-8 character. + * + * @see iscntrl() + * @see f_utf_character_is_emoji() + * @see f_utf_is_emoji() + */ +#if !defined(_di_f_utf_character_is_emoji_) || !defined(_di_f_utf_is_emoji_) + extern f_return_status private_f_utf_character_is_emoji(const f_utf_character character, const uint8_t width) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_utf_character_is_emoji_) || !defined(_di_f_utf_is_emoji_) + +/** * Private implementation of f_utf_character_is_numeric(). * * Intended to be shared to each of the different implementation variations. @@ -130,6 +177,52 @@ extern "C" { #endif // !defined(_di_f_utf_character_is_numeric_) || !defined(_di_f_utf_is_numeric_) /** + * Private implementation of f_utf_character_is_punctuation(). + * + * Intended to be shared to each of the different implementation variations. + * + * @param character + * The character to validate. + * @param width + * The number of bytes repesenting the character width. + * + * @return + * F_true if a UTF-8 control character. + * F_false if not a UTF-8 control character. + * F_utf (with error bit) if character is an invalid UTF-8 character. + * + * @see iscntrl() + * @see f_utf_character_is_punctuation() + * @see f_utf_is_punctuation() + */ +#if !defined(_di_f_utf_character_is_punctuation_) || !defined(_di_f_utf_is_punctuation_) + extern f_return_status private_f_utf_character_is_punctuation(const f_utf_character character, const uint8_t width) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_utf_character_is_punctuation_) || !defined(_di_f_utf_is_punctuation_) + +/** + * Private implementation of f_utf_character_is_symbol(). + * + * Intended to be shared to each of the different implementation variations. + * + * @param character + * The character to validate. + * @param width + * The number of bytes repesenting the character width. + * + * @return + * F_true if a UTF-8 control character. + * F_false if not a UTF-8 control character. + * F_utf (with error bit) if character is an invalid UTF-8 character. + * + * @see iscntrl() + * @see f_utf_character_is_symbol() + * @see f_utf_is_symbol() + */ +#if !defined(_di_f_utf_character_is_symbol_) || !defined(_di_f_utf_is_symbol_) + extern f_return_status private_f_utf_character_is_symbol(const f_utf_character character, const uint8_t width) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_utf_character_is_symbol_) || !defined(_di_f_utf_is_symbol_) + +/** * Private implementation of f_utf_character_is_valid(). * * Intended to be shared to each of the different implementation variations. @@ -158,6 +251,8 @@ extern "C" { * * @param character * The character to validate. + * @param width + * The number of bytes repesenting the character width. * * @return * F_true if a UTF-8 whitespace. @@ -168,10 +263,33 @@ extern "C" { * @see f_utf_is_whitespace() */ #if !defined(_di_f_utf_character_is_whitespace_) || !defined(_di_f_utf_is_whitespace_) - extern f_return_status private_f_utf_character_is_whitespace(const f_utf_character character) f_gcc_attribute_visibility_internal; + extern f_return_status private_f_utf_character_is_whitespace(const f_utf_character character, const uint8_t width) f_gcc_attribute_visibility_internal; #endif // !defined(_di_f_utf_character_is_whitespace_) || !defined(_di_f_utf_is_whitespace_) /** + * Private implementation of f_utf_character_is_whitespace_modifier(). + * + * Intended to be shared to each of the different implementation variations. + * + * @param character + * The character to validate. + * @param width + * The number of bytes repesenting the character width. + * + * @return + * F_true if a UTF-8 control character. + * F_false if not a UTF-8 control character. + * F_utf (with error bit) if character is an invalid UTF-8 character. + * + * @see iscntrl() + * @see f_utf_character_is_whitespace_modifier() + * @see f_utf_is_whitespace_modifier() + */ +#if !defined(_di_f_utf_character_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_modifier_) + extern f_return_status private_f_utf_character_is_whitespace_modifier(const f_utf_character character, const uint8_t width) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_utf_character_is_whitespace_modifier_) || !defined(_di_f_utf_is_whitespace_modifier_) + +/** * Private implementation of f_utf_character_is_word(). * * Intended to be shared to each of the different implementation variations. @@ -247,6 +365,8 @@ extern "C" { * * @param character * The character to validate. + * @param width + * The number of bytes repesenting the character width. * * @return * F_true if a UTF-8 non-printing or zero-width character. @@ -257,7 +377,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_return_status private_f_utf_character_is_zero_width(const f_utf_character character) f_gcc_attribute_visibility_internal; + extern f_return_status private_f_utf_character_is_zero_width(const f_utf_character character, const uint8_t width) f_gcc_attribute_visibility_internal; #endif // !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_zero_width_) #ifdef __cplusplus diff --git a/level_0/f_utf/c/utf.c b/level_0/f_utf/c/utf.c index e384622..25d1ee9 100644 --- a/level_0/f_utf/c/utf.c +++ b/level_0/f_utf/c/utf.c @@ -5,6 +5,79 @@ extern "C" { #endif +#ifndef _di_f_utf_buffer_decrement_ + f_return_status f_utf_buffer_decrement(const f_string_static buffer, f_string_range *range, const f_string_length step) { + #ifndef _di_level_0_parameter_checking_ + if (buffer.used == 0) return F_status_set_error(F_parameter); + if (range == 0) return F_status_set_error(F_parameter); + if (range->start > range->stop) return F_status_set_error(F_parameter); + if (range->start >= buffer.used) return F_status_set_error(F_parameter); + if (step < 1) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + f_string_length i = 0; + unsigned short width = 0; + + do { + width = f_macro_utf_byte_width(buffer.string[range->start - 1]); + + if (width > range->start) { + if (width > 1) { + return F_status_set_error(F_incomplete_utf_eos); + } + + return F_none_eos; + } + + i++; + range->start -= width; + } while (i < step); + + return F_none; + } +#endif // _di_f_utf_buffer_decrement_ + +#ifndef _di_f_utf_buffer_increment_ + f_return_status f_utf_buffer_increment(const f_string_static buffer, f_string_range *range, const f_string_length step) { + #ifndef _di_level_0_parameter_checking_ + if (buffer.used == 0) return F_status_set_error(F_parameter); + if (range == 0) return F_status_set_error(F_parameter); + if (range->start > range->stop) return F_status_set_error(F_parameter); + if (range->start >= buffer.used) return F_status_set_error(F_parameter); + if (step < 1) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + f_string_length i = 0; + unsigned short width = 0; + + do { + width = f_macro_utf_byte_width(buffer.string[range->start]); + + if (range->start + width > range->stop) { + if (width > 1) { + return F_status_set_error(F_incomplete_utf_stop); + } + + range->start += width; + return F_none_stop; + } + else if (range->start + width >= buffer.used) { + if (width > 1) { + return F_status_set_error(F_incomplete_utf_eos); + } + + range->start += width; + return F_none_eos; + } + + i++; + range->start += width; + } while (i < step); + + return F_none; + } +#endif // _di_f_utf_buffer_increment_ + #ifndef _di_f_utf_character_is_ f_return_status f_utf_character_is(const f_utf_character character) { unsigned short width = f_macro_utf_character_width_is(character); @@ -61,6 +134,27 @@ extern "C" { } #endif // _di_f_utf_character_is_alpha_numeric_ +#ifndef _di_f_utf_character_is_combining_ + f_return_status f_utf_character_is_combining(const f_utf_character character) { + unsigned short width = f_macro_utf_character_width_is(character); + + if (width == 0) { + // There are no combining characters in ASCII. + return F_false; + } + + if (width == 1) { + return F_status_is_error(F_utf); + } + + if (width != 3) { + return F_false; + } + + return private_f_utf_character_is_combining(character, width); + } +#endif // _di_f_utf_character_is_combining_ + #ifndef _di_f_utf_character_is_control_ f_return_status f_utf_character_is_control(const f_utf_character character) { unsigned short width = f_macro_utf_character_width_is(character); @@ -98,10 +192,30 @@ extern "C" { return F_false; } - return private_f_utf_character_is_control_picture(character); + return private_f_utf_character_is_control_picture(character, width); } #endif // _di_f_utf_character_is_control_picture_ +#ifndef _di_f_utf_character_is_emoji_ + f_return_status f_utf_character_is_emoji(const f_utf_character character) { + unsigned short width = f_macro_utf_character_width_is(character); + + if (width == 0) { + if (isdigit(f_macro_utf_character_to_char_1(character))) { + return F_true; + } + + return F_false; + } + + if (width == 1) { + return F_status_is_error(F_utf); + } + + return private_f_utf_character_is_emoji(character, width); + } +#endif // _di_f_utf_character_is_emoji_ + #ifndef _di_f_utf_character_is_fragment_ f_return_status f_utf_character_is_fragment(const f_utf_character character) { unsigned short width = f_macro_utf_character_width_is(character); @@ -132,12 +246,11 @@ extern "C" { return F_false; } - if (private_f_utf_character_is_whitespace(character) == F_true) { + if (private_f_utf_character_is_whitespace(character, width) == F_true) { return F_false; } - // This test is in isolation so zero-width characters must be treated as a non-graph. - if (private_f_utf_character_is_zero_width(character) == F_true) { + if (private_f_utf_character_is_zero_width(character, width) == F_true) { return F_false; } @@ -165,6 +278,26 @@ extern "C" { } #endif // _di_f_utf_character_is_numeric_ +#ifndef _di_f_utf_character_is_punctuation_ + f_return_status f_utf_character_is_punctuation(const f_utf_character character) { + unsigned short width = f_macro_utf_character_width_is(character); + + if (width == 0) { + if (isdigit(f_macro_utf_character_to_char_1(character))) { + return F_true; + } + + return F_false; + } + + if (width == 1) { + return F_status_is_error(F_utf); + } + + return private_f_utf_character_is_punctuation(character, width); + } +#endif // _di_f_utf_character_is_punctuation_ + #ifndef _di_f_utf_character_is_valid_ f_return_status f_utf_character_is_valid(const f_utf_character character) { unsigned short width = f_macro_utf_character_width_is(character); @@ -193,7 +326,7 @@ extern "C" { return F_status_is_error(F_utf); } - return private_f_utf_character_is_whitespace(character); + return private_f_utf_character_is_whitespace(character, width); } #endif // _di_f_utf_character_is_whitespace_ @@ -285,7 +418,7 @@ extern "C" { return F_status_is_error(F_utf); } - return private_f_utf_character_is_zero_width(character); + return private_f_utf_character_is_zero_width(character, width); } #endif // _di_f_utf_character_is_zero_width_ @@ -446,6 +579,37 @@ extern "C" { } #endif // _di_f_utf_is_alpha_numeric_ +#ifndef _di_f_utf_is_combining_ + f_return_status f_utf_is_combining(const f_string character, const f_string_length width_max) { + #ifndef _di_level_0_parameter_checking_ + if (width_max < 1) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + uint8_t width = f_macro_utf_byte_width_is(*character); + + // There are no ASCII combining characters. + if (width == 0) { + return F_false; + } + + if (width == 1) { + return F_status_is_error(F_incomplete_utf); + } + + f_utf_character character_utf = 0; + + { + f_status status = 0; + + status = f_utf_char_to_character(character, width_max, &character_utf); + + if (status != F_none) return status; + } + + return private_f_utf_character_is_combining(character_utf, width); + } +#endif // _di_f_utf_is_combining_ + #ifndef _di_f_utf_is_control_ f_return_status f_utf_is_control(const f_string character, const f_string_length width_max) { #ifndef _di_level_0_parameter_checking_ @@ -488,7 +652,7 @@ extern "C" { uint8_t width = f_macro_utf_byte_width_is(*character); - // There are not ASCII control pictures. + // There are no ASCII control pictures. if (width == 0) { return F_false; } @@ -507,10 +671,60 @@ extern "C" { if (status != F_none) return status; } - return private_f_utf_character_is_control_picture(character_utf); + return private_f_utf_character_is_control_picture(character_utf, width); } #endif // _di_f_utf_is_control_picture_ +#ifndef _di_f_utf_is_emoji_ + f_return_status f_utf_is_emoji(const f_string character, const f_string_length width_max) { + #ifndef _di_level_0_parameter_checking_ + if (width_max < 1) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + uint8_t width = f_macro_utf_byte_width_is(*character); + + if (width == 0) { + if (isdigit(*character)) { + return F_true; + } + + return F_false; + } + + if (width == 1) { + return F_status_is_error(F_incomplete_utf); + } + + f_utf_character character_utf = 0; + + { + f_status status = 0; + + status = f_utf_char_to_character(character, width_max, &character_utf); + + if (status != F_none) return status; + } + + return private_f_utf_character_is_emoji(character_utf, width); + } +#endif // _di_f_utf_is_emoji_ + +#ifndef _di_f_utf_is_fragment_ + f_return_status f_utf_is_fragment(const f_string character, const f_string_length width_max) { + #ifndef _di_level_0_parameter_checking_ + if (width_max < 1) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + uint8_t width = f_macro_utf_byte_width_is(*character); + + if (width == 1) { + return F_true; + } + + return F_false; + } +#endif // _di_f_utf_is_fragment_ + #ifndef _di_f_utf_is_graph_ f_return_status f_utf_is_graph(const f_string character, const f_string_length width_max) { #ifndef _di_level_0_parameter_checking_ @@ -545,12 +759,12 @@ extern "C" { return F_false; } - if (private_f_utf_character_is_whitespace(character_utf) == F_true) { + if (private_f_utf_character_is_whitespace(character_utf, width) == F_true) { return F_false; } // This test is in isolation so zero-width characters must be treated as a non-graph. - if (private_f_utf_character_is_zero_width(character_utf) == F_true) { + if (private_f_utf_character_is_zero_width(character_utf, width) == F_true) { return F_false; } @@ -592,6 +806,40 @@ extern "C" { } #endif // _di_f_utf_is_numeric_ +#ifndef _di_f_utf_is_punctuation_ + f_return_status f_utf_is_punctuation(const f_string character, const f_string_length width_max) { + #ifndef _di_level_0_parameter_checking_ + if (width_max < 1) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + uint8_t width = f_macro_utf_byte_width_is(*character); + + if (width == 0) { + if (isdigit(*character)) { + return F_true; + } + + return F_false; + } + + if (width == 1) { + return F_status_is_error(F_incomplete_utf); + } + + f_utf_character character_utf = 0; + + { + f_status status = 0; + + status = f_utf_char_to_character(character, width_max, &character_utf); + + if (status != F_none) return status; + } + + return private_f_utf_character_is_punctuation(character_utf, width); + } +#endif // _di_f_utf_is_punctuation_ + #ifndef _di_f_utf_is_valid_ f_return_status f_utf_is_valid(const f_string character, const f_string_length width_max) { #ifndef _di_level_0_parameter_checking_ @@ -652,6 +900,40 @@ extern "C" { } #endif // _di_f_utf_is_whitespace_ +#ifndef _di_f_utf_is_whitespace_modifier_ + f_return_status f_utf_is_whitespace_modifier(const f_string character, const f_string_length width_max) { + #ifndef _di_level_0_parameter_checking_ + if (width_max < 1) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + uint8_t width = f_macro_utf_byte_width_is(*character); + + if (width == 0) { + if (isdigit(*character)) { + return F_true; + } + + return F_false; + } + + if (width == 1) { + return F_status_is_error(F_incomplete_utf); + } + + f_utf_character character_utf = 0; + + { + f_status status = 0; + + status = f_utf_char_to_character(character, width_max, &character_utf); + + if (status != F_none) return status; + } + + return private_f_utf_character_is_whitespace_modifier(character_utf, width); + } +#endif // _di_f_utf_is_whitespace_modifier_ + #ifndef _di_f_utf_is_word_ f_return_status f_utf_is_word(const f_string character, const f_string_length width_max) { #ifndef _di_level_0_parameter_checking_ @@ -791,7 +1073,7 @@ extern "C" { if (status != F_none) return status; } - return private_f_utf_character_is_zero_width(character_utf); + return private_f_utf_character_is_zero_width(character_utf, width); } #endif // _di_f_utf_is_zero_width_ diff --git a/level_0/f_utf/c/utf.h b/level_0/f_utf/c/utf.h index 827388c..0c071d5 100644 --- a/level_0/f_utf/c/utf.h +++ b/level_0/f_utf/c/utf.h @@ -51,6 +51,67 @@ extern "C" { #endif /** + * Continue to the previous character, based on step and character width. + * + * For navigating a range within the given buffer by a specific number of characters that could be of any width allowed by UTF-8. + * + * The start position must be at the start of a valid UTF-8 block. + * + * @param buffer + * The string to process. + * @param range + * The start and stop positions to be incremented. + * The start position will be incremented by step. + * @param step + * The number of steps to decrement the start position. + * The steps refer to characters and not integers. + * Essentially this number is considered against the width of every character found. + * (For ASCII each step would be sizeof(int8_t), which is 1. + * (For UTF-8 character of width 3, each step would be (3 * sizeof(int8_t)). + * + * @return + * F_none on success. + * F_none_stop if the stop range is reached before all steps are completed. + * F_none_eos if the end of buffer is reached before all steps are completed. + * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_utf_buffer_decrement_ + extern f_return_status f_utf_buffer_decrement(const f_string_static buffer, f_string_range *range, const f_string_length step); +#endif // _di_f_utf_buffer_decrement_ + +/** + * Continue to the next character, based on step and character width. + * + * For navigating a range within the given buffer by a specific number of characters that could be of any width allowed by UTF-8. + * + * The start position must be at the start of a valid UTF-8 block. + * + * @param buffer + * The string to process. + * @param range + * The start and stop positions to be incremented. + * The start position will be incremented by step. + * @param step + * The number of steps to increment the start position. + * The steps refer to characters and not integers. + * Essentially this number is considered against the width of every character found. + * (For ASCII each step would be sizeof(int8_t), which is 1. + * (For UTF-8 character of width 3, each step would be (3 * sizeof(int8_t)). + * + * @return + * F_none on success. + * F_none_stop if the stop range is reached before all steps are completed. + * F_none_eos if the end of buffer is reached before all steps are completed. + * F_incomplete_utf_stop (with error bit) if the stop range is reached before the complete UTF-8 character can be processed. + * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_utf_buffer_increment_ + extern f_return_status f_utf_buffer_increment(const f_string_static buffer, f_string_range *range, const f_string_length step); +#endif // _di_f_utf_buffer_increment_ + +/** * Check to see if the entire byte block of the character is a UTF-8 character. * * This does not validate if the UTF-8 character is a valid UTF-8 character, for that use f_utf_character_is_valid(). @@ -64,7 +125,6 @@ extern "C" { * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_valid() - * @see f_utf_is() */ #ifndef _di_f_utf_character_is_ extern f_return_status f_utf_character_is(const f_utf_character character); @@ -73,8 +133,6 @@ extern "C" { /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 alphabet character. * - * @todo Incomplete, UTF-8 codes not yet checked! - * * @param character * The character to validate. * @@ -84,7 +142,6 @@ extern "C" { * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see iscntrl() - * @see f_utf_is_alpha() */ #ifndef _di_f_utf_character_is_alpha_ extern f_return_status f_utf_character_is_alpha(const f_utf_character character); @@ -93,8 +150,6 @@ extern "C" { /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 alphabetic or numeric character. * - * @todo Incomplete, UTF-8 codes not yet checked! - * * @param character * The character to validate. * @@ -104,13 +159,27 @@ extern "C" { * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see iscntrl() - * @see f_utf_is_alphanumeric() */ #ifndef _di_f_utf_character_is_alpha_numeric_ extern f_return_status f_utf_character_is_alpha_numeric(const f_utf_character character); #endif // _di_f_utf_character_is_alpha_numeric_ /** + * Check to see if the entire byte block of the character is a UTF-8 combining character. + * + * @param character + * The character to validate. + * + * @return + * F_true if a UTF-8 control picture character. + * F_false if not a UTF-8 control picture character. + * F_utf (with error bit) if character is an invalid UTF-8 character. + */ +#ifndef _di_f_utf_character_is_combining_ + extern f_return_status f_utf_character_is_combining(const f_utf_character character); +#endif // _di_f_utf_character_is_combining_ + +/** * Check to see if the entire byte block of the character is an ASCII or UTF-8 control character. * * @param character @@ -122,7 +191,6 @@ extern "C" { * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see iscntrl() - * @see f_utf_is_control() */ #ifndef _di_f_utf_character_is_control_ extern f_return_status f_utf_character_is_control(const f_utf_character character); @@ -140,14 +208,31 @@ extern "C" { * F_true if a UTF-8 control picture character. * F_false if not a UTF-8 control picture character. * F_utf (with error bit) if character is an invalid UTF-8 character. - * - * @see f_utf_is_control_picture() */ #ifndef _di_f_utf_character_is_control_picture_ extern f_return_status f_utf_character_is_control_picture(const f_utf_character character); #endif // _di_f_utf_character_is_control_picture_ /** + * Check to see if the entire byte block of the character is an ASCII or UTF-8 emoji character. + * + * @todo Incomplete, UTF-8 codes not yet checked! + * + * @param character + * The character to validate. + * + * @return + * F_true if a UTF-8 emoji character. + * F_false if not a UTF-8 emoji character. + * F_utf (with error bit) if character is an invalid UTF-8 character. + * + * @see iscntrl() + */ +#ifndef _di_f_utf_character_is_emoji_ + extern f_return_status f_utf_character_is_emoji(const f_utf_character character); +#endif // _di_f_utf_character_is_emoji_ + +/** * Check to see if the entire byte block of the character is a 1-width UTF-8 character fragment. * * Characters whose width is 1-byte are invalid. @@ -155,6 +240,17 @@ extern "C" { * * For normal validation functions, try using f_utf_character_is() or f_utf_character_is_valid(). * + * According to rfc3629, the valid octect sequences for UTF-8 are: + * UTF8-octets = *( UTF8-char ) + * UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4 + * UTF8-1 = %x00-7F + * UTF8-2 = %xC2-DF UTF8-tail + * UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / + * %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) + * UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / + * %xF4 %x80-8F 2( UTF8-tail ) + * UTF8-tail = %x80-BF + * * @param character * The character to validate. * @@ -165,7 +261,6 @@ extern "C" { * * @see f_utf_character_is() * @see f_utf_character_is_valid() - * @see f_utf_is_fragment() */ #ifndef _di_f_utf_character_is_fragment_ extern f_return_status f_utf_character_is_fragment(const f_utf_character character); @@ -192,8 +287,6 @@ extern "C" { /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 numeric character. * - * @todo Incomplete, UTF-8 codes not yet checked! - * * @param character * The character to validate. * @@ -210,6 +303,46 @@ extern "C" { #endif // _di_f_utf_character_is_numeric_ /** + * Check to see if the entire byte block of the character is an ASCII or UTF-8 punctuation character. + * + * @todo Incomplete, UTF-8 codes not yet checked! + * + * @param character + * The character to validate. + * + * @return + * F_true if a UTF-8 punctuation character. + * F_false if not a UTF-8 punctuation character. + * F_utf (with error bit) if character is an invalid UTF-8 character. + * + * @see iscntrl() + * @see f_utf_is_punctuation() + */ +#ifndef _di_f_utf_character_is_punctuation_ + extern f_return_status f_utf_character_is_punctuation(const f_utf_character character); +#endif // _di_f_utf_character_is_punctuation_ + +/** + * Check to see if the entire byte block of the character is an ASCII or UTF-8 symbol character. + * + * @todo Incomplete, UTF-8 codes not yet checked! + * + * @param character + * The character to validate. + * + * @return + * F_true if a UTF-8 symbol character. + * F_false if not a UTF-8 symbol character. + * F_utf (with error bit) if character is an invalid UTF-8 character. + * + * @see iscntrl() + * @see f_utf_is_symbol() + */ +#ifndef _di_f_utf_character_is_symbol_ + extern f_return_status f_utf_character_is_symbol(const f_utf_character character); +#endif // _di_f_utf_character_is_symbol_ + +/** * Check to see if the entire byte block of the character is a valid UTF-8 character. * * This does validate if the UTF-8 character is a valid UTF-8 character. @@ -256,6 +389,24 @@ extern "C" { #endif // _di_f_utf_character_is_whitespace_ /** + * Check to see if the entire byte block of the character is an ASCII or UTF-8 whitespace modifier character. + * + * @param character + * The character to validate. + * + * @return + * F_true if a UTF-8 modifier character. + * F_false if not a UTF-8 modifier character. + * F_utf (with error bit) if character is an invalid UTF-8 character. + * + * @see iscntrl() + * @see f_utf_is_whitespace_modifier() + */ +#ifndef _di_f_utf_character_is_whitespace_modifier_ + extern f_return_status f_utf_character_is_whitespace_modifier(const f_utf_character character); +#endif // _di_f_utf_character_is_whitespace_modifier_ + +/** * Check to see if the entire byte block of the character is an ASCII or UTF-8 word character. * * A word character is alpha-numeric or an underscore '_'. @@ -420,9 +571,6 @@ extern "C" { * F_false if not a UTF-8 character. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_parameter (with error bit) if a parameter is invalid. - * - * @see f_utf_is_valid() - * @see f_utf_character_is() */ #ifndef _di_f_utf_is_ extern f_return_status f_utf_is(const f_string character, const f_string_length width_max); @@ -431,8 +579,6 @@ extern "C" { /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 alphabet character. * - * @todo Incomplete, UTF-8 codes not yet checked! - * * @param character * The character to validate. * There must be enough space allocated to compare against, as limited by width_max. @@ -446,7 +592,6 @@ extern "C" { * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see iscntrl() - * @see f_utf_character_is_alpha() */ #ifndef _di_f_utf_is_alpha_ extern f_return_status f_utf_is_alpha(const f_string character, const f_string_length width_max); @@ -455,8 +600,6 @@ extern "C" { /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 alphabet or numeric character. * - * @todo Incomplete, UTF-8 codes not yet checked! - * * @param character * The character to validate. * There must be enough space allocated to compare against, as limited by width_max. @@ -470,13 +613,31 @@ extern "C" { * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see iscntrl() - * @see f_utf_character_is_alpha_numeric() */ #ifndef _di_f_utf_is_alpha_numeric_ extern f_return_status f_utf_is_alpha_numeric(const f_string character, const f_string_length width_max); #endif // _di_f_utf_is_alpha_numeric_ /** + * Check to see if the entire byte block of the character is a UTF-8 combining character. + * + * @param character + * The character to validate. + * There must be enough space allocated to compare against, as limited by width_max. + * @param width_max + * The maximum width available for checking. + * Can be anything greater than 0. + * + * @return + * F_true if a UTF-8 control picture character. + * F_false if not a UTF-8 control picture character. + * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + */ +#ifndef _di_f_utf_is_combining_ + extern f_return_status f_utf_is_combining(const f_string character, const f_string_length width_max); +#endif // _di_f_utf_is_combining_ + +/** * Check to see if the entire byte block of the character is an ASCII or UTF-8 control character. * * @param character @@ -514,14 +675,35 @@ extern "C" { * F_true if a UTF-8 control picture character. * F_false if not a UTF-8 control picture character. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. - * - * @see f_utf_character_is_control_picture() */ #ifndef _di_f_utf_is_control_picture_ extern f_return_status f_utf_is_control_picture(const f_string character, const f_string_length width_max); #endif // _di_f_utf_is_control_picture_ /** + * Check to see if the entire byte block of the character is an ASCII or UTF-8 emoji character. + * + * @todo Incomplete, UTF-8 codes not yet checked! + * + * @param character + * The character to validate. + * There must be enough space allocated to compare against, as limited by width_max. + * @param width_max + * The maximum width available for checking. + * Can be anything greater than 0. + * + * @return + * F_true if a UTF-8 emoji character. + * F_false if not a UTF-8 emoji character. + * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * + * @see iscntrl() + */ +#ifndef _di_f_utf_is_emoji_ + extern f_return_status f_utf_is_emoji(const f_string character, const f_string_length width_max); +#endif // _di_f_utf_is_emoji_ + +/** * Check to see if the entire byte block of the character is a 1-width UTF-8 character fragment. * * Characters whose width is 1-byte are invalid. @@ -550,10 +732,6 @@ extern "C" { * @return * F_true if a UTF-8 character. * F_false if not a UTF-8 character. - * - * @see f_utf_character_is() - * @see f_utf_character_is_valid() - * @see f_utf_character_is_fragment() */ #ifndef _di_f_utf_is_fragment_ extern f_return_status f_utf_is_fragment(const f_string character, const f_string_length width_max); @@ -578,7 +756,6 @@ extern "C" { * * @see isgraph() * @see iscntrl() - * @see f_utf_character_is_graph() */ #ifndef _di_f_utf_is_graph_ extern f_return_status f_utf_is_graph(const f_string character, const f_string_length width_max); @@ -587,8 +764,6 @@ extern "C" { /** * Check to see if the entire byte block of the character is an ASCII or UTF-8 numeric character. * - * @todo Incomplete, UTF-8 codes not yet checked! - * * @param character * The character to validate. * There must be enough space allocated to compare against, as limited by width_max. @@ -602,13 +777,58 @@ extern "C" { * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see iscntrl() - * @see f_utf_character_is_numeric() */ #ifndef _di_f_utf_is_numeric_ extern f_return_status f_utf_is_numeric(const f_string character, const f_string_length width_max); #endif // _di_f_utf_is_numeric_ /** + * Check to see if the entire byte block of the character is an ASCII or UTF-8 punctuation character. + * + * @todo Incomplete, UTF-8 codes not yet checked! + * + * @param character + * The character to validate. + * There must be enough space allocated to compare against, as limited by width_max. + * @param width_max + * The maximum width available for checking. + * Can be anything greater than 0. + * + * @return + * F_true if a UTF-8 punctuation character. + * F_false if not a UTF-8 punctuation character. + * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * + * @see iscntrl() + */ +#ifndef _di_f_utf_is_punctuation_ + extern f_return_status f_utf_is_punctuation(const f_string character, const f_string_length width_max); +#endif // _di_f_utf_is_punctuation_ + +/** + * Check to see if the entire byte block of the character is an ASCII or UTF-8 symbol character. + * + * @todo Incomplete, UTF-8 codes not yet checked! + * + * @param character + * The character to validate. + * There must be enough space allocated to compare against, as limited by width_max. + * @param width_max + * The maximum width available for checking. + * Can be anything greater than 0. + * + * @return + * F_true if a UTF-8 symbol character. + * F_false if not a UTF-8 symbol character. + * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * + * @see iscntrl() + */ +#ifndef _di_f_utf_is_symbol_ + extern f_return_status f_utf_is_symbol(const f_string character, const f_string_length width_max); +#endif // _di_f_utf_is_symbol_ + +/** * Check to see if the entire byte block of the character is a UTF-8 character and if that character is a valid UTF-8. * * This does check the validity of the character, to not do this use f_utf_is(). @@ -629,10 +849,6 @@ extern "C" { * F_false if not a valid UTF-8 character. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_parameter (with error bit) if a parameter is invalid. - * - * @see f_utf_is() - * @see f_utf_is_fragment() - * @see f_utf_character_is_valid() */ #ifndef _di_f_utf_is_valid_ extern f_return_status f_utf_is_valid(const f_string character, const f_string_length width_max); @@ -657,7 +873,6 @@ extern "C" { * * @see isspace() * @see iscntrl() - * @see f_utf_character_is_whitespace() */ #ifndef _di_f_utf_is_whitespace_ extern f_return_status f_utf_is_whitespace(const f_string character, const f_string_length width_max); @@ -683,7 +898,6 @@ extern "C" { * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see iscntrl() - * @see f_utf_character_is_word() */ #ifndef _di_f_utf_is_word_ extern f_return_status f_utf_is_word(const f_string character, const f_string_length width_max); @@ -709,7 +923,6 @@ extern "C" { * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see iscntrl() - * @see f_utf_character_is_word_dash() */ #ifndef _di_f_utf_is_word_dash_ extern f_return_status f_utf_is_word_dash(const f_string character, const f_string_length width_max); @@ -735,7 +948,6 @@ extern "C" { * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see iscntrl() - * @see f_utf_character_is_word_dash_plus() */ #ifndef _di_f_utf_is_word_dash_plus_ extern f_return_status f_utf_is_word_dash_plus(const f_string character, const f_string_length width_max); @@ -762,7 +974,6 @@ extern "C" { * * @see isspace() * @see iscntrl() - * @see f_utf_character_is_zero_width() */ #ifndef _di_f_utf_is_zero_width_ extern f_return_status f_utf_is_zero_width(const f_string character, const f_string_length width_max); diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index 74740bd..df260e0 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -68,7 +68,7 @@ extern "C" { found->array[found->used].stop = range->start - 1; found->used++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_content; @@ -109,7 +109,7 @@ extern "C" { if (object.string[range->start] == f_fss_delimit_slash) { while (range->start <= range->stop && range->start < object.used) { if (object.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; continue; @@ -121,7 +121,7 @@ extern "C" { buffer->string[buffer_position.stop] = object.string[range->start]; buffer_position.stop++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -137,7 +137,7 @@ extern "C" { buffer->string[buffer_position.stop + 1] = object.string[range->start]; buffer_position.stop += 2; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } } @@ -154,7 +154,7 @@ extern "C" { buffer->string[buffer_position.stop + 1] = object.string[range->start]; buffer_position.stop += 2; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } else if (object.string[range->start] == f_fss_comment) { @@ -163,7 +163,7 @@ extern "C" { while (range->start <= range->stop && range->start < object.used) { if (object.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; continue; @@ -196,7 +196,7 @@ extern "C" { while (range->start <= range->stop && range->start < object.used) { if (object.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; continue; @@ -220,7 +220,7 @@ extern "C" { buffer_position.stop++; slash_count++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; fl_macro_fss_skip_past_delimit_placeholders(object, (*range)); @@ -265,7 +265,7 @@ extern "C" { buffer->string[buffer_position.stop] = object.string[range->start]; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; buffer_position.stop++; @@ -282,7 +282,7 @@ extern "C" { buffer->string[buffer_position.stop] = object.string[range->start]; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; buffer_position.stop++; @@ -340,7 +340,7 @@ extern "C" { buffer_position.stop++; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while diff --git a/level_1/fl_fss/c/fss_basic.h b/level_1/fl_fss/c/fss_basic.h index 06f2ec2..0ef12c5 100644 --- a/level_1/fl_fss/c/fss_basic.h +++ b/level_1/fl_fss/c/fss_basic.h @@ -64,7 +64,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). * Errors from (with error bit): f_fss_is_graph(). * Errors from (with error bit): f_fss_is_space(). * Errors from (with error bit): f_fss_skip_past_space(). @@ -106,7 +106,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). * Errors from (with error bit): f_fss_is_graph(). * Errors from (with error bit): f_fss_is_space(). * Errors from (with error bit): f_fss_skip_past_space(). @@ -141,7 +141,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). */ #ifndef _di_fl_fss_basic_object_write_ extern f_return_status fl_fss_basic_object_write(f_string_dynamic *buffer, const f_string_static object, f_string_range *range); @@ -172,7 +172,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). */ #ifndef _di_fl_fss_basic_content_write_ extern f_return_status fl_fss_basic_content_write(f_string_dynamic *buffer, const f_string_static content, f_string_range *range); diff --git a/level_1/fl_fss/c/fss_basic_list.c b/level_1/fl_fss/c/fss_basic_list.c index 56ad5ec..4b64d83 100644 --- a/level_1/fl_fss/c/fss_basic_list.c +++ b/level_1/fl_fss/c/fss_basic_list.c @@ -43,7 +43,7 @@ extern "C" { if (buffer->string[range->start] == f_fss_comment) { fl_macro_fss_object_seek_till_newline((*buffer), (*range), delimits, F_data_not_eos, F_data_not_stop) - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object_not; @@ -55,7 +55,7 @@ extern "C" { f_string_length first_slash = range->start; f_string_length slash_count = 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop && (buffer->string[range->start] == f_fss_delimit_placeholder || buffer->string[range->start] == f_fss_delimit_slash)) { @@ -63,7 +63,7 @@ extern "C" { slash_count++; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -72,7 +72,7 @@ extern "C" { if (buffer->string[range->start] == f_fss_basic_list_open) { f_string_length stop_point = range->start - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop) { @@ -83,7 +83,7 @@ extern "C" { if (F_status_is_error(status)) return status; if (status == F_false) break; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -114,7 +114,7 @@ extern "C" { slash_count--; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -136,7 +136,7 @@ extern "C" { else if (buffer->string[range->start] == f_fss_basic_list_open) { f_string_length stop_point = range->start - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop) { @@ -147,7 +147,7 @@ extern "C" { if (F_status_is_error(status)) return status; if (status == F_false) break; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -158,7 +158,7 @@ extern "C" { found->stop = stop_point; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object; @@ -167,19 +167,19 @@ extern "C" { continue; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while // seek to the end of the line when no valid object is found. while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while fl_macro_fss_object_return_on_overflow((*buffer), (*range), (*found), delimits, F_data_not_eos, F_data_not_stop); - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object_not; @@ -217,7 +217,7 @@ extern "C" { found_newline = F_true; last_newline = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; fl_macro_fss_content_delimited_return_on_overflow((*buffer), (*range), (*found), delimits, F_none_eos, F_none_stop) @@ -229,7 +229,7 @@ extern "C" { f_string_length first_slash = range->start; f_string_length slash_count = 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop && (buffer->string[range->start] == f_fss_delimit_placeholder || buffer->string[range->start] == f_fss_delimit_slash)) { @@ -237,7 +237,7 @@ extern "C" { slash_count++; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -251,7 +251,7 @@ extern "C" { if (buffer->string[range->start] == f_fss_basic_list_open) { f_string_length stop_point = range->start - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop) { @@ -262,7 +262,7 @@ extern "C" { if (F_status_is_error(status)) return status; if (status == F_false) break; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -311,7 +311,7 @@ extern "C" { slash_count--; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -323,7 +323,7 @@ extern "C" { continue; } else if (buffer->string[range->start] == f_fss_basic_list_open) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop) { @@ -334,7 +334,7 @@ extern "C" { if (F_status_is_error(status)) return status; if (status == F_false) break; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -366,7 +366,7 @@ extern "C" { continue; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -436,7 +436,7 @@ extern "C" { buffer_position.stop++; } - status = f_fss_increment_buffer(object, range, 1); + status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; } // while @@ -447,12 +447,12 @@ extern "C" { buffer->string[buffer_position.stop] = object.string[range->start]; buffer_position.stop++; - status = f_fss_increment_buffer(object, range, 1); + status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < object.used) { if (object.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(object, range, 1); + status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; continue; @@ -463,7 +463,7 @@ extern "C" { buffer->string[buffer_position.stop] = object.string[range->start]; buffer_position.stop++; - status = f_fss_increment_buffer(object, range, 1); + status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; slash_count++; @@ -499,7 +499,7 @@ extern "C" { buffer_position.stop++; } - status = f_fss_increment_buffer(object, range, 1); + status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; } // while @@ -555,12 +555,12 @@ extern "C" { buffer_position.stop++; has_graph = F_true; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < content.used) { if (content.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; continue; @@ -572,7 +572,7 @@ extern "C" { buffer->string[buffer_position.stop] = content.string[range->start]; buffer_position.stop++; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; slash_count++; @@ -581,7 +581,7 @@ extern "C" { if (content.string[range->start] == f_fss_basic_list_open) { f_string_length start = range->start; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; while (range->start < content.used && range->start <= range->stop) { @@ -592,7 +592,7 @@ extern "C" { if (F_status_is_error(status)) return status; if (status == F_false) break; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; } // while @@ -627,7 +627,7 @@ extern "C" { has_graph = F_true; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; while (range->start < content.used && range->start <= range->stop) { @@ -638,7 +638,7 @@ extern "C" { if (F_status_is_error(status)) return status; if (status == F_false) break; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; } // while @@ -680,7 +680,7 @@ extern "C" { buffer_position.stop++; } - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; } // while diff --git a/level_1/fl_fss/c/fss_basic_list.h b/level_1/fl_fss/c/fss_basic_list.h index 3bc800a..aa72e14 100644 --- a/level_1/fl_fss/c/fss_basic_list.h +++ b/level_1/fl_fss/c/fss_basic_list.h @@ -65,7 +65,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). * Errors from (with error bit): f_fss_is_graph(). * Errors from (with error bit): f_fss_is_space(). * Errors from (with error bit): f_fss_skip_past_space(). @@ -107,7 +107,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). * Errors from (with error bit): f_fss_is_graph(). * Errors from (with error bit): f_fss_is_space(). * Errors from (with error bit): f_fss_skip_past_space(). @@ -142,7 +142,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). */ #ifndef _di_fl_fss_basic_list_object_write_ extern f_return_status fl_fss_basic_list_object_write(const f_string_static object, f_string_range *range, f_string_dynamic *buffer); @@ -173,7 +173,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). */ #ifndef _di_fl_fss_basic_list_content_write_ extern f_return_status fl_fss_basic_list_content_write(const f_string_static content, f_string_range *range, f_string_dynamic *buffer); diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index ca36946..19b546e 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -79,7 +79,7 @@ extern "C" { if (buffer->string[range->start] == f_fss_delimit_slash) { f_string_length last_slash = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -87,7 +87,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer->used) { if (buffer->string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -101,7 +101,7 @@ extern "C" { if (status == F_true) { found->array[found->used].stop = range->start - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -127,7 +127,7 @@ extern "C" { last_slash = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -151,7 +151,7 @@ extern "C" { delimits.array[delimits.used] = last_slash; delimits.used++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -161,7 +161,7 @@ extern "C" { else if (buffer->string[range->start] == f_fss_delimit_single_quote || buffer->string[range->start] == f_fss_delimit_double_quote) { quoted = buffer->string[range->start]; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -183,7 +183,7 @@ extern "C" { if (status == F_true) break; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -202,7 +202,7 @@ extern "C" { return FL_fss_found_content; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -217,7 +217,7 @@ extern "C" { f_string_length first_slash = range->start; f_string_length slash_count = 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -225,7 +225,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer->used) { if (buffer->string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -239,7 +239,7 @@ extern "C" { slash_count++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -272,7 +272,7 @@ extern "C" { slash_count--; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -288,7 +288,7 @@ extern "C" { if (status == F_true) { while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -297,7 +297,7 @@ extern "C" { fl_macro_fss_content_return_on_overflow((*buffer), (*range), (*found), delimits, F_unterminated_group_eos, F_unterminated_group_stop) - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -321,7 +321,7 @@ extern "C" { found->array[found->used].stop = location - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -350,7 +350,7 @@ extern "C" { slash_count--; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -364,7 +364,7 @@ extern "C" { else if (buffer->string[range->start] == quoted) { found->array[found->used].stop = range->start - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -383,7 +383,7 @@ extern "C" { status = f_fss_is_space(*buffer, *range); if (status == F_true) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -400,7 +400,7 @@ extern "C" { else if (buffer->string[range->start] != f_fss_delimit_placeholder) { while (range->start < buffer->used && range->start <= range->stop) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -411,7 +411,7 @@ extern "C" { if (buffer->string[range->start] == f_string_eol[0]) break; } // while - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -420,7 +420,7 @@ extern "C" { return F_unterminated_group; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -444,7 +444,7 @@ extern "C" { found->array[found->used].stop = range->start - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -456,7 +456,7 @@ extern "C" { } } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -478,7 +478,7 @@ extern "C" { // seek to the end of the line when no valid content is found while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -488,7 +488,7 @@ extern "C" { fl_macro_fss_content_delimited_return_on_overflow((*buffer), (*range), (*found), delimits, F_none_eos, F_none_stop) if (found->used == already_used) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -499,7 +499,7 @@ extern "C" { fl_macro_fss_apply_delimit_placeholders((*buffer), delimits); - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -543,7 +543,7 @@ extern "C" { if (object.string[range->start] == f_fss_delimit_slash) { while (range->start <= range->stop && range->start < object.used) { if (object.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; continue; @@ -554,7 +554,7 @@ extern "C" { buffer->string[buffer_position.stop] = object.string[range->start]; buffer_position.stop++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -571,7 +571,7 @@ extern "C" { buffer->string[buffer_position.stop + 1] = object.string[range->start]; buffer_position.stop += 2; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } } @@ -587,7 +587,7 @@ extern "C" { buffer->string[buffer_position.stop + 1] = object.string[range->start]; buffer_position.stop += 2; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } else if (object.string[range->start] == f_fss_comment) { @@ -596,7 +596,7 @@ extern "C" { while (range->start <= range->stop && range->start < object.used) { if (object.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; continue; @@ -616,11 +616,11 @@ extern "C" { f_string_length first_space = range->start; if (!quoted) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < object.used && isspace(object.string[range->start])) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -648,7 +648,7 @@ extern "C" { while (range->start <= range->stop && range->start < object.used) { if (object.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; continue; @@ -673,7 +673,7 @@ extern "C" { buffer_position.stop++; slash_count++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; fl_macro_fss_skip_past_delimit_placeholders(object, (*range)); @@ -718,7 +718,7 @@ extern "C" { buffer->string[buffer_position.stop] = object.string[range->start]; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; buffer_position.stop++; @@ -735,7 +735,7 @@ extern "C" { buffer->string[buffer_position.stop] = object.string[range->start]; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; buffer_position.stop++; @@ -789,12 +789,12 @@ extern "C" { buffer->string[buffer_position.stop] = f_fss_delimit_slash; buffer_position.stop++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < content.used) { if (content.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; continue; @@ -807,7 +807,7 @@ extern "C" { buffer->string[buffer_position.stop] = f_fss_delimit_slash; buffer_position.stop++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -834,7 +834,7 @@ extern "C" { buffer->string[buffer_position.stop + 1] = content.string[range->start]; buffer_position.stop += 2; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } } @@ -850,7 +850,7 @@ extern "C" { buffer->string[buffer_position.stop + 1] = content.string[range->start]; buffer_position.stop += 2; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } @@ -884,7 +884,7 @@ extern "C" { buffer->string[buffer_position.stop] = content.string[range->start]; buffer_position.stop++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -896,12 +896,12 @@ extern "C" { buffer->string[buffer_position.stop] = f_fss_delimit_slash; buffer_position.stop++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < content.used) { if (content.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; continue; @@ -915,7 +915,7 @@ extern "C" { buffer_position.stop++; slash_count++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -969,7 +969,7 @@ extern "C" { buffer_position.stop++; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while diff --git a/level_1/fl_fss/c/fss_extended.h b/level_1/fl_fss/c/fss_extended.h index 4adbd8f..95b6125 100644 --- a/level_1/fl_fss/c/fss_extended.h +++ b/level_1/fl_fss/c/fss_extended.h @@ -64,7 +64,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). * Errors from (with error bit): f_fss_is_graph(). * Errors from (with error bit): f_fss_is_space(). * Errors from (with error bit): f_fss_skip_past_space(). @@ -106,7 +106,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). * Errors from (with error bit): f_fss_is_graph(). * Errors from (with error bit): f_fss_is_space(). * Errors from (with error bit): f_fss_skip_past_space(). @@ -141,7 +141,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). */ #ifndef _di_fl_fss_extended_object_write_ extern f_return_status fl_fss_extended_object_write(const f_string_static object, f_string_range *range, f_string_dynamic *buffer); @@ -172,7 +172,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). */ #ifndef _di_fl_fss_extended_content_write_ extern f_return_status fl_fss_extended_content_write(const f_string_static content, f_string_range *range, f_string_dynamic *buffer); diff --git a/level_1/fl_fss/c/fss_extended_list.c b/level_1/fl_fss/c/fss_extended_list.c index 4cc6bd3..40f25a4 100644 --- a/level_1/fl_fss/c/fss_extended_list.c +++ b/level_1/fl_fss/c/fss_extended_list.c @@ -38,7 +38,7 @@ extern "C" { // return found nothing if this line only contains whitespace and delimit placeholders. if (buffer->string[range->start] == f_string_eol[0]) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object_not; @@ -51,7 +51,7 @@ extern "C" { if (buffer->string[range->start] == f_fss_comment) { fl_macro_fss_object_seek_till_newline((*buffer), (*range), delimits, F_data_not_eos, F_data_not_stop) - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object_not; @@ -63,7 +63,7 @@ extern "C" { f_string_length first_slash = range->start; f_string_length slash_count = 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop && (buffer->string[range->start] == f_fss_delimit_placeholder || buffer->string[range->start] == f_fss_delimit_slash)) { @@ -71,7 +71,7 @@ extern "C" { slash_count++; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -80,7 +80,7 @@ extern "C" { if (buffer->string[range->start] == f_fss_extended_list_open) { f_string_length stop_point = range->start - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop) { @@ -90,7 +90,7 @@ extern "C" { if (F_status_is_error(status)) return status; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -121,7 +121,7 @@ extern "C" { slash_count--; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -143,7 +143,7 @@ extern "C" { else if (buffer->string[range->start] == f_fss_extended_list_open) { f_string_length stop_point = range->start - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop) { @@ -154,7 +154,7 @@ extern "C" { if (F_status_is_error(status)) return status; if (status == F_false) break; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -165,7 +165,7 @@ extern "C" { found->stop = stop_point; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object; @@ -174,19 +174,19 @@ extern "C" { continue; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while // seek to the end of the line when no valid object is found. while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while fl_macro_fss_object_return_on_overflow((*buffer), (*range), (*found), delimits, F_data_not_eos, F_data_not_stop); - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object_not; @@ -271,7 +271,7 @@ extern "C" { f_string_length slash_count = 1; position_previous = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); f_macro_string_lengths_delete_simple(positions_start); @@ -288,7 +288,7 @@ extern "C" { slash_count++; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); f_macro_string_lengths_delete_simple(positions_start); @@ -347,7 +347,7 @@ extern "C" { } position_previous = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); f_macro_string_lengths_delete_simple(positions_start); @@ -463,7 +463,7 @@ extern "C" { f_string_length before_list_open = position_previous; position_previous = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); f_macro_string_lengths_delete_simple(positions_start); @@ -491,7 +491,7 @@ extern "C" { } position_previous = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); f_macro_string_lengths_delete_simple(positions_start); @@ -555,7 +555,7 @@ extern "C" { } position_previous = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); f_macro_string_lengths_delete_simple(positions_start); @@ -576,7 +576,7 @@ extern "C" { else if (buffer->string[range->start] == f_fss_extended_list_close) { while (range->start < buffer->used && range->start <= range->stop) { position_previous = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); f_macro_string_lengths_delete_simple(positions_start); @@ -670,7 +670,7 @@ extern "C" { line_start = range->start + 1; if (depth == 0) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); f_macro_string_lengths_delete_simple(positions_start); @@ -701,7 +701,7 @@ extern "C" { } position_previous = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); f_macro_string_lengths_delete_simple(positions_start); @@ -721,7 +721,7 @@ extern "C" { } else if (buffer->string[range->start] != f_string_eol[0]) { position_previous = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); f_macro_string_lengths_delete_simple(positions_start); @@ -738,7 +738,7 @@ extern "C" { } position_previous = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); f_macro_string_lengths_delete_simple(positions_start); @@ -813,7 +813,7 @@ extern "C" { buffer_position.stop++; } - status = f_fss_increment_buffer(object, range, 1); + status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; } // while @@ -824,12 +824,12 @@ extern "C" { buffer->string[buffer_position.stop] = object.string[range->start]; buffer_position.stop++; - status = f_fss_increment_buffer(object, range, 1); + status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < object.used) { if (object.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(object, range, 1); + status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; continue; @@ -840,7 +840,7 @@ extern "C" { buffer->string[buffer_position.stop] = object.string[range->start]; buffer_position.stop++; - status = f_fss_increment_buffer(object, range, 1); + status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; slash_count++; @@ -874,7 +874,7 @@ extern "C" { buffer_position.stop++; } - status = f_fss_increment_buffer(object, range, 1); + status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; } // while @@ -931,12 +931,12 @@ extern "C" { buffer_position.stop++; has_graph = F_true; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < content.used) { if (content.string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; continue; @@ -948,7 +948,7 @@ extern "C" { buffer->string[buffer_position.stop] = content.string[range->start]; buffer_position.stop++; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; slash_count++; @@ -957,7 +957,7 @@ extern "C" { if (content.string[range->start] == f_fss_extended_list_open) { f_string_length start = range->start; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; while (range->start < content.used && range->start <= range->stop) { @@ -967,7 +967,7 @@ extern "C" { if (F_status_is_error(status)) return status; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; } // while @@ -1002,7 +1002,7 @@ extern "C" { has_graph = F_true; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; while (range->start < content.used && range->start <= range->stop) { @@ -1012,7 +1012,7 @@ extern "C" { if (F_status_is_error(status)) return status; - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; } // while @@ -1055,7 +1055,7 @@ extern "C" { buffer_position.stop++; } - status = f_fss_increment_buffer(content, range, 1); + status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; } // while diff --git a/level_1/fl_fss/c/fss_extended_list.h b/level_1/fl_fss/c/fss_extended_list.h index cd16321..51c3913 100644 --- a/level_1/fl_fss/c/fss_extended_list.h +++ b/level_1/fl_fss/c/fss_extended_list.h @@ -65,7 +65,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). * Errors from (with error bit): f_fss_is_graph(). * Errors from (with error bit): f_fss_is_space(). * Errors from (with error bit): f_fss_skip_past_space(). @@ -111,7 +111,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). * Errors from (with error bit): f_fss_is_graph(). * Errors from (with error bit): f_fss_is_space(). * Errors from (with error bit): f_fss_skip_past_space(). @@ -146,7 +146,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). */ #ifndef _di_fl_fss_extended_list_object_write_ extern f_return_status fl_fss_extended_list_object_write(const f_string_static object, f_string_range *range, f_string_dynamic *buffer); @@ -177,7 +177,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). */ #ifndef _di_fl_fss_extended_list_content_write_ extern f_return_status fl_fss_extended_list_content_write(const f_string_static content, f_string_range *range, f_string_dynamic *buffer); diff --git a/level_1/fl_fss/c/fss_macro.h b/level_1/fl_fss/c/fss_macro.h index ea9ccad..52024ba 100644 --- a/level_1/fl_fss/c/fss_macro.h +++ b/level_1/fl_fss/c/fss_macro.h @@ -20,7 +20,7 @@ extern "C" { { \ f_status macro_allocation_status = F_none; \ \ - f_string_length i = 0; \ + f_array_length i = 0; \ \ while (i < delimits.used) { \ buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ @@ -63,7 +63,7 @@ extern "C" { #define fl_macro_fss_object_delimited_return_on_overflow(buffer, location, found, delimits, eos_status, stop_status) \ if (location.start >= buffer.used) { \ f_status macro_allocation_status = F_none; \ - f_string_length i = 0; \ + f_array_length i = 0; \ \ while (i < delimits.used) { \ buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ @@ -76,7 +76,7 @@ extern "C" { } \ else if (location.start > location.stop) { \ f_status macro_allocation_status = F_none; \ - f_string_length i = 0; \ + f_array_length i = 0; \ \ while (i < delimits.used) { \ buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ @@ -111,7 +111,7 @@ extern "C" { #define fl_macro_fss_content_delimited_return_on_overflow(buffer, location, found, delimits, eos_status, stop_status) \ if (location.start >= buffer.used) { \ f_status macro_allocation_status = F_none; \ - f_string_length i = 0; \ + f_array_length i = 0; \ \ while (i < delimits.used) { \ buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ @@ -124,7 +124,7 @@ extern "C" { } \ else if (location.start > location.stop) { \ f_status macro_allocation_status = F_none; \ - f_string_length i = 0; \ + f_array_length i = 0; \ \ while (i < delimits.used) { \ buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ @@ -178,7 +178,7 @@ extern "C" { #define fl_macro_fss_nest_delimited_return_on_overflow(buffer, location, found, delimits, positions, objects, eos_status, stop_status) \ if (location.start >= buffer.used) { \ f_status macro_allocation_status = F_none; \ - f_string_length i = 0; \ + f_array_length i = 0; \ \ while (i < delimits.used) { \ buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ @@ -192,7 +192,7 @@ extern "C" { } \ else if (location.start > location.stop) { \ f_status macro_allocation_status = F_none; \ - f_string_length i = 0; \ + f_array_length i = 0; \ \ while (i < delimits.used) { \ buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ @@ -232,7 +232,7 @@ extern "C" { location.start++; \ if (location.start >= buffer.used) { \ f_status macro_allocation_status = F_none; \ - f_string_length i = 0; \ + f_array_length i = 0; \ \ while (i < delimits.used) { \ buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ @@ -244,7 +244,7 @@ extern "C" { } \ if (location.start > location.stop) { \ f_status macro_allocation_status = F_none; \ - f_string_length i = 0; \ + f_array_length i = 0; \ \ while (i < delimits.used) { \ buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ @@ -284,7 +284,7 @@ extern "C" { location.start++; \ if (location.start >= buffer.used) { \ f_status macro_allocation_status = F_none; \ - f_string_length i = 0; \ + f_array_length i = 0; \ \ while (i < delimits.used) { \ buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ @@ -297,7 +297,7 @@ extern "C" { } \ if (location.start > location.stop) { \ f_status macro_allocation_status = F_none; \ - f_string_length i = 0; \ + f_array_length i = 0; \ \ while (i < delimits.used) { \ buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index 9e7d856..70a4e09 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -164,7 +164,7 @@ extern "C" { if (buffer->string[range->start] == f_fss_comment) { fl_macro_fss_object_seek_till_newline((*buffer), (*range), delimits, F_data_not_eos, F_data_not_stop); - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object_not; @@ -179,7 +179,7 @@ extern "C" { found->start = range->start; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < buffer->used) { @@ -187,7 +187,7 @@ extern "C" { if (F_status_is_error(status)) return status; if (status == F_true) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; continue; @@ -200,7 +200,7 @@ extern "C" { if (status == F_true) { found->stop = range->start - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; if (buffer->string[range->start] == f_string_eol[0]) { @@ -216,7 +216,7 @@ extern "C" { break; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { return status; } @@ -236,7 +236,7 @@ extern "C" { delimits.array[delimits.used] = first_slash; delimits.used++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -246,7 +246,7 @@ extern "C" { else if (buffer->string[range->start] == f_fss_delimit_single_quote || buffer->string[range->start] == f_fss_delimit_double_quote) { quoted = buffer->string[range->start]; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; found->start = range->start; @@ -266,7 +266,7 @@ extern "C" { if (status == F_true) break; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -282,7 +282,7 @@ extern "C" { return FL_fss_found_object_content_not; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -298,7 +298,7 @@ extern "C" { f_string_length first_slash = range->start; f_string_length slash_count = 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -307,7 +307,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer->used) { if (buffer->string[range->start] == f_fss_delimit_placeholder) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -321,7 +321,7 @@ extern "C" { slash_count++; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -355,7 +355,7 @@ extern "C" { slash_count--; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -370,7 +370,7 @@ extern "C" { if ((status = f_fss_is_graph(*buffer, *range)) == F_true) { while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -381,7 +381,7 @@ extern "C" { f_macro_string_lengths_delete_simple(delimits); - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object_not; @@ -402,7 +402,7 @@ extern "C" { found->stop = length - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object; @@ -427,7 +427,7 @@ extern "C" { slash_count--; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -441,7 +441,7 @@ extern "C" { else if (buffer->string[range->start] == quoted) { found->stop = range->start - 1; - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -457,7 +457,7 @@ extern "C" { else if ((status = f_fss_is_space(*buffer, *range)) == F_true) { fl_macro_fss_apply_delimit_placeholders((*buffer), delimits); - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object; @@ -469,7 +469,7 @@ extern "C" { else if (buffer->string[range->start] != f_fss_delimit_placeholder) { while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -481,13 +481,13 @@ extern "C" { f_macro_string_lengths_delete_simple(delimits); - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object_not; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -500,7 +500,7 @@ extern "C" { return FL_fss_found_object_not; } - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -512,7 +512,7 @@ extern "C" { // seek to the end of the line when no valid object is found while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); return status; @@ -523,7 +523,7 @@ extern "C" { f_macro_string_lengths_delete_simple(delimits); - status = f_fss_increment_buffer(*buffer, range, 1); + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object_not; diff --git a/level_1/fl_fss/c/private-fss.h b/level_1/fl_fss/c/private-fss.h index b4e5977..45bd919 100644 --- a/level_1/fl_fss/c/private-fss.h +++ b/level_1/fl_fss/c/private-fss.h @@ -75,7 +75,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * - * Errors from (with error bit): f_fss_increment_buffer(). + * Errors from (with error bit): f_utf_buffer_increment(). * Errors from (with error bit): f_fss_is_graph(). * Errors from (with error bit): f_fss_is_space(). * Errors from (with error bit): f_fss_skip_past_space(). -- 1.8.3.1