Update.
authorUlrich Drepper <drepper@redhat.com>
Sun, 18 Jun 2000 00:23:52 +0000 (00:23 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 18 Jun 2000 00:23:52 +0000 (00:23 +0000)
* locale/programs/ld-ctype.c (ctype_output): Really write out
mboutdigits information.
* localedata/tst-trans.c: Add code to test printf's I flag with locale.
* localedata/tst-trans.sh: Set GCONV_PATH for compilation environment.
* localedata/tests/trans.def: Add outdigit information.

* localedata/tst-mbswcs3.c: Remove comment.

ChangeLog
locale/programs/ld-ctype.c
localedata/tests/trans.def
localedata/tst-mbswcs3.c
localedata/tst-trans.c
localedata/tst-trans.sh

index 474d77fcefa259e323b9a1ad58fc90c1c5cf4057..61ebbc243361e7339371954ecb5b355c991efed5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2000-06-17  Ulrich Drepper  <drepper@redhat.com>
 
+       * locale/programs/ld-ctype.c (ctype_output): Really write out
+       mboutdigits information.
+       * localedata/tst-trans.c: Add code to test printf's I flag with locale.
+       * localedata/tst-trans.sh: Set GCONV_PATH for compilation environment.
+       * localedata/tests/trans.def: Add outdigit information.
+
+       * localedata/tst-mbswcs3.c: Remove comment.
+
        * stdio-common/vfprintf.c (vfprintf): Fix handling of I flag.
        * stdio-common/tiformat.c (sprint_ints): Add tests for I flag.
        * libio/tst_wprintf.c (main): Add test for I flag.
index bda89ec9bc52ca9f036e922c00d708e3c84947b3..5b570ba00ea0b36a85b76f662c2be51442f3b928 100644 (file)
@@ -981,14 +981,14 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
               them with a NUL byte following.  The NUL byte wouldn't be
               necessary but it makes it easier for the user.  */
            total = 0;
-           for (cnt = elem - _NL_CTYPE_INDIGITS0_MB;
+           for (cnt = elem - _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_MB);
                 cnt < ctype->mbdigits_act; cnt += 10)
              total += ctype->mbdigits[cnt]->nbytes + 1;
            iov[2 + elem + offset].iov_base = (char *) alloca (total);
            iov[2 + elem + offset].iov_len = total;
 
            cp = iov[2 + elem + offset].iov_base;
-           for (cnt = elem - _NL_CTYPE_INDIGITS0_MB;
+           for (cnt = elem - _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_MB);
                 cnt < ctype->mbdigits_act; cnt += 10)
              {
                cp = mempcpy (cp, ctype->mbdigits[cnt]->bytes,
@@ -1003,14 +1003,14 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
               there might be more than one.  We simply concatenate all of
               them with a NUL byte following.  The NUL byte wouldn't be
               necessary but it makes it easier for the user.  */
-           cnt = elem - _NL_CTYPE_OUTDIGIT0_MB;
+           cnt = elem - _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_MB);
            total = ctype->mboutdigits[cnt]->nbytes + 1;
            iov[2 + elem + offset].iov_base = (char *) alloca (total);
            iov[2 + elem + offset].iov_len = total;
 
            *(char *) mempcpy (iov[2 + elem + offset].iov_base,
-                              ctype->mbdigits[cnt]->bytes,
-                              ctype->mbdigits[cnt]->nbytes) = '\0';
+                              ctype->mboutdigits[cnt]->bytes,
+                              ctype->mboutdigits[cnt]->nbytes) = '\0';
            idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
            break;
 
@@ -1021,7 +1021,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
              (uint32_t *) alloca (total * sizeof (uint32_t));
            iov[2 + elem + offset].iov_len = total * sizeof (uint32_t);
 
-           for (cnt = elem - _NL_CTYPE_INDIGITS0_WC;
+           for (cnt = elem - _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_WC);
                 cnt < ctype->wcdigits_act; cnt += 10)
              ((uint32_t *) iov[2 + elem + offset].iov_base)[cnt / 10]
                = ctype->wcdigits[cnt];
@@ -1029,7 +1029,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
            break;
 
          case _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_WC) ... _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT9_WC):
-           cnt = elem - _NL_CTYPE_OUTDIGIT0_WC;
+           cnt = elem - _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_WC);
            iov[2 + elem + offset].iov_base = &ctype->wcoutdigits[cnt];
            iov[2 + elem + offset].iov_len = sizeof (uint32_t);
            idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
index 2f2ac61b96000aa31d7aedc83fc55cee9362b4c3..8bda88b7cb648dfd0967328abfc506d56317a436 100644 (file)
@@ -110,6 +110,9 @@ toupper (<a>,<A>);/
 charconv test
 
 test (<A>,<B>);(<B>,<C>)
+
+outdigit <a>;<b>;<c>;<d>;<e>;<f>;<g>;<h>;<i>;<j>
+
 END LC_CTYPE
 
 LC_COLLATE
index b9846ee8ac202707d00cc4a34791c255dce9cd0e..a5929f85c4a25f5ce3eb84e3fca62f11bab4e41b 100644 (file)
@@ -74,22 +74,3 @@ main (void)
 
   return result;
 }
-
-/* Expected output:
-
-wcsrtombs(dst,&src,1,&state) -> 1, src = srcbuf+1, dst = buf+1
-wcsrtombs(dst,&src,1,&state) -> 1, src = srcbuf+2, dst = buf+2
-wcsrtombs(dst,&src,3,&state) -> 3, src = srcbuf+3, dst = buf+5
-wcsrtombs(dst,&src,1,&state) -> 1, src = srcbuf+3, dst = buf+6
-
-*/
-
-/* Output of a non-restarting implementation:
-
-wcsrtombs(dst,&src,1,&state) -> 1, src = srcbuf+1, dst = buf+1
-wcsrtombs(dst,&src,1,&state) -> 0, src = srcbuf+1, dst = buf+1
-wcsrtombs(dst,&src,3,&state) -> 3, src = srcbuf+2, dst = buf+4
-wcsrtombs(dst,&src,1,&state) -> 0, src = srcbuf+2, dst = buf+4
-wrong results
-
-*/
index 8bc64ce0691c8a356a152b9126a96046337189c9..a84ee20e720751fcc9867a826bdc143f40cd691f 100644 (file)
 
 #include <locale.h>
 #include <stdio.h>
+#include <wchar.h>
 #include <wctype.h>
 
 int
 main (void)
 {
+  char buf[30];
+  wchar_t wbuf[30];
   wctrans_t t;
   wint_t wch;
   int errors = 0;
+  int len;
 
   setlocale (LC_ALL, "");
 
@@ -48,5 +52,18 @@ main (void)
   if (wch != L'C')
     errors = 1;
 
+  /* Test the output digit handling.  */
+  swprintf (wbuf, sizeof (wbuf) / sizeof (wbuf[0]), L"%Id", 0x499602D2);
+  errors |= wcscmp (wbuf, L"bcdefghija") != 0;
+  len = wcslen (wbuf);
+  errors |= len != 10;
+  printf ("len = %d, wbuf = L\"%ls\"\n", len, wbuf);
+
+  snprintf (buf, sizeof buf, "%Id", 0x499602D2);
+  errors |= strcmp (buf, "bcdefghija") != 0;
+  len = strlen (buf);
+  errors |= len != 10;
+  printf ("len = %d, buf = \"%s\"\n", len, buf);
+
   return errors;
 }
index c4fe934133e1b4dcc94acefadfe747a61ccd99a3..c17525dd18f3bccb727a76b8984f09f9b5f6380e 100755 (executable)
@@ -29,8 +29,8 @@ ${common_objpfx}localedata/tt_TT ||
 exit 1
 
 # Run the test program.
-LOCPATH=${common_objpfx}localedata LC_ALL=tt_TT \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
+LC_ALL=tt_TT ${common_objpfx}elf/ld.so --library-path $common_objpfx \
 ${common_objpfx}localedata/tst-trans > ${common_objpfx}localedata/tst-trans.out
 
 exit $?