~drizzle-trunk/drizzle/development

1 by brian
clean slate
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
16
/*
17
  A better inplementation of the UNIX ctype(3) library.
264.1.12 by Monty Taylor
Fixed ref to my_global.h in mystrings/longlong2str_asm.c.
18
  Notes:   drizzled/global.h should be included before ctype.h
1 by brian
clean slate
19
*/
20
21
#ifndef _m_ctype_h
22
#define _m_ctype_h
23
548 by Monty Taylor
Moved my_handler to myisam, which is where it actually belongs.
24
#include <stdint.h>
612.2.4 by Monty Taylor
Moved some defines to config.h. Stopped including config.h directly anywhere.
25
#include <sys/types.h>
629.1.1 by Monty Taylor
More solaris fixes.
26
#if !defined(__cplusplus)
27
# include <stdbool.h>
28
#endif
548 by Monty Taylor
Moved my_handler to myisam, which is where it actually belongs.
29
1 by brian
clean slate
30
#ifdef	__cplusplus
31
extern "C" {
32
#endif
33
34
#define MY_CS_NAME_SIZE			32
35
#define MY_CS_CTYPE_TABLE_SIZE		257
36
#define MY_CS_TO_LOWER_TABLE_SIZE	256
37
#define MY_CS_TO_UPPER_TABLE_SIZE	256
38
#define MY_CS_SORT_ORDER_TABLE_SIZE	256
39
#define MY_CS_TO_UNI_TABLE_SIZE		256
40
41
#define CHARSET_DIR	"charsets/"
42
612.2.4 by Monty Taylor
Moved some defines to config.h. Stopped including config.h directly anywhere.
43
#define my_wc_t unsigned long
1 by brian
clean slate
44
45
typedef struct unicase_info_st
46
{
206 by Brian Aker
Removed final uint dead types.
47
  uint16_t toupper;
48
  uint16_t tolower;
49
  uint16_t sort;
1 by brian
clean slate
50
} MY_UNICASE_INFO;
51
52
53
extern MY_UNICASE_INFO *my_unicase_default[256];
54
extern MY_UNICASE_INFO *my_unicase_turkish[256];
55
56
typedef struct uni_ctype_st
57
{
481 by Brian Aker
Remove all of uchar.
58
  unsigned char  pctype;
59
  unsigned char  *ctype;
1 by brian
clean slate
60
} MY_UNI_CTYPE;
61
62
extern MY_UNI_CTYPE my_uni_ctype[256];
63
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))
76
77
#define MY_SEQ_INTTAIL	1
78
#define MY_SEQ_SPACES	2
79
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*/
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
91
#define MY_CS_CSSORT	1024   /* if case sensitive sort order   */
92
#define MY_CS_HIDDEN	2048   /* don't display in SHOW          */
1 by brian
clean slate
93
#define MY_CS_PUREASCII 4096   /* if a charset is pure ascii     */
94
#define MY_CS_NONASCII  8192   /* if not ASCII-compatible        */
95
#define MY_CHARSET_UNDEFINED 0
96
97
/* Character repertoire flags */
98
#define MY_REPERTOIRE_ASCII      1 /* Pure ASCII            U+0000..U+007F */
99
#define MY_REPERTOIRE_EXTENDED   2 /* Extended characters:  U+0080..U+FFFF */
100
#define MY_REPERTOIRE_UNICODE30  3 /* ASCII | EXTENDED:     U+0000..U+FFFF */
101
102
/* Flags for strxfrm */
103
#define MY_STRXFRM_LEVEL1          0x00000001 /* for primary weights   */
104
#define MY_STRXFRM_LEVEL2          0x00000002 /* for secondary weights */
105
#define MY_STRXFRM_LEVEL3          0x00000004 /* for tertiary weights  */
106
#define MY_STRXFRM_LEVEL4          0x00000008 /* fourth level weights  */
107
#define MY_STRXFRM_LEVEL5          0x00000010 /* fifth level weights   */
108
#define MY_STRXFRM_LEVEL6          0x00000020 /* sixth level weights   */
109
#define MY_STRXFRM_LEVEL_ALL       0x0000003F /* Bit OR for the above six */
110
#define MY_STRXFRM_NLEVELS         6          /* Number of possible levels*/
111
112
#define MY_STRXFRM_PAD_WITH_SPACE  0x00000040 /* if pad result with spaces */
113
#define MY_STRXFRM_UNUSED_00000080 0x00000080 /* for future extensions     */
114
115
#define MY_STRXFRM_DESC_LEVEL1     0x00000100 /* if desc order for level1 */
116
#define MY_STRXFRM_DESC_LEVEL2     0x00000200 /* if desc order for level2 */
117
#define MY_STRXFRM_DESC_LEVEL3     0x00000300 /* if desc order for level3 */
118
#define MY_STRXFRM_DESC_LEVEL4     0x00000800 /* if desc order for level4 */
119
#define MY_STRXFRM_DESC_LEVEL5     0x00001000 /* if desc order for level5 */
120
#define MY_STRXFRM_DESC_LEVEL6     0x00002000 /* if desc order for level6 */
121
#define MY_STRXFRM_DESC_SHIFT      8
122
123
#define MY_STRXFRM_UNUSED_00004000 0x00004000 /* for future extensions     */
124
#define MY_STRXFRM_UNUSED_00008000 0x00008000 /* for future extensions     */
125
126
#define MY_STRXFRM_REVERSE_LEVEL1  0x00010000 /* if reverse order for level1 */
127
#define MY_STRXFRM_REVERSE_LEVEL2  0x00020000 /* if reverse order for level2 */
128
#define MY_STRXFRM_REVERSE_LEVEL3  0x00040000 /* if reverse order for level3 */
129
#define MY_STRXFRM_REVERSE_LEVEL4  0x00080000 /* if reverse order for level4 */
130
#define MY_STRXFRM_REVERSE_LEVEL5  0x00100000 /* if reverse order for level5 */
131
#define MY_STRXFRM_REVERSE_LEVEL6  0x00200000 /* if reverse order for level6 */
132
#define MY_STRXFRM_REVERSE_SHIFT   16
133
134
135
typedef struct my_uni_idx_st
136
{
206 by Brian Aker
Removed final uint dead types.
137
  uint16_t from;
138
  uint16_t to;
481 by Brian Aker
Remove all of uchar.
139
  unsigned char  *tab;
1 by brian
clean slate
140
} MY_UNI_IDX;
141
142
typedef struct
143
{
411 by Brian Aker
Removed legacy bits around enum.
144
  uint32_t beg;
145
  uint32_t end;
146
  uint32_t mb_len;
1 by brian
clean slate
147
} my_match_t;
148
149
enum my_lex_states
150
{
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
151
  MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT,
1 by brian
clean slate
152
  MY_LEX_IDENT_SEP, MY_LEX_IDENT_START,
153
  MY_LEX_REAL, MY_LEX_HEX_NUMBER, MY_LEX_BIN_NUMBER,
154
  MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END,
155
  MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL,
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
156
  MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE,
157
  MY_LEX_LONG_COMMENT, MY_LEX_END_LONG_COMMENT, MY_LEX_SEMICOLON,
158
  MY_LEX_SET_VAR, MY_LEX_USER_END, MY_LEX_HOSTNAME, MY_LEX_SKIP,
1 by brian
clean slate
159
  MY_LEX_USER_VARIABLE_DELIMITER, MY_LEX_SYSTEM_VAR,
160
  MY_LEX_IDENT_OR_KEYWORD,
235 by Brian Aker
Final bit of NCHAR removed.
161
  MY_LEX_IDENT_OR_HEX, MY_LEX_IDENT_OR_BIN,
1 by brian
clean slate
162
  MY_LEX_STRING_OR_DELIMITER
163
};
164
165
struct charset_info_st;
166
167
168
/* See strings/CHARSET_INFO.txt for information about this structure  */
169
typedef struct my_collation_handler_st
170
{
276 by Brian Aker
Cleaned out my_bool from strings.
171
  bool (*init)(struct charset_info_st *, void *(*alloc)(size_t));
1 by brian
clean slate
172
  /* Collation routines */
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
173
  int     (*strnncoll)(const struct charset_info_st * const,
481 by Brian Aker
Remove all of uchar.
174
		       const unsigned char *, size_t, const unsigned char *, size_t, bool);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
175
  int     (*strnncollsp)(const struct charset_info_st * const,
481 by Brian Aker
Remove all of uchar.
176
                         const unsigned char *, size_t, const unsigned char *, size_t,
276 by Brian Aker
Cleaned out my_bool from strings.
177
                         bool diff_if_only_endspace_difference);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
178
  size_t  (*strnxfrm)(const struct charset_info_st * const,
481 by Brian Aker
Remove all of uchar.
179
                      unsigned char *dst, size_t dstlen, uint32_t nweights,
180
                      const unsigned char *src, size_t srclen, uint32_t flags);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
181
  size_t    (*strnxfrmlen)(const struct charset_info_st * const, size_t);
276 by Brian Aker
Cleaned out my_bool from strings.
182
  bool (*like_range)(const struct charset_info_st * const,
77.1.95 by Monty Taylor
Fixed silly my_bool==char nonsense.
183
                        const char *s, size_t s_length,
184
                        char escape, char w_one, char w_many,
185
                        size_t res_length,
186
                        char *min_str, char *max_str,
187
                        size_t *min_len, size_t *max_len);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
188
  int     (*wildcmp)(const struct charset_info_st * const,
1 by brian
clean slate
189
  		     const char *str,const char *str_end,
190
                     const char *wildstr,const char *wildend,
191
                     int escape,int w_one, int w_many);
192
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
193
  int  (*strcasecmp)(const struct charset_info_st * const, const char *, const char *);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
194
411 by Brian Aker
Removed legacy bits around enum.
195
  uint32_t (*instr)(const struct charset_info_st * const,
1 by brian
clean slate
196
                const char *b, size_t b_length,
197
                const char *s, size_t s_length,
411 by Brian Aker
Removed legacy bits around enum.
198
                my_match_t *match, uint32_t nmatch);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
199
1 by brian
clean slate
200
  /* Hash calculation */
481 by Brian Aker
Remove all of uchar.
201
  void (*hash_sort)(const struct charset_info_st *cs, const unsigned char *key, size_t len,
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
202
                    uint32_t *nr1, uint32_t *nr2);
481 by Brian Aker
Remove all of uchar.
203
  bool (*propagate)(const struct charset_info_st *cs, const unsigned char *str, size_t len);
1 by brian
clean slate
204
} MY_COLLATION_HANDLER;
205
206
extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
207
extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
208
extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
209
extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;
210
211
/* Some typedef to make it easy for C++ to make function pointers */
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
212
typedef int (*my_charset_conv_mb_wc)(const struct charset_info_st * const, my_wc_t *,
481 by Brian Aker
Remove all of uchar.
213
                                     const unsigned char *, const unsigned char *);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
214
typedef int (*my_charset_conv_wc_mb)(const struct charset_info_st * const, my_wc_t,
481 by Brian Aker
Remove all of uchar.
215
                                     unsigned char *, unsigned char *);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
216
typedef size_t (*my_charset_conv_case)(const struct charset_info_st * const,
1 by brian
clean slate
217
                                       char *, size_t, char *, size_t);
218
219
220
/* See strings/CHARSET_INFO.txt about information on this structure  */
221
typedef struct my_charset_handler_st
222
{
276 by Brian Aker
Cleaned out my_bool from strings.
223
  bool (*init)(struct charset_info_st *, void *(*alloc)(size_t));
1 by brian
clean slate
224
  /* Multibyte routines */
411 by Brian Aker
Removed legacy bits around enum.
225
  uint32_t    (*ismbchar)(const struct charset_info_st * const, const char *, const char *);
226
  uint32_t    (*mbcharlen)(const struct charset_info_st * const, uint32_t c);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
227
  size_t  (*numchars)(const struct charset_info_st * const, const char *b, const char *e);
228
  size_t  (*charpos)(const struct charset_info_st * const, const char *b, const char *e,
1 by brian
clean slate
229
                     size_t pos);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
230
  size_t  (*well_formed_len)(const struct charset_info_st * const,
1 by brian
clean slate
231
                             const char *b,const char *e,
232
                             size_t nchars, int *error);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
233
  size_t  (*lengthsp)(const struct charset_info_st * const, const char *ptr, size_t length);
234
  size_t  (*numcells)(const struct charset_info_st * const, const char *b, const char *e);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
235
1 by brian
clean slate
236
  /* Unicode conversion */
237
  my_charset_conv_mb_wc mb_wc;
238
  my_charset_conv_wc_mb wc_mb;
239
240
  /* CTYPE scanner */
236.3.9 by Andrey Hristov
- Fix build of exotic, mostly non-western, charsets (--with-extra-charsets)
241
  int (*ctype)(const struct charset_info_st *cs, int *ctype,
481 by Brian Aker
Remove all of uchar.
242
               const unsigned char *s, const unsigned char *e);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
243
1 by brian
clean slate
244
  /* Functions for case and sort conversion */
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
245
  size_t  (*caseup_str)(const struct charset_info_st * const, char *);
246
  size_t  (*casedn_str)(const struct charset_info_st * const, char *);
1 by brian
clean slate
247
248
  my_charset_conv_case caseup;
249
  my_charset_conv_case casedn;
250
251
  /* Charset dependant snprintf() */
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
252
  size_t (*snprintf)(const struct charset_info_st * const, char *to, size_t n,
1 by brian
clean slate
253
                     const char *fmt,
212.5.26 by Monty Taylor
Removed my_attribute. Renaming __attribute__((format(x,y,z))) to ATTRIBUTE_FORMAT(x,y,z) is retarded. So we don't do it anymore.
254
                     ...) __attribute__((format(printf, 4, 5)));
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
255
  size_t (*long10_to_str)(const struct charset_info_st * const, char *to, size_t n,
1 by brian
clean slate
256
                          int radix, long int val);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
257
  size_t (*int64_t10_to_str)(const struct charset_info_st * const, char *to, size_t n,
152 by Brian Aker
longlong replacement
258
                              int radix, int64_t val);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
259
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
260
  void (*fill)(const struct charset_info_st * const, char *to, size_t len, int fill);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
261
1 by brian
clean slate
262
  /* String-to-number conversion routines */
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
263
  long        (*strntol)(const struct charset_info_st * const, const char *s, size_t l,
264
			 int base, char **e, int *err);
612.2.4 by Monty Taylor
Moved some defines to config.h. Stopped including config.h directly anywhere.
265
  unsigned long      (*strntoul)(const struct charset_info_st * const, const char *s, size_t l,
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
266
			 int base, char **e, int *err);
267
  int64_t   (*strntoll)(const struct charset_info_st * const, const char *s, size_t l,
268
			 int base, char **e, int *err);
269
  uint64_t (*strntoull)(const struct charset_info_st * const, const char *s, size_t l,
270
			 int base, char **e, int *err);
271
  double      (*strntod)(const struct charset_info_st * const, char *s, size_t l, char **e,
1 by brian
clean slate
272
			 int *err);
236.3.9 by Andrey Hristov
- Fix build of exotic, mostly non-western, charsets (--with-extra-charsets)
273
  int64_t    (*strtoll10)(const struct charset_info_st *cs,
1 by brian
clean slate
274
                           const char *nptr, char **endptr, int *error);
236.3.9 by Andrey Hristov
- Fix build of exotic, mostly non-western, charsets (--with-extra-charsets)
275
  uint64_t   (*strntoull10rnd)(const struct charset_info_st *cs,
1 by brian
clean slate
276
                                const char *str, size_t length,
277
                                int unsigned_fl,
278
                                char **endptr, int *error);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
279
  size_t        (*scan)(const struct charset_info_st * const, const char *b, const char *e,
1 by brian
clean slate
280
                        int sq);
281
} MY_CHARSET_HANDLER;
282
283
extern MY_CHARSET_HANDLER my_charset_8bit_handler;
284
extern MY_CHARSET_HANDLER my_charset_ucs2_handler;
285
286
287
/* See strings/CHARSET_INFO.txt about information on this structure  */
288
typedef struct charset_info_st
289
{
411 by Brian Aker
Removed legacy bits around enum.
290
  uint32_t      number;
291
  uint32_t      primary_number;
292
  uint32_t      binary_number;
293
  uint32_t      state;
1 by brian
clean slate
294
  const char *csname;
295
  const char *name;
296
  const char *comment;
297
  const char *tailoring;
481 by Brian Aker
Remove all of uchar.
298
  unsigned char    *ctype;
299
  unsigned char    *to_lower;
300
  unsigned char    *to_upper;
301
  unsigned char    *sort_order;
206 by Brian Aker
Removed final uint dead types.
302
  uint16_t   *contractions;
303
  uint16_t   **sort_order_big;
304
  uint16_t      *tab_to_uni;
1 by brian
clean slate
305
  MY_UNI_IDX  *tab_from_uni;
306
  MY_UNICASE_INFO **caseinfo;
481 by Brian Aker
Remove all of uchar.
307
  unsigned char     *state_map;
308
  unsigned char     *ident_map;
411 by Brian Aker
Removed legacy bits around enum.
309
  uint32_t      strxfrm_multiply;
481 by Brian Aker
Remove all of uchar.
310
  unsigned char     caseup_multiply;
311
  unsigned char     casedn_multiply;
411 by Brian Aker
Removed legacy bits around enum.
312
  uint32_t      mbminlen;
313
  uint32_t      mbmaxlen;
206 by Brian Aker
Removed final uint dead types.
314
  uint16_t    min_sort_char;
315
  uint16_t    max_sort_char; /* For LIKE optimization */
481 by Brian Aker
Remove all of uchar.
316
  unsigned char     pad_char;
276 by Brian Aker
Cleaned out my_bool from strings.
317
  bool   escape_with_backslash_is_dangerous;
481 by Brian Aker
Remove all of uchar.
318
  unsigned char     levels_for_compare;
319
  unsigned char     levels_for_order;
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
320
1 by brian
clean slate
321
  MY_CHARSET_HANDLER *cset;
322
  MY_COLLATION_HANDLER *coll;
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
323
1 by brian
clean slate
324
} CHARSET_INFO;
520.6.7 by Monty Taylor
Moved a bunch of crap out of common_includes.
325
326
uint32_t strconvert(const CHARSET_INFO *from_cs, const char *from,
327
                const CHARSET_INFO *to_cs, char *to, uint32_t to_length,
328
                uint32_t *errors);
329
365.2.9 by Monty Taylor
Got rid of all instances of ~0
330
#define ILLEGAL_CHARSET_INFO_NUMBER (UINT32_MAX)
1 by brian
clean slate
331
332
333
extern CHARSET_INFO my_charset_bin;
334
extern CHARSET_INFO my_charset_filename;
335
extern CHARSET_INFO my_charset_latin1;
336
extern CHARSET_INFO my_charset_latin1_german2_ci;
337
extern CHARSET_INFO my_charset_latin1_bin;
338
extern CHARSET_INFO my_charset_latin2_czech_ci;
339
extern CHARSET_INFO my_charset_utf8mb3_bin;
340
extern CHARSET_INFO my_charset_utf8mb3_general_ci;
341
extern CHARSET_INFO my_charset_utf8mb3_unicode_ci;
342
extern CHARSET_INFO my_charset_utf8mb4_bin;
343
extern CHARSET_INFO my_charset_utf8mb4_general_ci;
344
extern CHARSET_INFO my_charset_utf8mb4_unicode_ci;
345
346
#define MY_UTF8MB3                 "utf8mb3"
347
#define MY_UTF8MB4                 "utf8"
348
#define my_charset_utf8_general_ci my_charset_utf8mb4_general_ci
349
#define my_charset_utf8_bin        my_charset_utf8mb4_bin
350
351
352
/* declarations for simple charsets */
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
353
extern size_t my_strnxfrm_simple(const CHARSET_INFO * const,
481 by Brian Aker
Remove all of uchar.
354
                                 unsigned char *dst, size_t dstlen, uint32_t nweights,
355
                                 const unsigned char *src, size_t srclen, uint32_t flags);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
356
size_t my_strnxfrmlen_simple(const CHARSET_INFO * const, size_t);
481 by Brian Aker
Remove all of uchar.
357
extern int  my_strnncoll_simple(const CHARSET_INFO * const, const unsigned char *, size_t,
358
				const unsigned char *, size_t, bool);
1 by brian
clean slate
359
481 by Brian Aker
Remove all of uchar.
360
extern int  my_strnncollsp_simple(const CHARSET_INFO * const, const unsigned char *, size_t,
361
                                  const unsigned char *, size_t,
276 by Brian Aker
Cleaned out my_bool from strings.
362
                                  bool diff_if_only_endspace_difference);
1 by brian
clean slate
363
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
364
extern void my_hash_sort_simple(const CHARSET_INFO * const cs,
481 by Brian Aker
Remove all of uchar.
365
				const unsigned char *key, size_t len,
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
366
				uint32_t *nr1, uint32_t *nr2);
1 by brian
clean slate
367
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
368
extern size_t my_lengthsp_8bit(const CHARSET_INFO * const cs, const char *ptr, size_t length);
1 by brian
clean slate
369
411 by Brian Aker
Removed legacy bits around enum.
370
extern uint32_t my_instr_simple(const CHARSET_INFO * const,
1 by brian
clean slate
371
                            const char *b, size_t b_length,
372
                            const char *s, size_t s_length,
411 by Brian Aker
Removed legacy bits around enum.
373
                            my_match_t *match, uint32_t nmatch);
1 by brian
clean slate
374
375
376
/* Functions for 8bit */
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
377
extern size_t my_caseup_str_8bit(const CHARSET_INFO * const, char *);
378
extern size_t my_casedn_str_8bit(const CHARSET_INFO * const, char *);
379
extern size_t my_caseup_8bit(const CHARSET_INFO * const, char *src, size_t srclen,
380
                             char *dst, size_t dstlen);
381
extern size_t my_casedn_8bit(const CHARSET_INFO * const, char *src, size_t srclen,
382
                             char *dst, size_t dstlen);
383
384
extern int my_strcasecmp_8bit(const CHARSET_INFO * const  cs, const char *, const char *);
385
481 by Brian Aker
Remove all of uchar.
386
int my_mb_wc_8bit(const CHARSET_INFO * const cs,my_wc_t *wc, const unsigned char *s,const unsigned char *e);
387
int my_wc_mb_8bit(const CHARSET_INFO * const cs,my_wc_t wc, unsigned char *s, unsigned char *e);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
388
481 by Brian Aker
Remove all of uchar.
389
int my_mb_ctype_8bit(const CHARSET_INFO * const,int *, const unsigned char *,const unsigned char *);
390
int my_mb_ctype_mb(const CHARSET_INFO * const,int *, const unsigned char *,const unsigned char *);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
391
392
size_t my_scan_8bit(const CHARSET_INFO * const cs, const char *b, const char *e, int sq);
393
394
size_t my_snprintf_8bit(const CHARSET_INFO * const, char *to, size_t n,
1 by brian
clean slate
395
                        const char *fmt, ...)
212.5.26 by Monty Taylor
Removed my_attribute. Renaming __attribute__((format(x,y,z))) to ATTRIBUTE_FORMAT(x,y,z) is retarded. So we don't do it anymore.
396
  __attribute__((format(printf, 4, 5)));
1 by brian
clean slate
397
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
398
long       my_strntol_8bit(const CHARSET_INFO * const, const char *s, size_t l, int base,
1 by brian
clean slate
399
                           char **e, int *err);
612.2.4 by Monty Taylor
Moved some defines to config.h. Stopped including config.h directly anywhere.
400
unsigned long      my_strntoul_8bit(const CHARSET_INFO * const, const char *s, size_t l, int base,
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
401
			    char **e, int *err);
402
int64_t   my_strntoll_8bit(const CHARSET_INFO * const, const char *s, size_t l, int base,
403
			    char **e, int *err);
404
uint64_t my_strntoull_8bit(const CHARSET_INFO * const, const char *s, size_t l, int base,
405
			    char **e, int *err);
406
double      my_strntod_8bit(const CHARSET_INFO * const, char *s, size_t l,char **e,
1 by brian
clean slate
407
			    int *err);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
408
size_t my_long10_to_str_8bit(const CHARSET_INFO * const, char *to, size_t l, int radix,
1 by brian
clean slate
409
                             long int val);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
410
size_t my_int64_t10_to_str_8bit(const CHARSET_INFO * const, char *to, size_t l, int radix,
152 by Brian Aker
longlong replacement
411
                                 int64_t val);
1 by brian
clean slate
412
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
413
int64_t my_strtoll10_8bit(const CHARSET_INFO * const cs,
1 by brian
clean slate
414
                           const char *nptr, char **endptr, int *error);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
415
int64_t my_strtoll10_ucs2(CHARSET_INFO *cs,
1 by brian
clean slate
416
                           const char *nptr, char **endptr, int *error);
417
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
418
uint64_t my_strntoull10rnd_8bit(const CHARSET_INFO * const cs,
1 by brian
clean slate
419
                                 const char *str, size_t length, int
420
                                 unsigned_fl, char **endptr, int *error);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
421
uint64_t my_strntoull10rnd_ucs2(CHARSET_INFO *cs,
1 by brian
clean slate
422
                                 const char *str, size_t length,
423
                                 int unsigned_fl, char **endptr, int *error);
424
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
425
void my_fill_8bit(const CHARSET_INFO * const cs, char* to, size_t l, int fill);
1 by brian
clean slate
426
276 by Brian Aker
Cleaned out my_bool from strings.
427
bool  my_like_range_simple(const CHARSET_INFO * const cs,
1 by brian
clean slate
428
			      const char *ptr, size_t ptr_length,
77.1.95 by Monty Taylor
Fixed silly my_bool==char nonsense.
429
			      char escape, char w_one, char w_many,
1 by brian
clean slate
430
			      size_t res_length,
431
			      char *min_str, char *max_str,
432
			      size_t *min_length, size_t *max_length);
433
276 by Brian Aker
Cleaned out my_bool from strings.
434
bool  my_like_range_mb(const CHARSET_INFO * const cs,
1 by brian
clean slate
435
			  const char *ptr, size_t ptr_length,
77.1.95 by Monty Taylor
Fixed silly my_bool==char nonsense.
436
			  char escape, char w_one, char w_many,
1 by brian
clean slate
437
			  size_t res_length,
438
			  char *min_str, char *max_str,
439
			  size_t *min_length, size_t *max_length);
440
276 by Brian Aker
Cleaned out my_bool from strings.
441
bool  my_like_range_ucs2(const CHARSET_INFO * const cs,
1 by brian
clean slate
442
			    const char *ptr, size_t ptr_length,
77.1.95 by Monty Taylor
Fixed silly my_bool==char nonsense.
443
			    char escape, char w_one, char w_many,
1 by brian
clean slate
444
			    size_t res_length,
445
			    char *min_str, char *max_str,
446
			    size_t *min_length, size_t *max_length);
447
276 by Brian Aker
Cleaned out my_bool from strings.
448
bool  my_like_range_utf16(const CHARSET_INFO * const cs,
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
449
			     const char *ptr, size_t ptr_length,
450
			     char escape, char w_one, char w_many,
451
			     size_t res_length,
452
			     char *min_str, char *max_str,
453
			     size_t *min_length, size_t *max_length);
454
276 by Brian Aker
Cleaned out my_bool from strings.
455
bool  my_like_range_utf32(const CHARSET_INFO * const cs,
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
456
			     const char *ptr, size_t ptr_length,
457
			     char escape, char w_one, char w_many,
458
			     size_t res_length,
459
			     char *min_str, char *max_str,
460
			     size_t *min_length, size_t *max_length);
461
462
463
int my_wildcmp_8bit(const CHARSET_INFO * const,
1 by brian
clean slate
464
		    const char *str,const char *str_end,
465
		    const char *wildstr,const char *wildend,
466
		    int escape, int w_one, int w_many);
467
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
468
int my_wildcmp_bin(const CHARSET_INFO * const,
1 by brian
clean slate
469
		   const char *str,const char *str_end,
470
		   const char *wildstr,const char *wildend,
471
		   int escape, int w_one, int w_many);
472
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
473
size_t my_numchars_8bit(const CHARSET_INFO * const, const char *b, const char *e);
474
size_t my_numcells_8bit(const CHARSET_INFO * const, const char *b, const char *e);
475
size_t my_charpos_8bit(const CHARSET_INFO * const, const char *b, const char *e, size_t pos);
476
size_t my_well_formed_len_8bit(const CHARSET_INFO * const, const char *b, const char *e,
1 by brian
clean slate
477
                             size_t pos, int *error);
632.1.10 by Monty Taylor
Got rid of Sun Studio warnings.
478
typedef  void *(*cs_alloc_func)(size_t);
479
bool my_coll_init_simple(CHARSET_INFO *cs, cs_alloc_func alloc);
480
bool my_cset_init_8bit(CHARSET_INFO *cs, cs_alloc_func alloc);
411 by Brian Aker
Removed legacy bits around enum.
481
uint32_t my_mbcharlen_8bit(const CHARSET_INFO * const, uint32_t c);
1 by brian
clean slate
482
483
484
/* Functions for multibyte charsets */
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
485
extern size_t my_caseup_str_mb(const CHARSET_INFO * const, char *);
486
extern size_t my_casedn_str_mb(const CHARSET_INFO * const, char *);
487
extern size_t my_caseup_mb(const CHARSET_INFO * const, char *src, size_t srclen,
488
                                         char *dst, size_t dstlen);
489
extern size_t my_casedn_mb(const CHARSET_INFO * const, char *src, size_t srclen,
490
                                         char *dst, size_t dstlen);
491
extern int my_strcasecmp_mb(const CHARSET_INFO * const  cs, const char *s, const char *t);
1 by brian
clean slate
492
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
493
int my_wildcmp_mb(const CHARSET_INFO * const,
1 by brian
clean slate
494
		  const char *str,const char *str_end,
495
		  const char *wildstr,const char *wildend,
496
		  int escape, int w_one, int w_many);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
497
size_t my_numchars_mb(const CHARSET_INFO * const, const char *b, const char *e);
498
size_t my_numcells_mb(const CHARSET_INFO * const, const char *b, const char *e);
499
size_t my_charpos_mb(const CHARSET_INFO * const, const char *b, const char *e, size_t pos);
500
size_t my_well_formed_len_mb(const CHARSET_INFO * const, const char *b, const char *e,
1 by brian
clean slate
501
                             size_t pos, int *error);
411 by Brian Aker
Removed legacy bits around enum.
502
uint32_t my_instr_mb(const CHARSET_INFO * const,
1 by brian
clean slate
503
                 const char *b, size_t b_length,
504
                 const char *s, size_t s_length,
411 by Brian Aker
Removed legacy bits around enum.
505
                 my_match_t *match, uint32_t nmatch);
1 by brian
clean slate
506
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
507
int my_strnncoll_mb_bin(const CHARSET_INFO * const  cs,
481 by Brian Aker
Remove all of uchar.
508
                        const unsigned char *s, size_t slen,
509
                        const unsigned char *t, size_t tlen,
276 by Brian Aker
Cleaned out my_bool from strings.
510
                        bool t_is_prefix);
1 by brian
clean slate
511
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
512
int my_strnncollsp_mb_bin(const CHARSET_INFO * const cs,
481 by Brian Aker
Remove all of uchar.
513
                          const unsigned char *a, size_t a_length,
514
                          const unsigned char *b, size_t b_length,
276 by Brian Aker
Cleaned out my_bool from strings.
515
                          bool diff_if_only_endspace_difference);
1 by brian
clean slate
516
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
517
int my_wildcmp_mb_bin(const CHARSET_INFO * const cs,
1 by brian
clean slate
518
                      const char *str,const char *str_end,
519
                      const char *wildstr,const char *wildend,
520
                      int escape, int w_one, int w_many);
521
647 by Brian Aker
Clean up of code for Solaris (removed dead lock call).
522
int my_strcasecmp_mb_bin(const CHARSET_INFO * const, const char *s, const char *t);
1 by brian
clean slate
523
647 by Brian Aker
Clean up of code for Solaris (removed dead lock call).
524
void my_hash_sort_mb_bin(const CHARSET_INFO *,
481 by Brian Aker
Remove all of uchar.
525
                         const unsigned char *key, size_t len, uint32_t *nr1, uint32_t *nr2);
1 by brian
clean slate
526
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
527
size_t my_strnxfrm_mb(const CHARSET_INFO * const,
481 by Brian Aker
Remove all of uchar.
528
                      unsigned char *dst, size_t dstlen, uint32_t nweights,
529
                      const unsigned char *src, size_t srclen, uint32_t flags);
1 by brian
clean slate
530
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
531
int my_wildcmp_unicode(const CHARSET_INFO * const cs,
1 by brian
clean slate
532
                       const char *str, const char *str_end,
533
                       const char *wildstr, const char *wildend,
534
                       int escape, int w_one, int w_many,
535
                       MY_UNICASE_INFO **weights);
536
276 by Brian Aker
Cleaned out my_bool from strings.
537
extern bool my_parse_charset_xml(const char *bug, size_t len,
1 by brian
clean slate
538
				    int (*add)(CHARSET_INFO *cs));
539
481 by Brian Aker
Remove all of uchar.
540
bool my_propagate_simple(const CHARSET_INFO * const cs, const unsigned char *str, size_t len);
541
bool my_propagate_complex(const CHARSET_INFO * const cs, const unsigned char *str, size_t len);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
542
543
612.2.4 by Monty Taylor
Moved some defines to config.h. Stopped including config.h directly anywhere.
544
uint32_t my_string_repertoire(const CHARSET_INFO * const cs, const char *str, unsigned long len);
276 by Brian Aker
Cleaned out my_bool from strings.
545
bool my_charset_is_ascii_based(const CHARSET_INFO * const cs);
546
bool my_charset_is_8bit_pure_ascii(const CHARSET_INFO * const cs);
1 by brian
clean slate
547
548
411 by Brian Aker
Removed legacy bits around enum.
549
uint32_t my_strxfrm_flag_normalize(uint32_t flags, uint32_t nlevels);
481 by Brian Aker
Remove all of uchar.
550
void my_strxfrm_desc_and_reverse(unsigned char *str, unsigned char *strend,
411 by Brian Aker
Removed legacy bits around enum.
551
                                 uint32_t flags, uint32_t level);
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
552
size_t my_strxfrm_pad_desc_and_reverse(const CHARSET_INFO * const cs,
481 by Brian Aker
Remove all of uchar.
553
                                       unsigned char *str, unsigned char *frmend, unsigned char *strend,
411 by Brian Aker
Removed legacy bits around enum.
554
                                       uint32_t nweights, uint32_t flags, uint32_t level);
1 by brian
clean slate
555
276 by Brian Aker
Cleaned out my_bool from strings.
556
bool my_charset_is_ascii_compatible(const CHARSET_INFO * const cs);
1 by brian
clean slate
557
632.1.10 by Monty Taylor
Got rid of Sun Studio warnings.
558
int
559
my_strnncoll_utf8mb3(const CHARSET_INFO * const cs,
560
                     const unsigned char *s, size_t slen,
561
                     const unsigned char *t, size_t tlen,
562
                     bool t_is_prefix);
563
564
int
565
my_strnncollsp_utf8mb3(const CHARSET_INFO * const cs,
566
                       const unsigned char *s, size_t slen,
567
                       const unsigned char *t, size_t tlen,
568
                       bool diff_if_only_endspace_difference);
569
570
size_t
571
my_strnxfrm_utf8mb3(const CHARSET_INFO * const cs,
572
                    unsigned char *dst, size_t dstlen, uint32_t nweights,
573
                    const unsigned char *src, size_t srclen, uint32_t flags);
574
575
size_t
576
my_strnxfrmlen_utf8mb3(const CHARSET_INFO * const cs, size_t len);
577
578
size_t my_strnxfrm_utf8mb3_bin(const CHARSET_INFO * const cs,
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
579
                               unsigned char *dst, size_t dstlen,
632.1.10 by Monty Taylor
Got rid of Sun Studio warnings.
580
                               uint32_t nweights, const unsigned char *src,
581
                               size_t srclen, uint32_t flags);
582
/*
583
  Compare 0-terminated UTF8 strings.
584
585
  SYNOPSIS
586
    my_strcasecmp_utf8mb3()
587
    cs                  character set handler
588
    s                   First 0-terminated string to compare
589
    t                   Second 0-terminated string to compare
590
591
  IMPLEMENTATION
592
593
  RETURN
594
    - negative number if s < t
595
    - positive number if s > t
596
    - 0 is the strings are equal
597
*/
598
int
599
my_strcasecmp_utf8mb3(const CHARSET_INFO * const cs,
600
                      const char *s, const char *t);
601
602
int
603
my_strnncoll_utf8mb3_cs(CHARSET_INFO *cs,
604
                        const unsigned char *s, size_t slen,
605
                        const unsigned char *t, size_t tlen,
606
                        bool t_is_prefix);
607
608
int
609
my_strnncollsp_utf8mb3_cs(CHARSET_INFO *cs,
610
                          const unsigned char *s, size_t slen,
611
                          const unsigned char *t, size_t tlen,
612
                          bool diff_if_only_endspace_difference);
613
614
int
615
my_wildcmp_utf8mb3(const CHARSET_INFO * const cs,
616
                   const char *str,const char *str_end,
617
                   const char *wildstr,const char *wildend,
618
                   int escape, int w_one, int w_many);
619
620
unsigned int
621
my_ismbchar_utf8mb3(const CHARSET_INFO * const cs,
622
                    const char *b, const char *e);
623
624
int
625
my_wc_mb_filename(const CHARSET_INFO * const,
626
                  my_wc_t wc, unsigned char *s, unsigned char *e);
627
628
int
629
my_mb_wc_filename(const CHARSET_INFO * const,
630
                  my_wc_t *pwc, const unsigned char *s, const unsigned char *e);
631
632
size_t
633
my_caseup_str_utf8mb3(const CHARSET_INFO * const cs, char *src);
634
size_t
635
my_casedn_str_utf8mb3(const CHARSET_INFO * const cs, char *src);
636
size_t
637
my_caseup_utf8mb3(const CHARSET_INFO * const cs, char *src, size_t srclen,
638
                  char *dst, size_t dstlen);
639
size_t
640
my_casedn_utf8mb3(const CHARSET_INFO * const cs, char *src, size_t srclen,
641
                  char *dst, size_t dstlen);
642
643
int my_mb_wc_utf8mb3(const CHARSET_INFO * const, my_wc_t * pwc,
644
                     const unsigned char *s, const unsigned char *e);
645
int my_wc_mb_utf8mb3(const CHARSET_INFO * const,
646
                     my_wc_t wc, unsigned char *r, unsigned char *e);
647
648
unsigned int
649
my_mbcharlen_utf8mb3(const CHARSET_INFO * const, uint32_t c);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
650
632.1.10 by Monty Taylor
Got rid of Sun Studio warnings.
651
unsigned int my_ismbchar_utf8mb4(const CHARSET_INFO * const cs,                                  const char *b, const char *e);
652
unsigned int my_mbcharlen_utf8mb4(const CHARSET_INFO * const, uint32_t c);
653
654
size_t my_strnxfrmlen_utf8mb4(const CHARSET_INFO * const, size_t len);
655
size_t
656
my_strnxfrm_utf8mb4(const CHARSET_INFO * const cs,
657
                    unsigned char *dst, size_t dstlen, uint32_t nweights,
658
                    const unsigned char *src, size_t srclen, uint32_t flags);
659
660
int
661
my_wildcmp_utf8mb4(const CHARSET_INFO * const cs,
662
                   const char *str, const char *strend,
663
                   const char *wildstr, const char *wildend,
664
                   int escape, int w_one, int w_many);
665
int
666
my_strnncollsp_utf8mb4(const CHARSET_INFO * const cs,
667
                       const unsigned char *s, size_t slen,
668
                       const unsigned char *t, size_t tlen,
669
                       bool diff_if_only_endspace_difference);
670
int my_strcasecmp_utf8mb4(const CHARSET_INFO * const cs,
671
                          const char *s, const char *t);
672
673
int
674
my_strnncoll_utf8mb4(const CHARSET_INFO * const cs,
675
                     const unsigned char *s, size_t slen,
676
                     const unsigned char *t, size_t tlen,
677
                     bool t_is_prefix);
678
679
int
680
my_mb_wc_utf8mb4(const CHARSET_INFO * const cs,
681
                 my_wc_t * pwc, const unsigned char *s, const unsigned char *e);
682
683
int
684
my_wc_mb_utf8mb4(const CHARSET_INFO * const cs,
685
                 my_wc_t wc, unsigned char *r, unsigned char *e);
686
687
size_t my_caseup_str_utf8mb4(const CHARSET_INFO * const cs, char *src);
688
size_t my_casedn_str_utf8mb4(const CHARSET_INFO * const cs, char *src);
689
690
size_t
691
my_caseup_utf8mb4(const CHARSET_INFO * const cs, char *src, size_t srclen,
692
                  char *dst, size_t dstlen);
693
size_t
694
my_casedn_utf8mb4(const CHARSET_INFO * const cs,
695
                  char *src, size_t srclen,
696
                  char *dst, size_t dstlen);
697
698
699
bool my_coll_init_uca(CHARSET_INFO *cs, cs_alloc_func alloc);
700
701
int my_strnncoll_any_uca(const CHARSET_INFO * const cs,
702
                         const unsigned char *s, size_t slen,
703
                         const unsigned char *t, size_t tlen,
704
                         bool t_is_prefix);
705
706
int my_strnncollsp_any_uca(const CHARSET_INFO * const cs,
707
                           const unsigned char *s, size_t slen,
708
                           const unsigned char *t, size_t tlen,
709
                           bool diff_if_only_endspace_difference);
710
711
void my_hash_sort_any_uca(const CHARSET_INFO * const cs,
712
                          const unsigned char *s, size_t slen,
713
                          uint32_t *n1, uint32_t *n2);
714
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
715
size_t my_strnxfrm_any_uca(const CHARSET_INFO * const cs,
632.1.10 by Monty Taylor
Got rid of Sun Studio warnings.
716
                           unsigned char *dst, size_t dstlen, uint32_t nweights,
717
                           const unsigned char *src, size_t srclen,
718
                           uint32_t flags);
719
720
int my_wildcmp_uca(const CHARSET_INFO * const cs,
721
                   const char *str,const char *str_end,
722
                   const char *wildstr,const char *wildend,
723
                   int escape, int w_one, int w_many);
724
725
int my_strnncoll_8bit_bin(const CHARSET_INFO * const,
726
                          const unsigned char *s, size_t slen,
727
                          const unsigned char *t, size_t tlen,
728
                          bool t_is_prefix);
729
int my_strnncollsp_8bit_bin(const CHARSET_INFO * const,
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
730
                            const unsigned char *a, size_t a_length,
632.1.10 by Monty Taylor
Got rid of Sun Studio warnings.
731
                            const unsigned char *b, size_t b_length,
732
                            bool diff_if_only_endspace_difference);
733
size_t my_case_str_bin(const CHARSET_INFO * const, char *);
734
size_t my_case_bin(const CHARSET_INFO * const, char *,
735
                   size_t srclen, char *, size_t);
736
int my_strcasecmp_bin(const CHARSET_INFO * const,
737
                      const char *s, const char *t);
738
size_t
739
my_strnxfrm_8bit_bin(const CHARSET_INFO * const cs,
740
                     unsigned char * dst, size_t dstlen, uint32_t nweights,
741
                     const unsigned char *src, size_t srclen, uint32_t flags);
742
uint32_t my_instr_bin(const CHARSET_INFO * const,
743
                      const char *b, size_t b_length,
744
                      const char *s, size_t s_length,
745
                      my_match_t *match, uint32_t nmatch);
746
size_t my_lengthsp_binary(const CHARSET_INFO * const,
747
                          const char *, size_t length);
748
int my_mb_wc_bin(const CHARSET_INFO * const,
749
                 my_wc_t *wc, const unsigned char *str,
750
                 const unsigned char *end);
751
int my_wc_mb_bin(const CHARSET_INFO * const, my_wc_t wc,
752
                 unsigned char *str, unsigned char *end);
753
void my_hash_sort_8bit_bin(const CHARSET_INFO * const,
754
                           const unsigned char *key, size_t len,
755
                           uint32_t *nr1, uint32_t *nr2);
756
bool my_coll_init_8bit_bin(CHARSET_INFO *cs,
757
                           cs_alloc_func);
758
int my_strnncoll_binary(const CHARSET_INFO * const,
759
                        const unsigned char *s, size_t slen,
760
                        const unsigned char *t, size_t tlen,
761
                        bool t_is_prefix);
762
int my_strnncollsp_binary(const CHARSET_INFO * const cs,
763
                          const unsigned char *s, size_t slen,
764
                          const unsigned char *t, size_t tlen,
765
                          bool);
766
767
1 by brian
clean slate
768
#define	_MY_U	01	/* Upper case */
769
#define	_MY_L	02	/* Lower case */
770
#define	_MY_NMR	04	/* Numeral (digit) */
771
#define	_MY_SPC	010	/* Spacing character */
772
#define	_MY_PNT	020	/* Punctuation */
773
#define	_MY_CTR	040	/* Control character */
774
#define	_MY_B	0100	/* Blank */
775
#define	_MY_X	0200	/* heXadecimal digit */
776
777
778
#define	my_isascii(c)	(!((c) & ~0177))
779
#define	my_toascii(c)	((c) & 0177)
780
#define my_tocntrl(c)	((c) & 31)
781
#define my_toprint(c)	((c) | 64)
481 by Brian Aker
Remove all of uchar.
782
#define my_toupper(s,c)	(char) ((s)->to_upper[(unsigned char) (c)])
783
#define my_tolower(s,c)	(char) ((s)->to_lower[(unsigned char) (c)])
784
#define	my_isalpha(s, c)  (((s)->ctype+1)[(unsigned char) (c)] & (_MY_U | _MY_L))
785
#define	my_isupper(s, c)  (((s)->ctype+1)[(unsigned char) (c)] & _MY_U)
786
#define	my_islower(s, c)  (((s)->ctype+1)[(unsigned char) (c)] & _MY_L)
787
#define	my_isdigit(s, c)  (((s)->ctype+1)[(unsigned char) (c)] & _MY_NMR)
788
#define	my_isxdigit(s, c) (((s)->ctype+1)[(unsigned char) (c)] & _MY_X)
789
#define	my_isalnum(s, c)  (((s)->ctype+1)[(unsigned char) (c)] & (_MY_U | _MY_L | _MY_NMR))
790
#define	my_isspace(s, c)  (((s)->ctype+1)[(unsigned char) (c)] & _MY_SPC)
791
#define	my_ispunct(s, c)  (((s)->ctype+1)[(unsigned char) (c)] & _MY_PNT)
792
#define	my_isprint(s, c)  (((s)->ctype+1)[(unsigned char) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B))
793
#define	my_isgraph(s, c)  (((s)->ctype+1)[(unsigned char) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR))
794
#define	my_iscntrl(s, c)  (((s)->ctype+1)[(unsigned char) (c)] & _MY_CTR)
1 by brian
clean slate
795
796
/* Some macros that should be cleaned up a little */
797
#define my_isvar(s,c)                 (my_isalnum(s,c) || (c) == '_')
798
#define my_isvar_start(s,c)           (my_isalpha(s,c) || (c) == '_')
799
800
#define my_binary_compare(s)	      ((s)->state  & MY_CS_BINSORT)
801
#define use_strnxfrm(s)               ((s)->state  & MY_CS_STRNXFRM)
802
#define my_strnxfrm(cs, d, dl, s, sl) \
803
   ((cs)->coll->strnxfrm((cs), (d), (dl), (dl), (s), (sl), MY_STRXFRM_PAD_WITH_SPACE))
804
#define my_strnncoll(s, a, b, c, d) ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0))
805
#define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \
806
   ((s)->coll->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h), (i), (j)))
807
#define my_wildcmp(cs,s,se,w,we,e,o,m) ((cs)->coll->wildcmp((cs),(s),(se),(w),(we),(e),(o),(m)))
808
#define my_strcasecmp(s, a, b)        ((s)->coll->strcasecmp((s), (a), (b)))
809
#define my_charpos(cs, b, e, num)     (cs)->cset->charpos((cs), (const char*) (b), (const char *)(e), (num))
810
811
812
#define use_mb(s)                     ((s)->cset->ismbchar != NULL)
813
#define my_ismbchar(s, a, b)          ((s)->cset->ismbchar((s), (a), (b)))
814
#ifdef USE_MB
815
#define my_mbcharlen(s, a)            ((s)->cset->mbcharlen((s),(a)))
816
#else
817
#define my_mbcharlen(s, a)            1
818
#endif
819
820
#define my_caseup_str(s, a)           ((s)->cset->caseup_str((s), (a)))
821
#define my_casedn_str(s, a)           ((s)->cset->casedn_str((s), (a)))
822
#define my_strntol(s, a, b, c, d, e)  ((s)->cset->strntol((s),(a),(b),(c),(d),(e)))
823
#define my_strntoul(s, a, b, c, d, e) ((s)->cset->strntoul((s),(a),(b),(c),(d),(e)))
824
#define my_strntoll(s, a, b, c, d, e) ((s)->cset->strntoll((s),(a),(b),(c),(d),(e)))
825
#define my_strntoull(s, a, b, c,d, e) ((s)->cset->strntoull((s),(a),(b),(c),(d),(e)))
826
#define my_strntod(s, a, b, c, d)     ((s)->cset->strntod((s),(a),(b),(c),(d)))
827
828
829
/* XXX: still need to take care of this one */
830
#ifdef MY_CHARSET_TIS620
831
#error The TIS620 charset is broken at the moment.  Tell tim to fix it.
832
#define USE_TIS620
212.5.19 by Monty Taylor
Coupla small include cleanups.
833
#include <mystrings/t_ctype.h>
1 by brian
clean slate
834
#endif
835
836
#ifdef	__cplusplus
837
}
838
#endif
839
840
#endif /* _m_ctype_h */