]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Wed, 28 Jun 2000 04:27:24 +0000 (04:27 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 28 Jun 2000 04:27:24 +0000 (04:27 +0000)
* 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.

33 files changed:
ChangeLog
locale/programs/ld-ctype.c
localedata/ChangeLog
localedata/Makefile
localedata/charmaps/EUC-JP
localedata/tests-mbwc/dat_iswcntrl.c
localedata/tests-mbwc/dat_iswctype.c
localedata/tests-mbwc/dat_iswprint.c
localedata/tests-mbwc/dat_swscanf.c
localedata/tests-mbwc/dat_towctrans.c
localedata/tests-mbwc/dat_wcscoll.c
localedata/tests-mbwc/dat_wcswidth.c
localedata/tests-mbwc/dat_wcsxfrm.c
localedata/tests-mbwc/dat_wctob.c
localedata/tests-mbwc/dat_wcwidth.c
localedata/tests-mbwc/tst_funcs.h
localedata/tests-mbwc/tst_swscanf.c
localedata/tests-mbwc/tst_towctrans.c
localedata/tests-mbwc/tst_wcschr.c
localedata/tests-mbwc/tst_wcscoll.c
localedata/tests-mbwc/tst_wcscpy.c
localedata/tests-mbwc/tst_wcsncat.c
localedata/tests-mbwc/tst_wcsncpy.c
localedata/tests-mbwc/tst_wcspbrk.c
localedata/tests-mbwc/tst_wcsstr.c
localedata/tests-mbwc/tst_wctrans.c
localedata/tests-mbwc/tst_wctype.c
localedata/tst-ctype-de_DE.in
localedata/tst-ctype.sh
stdio-common/vfscanf.c
wcsmbs/wctob.c
wcsmbs/wcwidth.h
wctype/wctype.h

index e53b21df1f69ea0af4ee969643f1ac7c5c8fc62b..fa9eaeafe8279372b147ab8848b78895c4f1c45a 100644 (file)
--- 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 ().
index ce097e741bcc48c6419198ea7e4afa904ab1d1b1..417660160f74722ce5c3031ee2c8a8c7a2e858c8 100644 (file)
@@ -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;
 
index 0b7dac9a8ac2a26274c2bf066f3b8e73410d3081..f7332684986484f1848ad13bd47133a98b2a4ce0 100644 (file)
@@ -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.
index 0330a973f318e7022165adb64d2bf6babf7ccbd8..7c88b045a8175770bb64c140092c2659d0626b15 100644 (file)
@@ -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
 
index f5ff8fa8e9b1586921a5c3f27afb7b37917a1df3..047d6b8c7182d2e966f247d677ada5d0f153e9d7 100644 (file)
@@ -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
index 89d5021916c5f90b5c5e1fe000509c646b487a4d..4eac814ec0125c7e83218badb49c4478191f1fbd 100644 (file)
@@ -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 }  },
index ebdaedce573ab69eaa281712d12fabd6eb5ae4d7..7e481ff72f73b84f8ec43e3a539d97bedba4f359 100644 (file)
@@ -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 }
     }
index 47fa4167da867a43463c13e6c5c2bff024faf1ae..70abb6635e82072e01586b0274ec4df0935f46f0 100644 (file)
@@ -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) }
 };
-
index 24274401ba8deac9ec9273a44cdb7a3997212de4..cce5b336e64e53719386f105c3249cf6506d2bfd 100644 (file)
@@ -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.  */
     }
index 0baeb9bb0954f6322e193cd52bde8546e36cf56f..53083e3bac935d8754d906dd4d306c2e8b669877 100644 (file)
@@ -38,7 +38,11 @@ TST_TOWCTRANS tst_towctrans_loc [] = {
   {
     { Ttowctrans, TST_LOC_de },
     {
+#ifdef SHOJI_IS_RIGHT
       {         { 0x0010, "tojkata" }, { 1,EINVAL,1,0x0010 }  },
+#else
+      {         { 0x0010, "tojkata" }, { 1,0,     1,0x0010 }  },
+#endif
       {         { 0x0080, "tolower" }, { 1,0,     1,0x0080 }  },
       {         { 0x00EC, "toupper" }, { 1,0,     1,0x00CC }  },
       {         { 0x00CC, "tolower" }, { 1,0,     1,0x00EC }  },
@@ -48,7 +52,11 @@ TST_TOWCTRANS tst_towctrans_loc [] = {
   {
     { Ttowctrans, TST_LOC_enUS },
     {
+#ifdef SHOJI_IS_RIGHT
       {         { 0x0010, "xxxxxxx" }, { 1,EINVAL,1,0x0010 }  },
+#else
+      {         { 0x0010, "xxxxxxx" }, { 1,0,     1,0x0010 }  },
+#endif
       {         { 0x007F, "tolower" }, { 1,0,     1,0x007F }  },
       {         { 0x0061, "toupper" }, { 1,0,     1,0x0041 }  },
       {         { 0x0041, "tolower" }, { 1,0,     1,0x0061 }  },
index d087fc634425f2b3c3aea3fb4c837b02ecb8995a..ffedacab1eb2eaea44add3c1f91b38edb39d0bfb 100644 (file)
@@ -104,6 +104,7 @@ TST_WCSCOLL tst_wcscoll_loc [] = {
                         { 0x0041,0x0041,0x0043,0x0000 }, },  /* #4 */
            /*expect*/ { 0,0,0,0, -1,                     },
          },
+#ifdef SHOJI_IS_RIGHT
          /* <WAIVER> */ /* assume ascii */
          { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
                         { 0x0041,0x0061,0x0043,0x0000 }, },  /* #5 */
@@ -114,6 +115,17 @@ TST_WCSCOLL tst_wcscoll_loc [] = {
                         { 0x0041,0x0042,0x0043,0x0000 }, },  /* #6 */
            /*expect*/ { 0,0,0,0, +1,                     },
          },
+#else
+         /* XXX Correct order is lowercase before uppercase.  */
+         { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+                        { 0x0041,0x0061,0x0043,0x0000 }, },  /* #5 */
+           /*expect*/ { 0,0,0,0, +1,                     },
+         },
+         { /*input.*/ { { 0x0041,0x0061,0x0043,0x0000 },
+                        { 0x0041,0x0042,0x0043,0x0000 }, },  /* #6 */
+           /*expect*/ { 0,0,0,0, -1,                     },
+         },
+#endif
          { /*input.*/ { { 0x0041,0x0042,0x0000        },
                         { 0x0041,0x0042,0x0049,0x0000 }, },  /* #7 */
            /*expect*/ { 0,0,0,0, -1,                     },
@@ -122,6 +134,7 @@ TST_WCSCOLL tst_wcscoll_loc [] = {
                         { 0x0041,0x0042,0x0000        }, },  /* #8 */
            /*expect*/ { 0,0,0,0, +1,                     },
          },
+#ifdef SHOJI_IS_RIGHT
          { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 },
                         { 0x0041,0x008E,0x0049,0x0000 }, },  /* #9 */
            /*expect*/ { 1,0,0,0, +1,                  },
@@ -130,6 +143,17 @@ TST_WCSCOLL tst_wcscoll_loc [] = {
                         { 0x0041,0x0092,0x0049,0x0000 }, },  /* #10 */
            /*expect*/ { 0,0,0,0, -1,                  },
          },
+#else
+         /* Do not assume position of character out of range.  */
+         { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 },
+                        { 0x0041,0x008E,0x0049,0x0000 }, },  /* #9 */
+           /*expect*/ { 1,0,0,0, 0,                   },
+         },
+         { /*input.*/ { { 0x0041,0x008E,0x0049,0x0000 },
+                        { 0x0041,0x0092,0x0049,0x0000 }, },  /* #10 */
+           /*expect*/ { 0,0,0,0, 0,                   },
+         },
+#endif
          { is_last: 1 }
        }
     },
index f8d51341d7b3adb94d8723bf78e8698ab4fa285f..a1c7076e60b34b9c0b11007122c9648835b1479e 100644 (file)
@@ -64,10 +64,10 @@ TST_WCSWIDTH tst_wcswidth_loc [] = {
       { /*input.*/ { { 0x00C1,0x00FF,0x0000 },          2 },  /* 18 */
        /*expect*/ { 0,0,1,2                               },
       },
-      { /*input.*/ { { 0x00C1,0x3042,0x0000 },          2 },  /* 19 */   /* <WAIVER> */  /* returns 2 */
+      { /*input.*/ { { 0x00C1,0x3042,0x0000 },          2 },  /* 19 */
        /*expect*/ { 0,0,1,-1                              },
       },
-      { /*input.*/ { { 0x00C1,0x3044,0x0000 },          2 },  /* 20 */   /* <WAIVER> */  /* returns 2 */
+      { /*input.*/ { { 0x00C1,0x3044,0x0000 },          2 },  /* 20 */
        /*expect*/ { 0,0,1,-1                              },
       },
       { is_last: 1 }
@@ -85,12 +85,21 @@ TST_WCSWIDTH tst_wcswidth_loc [] = {
       { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },   2 },  /* 03 */
        /*expect*/ { 0,0,1,2                               },
       },
+#ifdef SHOJI_IS_RIGHT
       { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },   3 },  /* 04 */
        /*expect*/ { 0,0,1,3                               },
       },
       { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },   4 },  /* 05 */
        /*expect*/ { 0,0,1,3                               },
       },
+#else
+      { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },   3 },  /* 04 */
+       /*expect*/ { 0,0,1,-1                              },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },   4 },  /* 05 */
+       /*expect*/ { 0,0,1,3                               },
+      },
+#endif
       { /*input.*/ { { 0x0000 },                        1 },  /* 06 */
        /*expect*/ { 0,0,1,0                               },
       },
@@ -124,17 +133,24 @@ TST_WCSWIDTH tst_wcswidth_loc [] = {
       { /*input.*/ { { 0x0041,0x00A0,0x0000 },          2 },  /* 16 */
        /*expect*/ { 0,0,1,-1                              },
       },
+#ifdef SHOJI_IS_RIGHT
       { /*input.*/ { { 0x0041,0x00A1,0x0000 },          2 },  /* 17 */
        /*expect*/ { 0,0,1,2                               },
       },
       { /*input.*/ { { 0x0041,0x00FF,0x0000 },          2 },  /* 18 */
        /*expect*/ { 0,0,1,2                               },
       },
-      /* <WAIVER> */  /* returns 2 */
+#else
+      { /*input.*/ { { 0x0041,0x007E,0x0000 },          2 },  /* 17 */
+       /*expect*/ { 0,0,1,2                               },
+      },
+      { /*input.*/ { { 0x0041,0x0020,0x0000 },          2 },  /* 18 */
+       /*expect*/ { 0,0,1,2                               },
+      },
+#endif
       { /*input.*/ { { 0x0041,0x3042,0x0000 },          2 },  /* 19 */
        /*expect*/ { 0,0,1,-1                              },
       },
-      /* <WAIVER> */  /* returns 2 */
       { /*input.*/ { { 0x0041,0x3044,0x0000 },          2 },  /* 20 */
        /*expect*/ { 0,0,1,-1                              },
       },
@@ -192,10 +208,17 @@ TST_WCSWIDTH tst_wcswidth_loc [] = {
       { /*input.*/ { { 0x0041,0x00A0,0x0000 },          2 },  /* 16 */
        /*expect*/ { 0,0,1,-1                              },
       },
+#ifdef NO_WAIVER
       /* <NO_WAIVER> */         /* returns 3 */
       { /*input.*/ { { 0x0041,0x00A1,0x0000 },          2 },  /* 17 */
        /*expect*/ { 0,0,1,-1                              },
       },
+#else
+      /* XXX U00A1 is valid -> /x8f/xa2/xc4 in JIS X 0212 */
+      { /*input.*/ { { 0x0041,0x00A1,0x0000 },          2 },  /* 17 */
+       /*expect*/ { 0,0,1,3                               },
+      },
+#endif
       { /*input.*/ { { 0x0041,0xFF71,0x0000 },          2 },  /* 18 */
        /*expect*/ { 0,0,1,2                               },
       },
index 8d52efcf90996fc87620e85b49b53fd8cd5c4fa8..46f99035c5b9b768da4dea4f720ef617548d6c88 100644 (file)
@@ -55,12 +55,13 @@ TST_WCSXFRM tst_wcsxfrm_loc [] = {
       { /*inp*/ { { 0x0000,0x0000 }, { 0x0000,0x0000 }, 7, 7 },         /* #04 */
        /*exp*/ {   1,0,               0,0,                  },
       },
-
+#ifdef NO_WAIVER
       { /* <WAIVER> x 2 */
        /*inp*/ { { 0x3061,0x0000 }, { 0xFF42,0x0000 }, 7, 7 },  /* #05 */
        /* <WAIVER>     */
        /*exp*/ {   1,EINVAL,          1,(size_t)-1,         },
       },
+#endif
       { is_last: 1 }
     }
   },
@@ -82,10 +83,12 @@ TST_WCSXFRM tst_wcsxfrm_loc [] = {
       { /*inp*/ { { 0xFF71,0x0000 }, { 0x30A2,0x0000 }, 7, 7 },         /* #05 */
        /*exp*/ {   1,0,               0,0,                  },
       },
+#ifdef NO_WAIVER
       /* <WAIVER> x 2 */
       { /*inp*/ { { 0x008E,0x0000 }, { 0x008F,0x0000 }, 7, 7 },         /* #06 */
        /*exp*/ {   1,EINVAL,          1,(size_t)-1,         },
       },
+#endif
       { is_last: 1 }
     }
   },
index 9f30aff0eacdbb7ca3d47f9b50f0595949ffe213..d40b74a85abfcae48d1fae303b107f5f3c97c156 100644 (file)
@@ -25,8 +25,14 @@ TST_WCTOB tst_wctob_loc [] = {
          {  { WEOF   }, { 0,0,  1, EOF        }  },
          {  { 0x0020 }, { 0,0,  1, 0x20       }  },
          {  { 0x0061 }, { 0,0,  1, 0x61       }  },
+#ifdef SHOJI_IS_RIGHT
          {  { 0x0080 }, { 0,0,  1, 0x80       }  },
          {  { 0x00C4 }, { 0,0,  1, 0xC4       }  },
+#else
+         /* XXX These are no valid characters.  */
+         {  { 0x0080 }, { 0,0,  1, EOF        }  },
+         {  { 0x00C4 }, { 0,0,  1, EOF        }  },
+#endif
          {  { 0x30C4 }, { 0,0,  1, EOF        }  },
          {  is_last: 1 } /* Last element.  */
        }
@@ -36,7 +42,12 @@ TST_WCTOB tst_wctob_loc [] = {
          {  { WEOF   }, { 0,0,  1, EOF        }  },
          {  { 0x0020 }, { 0,0,  1, 0x20       }  },
          {  { 0x0061 }, { 0,0,  1, 0x61       }  },
+#ifdef SHOJI_IS_RIGHT
          {  { 0x0080 }, { 0,0,  1, 0x80       }  },  /* <WAIVER> */
+#else
+         /* XXX These are no valid characters.  */
+         {  { 0x0080 }, { 0,0,  1, EOF        }  },
+#endif
          {  { 0x00C4 }, { 0,0,  1, EOF        }  },
          {  { 0x30C4 }, { 0,0,  1, EOF        }  },
          {  is_last: 1 } /* Last element.  */
index d57a3d4247e254c295debdcbed6c8191d63635c3..5472d1f5598282a95a50383c657a2efb190f205b 100644 (file)
@@ -28,10 +28,16 @@ TST_WCWIDTH tst_wcwidth_loc [] = {
        { /*inp*/ { 0x00C1                   },  /* #06 */
          /*exp*/ { 0,0,        1,1,         },
        },
+#ifdef SHOJI_IS_RIGHT
        /* <WAIVER> */  /* CHECK : wint_t */
        { /*inp*/ { 0x3041                   },  /* #07 */
          /*exp*/ { 0,0,        1,0,         },
        },
+#else
+       { /*inp*/ { 0x3041                   },  /* #07 */
+         /*exp*/ { 0,0,        1,EOF,       },
+       },
+#endif
        { is_last: 1 }
       }
     },
@@ -50,15 +56,12 @@ TST_WCWIDTH tst_wcwidth_loc [] = {
        { /*inp*/ { 0x0080                   },  /* #04 */
          /*exp*/ { 0,0,        1,-1,        },
        },
-       /* <WAIVER> */  /* assume ascii */
        { /*inp*/ { 0x00A1                   },  /* #05 */
          /*exp*/ { 0,0,        1,-1,        },
        },
-       /* <WAIVER> */  /* assume ascii */
        { /*inp*/ { 0x00C1                   },  /* #06 */
          /*exp*/ { 0,0,        1,-1,        },
        },
-       /* <WAIVER> */  /* CHECK : wint_t */
        { /*inp*/ { 0x3041                   },  /* #07 */
          /*exp*/ { 0,0,        1,-1,        },
        },
@@ -80,10 +83,17 @@ TST_WCWIDTH tst_wcwidth_loc [] = {
        { /*inp*/ { 0x0080                   },  /* #04 */
          /*exp*/ { 0,0,        1,-1,        },
        },
+#ifdef SHOJI_IS_RIGHT
        /* <NO_WAIVER> */
        { /*inp*/ { 0x00A1                   },  /* #05 */
          /*exp*/ { 0,0,        1,0,         },
        },
+#else
+       /* XXX U00A1 is a valid character in EUC-JP.  */
+       { /*inp*/ { 0x00A1                   },  /* #05 */
+         /*exp*/ { 0,0,        1,2,         },
+       },
+#endif
        /* jisx0212 */
        { /*inp*/ { 0x00C1                   },  /* #06 */
          /*exp*/ { 0,0,        1,2,         },
index 95d0787e5d84ea0b9c0b18e213cd8995446baa97..e72154fa74e109e7fcc3c21da2c78b6d16ac25de 100644 (file)
@@ -96,15 +96,15 @@ extern int result (FILE * fp, char res, const char *func, const char *loc,
        for (loc = 0; strcmp (TST_HEAD (o_func).locale, TST_LOC_end); ++loc)
 
 
-#define TST_HEAD_LOCALE(ofunc, s_func)                                         \
-  func_id = TST_HEAD (ofunc).func_id;                                          \
-  locale  = TST_HEAD (ofunc).locale;                                           \
-  if (setlocale (LC_ALL, locale) == NULL)                                      \
-    {                                                                          \
-      fprintf (stderr, "Warning : can't set locale: %s\nskipping ...\n",       \
-              locale);                                                         \
-      result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "can't set locale");     \
-      continue;                                                                        \
+#define TST_HEAD_LOCALE(ofunc, s_func) \
+  func_id = TST_HEAD (ofunc).func_id;                                        \
+  locale  = TST_HEAD (ofunc).locale;                                         \
+  if (setlocale (LC_ALL, locale) == NULL)                                    \
+    {                                                                        \
+      fprintf (stderr, "Warning : can't set locale: %s\nskipping ...\n",      \
+              locale);                                                       \
+      result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "can't set locale");    \
+      continue;                                                                      \
     }
 
 #define TST_DO_REC(ofunc) \
@@ -131,36 +131,36 @@ extern int result (FILE * fp, char res, const char *func, const char *loc,
 #define TST_SAVE_ERRNO \
        errno_save = errno
 
-#define TST_IF_RETURN(_s_func_)                                                        \
-  if (err_flg == 1)                                                            \
-    {                                                                          \
-      if (errno_save == err_exp)                                               \
-       {                                                                       \
-         result (fp, C_SUCCESS, _s_func_, locale, rec+1, seq_num+1, 1,         \
-                 MS_PASSED);                                                   \
-       }                                                                       \
-      else                                                                     \
-       {                                                                       \
-         err_count++;                                                          \
-         result (fp, C_FAILURE, _s_func_, locale, rec+1, seq_num+1, 1,         \
-                 "the value of errno is different from an expected value");    \
-       }                                                                       \
-    }                                                                          \
-                                                                               \
-  if (ret_flg == 1)                                                            \
-    {                                                                          \
-      if (ret == ret_exp)                                                      \
-       {                                                                       \
-         result (fp, C_SUCCESS, _s_func_, locale, rec+1, seq_num+1, 2,         \
-                 MS_PASSED);                                                   \
-       }                                                                       \
-      else                                                                     \
-       {                                                                       \
-         err_count++;                                                          \
-         result (fp, C_FAILURE, _s_func_, locale, rec+1, seq_num+1, 2,         \
-                 "the return value is different from an expected value");      \
-       }                                                                       \
-    }                                                                          \
+#define TST_IF_RETURN(_s_func_) \
+  if (err_flg == 1)                                                          \
+    {                                                                        \
+      if (errno_save == err_exp)                                             \
+       {                                                                     \
+         result (fp, C_SUCCESS, _s_func_, locale, rec+1, seq_num+1, 1,       \
+                 MS_PASSED);                                                 \
+       }                                                                     \
+      else                                                                   \
+       {                                                                     \
+         err_count++;                                                        \
+         result (fp, C_FAILURE, _s_func_, locale, rec+1, seq_num+1, 1,       \
+                 "the value of errno is different from an expected value");  \
+       }                                                                     \
+    }                                                                        \
+                                                                             \
+  if (ret_flg == 1)                                                          \
+    {                                                                        \
+      if (ret == ret_exp)                                                    \
+       {                                                                     \
+         result (fp, C_SUCCESS, _s_func_, locale, rec+1, seq_num+1, 2,       \
+                 MS_PASSED);                                                 \
+       }                                                                     \
+      else                                                                   \
+       {                                                                     \
+         err_count++;                                                        \
+         result (fp, C_FAILURE, _s_func_, locale, rec+1, seq_num+1, 2,       \
+                 "the return value is different from an expected value");    \
+       }                                                                     \
+    }                                                                        \
   else
 
 #define TEX_ERRET_REC(_type_)                  \
@@ -188,45 +188,45 @@ extern int result (FILE * fp, char res, const char *func, const char *loc,
        TEX_ERRET_REC (int)   TEX_ISW##_FUNC_##_REC;    \
        TMD_RECHEAD (ISW##_FUNC_)
 
-#define TST_FUNC_ISW(_FUNC_, _func_)                                           \
-int                                                                            \
-tst_isw##_func_ (FILE *fp, int debug_flg)                                      \
-{                                                                              \
-  TST_DECL_VARS(int);                                                          \
-  wint_t wc;                                                                   \
-  TST_DO_TEST (isw##_func_)                                                    \
-    {                                                                          \
-      TST_HEAD_LOCALE (isw##_func_, S_ISW##_FUNC_);                            \
-      TST_DO_REC(isw##_func_)                                                  \
-       {                                                                       \
-         TST_GET_ERRET (isw##_func_);                                          \
-         wc = TST_INPUT (isw##_func_).wc;                                      \
-         ret = isw##_func_ (wc);                                               \
-         if (debug_flg)                                                        \
-           {                                                                   \
-             fprintf (stdout, "isw*() [ %s : %d ] ret = %d\n", locale,         \
-                      rec+1, ret);                                             \
-           }                                                                   \
-                                                                               \
-         TST_IF_RETURN (S_ISW##_FUNC_)                                         \
-           {                                                                   \
-             if (ret != 0)                                                     \
-               {                                                               \
-                 result (fp, C_SUCCESS, S_ISW##_FUNC_, locale, rec+1,          \
-                         seq_num+1, 3, MS_PASSED);                             \
-               }                                                               \
-             else                                                              \
-               {                                                               \
-                 err_count++;                                                  \
-                 result (fp, C_FAILURE, S_ISW##_FUNC_, locale, rec+1,          \
-                         seq_num+1, 3,                                         \
-                         "the function returned 0, but should be non-zero");   \
-               }                                                               \
-           }                                                                   \
-       }                                                                       \
-    }                                                                          \
-                                                                               \
-  return err_count;                                                            \
+#define TST_FUNC_ISW(_FUNC_, _func_) \
+int                                                                          \
+tst_isw##_func_ (FILE *fp, int debug_flg)                                    \
+{                                                                            \
+  TST_DECL_VARS(int);                                                        \
+  wint_t wc;                                                                 \
+  TST_DO_TEST (isw##_func_)                                                  \
+    {                                                                        \
+      TST_HEAD_LOCALE (isw##_func_, S_ISW##_FUNC_);                          \
+      TST_DO_REC(isw##_func_)                                                \
+       {                                                                     \
+         TST_GET_ERRET (isw##_func_);                                        \
+         wc = TST_INPUT (isw##_func_).wc;                                    \
+         ret = isw##_func_ (wc);                                             \
+         if (debug_flg)                                                      \
+           {                                                                 \
+             fprintf (stdout, "isw*() [ %s : %d ] ret = %d\n", locale,       \
+                      rec+1, ret);                                           \
+           }                                                                 \
+                                                                             \
+         TST_IF_RETURN (S_ISW##_FUNC_)                                       \
+           {                                                                 \
+             if (ret != 0)                                                   \
+               {                                                             \
+                 result (fp, C_SUCCESS, S_ISW##_FUNC_, locale, rec+1,        \
+                         seq_num+1, 3, MS_PASSED);                           \
+               }                                                             \
+             else                                                            \
+               {                                                             \
+                 err_count++;                                                \
+                 result (fp, C_FAILURE, S_ISW##_FUNC_, locale, rec+1,        \
+                         seq_num+1, 3,                                       \
+                         "the function returned 0, but should be non-zero"); \
+               }                                                             \
+           }                                                                 \
+       }                                                                     \
+    }                                                                        \
+                                                                             \
+  return err_count;                                                          \
 }
 
 
index 4f3286f5cf117fe1d5ea8082d2ce351d416d15bb..8819a0ef943e2605d5322b13f141f3225657a6fa 100644 (file)
@@ -59,7 +59,7 @@ tst_swscanf (FILE * fp, int debug_flg)
 
          if (TST_INPUT (swscanf).wch)
            {
-             fprintf (stdout, "                        val_S[ 0 ] = 0x%x\n",
+             fprintf (stdout, "                        val_S[ 0 ] = 0x%lx\n",
                       val_S[0]);
            }
          else
index 102b23628de6df3b3fd8e348f5f3c2b68e9f920f..1d874dc0f71762058d63d6a93dd7dbf79cf78beb 100644 (file)
@@ -14,7 +14,9 @@ tst_towctrans (FILE *fp, int debug_flg)
   TST_DECL_VARS (wint_t);
   wint_t wc;
   const char *ts;
+#if SHOJI_IS_RIGHT
   int dummy=0;
+#endif
   wctrans_t wto;
 
   TST_DO_TEST (towctrans)
@@ -26,6 +28,7 @@ tst_towctrans (FILE *fp, int debug_flg)
          wc = TST_INPUT (towctrans).wc;
          ts = TST_INPUT (towctrans).ts;
 
+#if SHOJI_IS_RIGHT
          if ((wto = wctrans (ts)) == (wctrans_t) 0)
            {
 #if 0
@@ -41,6 +44,9 @@ tst_towctrans (FILE *fp, int debug_flg)
                  fprintf (stdout, "towctrans() ------ wctrans() returnd 0.\n");
                }
            }
+#else
+         wto = wctrans (ts);
+#endif
 
          TST_CLEAR_ERRNO;
          ret = towctrans (wc, wto);
index 3dcc1e893f2b4e38b6912475fa270345ffec783e..118baba304d0894ed9e4b292ec59311289737e07 100644 (file)
@@ -27,7 +27,7 @@ tst_wcschr (FILE * fp, int debug_flg)
        {
          if (ret)
            {
-             fprintf (stderr, "wcschr: ret = 0x%x\n", *ret);
+             fprintf (stderr, "wcschr: ret = 0x%lx\n", *ret);
            }
          else
            {
index d648fa3c6062c3b89f9292919f05aa343ab97f45..929f80d80076d04b08a08beee22a6e0fe3e5fcfe 100644 (file)
@@ -44,9 +44,28 @@ tst_wcscoll (FILE * fp, int debug_flg)
            else
              {
                err_count++;
-               Result (C_FAILURE, S_WCSCOLL, CASE_3,
-                       "the return value should be positive "
-                       "/negative but it's negative/positive.");
+               if (cmp == 1)
+                 {
+                   if (ret == 0)
+                     Result (C_FAILURE, S_WCSCOLL, CASE_3,
+                             "the return value should be positive"
+                             " but it's zero.");
+                   else
+                     Result (C_FAILURE, S_WCSCOLL, CASE_3,
+                             "the return value should be positive"
+                             " but it's negative.");
+                 }
+               else
+                 {
+                   if (ret == 0)
+                     Result (C_FAILURE, S_WCSCOLL, CASE_3,
+                             "the return value should be negative"
+                             " but it's zero.");
+                   else
+                     Result (C_FAILURE, S_WCSCOLL, CASE_3,
+                             "the return value should be negative"
+                             " but it's positive.");
+                 }
              }
          }
       }
index 2e9212e6ceac471c6f9edc9f84507497918d29ed..3dc6406a38b97c1a1f56a694ded060a99316a07b 100644 (file)
@@ -46,7 +46,7 @@ tst_wcscpy (FILE * fp, int debug_flg)
              if (debug_flg)
                {
                  fprintf (stderr,
-                          "ws1[ %d ] = 0x%x <-> wx_ex[ %d ] = 0x%x\n", i,
+                          "ws1[ %d ] = 0x%lx <-> wx_ex[ %d ] = 0x%lx\n", i,
                           ws1[i], i, ws_ex[i]);
                }
 
index 9342eb09accea952ad59d39837f59701c4b4ff8c..4665f72ced5e98827407b903f297e3927923d82e 100644 (file)
@@ -48,7 +48,7 @@ tst_wcsncat (FILE * fp, int debug_flg)
            {
              if (debug_flg)
                {
-                 fprintf (stderr, "ws1[%d] = 0x%x\n", i, ws1[i]);
+                 fprintf (stderr, "ws1[%d] = 0x%lx\n", i, ws1[i]);
                }
 
              if (ws1[i] != ws_ex[i])
index cf27271ebdab7c1d638957634e3f17f340f96a4d..f2127d4a7dd361eed621df980fd093a053eff08f 100644 (file)
@@ -63,7 +63,7 @@ tst_wcsncpy (FILE *fp, int debug_flg)
            {
              if (debug_flg)
                fprintf (stderr,
-                        "wcsncpy: ws1[ %d ] = 0x%x <-> wx_ex[ %d ] = 0x%x\n",
+                        "wcsncpy: ws1[ %d ] = 0x%lx <-> wx_ex[ %d ] = 0x%lx\n",
                         i, ws1[i], i, ws_ex[i]);
 
              if (ws1[i] != ws_ex[i])
index 1bb0f6dc44d68bc215ebb58ec4a1519fe920fd77..405c12531e86509b6ac6196e8f6cfe1208e60268 100644 (file)
@@ -32,7 +32,7 @@ tst_wcspbrk (FILE * fp, int debug_flg)
                   rec + 1, (ret == NULL) ? "null" : "not null");
          if (ret)
            fprintf (stderr,
-                    "                        ret[0] = 0x%x : 0x%x = ws2[0]\n",
+                    "                        ret[0] = 0x%lx : 0x%lx = ws2[0]\n",
                     ret[0], ws2[0]);
        }
 
@@ -58,7 +58,7 @@ tst_wcspbrk (FILE * fp, int debug_flg)
 
        if (debug_flg)
          fprintf (stdout,
-                  "                        *ret = 0x%x <-> 0x%x = wc_ex\n",
+                  "                        *ret = 0x%lx <-> 0x%lx = wc_ex\n",
                   *ret, wc_ex);
 
        if (*ret != wc_ex)
index 02f756c37c9835002d6264d4e7cddae2c2206919..15654df0a9dd8d84c6a96e65efccec797e53e459 100644 (file)
@@ -31,7 +31,7 @@ tst_wcsstr (FILE * fp, int debug_flg)
          if (ret)
            {
              fprintf (stderr,
-                      "        ret[ 0 ] = 0x%x <-> 0x%x = ws2[ 0 ]\n",
+                      "        ret[ 0 ] = 0x%lx <-> 0x%lx = ws2[ 0 ]\n",
                       ret[0], ws2[0]);
            }
        }
@@ -59,8 +59,8 @@ tst_wcsstr (FILE * fp, int debug_flg)
            if (debug_flg)
              {
                fprintf (stderr,
-                        "      : ret[ %d ] = 0x%x <-> 0x%x = ws2[ %d ]\n", i,
-                        ret[i], ws2[i], i);
+                        "      : ret[ %d ] = 0x%lx <-> 0x%lx = ws2[ %d ]\n",
+                        i, ret[i], ws2[i], i);
              }
 
            if (ret[i] != ws2[i])
index 129b797fb34ada5d2bcb6b9d8fd64efcd768c17e..b422d6ff940c39f549c01648fbfb26553137875c 100644 (file)
@@ -27,7 +27,8 @@ tst_wctrans (FILE * fp, int debug_flg)
 
       if (debug_flg)
        {
-         fprintf (stderr, "tst_wctrans : [ %d ] ret = %d\n", rec + 1, ret);
+         fprintf (stderr, "tst_wctrans : [ %d ] ret = %ld\n", rec + 1,
+                  (long int) ret);
          fprintf (stderr, "                   errno = %d\n", errno_save);
        }
 
index 1ad30ce372499b1b431d5b2c0adbf40f1cfd05d2..a203e490871607cf0933bde88a43ef9aef39bcff 100644 (file)
@@ -25,7 +25,7 @@ tst_wctype (FILE * fp, int debug_flg)
 
       if (debug_flg)
        {
-         fprintf (stderr, "tst_wctype : [ %d ] ret = %d\n", rec + 1, ret);
+         fprintf (stderr, "tst_wctype : [ %d ] ret = %ld\n", rec + 1, ret);
        }
 
       TST_IF_RETURN (S_WCTYPE)
index f4a1f23f1f652ca6b2b2f7498fefe4598e93982f..539ff8998d6cd33554db986f872cdbd946ae3bce 100644 (file)
@@ -27,7 +27,7 @@ print   
 print   ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
         111111111111111111111111111111111111111111111111
 graph    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
-        111111111111111111111111111111111111111111111111
+        011111111111111111111111111111111111111111111111
 graph   ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
         111111111111111111111111111111111111111111111111
 blank    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
index afb4e68e5eed56364402b461548f3a4bb79db91d..6946c306715b19b0a197efb6a328b3ba2a2e8e9b 100755 (executable)
@@ -38,6 +38,9 @@ generate_locale ()
 }
 
 generate_locale EUC-JP ja_JP ja_JP.EUC-JP
+# XXX This is a hack for now.  We need the en_US.ANSI_X3.4-1968 locale
+# XXX elsewhere
+generate_locale ANSI_X3.4-1968 en_US en_US.ANSI_X3.4-1968
 
 status=0
 
index 3ca82cc4c7c36b60a12a89d72840644e73644211..feff0eb50a0df75242f9ea510c275e1c697028b8 100644 (file)
@@ -86,7 +86,7 @@
 #  define ISXDIGIT(Ch)   iswxdigit (Ch)
 #  define TOLOWER(Ch)    towlower (Ch)
 #  define ORIENT         if (s->_vtable_offset == 0 && _IO_fwide (s, 1) != 1)\
-                           return EOF
+                           return WEOF
 #  define __strtoll_internal   __wcstoll_internal
 #  define __strtoull_internal  __wcstoull_internal
 #  define __strtol_internal    __wcstol_internal
@@ -99,6 +99,8 @@
 #  define CHAR_T         wchar_t
 #  define UCHAR_T        unsigned int
 #  define WINT_T         wint_t
+#  undef EOF
+#  define EOF            WEOF
 # else
 #  define ungetc(c, s) ((void) ((int) c == EOF                               \
                                 || (--read_in,                               \
@@ -715,7 +717,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
          if (!(flags & SUPPRESS))
            {
              wstr = ARG (wchar_t *);
-             if (str == NULL)
+             if (wstr == NULL)
                conv_error ();
            }
 
index 0ee17ce4433e370c9351baf9d515ad29a010c305..68ab6614f74f45ee7b844013c3a9a288d3bcbc16 100644 (file)
@@ -36,6 +36,9 @@ wctob (c)
   size_t dummy;
   int status;
 
+  if (c == WEOF)
+    return EOF;
+
   /* Tell where we want the result.  */
   data.__outbuf = buf;
   data.__outbufend = buf + MB_LEN_MAX;
index a9f8a26d499e5121b3aae9c2da55116a3ee8b728..ffc74be26ce07a76ab371268aa84be50f22e78f3 100644 (file)
@@ -1,5 +1,5 @@
 /* Internal header containing implementation of wcwidth() function.
-   Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
 
@@ -33,6 +33,7 @@ static __inline int
 internal_wcwidth (wint_t ch)
 {
   size_t idx;
+  unsigned char res;
 
   if (ch == L'\0')
     return 0;
@@ -41,5 +42,6 @@ internal_wcwidth (wint_t ch)
   if (idx == ~((size_t) 0) || (__ctype32_b[idx] & _ISwprint) == 0)
     return -1;
 
-  return (int) __ctype_width[idx];
+  res = __ctype_width[idx];
+  return res == (unsigned char) '\xff' ? -1 : (int) res;
 }
index 2a4caddd901136dbd941095595b341fd6b340027..8bcbaf987b142c41279e8e5db8a77098ae52d39b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -176,48 +176,61 @@ extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
 extern unsigned int *__ctype32_b;
 
 # define iswalnum(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwalnum) : iswalnum (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwalnum) : iswalnum (wc)))
 # define iswalpha(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwalpha) : iswalpha (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwalpha) : iswalpha (wc)))
 # define iswcntrl(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwcntrl) : iswcntrl (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwcntrl) : iswcntrl (wc)))
 # define iswdigit(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwdigit) : iswdigit (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwdigit) : iswdigit (wc)))
 # define iswlower(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwlower) : iswlower (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwlower) : iswlower (wc)))
 # define iswgraph(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwgraph) : iswgraph (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwgraph) : iswgraph (wc)))
 # define iswprint(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwprint) : iswprint (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwprint) : iswprint (wc)))
 # define iswpunct(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwpunct) : iswpunct (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwpunct) : iswpunct (wc)))
 # define iswspace(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwspace) : iswspace (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwspace) : iswspace (wc)))
 # define iswupper(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwupper) : iswupper (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwupper) : iswupper (wc)))
 # define iswxdigit(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwxdigit) : iswxdigit (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwxdigit) : iswxdigit (wc)))
 
 # ifdef __USE_GNU
 #  define iswblank(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & _ISwblank) : iswblank (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwblank) : iswblank (wc)))
 # endif
 
 # define iswctype(wc, desc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (int) (__ctype32_b[wc] & desc) : iswctype (wc, desc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (int) (__ctype32_b[(wint_t) (wc)] & desc) : iswctype (wc, desc)))
 
 #endif /* gcc && optimizing */
 
@@ -245,12 +258,14 @@ extern const wint_t *__ctype32_tolower;
 extern const wint_t *__ctype32_toupper;
 
 # define towlower(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (wint_t) __ctype32_tolower[wc] : towlower (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (wint_t) __ctype32_tolower[(wint_t) (wc)] : towlower (wc)))
 
 # define towupper(wc) \
-  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'             \
-   ? (wint_t) __ctype32_toupper[wc] : towupper (wc))
+  (__extension__                                                             \
+    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'                   \
+     ? (wint_t) __ctype32_toupper[(wint_t) (wc)] : towupper (wc)))
 
 #endif /* gcc && optimizing */