1/* Copyright (c) 2000, 2001, 2003 MySQL AB
2 Use is subject to license terms
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16
17/*
18 Copyright (C) 1998, 1999 by Pruet Boonma, all rights reserved.
19 Copyright (C) 1998 by Theppitak Karoonboonyanan, all rights reserved.
20 Permission to use, copy, modify, distribute and sell this software
21 and its documentation for any purpose is hereby granted without fee,
22 provided that the above copyright notice appear in all copies.
23 Smaphan Raruenrom and Pruet Boonma makes no representations about
24 the suitability of this software for any purpose. It is provided
25 "as is" without express or implied warranty.
26*/
27
28/*
29 LC_COLLATE category + Level information
30*/
31
32#ifndef _t_ctype_h
33#define _t_ctype_h
34
35typedef unsigned char tchar;
36
37#define TOT_LEVELS 5
38#define LAST_LEVEL 4 /* TOT_LEVELS - 1 */
39
40#define IGNORE 0
41
42
43/* level 1 symbols & order */
44enum l1_symbols {
45 L1_08 = TOT_LEVELS,
46 L1_18,
47 L1_28,
48 L1_38,
49 L1_48,
50 L1_58,
51 L1_68,
52 L1_78,
53 L1_88,
54 L1_98,
55 L1_A8,
56 L1_B8,
57 L1_C8,
58 L1_D8,
59 L1_E8,
60 L1_F8,
61 L1_G8,
62 L1_H8,
63 L1_I8,
64 L1_J8,
65 L1_K8,
66 L1_L8,
67 L1_M8,
68 L1_N8,
69 L1_O8,
70 L1_P8,
71 L1_Q8,
72 L1_R8,
73 L1_S8,
74 L1_T8,
75 L1_U8,
76 L1_V8,
77 L1_W8,
78 L1_X8,
79 L1_Y8,
80 L1_Z8,
81 L1_KO_KAI,
82 L1_KHO_KHAI,
83 L1_KHO_KHUAT,
84 L1_KHO_KHWAI,
85 L1_KHO_KHON,
86 L1_KHO_RAKHANG,
87 L1_NGO_NGU,
88 L1_CHO_CHAN,
89 L1_CHO_CHING,
90 L1_CHO_CHANG,
91 L1_SO_SO,
92 L1_CHO_CHOE,
93 L1_YO_YING,
94 L1_DO_CHADA,
95 L1_TO_PATAK,
96 L1_THO_THAN,
97 L1_THO_NANGMONTHO,
98 L1_THO_PHUTHAO,
99 L1_NO_NEN,
100 L1_DO_DEK,
101 L1_TO_TAO,
102 L1_THO_THUNG,
103 L1_THO_THAHAN,
104 L1_THO_THONG,
105 L1_NO_NU,
106 L1_BO_BAIMAI,
107 L1_PO_PLA,
108 L1_PHO_PHUNG,
109 L1_FO_FA,
110 L1_PHO_PHAN,
111 L1_FO_FAN,
112 L1_PHO_SAMPHAO,
113 L1_MO_MA,
114 L1_YO_YAK,
115 L1_RO_RUA,
116 L1_RU,
117 L1_LO_LING,
118 L1_LU,
119 L1_WO_WAEN,
120 L1_SO_SALA,
121 L1_SO_RUSI,
122 L1_SO_SUA,
123 L1_HO_HIP,
124 L1_LO_CHULA,
125 L1_O_ANG,
126 L1_HO_NOKHUK,
127 L1_NKHIT,
128 L1_SARA_A,
129 L1_MAI_HAN_AKAT,
130 L1_SARA_AA,
131 L1_SARA_AM,
132 L1_SARA_I,
133 L1_SARA_II,
134 L1_SARA_UE,
135 L1_SARA_UEE,
136 L1_SARA_U,
137 L1_SARA_UU,
138 L1_SARA_E,
139 L1_SARA_AE,
140 L1_SARA_O,
141 L1_SARA_AI_MAIMUAN,
142 L1_SARA_AI_MAIMALAI
143};
144
145/* level 2 symbols & order */
146enum l2_symbols {
147 L2_BLANK = TOT_LEVELS,
148 L2_THAII,
149 L2_YAMAK,
150 L2_PINTHU,
151 L2_GARAN,
152 L2_TYKHU,
153 L2_TONE1,
154 L2_TONE2,
155 L2_TONE3,
156 L2_TONE4
157};
158
159/* level 3 symbols & order */
160enum l3_symbols {
161 L3_BLANK = TOT_LEVELS,
162 L3_SPACE,
163 L3_NB_SACE,
164 L3_LOW_LINE,
165 L3_HYPHEN,
166 L3_COMMA,
167 L3_SEMICOLON,
168 L3_COLON,
169 L3_EXCLAMATION,
170 L3_QUESTION,
171 L3_SOLIDUS,
172 L3_FULL_STOP,
173 L3_PAIYAN_NOI,
174 L3_MAI_YAMOK,
175 L3_GRAVE,
176 L3_CIRCUMFLEX,
177 L3_TILDE,
178 L3_APOSTROPHE,
179 L3_QUOTATION,
180 L3_L_PARANTHESIS,
181 L3_L_BRACKET,
182 L3_L_BRACE,
183 L3_R_BRACE,
184 L3_R_BRACKET,
185 L3_R_PARENTHESIS,
186 L3_AT,
187 L3_BAHT,
188 L3_DOLLAR,
189 L3_FONGMAN,
190 L3_ANGKHANKHU,
191 L3_KHOMUT,
192 L3_ASTERISK,
193 L3_BK_SOLIDUS,
194 L3_AMPERSAND,
195 L3_NUMBER,
196 L3_PERCENT,
197 L3_PLUS,
198 L3_LESS_THAN,
199 L3_EQUAL,
200 L3_GREATER_THAN,
201 L3_V_LINE
202};
203
204/* level 4 symbols & order */
205enum l4_symbols {
206 L4_BLANK = TOT_LEVELS,
207 L4_MIN,
208 L4_CAP,
209 L4_EXT
210};
211
212enum level_symbols {
213 L_UPRUPR = TOT_LEVELS,
214 L_UPPER,
215 L_MIDDLE,
216 L_LOWER
217};
218
219#define _is(c) (t_ctype[(c)][LAST_LEVEL])
220#define _level 8
221#define _consnt 16
222#define _ldvowel 32
223#define _fllwvowel 64
224#define _uprvowel 128
225#define _lwrvowel 256
226#define _tone 512
227#define _diacrt1 1024
228#define _diacrt2 2048
229#define _combine 4096
230#define _stone 8192
231#define _tdig 16384
232#define _rearvowel (_fllwvowel | _uprvowel | _lwrvowel)
233#define _diacrt (_diacrt1 | _diacrt2)
234#define levelof(c) ( _is(c) & _level )
235#define isthai(c) ( (c) >= 128 )
236#define istalpha(c) ( _is(c) & (_consnt|_ldvowel|_rearvowel|\
237 _tone|_diacrt1|_diacrt2) )
238#define isconsnt(c) ( _is(c) & _consnt )
239#define isldvowel(c) ( _is(c) & _ldvowel )
240#define isfllwvowel(c) ( _is(c) & _fllwvowel )
241#define ismidvowel(c) ( _is(c) & (_ldvowel|_fllwvowel) )
242#define isuprvowel(c) ( _is(c) & _uprvowel )
243#define islwrvowel(c) ( _is(c) & _lwrvowel )
244#define isuprlwrvowel(c) ( _is(c) & (_lwrvowel | _uprvowel))
245#define isrearvowel(c) ( _is(c) & _rearvowel )
246#define isvowel(c) ( _is(c) & (_ldvowel|_rearvowel) )
247#define istone(c) ( _is(c) & _tone )
248#define isunldable(c) ( _is(c) & (_rearvowel|_tone|_diacrt1|_diacrt2) )
249#define iscombinable(c) ( _is(c) & _combine )
250#define istdigit(c) ( _is(c) & _tdig )
251#define isstone(c) ( _is(c) & _stone )
252#define isdiacrt1(c) ( _is(c) & _diacrt1)
253#define isdiacrt2(c) ( _is(c) & _diacrt2)
254#define isdiacrt(c) ( _is(c) & _diacrt)
255
256/* Function prototype called by sql/field.cc */
257void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length);
258
259#endif
260