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