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