-static int utf32__is_control_or_cr_or_lf(uint32_t c) {
- switch(utf32__general_category(c)) {
- default:
- return 0;
- case unicode_gc_Zl:
- case unicode_gc_Zp:
- case unicode_gc_Cc:
- return 1;
- case unicode_gc_Cf:
- if(c == 0x200C || c == 0x200D)
- return 0;
- return 1;
- }
-}
-
-#define Hangul_Syllable_Type_NA 0
-#define Hangul_Syllable_Type_L 0x1100
-#define Hangul_Syllable_Type_V 0x1160
-#define Hangul_Syllable_Type_T 0x11A8
-#define Hangul_Syllable_Type_LV 0xAC00
-#define Hangul_Syllable_Type_LVT 0xAC01
-
-/** @brief Determine Hangul_Syllable_Type of @p c
- * @param c Code point
- * @return Equivalance class of @p c, or Hangul_Syllable_Type_NA
- *
- * If this is a Hangul character then a representative member of its
- * equivalence class is returned. Otherwise Hangul_Syllable_Type_NA is
- * returned.
- */
-static uint32_t utf32__hangul_syllable_type(uint32_t c) {
- /* Dispose of the bulk of the non-Hangul code points first */
- if(c < 0x1100) return Hangul_Syllable_Type_NA;
- if(c > 0x1200 && c < 0xAC00) return Hangul_Syllable_Type_NA;
- if(c >= 0xD800) return Hangul_Syllable_Type_NA;
- /* Now we pick out the assigned Hangul code points */
- if((c >= 0x1100 && c <= 0x1159) || c == 0x115F) return Hangul_Syllable_Type_L;
- if(c >= 0x1160 && c <= 0x11A2) return Hangul_Syllable_Type_V;
- if(c >= 0x11A8 && c <= 0x11F9) return Hangul_Syllable_Type_T;
- if(c >= 0xAC00 && c <= 0xD7A3) {
- if(c % 28 == 16)
- return Hangul_Syllable_Type_LV;
- else
- return Hangul_Syllable_Type_LVT;
- }
- return Hangul_Syllable_Type_NA;