Annotation of win32/sql/mysql/include/m_ctype.h, revision 1.2

1.2     ! misha       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: 
1.1       parser     16: /*
                     17:   A better inplementation of the UNIX ctype(3) library.
1.2     ! misha      18:   Notes:   my_global.h should be included before ctype.h
1.1       parser     19: */
                     20: 
                     21: #ifndef _m_ctype_h
                     22: #define _m_ctype_h
                     23: 
1.2     ! misha      24: #include <my_attribute.h>
1.1       parser     25: 
                     26: #ifdef __cplusplus
                     27: extern "C" {
                     28: #endif
                     29: 
1.2     ! misha      30: #define MY_CS_NAME_SIZE                        32
        !            31: #define MY_CS_CTYPE_TABLE_SIZE         257
        !            32: #define MY_CS_TO_LOWER_TABLE_SIZE      256
        !            33: #define MY_CS_TO_UPPER_TABLE_SIZE      256
        !            34: #define MY_CS_SORT_ORDER_TABLE_SIZE    256
        !            35: #define MY_CS_TO_UNI_TABLE_SIZE                256
        !            36: 
        !            37: #define CHARSET_DIR    "charsets/"
        !            38: 
        !            39: #define my_wc_t ulong
        !            40: 
        !            41: typedef struct unicase_info_st
        !            42: {
        !            43:   uint16 toupper;
        !            44:   uint16 tolower;
        !            45:   uint16 sort;
        !            46: } MY_UNICASE_INFO;
        !            47: 
        !            48: 
        !            49: extern MY_UNICASE_INFO *my_unicase_default[256];
        !            50: extern MY_UNICASE_INFO *my_unicase_turkish[256];
        !            51: 
        !            52: 
        !            53: /* wm_wc and wc_mb return codes */
        !            54: #define MY_CS_ILSEQ    0     /* Wrong by sequence: wb_wc                   */
        !            55: #define MY_CS_ILUNI    0     /* Cannot encode Unicode to charset: wc_mb    */
        !            56: #define MY_CS_TOOSMALL  -101  /* Need at least one byte:    wc_mb and mb_wc */
        !            57: #define MY_CS_TOOSMALL2 -102  /* Need at least two bytes:   wc_mb and mb_wc */
        !            58: #define MY_CS_TOOSMALL3 -103  /* Need at least three bytes: wc_mb and mb_wc */
        !            59: /* These following three are currently not really used */
        !            60: #define MY_CS_TOOSMALL4 -104  /* Need at least 4 bytes: wc_mb and mb_wc */
        !            61: #define MY_CS_TOOSMALL5 -105  /* Need at least 5 bytes: wc_mb and mb_wc */
        !            62: #define MY_CS_TOOSMALL6 -106  /* Need at least 6 bytes: wc_mb and mb_wc */
        !            63: /* A helper macros for "need at least n bytes" */
        !            64: #define MY_CS_TOOSMALLN(n)    (-100-(n))
        !            65: 
        !            66: #define MY_SEQ_INTTAIL 1
        !            67: #define MY_SEQ_SPACES  2
        !            68: 
        !            69:         /* My charsets_list flags */
        !            70: #define MY_CS_COMPILED  1      /* compiled-in sets               */
        !            71: #define MY_CS_CONFIG    2      /* sets that have a *.conf file   */
        !            72: #define MY_CS_INDEX     4      /* sets listed in the Index file  */
        !            73: #define MY_CS_LOADED    8      /* sets that are currently loaded */
        !            74: #define MY_CS_BINSORT  16     /* if binary sort order           */
        !            75: #define MY_CS_PRIMARY  32     /* if primary collation           */
        !            76: #define MY_CS_STRNXFRM 64     /* if strnxfrm is used for sort   */
        !            77: #define MY_CS_UNICODE  128    /* is a charset is full unicode   */
        !            78: #define MY_CS_READY    256    /* if a charset is initialized    */
        !            79: #define MY_CS_AVAILABLE        512    /* If either compiled-in or loaded*/
        !            80: #define MY_CS_CSSORT   1024   /* if case sensitive sort order   */     
        !            81: #define MY_CHARSET_UNDEFINED 0
        !            82: 
        !            83: 
        !            84: typedef struct my_uni_idx_st
        !            85: {
        !            86:   uint16 from;
        !            87:   uint16 to;
        !            88:   uchar  *tab;
        !            89: } MY_UNI_IDX;
        !            90: 
        !            91: typedef struct
        !            92: {
        !            93:   uint beg;
        !            94:   uint end;
        !            95:   uint mb_len;
        !            96: } my_match_t;
        !            97: 
        !            98: enum my_lex_states
        !            99: {
        !           100:   MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT, 
        !           101:   MY_LEX_IDENT_SEP, MY_LEX_IDENT_START,
        !           102:   MY_LEX_REAL, MY_LEX_HEX_NUMBER, MY_LEX_BIN_NUMBER,
        !           103:   MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END,
        !           104:   MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL,
        !           105:   MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE, 
        !           106:   MY_LEX_LONG_COMMENT, MY_LEX_END_LONG_COMMENT, MY_LEX_SEMICOLON, 
        !           107:   MY_LEX_SET_VAR, MY_LEX_USER_END, MY_LEX_HOSTNAME, MY_LEX_SKIP, 
        !           108:   MY_LEX_USER_VARIABLE_DELIMITER, MY_LEX_SYSTEM_VAR,
        !           109:   MY_LEX_IDENT_OR_KEYWORD,
        !           110:   MY_LEX_IDENT_OR_HEX, MY_LEX_IDENT_OR_BIN, MY_LEX_IDENT_OR_NCHAR,
        !           111:   MY_LEX_STRING_OR_DELIMITER
        !           112: };
        !           113: 
        !           114: struct charset_info_st;
        !           115: 
        !           116: 
        !           117: /* See strings/CHARSET_INFO.txt for information about this structure  */
        !           118: typedef struct my_collation_handler_st
        !           119: {
        !           120:   my_bool (*init)(struct charset_info_st *, void *(*alloc)(uint));
        !           121:   /* Collation routines */
        !           122:   int     (*strnncoll)(struct charset_info_st *,
        !           123:                       const uchar *, uint, const uchar *, uint, my_bool);
        !           124:   int     (*strnncollsp)(struct charset_info_st *,
        !           125:                          const uchar *, uint, const uchar *, uint,
        !           126:                          my_bool diff_if_only_endspace_difference);
        !           127:   int     (*strnxfrm)(struct charset_info_st *,
        !           128:                      uchar *, uint, const uchar *, uint);
        !           129:   uint    (*strnxfrmlen)(struct charset_info_st *, uint); 
        !           130:   my_bool (*like_range)(struct charset_info_st *,
        !           131:                        const char *s, uint s_length,
        !           132:                        pchar w_prefix, pchar w_one, pchar w_many, 
        !           133:                        uint res_length,
        !           134:                        char *min_str, char *max_str,
        !           135:                        uint *min_len, uint *max_len);
        !           136:   int     (*wildcmp)(struct charset_info_st *,
        !           137:                     const char *str,const char *str_end,
        !           138:                      const char *wildstr,const char *wildend,
        !           139:                      int escape,int w_one, int w_many);
        !           140: 
        !           141:   int  (*strcasecmp)(struct charset_info_st *, const char *, const char *);
        !           142:   
        !           143:   uint (*instr)(struct charset_info_st *,
        !           144:                 const char *b, uint b_length,
        !           145:                 const char *s, uint s_length,
        !           146:                 my_match_t *match, uint nmatch);
        !           147:   
        !           148:   /* Hash calculation */
        !           149:   void (*hash_sort)(struct charset_info_st *cs, const uchar *key, uint len,
        !           150:                    ulong *nr1, ulong *nr2); 
        !           151:   my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, uint len);
        !           152: } MY_COLLATION_HANDLER;
        !           153: 
        !           154: extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
        !           155: extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
        !           156: extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
        !           157: extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;
        !           158: 
        !           159: 
        !           160: /* See strings/CHARSET_INFO.txt about information on this structure  */
        !           161: typedef struct my_charset_handler_st
        !           162: {
        !           163:   my_bool (*init)(struct charset_info_st *, void *(*alloc)(uint));
        !           164:   /* Multibyte routines */
        !           165:   int     (*ismbchar)(struct charset_info_st *, const char *, const char *);
        !           166:   int     (*mbcharlen)(struct charset_info_st *, uint);
        !           167:   uint    (*numchars)(struct charset_info_st *, const char *b, const char *e);
        !           168:   uint    (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos);
        !           169:   uint    (*well_formed_len)(struct charset_info_st *,
        !           170:                              const char *b,const char *e,
        !           171:                              uint nchars, int *error);
        !           172:   uint    (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
        !           173:   uint    (*numcells)(struct charset_info_st *, const char *b, const char *e);
        !           174:   
        !           175:   /* Unicode convertion */
        !           176:   int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc,
        !           177:               const unsigned char *s,const unsigned char *e);
        !           178:   int (*wc_mb)(struct charset_info_st *cs,my_wc_t wc,
        !           179:               unsigned char *s,unsigned char *e);
        !           180:   
        !           181:   /* Functions for case and sort convertion */
        !           182:   uint    (*caseup_str)(struct charset_info_st *, char *);
        !           183:   uint    (*casedn_str)(struct charset_info_st *, char *);
        !           184:   uint    (*caseup)(struct charset_info_st *, char *src, uint srclen,
        !           185:                                               char *dst, uint dstlen);
        !           186:   uint    (*casedn)(struct charset_info_st *, char *src, uint srclen,
        !           187:                                               char *dst, uint dstlen);
        !           188:   
        !           189:   /* Charset dependant snprintf() */
        !           190:   int  (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt,
        !           191:                   ...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);
        !           192:   int  (*long10_to_str)(struct charset_info_st *, char *to, uint n, int radix,
        !           193:                        long int val);
        !           194:   int (*longlong10_to_str)(struct charset_info_st *, char *to, uint n,
        !           195:                           int radix, longlong val);
        !           196:   
        !           197:   void (*fill)(struct charset_info_st *, char *to, uint len, int fill);
        !           198:   
        !           199:   /* String-to-number convertion routines */
        !           200:   long        (*strntol)(struct charset_info_st *, const char *s, uint l,
        !           201:                         int base, char **e, int *err);
        !           202:   ulong      (*strntoul)(struct charset_info_st *, const char *s, uint l,
        !           203:                         int base, char **e, int *err);
        !           204:   longlong   (*strntoll)(struct charset_info_st *, const char *s, uint l,
        !           205:                         int base, char **e, int *err);
        !           206:   ulonglong (*strntoull)(struct charset_info_st *, const char *s, uint l,
        !           207:                         int base, char **e, int *err);
        !           208:   double      (*strntod)(struct charset_info_st *, char *s, uint l, char **e,
        !           209:                         int *err);
        !           210:   longlong    (*strtoll10)(struct charset_info_st *cs,
        !           211:                            const char *nptr, char **endptr, int *error);
        !           212:   ulonglong   (*strntoull10rnd)(struct charset_info_st *cs,
        !           213:                                 const char *str, uint length, int unsigned_fl,
        !           214:                                 char **endptr, int *error);
        !           215:   ulong        (*scan)(struct charset_info_st *, const char *b, const char *e,
        !           216:                       int sq);
        !           217: } MY_CHARSET_HANDLER;
        !           218: 
        !           219: extern MY_CHARSET_HANDLER my_charset_8bit_handler;
        !           220: extern MY_CHARSET_HANDLER my_charset_ucs2_handler;
        !           221: 
        !           222: 
        !           223: /* See strings/CHARSET_INFO.txt about information on this structure  */
        !           224: typedef struct charset_info_st
        !           225: {
        !           226:   uint      number;
        !           227:   uint      primary_number;
        !           228:   uint      binary_number;
        !           229:   uint      state;
        !           230:   const char *csname;
        !           231:   const char *name;
        !           232:   const char *comment;
        !           233:   const char *tailoring;
        !           234:   uchar    *ctype;
        !           235:   uchar    *to_lower;
        !           236:   uchar    *to_upper;
        !           237:   uchar    *sort_order;
        !           238:   uint16   *contractions;
        !           239:   uint16   **sort_order_big;
        !           240:   uint16      *tab_to_uni;
        !           241:   MY_UNI_IDX  *tab_from_uni;
        !           242:   MY_UNICASE_INFO **caseinfo;
        !           243:   uchar     *state_map;
        !           244:   uchar     *ident_map;
        !           245:   uint      strxfrm_multiply;
        !           246:   uchar     caseup_multiply;
        !           247:   uchar     casedn_multiply;
        !           248:   uint      mbminlen;
        !           249:   uint      mbmaxlen;
        !           250:   uint16    min_sort_char;
        !           251:   uint16    max_sort_char; /* For LIKE optimization */
        !           252:   uchar     pad_char;
        !           253:   my_bool   escape_with_backslash_is_dangerous;
        !           254:   
        !           255:   MY_CHARSET_HANDLER *cset;
        !           256:   MY_COLLATION_HANDLER *coll;
        !           257:   
        !           258: } CHARSET_INFO;
        !           259: 
        !           260: 
        !           261: extern CHARSET_INFO my_charset_bin;
        !           262: extern CHARSET_INFO my_charset_big5_chinese_ci;
        !           263: extern CHARSET_INFO my_charset_big5_bin;
        !           264: extern CHARSET_INFO my_charset_cp932_japanese_ci;
        !           265: extern CHARSET_INFO my_charset_cp932_bin;
        !           266: extern CHARSET_INFO my_charset_eucjpms_japanese_ci;
        !           267: extern CHARSET_INFO my_charset_eucjpms_bin;
        !           268: extern CHARSET_INFO my_charset_euckr_korean_ci;
        !           269: extern CHARSET_INFO my_charset_euckr_bin;
        !           270: extern CHARSET_INFO my_charset_gb2312_chinese_ci;
        !           271: extern CHARSET_INFO my_charset_gb2312_bin;
        !           272: extern CHARSET_INFO my_charset_gbk_chinese_ci;
        !           273: extern CHARSET_INFO my_charset_gbk_bin;
        !           274: extern CHARSET_INFO my_charset_latin1;
        !           275: extern CHARSET_INFO my_charset_latin1_german2_ci;
        !           276: extern CHARSET_INFO my_charset_latin1_bin;
        !           277: extern CHARSET_INFO my_charset_latin2_czech_ci;
        !           278: extern CHARSET_INFO my_charset_sjis_japanese_ci;
        !           279: extern CHARSET_INFO my_charset_sjis_bin;
        !           280: extern CHARSET_INFO my_charset_tis620_thai_ci;
        !           281: extern CHARSET_INFO my_charset_tis620_bin;
        !           282: extern CHARSET_INFO my_charset_ucs2_general_ci;
        !           283: extern CHARSET_INFO my_charset_ucs2_bin;
        !           284: extern CHARSET_INFO my_charset_ucs2_general_uca;
        !           285: extern CHARSET_INFO my_charset_ujis_japanese_ci;
        !           286: extern CHARSET_INFO my_charset_ujis_bin;
        !           287: extern CHARSET_INFO my_charset_utf8_general_ci;
        !           288: extern CHARSET_INFO my_charset_utf8_bin;
        !           289: extern CHARSET_INFO my_charset_cp1250_czech_ci;
        !           290: 
        !           291: /* declarations for simple charsets */
        !           292: extern int  my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *,
        !           293:                                uint); 
        !           294: uint  my_strnxfrmlen_simple(CHARSET_INFO *, uint); 
        !           295: extern int  my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint,
        !           296:                                const uchar *, uint, my_bool);
        !           297: 
        !           298: extern int  my_strnncollsp_simple(CHARSET_INFO *, const uchar *, uint,
        !           299:                                   const uchar *, uint,
        !           300:                                   my_bool diff_if_only_endspace_difference);
        !           301: 
        !           302: extern void my_hash_sort_simple(CHARSET_INFO *cs,
        !           303:                                const uchar *key, uint len,
        !           304:                                ulong *nr1, ulong *nr2); 
        !           305: 
        !           306: extern uint my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, uint length);
        !           307: 
        !           308: extern uint my_instr_simple(struct charset_info_st *,
        !           309:                             const char *b, uint b_length,
        !           310:                             const char *s, uint s_length,
        !           311:                             my_match_t *match, uint nmatch);
        !           312: 
        !           313: 
        !           314: /* Functions for 8bit */
        !           315: extern uint my_caseup_str_8bit(CHARSET_INFO *, char *);
        !           316: extern uint my_casedn_str_8bit(CHARSET_INFO *, char *);
        !           317: extern uint my_caseup_8bit(CHARSET_INFO *, char *src, uint srclen,
        !           318:                                            char *dst, uint dstlen);
        !           319: extern uint my_casedn_8bit(CHARSET_INFO *, char *src, uint srclen,
        !           320:                                            char *dst, uint dstlen);
        !           321: 
        !           322: extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
        !           323: 
        !           324: int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e);
        !           325: int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
        !           326: 
        !           327: ulong my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq);
        !           328: 
        !           329: int my_snprintf_8bit(struct charset_info_st *, char *to, uint n,
        !           330:                     const char *fmt, ...)
        !           331:   ATTRIBUTE_FORMAT(printf, 4, 5);
        !           332: 
        !           333: long        my_strntol_8bit(CHARSET_INFO *, const char *s, uint l, int base,
        !           334:                            char **e, int *err);
        !           335: ulong      my_strntoul_8bit(CHARSET_INFO *, const char *s, uint l, int base,
        !           336:                            char **e, int *err);
        !           337: longlong   my_strntoll_8bit(CHARSET_INFO *, const char *s, uint l, int base,
        !           338:                            char **e, int *err);
        !           339: ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, uint l, int base,
        !           340:                            char **e, int *err);
        !           341: double      my_strntod_8bit(CHARSET_INFO *, char *s, uint l,char **e,
        !           342:                            int *err);
        !           343: int  my_long10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix,
        !           344:                           long int val);
        !           345: int my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix,
        !           346:                              longlong val);
        !           347: 
        !           348: longlong my_strtoll10_8bit(CHARSET_INFO *cs,
        !           349:                            const char *nptr, char **endptr, int *error);
        !           350: longlong my_strtoll10_ucs2(CHARSET_INFO *cs, 
        !           351:                            const char *nptr, char **endptr, int *error);
        !           352: 
        !           353: ulonglong my_strntoull10rnd_8bit(CHARSET_INFO *cs,
        !           354:                                  const char *str, uint length, int unsigned_fl,
        !           355:                                  char **endptr, int *error);
        !           356: ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs, 
        !           357:                                  const char *str, uint length, int unsigned_fl,
        !           358:                                  char **endptr, int *error);
        !           359: 
        !           360: void my_fill_8bit(CHARSET_INFO *cs, char* to, uint l, int fill);
        !           361: 
        !           362: my_bool  my_like_range_simple(CHARSET_INFO *cs,
        !           363:                              const char *ptr, uint ptr_length,
        !           364:                              pbool escape, pbool w_one, pbool w_many,
        !           365:                              uint res_length,
        !           366:                              char *min_str, char *max_str,
        !           367:                              uint *min_length, uint *max_length);
        !           368: 
        !           369: my_bool  my_like_range_mb(CHARSET_INFO *cs,
        !           370:                          const char *ptr, uint ptr_length,
        !           371:                          pbool escape, pbool w_one, pbool w_many,
        !           372:                          uint res_length,
        !           373:                          char *min_str, char *max_str,
        !           374:                          uint *min_length, uint *max_length);
        !           375: 
        !           376: my_bool  my_like_range_ucs2(CHARSET_INFO *cs,
        !           377:                            const char *ptr, uint ptr_length,
        !           378:                            pbool escape, pbool w_one, pbool w_many,
        !           379:                            uint res_length,
        !           380:                            char *min_str, char *max_str,
        !           381:                            uint *min_length, uint *max_length);
        !           382: 
        !           383: 
        !           384: int my_wildcmp_8bit(CHARSET_INFO *,
        !           385:                    const char *str,const char *str_end,
        !           386:                    const char *wildstr,const char *wildend,
        !           387:                    int escape, int w_one, int w_many);
        !           388: 
        !           389: int my_wildcmp_bin(CHARSET_INFO *,
        !           390:                   const char *str,const char *str_end,
        !           391:                   const char *wildstr,const char *wildend,
        !           392:                   int escape, int w_one, int w_many);
        !           393: 
        !           394: uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
        !           395: uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
        !           396: uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
        !           397: uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e,
        !           398:                              uint pos, int *error);
        !           399: int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
        !           400: 
        !           401: 
        !           402: /* Functions for multibyte charsets */
        !           403: extern uint my_caseup_str_mb(CHARSET_INFO *, char *);
        !           404: extern uint my_casedn_str_mb(CHARSET_INFO *, char *);
        !           405: extern uint my_caseup_mb(CHARSET_INFO *, char *src, uint srclen,
        !           406:                                          char *dst, uint dstlen);
        !           407: extern uint my_casedn_mb(CHARSET_INFO *, char *src, uint srclen,
        !           408:                                          char *dst, uint dstlen);
        !           409: extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
        !           410: 
        !           411: int my_wildcmp_mb(CHARSET_INFO *,
        !           412:                  const char *str,const char *str_end,
        !           413:                  const char *wildstr,const char *wildend,
        !           414:                  int escape, int w_one, int w_many);
        !           415: uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
        !           416: uint my_numcells_mb(CHARSET_INFO *, const char *b, const char *e);
        !           417: uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
        !           418: uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e,
        !           419:                            uint pos, int *error);
        !           420: uint my_instr_mb(struct charset_info_st *,
        !           421:                  const char *b, uint b_length,
        !           422:                  const char *s, uint s_length,
        !           423:                  my_match_t *match, uint nmatch);
        !           424: 
        !           425: int my_wildcmp_unicode(CHARSET_INFO *cs,
        !           426:                        const char *str, const char *str_end,
        !           427:                        const char *wildstr, const char *wildend,
        !           428:                        int escape, int w_one, int w_many,
        !           429:                        MY_UNICASE_INFO **weights);
        !           430: 
        !           431: extern my_bool my_parse_charset_xml(const char *bug, uint len,
        !           432:                                    int (*add)(CHARSET_INFO *cs));
        !           433: 
        !           434: my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, uint len);
        !           435: my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
        !           436: 
        !           437: 
        !           438: #define        _MY_U   01      /* Upper case */
        !           439: #define        _MY_L   02      /* Lower case */
        !           440: #define        _MY_NMR 04      /* Numeral (digit) */
        !           441: #define        _MY_SPC 010     /* Spacing character */
        !           442: #define        _MY_PNT 020     /* Punctuation */
        !           443: #define        _MY_CTR 040     /* Control character */
        !           444: #define        _MY_B   0100    /* Blank */
        !           445: #define        _MY_X   0200    /* heXadecimal digit */
        !           446: 
        !           447: 
        !           448: #define        my_isascii(c)   (!((c) & ~0177))
        !           449: #define        my_toascii(c)   ((c) & 0177)
        !           450: #define my_tocntrl(c)  ((c) & 31)
        !           451: #define my_toprint(c)  ((c) | 64)
        !           452: #define my_toupper(s,c)        (char) ((s)->to_upper[(uchar) (c)])
        !           453: #define my_tolower(s,c)        (char) ((s)->to_lower[(uchar) (c)])
        !           454: #define        my_isalpha(s, c)  (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L))
        !           455: #define        my_isupper(s, c)  (((s)->ctype+1)[(uchar) (c)] & _MY_U)
        !           456: #define        my_islower(s, c)  (((s)->ctype+1)[(uchar) (c)] & _MY_L)
        !           457: #define        my_isdigit(s, c)  (((s)->ctype+1)[(uchar) (c)] & _MY_NMR)
        !           458: #define        my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_X)
        !           459: #define        my_isalnum(s, c)  (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L | _MY_NMR))
        !           460: #define        my_isspace(s, c)  (((s)->ctype+1)[(uchar) (c)] & _MY_SPC)
        !           461: #define        my_ispunct(s, c)  (((s)->ctype+1)[(uchar) (c)] & _MY_PNT)
        !           462: #define        my_isprint(s, c)  (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B))
        !           463: #define        my_isgraph(s, c)  (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR))
        !           464: #define        my_iscntrl(s, c)  (((s)->ctype+1)[(uchar) (c)] & _MY_CTR)
1.1       parser    465: 
                    466: /* Some macros that should be cleaned up a little */
1.2     ! misha     467: #define my_isvar(s,c)                 (my_isalnum(s,c) || (c) == '_')
        !           468: #define my_isvar_start(s,c)           (my_isalpha(s,c) || (c) == '_')
1.1       parser    469: 
1.2     ! misha     470: #define my_binary_compare(s)         ((s)->state  & MY_CS_BINSORT)
        !           471: #define use_strnxfrm(s)               ((s)->state  & MY_CS_STRNXFRM)
        !           472: #define my_strnxfrm(s, a, b, c, d)    ((s)->coll->strnxfrm((s), (a), (b), (c), (d)))
        !           473: #define my_strnncoll(s, a, b, c, d) ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0))
        !           474: #define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \
        !           475:    ((s)->coll->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h), (i), (j)))
        !           476: #define my_wildcmp(cs,s,se,w,we,e,o,m) ((cs)->coll->wildcmp((cs),(s),(se),(w),(we),(e),(o),(m)))
        !           477: #define my_strcasecmp(s, a, b)        ((s)->coll->strcasecmp((s), (a), (b)))
        !           478: #define my_charpos(cs, b, e, num)     (cs)->cset->charpos((cs), (const char*) (b), (const char *)(e), (num))
        !           479: 
        !           480: 
        !           481: #define use_mb(s)                     ((s)->cset->ismbchar != NULL)
        !           482: #define my_ismbchar(s, a, b)          ((s)->cset->ismbchar((s), (a), (b)))
        !           483: #ifdef USE_MB
        !           484: #define my_mbcharlen(s, a)            ((s)->cset->mbcharlen((s),(a)))
        !           485: #else
        !           486: #define my_mbcharlen(s, a)            1
1.1       parser    487: #endif
                    488: 
1.2     ! misha     489: #define my_caseup_str(s, a)           ((s)->cset->caseup_str((s), (a)))
        !           490: #define my_casedn_str(s, a)           ((s)->cset->casedn_str((s), (a)))
        !           491: #define my_strntol(s, a, b, c, d, e)  ((s)->cset->strntol((s),(a),(b),(c),(d),(e)))
        !           492: #define my_strntoul(s, a, b, c, d, e) ((s)->cset->strntoul((s),(a),(b),(c),(d),(e)))
        !           493: #define my_strntoll(s, a, b, c, d, e) ((s)->cset->strntoll((s),(a),(b),(c),(d),(e)))
        !           494: #define my_strntoull(s, a, b, c,d, e) ((s)->cset->strntoull((s),(a),(b),(c),(d),(e)))
        !           495: #define my_strntod(s, a, b, c, d)     ((s)->cset->strntod((s),(a),(b),(c),(d)))
1.1       parser    496: 
                    497: 
1.2     ! misha     498: /* XXX: still need to take care of this one */
        !           499: #ifdef MY_CHARSET_TIS620
        !           500: #error The TIS620 charset is broken at the moment.  Tell tim to fix it.
1.1       parser    501: #define USE_TIS620
                    502: #include "t_ctype.h"
                    503: #endif
                    504: 
                    505: #ifdef __cplusplus
                    506: }
                    507: #endif
                    508: 
                    509: #endif /* _m_ctype_h */

E-mail: