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