aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-28 04:27:24 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-28 04:27:24 +0000
commit0e16ecfa1e7689c0b3be626f9a3441ebb5710c70 (patch)
tree12a793be9d9a1f7a4a911239194bae33470dcb23
parent37696206076f6f075542adfdc4b1fe49100e9f32 (diff)
downloadglibc-0e16ecfa1e7689c0b3be626f9a3441ebb5710c70.tar.xz
glibc-0e16ecfa1e7689c0b3be626f9a3441ebb5710c70.zip
Update.
* locale/programs/ld-ctype.c (ctype_finish): Take all characters from the input charset into account when generating the hash table. (allocate_arrays): Correct setting default width. Not all empty slots in the table are filled, only those not covert explicitly by the locale description and in the charset. * stdio-common/vfscanf.c: Make sure to always return WEOF and EOF for wide character version. For %C handling, test correct pointer variable for NULL. * wcsmbs/wctob.c: Handle WEOF special. * wcsmbs/wcwidth.h: 0xff in width array means invalid character. * wctype/wctype.h: Protect gcc-isms with __extension__. Avoid always-true test to avoid warning.
-rw-r--r--ChangeLog17
-rw-r--r--locale/programs/ld-ctype.c64
-rw-r--r--localedata/ChangeLog42
-rw-r--r--localedata/Makefile32
-rw-r--r--localedata/charmaps/EUC-JP2
-rw-r--r--localedata/tests-mbwc/dat_iswcntrl.c4
-rw-r--r--localedata/tests-mbwc/dat_iswctype.c10
-rw-r--r--localedata/tests-mbwc/dat_iswprint.c3
-rw-r--r--localedata/tests-mbwc/dat_swscanf.c16
-rw-r--r--localedata/tests-mbwc/dat_towctrans.c8
-rw-r--r--localedata/tests-mbwc/dat_wcscoll.c24
-rw-r--r--localedata/tests-mbwc/dat_wcswidth.c31
-rw-r--r--localedata/tests-mbwc/dat_wcsxfrm.c5
-rw-r--r--localedata/tests-mbwc/dat_wctob.c11
-rw-r--r--localedata/tests-mbwc/dat_wcwidth.c16
-rw-r--r--localedata/tests-mbwc/tst_funcs.h156
-rw-r--r--localedata/tests-mbwc/tst_swscanf.c2
-rw-r--r--localedata/tests-mbwc/tst_towctrans.c6
-rw-r--r--localedata/tests-mbwc/tst_wcschr.c2
-rw-r--r--localedata/tests-mbwc/tst_wcscoll.c25
-rw-r--r--localedata/tests-mbwc/tst_wcscpy.c2
-rw-r--r--localedata/tests-mbwc/tst_wcsncat.c2
-rw-r--r--localedata/tests-mbwc/tst_wcsncpy.c2
-rw-r--r--localedata/tests-mbwc/tst_wcspbrk.c4
-rw-r--r--localedata/tests-mbwc/tst_wcsstr.c6
-rw-r--r--localedata/tests-mbwc/tst_wctrans.c3
-rw-r--r--localedata/tests-mbwc/tst_wctype.c2
-rw-r--r--localedata/tst-ctype-de_DE.in2
-rwxr-xr-xlocaledata/tst-ctype.sh3
-rw-r--r--stdio-common/vfscanf.c6
-rw-r--r--wcsmbs/wctob.c3
-rw-r--r--wcsmbs/wcwidth.h6
-rw-r--r--wctype/wctype.h77
33 files changed, 435 insertions, 159 deletions
diff --git a/ChangeLog b/ChangeLog
index e53b21df1f..fa9eaeafe8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,25 @@
2000-06-27 Ulrich Drepper <drepper@redhat.com>
+ * locale/programs/ld-ctype.c (ctype_finish): Take all characters from
+ the input charset into account when generating the hash table.
+ (allocate_arrays): Correct setting default width. Not all empty slots
+ in the table are filled, only those not covert explicitly by the
+ locale description and in the charset.
+
* wctype/towctrans.c (__towctrans): Be graceful and accept error
return values from the wctrans function.
+ * stdio-common/vfscanf.c: Make sure to always return WEOF and EOF for
+ wide character version.
+ For %C handling, test correct pointer variable for NULL.
+
+ * wcsmbs/wctob.c: Handle WEOF special.
+
+ * wcsmbs/wcwidth.h: 0xff in width array means invalid character.
+
+ * wctype/wctype.h: Protect gcc-isms with __extension__. Avoid
+ always-true test to avoid warning.
+
2000-06-27 Greg McGary <greg@mcgary.org>
* elf/dl-open.c (_dl_sysdep_start): Wrap weak_extern decl in BP_SYM ().
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index ce097e741b..417660160f 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -345,6 +345,10 @@ ctype_finish (struct localedef_t *locale, struct charmap_t *charmap)
struct charseq *space_seq;
struct locale_ctype_t *ctype = locale->categories[LC_CTYPE].ctype;
int warned;
+ const void *key;
+ size_t len;
+ void *vdata;
+ void *curs;
/* Now resolve copying and also handle completely missing definitions. */
if (ctype == NULL)
@@ -637,6 +641,21 @@ character '%s' in class `%s' must not be in class `%s'"),
}
}
+ /* Now set all the other characters of the character set to the
+ default width. */
+ curs = NULL;
+ while (iterate_table (&charmap->char_table, &curs, &key, &len, &vdata) == 0)
+ {
+ struct charseq *data = (struct charseq *) vdata;
+
+ if (data->ucs4 == UNINITIALIZED_CHAR_VALUE)
+ data->ucs4 = repertoire_find_value (ctype->repertoire,
+ data->name, len);
+
+ if (data->ucs4 != ILLEGAL_CHAR_VALUE)
+ (void) find_idx (ctype, NULL, NULL, NULL, data->ucs4);
+ }
+
/* There must be a multiple of 10 digits. */
if (ctype->mbdigits_act % 10 != 0)
{
@@ -3158,6 +3177,10 @@ allocate_arrays (struct locale_ctype_t *ctype, struct charmap_t *charmap,
{
size_t idx;
size_t width_table_size;
+ const void *key;
+ size_t len;
+ void *vdata;
+ void *curs;
/* First we have to decide how we organize the arrays. It is easy
for a one-byte character set. But multi-byte character set
@@ -3345,8 +3368,8 @@ Computing table size for character classes might take a while..."),
width_table_size = (ctype->plane_size * ctype->plane_cnt + 3) & ~3ul;
ctype->width = (unsigned char *) xmalloc (width_table_size);
- /* Initialize with default width value. */
- memset (ctype->width, charmap->width_default, width_table_size);
+ /* Initialize with -1. */
+ memset (ctype->width, '\xff', width_table_size);
if (charmap->width_rules != NULL)
{
size_t cnt;
@@ -3389,8 +3412,10 @@ Computing table size for character classes might take a while..."),
size_t depth = 0;
while (ctype->names[nr + depth * ctype->plane_size] != wch)
- ++depth;
- assert (depth < ctype->plane_cnt);
+ {
+ ++depth;
+ assert (depth < ctype->plane_cnt);
+ }
ctype->width[nr + depth * ctype->plane_size]
= charmap->width_rules[cnt].width;
@@ -3421,6 +3446,37 @@ Computing table size for character classes might take a while..."),
}
}
+ /* Now set all the other characters of the character set to the
+ default width. */
+ curs = NULL;
+ while (iterate_table (&charmap->char_table, &curs, &key, &len, &vdata) == 0)
+ {
+ struct charseq *data = (struct charseq *) vdata;
+ size_t nr;
+ size_t depth;
+
+ if (data->ucs4 == UNINITIALIZED_CHAR_VALUE)
+ data->ucs4 = repertoire_find_value (ctype->repertoire,
+ data->name, len);
+
+ if (data->ucs4 != ILLEGAL_CHAR_VALUE)
+ {
+ nr = data->ucs4 % ctype->plane_size;
+ depth = 0;
+
+ while (ctype->names[nr + depth * ctype->plane_size] != data->ucs4)
+ {
+ ++depth;
+ assert (depth < ctype->plane_cnt);
+ }
+
+ if (ctype->width[nr + depth * ctype->plane_size]
+ == (unsigned char) '\xff')
+ ctype->width[nr + depth * ctype->plane_size] =
+ charmap->width_default;
+ }
+ }
+
/* Set MB_CUR_MAX. */
ctype->mb_cur_max = charmap->mb_cur_max;
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 0b7dac9a8a..f733268498 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,5 +1,47 @@
2000-06-27 Ulrich Drepper <drepper@redhat.com>
+ * tests-mbwc/dat_iswcntrl.c: U0000 is not in class cntrl.
+ * tests-mbwc/dat_iswctype.c: U0000 is not in class cntrl.
+ U4E06 is not in EUC-JP.
+ * tests-mbwc/dat_swscanf.c: Correct several bugs in the tests.
+ * tests-mbwc/dat_towctrans.c: Likewise.
+ * tests-mbwc/dat_wcscoll.c: Likewise.
+ * tests-mbwc/dat_wcswidth.c: Likewise.
+ * tests-mbwc/dat_wctob.c: Likewise.
+
+ * tests-mbwc/tst_towctrans.c: Remove hack which avoided crash in an
+ versions.
+
+ * tests-mbwc/dat_iswprint.c: Disable one test until it is decided
+ what is correct.
+ * tests-mbwc/dat_wcsxfrm.c: Likewise.
+ * tests-mbwc/dat_wcwidth.c: Likewise.
+
+ * tests-mbwc/tst_funcs.h: Pretty print.
+
+ * tests-mbwc/tst_scscanf.c: Use correct format to avoid warning.
+ * tests-mbwc/tst_wcschr.c: Likewise.
+ * tests-mbwc/tst_wcscpy.c: Likewise.
+ * tests-mbwc/tst_wcscat.c: Likewise.
+ * tests-mbwc/tst_wcsncpy.c: Likewise.
+ * tests-mbwc/tst_wcspbrk.c: Likewise.
+ * tests-mbwc/tst_wcsstr.c: Likewise.
+ * tests-mbwc/tst_wctrans.c: Likewise.
+ * tests-mbwc/tst_wctype.c: Likewise.
+
+ * tests-mbwc/tst_wcscoll.c: Print better error messages.
+
+ * Makefile (tests): Define as $(locale_test_suite) but only
+ if not cross-compiling and shared libs are built.
+ (locale_test_suite): New variable. Name all new tests from the
+ locale test suite.
+ Add rule to run new tests only when all data is available.
+ * tst-ctype.sh: Add hack to generate en_US.ANSI_X3.4-1968 locale.
+
+ * tst-ctype-de_DE.in: U00A0 is not in class graph.
+
+ * charmaps/EUC-JP: Remove U005C and U007E entries from non-ASCII range.
+
* locales/i18n: Backspace isn't blank, tab is.
* tst-ctype.c (main): Add tests for control characters and space.
diff --git a/localedata/Makefile b/localedata/Makefile
index 0330a973f3..7c88b045a8 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -35,15 +35,6 @@ locales := $(filter-out $(addprefix locales/, CVS RCS SCCS %~), \
repertoiremaps := $(filter-out $(addprefix repertoiremaps/, CVS RCS SCCS %~), \
$(wildcard repertoiremaps/*))
-# Disable the tests for now - first the locales have to be generated
-#tests := tst_iswalnum tst_iswprint tst_towctrans tst_wcsncmp tst_wctrans \
-# tst_iswalpha tst_iswpunct tst_wcschr tst_wcspbrk tst_wctype \
-# tst_iswcntrl tst_iswspace tst_wcscoll tst_wcsspn tst_iswdigit \
-# tst_iswupper tst_wcscpy tst_wcsstr tst_iswgraph tst_iswxdigit \
-# tst_wcscspn tst_wcswidth tst_iswlower tst_swscanf tst_wcslen \
-# tst_wctob tst_iswctype tst_towlower tst_wcscat tst_towupper \
-# tst_wcscmp tst_wcsncat tst_wcsncpy tst_wcsxfrm tst_wcwidth
-
subdir-dirs = tests-mbwc
vpath %.c tests-mbwc
@@ -69,8 +60,9 @@ fmon-tests = n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \
y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21
generated := $(test-input) $(test-output)
-generated-dirs := $(basename $(test-input)) en_US $(ld-test-names) tt_TT\
- de_DE.437 $(addprefix tstfmon_,$(fmon-tests))
+generated-dirs := $(basename $(test-input)) $(ld-test-names) tt_TT \
+ de_DE.437 $(addprefix tstfmon_,$(fmon-tests)) \
+ en_US.ANSI_X3.4-1968 ja_JP.EUC-JP
distribute := CHECKSUMS README SUPPORTED ChangeLog \
$(charmaps) $(locales) $(repertoiremaps) \
@@ -82,6 +74,22 @@ distribute := CHECKSUMS README SUPPORTED ChangeLog \
# Get $(inst_i18ndir) defined.
include ../Makeconfig
+ifeq (no,$(cross-compiling))
+ifeq (yes,$(build-shared))
+# Disable the tests for now - first the locales have to be generated
+locale_test_suite := tst_iswalnum tst_iswprint tst_towctrans tst_wcsncmp \
+ tst_wctrans tst_iswalpha tst_iswpunct tst_wcschr \
+ tst_wcspbrk tst_wctype tst_iswcntrl tst_iswspace \
+ tst_wcscoll tst_wcsspn tst_iswdigit tst_iswupper \
+ tst_wcscpy tst_wcsstr tst_iswgraph tst_iswxdigit \
+ tst_wcscspn tst_wcswidth tst_iswlower tst_swscanf \
+ tst_wcslen tst_wctob tst_iswctype tst_towlower \
+ tst_wcscat tst_towupper tst_wcscmp tst_wcsncat \
+ tst_wcsncpy tst_wcsxfrm tst_wcwidth
+tests = $(locale_test_suite)
+endif
+endif
+
# Files to install.
install-others := $(addprefix $(inst_i18ndir)/, $(charmaps) $(locales) \
$(repertoiremaps))
@@ -101,6 +109,7 @@ CFLAGS-tst-mbswcs4.c = -Wno-format
CFLAGS-tst-mbswcs5.c = -Wno-format
CFLAGS-tst-trans.c = -Wno-format
+
ifeq (no,$(cross-compiling))
ifeq (yes,$(build-shared))
.PHONY: do-collate-test do-tst-fmon do-tst-locale do-tst-rpmatch do-tst-trans \
@@ -123,6 +132,7 @@ do-tst-mbswcs: tst-mbswcs.sh $(objpfx)tst-mbswcs1 $(objpfx)tst-mbswcs2 \
$(SHELL) -e $< $(common-objpfx)
do-tst-ctype: tst-ctype.sh $(objpfx)tst-ctype do-collate-test
$(SHELL) -e $< $(common-objpfx)
+$(addsuffix .out,$(addprefix $(objpfx),$(locale_test_suite))): %: do-tst-ctype
endif
endif
diff --git a/localedata/charmaps/EUC-JP b/localedata/charmaps/EUC-JP
index f5ff8fa8e9..047d6b8c71 100644
--- a/localedata/charmaps/EUC-JP
+++ b/localedata/charmaps/EUC-JP
@@ -242,7 +242,6 @@ CHARMAP
<U2015> /xa1/xbd HORIZONTAL BAR
<U2010> /xa1/xbe HYPHEN
<UFF0F> /xa1/xbf FULLWIDTH SOLIDUS
-<U005C> /xa1/xc0 REVERSE SOLIDUS
<U301C> /xa1/xc1 WAVE DASH
<U2016> /xa1/xc2 DOUBLE VERTICAL LINE
<UFF5C> /xa1/xc3 FULLWIDTH VERTICAL LINE
@@ -7102,7 +7101,6 @@ CHARMAP
<U00AF> /x8f/xa2/xb4 MACRON
<U02DB> /x8f/xa2/xb5 OGONEK
<U02DA> /x8f/xa2/xb6 RING ABOVE
-<U007E> /x8f/xa2/xb7 TILDE
<U0384> /x8f/xa2/xb8 GREEK TONOS
<U0385> /x8f/xa2/xb9 GREEK DIALYTIKA TONOS
<U00A1> /x8f/xa2/xc2 INVERTED EXCLAMATION MARK
diff --git a/localedata/tests-mbwc/dat_iswcntrl.c b/localedata/tests-mbwc/dat_iswcntrl.c
index 89d5021916..4eac814ec0 100644
--- a/localedata/tests-mbwc/dat_iswcntrl.c
+++ b/localedata/tests-mbwc/dat_iswcntrl.c
@@ -46,7 +46,11 @@ TST_ISW_LOC (CNTRL, cntrl) = {
{ TST_ISW_REC (enUS, cntrl)
{
{ { WEOF }, { 0,0,1,0 } },
+#ifdef SHOJI_IS_RIGHT
{ { 0x0000 }, { 0,0,0,0 } },
+#else
+ { { 0x0000 }, { 0,0,1,0 } },
+#endif
{ { 0x001F }, { 0,0,0,0 } },
{ { 0x0020 }, { 0,0,1,0 } },
{ { 0x0021 }, { 0,0,1,0 } },
diff --git a/localedata/tests-mbwc/dat_iswctype.c b/localedata/tests-mbwc/dat_iswctype.c
index ebdaedce57..7e481ff72f 100644
--- a/localedata/tests-mbwc/dat_iswctype.c
+++ b/localedata/tests-mbwc/dat_iswctype.c
@@ -210,7 +210,12 @@ TST_ISWCTYPE tst_iswctype_loc [] = {
{ { 0x0009, "blank" }, { 0,0,0,0 } },
{ { 0x000B, "blank" }, { 0,0,1,0 } },
{ { 0x0020, "blank" }, { 0,0,0,0 } },
+#ifdef SHOJI_IS_RIGHT
{ { 0x0000, "cntrl" }, { 0,0,0,0 } },
+#else
+ /* XXX U0000 has no properties at all. */
+ { { 0x0000, "cntrl" }, { 0,0,1,0 } },
+#endif
{ { 0x001F, "cntrl" }, { 0,0,0,0 } },
{ { 0x0020, "cntrl" }, { 0,0,1,0 } },
{ { 0x0021, "cntrl" }, { 0,0,1,0 } },
@@ -531,8 +536,13 @@ TST_ISWCTYPE tst_iswctype_loc [] = {
{ { 0xFF66, "jkata" }, { 0,0,0,0 } }, /* HALF KATA WO */
{ { 0xFF6F, "jkata" }, { 0,0,0,0 } }, /* HALF KATA tu */
{ { 0x4E05, "jkanji" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
/* <NO_WAIVER>: */
{ { 0x4E06, "jkanji" }, { 0,0,1,1 } }, /* CJK UNI.IDEO.NON-J */
+#else
+ /* XXX This character does not exist in EUC-JP. */
+ { { 0x4E06, "jkanji" }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+#endif
{ { 0x4E07, "jkanji" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */
{ is_last: 1 }
}
diff --git a/localedata/tests-mbwc/dat_iswprint.c b/localedata/tests-mbwc/dat_iswprint.c
index 47fa4167da..70abb6635e 100644
--- a/localedata/tests-mbwc/dat_iswprint.c
+++ b/localedata/tests-mbwc/dat_iswprint.c
@@ -65,7 +65,9 @@ TST_ISW_LOC (PRINT, print) = {
{ { 0x007E }, { 0,0,0,0 } },
{ { 0x007F }, { 0,0,1,0 } },
{ { 0x0080 }, { 0,0,1,0 } }, /* 20 */
+#ifdef NO_WAIVER
{ { 0x3042 }, { 0,0,1,0 } }, /* <WAIVER> */
+#endif
{ is_last: 1 } /* Last element. */
}
},
@@ -120,4 +122,3 @@ TST_ISW_LOC (PRINT, print) = {
},
{ TST_ISW_REC (end, print) }
};
-
diff --git a/localedata/tests-mbwc/dat_swscanf.c b/localedata/tests-mbwc/dat_swscanf.c
index 24274401ba..cce5b336e6 100644
--- a/localedata/tests-mbwc/dat_swscanf.c
+++ b/localedata/tests-mbwc/dat_swscanf.c
@@ -33,7 +33,6 @@ TST_SWSCANF tst_swscanf_loc [] =
},
},
/*------------------------ 02 -----------------------*/
- /* <NO_WAIVER> x 2 */
{ { {
0x00E4, 0x00C4, 0x0000 /* "äÄ" */
},
@@ -60,8 +59,13 @@ TST_SWSCANF tst_swscanf_loc [] =
},
L"1%d:2%d:3%d:4%d:5%d:6%d:7%d:8%d:9%d", 0
},
- { 1,EINVAL,1,EOF,
+#ifdef SHOJI_IS_RIGHT
+ { 1,EINVAL,1,WEOF,
+ 0,0,0,0,"", { 0x0000 },
+#else
+ { 0,0,1,0,
0,0,0,0,"", { 0x0000 },
+#endif
},
},
/*---------------------------------------------------*/
@@ -136,7 +140,6 @@ TST_SWSCANF tst_swscanf_loc [] =
},
},
/*------------------------ 03 -----------------------*/
- /* <NO_WAIVER> */
{ { {
0x0031, 0x003A,
0x0030, 0x003A,
@@ -144,12 +147,16 @@ TST_SWSCANF tst_swscanf_loc [] =
0x0061, 0x003A,
0x0063, 0x0064, 0x0000, 0x0000,
},
- L"%2$d:%1$u:%f:%c:%s", 0
+ L"%2$d:%1$u:%3$f:%4$c:%5$s", 0
},
{ 1,0,1,5,
0, 1, 3.9, 'a', "cd", { 0x0000 }
},
},
+#ifdef SHOJI_IS_RIGHT
+ /* XXX This test does not make sense. The format string is
+ L"\x1\x2\x25\x53" and it is supposed to match the words
+ 0x30A2, 0x30A4, 0x0001. */
/*------------------------ 04 -----------------------*/
/* <NO_WAIVER> x 2 */
{ { {
@@ -161,6 +168,7 @@ TST_SWSCANF tst_swscanf_loc [] =
0,0,0,0,"", { 0x0000 }
},
},
+#endif
/*---------------------------------------------------*/
{ is_last: 1} /* Last element. */