From: Kevin Day Date: Wed, 28 Oct 2026 04:31:05 +0000 (-0500) Subject: Feature: Add f_utf_is_zero_width_simple(). X-Git-Url: https://www.git.kevux.org/?a=commitdiff_plain;h=8f54a1e01d5533e63a38f2849670b20118d18605;p=fll Feature: Add f_utf_is_zero_width_simple(). The `f_utf_is_zero_width_simple()` is a variation on `f_utf_is_zero_width_simple()` that doesn't perform checks for control characters, combining characters, and joiner characters. Man pages will need to be generated. Something similar probably should be done for the `is_control` functions. --- diff --git a/build/stand_alone/byte_dump.config.h b/build/stand_alone/byte_dump.config.h index f656e8b65..8d4aee9cf 100644 --- a/build/stand_alone/byte_dump.config.h +++ b/build/stand_alone/byte_dump.config.h @@ -1397,6 +1397,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ #define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/example.config.h b/build/stand_alone/example.config.h index cd01de073..0126b384c 100644 --- a/build/stand_alone/example.config.h +++ b/build/stand_alone/example.config.h @@ -1362,6 +1362,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ #define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fake.config.h b/build/stand_alone/fake.config.h index 421eeb021..4666a7364 100644 --- a/build/stand_alone/fake.config.h +++ b/build/stand_alone/fake.config.h @@ -1858,6 +1858,7 @@ #define _di_f_utf_is_word_dash_ //#define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_identify.config.h b/build/stand_alone/fss_identify.config.h index 844487967..94a77faea 100644 --- a/build/stand_alone/fss_identify.config.h +++ b/build/stand_alone/fss_identify.config.h @@ -1547,6 +1547,7 @@ //#define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ #define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_read.config.fss_basic.h b/build/stand_alone/fss_read.config.fss_basic.h index 91a2802fa..9da108d2f 100644 --- a/build/stand_alone/fss_read.config.fss_basic.h +++ b/build/stand_alone/fss_read.config.fss_basic.h @@ -1618,6 +1618,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_read.config.fss_basic_list.h b/build/stand_alone/fss_read.config.fss_basic_list.h index 2401f32a9..fe2a7037e 100644 --- a/build/stand_alone/fss_read.config.fss_basic_list.h +++ b/build/stand_alone/fss_read.config.fss_basic_list.h @@ -1618,6 +1618,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_read.config.fss_embedded_list.h b/build/stand_alone/fss_read.config.fss_embedded_list.h index 1df6857df..9f8aec1c2 100644 --- a/build/stand_alone/fss_read.config.fss_embedded_list.h +++ b/build/stand_alone/fss_read.config.fss_embedded_list.h @@ -1618,6 +1618,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_read.config.fss_extended.h b/build/stand_alone/fss_read.config.fss_extended.h index 991618971..d2abb44d6 100644 --- a/build/stand_alone/fss_read.config.fss_extended.h +++ b/build/stand_alone/fss_read.config.fss_extended.h @@ -1618,6 +1618,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_read.config.fss_extended_list.h b/build/stand_alone/fss_read.config.fss_extended_list.h index 08c2e6461..738603fa3 100644 --- a/build/stand_alone/fss_read.config.fss_extended_list.h +++ b/build/stand_alone/fss_read.config.fss_extended_list.h @@ -1618,6 +1618,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_read.config.fss_payload.h b/build/stand_alone/fss_read.config.fss_payload.h index 4e7502d21..76bd72b16 100644 --- a/build/stand_alone/fss_read.config.fss_payload.h +++ b/build/stand_alone/fss_read.config.fss_payload.h @@ -1618,6 +1618,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_read.config.h b/build/stand_alone/fss_read.config.h index bcab695b4..fa29bf719 100644 --- a/build/stand_alone/fss_read.config.h +++ b/build/stand_alone/fss_read.config.h @@ -1618,6 +1618,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_write.config.fss_basic.h b/build/stand_alone/fss_write.config.fss_basic.h index 79d1bbc8d..7bdca3cc1 100644 --- a/build/stand_alone/fss_write.config.fss_basic.h +++ b/build/stand_alone/fss_write.config.fss_basic.h @@ -1561,6 +1561,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_write.config.fss_basic_list.h b/build/stand_alone/fss_write.config.fss_basic_list.h index 91367fd64..d78512106 100644 --- a/build/stand_alone/fss_write.config.fss_basic_list.h +++ b/build/stand_alone/fss_write.config.fss_basic_list.h @@ -1561,6 +1561,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_write.config.fss_embedded_list.h b/build/stand_alone/fss_write.config.fss_embedded_list.h index c12428745..05f1c6b13 100644 --- a/build/stand_alone/fss_write.config.fss_embedded_list.h +++ b/build/stand_alone/fss_write.config.fss_embedded_list.h @@ -1561,6 +1561,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_write.config.fss_extended.h b/build/stand_alone/fss_write.config.fss_extended.h index 8e09ac1f8..6462e1ea1 100644 --- a/build/stand_alone/fss_write.config.fss_extended.h +++ b/build/stand_alone/fss_write.config.fss_extended.h @@ -1561,6 +1561,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_write.config.fss_extended_list.h b/build/stand_alone/fss_write.config.fss_extended_list.h index 05c5b9fd0..2971aa09b 100644 --- a/build/stand_alone/fss_write.config.fss_extended_list.h +++ b/build/stand_alone/fss_write.config.fss_extended_list.h @@ -1561,6 +1561,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_write.config.fss_payload.h b/build/stand_alone/fss_write.config.fss_payload.h index 8fd7bc4d8..b76494bf4 100644 --- a/build/stand_alone/fss_write.config.fss_payload.h +++ b/build/stand_alone/fss_write.config.fss_payload.h @@ -1561,6 +1561,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/fss_write.config.h b/build/stand_alone/fss_write.config.h index db8d0783a..0dc77b3c2 100644 --- a/build/stand_alone/fss_write.config.h +++ b/build/stand_alone/fss_write.config.h @@ -1561,6 +1561,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ //#define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/iki_read.config.eki.h b/build/stand_alone/iki_read.config.eki.h index 3e207ebb0..f0477c84c 100644 --- a/build/stand_alone/iki_read.config.eki.h +++ b/build/stand_alone/iki_read.config.eki.h @@ -1458,6 +1458,7 @@ #define _di_f_utf_is_word_dash_ //#define _di_f_utf_is_word_dash_plus_ #define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/iki_read.config.h b/build/stand_alone/iki_read.config.h index afc332121..fbf1ae662 100644 --- a/build/stand_alone/iki_read.config.h +++ b/build/stand_alone/iki_read.config.h @@ -1458,6 +1458,7 @@ #define _di_f_utf_is_word_dash_ //#define _di_f_utf_is_word_dash_plus_ #define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/iki_write.config.eki.h b/build/stand_alone/iki_write.config.eki.h index 3d03e3957..9e59305c3 100644 --- a/build/stand_alone/iki_write.config.eki.h +++ b/build/stand_alone/iki_write.config.eki.h @@ -1409,6 +1409,7 @@ #define _di_f_utf_is_word_dash_ //#define _di_f_utf_is_word_dash_plus_ #define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/iki_write.config.h b/build/stand_alone/iki_write.config.h index 3832f9a3b..236d7d818 100644 --- a/build/stand_alone/iki_write.config.h +++ b/build/stand_alone/iki_write.config.h @@ -1409,6 +1409,7 @@ #define _di_f_utf_is_word_dash_ //#define _di_f_utf_is_word_dash_plus_ #define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/status_code.config.fss.h b/build/stand_alone/status_code.config.fss.h index 383acdbd4..ecbdb2a8c 100644 --- a/build/stand_alone/status_code.config.fss.h +++ b/build/stand_alone/status_code.config.fss.h @@ -1531,6 +1531,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ #define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/status_code.config.h b/build/stand_alone/status_code.config.h index a08336293..846684224 100644 --- a/build/stand_alone/status_code.config.h +++ b/build/stand_alone/status_code.config.h @@ -1457,6 +1457,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ #define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/build/stand_alone/utf8.config.h b/build/stand_alone/utf8.config.h index ec0642738..1f2b1f331 100644 --- a/build/stand_alone/utf8.config.h +++ b/build/stand_alone/utf8.config.h @@ -1415,6 +1415,7 @@ #define _di_f_utf_is_word_dash_ #define _di_f_utf_is_word_dash_plus_ #define _di_f_utf_is_zero_width_ +#define _di_f_utf_is_zero_width_simple_ #define _di_f_utf_space_em_per_four_s_ #define _di_f_utf_space_em_per_six_s_ #define _di_f_utf_space_em_per_three_s_ diff --git a/level_0/f_utf/c/private-utf_zero_width.c b/level_0/f_utf/c/private-utf_zero_width.c index 52e438fb6..4ea4113c2 100644 --- a/level_0/f_utf/c/private-utf_zero_width.c +++ b/level_0/f_utf/c/private-utf_zero_width.c @@ -6,7 +6,7 @@ extern "C" { #endif -#if !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_character_is_alphabetic_numeric_) || !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_character_is_graph_) || !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) +#if !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_character_is_alphabetic_numeric_) || !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_character_is_graph_) || !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(_di_f_utf_is_zero_width_simple_) f_status_t private_f_utf_character_is_zero_width(const f_utf_char_t sequence) { if (macro_f_utf_char_t_width_is(sequence) == 3) { @@ -45,7 +45,7 @@ extern "C" { return F_false; } -#endif // !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_character_is_alphabetic_numeric_) || !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_character_is_graph_) || !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) +#endif // !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_character_is_alphabetic_numeric_) || !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_character_is_graph_) || !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(_di_f_utf_is_zero_width_simple_) #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_utf/c/private-utf_zero_width.h b/level_0/f_utf/c/private-utf_zero_width.h index 3a44013a6..dc800c64a 100644 --- a/level_0/f_utf/c/private-utf_zero_width.h +++ b/level_0/f_utf/c/private-utf_zero_width.h @@ -49,11 +49,12 @@ extern "C" { * @see f_utf_is_word() * @see f_utf_is_word_dash() * @see f_utf_is_word_dash_plus() - * @see f_utf_is_zero_width_ + * @see f_utf_is_zero_width() + * @see f_utf_is_zero_width_simple() */ -#if !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_character_is_alphabetic_numeric_) || !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_character_is_graph_) || !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) +#if !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_character_is_alphabetic_numeric_) || !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_character_is_graph_) || !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(_di_f_utf_is_zero_width_simple_) extern f_status_t private_f_utf_character_is_zero_width(const f_utf_char_t sequence) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_character_is_alphabetic_numeric_) || !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_character_is_graph_) || !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) +#endif // !defined(_di_f_utf_character_is_alphabetic_) || !defined(_di_f_utf_character_is_alphabetic_numeric_) || !defined(_di_f_utf_character_is_alphabetic_digit_) || !defined(_di_f_utf_character_is_graph_) || !defined(_di_f_utf_character_is_word_) || !defined(_di_f_utf_character_is_word_dash_) || !defined(_di_f_utf_character_is_word_dash_plus_) || !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_alphabetic_) || !defined(_di_f_utf_is_alphabetic_digit_) || !defined(_di_f_utf_is_alphabetic_numeric_) || !defined(_di_f_utf_is_graph_) || !defined(_di_f_utf_is_word_) || !defined(_di_f_utf_is_word_dash_) || !defined(_di_f_utf_is_word_dash_plus_) || !defined(_di_f_utf_is_zero_width_) || !defined(_di_f_utf_is_zero_width_simple_) #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_utf/c/utf/is.c b/level_0/f_utf/c/utf/is.c index 9e6305d6a..be9d43532 100644 --- a/level_0/f_utf/c/utf/is.c +++ b/level_0/f_utf/c/utf/is.c @@ -848,6 +848,34 @@ extern "C" { } #endif // _di_f_utf_is_zero_width_ +#ifndef _di_f_utf_is_zero_width_simple_ + f_status_t f_utf_is_zero_width_simple(const f_string_t sequence, const f_number_unsigned_t width_max) { + + if (width_max < 1) return F_data_not; + + if (macro_f_utf_byte_width_is(*sequence)) { + if (macro_f_utf_byte_width_is(*sequence) > width_max) return F_status_set_error(F_complete_not_utf); + if (macro_f_utf_byte_width_is(*sequence) == 1) return F_status_set_error(F_utf_fragment); + + f_utf_char_t utf = 0; + + { + const f_status_t status = private_f_utf_char_to_character(sequence, width_max, &utf); + if (F_status_is_error(status)) return status; + } + + return private_f_utf_character_is_zero_width(utf); + } + + // These control characters are considered zero-width spaces. + if (*sequence >= 0x00 && *sequence < 0x09) return F_true; + if (*sequence > 0x0b && *sequence < 0x20) return F_true; + if (*sequence == 0x7f) return F_true; + + return F_false; + } +#endif // _di_f_utf_is_zero_width_simple_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_utf/c/utf/is.h b/level_0/f_utf/c/utf/is.h index 9a5b08d21..50c0e7ea0 100644 --- a/level_0/f_utf/c/utf/is.h +++ b/level_0/f_utf/c/utf/is.h @@ -928,6 +928,38 @@ extern "C" { extern f_status_t f_utf_is_zero_width(const f_string_t sequence, const f_number_unsigned_t width_max); #endif // _di_f_utf_is_zero_width_ +/** + * Check to see if the entire byte block of the character is an ASCII or UTF-8 general non-printing character. + * + * Only characters that do not print, which are generally called zero-width. + * + * This is a simple version of f_utf_is_zero_width() that does not check for zero-width types in these categories: + * - control + * - combining + * - joiner + * + * @param sequence + * The byte sequence to validate as a character. + * There must be enough space allocated to compare against, as limited by width_max. + * @param width_max + * The maximum width available for checking. + * Can be anything greater than 0. + * + * @return + * F_true if a UTF-8 white space. + * F_false if not a UTF-8 white space. + * F_data_not if width_max is less than 1. + * + * F_complete_not_utf (with error bit set) if character is an incomplete UTF-8 sequence. + * F_maybe (with error bit) if this could be a white space but width is not long enough. + * F_parameter (with error bit) if a parameter is invalid. + * F_utf_fragment (with error bit) if character is a UTF-8 fragment. + * F_utf_not (with error bit) if Unicode is an invalid Unicode character. + */ +#ifndef _di_f_utf_is_zero_width_simple_ + extern f_status_t f_utf_is_zero_width_simple(const f_string_t sequence, const f_number_unsigned_t width_max); +#endif // _di_f_utf_is_zero_width_simple_ + #ifdef __cplusplus } // extern "C" #endif