Intial commit
[profile/ivi/w3m.git] / libwc / ccs.h
1
2 #ifndef _WC_CCS_H
3 #define _WC_CCS_H
4
5 #include "iso2022.h"
6 #include "priv.h"
7
8 #define WC_F_ISO_BASE   0x40
9 #define WC_F_PCS_BASE   0x01
10 #define WC_F_WCS_BASE   0x00
11
12 #define WC_F_CS94_END   WC_F_GB_1988
13 #define WC_F_CS96_END   WC_F_ISO_8859_16
14 #define WC_F_CS94W_END  WC_F_JIS_X_0213_2
15 #define WC_F_CS96W_END  0
16 #define WC_F_CS942_END  0
17 #define WC_F_PCS_END    WC_F_RAW
18 #define WC_F_PCSW_END   WC_F_HKSCS_2
19 #define WC_F_WCS16_END  WC_F_UCS2
20 #define WC_F_WCS16W_END WC_F_UCS2
21 #define WC_F_WCS32_END  WC_F_GB18030
22 #define WC_F_WCS32W_END WC_F_GB18030
23
24 #define WC_CCS_A_SET            0x0FFFF
25 #define WC_CCS_A_TYPE           0x0FF00
26 #define WC_CCS_A_INDEX          0x000FF
27 #define WC_CCS_A_MBYTE          0x08000
28 #define WC_CCS_A_WIDE           0x10000
29 #define WC_CCS_A_COMB           0x20000
30 #define WC_CCS_A_ISO_2022       0x00700
31
32 #define WC_CCS_A_CS94           0x00100
33 #define WC_CCS_A_CS96           0x00200
34 #define WC_CCS_A_CS942          0x00400
35 #define WC_CCS_A_PCS            0x00800
36 #define WC_CCS_A_WCS16          0x01000
37 #define WC_CCS_A_WCS32          0x02000
38 #define WC_CCS_A_UNKNOWN        0x04000
39 #define WC_CCS_A_CS94W          (WC_CCS_A_CS94|WC_CCS_A_MBYTE)
40 #define WC_CCS_A_CS96W          (WC_CCS_A_CS96|WC_CCS_A_MBYTE)
41 #define WC_CCS_A_PCSW           (WC_CCS_A_PCS|WC_CCS_A_MBYTE)
42 #define WC_CCS_A_WCS16W         (WC_CCS_A_WCS16|WC_CCS_A_WIDE)
43 #define WC_CCS_A_WCS32W         (WC_CCS_A_WCS32|WC_CCS_A_WIDE)
44 #define WC_CCS_A_UNKNOWN_W      (WC_CCS_A_UNKNOWN|WC_CCS_A_MBYTE)
45 #define WC_CCS_A_CS94_C         (WC_CCS_A_CS94|WC_CCS_A_COMB)
46 #define WC_CCS_A_CS96_C         (WC_CCS_A_CS96|WC_CCS_A_COMB)
47 #define WC_CCS_A_CS942_C        (WC_CCS_A_CS942|WC_CCS_A_COMB)
48 #define WC_CCS_A_PCS_C          (WC_CCS_A_PCS|WC_CCS_A_COMB)
49 #define WC_CCS_A_WCS16_C        (WC_CCS_A_WCS16|WC_CCS_A_COMB)
50 #define WC_CCS_A_WCS32_C        (WC_CCS_A_WCS32|WC_CCS_A_COMB)
51 #define WC_CCS_A_CS94W_C        (WC_CCS_A_CS94W|WC_CCS_A_COMB)
52 #define WC_CCS_A_CS96W_C        (WC_CCS_A_CS96W|WC_CCS_A_COMB)
53 #define WC_CCS_A_PCSW_C         (WC_CCS_A_PCSW|WC_CCS_A_COMB)
54 #define WC_CCS_A_WCS16W_C       (WC_CCS_A_WCS16W|WC_CCS_A_COMB)
55 #define WC_CCS_A_WCS32W_C       (WC_CCS_A_WCS32W|WC_CCS_A_COMB)
56
57 #define WC_CCS_SET_CS94(c)      ((c)|WC_CCS_A_CS94)
58 #define WC_CCS_SET_CS94W(c)     ((c)|WC_CCS_A_CS94W)
59 #define WC_CCS_SET_CS96(c)      ((c)|WC_CCS_A_CS96)
60 #define WC_CCS_SET_CS96W(c)     ((c)|WC_CCS_A_CS96W)
61 #define WC_CCS_SET_CS942(c)     ((c)|WC_CCS_A_CS942)
62 #define WC_CCS_SET_PCS(c)       ((c)|WC_CCS_A_PCS)
63 #define WC_CCS_SET_PCSW(c)      ((c)|WC_CCS_A_PCSW)
64 #define WC_CCS_SET_WCS16(c)     ((c)|WC_CCS_A_WCS16)
65 #define WC_CCS_SET_WCS16W(c)    ((c)|WC_CCS_A_WCS16W)
66 #define WC_CCS_SET_WCS32(c)     ((c)|WC_CCS_A_WCS32)
67 #define WC_CCS_SET_WCS32W(c)    ((c)|WC_CCS_A_WCS32W)
68
69 #define WC_CCS_IS_WIDE(c)       ((c)&(WC_CCS_A_MBYTE|WC_CCS_A_WIDE))
70 #define WC_CCS_IS_COMB(c)       ((c)&WC_CCS_A_COMB)
71 #define WC_CCS_IS_ISO_2022(c)   ((c)&WC_CCS_A_ISO_2022)
72 #define WC_CCS_IS_UNKNOWN(c)    ((c)&WC_CCS_A_UNKNOWN)
73
74 #define WC_CCS_SET(c)           ((c)&WC_CCS_A_SET)
75 #define WC_CCS_TYPE(c)          ((c)&WC_CCS_A_TYPE)
76 #define WC_CCS_INDEX(c)         ((c)&WC_CCS_A_INDEX)
77 #define WC_CCS_GET_F(c)         WC_CCS_INDEX(c)
78
79 #define WC_CCS_US_ASCII         WC_CCS_SET_CS94(WC_F_US_ASCII)
80 #define WC_CCS_JIS_X_0201       WC_CCS_SET_CS94(WC_F_JIS_X_0201)
81 #define WC_CCS_JIS_X_0201K      WC_CCS_SET_CS94(WC_F_JIS_X_0201K)
82 #define WC_CCS_GB_1988          WC_CCS_SET_CS94(WC_F_GB_1988)
83
84 #define WC_CCS_ISO_8859_1       WC_CCS_SET_CS96(WC_F_ISO_8859_1)
85 #define WC_CCS_ISO_8859_2       WC_CCS_SET_CS96(WC_F_ISO_8859_2)
86 #define WC_CCS_ISO_8859_3       WC_CCS_SET_CS96(WC_F_ISO_8859_3)
87 #define WC_CCS_ISO_8859_4       WC_CCS_SET_CS96(WC_F_ISO_8859_4)
88 #define WC_CCS_ISO_8859_5       WC_CCS_SET_CS96(WC_F_ISO_8859_5)
89 #define WC_CCS_ISO_8859_6       WC_CCS_SET_CS96(WC_F_ISO_8859_6)
90 #define WC_CCS_ISO_8859_7       WC_CCS_SET_CS96(WC_F_ISO_8859_7)
91 #define WC_CCS_ISO_8859_8       WC_CCS_SET_CS96(WC_F_ISO_8859_8)
92 #define WC_CCS_ISO_8859_9       WC_CCS_SET_CS96(WC_F_ISO_8859_9)
93 #define WC_CCS_ISO_8859_10      WC_CCS_SET_CS96(WC_F_ISO_8859_10)
94 #define WC_CCS_ISO_8859_11      WC_CCS_SET_CS96(WC_F_ISO_8859_11)
95 #define WC_CCS_TIS_620          WC_CCS_ISO_8859_11
96 #define WC_CCS_ISO_8859_13      WC_CCS_SET_CS96(WC_F_ISO_8859_13)
97 #define WC_CCS_ISO_8859_14      WC_CCS_SET_CS96(WC_F_ISO_8859_14)
98 #define WC_CCS_ISO_8859_15      WC_CCS_SET_CS96(WC_F_ISO_8859_15)
99 #define WC_CCS_ISO_8859_16      WC_CCS_SET_CS96(WC_F_ISO_8859_16)
100
101 #define WC_CCS_SPECIAL          WC_CCS_SET_PCS(WC_F_SPECIAL)
102 #define WC_CCS_CP437            WC_CCS_SET_PCS(WC_F_CP437)
103 #define WC_CCS_CP737            WC_CCS_SET_PCS(WC_F_CP737)
104 #define WC_CCS_CP775            WC_CCS_SET_PCS(WC_F_CP775)
105 #define WC_CCS_CP850            WC_CCS_SET_PCS(WC_F_CP850)
106 #define WC_CCS_CP852            WC_CCS_SET_PCS(WC_F_CP852)
107 #define WC_CCS_CP855            WC_CCS_SET_PCS(WC_F_CP855)
108 #define WC_CCS_CP856            WC_CCS_SET_PCS(WC_F_CP856)
109 #define WC_CCS_CP857            WC_CCS_SET_PCS(WC_F_CP857)
110 #define WC_CCS_CP860            WC_CCS_SET_PCS(WC_F_CP860)
111 #define WC_CCS_CP861            WC_CCS_SET_PCS(WC_F_CP861)
112 #define WC_CCS_CP862            WC_CCS_SET_PCS(WC_F_CP862)
113 #define WC_CCS_CP863            WC_CCS_SET_PCS(WC_F_CP863)
114 #define WC_CCS_CP864            WC_CCS_SET_PCS(WC_F_CP864)
115 #define WC_CCS_CP865            WC_CCS_SET_PCS(WC_F_CP865)
116 #define WC_CCS_CP866            WC_CCS_SET_PCS(WC_F_CP866)
117 #define WC_CCS_CP869            WC_CCS_SET_PCS(WC_F_CP869)
118 #define WC_CCS_CP874            WC_CCS_SET_PCS(WC_F_CP874)
119 #define WC_CCS_CP1006           WC_CCS_SET_PCS(WC_F_CP1006)
120 #define WC_CCS_CP1250           WC_CCS_SET_PCS(WC_F_CP1250)
121 #define WC_CCS_CP1251           WC_CCS_SET_PCS(WC_F_CP1251)
122 #define WC_CCS_CP1252           WC_CCS_SET_PCS(WC_F_CP1252)
123 #define WC_CCS_CP1253           WC_CCS_SET_PCS(WC_F_CP1253)
124 #define WC_CCS_CP1254           WC_CCS_SET_PCS(WC_F_CP1254)
125 #define WC_CCS_CP1255           WC_CCS_SET_PCS(WC_F_CP1255)
126 #define WC_CCS_CP1256           WC_CCS_SET_PCS(WC_F_CP1256)
127 #define WC_CCS_CP1257           WC_CCS_SET_PCS(WC_F_CP1257)
128 #define WC_CCS_CP1258_1         WC_CCS_SET_PCS(WC_F_CP1258_1)
129 #define WC_CCS_CP1258_2         WC_CCS_SET_PCS(WC_F_CP1258_2)
130 #define WC_CCS_TCVN_5712_1      WC_CCS_SET_PCS(WC_F_TCVN_5712_1)
131 #define WC_CCS_TCVN_5712_2      WC_CCS_SET_PCS(WC_F_TCVN_5712_2)
132 #define WC_CCS_TCVN_5712_3      WC_CCS_SET_PCS(WC_F_TCVN_5712_3)
133 #define WC_CCS_VISCII_11_1      WC_CCS_SET_PCS(WC_F_VISCII_11_1)
134 #define WC_CCS_VISCII_11_2      WC_CCS_SET_PCS(WC_F_VISCII_11_2)
135 #define WC_CCS_VPS_1            WC_CCS_SET_PCS(WC_F_VPS_1)
136 #define WC_CCS_VPS_2            WC_CCS_SET_PCS(WC_F_VPS_2)
137 #define WC_CCS_KOI8_R           WC_CCS_SET_PCS(WC_F_KOI8_R)
138 #define WC_CCS_KOI8_U           WC_CCS_SET_PCS(WC_F_KOI8_U)
139 #define WC_CCS_NEXTSTEP         WC_CCS_SET_PCS(WC_F_NEXTSTEP)
140 #define WC_CCS_GBK_80           WC_CCS_SET_PCS(WC_F_GBK_80)
141 #define WC_CCS_RAW              WC_CCS_SET_PCS(WC_F_RAW)
142
143 #define WC_CCS_JIS_C_6226       WC_CCS_SET_CS94W(WC_F_JIS_C_6226)
144 #define WC_CCS_JIS_X_0208       WC_CCS_SET_CS94W(WC_F_JIS_X_0208)
145 #define WC_CCS_JIS_X_0212       WC_CCS_SET_CS94W(WC_F_JIS_X_0212)
146 #define WC_CCS_GB_2312          WC_CCS_SET_CS94W(WC_F_GB_2312)
147 #define WC_CCS_ISO_IR_165       WC_CCS_SET_CS94W(WC_F_ISO_IR_165)
148 #define WC_CCS_CNS_11643_1      WC_CCS_SET_CS94W(WC_F_CNS_11643_1)
149 #define WC_CCS_CNS_11643_2      WC_CCS_SET_CS94W(WC_F_CNS_11643_2)
150 #define WC_CCS_CNS_11643_3      WC_CCS_SET_CS94W(WC_F_CNS_11643_3)
151 #define WC_CCS_CNS_11643_4      WC_CCS_SET_CS94W(WC_F_CNS_11643_4)
152 #define WC_CCS_CNS_11643_5      WC_CCS_SET_CS94W(WC_F_CNS_11643_5)
153 #define WC_CCS_CNS_11643_6      WC_CCS_SET_CS94W(WC_F_CNS_11643_6)
154 #define WC_CCS_CNS_11643_7      WC_CCS_SET_CS94W(WC_F_CNS_11643_7)
155 #define WC_CCS_KS_X_1001        WC_CCS_SET_CS94W(WC_F_KS_X_1001)
156 #define WC_CCS_KPS_9566         WC_CCS_SET_CS94W(WC_F_KPS_9566)
157 #define WC_CCS_JIS_X_0213_1     WC_CCS_SET_CS94W(WC_F_JIS_X_0213_1)
158 #define WC_CCS_JIS_X_0213_2     WC_CCS_SET_CS94W(WC_F_JIS_X_0213_2)
159
160 #define WC_CCS_SPECIAL_W        WC_CCS_SET_PCSW(WC_F_SPECIAL_W)
161 #define WC_CCS_BIG5             WC_CCS_SET_PCSW(WC_F_BIG5)
162 #define WC_CCS_BIG5_1           WC_CCS_SET_PCSW(WC_F_BIG5_1)
163 #define WC_CCS_BIG5_2           WC_CCS_SET_PCSW(WC_F_BIG5_2)
164 #define WC_CCS_CNS_11643_8      WC_CCS_SET_PCSW(WC_F_CNS_11643_8)
165 #define WC_CCS_CNS_11643_9      WC_CCS_SET_PCSW(WC_F_CNS_11643_9)
166 #define WC_CCS_CNS_11643_10     WC_CCS_SET_PCSW(WC_F_CNS_11643_10)
167 #define WC_CCS_CNS_11643_11     WC_CCS_SET_PCSW(WC_F_CNS_11643_11)
168 #define WC_CCS_CNS_11643_12     WC_CCS_SET_PCSW(WC_F_CNS_11643_12)
169 #define WC_CCS_CNS_11643_13     WC_CCS_SET_PCSW(WC_F_CNS_11643_13)
170 #define WC_CCS_CNS_11643_14     WC_CCS_SET_PCSW(WC_F_CNS_11643_14)
171 #define WC_CCS_CNS_11643_15     WC_CCS_SET_PCSW(WC_F_CNS_11643_15)
172 #define WC_CCS_CNS_11643_16     WC_CCS_SET_PCSW(WC_F_CNS_11643_16)
173 #define WC_CCS_CNS_11643_X      WC_CCS_SET_PCSW(WC_F_CNS_11643_X)
174 #define WC_CCS_GB_12345         WC_CCS_SET_PCSW(WC_F_GB_12345)
175 #define WC_CCS_JOHAB            WC_CCS_SET_PCSW(WC_F_JOHAB)
176 #define WC_CCS_JOHAB_1          WC_CCS_SET_PCSW(WC_F_JOHAB_1)
177 #define WC_CCS_JOHAB_2          WC_CCS_SET_PCSW(WC_F_JOHAB_2)
178 #define WC_CCS_JOHAB_3          WC_CCS_SET_PCSW(WC_F_JOHAB_3)
179 #define WC_CCS_SJIS_EXT         WC_CCS_SET_PCSW(WC_F_SJIS_EXT)
180 #define WC_CCS_SJIS_EXT_1       WC_CCS_SET_PCSW(WC_F_SJIS_EXT_1)
181 #define WC_CCS_SJIS_EXT_2       WC_CCS_SET_PCSW(WC_F_SJIS_EXT_2)
182 #define WC_CCS_GBK              WC_CCS_SET_PCSW(WC_F_GBK)
183 #define WC_CCS_GBK_1            WC_CCS_SET_PCSW(WC_F_GBK_1)
184 #define WC_CCS_GBK_2            WC_CCS_SET_PCSW(WC_F_GBK_2)
185 #define WC_CCS_GBK_EXT          WC_CCS_SET_PCSW(WC_F_GBK_EXT)
186 #define WC_CCS_GBK_EXT_1        WC_CCS_SET_PCSW(WC_F_GBK_EXT_1)
187 #define WC_CCS_GBK_EXT_2        WC_CCS_SET_PCSW(WC_F_GBK_EXT_2)
188 #define WC_CCS_UHC              WC_CCS_SET_PCSW(WC_F_UHC)
189 #define WC_CCS_UHC_1            WC_CCS_SET_PCSW(WC_F_UHC_1)
190 #define WC_CCS_UHC_2            WC_CCS_SET_PCSW(WC_F_UHC_2)
191 #define WC_CCS_HKSCS            WC_CCS_SET_PCSW(WC_F_HKSCS)
192 #define WC_CCS_HKSCS_1          WC_CCS_SET_PCSW(WC_F_HKSCS_1)
193 #define WC_CCS_HKSCS_2          WC_CCS_SET_PCSW(WC_F_HKSCS_2)
194
195 #define WC_CCS_UCS2             WC_CCS_SET_WCS16(WC_F_UCS2)
196 #define WC_CCS_UCS4             WC_CCS_SET_WCS32(WC_F_UCS4)
197 #define WC_CCS_UCS_TAG          WC_CCS_SET_WCS32(WC_F_UCS_TAG)
198 #define WC_CCS_GB18030          WC_CCS_SET_WCS32(WC_F_GB18030)
199 #define WC_CCS_UCS2_W           WC_CCS_SET_WCS16W(WC_F_UCS2)
200 #define WC_CCS_UCS4_W           WC_CCS_SET_WCS32W(WC_F_UCS4)
201 #define WC_CCS_UCS_TAG_W        WC_CCS_SET_WCS32W(WC_F_UCS_TAG)
202 #define WC_CCS_GB18030_W        WC_CCS_SET_WCS32W(WC_F_GB18030)
203
204 #define WC_CCS_UNKNOWN          WC_CCS_A_UNKNOWN
205 #define WC_CCS_C1               (WC_CCS_A_UNKNOWN|WC_F_C1)
206 #define WC_CCS_UNKNOWN_W        WC_CCS_A_UNKNOWN_W
207
208 #define WC_CCS_IS_UNICODE(c)    (WC_CCS_SET(c) == WC_CCS_UCS2 || WC_CCS_SET(c) == WC_CCS_UCS4 || WC_CCS_SET(c) == WC_CCS_UCS_TAG)
209
210 extern wc_bool wc_is_combining(wc_wchar_t cc);
211
212 #endif