Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 25 Jul 2000 00:38:27 +0000 (00:38 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 25 Jul 2000 00:38:27 +0000 (00:38 +0000)
2000-07-24  Ulrich Drepper  <drepper@redhat.com>

* libio/iogetwline.c (_IO_getwline_info): Use wide character
string functions.

ChangeLog
libio/iogetwline.c
localedata/ChangeLog
localedata/Makefile
localedata/tst-wctype.c [new file with mode: 0644]
localedata/tst-wctype.input [new file with mode: 0644]
localedata/tst-wctype.sh [new file with mode: 0755]

index 971ec0c..f989092 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-07-24  Ulrich Drepper  <drepper@redhat.com>
+
+       * libio/iogetwline.c (_IO_getwline_info): Use wide character
+       string functions.
+
 2000-07-24  Jakub Jelinek  <jakub@redhat.com>
 
        * libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size
index 402158a..b7f1115 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU IO Library.
 
    This library is free software; you can redistribute it and/or
@@ -91,8 +91,7 @@ _IO_getwline_info (fp, buf, n, delim, extract_delim, eof)
            wchar_t *t;
            if ((_IO_size_t) len >= n)
              len = n;
-           t = (wchar_t *) memchr ((void *) fp->_wide_data->_IO_read_ptr,
-                                   delim, len);
+           t = wmemchr ((void *) fp->_wide_data->_IO_read_ptr, delim, len);
            if (t != NULL)
              {
                _IO_size_t old_len = ptr - buf;
@@ -103,12 +102,12 @@ _IO_getwline_info (fp, buf, n, delim, extract_delim, eof)
                    if (extract_delim > 0)
                      ++len;
                  }
-               memcpy ((void *) ptr, (void *) fp->_wide_data->_IO_read_ptr,
-                       len);
+               wmemcpy ((void *) ptr, (void *) fp->_wide_data->_IO_read_ptr,
+                        len);
                fp->_wide_data->_IO_read_ptr = t;
                return old_len + len;
              }
-           memcpy ((void *) ptr, (void *) fp->_wide_data->_IO_read_ptr, len);
+           wmemcpy ((void *) ptr, (void *) fp->_wide_data->_IO_read_ptr, len);
            fp->_wide_data->_IO_read_ptr += len;
            ptr += len;
            n -= len;
index 1555ccd..b347763 100644 (file)
@@ -1,3 +1,10 @@
+2000-07-24  Ulrich Drepper  <drepper@redhat.com>
+
+       * Makefile: Add rules to build, run, and distribute tst-wctype.
+       * tst-wctype.c: New file.
+       * tst-wctype.input: New file.
+       * tst-wctype.sh: New file.
+
 2000-07-24  Jakub Jelinek  <jakub@redhat.com>
 
        * locales/de_DE (LC_TIME): Use `Mit', not `Mot' as abbreviation
index 87216d2..1a24df9 100644 (file)
@@ -43,7 +43,7 @@ vpath %.h tests-mbwc
 
 test-srcs := collate-test xfrm-test tst-fmon tst-rpmatch tst-trans \
             tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
-            tst-ctype
+            tst-ctype tst-wctype
 #test-input := de_DE.ISO-8859-1 da_DK.ISO-8859-1 fr_CA,2.13.ISO-8859-1 \
 #            hr_HR.ISO-8859-2 # once it is fixed: cs_CZ.ISO-8859-2
 test-input := de_DE.ISO-8859-1 en_US.ISO-8859-1
@@ -70,7 +70,8 @@ distribute := CHECKSUMS README SUPPORTED ChangeLog                    \
              th_TH.in cs_CZ.in tst-mbswcs.sh tst-trans.sh tst-ctype.sh \
              tst-ctype-de_DE.in $(wildcard tests-mbwc/*.[ch])          \
              $(addprefix tst-fmon-locales/tstfmon_,$(fmon-tests))      \
-             gen-locale.sh show-ucs-data.c
+             gen-locale.sh show-ucs-data.c                             \
+             tst-wctype.sh tst-wctype.input
 
 # Get $(inst_i18ndir) defined.
 include ../Makeconfig
@@ -136,7 +137,7 @@ $(addsuffix .out,$(addprefix $(objpfx),$(locale_test_suite))): %: \
 
 tests: $(objpfx)sort-test.out $(objpfx)tst-fmon.out $(objpfx)tst-locale.out \
        $(objpfx)tst-rpmatch.out $(objpfx)tst-trans.out \
-       $(objpfx)tst-mbswcs.out $(objpfx)tst-ctype.out
+       $(objpfx)tst-mbswcs.out $(objpfx)tst-ctype.out $(objpfx)tst-wctype.out
 
 $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
                       $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
@@ -166,6 +167,10 @@ $(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
                        $(objpfx)sort-test.out \
                        $(addprefix $(objpfx),$(CTYPE_FILES))
        $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
+$(objpfx)tst-wctype.out: tst-wctype.sh $(objpfx)tst-wctype \
+                       $(objpfx)sort-test.out tst-wctype.input \
+                       $(addprefix $(objpfx),$(CTYPE_FILES))
+       $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
 endif
 
 # Sometimes the whole collection of locale files should be installed.
diff --git a/localedata/tst-wctype.c b/localedata/tst-wctype.c
new file mode 100644 (file)
index 0000000..6c59a50
--- /dev/null
@@ -0,0 +1,40 @@
+#include <error.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <wctype.h>
+
+int
+main (void)
+{
+  wctype_t wct;
+  wchar_t buf[1000];
+  int result = 1;
+
+  setlocale (LC_ALL, "");
+  wprintf (L"locale = %s\n", setlocale (LC_CTYPE, NULL));
+
+  wct = wctype ("jhira");
+  if (wct == 0)
+    error (EXIT_FAILURE, 0, "jhira: no such character class");
+
+  if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
+    {
+      int n;
+
+      wprintf (L"buf[] = \"%ls\"\n", buf);
+
+      result = 0;
+
+      for (n = 0; buf[n] != L'\0'; ++n)
+       {
+         wprintf (L"jhira(U%04lx = %lc) = %d\n", (long) buf[n], buf[n],
+                  iswctype (buf[n], wct));
+         result |= ((buf[n] < 0xff && iswctype (buf[n], wct))
+                    || (buf[n] > 0xff && !iswctype (buf[n], wct)));
+       }
+    }
+
+  return result;
+}
diff --git a/localedata/tst-wctype.input b/localedata/tst-wctype.input
new file mode 100644 (file)
index 0000000..a7b4928
--- /dev/null
@@ -0,0 +1 @@
+¤¡¤¢¤£¤¤¤¥¤¦¤§¤¨¤©¤ª¤«¤¬¤­¤®¤¯¤°¤±¤²¤³¤´¤µ¤¶¤·¤¸¤¹¤ºabcdefghjklmnoprrstuvwxyz
diff --git a/localedata/tst-wctype.sh b/localedata/tst-wctype.sh
new file mode 100755 (executable)
index 0000000..ae32525
--- /dev/null
@@ -0,0 +1,30 @@
+#! /bin/sh
+# Test locale-define character classes.
+# Copyright (C) 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
+# modify it under the terms of the GNU Library General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB.  If
+# not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+common_objpfx=$1
+run_program_prefix=$2
+
+# Run the test program.
+LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
+LC_ALL=ja_JP.EUC-JP ${run_program_prefix} \
+  ${common_objpfx}localedata/tst-wctype < tst-wctype.input \
+    > ${common_objpfx}localedata/tst-wctype.out
+
+exit $?