Drizzled Public API Documentation

t_ctype.h
00001 /* Copyright (C) 2000 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00015 
00016 /*
00017   Copyright (C) 1998, 1999 by Pruet Boonma, all rights reserved.
00018   Copyright (C) 1998 by Theppitak Karoonboonyanan, all rights reserved.
00019   Permission to use, copy, modify, distribute and sell this software
00020    and its documentation for any purpose is hereby granted without fee,
00021    provided that the above copyright notice appear in all copies.
00022    Smaphan Raruenrom and Pruet Boonma makes no representations about
00023    the suitability of this software for any purpose.  It is provided
00024     "as is" without express or implied warranty.
00025 */
00026 
00027 /*
00028   LC_COLLATE category + Level information
00029 */
00030 
00031 #pragma once
00032 
00033 namespace drizzled
00034 {
00035 namespace internal
00036 {
00037 
00038 typedef unsigned char tchar;
00039 
00040 #define TOT_LEVELS 5
00041 #define LAST_LEVEL 4  /* TOT_LEVELS - 1 */
00042 
00043 #define IGNORE 0
00044 
00045 
00046 /* level 1 symbols & order */
00047 enum l1_symbols {
00048     L1_08 = TOT_LEVELS,
00049     L1_18,
00050     L1_28,
00051     L1_38,
00052     L1_48,
00053     L1_58,
00054     L1_68,
00055     L1_78,
00056     L1_88,
00057     L1_98,
00058     L1_A8,
00059     L1_B8,
00060     L1_C8,
00061     L1_D8,
00062     L1_E8,
00063     L1_F8,
00064     L1_G8,
00065     L1_H8,
00066     L1_I8,
00067     L1_J8,
00068     L1_K8,
00069     L1_L8,
00070     L1_M8,
00071     L1_N8,
00072     L1_O8,
00073     L1_P8,
00074     L1_Q8,
00075     L1_R8,
00076     L1_S8,
00077     L1_T8,
00078     L1_U8,
00079     L1_V8,
00080     L1_W8,
00081     L1_X8,
00082     L1_Y8,
00083     L1_Z8,
00084     L1_KO_KAI,
00085     L1_KHO_KHAI,
00086     L1_KHO_KHUAT,
00087     L1_KHO_KHWAI,
00088     L1_KHO_KHON,
00089     L1_KHO_RAKHANG,
00090     L1_NGO_NGU,
00091     L1_CHO_CHAN,
00092     L1_CHO_CHING,
00093     L1_CHO_CHANG,
00094     L1_SO_SO,
00095     L1_CHO_CHOE,
00096     L1_YO_YING,
00097     L1_DO_CHADA,
00098     L1_TO_PATAK,
00099     L1_THO_THAN,
00100     L1_THO_NANGMONTHO,
00101     L1_THO_PHUTHAO,
00102     L1_NO_NEN,
00103     L1_DO_DEK,
00104     L1_TO_TAO,
00105     L1_THO_THUNG,
00106     L1_THO_THAHAN,
00107     L1_THO_THONG,
00108     L1_NO_NU,
00109     L1_BO_BAIMAI,
00110     L1_PO_PLA,
00111     L1_PHO_PHUNG,
00112     L1_FO_FA,
00113     L1_PHO_PHAN,
00114     L1_FO_FAN,
00115     L1_PHO_SAMPHAO,
00116     L1_MO_MA,
00117     L1_YO_YAK,
00118     L1_RO_RUA,
00119     L1_RU,
00120     L1_LO_LING,
00121     L1_LU,
00122     L1_WO_WAEN,
00123     L1_SO_SALA,
00124     L1_SO_RUSI,
00125     L1_SO_SUA,
00126     L1_HO_HIP,
00127     L1_LO_CHULA,
00128     L1_O_ANG,
00129     L1_HO_NOKHUK,
00130     L1_NKHIT,
00131     L1_SARA_A,
00132     L1_MAI_HAN_AKAT,
00133     L1_SARA_AA,
00134     L1_SARA_AM,
00135     L1_SARA_I,
00136     L1_SARA_II,
00137     L1_SARA_UE,
00138     L1_SARA_UEE,
00139     L1_SARA_U,
00140     L1_SARA_UU,
00141     L1_SARA_E,
00142     L1_SARA_AE,
00143     L1_SARA_O,
00144     L1_SARA_AI_MAIMUAN,
00145     L1_SARA_AI_MAIMALAI
00146 };
00147 
00148 /* level 2 symbols & order */
00149 enum l2_symbols {
00150     L2_BLANK = TOT_LEVELS,
00151     L2_THAII,
00152     L2_YAMAK,
00153     L2_PINTHU,
00154     L2_GARAN,
00155     L2_TYKHU,
00156     L2_TONE1,
00157     L2_TONE2,
00158     L2_TONE3,
00159     L2_TONE4
00160 };
00161 
00162 /* level 3 symbols & order */
00163 enum l3_symbols {
00164   L3_BLANK = TOT_LEVELS,
00165     L3_SPACE,
00166     L3_NB_SACE,
00167     L3_LOW_LINE,
00168     L3_HYPHEN,
00169     L3_COMMA,
00170     L3_SEMICOLON,
00171     L3_COLON,
00172     L3_EXCLAMATION,
00173     L3_QUESTION,
00174     L3_SOLIDUS,
00175     L3_FULL_STOP,
00176     L3_PAIYAN_NOI,
00177     L3_MAI_YAMOK,
00178     L3_GRAVE,
00179     L3_CIRCUMFLEX,
00180     L3_TILDE,
00181     L3_APOSTROPHE,
00182     L3_QUOTATION,
00183     L3_L_PARANTHESIS,
00184     L3_L_BRACKET,
00185     L3_L_BRACE,
00186     L3_R_BRACE,
00187     L3_R_BRACKET,
00188     L3_R_PARENTHESIS,
00189     L3_AT,
00190     L3_BAHT,
00191     L3_DOLLAR,
00192     L3_FONGMAN,
00193     L3_ANGKHANKHU,
00194     L3_KHOMUT,
00195     L3_ASTERISK,
00196     L3_BK_SOLIDUS,
00197     L3_AMPERSAND,
00198     L3_NUMBER,
00199     L3_PERCENT,
00200     L3_PLUS,
00201     L3_LESS_THAN,
00202     L3_EQUAL,
00203     L3_GREATER_THAN,
00204     L3_V_LINE
00205 };
00206 
00207 /* level 4 symbols & order */
00208 enum l4_symbols {
00209     L4_BLANK = TOT_LEVELS,
00210     L4_MIN,
00211     L4_CAP,
00212     L4_EXT
00213 };
00214 
00215 enum level_symbols {
00216     L_UPRUPR = TOT_LEVELS,
00217     L_UPPER,
00218     L_MIDDLE,
00219     L_LOWER
00220 };
00221 
00222 #define _is(c)      (t_ctype[(c)][LAST_LEVEL])
00223 #define _level      8
00224 #define _consnt     16
00225 #define _ldvowel    32
00226 #define _fllwvowel    64
00227 #define _uprvowel   128
00228 #define _lwrvowel   256
00229 #define _tone     512
00230 #define _diacrt1    1024
00231 #define _diacrt2    2048
00232 #define _combine    4096
00233 #define _stone      8192
00234 #define _tdig     16384
00235 #define _rearvowel    (_fllwvowel | _uprvowel | _lwrvowel)
00236 #define _diacrt     (_diacrt1 | _diacrt2)
00237 #define istalpha(c)   ( _is(c) & (_consnt|_ldvowel|_rearvowel|\
00238                          _tone|_diacrt1|_diacrt2) )
00239 #define isconsnt(c)   ( _is(c) & _consnt )
00240 #define isldvowel(c)  ( _is(c) & _ldvowel )
00241 #define isfllwvowel(c)  ( _is(c) & _fllwvowel )
00242 #define ismidvowel(c) ( _is(c) & (_ldvowel|_fllwvowel) )
00243 #define isuprvowel(c) ( _is(c) & _uprvowel )
00244 #define islwrvowel(c) ( _is(c) & _lwrvowel )
00245 #define isuprlwrvowel(c) ( _is(c) & (_lwrvowel | _uprvowel))
00246 #define isrearvowel(c)  ( _is(c) & _rearvowel )
00247 #define isvowel(c)      ( _is(c) & (_ldvowel|_rearvowel) )
00248 #define istone(c)       ( _is(c) & _tone )
00249 #define isunldable(c)   ( _is(c) & (_rearvowel|_tone|_diacrt1|_diacrt2) )
00250 #define iscombinable(c) ( _is(c) & _combine )
00251 #define istdigit(c)     ( _is(c) & _tdig )
00252 #define isstone(c)      ( _is(c) & _stone )
00253 #define isdiacrt1(c)  ( _is(c) & _diacrt1)
00254 #define isdiacrt2(c)  ( _is(c) & _diacrt2)
00255 #define isdiacrt(c)   ( _is(c) & _diacrt)
00256 
00257 /* Function prototype called by sql/field.cc */
00258 void ThNormalize(unsigned char* ptr, uint32_t field_length, const unsigned char* from, uint32_t length);
00259 
00260 } /* namespace internal */
00261 } /* namespace drizzled */
00262