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