The world's most popular open source database
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; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00016 00017 /* 00018 A better inplementation of the UNIX ctype(3) library. 00019 Notes: my_global.h should be included before ctype.h 00020 */ 00021 00022 #ifndef _m_ctype_h 00023 #define _m_ctype_h 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 #define MY_CS_NAME_SIZE 32 00030 #define MY_CS_CTYPE_TABLE_SIZE 257 00031 #define MY_CS_TO_LOWER_TABLE_SIZE 256 00032 #define MY_CS_TO_UPPER_TABLE_SIZE 256 00033 #define MY_CS_SORT_ORDER_TABLE_SIZE 256 00034 #define MY_CS_TO_UNI_TABLE_SIZE 256 00035 00036 #define CHARSET_DIR "charsets/" 00037 00038 #define my_wc_t ulong 00039 00040 typedef struct unicase_info_st 00041 { 00042 uint16 toupper; 00043 uint16 tolower; 00044 uint16 sort; 00045 } MY_UNICASE_INFO; 00046 00047 00048 extern MY_UNICASE_INFO *my_unicase_default[256]; 00049 extern MY_UNICASE_INFO *my_unicase_turkish[256]; 00050 00051 typedef struct uni_ctype_st 00052 { 00053 unsigned char pctype; 00054 unsigned char *ctype; 00055 } MY_UNI_CTYPE; 00056 00057 extern MY_UNI_CTYPE my_uni_ctype[256]; 00058 00059 /* wm_wc and wc_mb return codes */ 00060 #define MY_CS_ILSEQ 0 /* Wrong by sequence: wb_wc */ 00061 #define MY_CS_ILUNI 0 /* Cannot encode Unicode to charset: wc_mb */ 00062 #define MY_CS_TOOSMALL -101 /* Need at least one byte: wc_mb and mb_wc */ 00063 #define MY_CS_TOOSMALL2 -102 /* Need at least two bytes: wc_mb and mb_wc */ 00064 #define MY_CS_TOOSMALL3 -103 /* Need at least three bytes: wc_mb and mb_wc */ 00065 /* These following three are currently not really used */ 00066 #define MY_CS_TOOSMALL4 -104 /* Need at least 4 bytes: wc_mb and mb_wc */ 00067 #define MY_CS_TOOSMALL5 -105 /* Need at least 5 bytes: wc_mb and mb_wc */ 00068 #define MY_CS_TOOSMALL6 -106 /* Need at least 6 bytes: wc_mb and mb_wc */ 00069 /* A helper macros for "need at least n bytes" */ 00070 #define MY_CS_TOOSMALLN(n) (-100-(n)) 00071 00072 #define MY_SEQ_INTTAIL 1 00073 #define MY_SEQ_SPACES 2 00074 00075 /* My charsets_list flags */ 00076 #define MY_CS_COMPILED 1 /* compiled-in sets */ 00077 #define MY_CS_CONFIG 2 /* sets that have a *.conf file */ 00078 #define MY_CS_INDEX 4 /* sets listed in the Index file */ 00079 #define MY_CS_LOADED 8 /* sets that are currently loaded */ 00080 #define MY_CS_BINSORT 16 /* if binary sort order */ 00081 #define MY_CS_PRIMARY 32 /* if primary collation */ 00082 #define MY_CS_STRNXFRM 64 /* if strnxfrm is used for sort */ 00083 #define MY_CS_UNICODE 128 /* is a charset is full unicode */ 00084 #define MY_CS_READY 256 /* if a charset is initialized */ 00085 #define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/ 00086 #define MY_CS_CSSORT 1024 /* if case sensitive sort order */ 00087 #define MY_CS_HIDDEN 2048 /* don't display in SHOW */ 00088 #define MY_CHARSET_UNDEFINED 0 00089 00090 00091 typedef struct my_uni_idx_st 00092 { 00093 uint16 from; 00094 uint16 to; 00095 uchar *tab; 00096 } MY_UNI_IDX; 00097 00098 typedef struct 00099 { 00100 uint beg; 00101 uint end; 00102 uint mblen; 00103 } my_match_t; 00104 00105 enum my_lex_states 00106 { 00107 MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT, 00108 MY_LEX_IDENT_SEP, MY_LEX_IDENT_START, 00109 MY_LEX_REAL, MY_LEX_HEX_NUMBER, MY_LEX_BIN_NUMBER, 00110 MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END, 00111 MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL, 00112 MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE, 00113 MY_LEX_LONG_COMMENT, MY_LEX_END_LONG_COMMENT, MY_LEX_SEMICOLON, 00114 MY_LEX_SET_VAR, MY_LEX_USER_END, MY_LEX_HOSTNAME, MY_LEX_SKIP, 00115 MY_LEX_USER_VARIABLE_DELIMITER, MY_LEX_SYSTEM_VAR, 00116 MY_LEX_IDENT_OR_KEYWORD, 00117 MY_LEX_IDENT_OR_HEX, MY_LEX_IDENT_OR_BIN, MY_LEX_IDENT_OR_NCHAR, 00118 MY_LEX_STRING_OR_DELIMITER 00119 }; 00120 00121 struct charset_info_st; 00122 00123 typedef struct my_collation_handler_st 00124 { 00125 my_bool (*init)(struct charset_info_st *, void *(*alloc)(uint)); 00126 /* Collation routines */ 00127 int (*strnncoll)(struct charset_info_st *, 00128 const uchar *, uint, const uchar *, uint, my_bool); 00129 int (*strnncollsp)(struct charset_info_st *, 00130 const uchar *, uint, const uchar *, uint, 00131 my_bool diff_if_only_endspace_difference); 00132 int (*strnxfrm)(struct charset_info_st *, 00133 uchar *, uint, const uchar *, uint); 00134 uint (*strnxfrmlen)(struct charset_info_st *, uint); 00135 my_bool (*like_range)(struct charset_info_st *, 00136 const char *s, uint s_length, 00137 pchar w_prefix, pchar w_one, pchar w_many, 00138 uint res_length, 00139 char *min_str, char *max_str, 00140 uint *min_len, uint *max_len); 00141 int (*wildcmp)(struct charset_info_st *, 00142 const char *str,const char *str_end, 00143 const char *wildstr,const char *wildend, 00144 int escape,int w_one, int w_many); 00145 00146 int (*strcasecmp)(struct charset_info_st *, const char *, const char *); 00147 00148 uint (*instr)(struct charset_info_st *, 00149 const char *b, uint b_length, 00150 const char *s, uint s_length, 00151 my_match_t *match, uint nmatch); 00152 00153 /* Hash calculation */ 00154 void (*hash_sort)(struct charset_info_st *cs, const uchar *key, uint len, 00155 ulong *nr1, ulong *nr2); 00156 my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, uint len); 00157 } MY_COLLATION_HANDLER; 00158 00159 extern MY_COLLATION_HANDLER my_collation_mb_bin_handler; 00160 extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler; 00161 extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler; 00162 extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler; 00163 00164 00165 typedef struct my_charset_handler_st 00166 { 00167 my_bool (*init)(struct charset_info_st *, void *(*alloc)(uint)); 00168 /* Multibyte routines */ 00169 int (*ismbchar)(struct charset_info_st *, const char *, const char *); 00170 int (*mbcharlen)(struct charset_info_st *, uint); 00171 uint (*numchars)(struct charset_info_st *, const char *b, const char *e); 00172 uint (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos); 00173 uint (*well_formed_len)(struct charset_info_st *, 00174 const char *b,const char *e, 00175 uint nchars, int *error); 00176 uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length); 00177 uint (*numcells)(struct charset_info_st *, const char *b, const char *e); 00178 00179 /* Unicode conversion */ 00180 int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc, 00181 const unsigned char *s,const unsigned char *e); 00182 int (*wc_mb)(struct charset_info_st *cs,my_wc_t wc, 00183 unsigned char *s,unsigned char *e); 00184 00185 /* CTYPE scanner */ 00186 int (*ctype)(struct charset_info_st *cs, int *ctype, 00187 const unsigned char *s, const unsigned char *e); 00188 00189 /* Functions for case and sort conversion */ 00190 void (*caseup_str)(struct charset_info_st *, char *); 00191 void (*casedn_str)(struct charset_info_st *, char *); 00192 uint (*caseup)(struct charset_info_st *, char *src, uint srclen, 00193 char *dst, uint dstlen); 00194 uint (*casedn)(struct charset_info_st *, char *src, uint srclen, 00195 char *dst, uint dstlen); 00196 00197 /* Charset dependant snprintf() */ 00198 int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt, 00199 ...); 00200 int (*long10_to_str)(struct charset_info_st *, char *to, uint n, int radix, 00201 long int val); 00202 int (*longlong10_to_str)(struct charset_info_st *, char *to, uint n, 00203 int radix, longlong val); 00204 00205 void (*fill)(struct charset_info_st *, char *to, uint len, int fill); 00206 00207 /* String-to-number conversion routines */ 00208 long (*strntol)(struct charset_info_st *, const char *s, uint l, 00209 int base, char **e, int *err); 00210 ulong (*strntoul)(struct charset_info_st *, const char *s, uint l, 00211 int base, char **e, int *err); 00212 longlong (*strntoll)(struct charset_info_st *, const char *s, uint l, 00213 int base, char **e, int *err); 00214 ulonglong (*strntoull)(struct charset_info_st *, const char *s, uint l, 00215 int base, char **e, int *err); 00216 double (*strntod)(struct charset_info_st *, char *s, uint l, char **e, 00217 int *err); 00218 longlong (*strtoll10)(struct charset_info_st *cs, 00219 const char *nptr, char **endptr, int *error); 00220 ulong (*scan)(struct charset_info_st *, const char *b, const char *e, 00221 int sq); 00222 } MY_CHARSET_HANDLER; 00223 00224 extern MY_CHARSET_HANDLER my_charset_8bit_handler; 00225 extern MY_CHARSET_HANDLER my_charset_ucs2_handler; 00226 00227 00228 typedef struct charset_info_st 00229 { 00230 uint number; 00231 uint primary_number; 00232 uint binary_number; 00233 uint state; 00234 const char *csname; 00235 const char *name; 00236 const char *comment; 00237 const char *tailoring; 00238 uchar *ctype; 00239 uchar *to_lower; 00240 uchar *to_upper; 00241 uchar *sort_order; 00242 uint16 *contractions; 00243 uint16 **sort_order_big; 00244 uint16 *tab_to_uni; 00245 MY_UNI_IDX *tab_from_uni; 00246 MY_UNICASE_INFO **caseinfo; 00247 uchar *state_map; 00248 uchar *ident_map; 00249 uint strxfrm_multiply; 00250 uchar caseup_multiply; 00251 uchar casedn_multiply; 00252 uint mbminlen; 00253 uint mbmaxlen; 00254 uint16 min_sort_char; 00255 uint16 max_sort_char; /* For LIKE optimization */ 00256 uchar pad_char; 00257 my_bool escape_with_backslash_is_dangerous; 00258 00259 MY_CHARSET_HANDLER *cset; 00260 MY_COLLATION_HANDLER *coll; 00261 00262 } CHARSET_INFO; 00263 00264 00265 extern CHARSET_INFO my_charset_bin; 00266 extern CHARSET_INFO my_charset_big5_chinese_ci; 00267 extern CHARSET_INFO my_charset_big5_bin; 00268 extern CHARSET_INFO my_charset_cp932_japanese_ci; 00269 extern CHARSET_INFO my_charset_cp932_bin; 00270 extern CHARSET_INFO my_charset_eucjpms_japanese_ci; 00271 extern CHARSET_INFO my_charset_eucjpms_bin; 00272 extern CHARSET_INFO my_charset_euckr_korean_ci; 00273 extern CHARSET_INFO my_charset_euckr_bin; 00274 extern CHARSET_INFO my_charset_gb2312_chinese_ci; 00275 extern CHARSET_INFO my_charset_gb2312_bin; 00276 extern CHARSET_INFO my_charset_gbk_chinese_ci; 00277 extern CHARSET_INFO my_charset_gbk_bin; 00278 extern CHARSET_INFO my_charset_latin1; 00279 extern CHARSET_INFO my_charset_latin1_german2_ci; 00280 extern CHARSET_INFO my_charset_latin1_bin; 00281 extern CHARSET_INFO my_charset_latin2_czech_ci; 00282 extern CHARSET_INFO my_charset_sjis_japanese_ci; 00283 extern CHARSET_INFO my_charset_sjis_bin; 00284 extern CHARSET_INFO my_charset_tis620_thai_ci; 00285 extern CHARSET_INFO my_charset_tis620_bin; 00286 extern CHARSET_INFO my_charset_ucs2_general_ci; 00287 extern CHARSET_INFO my_charset_ucs2_bin; 00288 extern CHARSET_INFO my_charset_ucs2_general_uca; 00289 extern CHARSET_INFO my_charset_ujis_japanese_ci; 00290 extern CHARSET_INFO my_charset_ujis_bin; 00291 extern CHARSET_INFO my_charset_utf8_general_ci; 00292 extern CHARSET_INFO my_charset_utf8_bin; 00293 extern CHARSET_INFO my_charset_cp1250_czech_ci; 00294 extern CHARSET_INFO my_charset_filename; 00295 00296 /* declarations for simple charsets */ 00297 extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *, 00298 uint); 00299 uint my_strnxfrmlen_simple(CHARSET_INFO *, uint); 00300 extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint, 00301 const uchar *, uint, my_bool); 00302 00303 extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, uint, 00304 const uchar *, uint, 00305 my_bool diff_if_only_endspace_difference); 00306 00307 extern void my_hash_sort_simple(CHARSET_INFO *cs, 00308 const uchar *key, uint len, 00309 ulong *nr1, ulong *nr2); 00310 00311 extern uint my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, uint length); 00312 00313 extern uint my_instr_simple(struct charset_info_st *, 00314 const char *b, uint b_length, 00315 const char *s, uint s_length, 00316 my_match_t *match, uint nmatch); 00317 00318 00319 /* Functions for 8bit */ 00320 extern void my_caseup_str_8bit(CHARSET_INFO *, char *); 00321 extern void my_casedn_str_8bit(CHARSET_INFO *, char *); 00322 extern uint my_caseup_8bit(CHARSET_INFO *, char *src, uint srclen, 00323 char *dst, uint dstlen); 00324 extern uint my_casedn_8bit(CHARSET_INFO *, char *src, uint srclen, 00325 char *dst, uint dstlen); 00326 00327 extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *); 00328 00329 int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e); 00330 int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); 00331 00332 int my_mb_ctype_8bit(CHARSET_INFO *,int *, const uchar *,const uchar *); 00333 int my_mb_ctype_mb(CHARSET_INFO *,int *, const uchar *,const uchar *); 00334 00335 ulong my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq); 00336 00337 int my_snprintf_8bit(struct charset_info_st *, char *to, uint n, 00338 const char *fmt, ...); 00339 00340 long my_strntol_8bit(CHARSET_INFO *, const char *s, uint l, int base, 00341 char **e, int *err); 00342 ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, uint l, int base, 00343 char **e, int *err); 00344 longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, uint l, int base, 00345 char **e, int *err); 00346 ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, uint l, int base, 00347 char **e, int *err); 00348 double my_strntod_8bit(CHARSET_INFO *, char *s, uint l,char **e, 00349 int *err); 00350 int my_long10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix, 00351 long int val); 00352 int my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix, 00353 longlong val); 00354 00355 longlong my_strtoll10_8bit(CHARSET_INFO *cs, 00356 const char *nptr, char **endptr, int *error); 00357 longlong my_strtoll10_ucs2(CHARSET_INFO *cs, 00358 const char *nptr, char **endptr, int *error); 00359 00360 void my_fill_8bit(CHARSET_INFO *cs, char* to, uint l, int fill); 00361 00362 my_bool my_like_range_simple(CHARSET_INFO *cs, 00363 const char *ptr, uint ptr_length, 00364 pbool escape, pbool w_one, pbool w_many, 00365 uint res_length, 00366 char *min_str, char *max_str, 00367 uint *min_length, uint *max_length); 00368 00369 my_bool my_like_range_mb(CHARSET_INFO *cs, 00370 const char *ptr, uint ptr_length, 00371 pbool escape, pbool w_one, pbool w_many, 00372 uint res_length, 00373 char *min_str, char *max_str, 00374 uint *min_length, uint *max_length); 00375 00376 my_bool my_like_range_ucs2(CHARSET_INFO *cs, 00377 const char *ptr, uint ptr_length, 00378 pbool escape, pbool w_one, pbool w_many, 00379 uint res_length, 00380 char *min_str, char *max_str, 00381 uint *min_length, uint *max_length); 00382 00383 00384 int my_wildcmp_8bit(CHARSET_INFO *, 00385 const char *str,const char *str_end, 00386 const char *wildstr,const char *wildend, 00387 int escape, int w_one, int w_many); 00388 00389 int my_wildcmp_bin(CHARSET_INFO *, 00390 const char *str,const char *str_end, 00391 const char *wildstr,const char *wildend, 00392 int escape, int w_one, int w_many); 00393 00394 uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e); 00395 uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e); 00396 uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos); 00397 uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e, 00398 uint pos, int *error); 00399 int my_mbcharlen_8bit(CHARSET_INFO *, uint c); 00400 00401 00402 /* Functions for multibyte charsets */ 00403 extern void my_caseup_str_mb(CHARSET_INFO *, char *); 00404 extern void my_casedn_str_mb(CHARSET_INFO *, char *); 00405 extern uint my_caseup_mb(CHARSET_INFO *, char *src, uint srclen, 00406 char *dst, uint dstlen); 00407 extern uint my_casedn_mb(CHARSET_INFO *, char *src, uint srclen, 00408 char *dst, uint dstlen); 00409 extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *); 00410 00411 int my_wildcmp_mb(CHARSET_INFO *, 00412 const char *str,const char *str_end, 00413 const char *wildstr,const char *wildend, 00414 int escape, int w_one, int w_many); 00415 uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e); 00416 uint my_numcells_mb(CHARSET_INFO *, const char *b, const char *e); 00417 uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos); 00418 uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e, 00419 uint pos, int *error); 00420 uint my_instr_mb(struct charset_info_st *, 00421 const char *b, uint b_length, 00422 const char *s, uint s_length, 00423 my_match_t *match, uint nmatch); 00424 00425 int my_wildcmp_unicode(CHARSET_INFO *cs, 00426 const char *str, const char *str_end, 00427 const char *wildstr, const char *wildend, 00428 int escape, int w_one, int w_many, 00429 MY_UNICASE_INFO **weights); 00430 00431 extern my_bool my_parse_charset_xml(const char *bug, uint len, 00432 int (*add)(CHARSET_INFO *cs)); 00433 extern char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end, 00434 char c); 00435 00436 my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, uint len); 00437 my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len); 00438 00439 00440 #define _MY_U 01 /* Upper case */ 00441 #define _MY_L 02 /* Lower case */ 00442 #define _MY_NMR 04 /* Numeral (digit) */ 00443 #define _MY_SPC 010 /* Spacing character */ 00444 #define _MY_PNT 020 /* Punctuation */ 00445 #define _MY_CTR 040 /* Control character */ 00446 #define _MY_B 0100 /* Blank */ 00447 #define _MY_X 0200 /* heXadecimal digit */ 00448 00449 00450 #define my_isascii(c) (!((c) & ~0177)) 00451 #define my_toascii(c) ((c) & 0177) 00452 #define my_tocntrl(c) ((c) & 31) 00453 #define my_toprint(c) ((c) | 64) 00454 #define my_toupper(s,c) (char) ((s)->to_upper[(uchar) (c)]) 00455 #define my_tolower(s,c) (char) ((s)->to_lower[(uchar) (c)]) 00456 #define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L)) 00457 #define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_U) 00458 #define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_L) 00459 #define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_NMR) 00460 #define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_X) 00461 #define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L | _MY_NMR)) 00462 #define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_SPC) 00463 #define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_PNT) 00464 #define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B)) 00465 #define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR)) 00466 #define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_CTR) 00467 00468 /* Some macros that should be cleaned up a little */ 00469 #define my_isvar(s,c) (my_isalnum(s,c) || (c) == '_') 00470 #define my_isvar_start(s,c) (my_isalpha(s,c) || (c) == '_') 00471 00472 #define my_binary_compare(s) ((s)->state & MY_CS_BINSORT) 00473 #define use_strnxfrm(s) ((s)->state & MY_CS_STRNXFRM) 00474 #define my_strnxfrm(s, a, b, c, d) ((s)->coll->strnxfrm((s), (a), (b), (c), (d))) 00475 #define my_strnncoll(s, a, b, c, d) ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0)) 00476 #define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \ 00477 ((s)->coll->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h), (i), (j))) 00478 #define my_wildcmp(cs,s,se,w,we,e,o,m) ((cs)->coll->wildcmp((cs),(s),(se),(w),(we),(e),(o),(m))) 00479 #define my_strcasecmp(s, a, b) ((s)->coll->strcasecmp((s), (a), (b))) 00480 #define my_charpos(cs, b, e, num) (cs)->cset->charpos((cs), (const char*) (b), (const char *)(e), (num)) 00481 00482 00483 #define use_mb(s) ((s)->cset->ismbchar != NULL) 00484 #define my_ismbchar(s, a, b) ((s)->cset->ismbchar((s), (a), (b))) 00485 #ifdef USE_MB 00486 #define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s),(a))) 00487 #else 00488 #define my_mbcharlen(s, a) 1 00489 #endif 00490 00491 #define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a))) 00492 #define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a))) 00493 #define my_strntol(s, a, b, c, d, e) ((s)->cset->strntol((s),(a),(b),(c),(d),(e))) 00494 #define my_strntoul(s, a, b, c, d, e) ((s)->cset->strntoul((s),(a),(b),(c),(d),(e))) 00495 #define my_strntoll(s, a, b, c, d, e) ((s)->cset->strntoll((s),(a),(b),(c),(d),(e))) 00496 #define my_strntoull(s, a, b, c,d, e) ((s)->cset->strntoull((s),(a),(b),(c),(d),(e))) 00497 #define my_strntod(s, a, b, c, d) ((s)->cset->strntod((s),(a),(b),(c),(d))) 00498 00499 00500 /* XXX: still need to take care of this one */ 00501 #ifdef MY_CHARSET_TIS620 00502 #error The TIS620 charset is broken at the moment. Tell tim to fix it. 00503 #define USE_TIS620 00504 #include "t_ctype.h" 00505 #endif 00506 00507 #ifdef __cplusplus 00508 } 00509 #endif 00510 00511 #endif /* _m_ctype_h */
1.4.7

