00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CUTEXT_WCCAT_H
00019 #define CUTEXT_WCCAT_H
00020
00021 #include <cu/wchar.h>
00022
00023 CU_BEGIN_DECLARATIONS
00024
00025
00026
00027
00028
00029 typedef enum {
00030 CUTEXT_WCCAT_NONE,
00031 CUTEXT_WCCAT_LU = 8,
00032 CUTEXT_WCCAT_LL,
00033 CUTEXT_WCCAT_LT,
00034 CUTEXT_WCCAT_LM,
00035 CUTEXT_WCCAT_LO,
00036 CUTEXT_WCCAT_MN = 16,
00037 CUTEXT_WCCAT_MC,
00038 CUTEXT_WCCAT_ME,
00039 CUTEXT_WCCAT_ND = 24,
00040 CUTEXT_WCCAT_NL,
00041 CUTEXT_WCCAT_NO,
00042 CUTEXT_WCCAT_PC = 32,
00043 CUTEXT_WCCAT_PD,
00044 CUTEXT_WCCAT_PS,
00045 CUTEXT_WCCAT_PE,
00046 CUTEXT_WCCAT_PI,
00047 CUTEXT_WCCAT_PF,
00048 CUTEXT_WCCAT_PO,
00049 CUTEXT_WCCAT_SM = 40,
00050 CUTEXT_WCCAT_SC,
00051 CUTEXT_WCCAT_SK,
00052 CUTEXT_WCCAT_SO,
00053 CUTEXT_WCCAT_ZS = 48,
00054 CUTEXT_WCCAT_ZL,
00055 CUTEXT_WCCAT_ZP,
00056 CUTEXT_WCCAT_CC = 56,
00057 CUTEXT_WCCAT_CF,
00058 CUTEXT_WCCAT_CS,
00059 CUTEXT_WCCAT_CO,
00060 CUTEXT_WCCAT_CN,
00061 } cutext_wccat_t;
00062
00063
00064
00065 cutext_wccat_t cutext_wccat_by_name(char *name);
00066
00067
00068 cutext_wccat_t cutext_wchar_wccat(cu_wint_t ch);
00069
00070
00071 CU_SINLINE cu_bool_t
00072 cutext_wccat_is_letter(cutext_wccat_t ct) { return (ct >> 3) == 1; }
00073
00074
00075 CU_SINLINE cu_bool_t
00076 cutext_wccat_is_mark(cutext_wccat_t ct) { return (ct >> 3) == 2; }
00077
00078
00079 CU_SINLINE cu_bool_t
00080 cutext_wccat_is_number(cutext_wccat_t ct) { return (ct >> 3) == 3; }
00081
00082
00083 CU_SINLINE cu_bool_t
00084 cutext_wccat_is_punctuation(cutext_wccat_t ct) { return (ct >> 3) == 4; }
00085
00086
00087 CU_SINLINE cu_bool_t
00088 cutext_wccat_is_symbol(cutext_wccat_t ct) { return (ct >> 3) == 5; }
00089
00090
00091 CU_SINLINE cu_bool_t
00092 cutext_wccat_is_separator(cutext_wccat_t ct) { return (ct >> 3) == 6; }
00093
00094
00095 CU_SINLINE cu_bool_t
00096 cutext_wccat_is_other(cutext_wccat_t ct) { return (ct >> 3) == 7; }
00097
00098 CU_SINLINE cu_bool_t
00099 cutext_wchar_is_letter(cu_wchar_t ch)
00100 {
00101 return cutext_wccat_is_letter(cutext_wchar_wccat(ch));
00102 }
00103 CU_SINLINE cu_bool_t
00104 cutext_wchar_is_mark(cu_wchar_t ch)
00105 {
00106 return cutext_wccat_is_mark(cutext_wchar_wccat(ch));
00107 }
00108 CU_SINLINE cu_bool_t
00109 cutext_wchar_is_number(cu_wchar_t ch)
00110 {
00111 return cutext_wccat_is_number(cutext_wchar_wccat(ch));
00112 }
00113 CU_SINLINE cu_bool_t
00114 cutext_wchar_is_punctuation(cu_wchar_t ch)
00115 {
00116 return cutext_wccat_is_punctuation(cutext_wchar_wccat(ch));
00117 }
00118 CU_SINLINE cu_bool_t
00119 cutext_wchar_is_symbol(cu_wchar_t ch)
00120 {
00121 return cutext_wccat_is_symbol(cutext_wchar_wccat(ch));
00122 }
00123 CU_SINLINE cu_bool_t
00124 cutext_wchar_is_separator(cu_wchar_t ch)
00125 {
00126 return cutext_wccat_is_separator(cutext_wchar_wccat(ch));
00127 }
00128 CU_SINLINE cu_bool_t
00129 cutext_wchar_is_other(cu_wchar_t ch)
00130 {
00131 return cutext_wccat_is_other(cutext_wchar_wccat(ch));
00132 }
00133
00134 CU_SINLINE cu_bool_t
00135 cutext_wchar_is_vertical_space(cu_wchar_t ch)
00136 {
00137 return ch == '\n' || ch == '\v' || ch == '\f';
00138 }
00139 CU_SINLINE cu_bool_t
00140 cutext_wchar_is_space(cu_wchar_t ch)
00141 {
00142 return cutext_wchar_is_separator(ch) || cutext_wchar_is_vertical_space(ch)
00143 || ch == '\t';
00144 }
00145 CU_SINLINE cu_bool_t
00146 cutext_wchar_is_print(cu_wchar_t ch)
00147 {
00148 return !cutext_wchar_is_other(ch)
00149 && !cutext_wchar_is_vertical_space(ch);
00150 }
00151
00152
00153
00154 CU_END_DECLARATIONS
00155
00156 #endif