Commit 1fd84d34 authored by unknown's avatar unknown

Configure.in/Makefile.in charset related things are now earier to maintain

Fixes in charset related C++ code


configure.in:
  Make things to be easier managable
include/m_ctype.h:
  Hide some functions under conditional compilation
libmysql/Makefile.shared:
  Make things to be easier managable
sql/item_func.cc:
  Fixed that private member is not available in this context
sql/item_strfunc.cc:
  Fixed that private member is not available in this context
strings/Makefile.am:
  Make charset things to be easier managable
  Some fixes in charset C++ code
strings/ctype-big5.c:
  Hide some functions under conditional compilation
strings/ctype-czech.c:
  Hide some functions under conditional compilation
strings/ctype-euc_kr.c:
  Hide some functions under conditional compilation
strings/ctype-gb2312.c:
  Hide some functions under conditional compilation
strings/ctype-gbk.c:
  Hide some functions under conditional compilation
strings/ctype-latin1_de.c:
  Hide some functions under conditional compilation
strings/ctype-mb.c:
  Hide some functions under conditional compilation
strings/ctype-sjis.c:
  Hide some functions under conditional compilation
strings/ctype-tis620.c:
  Hide some functions under conditional compilation
strings/ctype-ujis.c:
  Hide some functions under conditional compilation
parent af87d92a
...@@ -1869,6 +1869,7 @@ CHARSETS_AVAILABLE="armscii8 big5 cp1251 cp1257 ...@@ -1869,6 +1869,7 @@ CHARSETS_AVAILABLE="armscii8 big5 cp1251 cp1257
latin1 latin1_de latin2 latin5 sjis swe7 tis620 ujis latin1 latin1_de latin2 latin5 sjis swe7 tis620 ujis
usa7 utf8 win1250 win1251ukr" usa7 utf8 win1250 win1251ukr"
CHARSETS_DEPRECATED="win1251" CHARSETS_DEPRECATED="win1251"
CHARSETS_COMPLEX="big5 czech euc_kr gb2312 gbk latin1_de sjis tis620 ujis"
DEFAULT_CHARSET=latin1 DEFAULT_CHARSET=latin1
AC_DIVERT_POP AC_DIVERT_POP
...@@ -1889,15 +1890,11 @@ AC_MSG_CHECKING("character sets") ...@@ -1889,15 +1890,11 @@ AC_MSG_CHECKING("character sets")
if test "$extra_charsets" = none; then if test "$extra_charsets" = none; then
CHARSETS="" CHARSETS=""
elif test "$extra_charsets" = complex; then elif test "$extra_charsets" = complex; then
CHARSETS=`/bin/ls -1 $srcdir/strings/ctype-*.c | \ CHARSETS="$CHARSETS_COMPLEX"
sed -e 's;^.*/ctype-;;' -e 's;.c$;;'` elif test "$extra_charsets" = all; then
CHARSETS=`echo $CHARSETS` # get rid of line breaks CHARSETS="$CHARSETS_AVAILABLE $CHARSETS_DEPRECATED"
else else
if test "$extra_charsets" = all; then CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'`
CHARSETS="$CHARSETS_AVAILABLE $CHARSETS_DEPRECATED"
else
CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'`
fi
fi fi
use_mb="no" use_mb="no"
...@@ -2018,19 +2015,6 @@ do ...@@ -2018,19 +2015,6 @@ do
esac esac
done done
CHARSET_SRCS=""
CHARSETS_NEED_SOURCE=""
for c in $CHARSETS
do
cs_file="$srcdir/strings/ctype-$c.c"
if test -f $cs_file
then
CHARSET_SRCS="${CHARSET_SRCS}ctype-$c.c "
CHARSETS_NEED_SOURCE="$CHARSETS_NEED_SOURCE $c"
fi
done
if test "$use_mb" = "yes" if test "$use_mb" = "yes"
then then
AC_DEFINE(USE_MB) AC_DEFINE(USE_MB)
...@@ -2042,11 +2026,6 @@ AC_DEFINE(USE_STRCOLL) ...@@ -2042,11 +2026,6 @@ AC_DEFINE(USE_STRCOLL)
AC_SUBST(default_charset) AC_SUBST(default_charset)
AC_DEFINE_UNQUOTED(DEFAULT_CHARSET_NAME,"$default_charset") AC_DEFINE_UNQUOTED(DEFAULT_CHARSET_NAME,"$default_charset")
AC_SUBST(CHARSET_SRCS)
CHARSET_OBJS="`echo "$CHARSET_SRCS" | sed -e 's/\.c /.o /g'`"
AC_SUBST(CHARSET_OBJS)
AC_SUBST(CHARSETS_NEED_SOURCE)
AC_MSG_RESULT([default: $default_charset; compiled in: $CHARSETS]) AC_MSG_RESULT([default: $default_charset; compiled in: $CHARSETS])
......
...@@ -90,15 +90,17 @@ extern void my_casedn_8bit(CHARSET_INFO *, char *, uint); ...@@ -90,15 +90,17 @@ extern void my_casedn_8bit(CHARSET_INFO *, char *, uint);
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *); extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
extern int my_strncasecmp_8bit(CHARSET_INFO * cs, const char *, const char *, uint); extern int my_strncasecmp_8bit(CHARSET_INFO * cs, const char *, const char *, uint);
#ifdef USE_MB
/* Functions for multibyte charsets */ /* Functions for multibyte charsets */
extern void my_caseup_str_mb(CHARSET_INFO *, char *); extern void my_caseup_str_mb(CHARSET_INFO *, char *);
extern void my_casedn_str_mb(CHARSET_INFO *, char *); extern void my_casedn_str_mb(CHARSET_INFO *, char *);
extern void my_caseup_mb(CHARSET_INFO *, char *, uint); extern void my_caseup_mb(CHARSET_INFO *, char *, uint);
extern void my_casedn_mb(CHARSET_INFO *, char *, uint); extern void my_casedn_mb(CHARSET_INFO *, char *, uint);
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *); extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
extern int my_strncasecmp_mb(CHARSET_INFO * cs,const char *, const char *t, uint); extern int my_strncasecmp_mb(CHARSET_INFO * cs,const char *, const char *t, uint);
#endif
#ifdef HAVE_CHARSET_big5
/* declarations for the big5 character set */ /* declarations for the big5 character set */
extern uchar ctype_big5[], to_lower_big5[], to_upper_big5[], sort_order_big5[]; extern uchar ctype_big5[], to_lower_big5[], to_upper_big5[], sort_order_big5[];
extern int my_strnncoll_big5(CHARSET_INFO *,const uchar *, uint, const uchar *, uint); extern int my_strnncoll_big5(CHARSET_INFO *,const uchar *, uint, const uchar *, uint);
...@@ -108,7 +110,9 @@ extern my_bool my_like_range_big5(CHARSET_INFO *,const char *, uint, pchar, uint ...@@ -108,7 +110,9 @@ extern my_bool my_like_range_big5(CHARSET_INFO *,const char *, uint, pchar, uint
extern int ismbchar_big5(const char *, const char *); extern int ismbchar_big5(const char *, const char *);
extern my_bool ismbhead_big5(uint); extern my_bool ismbhead_big5(uint);
extern int mbcharlen_big5(uint); extern int mbcharlen_big5(uint);
#endif
#ifdef HAVE_CHARSET_czech
/* declarations for the czech character set */ /* declarations for the czech character set */
extern uchar ctype_czech[], to_lower_czech[], to_upper_czech[], sort_order_czech[]; extern uchar ctype_czech[], to_lower_czech[], to_upper_czech[], sort_order_czech[];
extern int my_strnncoll_czech(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); extern int my_strnncoll_czech(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
...@@ -116,19 +120,25 @@ extern int my_strnxfrm_czech(CHARSET_INFO *, uchar *, uint, const uchar *, u ...@@ -116,19 +120,25 @@ extern int my_strnxfrm_czech(CHARSET_INFO *, uchar *, uint, const uchar *, u
extern my_bool my_like_range_czech(CHARSET_INFO *, extern my_bool my_like_range_czech(CHARSET_INFO *,
const char *, uint, pchar, uint, const char *, uint, pchar, uint,
char *, char *, uint *, uint *); char *, char *, uint *, uint *);
#endif
#ifdef HAVE_CHARSET_euc_kr
/* declarations for the euc_kr character set */ /* declarations for the euc_kr character set */
extern uchar ctype_euc_kr[], to_lower_euc_kr[], to_upper_euc_kr[], sort_order_euc_kr[]; extern uchar ctype_euc_kr[], to_lower_euc_kr[], to_upper_euc_kr[], sort_order_euc_kr[];
extern int ismbchar_euc_kr(const char *, const char *); extern int ismbchar_euc_kr(const char *, const char *);
extern my_bool ismbhead_euc_kr(uint); extern my_bool ismbhead_euc_kr(uint);
extern int mbcharlen_euc_kr(uint); extern int mbcharlen_euc_kr(uint);
#endif
#ifdef HAVE_CHARSET_gb2312
/* declarations for the gb2312 character set */ /* declarations for the gb2312 character set */
extern uchar ctype_gb2312[], to_lower_gb2312[], to_upper_gb2312[], sort_order_gb2312[]; extern uchar ctype_gb2312[], to_lower_gb2312[], to_upper_gb2312[], sort_order_gb2312[];
extern int ismbchar_gb2312(const char *, const char *); extern int ismbchar_gb2312(const char *, const char *);
extern my_bool ismbhead_gb2312(uint); extern my_bool ismbhead_gb2312(uint);
extern int mbcharlen_gb2312(uint); extern int mbcharlen_gb2312(uint);
#endif
#ifdef HAVE_CHARSET_gbk
/* declarations for the gbk character set */ /* declarations for the gbk character set */
extern uchar ctype_gbk[], to_lower_gbk[], to_upper_gbk[], sort_order_gbk[]; extern uchar ctype_gbk[], to_lower_gbk[], to_upper_gbk[], sort_order_gbk[];
extern int my_strnncoll_gbk(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); extern int my_strnncoll_gbk(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
...@@ -138,14 +148,18 @@ extern my_bool my_like_range_gbk(CHARSET_INFO *, const char *, uint, pchar, uint ...@@ -138,14 +148,18 @@ extern my_bool my_like_range_gbk(CHARSET_INFO *, const char *, uint, pchar, uint
extern int ismbchar_gbk(const char *, const char *); extern int ismbchar_gbk(const char *, const char *);
extern my_bool ismbhead_gbk(uint); extern my_bool ismbhead_gbk(uint);
extern int mbcharlen_gbk(uint); extern int mbcharlen_gbk(uint);
#endif
#ifdef HAVE_CHARSET_latin1_de
/* declarations for the latin1_de character set */ /* declarations for the latin1_de character set */
extern uchar ctype_latin1_de[], to_lower_latin1_de[], to_upper_latin1_de[], sort_order_latin1_de[]; extern uchar ctype_latin1_de[], to_lower_latin1_de[], to_upper_latin1_de[], sort_order_latin1_de[];
extern int my_strnncoll_latin1_de(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); extern int my_strnncoll_latin1_de(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
extern int my_strnxfrm_latin1_de(CHARSET_INFO *, uchar *, uint, const uchar *, uint); extern int my_strnxfrm_latin1_de(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
extern my_bool my_like_range_latin1_de(CHARSET_INFO *, const char *, uint, pchar, uint, extern my_bool my_like_range_latin1_de(CHARSET_INFO *, const char *, uint, pchar, uint,
char *, char *, uint *, uint *); char *, char *, uint *, uint *);
#endif
#ifdef HAVE_CHARSET_sjis
/* declarations for the sjis character set */ /* declarations for the sjis character set */
extern uchar ctype_sjis[], to_lower_sjis[], to_upper_sjis[], sort_order_sjis[]; extern uchar ctype_sjis[], to_lower_sjis[], to_upper_sjis[], sort_order_sjis[];
extern int my_strnncoll_sjis(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); extern int my_strnncoll_sjis(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
...@@ -155,19 +169,24 @@ extern my_bool my_like_range_sjis(CHARSET_INFO *, const char *, uint, pchar, uin ...@@ -155,19 +169,24 @@ extern my_bool my_like_range_sjis(CHARSET_INFO *, const char *, uint, pchar, uin
extern int ismbchar_sjis(const char *, const char *); extern int ismbchar_sjis(const char *, const char *);
extern my_bool ismbhead_sjis(uint); extern my_bool ismbhead_sjis(uint);
extern int mbcharlen_sjis(uint); extern int mbcharlen_sjis(uint);
#endif
#ifdef HAVE_CHARSET_tis620
/* declarations for the tis620 character set */ /* declarations for the tis620 character set */
extern uchar ctype_tis620[], to_lower_tis620[], to_upper_tis620[], sort_order_tis620[]; extern uchar ctype_tis620[], to_lower_tis620[], to_upper_tis620[], sort_order_tis620[];
extern int my_strnncoll_tis620(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); extern int my_strnncoll_tis620(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
extern int my_strnxfrm_tis620(CHARSET_INFO *, uchar *, uint, const uchar *, uint); extern int my_strnxfrm_tis620(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
extern my_bool my_like_range_tis620(CHARSET_INFO *, const char *, uint, pchar, uint, extern my_bool my_like_range_tis620(CHARSET_INFO *, const char *, uint, pchar, uint,
char *, char *, uint *, uint *); char *, char *, uint *, uint *);
#endif
#ifdef HAVE_CHARSET_ujis
/* declarations for the ujis character set */ /* declarations for the ujis character set */
extern uchar ctype_ujis[], to_lower_ujis[], to_upper_ujis[], sort_order_ujis[]; extern uchar ctype_ujis[], to_lower_ujis[], to_upper_ujis[], sort_order_ujis[];
extern int ismbchar_ujis(const char *, const char *); extern int ismbchar_ujis(const char *, const char *);
extern my_bool ismbhead_ujis(uint); extern my_bool ismbhead_ujis(uint);
extern int mbcharlen_ujis(uint); extern int mbcharlen_ujis(uint);
#endif
#define _U 01 /* Upper case */ #define _U 01 /* Upper case */
......
...@@ -27,9 +27,6 @@ pkglib_LTLIBRARIES = $(target) ...@@ -27,9 +27,6 @@ pkglib_LTLIBRARIES = $(target)
noinst_PROGRAMS = conf_to_src noinst_PROGRAMS = conf_to_src
# We need .lo, not .o files for everything.
CHARSET_OBJS=@CHARSET_OBJS@
LTCHARSET_OBJS= ${CHARSET_OBJS:.o=.lo}
target_sources = libmysql.c net.c password.c manager.c \ target_sources = libmysql.c net.c password.c manager.c \
get_password.c errmsg.c get_password.c errmsg.c
...@@ -41,7 +38,11 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \ ...@@ -41,7 +38,11 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
strcend.lo bcmp.lo \ strcend.lo bcmp.lo \
bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \ bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
strtoull.lo strtoll.lo llstr.lo \ strtoull.lo strtoll.lo llstr.lo \
ctype.lo ctype-simple.lo ctype-mb.lo $(LTCHARSET_OBJS) ctype.lo ctype-simple.lo ctype-mb.lo \
ctype-big5.lo ctype-czech.lo ctype-euc_kr.lo \
ctype-gb2312.lo ctype-gbk.lo ctype-latin1_de.lo \
ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo
mystringsextra= strto.c mystringsextra= strto.c
dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
mysysheaders = mysys_priv.h my_static.h mysysheaders = mysys_priv.h my_static.h
...@@ -74,7 +75,7 @@ DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \ ...@@ -74,7 +75,7 @@ DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" $(target_defs) -DSHAREDIR="\"$(MYSQLSHAREdir)\"" $(target_defs)
# The automatic dependencies miss this # The automatic dependencies miss this
bmove_upp.lo: $(LTCHARSET_OBJS) #bmove_upp.lo: $(LTCHARSET_OBJS)
clean-local: clean-local:
rm -f `echo $(mystringsobjects) | sed "s;\.lo;.c;g"` \ rm -f `echo $(mystringsobjects) | sed "s;\.lo;.c;g"` \
......
...@@ -830,7 +830,7 @@ longlong Item_func_locate::val_int() ...@@ -830,7 +830,7 @@ longlong Item_func_locate::val_int()
{ {
start=(uint) args[2]->val_int()-1; start=(uint) args[2]->val_int()-1;
#ifdef USE_MB #ifdef USE_MB
if (use_mb(a->str_charset)) if (use_mb(a->charset()))
{ {
start0=start; start0=start;
if (!binary_str) if (!binary_str)
...@@ -843,7 +843,7 @@ longlong Item_func_locate::val_int() ...@@ -843,7 +843,7 @@ longlong Item_func_locate::val_int()
if (!b->length()) // Found empty string at start if (!b->length()) // Found empty string at start
return (longlong) (start+1); return (longlong) (start+1);
#ifdef USE_MB #ifdef USE_MB
if (use_mb(a->str_charset) && !binary_str) if (use_mb(a->charset()) && !binary_str)
{ {
const char *ptr=a->ptr()+start; const char *ptr=a->ptr()+start;
const char *search=b->ptr(); const char *search=b->ptr();
...@@ -862,7 +862,7 @@ longlong Item_func_locate::val_int() ...@@ -862,7 +862,7 @@ longlong Item_func_locate::val_int()
return (longlong) start0+1; return (longlong) start0+1;
} }
skipp: skipp:
if ((l=my_ismbchar(a->str_charset,ptr,strend))) ptr+=l; if ((l=my_ismbchar(a->charset(),ptr,strend))) ptr+=l;
else ++ptr; else ++ptr;
++start0; ++start0;
} }
...@@ -913,10 +913,10 @@ longlong Item_func_ord::val_int() ...@@ -913,10 +913,10 @@ longlong Item_func_ord::val_int()
null_value=0; null_value=0;
if (!res->length()) return 0; if (!res->length()) return 0;
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->str_charset) && !args[0]->binary) if (use_mb(res->charset()) && !args[0]->binary)
{ {
register const char *str=res->ptr(); register const char *str=res->ptr();
register uint32 n=0, l=my_ismbchar(res->str_charset,str,str+res->length()); register uint32 n=0, l=my_ismbchar(res->charset(),str,str+res->length());
if (!l) return (longlong)((uchar) *str); if (!l) return (longlong)((uchar) *str);
while (l--) while (l--)
n=(n<<8)|(uint32)((uchar) *str++); n=(n<<8)|(uint32)((uchar) *str++);
......
...@@ -510,7 +510,7 @@ String *Item_func_reverse::val_str(String *str) ...@@ -510,7 +510,7 @@ String *Item_func_reverse::val_str(String *str)
ptr = (char *) res->ptr(); ptr = (char *) res->ptr();
end=ptr+res->length(); end=ptr+res->length();
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->str_charset) && !binary) if (use_mb(res->charset()) && !binary)
{ {
String tmpstr; String tmpstr;
tmpstr.copy(*res); tmpstr.copy(*res);
...@@ -518,7 +518,7 @@ String *Item_func_reverse::val_str(String *str) ...@@ -518,7 +518,7 @@ String *Item_func_reverse::val_str(String *str)
register uint32 l; register uint32 l;
while (ptr < end) while (ptr < end)
{ {
if ((l=my_ismbchar(res->str_charset, ptr,end))) if ((l=my_ismbchar(res->charset(), ptr,end)))
tmp-=l, memcpy(tmp,ptr,l), ptr+=l; tmp-=l, memcpy(tmp,ptr,l), ptr+=l;
else else
*--tmp=*ptr++; *--tmp=*ptr++;
...@@ -573,7 +573,7 @@ String *Item_func_replace::val_str(String *str) ...@@ -573,7 +573,7 @@ String *Item_func_replace::val_str(String *str)
goto null; goto null;
#ifdef USE_MB #ifdef USE_MB
binary_str = (args[0]->binary || args[1]->binary || !use_mb(res->str_charset)); binary_str = (args[0]->binary || args[1]->binary || !use_mb(res->charset()));
#endif #endif
if (res2->length() == 0) if (res2->length() == 0)
...@@ -621,7 +621,7 @@ String *Item_func_replace::val_str(String *str) ...@@ -621,7 +621,7 @@ String *Item_func_replace::val_str(String *str)
goto redo; goto redo;
} }
skipp: skipp:
if ((l=my_ismbchar(res->str_charset, ptr,strend))) ptr+=l; if ((l=my_ismbchar(res->charset(), ptr,strend))) ptr+=l;
else ++ptr; else ++ptr;
} }
} }
...@@ -679,7 +679,7 @@ String *Item_func_insert::val_str(String *str) ...@@ -679,7 +679,7 @@ String *Item_func_insert::val_str(String *str)
args[3]->null_value) args[3]->null_value)
goto null; /* purecov: inspected */ goto null; /* purecov: inspected */
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->str_charset) && !args[0]->binary) if (use_mb(res->charset()) && !args[0]->binary)
{ {
start=res->charpos(start); start=res->charpos(start);
length=res->charpos(length,start); length=res->charpos(length,start);
...@@ -751,7 +751,7 @@ String *Item_func_left::val_str(String *str) ...@@ -751,7 +751,7 @@ String *Item_func_left::val_str(String *str)
if (length <= 0) if (length <= 0)
return &empty_string; return &empty_string;
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->str_charset) && !binary) if (use_mb(res->charset()) && !binary)
length = res->charpos(length); length = res->charpos(length);
#endif #endif
if (res->length() > (ulong) length) if (res->length() > (ulong) length)
...@@ -799,7 +799,7 @@ String *Item_func_right::val_str(String *str) ...@@ -799,7 +799,7 @@ String *Item_func_right::val_str(String *str)
if (res->length() <= (uint) length) if (res->length() <= (uint) length)
return res; /* purecov: inspected */ return res; /* purecov: inspected */
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->str_charset) && !binary) if (use_mb(res->charset()) && !binary)
{ {
uint start=res->numchars()-(uint) length; uint start=res->numchars()-(uint) length;
if (start<=0) return res; if (start<=0) return res;
...@@ -832,7 +832,7 @@ String *Item_func_substr::val_str(String *str) ...@@ -832,7 +832,7 @@ String *Item_func_substr::val_str(String *str)
(arg_count == 3 && args[2]->null_value)))) (arg_count == 3 && args[2]->null_value))))
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->str_charset) && !binary) if (use_mb(res->charset()) && !binary)
{ {
start=res->charpos(start); start=res->charpos(start);
length=res->charpos(length,start); length=res->charpos(length,start);
...@@ -892,7 +892,7 @@ String *Item_func_substr_index::val_str(String *str) ...@@ -892,7 +892,7 @@ String *Item_func_substr_index::val_str(String *str)
return &empty_string; // Wrong parameters return &empty_string; // Wrong parameters
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->str_charset) && !binary) if (use_mb(res->charset()) && !binary)
{ {
const char *ptr=res->ptr(); const char *ptr=res->ptr();
const char *strend = ptr+res->length(); const char *strend = ptr+res->length();
...@@ -917,7 +917,7 @@ String *Item_func_substr_index::val_str(String *str) ...@@ -917,7 +917,7 @@ String *Item_func_substr_index::val_str(String *str)
continue; continue;
} }
skipp: skipp:
if ((l=my_ismbchar(res->str_charset, ptr,strend))) ptr+=l; if ((l=my_ismbchar(res->charset(), ptr,strend))) ptr+=l;
else ++ptr; else ++ptr;
} /* either not found or got total number when count<0 */ } /* either not found or got total number when count<0 */
if (pass == 0) /* count<0 */ if (pass == 0) /* count<0 */
...@@ -1046,11 +1046,11 @@ String *Item_func_rtrim::val_str(String *str) ...@@ -1046,11 +1046,11 @@ String *Item_func_rtrim::val_str(String *str)
{ {
char chr=(*remove_str)[0]; char chr=(*remove_str)[0];
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->str_charset) && !binary) if (use_mb(res->charset()) && !binary)
{ {
while (ptr < end) while (ptr < end)
{ {
if ((l=my_ismbchar(res->str_charset, ptr,end))) ptr+=l,p=ptr; if ((l=my_ismbchar(res->charset(), ptr,end))) ptr+=l,p=ptr;
else ++ptr; else ++ptr;
} }
ptr=p; ptr=p;
...@@ -1063,12 +1063,12 @@ String *Item_func_rtrim::val_str(String *str) ...@@ -1063,12 +1063,12 @@ String *Item_func_rtrim::val_str(String *str)
{ {
const char *r_ptr=remove_str->ptr(); const char *r_ptr=remove_str->ptr();
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->str_charset) && !binary) if (use_mb(res->charset()) && !binary)
{ {
loop: loop:
while (ptr + remove_length < end) while (ptr + remove_length < end)
{ {
if ((l=my_ismbchar(res->str_charset, ptr,end))) ptr+=l; if ((l=my_ismbchar(res->charset(), ptr,end))) ptr+=l;
else ++ptr; else ++ptr;
} }
if (ptr + remove_length == end && !memcmp(ptr,r_ptr,remove_length)) if (ptr + remove_length == end && !memcmp(ptr,r_ptr,remove_length))
...@@ -1114,14 +1114,14 @@ String *Item_func_trim::val_str(String *str) ...@@ -1114,14 +1114,14 @@ String *Item_func_trim::val_str(String *str)
while (ptr+remove_length <= end && !memcmp(ptr,r_ptr,remove_length)) while (ptr+remove_length <= end && !memcmp(ptr,r_ptr,remove_length))
ptr+=remove_length; ptr+=remove_length;
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->str_charset) && !binary) if (use_mb(res->charset()) && !binary)
{ {
char *p=ptr; char *p=ptr;
register uint32 l; register uint32 l;
loop: loop:
while (ptr + remove_length < end) while (ptr + remove_length < end)
{ {
if ((l=my_ismbchar(res->str_charset, ptr,end))) ptr+=l; if ((l=my_ismbchar(res->charset(), ptr,end))) ptr+=l;
else ++ptr; else ++ptr;
} }
if (ptr + remove_length == end && !memcmp(ptr,r_ptr,remove_length)) if (ptr + remove_length == end && !memcmp(ptr,r_ptr,remove_length))
......
...@@ -22,23 +22,23 @@ pkglib_LIBRARIES = libmystrings.a ...@@ -22,23 +22,23 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X # Exact one of ASSEMBLER_X
if ASSEMBLER_x86 if ASSEMBLER_x86
ASRCS = strings-x86.s longlong2str-x86.s ASRCS = strings-x86.s longlong2str-x86.s
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c ctype.c ctype-simple.c ctype-mb.c strnlen.c CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c
else else
if ASSEMBLER_sparc if ASSEMBLER_sparc
# These file MUST all be on the same line!! Otherwise automake # These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile # generats a very broken makefile
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s strxmov-sparc.s ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s strxmov-sparc.s
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c ctype.c ctype-simple.c ctype-mb.c strnlen.c CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c
else else
#no assembler #no assembler
ASRCS = ASRCS =
# These file MUST all be on the same line!! Otherwise automake # These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile # generats a very broken makefile
CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c ctype.c ctype-simple.c ctype-mb.c strnlen.c CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c
endif endif
endif endif
libmystrings_a_SOURCES = @CHARSET_SRCS@ $(ASRCS) $(CSRCS) libmystrings_a_SOURCES = $(ASRCS) $(CSRCS)
noinst_PROGRAMS = conf_to_src noinst_PROGRAMS = conf_to_src
# Default charset definitions # Default charset definitions
EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c \ EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c \
...@@ -61,7 +61,7 @@ OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ ...@@ -61,7 +61,7 @@ OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\
sleep.h specific.h version.h pwd.h timers.h uio.h \ sleep.h specific.h version.h pwd.h timers.h uio.h \
cdefs.h machdep.h signal.h __signal.h util.h cdefs.h machdep.h signal.h __signal.h util.h
libmystrings_a_LIBADD= @CHARSET_OBJS@ libmystrings_a_LIBADD=
conf_to_src_SOURCES = conf_to_src.c conf_to_src_SOURCES = conf_to_src.c
conf_to_src_LDADD= conf_to_src_LDADD=
#force static linking of conf_to_src - essential when linking against #force static linking of conf_to_src - essential when linking against
...@@ -69,7 +69,7 @@ conf_to_src_LDADD= ...@@ -69,7 +69,7 @@ conf_to_src_LDADD=
conf_to_src_LDFLAGS= @NOINST_LDFLAGS@ conf_to_src_LDFLAGS= @NOINST_LDFLAGS@
# This is because the dependency tracking misses @FOO@ vars in sources. # This is because the dependency tracking misses @FOO@ vars in sources.
strtoull.o: @CHARSET_OBJS@ #strtoull.o: @CHARSET_OBJS@
if ASSEMBLER if ASSEMBLER
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "m_string.h" #include "m_string.h"
#include "m_ctype.h" #include "m_ctype.h"
#ifdef HAVE_CHARSET_big5
/* Support for Chinese(BIG5) characters, by jou@nematic.ieo.nctu.edu.tw /* Support for Chinese(BIG5) characters, by jou@nematic.ieo.nctu.edu.tw
modified by Wei He (hewei@mail.ied.ac.cn) */ modified by Wei He (hewei@mail.ied.ac.cn) */
...@@ -390,3 +392,5 @@ int mbcharlen_big5(uint c) ...@@ -390,3 +392,5 @@ int mbcharlen_big5(uint c)
{ {
return (isbig5head(c)? 2: 0); return (isbig5head(c)? 2: 0);
} }
#endif
...@@ -77,6 +77,8 @@ ...@@ -77,6 +77,8 @@
#endif #endif
#ifdef HAVE_CHARSET_czech
/* /*
These are four tables for four passes of the algorithm. Please see These are four tables for four passes of the algorithm. Please see
below for what are the "special values" below for what are the "special values"
...@@ -513,3 +515,5 @@ uchar NEAR sort_order_czech[] = { ...@@ -513,3 +515,5 @@ uchar NEAR sort_order_czech[] = {
}; };
#endif #endif
#endif
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
#include "m_string.h" #include "m_string.h"
#include "m_ctype.h" #include "m_ctype.h"
#ifdef HAVE_CHARSET_euc_kr
uchar NEAR ctype_euc_kr[257] = uchar NEAR ctype_euc_kr[257] =
{ {
0, /* For standard library */ 0, /* For standard library */
...@@ -196,3 +199,5 @@ int mbcharlen_euc_kr(uint c) ...@@ -196,3 +199,5 @@ int mbcharlen_euc_kr(uint c)
{ {
return (iseuc_kr(c) ? 2 : 0); return (iseuc_kr(c) ? 2 : 0);
} }
#endif
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "m_string.h" #include "m_string.h"
#include "m_ctype.h" #include "m_ctype.h"
#ifdef HAVE_CHARSET_gb2312
uchar NEAR ctype_gb2312[257] = uchar NEAR ctype_gb2312[257] =
{ {
0, /* For standard library */ 0, /* For standard library */
...@@ -178,3 +180,5 @@ int mbcharlen_gb2312(uint c) ...@@ -178,3 +180,5 @@ int mbcharlen_gb2312(uint c)
{ {
return (isgb2312head(c)? 2:0); return (isgb2312head(c)? 2:0);
} }
#endif
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#include "m_string.h" #include "m_string.h"
#include "m_ctype.h" #include "m_ctype.h"
#ifdef HAVE_CHARSET_gbk
/* Support for Chinese(GBK) characters, by hewei@mail.ied.ac.cn */ /* Support for Chinese(GBK) characters, by hewei@mail.ied.ac.cn */
#define isgbkhead(c) (0x81<=(uchar)(c) && (uchar)(c)<=0xfe) #define isgbkhead(c) (0x81<=(uchar)(c) && (uchar)(c)<=0xfe)
...@@ -2715,3 +2718,5 @@ int mbcharlen_gbk(uint c) ...@@ -2715,3 +2718,5 @@ int mbcharlen_gbk(uint c)
{ {
return (isgbkhead(c)? 2:0); return (isgbkhead(c)? 2:0);
} }
#endif
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include "m_string.h" #include "m_string.h"
#include "m_ctype.h" #include "m_ctype.h"
#ifdef HAVE_CHARSET_latin1_de
uchar ctype_latin1_de[] = { uchar ctype_latin1_de[] = {
0, 0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
...@@ -350,3 +352,5 @@ my_bool my_like_range_latin1_de(CHARSET_INFO *cs, ...@@ -350,3 +352,5 @@ my_bool my_like_range_latin1_de(CHARSET_INFO *cs,
*min_str++ = *max_str++ = ' '; // Because if key compression *min_str++ = *max_str++ = ' '; // Because if key compression
return 0; return 0;
} }
#endif
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
#include <my_global.h> #include <my_global.h>
#include "m_ctype.h" #include "m_ctype.h"
#ifdef USE_MB
void my_caseup_str_mb(CHARSET_INFO * cs, char *str) void my_caseup_str_mb(CHARSET_INFO * cs, char *str)
{ {
register uint32 l; register uint32 l;
...@@ -123,3 +126,4 @@ int my_strncasecmp_mb(CHARSET_INFO * cs, ...@@ -123,3 +126,4 @@ int my_strncasecmp_mb(CHARSET_INFO * cs,
return 0; return 0;
} }
#endif
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#include "m_string.h" #include "m_string.h"
#include "m_ctype.h" #include "m_ctype.h"
#ifdef HAVE_CHARSET_sjis
/* /*
* This comment is parsed by configure to create ctype.c, * This comment is parsed by configure to create ctype.c,
* so don't change it unless you know what you are doing. * so don't change it unless you know what you are doing.
...@@ -308,3 +311,5 @@ my_bool my_like_range_sjis(CHARSET_INFO *cs, ...@@ -308,3 +311,5 @@ my_bool my_like_range_sjis(CHARSET_INFO *cs,
*min_str++ = *max_str++ = ' '; /* Because if key compression */ *min_str++ = *max_str++ = ' '; /* Because if key compression */
return 0; return 0;
} }
#endif
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#include "m_ctype.h" #include "m_ctype.h"
#include "t_ctype.h" #include "t_ctype.h"
#ifdef HAVE_CHARSET_tis620
static uchar* thai2sortable(const uchar *tstr,uint len); static uchar* thai2sortable(const uchar *tstr,uint len);
#define BUFFER_MULTIPLY 4 #define BUFFER_MULTIPLY 4
...@@ -682,3 +684,5 @@ void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length) ...@@ -682,3 +684,5 @@ void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length)
} }
} }
} }
#endif
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#include "m_string.h" #include "m_string.h"
#include "m_ctype.h" #include "m_ctype.h"
#ifdef HAVE_CHARSET_ujis
uchar NEAR ctype_ujis[257] = uchar NEAR ctype_ujis[257] =
{ {
0, /* For standard library */ 0, /* For standard library */
...@@ -198,3 +201,5 @@ int mbcharlen_ujis(uint c) ...@@ -198,3 +201,5 @@ int mbcharlen_ujis(uint c)
{ {
return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 0); return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 0);
} }
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment