#include <my_global.h>#include "m_string.h"#include "m_ctype.h"#include <errno.h>#include "stdarg.h"Include dependency graph for ctype-simple.c:

Go to the source code of this file.
Classes | |
| struct | uni_idx |
Defines | |
| #define | likeconv(s, A) (uchar) (s)->sort_order[(uchar) (A)] |
| #define | INC_PTR(cs, A, B) (A)++ |
| #define | PLANE_SIZE 0x100 |
| #define | PLANE_NUM 0x100 |
| #define | PLANE_NUMBER(x) (((x)>>8) % PLANE_NUM) |
Functions | |
| uint | my_strnxfrmlen_simple (CHARSET_INFO *cs, uint len) |
| int | my_strnxfrm_simple (CHARSET_INFO *cs, uchar *dest, uint len, const uchar *src, uint srclen) |
| int | my_strnncoll_simple (CHARSET_INFO *cs, const uchar *s, uint slen, const uchar *t, uint tlen, my_bool t_is_prefix) |
| int | my_strnncollsp_simple (CHARSET_INFO *cs, const uchar *a, uint a_length, const uchar *b, uint b_length, my_bool diff_if_only_endspace_difference) |
| void | my_caseup_str_8bit (CHARSET_INFO *cs, char *str) |
| void | my_casedn_str_8bit (CHARSET_INFO *cs, char *str) |
| uint | my_caseup_8bit (CHARSET_INFO *cs, char *src, uint srclen, char *dst __attribute__((unused)), uint dstlen __attribute__((unused))) |
| uint | my_casedn_8bit (CHARSET_INFO *cs, char *src, uint srclen, char *dst __attribute__((unused)), uint dstlen __attribute__((unused))) |
| int | my_strcasecmp_8bit (CHARSET_INFO *cs, const char *s, const char *t) |
| int | my_mb_wc_8bit (CHARSET_INFO *cs, my_wc_t *wc, const unsigned char *str, const unsigned char *end __attribute__((unused))) |
| int | my_wc_mb_8bit (CHARSET_INFO *cs, my_wc_t wc, unsigned char *str, unsigned char *end __attribute__((unused))) |
| int | my_snprintf_8bit (CHARSET_INFO *cs __attribute__((unused)), char *to, uint n __attribute__((unused)), const char *fmt,...) |
| void | my_hash_sort_simple (CHARSET_INFO *cs, const uchar *key, uint len, ulong *nr1, ulong *nr2) |
| long | my_strntol_8bit (CHARSET_INFO *cs, const char *nptr, uint l, int base, char **endptr, int *err) |
| ulong | my_strntoul_8bit (CHARSET_INFO *cs, const char *nptr, uint l, int base, char **endptr, int *err) |
| longlong | my_strntoll_8bit (CHARSET_INFO *cs __attribute__((unused)), const char *nptr, uint l, int base, char **endptr, int *err) |
| ulonglong | my_strntoull_8bit (CHARSET_INFO *cs, const char *nptr, uint l, int base, char **endptr, int *err) |
| double | my_strntod_8bit (CHARSET_INFO *cs __attribute__((unused)), char *str, uint length, char **end, int *err) |
| int | my_long10_to_str_8bit (CHARSET_INFO *cs __attribute__((unused)), char *dst, uint len, int radix, long int val) |
| int | my_longlong10_to_str_8bit (CHARSET_INFO *cs __attribute__((unused)), char *dst, uint len, int radix, longlong val) |
| int | my_wildcmp_8bit (CHARSET_INFO *cs, const char *str, const char *str_end, const char *wildstr, const char *wildend, int escape, int w_one, int w_many) |
| my_bool | my_like_range_simple (CHARSET_INFO *cs, const char *ptr, uint ptr_length, pbool escape, pbool w_one, pbool w_many, uint res_length, char *min_str, char *max_str, uint *min_length, uint *max_length) |
| ulong | my_scan_8bit (CHARSET_INFO *cs, const char *str, const char *end, int sq) |
| void | my_fill_8bit (CHARSET_INFO *cs __attribute__((unused)), char *s, uint l, int fill) |
| uint | my_numchars_8bit (CHARSET_INFO *cs __attribute__((unused)), const char *b, const char *e) |
| uint | my_numcells_8bit (CHARSET_INFO *cs __attribute__((unused)), const char *b, const char *e) |
| uint | my_charpos_8bit (CHARSET_INFO *cs __attribute__((unused)), const char *b __attribute__((unused)), const char *e __attribute__((unused)), uint pos) |
| uint | my_well_formed_len_8bit (CHARSET_INFO *cs __attribute__((unused)), const char *start, const char *end, uint nchars, int *error) |
| uint | my_lengthsp_8bit (CHARSET_INFO *cs __attribute__((unused)), const char *ptr, uint length) |
| uint | my_instr_simple (CHARSET_INFO *cs, const char *b, uint b_length, const char *s, uint s_length, my_match_t *match, uint nmatch) |
| static int | pcmp (const void *f, const void *s) |
| static my_bool | create_fromuni (CHARSET_INFO *cs, void *(*alloc)(uint)) |
| static my_bool | my_cset_init_8bit (CHARSET_INFO *cs, void *(*alloc)(uint)) |
| static void | set_max_sort_char (CHARSET_INFO *cs) |
| static my_bool | my_coll_init_simple (CHARSET_INFO *cs, void *(*alloc)(uint) __attribute__((unused))) |
| longlong | my_strtoll10_8bit (CHARSET_INFO *cs __attribute__((unused)), const char *nptr, char **endptr, int *error) |
| int | my_mb_ctype_8bit (CHARSET_INFO *cs, int *ctype, const unsigned char *s, const unsigned char *e) |
| my_bool | my_propagate_simple (CHARSET_INFO *cs __attribute__((unused)), const uchar *str __attribute__((unused)), uint length __attribute__((unused))) |
| my_bool | my_propagate_complex (CHARSET_INFO *cs __attribute__((unused)), const uchar *str __attribute__((unused)), uint length __attribute__((unused))) |
Variables | |
| MY_CHARSET_HANDLER | my_charset_8bit_handler |
| MY_COLLATION_HANDLER | my_collation_8bit_simple_ci_handler |
Definition at line 931 of file ctype-simple.c.
| #define likeconv | ( | s, | |||
| A | ) | (uchar) (s)->sort_order[(uchar) (A)] |
Definition at line 928 of file ctype-simple.c.
| #define PLANE_NUM 0x100 |
| #define PLANE_SIZE 0x100 |
| static my_bool create_fromuni | ( | CHARSET_INFO * | cs, | |
| void *(*)(uint) | alloc | |||
| ) | [static] |
Definition at line 1236 of file ctype-simple.c.
References bzero, n, pcmp(), PLANE_NUM, PLANE_NUMBER, PLANE_SIZE, qsort(), charset_info_st::tab_to_uni, and TRUE.
Referenced by my_cset_init_8bit().
01237 { 01238 uni_idx idx[PLANE_NUM]; 01239 int i,n; 01240 01241 /* 01242 Check that Unicode map is loaded. 01243 It can be not loaded when the collation is 01244 listed in Index.xml but not specified 01245 in the character set specific XML file. 01246 */ 01247 if (!cs->tab_to_uni) 01248 return TRUE; 01249 01250 /* Clear plane statistics */ 01251 bzero(idx,sizeof(idx)); 01252 01253 /* Count number of characters in each plane */ 01254 for (i=0; i< 0x100; i++) 01255 { 01256 uint16 wc=cs->tab_to_uni[i]; 01257 int pl= PLANE_NUMBER(wc); 01258 01259 if (wc || !i) 01260 { 01261 if (!idx[pl].nchars) 01262 { 01263 idx[pl].uidx.from=wc; 01264 idx[pl].uidx.to=wc; 01265 }else 01266 { 01267 idx[pl].uidx.from=wc<idx[pl].uidx.from?wc:idx[pl].uidx.from; 01268 idx[pl].uidx.to=wc>idx[pl].uidx.to?wc:idx[pl].uidx.to; 01269 } 01270 idx[pl].nchars++; 01271 } 01272 } 01273 01274 /* Sort planes in descending order */ 01275 qsort(&idx,PLANE_NUM,sizeof(uni_idx),&pcmp); 01276 01277 for (i=0; i < PLANE_NUM; i++) 01278 { 01279 int ch,numchars; 01280 01281 /* Skip empty plane */ 01282 if (!idx[i].nchars) 01283 break; 01284 01285 numchars=idx[i].uidx.to-idx[i].uidx.from+1; 01286 if (!(idx[i].uidx.tab=(uchar*) alloc(numchars * sizeof(*idx[i].uidx.tab)))) 01287 return TRUE; 01288 01289 bzero(idx[i].uidx.tab,numchars*sizeof(*idx[i].uidx.tab)); 01290 01291 for (ch=1; ch < PLANE_SIZE; ch++) 01292 { 01293 uint16 wc=cs->tab_to_uni[ch]; 01294 if (wc >= idx[i].uidx.from && wc <= idx[i].uidx.to && wc) 01295 { 01296 int ofs= wc - idx[i].uidx.from; 01297 idx[i].uidx.tab[ofs]= ch; 01298 } 01299 } 01300 } 01301 01302 /* Allocate and fill reverse table for each plane */ 01303 n=i; 01304 if (!(cs->tab_from_uni= (MY_UNI_IDX*) alloc(sizeof(MY_UNI_IDX)*(n+1)))) 01305 return TRUE; 01306 01307 for (i=0; i< n; i++) 01308 cs->tab_from_uni[i]= idx[i].uidx; 01309 01310 /* Set end-of-list marker */ 01311 bzero(&cs->tab_from_uni[i],sizeof(MY_UNI_IDX)); 01312 return FALSE; 01313 }
Here is the call graph for this function:

Here is the caller graph for this function:

| uint my_casedn_8bit | ( | CHARSET_INFO * | cs, | |
| char * | src, | |||
| uint | srclen, | |||
| char *dst | __attribute__((unused)), | |||
| uint dstlen | __attribute__((unused)) | |||
| ) |
Definition at line 216 of file ctype-simple.c.
References DBUG_ASSERT, map, and charset_info_st::to_lower.
00219 { 00220 uint srclen0= srclen; 00221 register uchar *map=cs->to_lower; 00222 DBUG_ASSERT(src == dst && srclen == dstlen); 00223 for ( ; srclen > 0 ; srclen--, src++) 00224 *src= (char) map[(uchar) *src]; 00225 return srclen0; 00226 }
| void my_casedn_str_8bit | ( | CHARSET_INFO * | cs, | |
| char * | str | |||
| ) |
Definition at line 197 of file ctype-simple.c.
References map, and charset_info_st::to_lower.
00198 { 00199 register uchar *map=cs->to_lower; 00200 while ((*str = (char) map[(uchar)*str]) != 0) 00201 str++; 00202 }
| uint my_caseup_8bit | ( | CHARSET_INFO * | cs, | |
| char * | src, | |||
| uint | srclen, | |||
| char *dst | __attribute__((unused)), | |||
| uint dstlen | __attribute__((unused)) | |||
| ) |
Definition at line 204 of file ctype-simple.c.
References DBUG_ASSERT, map, and charset_info_st::to_upper.
00207 { 00208 uint srclen0= srclen; 00209 register uchar *map= cs->to_upper; 00210 DBUG_ASSERT(src == dst && srclen == dstlen); 00211 for ( ; srclen > 0 ; srclen--, src++) 00212 *src= (char) map[(uchar) *src]; 00213 return srclen0; 00214 }
| void my_caseup_str_8bit | ( | CHARSET_INFO * | cs, | |
| char * | str | |||
| ) |
Definition at line 190 of file ctype-simple.c.
References map, and charset_info_st::to_upper.
00191 { 00192 register uchar *map=cs->to_upper; 00193 while ((*str = (char) map[(uchar) *str]) != 0) 00194 str++; 00195 }
| uint my_charpos_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| const char *b | __attribute__((unused)), | |||
| const char *e | __attribute__((unused)), | |||
| uint | pos | |||
| ) |
| static my_bool my_coll_init_simple | ( | CHARSET_INFO * | cs, | |
| void * | (*)(uint) __attribute__ alloc((unused)) | |||
| ) | [static] |
Definition at line 1342 of file ctype-simple.c.
References FALSE, and set_max_sort_char().
01344 { 01345 set_max_sort_char(cs); 01346 return FALSE; 01347 }
Here is the call graph for this function:

| static my_bool my_cset_init_8bit | ( | CHARSET_INFO * | cs, | |
| void *(*)(uint) | alloc | |||
| ) | [static] |
Definition at line 1315 of file ctype-simple.c.
References charset_info_st::casedn_multiply, charset_info_st::caseup_multiply, create_fromuni(), and charset_info_st::pad_char.
01316 { 01317 cs->caseup_multiply= 1; 01318 cs->casedn_multiply= 1; 01319 cs->pad_char= ' '; 01320 return create_fromuni(cs, alloc); 01321 }
Here is the call graph for this function:

| void my_fill_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| char * | s, | |||
| uint | l, | |||
| int | fill | |||
| ) |
| void my_hash_sort_simple | ( | CHARSET_INFO * | cs, | |
| const uchar * | key, | |||
| uint | len, | |||
| ulong * | nr1, | |||
| ulong * | nr2 | |||
| ) |
Definition at line 289 of file ctype-simple.c.
References charset_info_st::sort_order, and sort_order.
00292 { 00293 register uchar *sort_order=cs->sort_order; 00294 const uchar *end= key + len; 00295 00296 /* 00297 Remove end space. We have to do this to be able to compare 00298 'A ' and 'A' as identical 00299 */ 00300 while (end > key && end[-1] == ' ') 00301 end--; 00302 00303 for (; key < (uchar*) end ; key++) 00304 { 00305 nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * 00306 ((uint) sort_order[(uint) *key])) + (nr1[0] << 8); 00307 nr2[0]+=3; 00308 } 00309 }
| uint my_instr_simple | ( | CHARSET_INFO * | cs, | |
| const char * | b, | |||
| uint | b_length, | |||
| const char * | s, | |||
| uint | s_length, | |||
| my_match_t * | match, | |||
| uint | nmatch | |||
| ) |
Definition at line 1155 of file ctype-simple.c.
References my_match_t::beg, my_match_t::end, my_match_t::mblen, search_end(), skip(), and charset_info_st::sort_order.
01159 { 01160 register const uchar *str, *search, *end, *search_end; 01161 01162 if (s_length <= b_length) 01163 { 01164 if (!s_length) 01165 { 01166 if (nmatch) 01167 { 01168 match->beg= 0; 01169 match->end= 0; 01170 match->mblen= 0; 01171 } 01172 return 1; /* Empty string is always found */ 01173 } 01174 01175 str= (const uchar*) b; 01176 search= (const uchar*) s; 01177 end= (const uchar*) b+b_length-s_length+1; 01178 search_end= (const uchar*) s + s_length; 01179 01180 skip: 01181 while (str != end) 01182 { 01183 if (cs->sort_order[*str++] == cs->sort_order[*search]) 01184 { 01185 register const uchar *i,*j; 01186 01187 i= str; 01188 j= search+1; 01189 01190 while (j != search_end) 01191 if (cs->sort_order[*i++] != cs->sort_order[*j++]) 01192 goto skip; 01193 01194 if (nmatch > 0) 01195 { 01196 match[0].beg= 0; 01197 match[0].end= (uint) (str- (const uchar*)b-1); 01198 match[0].mblen= match[0].end; 01199 01200 if (nmatch > 1) 01201 { 01202 match[1].beg= match[0].end; 01203 match[1].end= match[0].end+s_length; 01204 match[1].mblen= match[1].end-match[1].beg; 01205 } 01206 } 01207 return 2; 01208 } 01209 } 01210 } 01211 return 0; 01212 }
Here is the call graph for this function:

| uint my_lengthsp_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| const char * | ptr, | |||
| uint | length | |||
| ) |
Definition at line 1145 of file ctype-simple.c.
01147 { 01148 const char *end= ptr+length; 01149 while (end > ptr && end[-1] == ' ') 01150 end--; 01151 return (uint) (end-ptr); 01152 }
| my_bool my_like_range_simple | ( | CHARSET_INFO * | cs, | |
| const char * | ptr, | |||
| uint | ptr_length, | |||
| pbool | escape, | |||
| pbool | w_one, | |||
| pbool | w_many, | |||
| uint | res_length, | |||
| char * | min_str, | |||
| char * | max_str, | |||
| uint * | min_length, | |||
| uint * | max_length | |||
| ) |
Definition at line 1030 of file ctype-simple.c.
References charset_info_st::max_sort_char, charset_info_st::mbmaxlen, MY_CS_BINSORT, and charset_info_st::state.
01036 { 01037 const char *end= ptr + ptr_length; 01038 char *min_org=min_str; 01039 char *min_end=min_str+res_length; 01040 uint charlen= res_length / cs->mbmaxlen; 01041 01042 for (; ptr != end && min_str != min_end && charlen > 0 ; ptr++, charlen--) 01043 { 01044 if (*ptr == escape && ptr+1 != end) 01045 { 01046 ptr++; /* Skip escape */ 01047 *min_str++= *max_str++ = *ptr; 01048 continue; 01049 } 01050 if (*ptr == w_one) /* '_' in SQL */ 01051 { 01052 *min_str++='\0'; /* This should be min char */ 01053 *max_str++= (char) cs->max_sort_char; 01054 continue; 01055 } 01056 if (*ptr == w_many) /* '%' in SQL */ 01057 { 01058 /* Calculate length of keys */ 01059 *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : 01060 res_length); 01061 *max_length= res_length; 01062 do 01063 { 01064 *min_str++= 0; 01065 *max_str++= (char) cs->max_sort_char; 01066 } while (min_str != min_end); 01067 return 0; 01068 } 01069 *min_str++= *max_str++ = *ptr; 01070 } 01071 01072 *min_length= *max_length = (uint) (min_str - min_org); 01073 while (min_str != min_end) 01074 *min_str++= *max_str++ = ' '; /* Because if key compression */ 01075 return 0; 01076 }
| int my_long10_to_str_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| char * | dst, | |||
| uint | len, | |||
| int | radix, | |||
| long int | val | |||
| ) |
Definition at line 827 of file ctype-simple.c.
References buffer, e, memcpy, min, and p.
00829 { 00830 char buffer[66]; 00831 register char *p, *e; 00832 long int new_val; 00833 uint sign=0; 00834 00835 e = p = &buffer[sizeof(buffer)-1]; 00836 *p= 0; 00837 00838 if (radix < 0) 00839 { 00840 if (val < 0) 00841 { 00842 val= -val; 00843 *dst++= '-'; 00844 len--; 00845 sign= 1; 00846 } 00847 } 00848 00849 new_val = (long) ((unsigned long int) val / 10); 00850 *--p = '0'+ (char) ((unsigned long int) val - (unsigned long) new_val * 10); 00851 val = new_val; 00852 00853 while (val != 0) 00854 { 00855 new_val=val/10; 00856 *--p = '0' + (char) (val-new_val*10); 00857 val= new_val; 00858 } 00859 00860 len= min(len, (uint) (e-p)); 00861 memcpy(dst, p, len); 00862 return (int) len+sign; 00863 }
| int my_longlong10_to_str_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| char * | dst, | |||
| uint | len, | |||
| int | radix, | |||
| longlong | val | |||
| ) |
Definition at line 866 of file ctype-simple.c.
References buffer, e, memcpy, min, and p.
00868 { 00869 char buffer[65]; 00870 register char *p, *e; 00871 long long_val; 00872 uint sign= 0; 00873 00874 if (radix < 0) 00875 { 00876 if (val < 0) 00877 { 00878 val = -val; 00879 *dst++= '-'; 00880 len--; 00881 sign= 1; 00882 } 00883 } 00884 00885 e = p = &buffer[sizeof(buffer)-1]; 00886 *p= 0; 00887 00888 if (val == 0) 00889 { 00890 *--p= '0'; 00891 len= 1; 00892 goto cnv; 00893 } 00894 00895 while ((ulonglong) val > (ulonglong) LONG_MAX) 00896 { 00897 ulonglong quo=(ulonglong) val/(uint) 10; 00898 uint rem= (uint) (val- quo* (uint) 10); 00899 *--p = '0' + rem; 00900 val= quo; 00901 } 00902 00903 long_val= (long) val; 00904 while (long_val != 0) 00905 { 00906 long quo= long_val/10; 00907 *--p = (char) ('0' + (long_val - quo*10)); 00908 long_val= quo; 00909 } 00910 00911 len= min(len, (uint) (e-p)); 00912 cnv: 00913 memcpy(dst, p, len); 00914 return len+sign; 00915 }
| int my_mb_ctype_8bit | ( | CHARSET_INFO * | cs, | |
| int * | ctype, | |||
| const unsigned char * | s, | |||
| const unsigned char * | e | |||
| ) |
Definition at line 1357 of file ctype-simple.c.
References charset_info_st::ctype, and MY_CS_TOOSMALL.
01359 { 01360 if (s >= e) 01361 { 01362 *ctype= 0; 01363 return MY_CS_TOOSMALL; 01364 } 01365 *ctype= cs->ctype[*s + 1]; 01366 return 1; 01367 }
| int my_mb_wc_8bit | ( | CHARSET_INFO * | cs, | |
| my_wc_t * | wc, | |||
| const unsigned char * | str, | |||
| const unsigned char *end | __attribute__((unused)) | |||
| ) |
Definition at line 237 of file ctype-simple.c.
References MY_CS_TOOSMALL, and charset_info_st::tab_to_uni.
00240 { 00241 if (str >= end) 00242 return MY_CS_TOOSMALL; 00243 00244 *wc=cs->tab_to_uni[*str]; 00245 return (!wc[0] && str[0]) ? -1 : 1; 00246 }
| uint my_numcells_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| const char * | b, | |||
| const char * | e | |||
| ) |
| uint my_numchars_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| const char * | b, | |||
| const char * | e | |||
| ) |
| my_bool my_propagate_complex | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| const uchar *str | __attribute__((unused)), | |||
| uint length | __attribute__((unused)) | |||
| ) |
| my_bool my_propagate_simple | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| const uchar *str | __attribute__((unused)), | |||
| uint length | __attribute__((unused)) | |||
| ) |
| ulong my_scan_8bit | ( | CHARSET_INFO * | cs, | |
| const char * | str, | |||
| const char * | end, | |||
| int | sq | |||
| ) |
Definition at line 1079 of file ctype-simple.c.
References my_isspace, MY_SEQ_INTTAIL, and MY_SEQ_SPACES.
01080 { 01081 const char *str0= str; 01082 switch (sq) 01083 { 01084 case MY_SEQ_INTTAIL: 01085 if (*str == '.') 01086 { 01087 for(str++ ; str != end && *str == '0' ; str++); 01088 return (ulong) (str - str0); 01089 } 01090 return 0; 01091 01092 case MY_SEQ_SPACES: 01093 for ( ; str < end ; str++) 01094 { 01095 if (!my_isspace(cs,*str)) 01096 break; 01097 } 01098 return (ulong) (str - str0); 01099 default: 01100 return 0; 01101 } 01102 }
| int my_snprintf_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| char * | to, | |||
| uint n | __attribute__((unused)), | |||
| const char * | fmt, | |||
| ... | ||||
| ) |
Definition at line 276 of file ctype-simple.c.
References args, my_vsnprintf(), and n.
00279 { 00280 va_list args; 00281 int result; 00282 va_start(args,fmt); 00283 result= my_vsnprintf(to, n, fmt, args); 00284 va_end(args); 00285 return result; 00286 }
Here is the call graph for this function:

| int my_strcasecmp_8bit | ( | CHARSET_INFO * | cs, | |
| const char * | s, | |||
| const char * | t | |||
| ) |
Definition at line 228 of file ctype-simple.c.
References map, and charset_info_st::to_upper.
00229 { 00230 register uchar *map=cs->to_upper; 00231 while (map[(uchar) *s] == map[(uchar) *t++]) 00232 if (!*s++) return 0; 00233 return ((int) map[(uchar) s[0]] - (int) map[(uchar) t[-1]]); 00234 }
| int my_strnncoll_simple | ( | CHARSET_INFO * | cs, | |
| const uchar * | s, | |||
| uint | slen, | |||
| const uchar * | t, | |||
| uint | tlen, | |||
| my_bool | t_is_prefix | |||
| ) |
Definition at line 97 of file ctype-simple.c.
References map, and charset_info_st::sort_order.
00100 { 00101 int len = ( slen > tlen ) ? tlen : slen; 00102 uchar *map= cs->sort_order; 00103 if (t_is_prefix && slen > tlen) 00104 slen=tlen; 00105 while (len--) 00106 { 00107 if (map[*s++] != map[*t++]) 00108 return ((int) map[s[-1]] - (int) map[t[-1]]); 00109 } 00110 return (int) (slen - tlen); 00111 }
| int my_strnncollsp_simple | ( | CHARSET_INFO * | cs, | |
| const uchar * | a, | |||
| uint | a_length, | |||
| const uchar * | b, | |||
| uint | b_length, | |||
| my_bool | diff_if_only_endspace_difference | |||
| ) |
Definition at line 144 of file ctype-simple.c.
References map, min, charset_info_st::sort_order, and mySTL::swap().
00147 { 00148 const uchar *map= cs->sort_order, *end; 00149 uint length; 00150 int res; 00151 00152 #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE 00153 diff_if_only_endspace_difference= 0; 00154 #endif 00155 00156 end= a + (length= min(a_length, b_length)); 00157 while (a < end) 00158 { 00159 if (map[*a++] != map[*b++]) 00160 return ((int) map[a[-1]] - (int) map[b[-1]]); 00161 } 00162 res= 0; 00163 if (a_length != b_length) 00164 { 00165 int swap= 1; 00166 if (diff_if_only_endspace_difference) 00167 res= 1; /* Assume 'a' is bigger */ 00168 /* 00169 Check the next not space character of the longer key. If it's < ' ', 00170 then it's smaller than the other key. 00171 */ 00172 if (a_length < b_length) 00173 { 00174 /* put shorter key in s */ 00175 a_length= b_length; 00176 a= b; 00177 swap= -1; /* swap sign of result */ 00178 res= -res; 00179 } 00180 for (end= a + a_length-length; a < end ; a++) 00181 { 00182 if (*a != ' ') 00183 return (*a < ' ') ? -swap : swap; 00184 } 00185 } 00186 return res; 00187 }
Here is the call graph for this function:

| double my_strntod_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| char * | str, | |||
| uint | length, | |||
| char ** | end, | |||
| int * | err | |||
| ) |
Definition at line 810 of file ctype-simple.c.
References INT_MAX32, and my_strtod().
00813 { 00814 if (length == INT_MAX32) 00815 length= 65535; /* Should be big enough */ 00816 *end= str + length; 00817 return my_strtod(str, end, err); 00818 }
Here is the call graph for this function:

| long my_strntol_8bit | ( | CHARSET_INFO * | cs, | |
| const char * | nptr, | |||
| uint | l, | |||
| int | base, | |||
| char ** | endptr, | |||
| int * | err | |||
| ) |
Definition at line 312 of file ctype-simple.c.
References e, INT_MAX32, INT_MIN32, my_isspace, and NULL.
00315 { 00316 int negative; 00317 register uint32 cutoff; 00318 register unsigned int cutlim; 00319 register uint32 i; 00320 register const char *s; 00321 register unsigned char c; 00322 const char *save, *e; 00323 int overflow; 00324 00325 *err= 0; /* Initialize error indicator */ 00326 #ifdef NOT_USED 00327 if (base < 0 || base == 1 || base > 36) 00328 base = 10; 00329 #endif 00330 00331 s = nptr; 00332 e = nptr+l; 00333 00334 for ( ; s<e && my_isspace(cs, *s) ; s++); 00335 00336 if (s == e) 00337 { 00338 goto noconv; 00339 } 00340 00341 /* Check for a sign. */ 00342 if (*s == '-') 00343 { 00344 negative = 1; 00345 ++s; 00346 } 00347 else if (*s == '+') 00348 { 00349 negative = 0; 00350 ++s; 00351 } 00352 else 00353 negative = 0; 00354 00355 #ifdef NOT_USED 00356 if (base == 16 && s[0] == '0' && (s[1]=='X' || s[1]=='x')) 00357 s += 2; 00358 #endif 00359 00360 #ifdef NOT_USED 00361 if (base == 0) 00362 { 00363 if (*s == '0') 00364 { 00365 if (s[1]=='X' || s[1]=='x') 00366 { 00367 s += 2; 00368 base = 16; 00369 } 00370 else 00371 base = 8; 00372 } 00373 else 00374 base = 10; 00375 } 00376 #endif 00377 00378 save = s; 00379 cutoff = ((uint32)~0L) / (uint32) base; 00380 cutlim = (uint) (((uint32)~0L) % (uint32) base); 00381 00382 overflow = 0; 00383 i = 0; 00384 for (c = *s; s != e; c = *++s) 00385 { 00386 if (c>='0' && c<='9') 00387 c -= '0'; 00388 else if (c>='A' && c<='Z') 00389 c = c - 'A' + 10; 00390 else if (c>='a' && c<='z') 00391 c = c - 'a' + 10; 00392 else 00393 break; 00394 if (c >= base) 00395 break; 00396 if (i > cutoff || (i == cutoff && c > cutlim)) 00397 overflow = 1; 00398 else 00399 { 00400 i *= (uint32) base; 00401 i += c; 00402 } 00403 } 00404 00405 if (s == save) 00406 goto noconv; 00407 00408 if (endptr != NULL) 00409 *endptr = (char *) s; 00410 00411 if (negative) 00412 { 00413 if (i > (uint32) INT_MIN32) 00414 overflow = 1; 00415 } 00416 else if (i > INT_MAX32) 00417 overflow = 1; 00418 00419 if (overflow) 00420 { 00421 err[0]= ERANGE; 00422 return negative ? INT_MIN32 : INT_MAX32; 00423 } 00424 00425 return (negative ? -((long) i) : (long) i); 00426 00427 noconv: 00428 err[0]= EDOM; 00429 if (endptr != NULL) 00430 *endptr = (char *) nptr; 00431 return 0L; 00432 }
| longlong my_strntoll_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| const char * | nptr, | |||
| uint | l, | |||
| int | base, | |||
| char ** | endptr, | |||
| int * | err | |||
| ) |
Definition at line 549 of file ctype-simple.c.
References e, int(), LONGLONG_MAX, LONGLONG_MIN, my_isspace, and NULL.
00552 { 00553 int negative; 00554 register ulonglong cutoff; 00555 register unsigned int cutlim; 00556 register ulonglong i; 00557 register const char *s, *e; 00558 const char *save; 00559 int overflow; 00560 00561 *err= 0; /* Initialize error indicator */ 00562 #ifdef NOT_USED 00563 if (base < 0 || base == 1 || base > 36) 00564 base = 10; 00565 #endif 00566 00567 s = nptr; 00568 e = nptr+l; 00569 00570 for(; s<e && my_isspace(cs,*s); s++); 00571 00572 if (s == e) 00573 { 00574 goto noconv; 00575 } 00576 00577 if (*s == '-') 00578 { 00579 negative = 1; 00580 ++s; 00581 } 00582 else if (*s == '+') 00583 { 00584 negative = 0; 00585 ++s; 00586 } 00587 else 00588 negative = 0; 00589 00590 #ifdef NOT_USED 00591 if (base == 16 && s[0] == '0' && (s[1]=='X'|| s[1]=='x')) 00592 s += 2; 00593 #endif 00594 00595 #ifdef NOT_USED 00596 if (base == 0) 00597 { 00598 if (*s == '0') 00599 { 00600 if (s[1]=='X' || s[1]=='x') 00601 { 00602 s += 2; 00603 base = 16; 00604 } 00605 else 00606 base = 8; 00607 } 00608 else 00609 base = 10; 00610 } 00611 #endif 00612 00613 save = s; 00614 00615 cutoff = (~(ulonglong) 0) / (unsigned long int) base; 00616 cutlim = (uint) ((~(ulonglong) 0) % (unsigned long int) base); 00617 00618 overflow = 0; 00619 i = 0; 00620 for ( ; s != e; s++) 00621 { 00622 register unsigned char c= *s; 00623 if (c>='0' && c<='9') 00624 c -= '0'; 00625 else if (c>='A' && c<='Z') 00626 c = c - 'A' + 10; 00627 else if (c>='a' && c<='z') 00628 c = c - 'a' + 10; 00629 else 00630 break; 00631 if (c >= base) 00632 break; 00633 if (i > cutoff || (i == cutoff && c > cutlim)) 00634 overflow = 1; 00635 else 00636 { 00637 i *= (ulonglong) base; 00638 i += c; 00639 } 00640 } 00641 00642 if (s == save) 00643 goto noconv; 00644 00645 if (endptr != NULL) 00646 *endptr = (char *) s; 00647 00648 if (negative) 00649 { 00650 if (i > (ulonglong) LONGLONG_MIN) 00651 overflow = 1; 00652 } 00653 else if (i > (ulonglong) LONGLONG_MAX) 00654 overflow = 1; 00655 00656 if (overflow) 00657 { 00658 err[0]= ERANGE; 00659 return negative ? LONGLONG_MIN : LONGLONG_MAX; 00660 } 00661 00662 return (negative ? -((longlong) i) : (longlong) i); 00663 00664 noconv: 00665 err[0]= EDOM; 00666 if (endptr != NULL) 00667 *endptr = (char *) nptr; 00668 return 0L; 00669 }
Here is the call graph for this function:

| ulong my_strntoul_8bit | ( | CHARSET_INFO * | cs, | |
| const char * | nptr, | |||
| uint | l, | |||
| int | base, | |||
| char ** | endptr, | |||
| int * | err | |||
| ) |
Definition at line 435 of file ctype-simple.c.
References e, my_isspace, and NULL.
00438 { 00439 int negative; 00440 register uint32 cutoff; 00441 register unsigned int cutlim; 00442 register uint32 i; 00443 register const char *s; 00444 register unsigned char c; 00445 const char *save, *e; 00446 int overflow; 00447 00448 *err= 0; /* Initialize error indicator */ 00449 #ifdef NOT_USED 00450 if (base < 0 || base == 1 || base > 36) 00451 base = 10; 00452 #endif 00453 00454 s = nptr; 00455 e = nptr+l; 00456 00457 for( ; s<e && my_isspace(cs, *s); s++); 00458 00459 if (s==e) 00460 { 00461 goto noconv; 00462 } 00463 00464 if (*s == '-') 00465 { 00466 negative = 1; 00467 ++s; 00468 } 00469 else if (*s == '+') 00470 { 00471 negative = 0; 00472 ++s; 00473 } 00474 else 00475 negative = 0; 00476 00477 #ifdef NOT_USED 00478 if (base == 16 && s[0] == '0' && (s[1]=='X' || s[1]=='x')) 00479 s += 2; 00480 #endif 00481 00482 #ifdef NOT_USED 00483 if (base == 0) 00484 { 00485 if (*s == '0') 00486 { 00487 if (s[1]=='X' || s[1]=='x') 00488 { 00489 s += 2; 00490 base = 16; 00491 } 00492 else 00493 base = 8; 00494 } 00495 else 00496 base = 10; 00497 } 00498 #endif 00499 00500 save = s; 00501 cutoff = ((uint32)~0L) / (uint32) base; 00502 cutlim = (uint) (((uint32)~0L) % (uint32) base); 00503 overflow = 0; 00504 i = 0; 00505 00506 for (c = *s; s != e; c = *++s) 00507 { 00508 if (c>='0' && c<='9') 00509 c -= '0'; 00510 else if (c>='A' && c<='Z') 00511 c = c - 'A' + 10; 00512 else if (c>='a' && c<='z') 00513 c = c - 'a' + 10; 00514 else 00515 break; 00516 if (c >= base) 00517 break; 00518 if (i > cutoff || (i == cutoff && c > cutlim)) 00519 overflow = 1; 00520 else 00521 { 00522 i *= (uint32) base; 00523 i += c; 00524 } 00525 } 00526 00527 if (s == save) 00528 goto noconv; 00529 00530 if (endptr != NULL) 00531 *endptr = (char *) s; 00532 00533 if (overflow) 00534 { 00535 err[0]= ERANGE; 00536 return (~(uint32) 0); 00537 } 00538 00539 return (negative ? -((long) i) : (long) i); 00540 00541 noconv: 00542 err[0]= EDOM; 00543 if (endptr != NULL) 00544 *endptr = (char *) nptr; 00545 return 0L; 00546 }
| ulonglong my_strntoull_8bit | ( | CHARSET_INFO * | cs, | |
| const char * | nptr, | |||
| uint | l, | |||
| int | base, | |||
| char ** | endptr, | |||
| int * | err | |||
| ) |
Definition at line 672 of file ctype-simple.c.
References e, int(), my_isspace, and NULL.
00675 { 00676 int negative; 00677 register ulonglong cutoff; 00678 register unsigned int cutlim; 00679 register ulonglong i; 00680 register const char *s, *e; 00681 const char *save; 00682 int overflow; 00683 00684 *err= 0; /* Initialize error indicator */ 00685 #ifdef NOT_USED 00686 if (base < 0 || base == 1 || base > 36) 00687 base = 10; 00688 #endif 00689 00690 s = nptr; 00691 e = nptr+l; 00692 00693 for(; s<e && my_isspace(cs,*s); s++); 00694 00695 if (s == e) 00696 { 00697 goto noconv; 00698 } 00699 00700 if (*s == '-') 00701 { 00702 negative = 1; 00703 ++s; 00704 } 00705 else if (*s == '+') 00706 { 00707 negative = 0; 00708 ++s; 00709 } 00710 else 00711 negative = 0; 00712 00713 #ifdef NOT_USED 00714 if (base == 16 && s[0] == '0' && (s[1]=='X' || s[1]=='x')) 00715 s += 2; 00716 #endif 00717 00718 #ifdef NOT_USED 00719 if (base == 0) 00720 { 00721 if (*s == '0') 00722 { 00723 if (s[1]=='X' || s[1]=='x') 00724 { 00725 s += 2; 00726 base = 16; 00727 } 00728 else 00729 base = 8; 00730 } 00731 else 00732 base = 10; 00733 } 00734 #endif 00735 00736 save = s; 00737 00738 cutoff = (~(ulonglong) 0) / (unsigned long int) base; 00739 cutlim = (uint) ((~(ulonglong) 0) % (unsigned long int) base); 00740 00741 overflow = 0; 00742 i = 0; 00743 for ( ; s != e; s++) 00744 { 00745 register unsigned char c= *s; 00746 00747 if (c>='0' && c<='9') 00748 c -= '0'; 00749 else if (c>='A' && c<='Z') 00750 c = c - 'A' + 10; 00751 else if (c>='a' && c<='z') 00752 c = c - 'a' + 10; 00753 else 00754 break; 00755 if (c >= base) 00756 break; 00757 if (i > cutoff || (i == cutoff && c > cutlim)) 00758 overflow = 1; 00759 else 00760 { 00761 i *= (ulonglong) base; 00762 i += c; 00763 } 00764 } 00765 00766 if (s == save) 00767 goto noconv; 00768 00769 if (endptr != NULL) 00770 *endptr = (char *) s; 00771 00772 if (overflow) 00773 { 00774 err[0]= ERANGE; 00775 return (~(ulonglong) 0); 00776 } 00777 00778 return (negative ? -((longlong) i) : (longlong) i); 00779 00780 noconv: 00781 err[0]= EDOM; 00782 if (endptr != NULL) 00783 *endptr = (char *) nptr; 00784 return 0L; 00785 }
Here is the call graph for this function:

| int my_strnxfrm_simple | ( | CHARSET_INFO * | cs, | |
| uchar * | dest, | |||
| uint | len, | |||
| const uchar * | src, | |||
| uint | srclen | |||
| ) |
Definition at line 73 of file ctype-simple.c.
References bfill, map, set_if_smaller, and charset_info_st::sort_order.
00076 { 00077 uchar *map= cs->sort_order; 00078 uint dstlen= len; 00079 set_if_smaller(len, srclen); 00080 if (dest != src) 00081 { 00082 const uchar *end; 00083 for ( end=src+len; src < end ; ) 00084 *dest++= map[*src++]; 00085 } 00086 else 00087 { 00088 const uchar *end; 00089 for ( end=dest+len; dest < end ; dest++) 00090 *dest= (char) map[(uchar) *dest]; 00091 } 00092 if (dstlen > len) 00093 bfill(dest, dstlen - len, ' '); 00094 return dstlen; 00095 }
| uint my_strnxfrmlen_simple | ( | CHARSET_INFO * | cs, | |
| uint | len | |||
| ) |
Definition at line 27 of file ctype-simple.c.
References charset_info_st::strxfrm_multiply.
00028 { 00029 return len * (cs->strxfrm_multiply ? cs->strxfrm_multiply : 1); 00030 }
| longlong my_strtoll10_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| const char * | nptr, | |||
| char ** | endptr, | |||
| int * | error | |||
| ) |
Definition at line 1350 of file ctype-simple.c.
References my_strtoll10().
01352 { 01353 return my_strtoll10(nptr, endptr, error); 01354 }
Here is the call graph for this function:

| int my_wc_mb_8bit | ( | CHARSET_INFO * | cs, | |
| my_wc_t | wc, | |||
| unsigned char * | str, | |||
| unsigned char *end | __attribute__((unused)) | |||
| ) |
Definition at line 248 of file ctype-simple.c.
References my_uni_idx_st::from, MY_CS_ILUNI, MY_CS_TOOSMALL, my_uni_idx_st::tab, charset_info_st::tab_from_uni, and my_uni_idx_st::to.
00251 { 00252 MY_UNI_IDX *idx; 00253 00254 if (str >= end) 00255 return MY_CS_TOOSMALL; 00256 00257 for (idx=cs->tab_from_uni; idx->tab ; idx++) 00258 { 00259 if (idx->from <= wc && idx->to >= wc) 00260 { 00261 str[0]= idx->tab[wc - idx->from]; 00262 return (!str[0] && wc) ? MY_CS_ILUNI : 1; 00263 } 00264 } 00265 return MY_CS_ILUNI; 00266 }
| uint my_well_formed_len_8bit | ( | CHARSET_INFO *cs | __attribute__((unused)), | |
| const char * | start, | |||
| const char * | end, | |||
| uint | nchars, | |||
| int * | error | |||
| ) |
| int my_wildcmp_8bit | ( | CHARSET_INFO * | cs, | |
| const char * | str, | |||
| const char * | str_end, | |||
| const char * | wildstr, | |||
| const char * | wildend, | |||
| int | escape, | |||
| int | w_one, | |||
| int | w_many | |||
| ) |
Definition at line 934 of file ctype-simple.c.
References cmp, INC_PTR, likeconv, and my_wildcmp_8bit().
00938 { 00939 int result= -1; /* Not found, using wildcards */ 00940 00941 while (wildstr != wildend) 00942 { 00943 while (*wildstr != w_many && *wildstr != w_one) 00944 { 00945 if (*wildstr == escape && wildstr+1 != wildend) 00946 wildstr++; 00947 00948 if (str == str_end || likeconv(cs,*wildstr++) != likeconv(cs,*str++)) 00949 return(1); /* No match */ 00950 if (wildstr == wildend) 00951 return(str != str_end); /* Match if both are at end */ 00952 result=1; /* Found an anchor char */ 00953 } 00954 if (*wildstr == w_one) 00955 { 00956 do 00957 { 00958 if (str == str_end) /* Skip one char if possible */ 00959 return(result); 00960 INC_PTR(cs,str,str_end); 00961 } while (++wildstr < wildend && *wildstr == w_one); 00962 if (wildstr == wildend) 00963 break; 00964 } 00965 if (*wildstr == w_many) 00966 { /* Found w_many */ 00967 uchar cmp; 00968 00969 wildstr++; 00970 /* Remove any '%' and '_' from the wild search string */ 00971 for (; wildstr != wildend ; wildstr++) 00972 { 00973 if (*wildstr == w_many) 00974 continue; 00975 if (*wildstr == w_one) 00976 { 00977 if (str == str_end) 00978 return(-1); 00979 INC_PTR(cs,str,str_end); 00980 continue; 00981 } 00982 break; /* Not a wild character */ 00983 } 00984 if (wildstr == wildend) 00985 return(0); /* Ok if w_many is last */ 00986 if (str == str_end) 00987 return(-1); 00988 00989 if ((cmp= *wildstr) == escape && wildstr+1 != wildend) 00990 cmp= *++wildstr; 00991 00992 INC_PTR(cs,wildstr,wildend); /* This is compared trough cmp */ 00993 cmp=likeconv(cs,cmp); 00994 do 00995 { 00996 while (str != str_end && (uchar) likeconv(cs,*str) != cmp) 00997 str++; 00998 if (str++ == str_end) return(-1); 00999 { 01000 int tmp=my_wildcmp_8bit(cs,str,str_end,wildstr,wildend,escape,w_one, 01001 w_many); 01002 if (tmp <= 0) 01003 return(tmp); 01004 } 01005 } while (str != str_end && wildstr[0] != w_many); 01006 return(-1); 01007 } 01008 } 01009 return(str != str_end ? 1 : 0); 01010 }
Here is the call graph for this function:

| static int pcmp | ( | const void * | f, | |
| const void * | s | |||
| ) | [static] |
Definition at line 1225 of file ctype-simple.c.
References F, my_uni_idx_st::from, uni_idx::nchars, my_uni_idx_st::to, and uni_idx::uidx.
Referenced by create_fromuni().
01226 { 01227 const uni_idx *F= (const uni_idx*) f; 01228 const uni_idx *S= (const uni_idx*) s; 01229 int res; 01230 01231 if (!(res=((S->nchars)-(F->nchars)))) 01232 res=((F->uidx.from)-(S->uidx.to)); 01233 return res; 01234 }
Here is the caller graph for this function:

| static void set_max_sort_char | ( | CHARSET_INFO * | cs | ) | [static] |
Definition at line 1323 of file ctype-simple.c.
References charset_info_st::max_sort_char, and charset_info_st::sort_order.
Referenced by my_coll_init_simple().
01324 { 01325 uchar max_char; 01326 uint i; 01327 01328 if (!cs->sort_order) 01329 return; 01330 01331 max_char=cs->sort_order[(uchar) cs->max_sort_char]; 01332 for (i= 0; i < 256; i++) 01333 { 01334 if ((uchar) cs->sort_order[i] > max_char) 01335 { 01336 max_char=(uchar) cs->sort_order[i]; 01337 cs->max_sort_char= i; 01338 } 01339 } 01340 }
Here is the caller graph for this function:

Initial value:
{
my_cset_init_8bit,
NULL,
my_mbcharlen_8bit,
my_numchars_8bit,
my_charpos_8bit,
my_well_formed_len_8bit,
my_lengthsp_8bit,
my_numcells_8bit,
my_mb_wc_8bit,
my_wc_mb_8bit,
my_mb_ctype_8bit,
my_caseup_str_8bit,
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
my_snprintf_8bit,
my_long10_to_str_8bit,
my_longlong10_to_str_8bit,
my_fill_8bit,
my_strntol_8bit,
my_strntoul_8bit,
my_strntoll_8bit,
my_strntoull_8bit,
my_strntod_8bit,
my_strtoll10_8bit,
my_scan_8bit
}
Definition at line 1424 of file ctype-simple.c.
Initial value:
{
my_coll_init_simple,
my_strnncoll_simple,
my_strnncollsp_simple,
my_strnxfrm_simple,
my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_8bit,
my_strcasecmp_8bit,
my_instr_simple,
my_hash_sort_simple,
my_propagate_simple
}
Definition at line 1454 of file ctype-simple.c.
1.4.7

