~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/internal/t_ctype.h

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

Show diffs side-by-side

added added

removed removed

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