summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_ctype.h3
-rw-r--r--strings/ctype-big5.c1
-rw-r--r--strings/ctype-bin.c3
-rw-r--r--strings/ctype-euc_kr.c1
-rw-r--r--strings/ctype-gb2312.c1
-rw-r--r--strings/ctype-gbk.c1
-rw-r--r--strings/ctype-latin1.c3
-rw-r--r--strings/ctype-mb.c232
-rw-r--r--strings/ctype-simple.c8
-rw-r--r--strings/ctype-sjis.c1
-rw-r--r--strings/ctype-tis620.c1
-rw-r--r--strings/ctype-ucs2.c1
-rw-r--r--strings/ctype-ujis.c1
-rw-r--r--strings/ctype-utf8.c1
14 files changed, 256 insertions, 2 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 1b6e7bf6739..65b11f4c06a 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -149,6 +149,7 @@ typedef struct my_charset_handler_st
uint (*well_formed_len)(struct charset_info_st *,
const char *b,const char *e, uint nchars);
uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
+ uint (*numcells)(struct charset_info_st *, const char *b, const char *e);
/* Unicode convertion */
int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc,
@@ -325,6 +326,7 @@ int my_wildcmp_8bit(CHARSET_INFO *,
int escape, int w_one, int w_many);
uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
+uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
@@ -342,6 +344,7 @@ int my_wildcmp_mb(CHARSET_INFO *,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many);
uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
+uint my_numcells_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_instr_mb(struct charset_info_st *,
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 0955372e8c0..3f35f7504ac 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -6290,6 +6290,7 @@ static MY_CHARSET_HANDLER my_charset_big5_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
+ my_numcells_mb,
my_mb_wc_big5, /* mb_wc */
my_wc_mb_big5, /* wc_mb */
my_caseup_str_mb,
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index e759a5654f1..9e59c22c31e 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -448,6 +448,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_8bit,
my_well_formed_len_8bit,
my_lengthsp_8bit,
+ my_numcells_8bit,
my_mb_wc_bin,
my_wc_mb_bin,
my_case_str_bin,
@@ -478,7 +479,7 @@ CHARSET_INFO my_charset_bin =
ctype_bin, /* ctype */
bin_char_array, /* to_lower */
bin_char_array, /* to_upper */
- bin_char_array, /* sort_order */
+ NULL, /* sort_order */
NULL, /* contractions */
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index bcf66e2a828..43a50b0dfbe 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -8657,6 +8657,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
+ my_numcells_mb,
my_mb_wc_euc_kr, /* mb_wc */
my_wc_mb_euc_kr, /* wc_mb */
my_caseup_str_mb,
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index e4e14259620..8d97ac9ca1d 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -5708,6 +5708,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
+ my_numcells_mb,
my_mb_wc_gb2312, /* mb_wc */
my_wc_mb_gb2312, /* wc_mb */
my_caseup_str_mb,
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 80876cac41f..9400fb08f2b 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -9939,6 +9939,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
+ my_numcells_mb,
my_mb_wc_gbk,
my_wc_mb_gbk,
my_caseup_str_mb,
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index f4717c51a1e..614717998fb 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -387,6 +387,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_8bit,
my_well_formed_len_8bit,
my_lengthsp_8bit,
+ my_numcells_8bit,
my_mb_wc_latin1,
my_wc_mb_latin1,
my_caseup_str_8bit,
@@ -700,7 +701,7 @@ CHARSET_INFO my_charset_latin1_german2_ci=
ctype_latin1,
to_lower_latin1,
to_upper_latin1,
- sort_order_latin1_de,
+ NULL,
NULL, /* contractions */
NULL, /* sort_order_big*/
cs_to_uni, /* tab_to_uni */
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index ecafa6356d5..7af76126fc4 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -570,6 +570,238 @@ static int my_wildcmp_mb_bin(CHARSET_INFO *cs,
}
+/*
+ Data was produced from EastAsianWidth.txt
+ using utt11-dump utility.
+*/
+static char pg11[256]=
+{
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,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,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,0,0,0,0,0,0,0,0,0,
+1,1,1,1,1,1,1,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
+};
+
+static struct {int page; char *p;} utr11_data[256]=
+{
+{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},
+{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},
+{0,NULL},{0,pg11},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},
+{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},
+{0,NULL},{0,NULL},{0,NULL},{0,pg23},{0,NULL},{0,NULL},{0,NULL},{0,NULL},
+{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,pg2E},{0,pg2F},
+{0,pg30},{0,pg31},{0,pg32},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{0,pg4D},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{0,pg9F},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{0,pgA4},{0,NULL},{0,NULL},{0,NULL},
+{0,NULL},{0,NULL},{0,NULL},{0,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},
+{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{0,pgD7},
+{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},
+{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},
+{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},
+{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},
+{0,NULL},{1,NULL},{0,pgFA},{0,NULL},{0,NULL},{0,NULL},{0,pgFE},{0,pgFF}
+};
+
+uint my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e)
+{
+ my_wc_t wc;
+ int clen= 0;
+
+ while (b < e)
+ {
+ int mblen;
+ uint pg;
+ if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0)
+ {
+ mblen= 1; /* Let's think a wrong sequence takes 1 dysplay cell */
+ b++;
+ continue;
+ }
+ b+= mblen;
+ pg= (wc >> 8) & 0xFF;
+ clen+= utr11_data[pg].p ? utr11_data[pg].p[wc & 0xFF] : utr11_data[pg].page;
+ clen++;
+ }
+ return clen;
+}
+
+
MY_COLLATION_HANDLER my_collation_mb_bin_handler =
{
NULL, /* init */
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index fbe702d27ad..84bfcb0b171 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1056,6 +1056,13 @@ uint my_numchars_8bit(CHARSET_INFO *cs __attribute__((unused)),
}
+uint my_numcells_8bit(CHARSET_INFO *cs __attribute__((unused)),
+ const char *b, const char *e)
+{
+ return e-b;
+}
+
+
uint my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *b __attribute__((unused)),
const char *e __attribute__((unused)),
@@ -1287,6 +1294,7 @@ MY_CHARSET_HANDLER my_charset_8bit_handler=
my_charpos_8bit,
my_well_formed_len_8bit,
my_lengthsp_8bit,
+ my_numcells_8bit,
my_mb_wc_8bit,
my_wc_mb_8bit,
my_caseup_str_8bit,
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 65d096b96fc..b4cfee0f24a 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -4558,6 +4558,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
+ my_numcells_mb,
my_mb_wc_sjis, /* mb_wc */
my_wc_mb_sjis, /* wc_mb */
my_caseup_str_8bit,
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index 60f02e3146d..420c5b5582e 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -930,6 +930,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_8bit,
my_well_formed_len_8bit,
my_lengthsp_8bit,
+ my_numcells_8bit,
my_mb_wc_tis620, /* mb_wc */
my_wc_mb_tis620, /* wc_mb */
my_caseup_str_8bit,
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 645e2e49fc1..c6e55ee8f0e 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1423,6 +1423,7 @@ MY_CHARSET_HANDLER my_charset_ucs2_handler=
my_charpos_ucs2,
my_well_formed_len_ucs2,
my_lengthsp_ucs2,
+ my_numcells_mb,
my_ucs2_uni, /* mb_wc */
my_uni_ucs2, /* wc_mb */
my_caseup_str_ucs2,
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index 746c31f37a0..37c26a3bbc4 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -8443,6 +8443,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
+ my_numcells_mb,
my_mb_wc_euc_jp, /* mb_wc */
my_wc_mb_euc_jp, /* wc_mb */
my_caseup_str_mb,
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index f7a70afcb92..7c3baac3c39 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -2066,6 +2066,7 @@ MY_CHARSET_HANDLER my_charset_utf8_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
+ my_numcells_mb,
my_utf8_uni,
my_uni_utf8,
my_caseup_str_utf8,