MySQL 8.3.0
Source Code Documentation
ctype-gbk.cc File Reference
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include "my_compiler.h"
#include "mysql/strings/m_ctype.h"
#include "strings/m_ctype_internals.h"

Macros

#define isgbkhead(c)   (0x81 <= (uint8_t)(c) && (uint8_t)(c) <= 0xfe)
 
#define isgbktail(c)
 
#define isgbkcode(c, d)   (isgbkhead(c) && isgbktail(d))
 
#define gbkcode(c, d)   ((((unsigned)(uint8_t)(c)) << 8) | (uint8_t)(d))
 
#define gbkhead(e)   ((uint8_t)((e) >> 8))
 
#define gbktail(e)   ((uint8_t)((e)&0xff))
 

Functions

static uint16_t gbksortorder (uint16_t i)
 
static int my_strnncoll_gbk_internal (const uint8_t **a_res, const uint8_t **b_res, size_t length)
 
static int my_strnncoll_gbk (const CHARSET_INFO *cs, const uint8_t *a, size_t a_length, const uint8_t *b, size_t b_length, bool b_is_prefix)
 
static int my_strnncollsp_gbk (const CHARSET_INFO *cs, const uint8_t *a, size_t a_length, const uint8_t *b, size_t b_length)
 
static size_t my_strnxfrm_gbk (const CHARSET_INFO *cs, uint8_t *dst, size_t dstlen, unsigned nweights, const uint8_t *src, size_t srclen, unsigned flags)
 
static unsigned ismbchar_gbk (const CHARSET_INFO *cs, const char *p, const char *e)
 
static unsigned mbcharlen_gbk (const CHARSET_INFO *cs, unsigned c)
 
static int func_gbk_uni_onechar (int code)
 
static int func_uni_gbk_onechar (int code)
 
static int my_wc_mb_gbk (const CHARSET_INFO *cs, my_wc_t wc, uint8_t *s, uint8_t *e)
 
static int my_mb_wc_gbk (const CHARSET_INFO *cs, my_wc_t *pwc, const uint8_t *s, const uint8_t *e)
 
static size_t my_well_formed_len_gbk (const CHARSET_INFO *cs, const char *b, const char *e, size_t pos, int *error)
 

Variables

static const uint8_t ctype_gbk [257]
 
static const uint8_t to_lower_gbk []
 
static const uint8_t to_upper_gbk []
 
static const MY_UNICASE_CHARACTER cA2 [256]
 
static const MY_UNICASE_CHARACTER cA3 [256]
 
static const MY_UNICASE_CHARACTER cA6 [256]
 
static const MY_UNICASE_CHARACTER cA7 [256]
 
static const MY_UNICASE_CHARACTERmy_caseinfo_pages_gbk [256]
 
static MY_UNICASE_INFO my_caseinfo_gbk = {0xFFFF, my_caseinfo_pages_gbk}
 
static const uint8_t sort_order_gbk []
 
static const uint16_t gbk_order []
 
static const uint16_t tab_gbk_uni0 []
 
static const uint16_t tab_uni_gbk0 []
 
static const uint16_t tab_uni_gbk1 []
 
static const uint16_t tab_uni_gbk2 []
 
static const uint16_t tab_uni_gbk3 []
 
static const uint16_t tab_uni_gbk4 []
 
static const uint16_t tab_uni_gbk5 []
 
static const uint16_t tab_uni_gbk6 []
 
static const uint16_t tab_uni_gbk7 []
 
static const uint16_t tab_uni_gbk8 []
 
static MY_COLLATION_HANDLER my_collation_ci_handler
 
static MY_CHARSET_HANDLER my_charset_handler
 
CHARSET_INFO my_charset_gbk_chinese_ci
 
CHARSET_INFO my_charset_gbk_bin
 

Macro Definition Documentation

◆ gbkcode

#define gbkcode (   c,
 
)    ((((unsigned)(uint8_t)(c)) << 8) | (uint8_t)(d))

◆ gbkhead

#define gbkhead (   e)    ((uint8_t)((e) >> 8))

◆ gbktail

#define gbktail (   e)    ((uint8_t)((e)&0xff))

◆ isgbkcode

#define isgbkcode (   c,
 
)    (isgbkhead(c) && isgbktail(d))

◆ isgbkhead

#define isgbkhead (   c)    (0x81 <= (uint8_t)(c) && (uint8_t)(c) <= 0xfe)

◆ isgbktail

#define isgbktail (   c)
Value:
((0x40 <= (uint8_t)(c) && (uint8_t)(c) <= 0x7e) || \
(0x80 <= (uint8_t)(c) && (uint8_t)(c) <= 0xfe))

Function Documentation

◆ func_gbk_uni_onechar()

static int func_gbk_uni_onechar ( int  code)
static

◆ func_uni_gbk_onechar()

static int func_uni_gbk_onechar ( int  code)
static

◆ gbksortorder()

static uint16_t gbksortorder ( uint16_t  i)
static

◆ ismbchar_gbk()

static unsigned ismbchar_gbk ( const CHARSET_INFO cs,
const char *  p,
const char *  e 
)
static

◆ mbcharlen_gbk()

static unsigned mbcharlen_gbk ( const CHARSET_INFO cs,
unsigned  c 
)
static

◆ my_mb_wc_gbk()

static int my_mb_wc_gbk ( const CHARSET_INFO cs,
my_wc_t pwc,
const uint8_t *  s,
const uint8_t *  e 
)
static

◆ my_strnncoll_gbk()

static int my_strnncoll_gbk ( const CHARSET_INFO cs,
const uint8_t *  a,
size_t  a_length,
const uint8_t *  b,
size_t  b_length,
bool  b_is_prefix 
)
static

◆ my_strnncoll_gbk_internal()

static int my_strnncoll_gbk_internal ( const uint8_t **  a_res,
const uint8_t **  b_res,
size_t  length 
)
static

◆ my_strnncollsp_gbk()

static int my_strnncollsp_gbk ( const CHARSET_INFO cs,
const uint8_t *  a,
size_t  a_length,
const uint8_t *  b,
size_t  b_length 
)
static

◆ my_strnxfrm_gbk()

static size_t my_strnxfrm_gbk ( const CHARSET_INFO cs,
uint8_t *  dst,
size_t  dstlen,
unsigned  nweights,
const uint8_t *  src,
size_t  srclen,
unsigned  flags 
)
static

◆ my_wc_mb_gbk()

static int my_wc_mb_gbk ( const CHARSET_INFO cs,
my_wc_t  wc,
uint8_t *  s,
uint8_t *  e 
)
static

◆ my_well_formed_len_gbk()

static size_t my_well_formed_len_gbk ( const CHARSET_INFO cs,
const char *  b,
const char *  e,
size_t  pos,
int *  error 
)
static

Variable Documentation

◆ cA2

const MY_UNICASE_CHARACTER cA2[256]
static

◆ cA3

const MY_UNICASE_CHARACTER cA3[256]
static

◆ cA6

const MY_UNICASE_CHARACTER cA6[256]
static

◆ cA7

const MY_UNICASE_CHARACTER cA7[256]
static

◆ ctype_gbk

const uint8_t ctype_gbk[257]
static
Initial value:
= {
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, 32, 32, 32, 32, 32, 32, 32,
72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 16, 16, 16, 16, 16, 16,
16, 129, 129, 129, 129, 129, 129, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16,
16, 130, 130, 130, 130, 130, 130, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0,
}

◆ gbk_order

const uint16_t gbk_order[]
static

◆ my_caseinfo_gbk

MY_UNICASE_INFO my_caseinfo_gbk = {0xFFFF, my_caseinfo_pages_gbk}
static

◆ my_caseinfo_pages_gbk

const MY_UNICASE_CHARACTER* my_caseinfo_pages_gbk[256]
static

◆ my_charset_gbk_bin

CHARSET_INFO my_charset_gbk_bin

◆ my_charset_gbk_chinese_ci

CHARSET_INFO my_charset_gbk_chinese_ci

◆ my_charset_handler

MY_CHARSET_HANDLER my_charset_handler
static
Initial value:
= {nullptr,
static int my_mb_wc_gbk(const CHARSET_INFO *cs, my_wc_t *pwc, const uint8_t *s, const uint8_t *e)
Definition: ctype-gbk.cc:9958
static unsigned mbcharlen_gbk(const CHARSET_INFO *cs, unsigned c)
Definition: ctype-gbk.cc:3614
static unsigned ismbchar_gbk(const CHARSET_INFO *cs, const char *p, const char *e)
Definition: ctype-gbk.cc:3609
static int my_wc_mb_gbk(const CHARSET_INFO *cs, my_wc_t wc, uint8_t *s, uint8_t *e)
Definition: ctype-gbk.cc:9938
static size_t my_well_formed_len_gbk(const CHARSET_INFO *cs, const char *b, const char *e, size_t pos, int *error)
Definition: ctype-gbk.cc:9981
int my_mb_ctype_mb(const CHARSET_INFO *cs, int *ctype, const uint8_t *s, const uint8_t *e)
Definition: ctype-mb.cc:1321
size_t my_numchars_mb(const CHARSET_INFO *cs, const char *pos, const char *end)
Definition: ctype-mb.cc:314
size_t my_casedn_mb(const CHARSET_INFO *cs, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-mb.cc:111
size_t my_casedn_str_mb(const CHARSET_INFO *cs, char *str)
Definition: ctype-mb.cc:57
size_t my_caseup_mb(const CHARSET_INFO *cs, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-mb.cc:84
size_t my_charpos_mb3(const CHARSET_INFO *cs, const char *pos, const char *end, size_t length)
Definition: ctype-mb.cc:325
size_t my_caseup_str_mb(const CHARSET_INFO *cs, char *str)
Definition: ctype-mb.cc:40
size_t my_numcells_8bit(const CHARSET_INFO *cs, const char *b, const char *e)
Definition: ctype-simple.cc:907
long long my_strtoll10_8bit(const CHARSET_INFO *cs, const char *nptr, const char **endptr, int *error)
Definition: ctype-simple.cc:1124
unsigned long long my_strntoull10rnd_8bit(const CHARSET_INFO *cs, const char *str, size_t length, int unsigned_flag, const char **endptr, int *error)
Definition: ctype-simple.cc:1220
double my_strntod_8bit(const CHARSET_INFO *cs, const char *str, size_t length, const char **end, int *err)
Definition: ctype-simple.cc:635
long long my_strntoll_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:460
size_t my_longlong10_to_str_8bit(const CHARSET_INFO *cs, char *dst, size_t len, int radix, long long val)
Definition: ctype-simple.cc:685
size_t my_long10_to_str_8bit(const CHARSET_INFO *cs, char *dst, size_t len, int radix, long int val)
Definition: ctype-simple.cc:649
size_t my_lengthsp_8bit(const CHARSET_INFO *cs, const char *ptr, size_t length)
Definition: ctype-simple.cc:926
unsigned long long my_strntoull_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:538
size_t my_snprintf_8bit(const CHARSET_INFO *cs, char *to, size_t n, const char *fmt,...)
Definition: ctype-simple.cc:277
void my_fill_8bit(const CHARSET_INFO *cs, char *s, size_t l, int fill)
Definition: ctype-simple.cc:897
unsigned long my_strntoul_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:388
long my_strntol_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:310
size_t my_scan_8bit(const CHARSET_INFO *cs, const char *str, const char *end, int sq)
Definition: ctype-simple.cc:875

◆ my_collation_ci_handler

MY_COLLATION_HANDLER my_collation_ci_handler
static
Initial value:
= {nullptr,
nullptr,
static int my_strnncollsp_gbk(const CHARSET_INFO *cs, const uint8_t *a, size_t a_length, const uint8_t *b, size_t b_length)
Definition: ctype-gbk.cc:3557
static size_t my_strnxfrm_gbk(const CHARSET_INFO *cs, uint8_t *dst, size_t dstlen, unsigned nweights, const uint8_t *src, size_t srclen, unsigned flags)
Definition: ctype-gbk.cc:3583
static int my_strnncoll_gbk(const CHARSET_INFO *cs, const uint8_t *a, size_t a_length, const uint8_t *b, size_t b_length, bool b_is_prefix)
Definition: ctype-gbk.cc:3549
unsigned my_instr_mb(const CHARSET_INFO *cs, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, unsigned nmatch)
Definition: ctype-mb.cc:356
int my_wildcmp_mb(const 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: ctype-mb.cc:307
int my_strcasecmp_mb(const CHARSET_INFO *cs, const char *s, const char *t)
Definition: ctype-mb.cc:193
bool my_like_range_mb(const CHARSET_INFO *cs, const char *ptr, size_t ptr_length, char escape, char w_one, char w_many, size_t res_length, char *min_str, char *max_str, size_t *min_length, size_t *max_length)
Definition: ctype-mb.cc:656
bool my_propagate_simple(const CHARSET_INFO *cs, const uint8_t *str, size_t length)
Definition: ctype-simple.cc:1473
size_t my_strnxfrmlen_simple(const CHARSET_INFO *cs, size_t len)
Definition: ctype-simple.cc:61
void my_hash_sort_simple(const CHARSET_INFO *cs, const uint8_t *key, size_t len, uint64_t *nr1, uint64_t *nr2)
Definition: ctype-simple.cc:287

◆ sort_order_gbk

const uint8_t sort_order_gbk[]
static

◆ tab_gbk_uni0

const uint16_t tab_gbk_uni0[]
static

◆ tab_uni_gbk0

const uint16_t tab_uni_gbk0[]
static

◆ tab_uni_gbk1

const uint16_t tab_uni_gbk1[]
static

◆ tab_uni_gbk2

const uint16_t tab_uni_gbk2[]
static

◆ tab_uni_gbk3

const uint16_t tab_uni_gbk3[]
static

◆ tab_uni_gbk4

const uint16_t tab_uni_gbk4[]
static
Initial value:
= {
0xA2E5, 0xA2E6, 0xA2E7, 0xA2E8, 0xA2E9, 0xA2EA, 0xA2EB, 0xA2EC, 0xA2ED,
0xA2EE, 0, 0, 0, 0, 0, 0, 0, 0xA95A,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0xA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0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0xFE40,
0xFE41, 0xFE42, 0xFE43, 0, 0xFE44, 0, 0xFE45, 0xFE46, 0,
0, 0, 0xFE47, 0, 0, 0, 0, 0, 0,
0xFE48, 0xFE49, 0xFE4A, 0, 0xFE4B, 0xFE4C, 0, 0, 0xFE4D,
0xFE4E, 0xFE4F}

◆ tab_uni_gbk8

const uint16_t tab_uni_gbk8[]
static

◆ to_lower_gbk

const uint8_t to_lower_gbk[]
static

◆ to_upper_gbk

const uint8_t to_upper_gbk[]
static