]> Kevux Git Server - fll/commitdiff
Feature: Add f_utf_is_zero_width_simple().
authorKevin Day <Kevin@kevux.org>
Wed, 28 Oct 2026 04:31:05 +0000 (23:31 -0500)
committerKevin Day <Kevin@kevux.org>
Wed, 28 Oct 2026 04:31:05 +0000 (23:31 -0500)
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.

29 files changed:
build/stand_alone/byte_dump.config.h
build/stand_alone/example.config.h
build/stand_alone/fake.config.h
build/stand_alone/fss_identify.config.h
build/stand_alone/fss_read.config.fss_basic.h
build/stand_alone/fss_read.config.fss_basic_list.h
build/stand_alone/fss_read.config.fss_embedded_list.h
build/stand_alone/fss_read.config.fss_extended.h
build/stand_alone/fss_read.config.fss_extended_list.h
build/stand_alone/fss_read.config.fss_payload.h
build/stand_alone/fss_read.config.h
build/stand_alone/fss_write.config.fss_basic.h
build/stand_alone/fss_write.config.fss_basic_list.h
build/stand_alone/fss_write.config.fss_embedded_list.h
build/stand_alone/fss_write.config.fss_extended.h
build/stand_alone/fss_write.config.fss_extended_list.h
build/stand_alone/fss_write.config.fss_payload.h
build/stand_alone/fss_write.config.h
build/stand_alone/iki_read.config.eki.h
build/stand_alone/iki_read.config.h
build/stand_alone/iki_write.config.eki.h
build/stand_alone/iki_write.config.h
build/stand_alone/status_code.config.fss.h
build/stand_alone/status_code.config.h
build/stand_alone/utf8.config.h
level_0/f_utf/c/private-utf_zero_width.c
level_0/f_utf/c/private-utf_zero_width.h
level_0/f_utf/c/utf/is.c
level_0/f_utf/c/utf/is.h

index f656e8b..8d4aee9 100644 (file)
 #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_
index cd01de0..0126b38 100644 (file)
 #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_
index 421eeb0..4666a73 100644 (file)
 #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_
index 8444879..94a77fa 100644 (file)
 //#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_
index 91a2802..9da108d 100644 (file)
 #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_
index 2401f32..fe2a703 100644 (file)
 #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_
index 1df6857..9f8aec1 100644 (file)
 #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_
index 9916189..d2abb44 100644 (file)
 #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_
index 08c2e64..738603f 100644 (file)
 #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_
index 4e7502d..76bd72b 100644 (file)
 #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_
index bcab695..fa29bf7 100644 (file)
 #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_
index 79d1bbc..7bdca3c 100644 (file)
 #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_
index 91367fd..d785121 100644 (file)
 #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_
index c124287..05f1c6b 100644 (file)
 #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_
index 8e09ac1..6462e1e 100644 (file)
 #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_
index 05c5b9f..2971aa0 100644 (file)
 #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_
index 8fd7bc4..b76494b 100644 (file)
 #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_
index db8d078..0dc77b3 100644 (file)
 #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_
index 3e207eb..f0477c8 100644 (file)
 #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_
index afc3321..fbf1ae6 100644 (file)
 #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_
index 3d03e39..9e59305 100644 (file)
 #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_
index 3832f9a..236d7d8 100644 (file)
 #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_
index 383acdb..ecbdb2a 100644 (file)
 #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_
index a083362..8466842 100644 (file)
 #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_
index ec06427..1f2b1f3 100644 (file)
 #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_
index 52e438f..4ea4113 100644 (file)
@@ -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"
index 3a44013..dc800c6 100644 (file)
@@ -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"
index 9e6305d..be9d435 100644 (file)
@@ -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
index 9a5b08d..50c0e7e 100644 (file)
@@ -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