2 Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
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.
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.
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 St, Fifth Floor, Boston, MA 02110-1301 USA
19 A better inplementation of the UNIX ctype(3) library.
20 Notes: my_global.h should be included before ctype.h
26 #include <my_attribute.h>
32 #define MY_CS_NAME_SIZE 32
33 #define MY_CS_CTYPE_TABLE_SIZE 257
34 #define MY_CS_TO_LOWER_TABLE_SIZE 256
35 #define MY_CS_TO_UPPER_TABLE_SIZE 256
36 #define MY_CS_SORT_ORDER_TABLE_SIZE 256
37 #define MY_CS_TO_UNI_TABLE_SIZE 256
39 #define CHARSET_DIR "charsets/"
43 typedef struct unicase_info_st
51 extern MY_UNICASE_INFO
*my_unicase_default
[256];
52 extern MY_UNICASE_INFO
*my_unicase_turkish
[256];
53 extern MY_UNICASE_INFO
*my_unicase_mysql500
[256];
56 typedef struct uni_ctype_st
62 extern MY_UNI_CTYPE my_uni_ctype
[256];
64 /* wm_wc and wc_mb return codes */
65 #define MY_CS_ILSEQ 0 /* Wrong by sequence: wb_wc */
66 #define MY_CS_ILUNI 0 /* Cannot encode Unicode to charset: wc_mb */
67 #define MY_CS_TOOSMALL -101 /* Need at least one byte: wc_mb and mb_wc */
68 #define MY_CS_TOOSMALL2 -102 /* Need at least two bytes: wc_mb and mb_wc */
69 #define MY_CS_TOOSMALL3 -103 /* Need at least three bytes: wc_mb and mb_wc */
70 /* These following three are currently not really used */
71 #define MY_CS_TOOSMALL4 -104 /* Need at least 4 bytes: wc_mb and mb_wc */
72 #define MY_CS_TOOSMALL5 -105 /* Need at least 5 bytes: wc_mb and mb_wc */
73 #define MY_CS_TOOSMALL6 -106 /* Need at least 6 bytes: wc_mb and mb_wc */
74 /* A helper macros for "need at least n bytes" */
75 #define MY_CS_TOOSMALLN(n) (-100-(n))
77 #define MY_SEQ_INTTAIL 1
78 #define MY_SEQ_SPACES 2
80 /* My charsets_list flags */
81 #define MY_CS_COMPILED 1 /* compiled-in sets */
82 #define MY_CS_CONFIG 2 /* sets that have a *.conf file */
83 #define MY_CS_INDEX 4 /* sets listed in the Index file */
84 #define MY_CS_LOADED 8 /* sets that are currently loaded */
85 #define MY_CS_BINSORT 16 /* if binary sort order */
86 #define MY_CS_PRIMARY 32 /* if primary collation */
87 #define MY_CS_STRNXFRM 64 /* if strnxfrm is used for sort */
88 #define MY_CS_UNICODE 128 /* is a charset is full unicode */
89 #define MY_CS_READY 256 /* if a charset is initialized */
90 #define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/
91 #define MY_CS_CSSORT 1024 /* if case sensitive sort order */
92 #define MY_CS_HIDDEN 2048 /* don't display in SHOW */
93 #define MY_CS_PUREASCII 4096 /* if a charset is pure ascii */
94 #define MY_CHARSET_UNDEFINED 0
96 /* Character repertoire flags */
97 #define MY_REPERTOIRE_ASCII 1 /* Pure ASCII U+0000..U+007F */
98 #define MY_REPERTOIRE_EXTENDED 2 /* Extended characters: U+0080..U+FFFF */
99 #define MY_REPERTOIRE_UNICODE30 3 /* ASCII | EXTENDED: U+0000..U+FFFF */
102 typedef struct my_uni_idx_st
118 MY_LEX_START
, MY_LEX_CHAR
, MY_LEX_IDENT
,
119 MY_LEX_IDENT_SEP
, MY_LEX_IDENT_START
,
120 MY_LEX_REAL
, MY_LEX_HEX_NUMBER
, MY_LEX_BIN_NUMBER
,
121 MY_LEX_CMP_OP
, MY_LEX_LONG_CMP_OP
, MY_LEX_STRING
, MY_LEX_COMMENT
, MY_LEX_END
,
122 MY_LEX_OPERATOR_OR_IDENT
, MY_LEX_NUMBER_IDENT
, MY_LEX_INT_OR_REAL
,
123 MY_LEX_REAL_OR_POINT
, MY_LEX_BOOL
, MY_LEX_EOL
, MY_LEX_ESCAPE
,
124 MY_LEX_LONG_COMMENT
, MY_LEX_END_LONG_COMMENT
, MY_LEX_SEMICOLON
,
125 MY_LEX_SET_VAR
, MY_LEX_USER_END
, MY_LEX_HOSTNAME
, MY_LEX_SKIP
,
126 MY_LEX_USER_VARIABLE_DELIMITER
, MY_LEX_SYSTEM_VAR
,
127 MY_LEX_IDENT_OR_KEYWORD
,
128 MY_LEX_IDENT_OR_HEX
, MY_LEX_IDENT_OR_BIN
, MY_LEX_IDENT_OR_NCHAR
,
129 MY_LEX_STRING_OR_DELIMITER
132 struct charset_info_st
;
135 extern int (*my_string_stack_guard
)(int);
137 /* See strings/CHARSET_INFO.txt for information about this structure */
138 typedef struct my_collation_handler_st
140 my_bool (*init
)(struct charset_info_st
*, void *(*alloc
)(size_t));
141 /* Collation routines */
142 int (*strnncoll
)(struct charset_info_st
*,
143 const uchar
*, size_t, const uchar
*, size_t, my_bool
);
144 int (*strnncollsp
)(struct charset_info_st
*,
145 const uchar
*, size_t, const uchar
*, size_t,
146 my_bool diff_if_only_endspace_difference
);
147 size_t (*strnxfrm
)(struct charset_info_st
*,
148 uchar
*, size_t, const uchar
*, size_t);
149 size_t (*strnxfrmlen
)(struct charset_info_st
*, size_t);
150 my_bool (*like_range
)(struct charset_info_st
*,
151 const char *s
, size_t s_length
,
152 pchar w_prefix
, pchar w_one
, pchar w_many
,
154 char *min_str
, char *max_str
,
155 size_t *min_len
, size_t *max_len
);
156 int (*wildcmp
)(struct charset_info_st
*,
157 const char *str
,const char *str_end
,
158 const char *wildstr
,const char *wildend
,
159 int escape
,int w_one
, int w_many
);
161 int (*strcasecmp
)(struct charset_info_st
*, const char *, const char *);
163 uint (*instr
)(struct charset_info_st
*,
164 const char *b
, size_t b_length
,
165 const char *s
, size_t s_length
,
166 my_match_t
*match
, uint nmatch
);
168 /* Hash calculation */
169 void (*hash_sort
)(struct charset_info_st
*cs
, const uchar
*key
, size_t len
,
170 ulong
*nr1
, ulong
*nr2
);
171 my_bool (*propagate
)(struct charset_info_st
*cs
, const uchar
*str
, size_t len
);
172 } MY_COLLATION_HANDLER
;
174 extern MY_COLLATION_HANDLER my_collation_mb_bin_handler
;
175 extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler
;
176 extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler
;
177 extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler
;
179 /* Some typedef to make it easy for C++ to make function pointers */
180 typedef int (*my_charset_conv_mb_wc
)(struct charset_info_st
*, my_wc_t
*,
181 const uchar
*, const uchar
*);
182 typedef int (*my_charset_conv_wc_mb
)(struct charset_info_st
*, my_wc_t
,
184 typedef size_t (*my_charset_conv_case
)(struct charset_info_st
*,
185 char *, size_t, char *, size_t);
188 /* See strings/CHARSET_INFO.txt about information on this structure */
189 typedef struct my_charset_handler_st
191 my_bool (*init
)(struct charset_info_st
*, void *(*alloc
)(size_t));
192 /* Multibyte routines */
193 uint (*ismbchar
)(struct charset_info_st
*, const char *, const char *);
194 uint (*mbcharlen
)(struct charset_info_st
*, uint c
);
195 size_t (*numchars
)(struct charset_info_st
*, const char *b
, const char *e
);
196 size_t (*charpos
)(struct charset_info_st
*, const char *b
, const char *e
,
198 size_t (*well_formed_len
)(struct charset_info_st
*,
199 const char *b
,const char *e
,
200 size_t nchars
, int *error
);
201 size_t (*lengthsp
)(struct charset_info_st
*, const char *ptr
, size_t length
);
202 size_t (*numcells
)(struct charset_info_st
*, const char *b
, const char *e
);
204 /* Unicode conversion */
205 my_charset_conv_mb_wc mb_wc
;
206 my_charset_conv_wc_mb wc_mb
;
209 int (*ctype
)(struct charset_info_st
*cs
, int *ctype
,
210 const uchar
*s
, const uchar
*e
);
212 /* Functions for case and sort conversion */
213 size_t (*caseup_str
)(struct charset_info_st
*, char *);
214 size_t (*casedn_str
)(struct charset_info_st
*, char *);
216 my_charset_conv_case caseup
;
217 my_charset_conv_case casedn
;
219 /* Charset dependant snprintf() */
220 size_t (*snprintf
)(struct charset_info_st
*, char *to
, size_t n
,
222 ...) ATTRIBUTE_FORMAT_FPTR(printf
, 4, 5);
223 size_t (*long10_to_str
)(struct charset_info_st
*, char *to
, size_t n
,
224 int radix
, long int val
);
225 size_t (*longlong10_to_str
)(struct charset_info_st
*, char *to
, size_t n
,
226 int radix
, longlong val
);
228 void (*fill
)(struct charset_info_st
*, char *to
, size_t len
, int fill
);
230 /* String-to-number conversion routines */
231 long (*strntol
)(struct charset_info_st
*, const char *s
, size_t l
,
232 int base
, char **e
, int *err
);
233 ulong (*strntoul
)(struct charset_info_st
*, const char *s
, size_t l
,
234 int base
, char **e
, int *err
);
235 longlong (*strntoll
)(struct charset_info_st
*, const char *s
, size_t l
,
236 int base
, char **e
, int *err
);
237 ulonglong (*strntoull
)(struct charset_info_st
*, const char *s
, size_t l
,
238 int base
, char **e
, int *err
);
239 double (*strntod
)(struct charset_info_st
*, char *s
, size_t l
, char **e
,
241 longlong (*strtoll10
)(struct charset_info_st
*cs
,
242 const char *nptr
, char **endptr
, int *error
);
243 ulonglong (*strntoull10rnd
)(struct charset_info_st
*cs
,
244 const char *str
, size_t length
,
246 char **endptr
, int *error
);
247 size_t (*scan
)(struct charset_info_st
*, const char *b
, const char *e
,
249 } MY_CHARSET_HANDLER
;
251 extern MY_CHARSET_HANDLER my_charset_8bit_handler
;
252 extern MY_CHARSET_HANDLER my_charset_ucs2_handler
;
255 /* See strings/CHARSET_INFO.txt about information on this structure */
256 typedef struct charset_info_st
265 const char *tailoring
;
270 uint16
*contractions
;
271 uint16
**sort_order_big
;
273 MY_UNI_IDX
*tab_from_uni
;
274 MY_UNICASE_INFO
**caseinfo
;
277 uint strxfrm_multiply
;
278 uchar caseup_multiply
;
279 uchar casedn_multiply
;
282 uint16 min_sort_char
;
283 uint16 max_sort_char
; /* For LIKE optimization */
285 my_bool escape_with_backslash_is_dangerous
;
287 MY_CHARSET_HANDLER
*cset
;
288 MY_COLLATION_HANDLER
*coll
;
291 #define ILLEGAL_CHARSET_INFO_NUMBER (~0U)
294 extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin
;
295 extern CHARSET_INFO my_charset_big5_chinese_ci
;
296 extern CHARSET_INFO my_charset_big5_bin
;
297 extern CHARSET_INFO my_charset_cp932_japanese_ci
;
298 extern CHARSET_INFO my_charset_cp932_bin
;
299 extern CHARSET_INFO my_charset_eucjpms_japanese_ci
;
300 extern CHARSET_INFO my_charset_eucjpms_bin
;
301 extern CHARSET_INFO my_charset_euckr_korean_ci
;
302 extern CHARSET_INFO my_charset_euckr_bin
;
303 extern CHARSET_INFO my_charset_gb2312_chinese_ci
;
304 extern CHARSET_INFO my_charset_gb2312_bin
;
305 extern CHARSET_INFO my_charset_gbk_chinese_ci
;
306 extern CHARSET_INFO my_charset_gbk_bin
;
307 extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1
;
308 extern CHARSET_INFO my_charset_latin1_german2_ci
;
309 extern CHARSET_INFO my_charset_latin1_bin
;
310 extern CHARSET_INFO my_charset_latin2_czech_ci
;
311 extern CHARSET_INFO my_charset_sjis_japanese_ci
;
312 extern CHARSET_INFO my_charset_sjis_bin
;
313 extern CHARSET_INFO my_charset_tis620_thai_ci
;
314 extern CHARSET_INFO my_charset_tis620_bin
;
315 extern CHARSET_INFO my_charset_ucs2_general_ci
;
316 extern CHARSET_INFO my_charset_ucs2_bin
;
317 extern CHARSET_INFO my_charset_ucs2_unicode_ci
;
318 extern CHARSET_INFO my_charset_ucs2_general_mysql500_ci
;
319 extern CHARSET_INFO my_charset_ujis_japanese_ci
;
320 extern CHARSET_INFO my_charset_ujis_bin
;
321 extern CHARSET_INFO my_charset_utf8_general_ci
;
322 extern CHARSET_INFO my_charset_utf8_unicode_ci
;
323 extern CHARSET_INFO my_charset_utf8_bin
;
324 extern CHARSET_INFO my_charset_utf8_general_mysql500_ci
;
325 extern CHARSET_INFO my_charset_cp1250_czech_ci
;
326 extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename
;
328 /* declarations for simple charsets */
329 extern size_t my_strnxfrm_simple(CHARSET_INFO
*, uchar
*, size_t,
330 const uchar
*, size_t);
331 size_t my_strnxfrmlen_simple(CHARSET_INFO
*, size_t);
332 extern int my_strnncoll_simple(CHARSET_INFO
*, const uchar
*, size_t,
333 const uchar
*, size_t, my_bool
);
335 extern int my_strnncollsp_simple(CHARSET_INFO
*, const uchar
*, size_t,
336 const uchar
*, size_t,
337 my_bool diff_if_only_endspace_difference
);
339 extern void my_hash_sort_simple(CHARSET_INFO
*cs
,
340 const uchar
*key
, size_t len
,
341 ulong
*nr1
, ulong
*nr2
);
343 extern size_t my_lengthsp_8bit(CHARSET_INFO
*cs
, const char *ptr
, size_t length
);
345 extern uint
my_instr_simple(struct charset_info_st
*,
346 const char *b
, size_t b_length
,
347 const char *s
, size_t s_length
,
348 my_match_t
*match
, uint nmatch
);
351 /* Functions for 8bit */
352 extern size_t my_caseup_str_8bit(CHARSET_INFO
*, char *);
353 extern size_t my_casedn_str_8bit(CHARSET_INFO
*, char *);
354 extern size_t my_caseup_8bit(CHARSET_INFO
*, char *src
, size_t srclen
,
355 char *dst
, size_t dstlen
);
356 extern size_t my_casedn_8bit(CHARSET_INFO
*, char *src
, size_t srclen
,
357 char *dst
, size_t dstlen
);
359 extern int my_strcasecmp_8bit(CHARSET_INFO
* cs
, const char *, const char *);
361 int my_mb_wc_8bit(CHARSET_INFO
*cs
,my_wc_t
*wc
, const uchar
*s
,const uchar
*e
);
362 int my_wc_mb_8bit(CHARSET_INFO
*cs
,my_wc_t wc
, uchar
*s
, uchar
*e
);
364 int my_mb_ctype_8bit(CHARSET_INFO
*,int *, const uchar
*,const uchar
*);
365 int my_mb_ctype_mb(CHARSET_INFO
*,int *, const uchar
*,const uchar
*);
367 size_t my_scan_8bit(CHARSET_INFO
*cs
, const char *b
, const char *e
, int sq
);
369 size_t my_snprintf_8bit(struct charset_info_st
*, char *to
, size_t n
,
370 const char *fmt
, ...)
371 ATTRIBUTE_FORMAT(printf
, 4, 5);
373 long my_strntol_8bit(CHARSET_INFO
*, const char *s
, size_t l
, int base
,
375 ulong
my_strntoul_8bit(CHARSET_INFO
*, const char *s
, size_t l
, int base
,
377 longlong
my_strntoll_8bit(CHARSET_INFO
*, const char *s
, size_t l
, int base
,
379 ulonglong
my_strntoull_8bit(CHARSET_INFO
*, const char *s
, size_t l
, int base
,
381 double my_strntod_8bit(CHARSET_INFO
*, char *s
, size_t l
,char **e
,
383 size_t my_long10_to_str_8bit(CHARSET_INFO
*, char *to
, size_t l
, int radix
,
385 size_t my_longlong10_to_str_8bit(CHARSET_INFO
*, char *to
, size_t l
, int radix
,
388 longlong
my_strtoll10_8bit(CHARSET_INFO
*cs
,
389 const char *nptr
, char **endptr
, int *error
);
390 longlong
my_strtoll10_ucs2(CHARSET_INFO
*cs
,
391 const char *nptr
, char **endptr
, int *error
);
393 ulonglong
my_strntoull10rnd_8bit(CHARSET_INFO
*cs
,
394 const char *str
, size_t length
, int
395 unsigned_fl
, char **endptr
, int *error
);
396 ulonglong
my_strntoull10rnd_ucs2(CHARSET_INFO
*cs
,
397 const char *str
, size_t length
,
398 int unsigned_fl
, char **endptr
, int *error
);
400 void my_fill_8bit(CHARSET_INFO
*cs
, char* to
, size_t l
, int fill
);
402 my_bool
my_like_range_simple(CHARSET_INFO
*cs
,
403 const char *ptr
, size_t ptr_length
,
404 pbool escape
, pbool w_one
, pbool w_many
,
406 char *min_str
, char *max_str
,
407 size_t *min_length
, size_t *max_length
);
409 my_bool
my_like_range_mb(CHARSET_INFO
*cs
,
410 const char *ptr
, size_t ptr_length
,
411 pbool escape
, pbool w_one
, pbool w_many
,
413 char *min_str
, char *max_str
,
414 size_t *min_length
, size_t *max_length
);
416 my_bool
my_like_range_ucs2(CHARSET_INFO
*cs
,
417 const char *ptr
, size_t ptr_length
,
418 pbool escape
, pbool w_one
, pbool w_many
,
420 char *min_str
, char *max_str
,
421 size_t *min_length
, size_t *max_length
);
424 int my_wildcmp_8bit(CHARSET_INFO
*,
425 const char *str
,const char *str_end
,
426 const char *wildstr
,const char *wildend
,
427 int escape
, int w_one
, int w_many
);
429 int my_wildcmp_bin(CHARSET_INFO
*,
430 const char *str
,const char *str_end
,
431 const char *wildstr
,const char *wildend
,
432 int escape
, int w_one
, int w_many
);
434 size_t my_numchars_8bit(CHARSET_INFO
*, const char *b
, const char *e
);
435 size_t my_numcells_8bit(CHARSET_INFO
*, const char *b
, const char *e
);
436 size_t my_charpos_8bit(CHARSET_INFO
*, const char *b
, const char *e
, size_t pos
);
437 size_t my_well_formed_len_8bit(CHARSET_INFO
*, const char *b
, const char *e
,
438 size_t pos
, int *error
);
439 uint
my_mbcharlen_8bit(CHARSET_INFO
*, uint c
);
442 /* Functions for multibyte charsets */
443 extern size_t my_caseup_str_mb(CHARSET_INFO
*, char *);
444 extern size_t my_casedn_str_mb(CHARSET_INFO
*, char *);
445 extern size_t my_caseup_mb(CHARSET_INFO
*, char *src
, size_t srclen
,
446 char *dst
, size_t dstlen
);
447 extern size_t my_casedn_mb(CHARSET_INFO
*, char *src
, size_t srclen
,
448 char *dst
, size_t dstlen
);
449 extern int my_strcasecmp_mb(CHARSET_INFO
* cs
,const char *, const char *);
451 int my_wildcmp_mb(CHARSET_INFO
*,
452 const char *str
,const char *str_end
,
453 const char *wildstr
,const char *wildend
,
454 int escape
, int w_one
, int w_many
);
455 size_t my_numchars_mb(CHARSET_INFO
*, const char *b
, const char *e
);
456 size_t my_numcells_mb(CHARSET_INFO
*, const char *b
, const char *e
);
457 size_t my_charpos_mb(CHARSET_INFO
*, const char *b
, const char *e
, size_t pos
);
458 size_t my_well_formed_len_mb(CHARSET_INFO
*, const char *b
, const char *e
,
459 size_t pos
, int *error
);
460 uint
my_instr_mb(struct charset_info_st
*,
461 const char *b
, size_t b_length
,
462 const char *s
, size_t s_length
,
463 my_match_t
*match
, uint nmatch
);
465 int my_wildcmp_unicode(CHARSET_INFO
*cs
,
466 const char *str
, const char *str_end
,
467 const char *wildstr
, const char *wildend
,
468 int escape
, int w_one
, int w_many
,
469 MY_UNICASE_INFO
**weights
);
471 extern my_bool
my_parse_charset_xml(const char *bug
, size_t len
,
472 int (*add
)(CHARSET_INFO
*cs
));
473 extern char *my_strchr(CHARSET_INFO
*cs
, const char *str
, const char *end
,
475 extern size_t my_strcspn(CHARSET_INFO
*cs
, const char *str
, const char *end
,
478 my_bool
my_propagate_simple(CHARSET_INFO
*cs
, const uchar
*str
, size_t len
);
479 my_bool
my_propagate_complex(CHARSET_INFO
*cs
, const uchar
*str
, size_t len
);
482 uint
my_string_repertoire(CHARSET_INFO
*cs
, const char *str
, ulong len
);
483 my_bool
my_charset_is_ascii_based(CHARSET_INFO
*cs
);
484 my_bool
my_charset_is_8bit_pure_ascii(CHARSET_INFO
*cs
);
485 uint
my_charset_repertoire(CHARSET_INFO
*cs
);
488 #define _MY_U 01 /* Upper case */
489 #define _MY_L 02 /* Lower case */
490 #define _MY_NMR 04 /* Numeral (digit) */
491 #define _MY_SPC 010 /* Spacing character */
492 #define _MY_PNT 020 /* Punctuation */
493 #define _MY_CTR 040 /* Control character */
494 #define _MY_B 0100 /* Blank */
495 #define _MY_X 0200 /* heXadecimal digit */
498 #define my_isascii(c) (!((c) & ~0177))
499 #define my_toascii(c) ((c) & 0177)
500 #define my_tocntrl(c) ((c) & 31)
501 #define my_toprint(c) ((c) | 64)
502 #define my_toupper(s,c) (char) ((s)->to_upper[(uchar) (c)])
503 #define my_tolower(s,c) (char) ((s)->to_lower[(uchar) (c)])
504 #define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L))
505 #define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_U)
506 #define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_L)
507 #define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_NMR)
508 #define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_X)
509 #define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L | _MY_NMR))
510 #define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_SPC)
511 #define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_PNT)
512 #define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B))
513 #define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR))
514 #define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_CTR)
516 /* Some macros that should be cleaned up a little */
517 #define my_isvar(s,c) (my_isalnum(s,c) || (c) == '_')
518 #define my_isvar_start(s,c) (my_isalpha(s,c) || (c) == '_')
520 #define my_binary_compare(s) ((s)->state & MY_CS_BINSORT)
521 #define use_strnxfrm(s) ((s)->state & MY_CS_STRNXFRM)
522 #define my_strnxfrm(s, a, b, c, d) ((s)->coll->strnxfrm((s), (a), (b), (c), (d)))
523 #define my_strnncoll(s, a, b, c, d) ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0))
524 #define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \
525 ((s)->coll->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h), (i), (j)))
526 #define my_wildcmp(cs,s,se,w,we,e,o,m) ((cs)->coll->wildcmp((cs),(s),(se),(w),(we),(e),(o),(m)))
527 #define my_strcasecmp(s, a, b) ((s)->coll->strcasecmp((s), (a), (b)))
528 #define my_charpos(cs, b, e, num) (cs)->cset->charpos((cs), (const char*) (b), (const char *)(e), (num))
531 #define use_mb(s) ((s)->cset->ismbchar != NULL)
532 #define my_ismbchar(s, a, b) ((s)->cset->ismbchar((s), (a), (b)))
534 #define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s),(a)))
536 #define my_mbcharlen(s, a) 1
539 #define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a)))
540 #define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a)))
541 #define my_strntol(s, a, b, c, d, e) ((s)->cset->strntol((s),(a),(b),(c),(d),(e)))
542 #define my_strntoul(s, a, b, c, d, e) ((s)->cset->strntoul((s),(a),(b),(c),(d),(e)))
543 #define my_strntoll(s, a, b, c, d, e) ((s)->cset->strntoll((s),(a),(b),(c),(d),(e)))
544 #define my_strntoull(s, a, b, c,d, e) ((s)->cset->strntoull((s),(a),(b),(c),(d),(e)))
545 #define my_strntod(s, a, b, c, d) ((s)->cset->strntod((s),(a),(b),(c),(d)))
548 /* XXX: still need to take care of this one */
549 #ifdef MY_CHARSET_TIS620
550 #error The TIS620 charset is broken at the moment. Tell tim to fix it.
559 #endif /* _m_ctype_h */