Commit 6539c6a5 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

ctype.c, Makefile.am, Makefile.shared:

  binary charset
ctype-bin.c:
  new file
parent 5bcd7e1a
......@@ -38,7 +38,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
strcend.lo bcmp.lo \
bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
strtoull.lo strtoll.lo llstr.lo \
ctype.lo ctype-simple.lo ctype-mb.lo \
ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \
ctype-big5.lo ctype-czech.lo ctype-euc_kr.lo \
ctype-win1250ch.lo ctype-utf8.lo \
ctype-gb2312.lo ctype-gbk.lo ctype-latin1_de.lo \
......
......@@ -22,19 +22,19 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X
if ASSEMBLER_x86
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 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 ctype-utf8.c ctype-win1250ch.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 ctype-utf8.c ctype-win1250ch.c ctype-bin.c
else
if ASSEMBLER_sparc
# These file MUST all be on the same line!! Otherwise automake
# 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
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 ctype-utf8.c ctype-win1250ch.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 ctype-utf8.c ctype-win1250ch.c ctype-bin.c
else
#no assembler
ASRCS =
# These file MUST all be on the same line!! Otherwise automake
# 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 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 ctype-utf8.c ctype-win1250ch.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 ctype-utf8.c ctype-win1250ch.c ctype-bin.c
endif
endif
......
/* Copyright (C) 2002 MySQL AB & tommy@valley.ne.jp.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/* This file is for binary pseudo charset, created by bar@mysql.com */
#include <my_global.h>
#include "m_string.h"
#include "m_ctype.h"
static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)),
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
int len = ( slen > tlen ) ? tlen : slen;
return memcmp(s,t,len);
}
static void my_caseup_str_bin(CHARSET_INFO *cs __attribute__((unused)),
char *str __attribute__((unused)))
{
}
static void my_casedn_str_bin(CHARSET_INFO * cs __attribute__((unused)),
char *str __attribute__((unused)))
{
}
static void my_caseup_bin(CHARSET_INFO * cs __attribute__((unused)),
char *str __attribute__((unused)),
uint length __attribute__((unused)))
{
}
static void my_casedn_bin(CHARSET_INFO * cs __attribute__((unused)),
char *str __attribute__((unused)),
uint length __attribute__((unused)))
{
}
static void my_tosort_bin(CHARSET_INFO * cs __attribute__((unused)),
char *str __attribute__((unused)),
uint length __attribute__((unused)))
{
}
static int my_strcasecmp_bin(CHARSET_INFO * cs __attribute__((unused)),
const char *s, const char *t)
{
return strcmp(s,t);
}
static int my_strncasecmp_bin(CHARSET_INFO * cs __attribute__((unused)),
const char *s, const char *t, uint len)
{
return memcmp(s,t,len);
}
static int my_mb_wc_bin(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *wc,
const unsigned char *str,
const unsigned char *end __attribute__((unused)))
{
*wc=str[0];
return 1;
}
static int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t wc,
unsigned char *s,
unsigned char *e __attribute__((unused)))
{
if ( wc<256 )
{
s[0]=wc;
return 1;
}
return MY_CS_ILUNI;
}
#ifndef NEW_HASH_FUNCTION
/* Calc hashvalue for a key, case indepenently */
static uint my_hash_caseup_bin(CHARSET_INFO *cs __attribute__((unused)),
const byte *key, uint length)
{
register uint nr=1, nr2=4;
while (length--)
{
nr^= (((nr & 63)+nr2)*
((uint) (uchar) *key++)) + (nr << 8);
nr2+=3;
}
return((uint) nr);
}
#else
static uint my_hash_caseup_bin(CHARSET_INFO *cs __attribute__((unused)),
const byte *key, uint len)
{
const byte *end=key+len;
uint hash;
for (hash = 0; key < end; key++)
{
hash *= 16777619;
hash ^= (uint) (uchar) *key;
}
return (hash);
}
#endif
void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)),
const uchar *key, uint len,ulong *nr1, ulong *nr2)
{
const uchar *pos = key;
key+= len;
for (; pos < (uchar*) key ; pos++)
{
nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) *
((uint)*pos)) + (nr1[0] << 8);
nr2[0]+=3;
}
}
CHARSET_INFO my_charset_bin =
{
63, /* number */
MY_CS_COMPILED, /* state */
"binary", /* name */
"", /* comment */
NULL, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
my_strnncoll_binary, /* strnncoll */
NULL, /* strxnfrm */
NULL, /* like_rabge */
0, /* mbmaxlen */
NULL, /* ismbchar */
NULL, /* ismbhead */
NULL, /* mbcharlen */
my_mb_wc_bin, /* mb_wc */
my_wc_mb_bin, /* wc_mb */
my_caseup_str_bin, /* caseup_str */
my_casedn_str_bin, /* casedn_str */
my_caseup_bin, /* caseup */
my_casedn_bin, /* casedn */
my_tosort_bin, /* tosort */
my_strcasecmp_bin, /* strcasecmp */
my_strncasecmp_bin, /* strncasecmp */
my_hash_caseup_bin, /* hash_caseup */
my_hash_sort_bin, /* hash_sort */
0 /* max_sort_char */
};
......@@ -3658,6 +3658,7 @@ CHARSET_INFO *system_charset_info = &compiled_charsets[0];
#define MY_ADD_CHARSET(x) all_charsets[(x)->number]=(x)
extern CHARSET_INFO my_charset_bin;
extern CHARSET_INFO my_charset_big5;
extern CHARSET_INFO my_charset_czech;
extern CHARSET_INFO my_charset_euc_kr;
......@@ -3676,6 +3677,8 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
{
CHARSET_INFO *cs;
MY_ADD_CHARSET(&my_charset_bin);
#ifdef HAVE_CHARSET_big5
MY_ADD_CHARSET(&my_charset_big5);
#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