Preparing to embed string to number conversion functions into charset structure

This commit is contained in:
unknown 2002-11-13 17:13:29 +04:00
parent e0ad88a2ff
commit 81d428bd5a
15 changed files with 270 additions and 13 deletions

View file

@ -118,6 +118,12 @@ typedef struct charset_info_st
/* Charset dependant snprintf() */
int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt, ...);
long (*strtol)(struct charset_info_st *, const char *s, char **e, int base);
ulong (*strtoul)(struct charset_info_st *, const char *s, char **e, int base);
longlong (*strtoll)(struct charset_info_st *, const char *s, char **e, int base);
ulonglong (*strtoull)(struct charset_info_st *, const char *s, char **e, int base);
double (*strtod)(struct charset_info_st *, const char *s, char **e);
} CHARSET_INFO;
@ -156,6 +162,13 @@ int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
int my_snprintf_8bit(struct charset_info_st *, char *to, uint n, const char *fmt, ...);
long my_strtol_8bit(CHARSET_INFO *, const char *s, char **e, int base);
ulong my_strtoul_8bit(CHARSET_INFO *, const char *s, char **e, int base);
longlong my_strtoll_8bit(CHARSET_INFO *, const char *s, char **e, int base);
ulonglong my_strtoull_8bit(CHARSET_INFO *, const char *s, char **e, int base);
double my_strtod_8bit(CHARSET_INFO *, const char *s, char **e);
#ifdef USE_MB
/* Functions for multibyte charsets */

View file

@ -389,6 +389,10 @@ static CHARSET_INFO *add_charset(CHARSET_INFO *cs, myf flags)
cs->hash_caseup = my_hash_caseup_simple;
cs->hash_sort = my_hash_sort_simple;
cs->snprintf = my_snprintf_8bit;
cs->strtol = my_strtol_8bit;
cs->strtoul = my_strtoul_8bit;
cs->strtoll = my_strtoll_8bit;
cs->strtoull = my_strtoull_8bit;
cs->mbmaxlen = 1;
set_max_sort_char(cs);

View file

@ -6248,7 +6248,12 @@ CHARSET_INFO my_charset_big5 =
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
};

View file

@ -626,7 +626,12 @@ CHARSET_INFO my_charset_czech =
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
};
#endif

View file

@ -8665,7 +8665,12 @@ CHARSET_INFO my_charset_euc_kr =
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
};
#endif

View file

@ -5715,7 +5715,12 @@ CHARSET_INFO my_charset_gb2312 =
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
};
#endif

View file

@ -9903,7 +9903,12 @@ CHARSET_INFO my_charset_gbk =
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
};

View file

@ -444,7 +444,12 @@ CHARSET_INFO my_charset_latin1_de =
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
};
#endif

View file

@ -244,3 +244,33 @@ void my_hash_sort_simple(CHARSET_INFO *cs,
nr2[0]+=3;
}
}
long my_strtol_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *s, char **e, int base)
{
return strtol(s,e,base);
}
ulong my_strtoul_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *s, char **e, int base)
{
return strtoul(s,e,base);
}
longlong my_strtoll_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *s, char **e, int base)
{
return strtoll(s,e,base);
}
ulonglong my_strtoull_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *s, char **e, int base)
{
return strtoul(s,e,base);
}
double my_strtod_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *s, char **e)
{
return strtod(s,e);
}

View file

@ -4490,7 +4490,12 @@ CHARSET_INFO my_charset_sjis =
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
};
#endif

View file

@ -718,7 +718,12 @@ CHARSET_INFO my_charset_tis620 =
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
};

View file

@ -8459,7 +8459,12 @@ CHARSET_INFO my_charset_ujis =
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
};

View file

@ -1984,7 +1984,12 @@ CHARSET_INFO my_charset_utf8 =
my_hash_caseup_utf8,/* hash_caseup */
my_hash_sort_utf8, /* hash_sort */
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
};
@ -2433,6 +2438,36 @@ static int my_snprintf_ucs2(CHARSET_INFO *cs __attribute__((unused))
}
static long my_strtol_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *s, char **e, int base)
{
return strtol(s,e,base);
}
static ulong my_strtoul_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *s, char **e, int base)
{
return strtoul(s,e,base);
}
static longlong my_strtoll_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *s, char **e, int base)
{
return strtoll(s,e,base);
}
static ulonglong my_strtoull_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *s, char **e, int base)
{
return strtoul(s,e,base);
}
double my_strtod_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *s, char **e)
{
return strtod(s,e);
}
CHARSET_INFO my_charset_ucs2 =
{
@ -2466,7 +2501,12 @@ CHARSET_INFO my_charset_ucs2 =
my_hash_caseup_ucs2,/* hash_caseup */
my_hash_sort_ucs2, /* hash_sort */
0,
my_snprintf_ucs2
my_snprintf_ucs2,
my_strtol_ucs2,
my_strtoul_ucs2,
my_strtoll_ucs2,
my_strtoull_ucs2,
my_strtod_ucs2
};

View file

@ -652,7 +652,12 @@ CHARSET_INFO my_charset_win1250ch =
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
};

View file

@ -2839,7 +2839,12 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit
my_snprintf_8bit,
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -2877,6 +2882,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -2913,6 +2923,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -2949,6 +2964,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -2986,6 +3006,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3022,6 +3047,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3058,6 +3088,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3094,6 +3129,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3131,6 +3171,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3167,6 +3212,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3203,6 +3253,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3239,6 +3294,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3275,6 +3335,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3311,6 +3376,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3347,6 +3417,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3384,6 +3459,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3420,6 +3500,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3457,6 +3542,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3494,6 +3584,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3530,6 +3625,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3566,6 +3666,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3602,6 +3707,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3638,6 +3748,11 @@ static CHARSET_INFO compiled_charsets[] = {
my_hash_sort_simple,
0,
my_snprintf_8bit
my_strtol_8bit,
my_strtoul_8bit,
my_strtoll_8bit,
my_strtoull_8bit,
my_strtod_8bit
},
#endif
@ -3674,6 +3789,11 @@ static CHARSET_INFO compiled_charsets[] = {
NULL, /* hash_caseup */
NULL, /* hash_sort */
0,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
}
};