The world's most popular open source database
#include <my_global.h>#include <m_ctype.h>#include <my_xml.h>#include <m_string.h>Include dependency graph for ctype.c:

Go to the source code of this file.
Classes | |
| struct | my_cs_file_section_st |
| struct | my_cs_file_info |
Defines | |
| #define | _CS_MISC 1 |
| #define | _CS_ID 2 |
| #define | _CS_CSNAME 3 |
| #define | _CS_FAMILY 4 |
| #define | _CS_ORDER 5 |
| #define | _CS_COLNAME 6 |
| #define | _CS_FLAG 7 |
| #define | _CS_CHARSET 8 |
| #define | _CS_COLLATION 9 |
| #define | _CS_UPPERMAP 10 |
| #define | _CS_LOWERMAP 11 |
| #define | _CS_UNIMAP 12 |
| #define | _CS_COLLMAP 13 |
| #define | _CS_CTYPEMAP 14 |
| #define | _CS_PRIMARY_ID 15 |
| #define | _CS_BINARY_ID 16 |
| #define | _CS_CSDESCRIPT 17 |
| #define | _CS_RESET 18 |
| #define | _CS_DIFF1 19 |
| #define | _CS_DIFF2 20 |
| #define | _CS_DIFF3 21 |
| #define | MY_CS_CSDESCR_SIZE 64 |
| #define | MY_CS_TAILORING_SIZE 128 |
Typedefs | |
| typedef my_cs_file_info | MY_CHARSET_LOADER |
Functions | |
| static char * | mstr (char *str, const char *src, uint l1, uint l2) |
| static struct my_cs_file_section_st * | cs_file_sec (const char *attr, uint len) |
| static int | fill_uchar (uchar *a, uint size, const char *str, uint len) |
| static int | fill_uint16 (uint16 *a, uint size, const char *str, uint len) |
| static int | cs_enter (MY_XML_PARSER *st, const char *attr, uint len) |
| static int | cs_leave (MY_XML_PARSER *st, const char *attr, uint len) |
| static int | cs_value (MY_XML_PARSER *st, const char *attr, uint len) |
| my_bool | my_parse_charset_xml (const char *buf, uint len, int(*add_collation)(CHARSET_INFO *cs)) |
Variables | |
| static struct my_cs_file_section_st | sec [] |
| #define _CS_BINARY_ID 16 |
| #define _CS_CHARSET 8 |
| #define _CS_COLLATION 9 |
| #define _CS_COLLMAP 13 |
| #define _CS_COLNAME 6 |
| #define _CS_CSDESCRIPT 17 |
| #define _CS_CSNAME 3 |
| #define _CS_CTYPEMAP 14 |
| #define _CS_DIFF1 19 |
| #define _CS_DIFF2 20 |
| #define _CS_DIFF3 21 |
| #define _CS_FLAG 7 |
| #define _CS_ID 2 |
| #define _CS_LOWERMAP 11 |
| #define _CS_PRIMARY_ID 15 |
| #define _CS_RESET 18 |
| #define _CS_UNIMAP 12 |
| #define _CS_UPPERMAP 10 |
| #define MY_CS_CSDESCR_SIZE 64 |
| typedef struct my_cs_file_info MY_CHARSET_LOADER |
| static int cs_enter | ( | MY_XML_PARSER * | st, | |
| const char * | attr, | |||
| uint | len | |||
| ) | [static] |
Definition at line 182 of file ctype.c.
References _CS_CHARSET, _CS_COLLATION, bzero, my_cs_file_info::cs, cs_file_sec(), MY_XML_OK, my_cs_file_info::tailoring_length, and xml_stack_st::user_data.
Referenced by my_parse_charset_xml().
00183 { 00184 struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; 00185 struct my_cs_file_section_st *s= cs_file_sec(attr,len); 00186 00187 if ( s && (s->state == _CS_CHARSET)) 00188 bzero(&i->cs,sizeof(i->cs)); 00189 00190 if (s && (s->state == _CS_COLLATION)) 00191 i->tailoring_length= 0; 00192 00193 return MY_XML_OK; 00194 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static struct my_cs_file_section_st* cs_file_sec | ( | const char * | attr, | |
| uint | len | |||
| ) | [static] |
Definition at line 115 of file ctype.c.
References NULL, sec, and my_cs_file_section_st::str.
Referenced by cs_enter(), cs_leave(), and cs_value().
00116 { 00117 struct my_cs_file_section_st *s; 00118 for (s=sec; s->str; s++) 00119 { 00120 if (!strncmp(attr,s->str,len)) 00121 return s; 00122 } 00123 return NULL; 00124 }
Here is the caller graph for this function:

| static int cs_leave | ( | MY_XML_PARSER * | st, | |
| const char * | attr, | |||
| uint | len | |||
| ) | [static] |
Definition at line 197 of file ctype.c.
References _CS_COLLATION, my_cs_file_info::add_collation, my_cs_file_info::cs, cs_file_sec(), MY_XML_OK, my_cs_file_section_st::state, and xml_stack_st::user_data.
Referenced by my_parse_charset_xml().
00198 { 00199 struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; 00200 struct my_cs_file_section_st *s= cs_file_sec(attr,len); 00201 int state= s ? s->state : 0; 00202 int rc; 00203 00204 switch(state){ 00205 case _CS_COLLATION: 00206 rc= i->add_collation ? i->add_collation(&i->cs) : MY_XML_OK; 00207 break; 00208 default: 00209 rc=MY_XML_OK; 00210 } 00211 return rc; 00212 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int cs_value | ( | MY_XML_PARSER * | st, | |
| const char * | attr, | |||
| uint | len | |||
| ) | [static] |
Definition at line 215 of file ctype.c.
References _CS_BINARY_ID, _CS_COLLMAP, _CS_COLNAME, _CS_CSDESCRIPT, _CS_CSNAME, _CS_CTYPEMAP, _CS_DIFF1, _CS_DIFF2, _CS_DIFF3, _CS_FLAG, _CS_ID, _CS_LOWERMAP, _CS_PRIMARY_ID, _CS_RESET, _CS_UNIMAP, _CS_UPPERMAP, xml_stack_st::attr, charset_info_st::binary_number, my_cs_file_info::comment, charset_info_st::comment, my_cs_file_info::cs, cs_file_sec(), my_cs_file_info::csname, charset_info_st::csname, charset_info_st::ctype, my_cs_file_info::ctype, fill_uchar(), fill_uint16(), mstr(), MY_CS_BINSORT, MY_CS_COMPILED, MY_CS_CSDESCR_SIZE, MY_CS_CTYPE_TABLE_SIZE, MY_CS_NAME_SIZE, MY_CS_PRIMARY, MY_CS_SORT_ORDER_TABLE_SIZE, MY_CS_TO_LOWER_TABLE_SIZE, MY_CS_TO_UNI_TABLE_SIZE, MY_CS_TO_UPPER_TABLE_SIZE, MY_XML_OK, my_cs_file_info::name, charset_info_st::name, NULL, charset_info_st::number, charset_info_st::primary_number, charset_info_st::sort_order, my_cs_file_info::sort_order, charset_info_st::state, strlen(), strtol(), charset_info_st::tab_to_uni, my_cs_file_info::tab_to_uni, my_cs_file_info::tailoring, charset_info_st::tailoring, my_cs_file_info::tailoring_length, charset_info_st::to_lower, my_cs_file_info::to_lower, charset_info_st::to_upper, my_cs_file_info::to_upper, and xml_stack_st::user_data.
Referenced by my_parse_charset_xml().
00216 { 00217 struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; 00218 struct my_cs_file_section_st *s; 00219 int state= (int)((s=cs_file_sec(st->attr, (int) strlen(st->attr))) ? s->state : 0); 00220 00221 switch (state) { 00222 case _CS_ID: 00223 i->cs.number= strtol(attr,(char**)NULL,10); 00224 break; 00225 case _CS_BINARY_ID: 00226 i->cs.binary_number= strtol(attr,(char**)NULL,10); 00227 break; 00228 case _CS_PRIMARY_ID: 00229 i->cs.primary_number= strtol(attr,(char**)NULL,10); 00230 break; 00231 case _CS_COLNAME: 00232 i->cs.name=mstr(i->name,attr,len,MY_CS_NAME_SIZE-1); 00233 break; 00234 case _CS_CSNAME: 00235 i->cs.csname=mstr(i->csname,attr,len,MY_CS_NAME_SIZE-1); 00236 break; 00237 case _CS_CSDESCRIPT: 00238 i->cs.comment=mstr(i->comment,attr,len,MY_CS_CSDESCR_SIZE-1); 00239 break; 00240 case _CS_FLAG: 00241 if (!strncmp("primary",attr,len)) 00242 i->cs.state|= MY_CS_PRIMARY; 00243 else if (!strncmp("binary",attr,len)) 00244 i->cs.state|= MY_CS_BINSORT; 00245 else if (!strncmp("compiled",attr,len)) 00246 i->cs.state|= MY_CS_COMPILED; 00247 break; 00248 case _CS_UPPERMAP: 00249 fill_uchar(i->to_upper,MY_CS_TO_UPPER_TABLE_SIZE,attr,len); 00250 i->cs.to_upper=i->to_upper; 00251 break; 00252 case _CS_LOWERMAP: 00253 fill_uchar(i->to_lower,MY_CS_TO_LOWER_TABLE_SIZE,attr,len); 00254 i->cs.to_lower=i->to_lower; 00255 break; 00256 case _CS_UNIMAP: 00257 fill_uint16(i->tab_to_uni,MY_CS_TO_UNI_TABLE_SIZE,attr,len); 00258 i->cs.tab_to_uni=i->tab_to_uni; 00259 break; 00260 case _CS_COLLMAP: 00261 fill_uchar(i->sort_order,MY_CS_SORT_ORDER_TABLE_SIZE,attr,len); 00262 i->cs.sort_order=i->sort_order; 00263 break; 00264 case _CS_CTYPEMAP: 00265 fill_uchar(i->ctype,MY_CS_CTYPE_TABLE_SIZE,attr,len); 00266 i->cs.ctype=i->ctype; 00267 break; 00268 case _CS_RESET: 00269 case _CS_DIFF1: 00270 case _CS_DIFF2: 00271 case _CS_DIFF3: 00272 { 00273 /* 00274 Convert collation description from 00275 Locale Data Markup Language (LDML) 00276 into ICU Collation Customization expression. 00277 */ 00278 char arg[16]; 00279 const char *cmd[]= {"&","<","<<","<<<"}; 00280 i->cs.tailoring= i->tailoring; 00281 mstr(arg,attr,len,sizeof(arg)-1); 00282 if (i->tailoring_length + 20 < sizeof(i->tailoring)) 00283 { 00284 char *dst= i->tailoring_length + i->tailoring; 00285 i->tailoring_length+= sprintf(dst," %s %s",cmd[state-_CS_RESET],arg); 00286 } 00287 } 00288 } 00289 return MY_XML_OK; 00290 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 147 of file ctype.c.
References e, NULL, strchr(), and strtoul().
Referenced by cs_value().
00148 { 00149 uint i= 0; 00150 const char *s, *b, *e=str+len; 00151 00152 for (s=str ; s < e ; i++) 00153 { 00154 for ( ; (s < e) && strchr(" \t\r\n",s[0]); s++) ; 00155 b=s; 00156 for ( ; (s < e) && !strchr(" \t\r\n",s[0]); s++) ; 00157 if (s == b || i > size) 00158 break; 00159 a[i]= (uchar) strtoul(b,NULL,16); 00160 } 00161 return 0; 00162 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 164 of file ctype.c.
References e, NULL, strchr(), and strtol().
Referenced by cs_value().
00165 { 00166 uint i= 0; 00167 00168 const char *s, *b, *e=str+len; 00169 for (s=str ; s < e ; i++) 00170 { 00171 for ( ; (s < e) && strchr(" \t\r\n",s[0]); s++) ; 00172 b=s; 00173 for ( ; (s < e) && !strchr(" \t\r\n",s[0]); s++) ; 00174 if (s == b || i > size) 00175 break; 00176 a[i]= (uint16) strtol(b,NULL,16); 00177 } 00178 return 0; 00179 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 43 of file ctype.c.
References memcpy.
Referenced by bstr(), cs_value(), dstr(), estr(), and my_xml_leave().
00044 { 00045 l1= l1<l2 ? l1 : l2; 00046 memcpy(str,src,l1); 00047 str[l1]='\0'; 00048 return str; 00049 }
Here is the caller graph for this function:

| my_bool my_parse_charset_xml | ( | const char * | buf, | |
| uint | len, | |||
| int(*)(CHARSET_INFO *cs) | add_collation | |||
| ) |
Definition at line 293 of file ctype.c.
References my_cs_file_info::add_collation, cs_enter(), cs_leave(), cs_value(), FALSE, MY_XML_OK, my_xml_parse(), my_xml_parser_create(), my_xml_parser_free(), my_xml_set_enter_handler(), my_xml_set_leave_handler(), my_xml_set_user_data(), my_xml_set_value_handler(), p, and TRUE.
00295 { 00296 MY_XML_PARSER p; 00297 struct my_cs_file_info i; 00298 my_bool rc; 00299 00300 my_xml_parser_create(&p); 00301 my_xml_set_enter_handler(&p,cs_enter); 00302 my_xml_set_value_handler(&p,cs_value); 00303 my_xml_set_leave_handler(&p,cs_leave); 00304 i.add_collation= add_collation; 00305 my_xml_set_user_data(&p,(void*)&i); 00306 rc= (my_xml_parse(&p,buf,len) == MY_XML_OK) ? FALSE : TRUE; 00307 my_xml_parser_free(&p); 00308 return rc; 00309 }
Here is the call graph for this function:

struct my_cs_file_section_st sec[] [static] |
Definition at line 80 of file ctype.c.
Referenced by client(), com_status(), ConfigValuesFactory::ConfigValuesFactory(), cs_file_sec(), date_add_interval(), execute(), execute_commands(), ConfigValuesFactory::extractCurrentSection(), mutex_spin_wait(), my_sleep(), ConfigInfo::print(), read_section_stabs_debugging_info(), saveInConfigValues(), srv_suspend_mysql_thread(), test_bind_date_conv(), and Item_func_sec_to_time::val_str().
1.4.7

