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.
#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_
#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_
#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_
//#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
#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_
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) {
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"
* @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"
}
#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
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