From: Ulrich Drepper Date: Tue, 25 Jul 2000 00:38:27 +0000 (+0000) Subject: Update. X-Git-Tag: cvs/glibc_2-1-92~105 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a64e8af15015e277914970bde5062735b9506cad;p=platform%2Fupstream%2Fglibc.git Update. 2000-07-24 Ulrich Drepper * libio/iogetwline.c (_IO_getwline_info): Use wide character string functions. --- diff --git a/ChangeLog b/ChangeLog index 971ec0c..f989092 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-07-24 Ulrich Drepper + + * libio/iogetwline.c (_IO_getwline_info): Use wide character + string functions. + 2000-07-24 Jakub Jelinek * libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size diff --git a/libio/iogetwline.c b/libio/iogetwline.c index 402158a..b7f1115 100644 --- a/libio/iogetwline.c +++ b/libio/iogetwline.c @@ -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; diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 1555ccd..b347763 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,10 @@ +2000-07-24 Ulrich Drepper + + * 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 * locales/de_DE (LC_TIME): Use `Mit', not `Mot' as abbreviation diff --git a/localedata/Makefile b/localedata/Makefile index 87216d2..1a24df9 100644 --- a/localedata/Makefile +++ b/localedata/Makefile @@ -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 index 0000000..6c59a504 --- /dev/null +++ b/localedata/tst-wctype.c @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include +#include + +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 index 0000000..a7b4928 --- /dev/null +++ b/localedata/tst-wctype.input @@ -0,0 +1 @@ +¤¡¤¢¤£¤¤¤¥¤¦¤§¤¨¤©¤ª¤«¤¬¤­¤®¤¯¤°¤±¤²¤³¤´¤µ¤¶¤·¤¸¤¹¤ºabcdefghjklmnoprrstuvwxyz diff --git a/localedata/tst-wctype.sh b/localedata/tst-wctype.sh new file mode 100755 index 0000000..ae32525 --- /dev/null +++ b/localedata/tst-wctype.sh @@ -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 $?