diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-10-31 03:10:13 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-10-31 03:10:13 +0000 |
commit | cdfb970dd9c20861d7fdac16435d70792b8a027a (patch) | |
tree | dfa5497c0b5b06408284073aa184688091b065c4 | |
parent | 42fea164a2f975da1b1bb687bf1a50506b59a668 (diff) | |
download | glibc-cdfb970dd9c20861d7fdac16435d70792b8a027a.tar glibc-cdfb970dd9c20861d7fdac16435d70792b8a027a.tar.gz glibc-cdfb970dd9c20861d7fdac16435d70792b8a027a.tar.bz2 glibc-cdfb970dd9c20861d7fdac16435d70792b8a027a.zip |
Update.
* locale/findlocale.c (free_mem): We can remove NODELETE marked
data, just not the C locale data.
* intl/tst-gettext.c: Use setlocale() in addition to setting envvar.
* intl/tst-gettext.sh: Copy locale data if necessary.
* intl/Makefile (generated-dirs): Add localedir.
* intl/dcigettext.c (guess_category_value): For libc always use
the setlocale() method.
* intl/Makefile: Add rules to build, run and, distribute tst-gettext2.
* intl/tst-gettext2.c: New file.
* intl/tst-gettext2.sh: New file.
* intl/tstlang1.po: New file.
* intl/tstlang2.po: New file.
Patch by Andreas Jaeger <aj@suse.de>.
2000-10-26 GOTO Masanori <gotom@debian.or.jp>
* intl/locale.alias: Add ja_JP.ujis alias.
2000-10-30 Ulrich Drepper <drepper@redhat.com>
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | intl/Makefile | 15 | ||||
-rw-r--r-- | intl/dcigettext.c | 2 | ||||
-rw-r--r-- | intl/locale.alias | 1 | ||||
-rw-r--r-- | intl/tst-gettext.c | 27 | ||||
-rwxr-xr-x | intl/tst-gettext.sh | 18 | ||||
-rw-r--r-- | intl/tst-gettext2.c | 68 | ||||
-rw-r--r-- | intl/tst-gettext2.sh | 54 | ||||
-rw-r--r-- | intl/tstlang1.po | 13 | ||||
-rw-r--r-- | intl/tstlang2.po | 13 | ||||
-rw-r--r-- | linuxthreads/linuxthreads.texi | 16 | ||||
-rw-r--r-- | locale/findlocale.c | 2 |
12 files changed, 224 insertions, 28 deletions
@@ -1,5 +1,28 @@ 2000-10-30 Ulrich Drepper <drepper@redhat.com> + * locale/findlocale.c (free_mem): We can remove NODELETE marked + data, just not the C locale data. + + * intl/tst-gettext.c: Use setlocale() in addition to setting envvar. + * intl/tst-gettext.sh: Copy locale data if necessary. + * intl/Makefile (generated-dirs): Add localedir. + + * intl/dcigettext.c (guess_category_value): For libc always use + the setlocale() method. + + * intl/Makefile: Add rules to build, run and, distribute tst-gettext2. + * intl/tst-gettext2.c: New file. + * intl/tst-gettext2.sh: New file. + * intl/tstlang1.po: New file. + * intl/tstlang2.po: New file. + Patch by Andreas Jaeger <aj@suse.de>. + +2000-10-26 GOTO Masanori <gotom@debian.or.jp> + + * intl/locale.alias: Add ja_JP.ujis alias. + +2000-10-30 Ulrich Drepper <drepper@redhat.com> + * locale/findlocale.c (_nl_find_locale): Don't store normalized name in *NAME. diff --git a/intl/Makefile b/intl/Makefile index ed9ff28106..e2df29cb93 100644 --- a/intl/Makefile +++ b/intl/Makefile @@ -26,9 +26,9 @@ routines = bindtextdom dcgettext dgettext gettext \ l10nflist explodename plural distribute = gettext.h gettextP.h hash-string.h loadinfo.h locale.alias \ plural.y po2test.sed tst-gettext.sh tst-translit.sh \ - translit.po + translit.po tst-gettext2.sh tstlang1.po tstlang2.po -test-srcs := tst-gettext tst-translit +test-srcs := tst-gettext tst-translit tst-gettext2 tests = tst-ngettext before-compile = $(objpfx)msgs.h @@ -36,7 +36,7 @@ before-compile = $(objpfx)msgs.h install-others = $(inst_msgcatdir)/locale.alias generated = msgs.h mtrace-tst-gettext tst-gettext.mtrace -generated-dirs := domaindir +generated-dirs := domaindir localedir plural.c: plural.y $(YACC) $(YFLAGS) $@ $^ @@ -50,16 +50,18 @@ include ../Rules ifeq (no,$(cross-compiling)) ifeq (yes,$(build-shared)) ifneq ($(strip $(MSGFMT)),:) -.PHONY: do-gettext-test do-translit-test -tests: $(objpfx)mtrace-tst-gettext do-translit-test +tests: $(objpfx)mtrace-tst-gettext $(objpfx)tst-translit.out \ + $(objpfx)tst-gettext2.out $(objpfx)mtrace-tst-gettext: $(objpfx)tst-gettext.out $(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@ $(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \ $(objpfx)tst-gettext.mtrace - do-translit-test: $(objpfx)tst-translit.out $(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ +$(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2 + $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \ + $(objpfx)tst-gettext endif endif endif @@ -69,6 +71,7 @@ $(objpfx)msgs.h: po2test.sed ../po/de.po sed -f $^ > $@ CFLAGS-tst-gettext.c = -DTESTSTRS_H=\"$(objpfx)msgs.h\" +CFLAGS-tst-gettext2.c = -DOBJPFX=\"$(objpfx)\" CFLAGS-tst-translit.c = -DOBJPFX=\"$(objpfx)\" $(objpfx)tst-translit.out: $(objpfx)tst-gettext.out diff --git a/intl/dcigettext.c b/intl/dcigettext.c index 7d7081dbe8..c47cccf512 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -1079,7 +1079,7 @@ guess_category_value (category, categoryname) /* `LANGUAGE' is not set. So we have to proceed with the POSIX methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some systems this can be done by the `setlocale' function itself. */ -#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL +#if defined _LIBC || (defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL) return setlocale (category, NULL); #else /* Setting of LC_ALL overwrites all other. */ diff --git a/intl/locale.alias b/intl/locale.alias index 799405aef3..d6fa49636f 100644 --- a/intl/locale.alias +++ b/intl/locale.alias @@ -52,6 +52,7 @@ italian it_IT.ISO-8859-1 japanese ja_JP.eucJP japanese.euc ja_JP.eucJP ja_JP ja_JP.eucJP +ja_JP.ujis ja_JP.eucJP japanese.sjis ja_JP.SJIS korean ko_KR.eucKR korean.euc ko_KR.eucKR diff --git a/intl/tst-gettext.c b/intl/tst-gettext.c index cfd2d5fc53..a83b1d25bd 100644 --- a/intl/tst-gettext.c +++ b/intl/tst-gettext.c @@ -106,6 +106,7 @@ main (int argc, char *argv[]) /* Now the same tests with LC_ALL deciding. */ unsetenv ("LANGUAGE"); setenv ("LC_ALL", "existing-locale", 1); + setlocale (LC_ALL, ""); puts ("test `gettext' with LC_ALL set"); /* This is the name of the existing domain with a catalog for the LC_MESSAGES category. */ @@ -119,13 +120,13 @@ main (int argc, char *argv[]) LC_MESSAGES category. We leave this value set for the `dgettext' and `dcgettext' tests. */ textdomain ("non-existing-domain"); - puts ("test `gettext' with LANGUAGE set"); + puts ("test `gettext' with LC_ALL deciding"); if (negative_gettext_test () != 0) { puts ("FAILED"); result = 1; } - puts ("test `dgettext' with LANGUAGE set"); + puts ("test `dgettext' with LC_ALL deciding"); if (positive_dgettext_test ("existing-domain") != 0) { puts ("FAILED"); @@ -135,8 +136,11 @@ main (int argc, char *argv[]) /* Now the same tests with LC_MESSAGES deciding. */ unsetenv ("LC_ALL"); setenv ("LC_MESSAGES", "existing-locale", 1); + setlocale (LC_MESSAGES, ""); setenv ("LC_TIME", "existing-locale", 1); + setlocale (LC_TIME, ""); setenv ("LC_NUMERIC", "non-existing-locale", 1); + setlocale (LC_NUMERIC, ""); puts ("test `gettext' with LC_ALL set"); /* This is the name of the existing domain with a catalog for the LC_MESSAGES category. */ @@ -150,33 +154,33 @@ main (int argc, char *argv[]) LC_MESSAGES category. We leave this value set for the `dgettext' and `dcgettext' tests. */ textdomain ("non-existing-domain"); - puts ("test `gettext' with LANGUAGE set"); + puts ("test `gettext' with LC_xxx deciding"); if (negative_gettext_test () != 0) { puts ("FAILED"); result = 1; } - puts ("test `dgettext' with LANGUAGE set"); + puts ("test `dgettext' with LC_xxx deciding"); if (positive_dgettext_test ("existing-domain") != 0) { puts ("FAILED"); result = 1; } - puts ("test `dcgettext' with LANGUAGE set (LC_MESSAGES)"); + puts ("test `dcgettext' with category == LC_MESSAGES"); if (positive_dcgettext_test ("existing-domain", LC_MESSAGES) != 0) { puts ("FAILED"); result = 1; } /* Try a different category. For this we also switch the domain. */ - puts ("test `dcgettext' with LANGUAGE set (LC_TIME)"); + puts ("test `dcgettext' with LANGUAGE == LC_TIME"); if (positive_dcgettext_test ("existing-time-domain", LC_TIME) != 0) { puts ("FAILED"); result = 1; } /* This time use a category for which there is no catalog. */ - puts ("test `dcgettext' with LANGUAGE set (LC_NUMERIC)"); + puts ("test `dcgettext' with LANGUAGE == LC_NUMERIC"); if (negative_dcgettext_test ("existing-domain", LC_NUMERIC) != 0) { puts ("FAILED"); @@ -186,10 +190,11 @@ main (int argc, char *argv[]) /* Now the same tests with LANG deciding. */ unsetenv ("LC_MESSAGES"); setenv ("LANG", "existing-locale", 1); + setlocale (LC_ALL, ""); /* This is the name of the existing domain with a catalog for the LC_MESSAGES category. */ textdomain ("existing-domain"); - puts ("test `gettext' with LC_ALL set"); + puts ("test `gettext' with LANG set"); if (positive_gettext_test () != 0) { puts ("FAILED"); @@ -199,19 +204,21 @@ main (int argc, char *argv[]) LC_MESSAGES category. We leave this value set for the `dgettext' and `dcgettext' tests. */ textdomain ("non-existing-domain"); - puts ("test `gettext' with LANGUAGE set"); + puts ("test `gettext' with LANG set"); if (negative_gettext_test () != 0) { puts ("FAILED"); result = 1; } - puts ("test `dgettext' with LANGUAGE set"); + puts ("test `dgettext' with LANG set"); if (positive_dgettext_test ("existing-domain") != 0) { puts ("FAILED"); result = 1; } + setlocale (LC_ALL, "C"); + return result; } diff --git a/intl/tst-gettext.sh b/intl/tst-gettext.sh index 42436fe5bf..c5898943d2 100755 --- a/intl/tst-gettext.sh +++ b/intl/tst-gettext.sh @@ -31,10 +31,24 @@ export LC_ALL # Generate the test data. test -d ${objpfx}domaindir || mkdir ${objpfx}domaindir -# Create the locale directories. +test -d ${objpfx}localedir || mkdir ${objpfx}localedir +# Create the domain directories. test -d ${objpfx}domaindir/existing-locale || mkdir ${objpfx}domaindir/existing-locale test -d ${objpfx}domaindir/existing-locale/LC_MESSAGES || mkdir ${objpfx}domaindir/existing-locale/LC_MESSAGES test -d ${objpfx}domaindir/existing-locale/LC_TIME || mkdir ${objpfx}domaindir/existing-locale/LC_TIME +# Create the locale directories. +test -d ${objpfx}localedir/existing-locale || { + mkdir ${objpfx}localedir/existing-locale + for f in ADDRESS COLLATE CTYPE IDENTIFICATION MEASUREMENT MONETARY NAME NUMEIRC PAPER TELEPHONE TIME; do + cp ${common_objpfx}localedata/de_DE.ISO-8859-1/LC_$f \ + ${objpfx}localedir/existing-locale + done +} +test -d ${objpfx}localedir/existing-locale/LC_MESSAGES || { + mkdir ${objpfx}localedir/existing-locale/LC_MESSAGES + cp ${common_objpfx}localedata/de_DE.ISO-8859-1/LC_MESSAGES/SYS_LC_MESSAGES \ + ${objpfx}localedir/existing-locale/LC_MESSAGES +} # Populate them. msgfmt -o ${objpfx}domaindir/existing-locale/LC_MESSAGES/existing-domain.mo \ @@ -43,7 +57,7 @@ msgfmt -o ${objpfx}domaindir/existing-locale/LC_TIME/existing-time-domain.mo \ ../po/de.po # Now run the test. -MALLOC_TRACE=$malloc_trace \ +MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \ ${common_objpfx}elf/ld.so --library-path $common_objpfx \ ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir diff --git a/intl/tst-gettext2.c b/intl/tst-gettext2.c new file mode 100644 index 0000000000..0cc4cad84a --- /dev/null +++ b/intl/tst-gettext2.c @@ -0,0 +1,68 @@ +/* Test of the gettext functions. + Copyright (C) 2000 Free Software Foundation, Inc. + Contributed by Thorsten Kukuk <kukuk@suse.de> and + Andreas Jaeger <aj@suse.de>, 2000. + + 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. */ + + +#include <locale.h> +#include <libintl.h> +#include <stdlib.h> +#include <stdio.h> + +struct data_t { + const char *selection; + const char *description; +}; + +int data_cnt = 2; +struct data_t strings[] = +{{"String1", N_("First string for testing.")}, + {"String2", N_("Another string for testing.")} +}; + +const int lang_cnt = 3; +const char *lang[] = {"lang1", "lang2", "lang3"}; + +int +main (void) +{ + int i; + + /* Clean up environment. */ + unsetenv ("LANGUAGE"); + unsetenv ("LC_ALL"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LC_CTYPE"); + unsetenv ("LANG"); + unsetenv ("OUTPUT_CHARSET"); + + textdomain ("tstlang"); + + for (i = 0; i < lang_cnt; ++i) + { + int j; + + setlocale (LC_ALL, lang[i]); + bindtextdomain ("tstlang", OBJPFX "domaindir"); + + for (j = 0; j < data_cnt; ++j) + printf ("%s - %s\n", strings[j].selection, _(strings[j].description)); + } + + return 0; +} diff --git a/intl/tst-gettext2.sh b/intl/tst-gettext2.sh new file mode 100644 index 0000000000..2c1a2e10ca --- /dev/null +++ b/intl/tst-gettext2.sh @@ -0,0 +1,54 @@ +#! /bin/sh +# Test of gettext functions. +# Copyright (C) 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 +objpfx=$2 +malloc_trace=$3 + +GCONV_PATH=${common_objpfx}iconvdata +export GCONV_PATH +LOCPATH=${common_objpfx}localedata +export LOCPATH +LC_ALL=C +export LC_ALL + +# Generate the test data. +test -d ${objpfx}domaindir || mkdir ${objpfx}domaindir +# Create the locale directories. +test -d ${objpfx}domaindir/lang1 || mkdir ${objpfx}domaindir/lang1 +test -d ${objpfx}domaindir/lang2 || mkdir ${objpfx}domaindir/lang2 +test -d ${objpfx}domaindir/lang1/LC_MESSAGES || mkdir ${objpfx}domaindir/lang1/LC_MESSAGES +test -d ${objpfx}domaindir/lang2/LC_MESSAGES || mkdir ${objpfx}domaindir/lang2/LC_MESSAGES + +# Populate them. +msgfmt -o ${objpfx}domaindir/lang1/LC_MESSAGES/tstlang.mo \ + tstlang1.po + +msgfmt -o ${objpfx}domaindir/lang2/LC_MESSAGES/tstlang.mo \ + tstlang2.po + + +# Now run the test. +MALLOC_TRACE=$malloc_trace \ +${common_objpfx}elf/ld.so --library-path $common_objpfx \ +${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir + +exit $? + diff --git a/intl/tstlang1.po b/intl/tstlang1.po new file mode 100644 index 0000000000..c411ce116f --- /dev/null +++ b/intl/tstlang1.po @@ -0,0 +1,13 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=US-ASCII\n" +"Content-Transfer-Encoding: 7-bit\n" + +#: tst-gettext2.c:33 +msgid "First string for testing." +msgstr "Lang1: 1st string" + +#: tst-gettext2.c:34 +msgid "Another string for testing." +msgstr "Lang1: 2nd string" diff --git a/intl/tstlang2.po b/intl/tstlang2.po new file mode 100644 index 0000000000..d1606c8ede --- /dev/null +++ b/intl/tstlang2.po @@ -0,0 +1,13 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=US-ASCII\n" +"Content-Transfer-Encoding: 7-bit\n" + +#: tst-gettext2.c:33 +msgid "First string for testing." +msgstr "Lang2: 1st string" + +#: tst-gettext2.c:34 +msgid "Another string for testing." +msgstr "Lang2: 2nd string" diff --git a/linuxthreads/linuxthreads.texi b/linuxthreads/linuxthreads.texi index e2d3ffd7c1..a3096b0c1f 100644 --- a/linuxthreads/linuxthreads.texi +++ b/linuxthreads/linuxthreads.texi @@ -187,7 +187,7 @@ any pthreads function until it has been reinitialized. @findex pthread_attr_setscope @comment pthread.h @comment POSIX -@deftypefun int pthread_attr_set@var{attr} (pthread_attr_t *@var{obj}, int @var{value}) +@deftypefun int pthread_attr_setattr (pthread_attr_t *@var{obj}, int @var{value}) Set attribute @var{attr} to @var{value} in the attribute object pointed to by @var{obj}. See below for a list of possible attributes and the values they can take. @@ -204,7 +204,7 @@ below. @findex pthread_attr_getscope @comment pthread.h @comment POSIX -@deftypefun int pthread_attr_get@var{attr} (const pthread_attr_t *@var{obj}, int *@var{value}) +@deftypefun int pthread_attr_getattr (const pthread_attr_t *@var{obj}, int *@var{value}) Store the current setting of @var{attr} in @var{obj} into the variable pointed to by @var{value}. @@ -558,7 +558,7 @@ The default type is ``fast''. Variables of type @code{pthread_mutex_t} can also be initialized statically, using the constants @code{PTHREAD_MUTEX_INITIALIZER} (for timed mutexes), @code{PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP} (for -recursive mutexes), @code{PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP} +recursive mutexes), @code{PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP} (for fast mutexes(, and @code{PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP} (for error checking mutexes). @@ -700,8 +700,8 @@ This function always returns 0. LinuxThreads supports only one mutex attribute: the mutex type, which is either @code{PTHREAD_MUTEX_ADAPTIVE_NP} for ``fast'' mutexes, -@code{PTHREAD_MUTEX_RECURSIVE_NP} for ``recursive'' mutexes, -@code{PTHREAD_MUTEX_TIMED_NP} for ``timed'' mutexes, or +@code{PTHREAD_MUTEX_RECURSIVE_NP} for ``recursive'' mutexes, +@code{PTHREAD_MUTEX_TIMED_NP} for ``timed'' mutexes, or @code{PTHREAD_MUTEX_ERRORCHECK_NP} for ``error checking'' mutexes. As the @code{NP} suffix indicates, this is a non-portable extension to the POSIX standard and should not be employed in portable programs. @@ -728,12 +728,12 @@ The default mutex type is ``timed'', that is, @code{PTHREAD_MUTEX_TIMED_NP}. @var{attr} to the value specified by @var{type}. If @var{type} is not @code{PTHREAD_MUTEX_ADAPTIVE_NP}, -@code{PTHREAD_MUTEX_RECURSIVE_NP}, @code{PTHREAD_MUTEX_TIMED_NP}, or +@code{PTHREAD_MUTEX_RECURSIVE_NP}, @code{PTHREAD_MUTEX_TIMED_NP}, or @code{PTHREAD_MUTEX_ERRORCHECK_NP}, this function will return @code{EINVAL} and leave @var{attr} unchanged. -The standard Unix98 identifiers @code{PTHREAD_MUTEX_DEFAULT}, -@code{PTHREAD_MUTEX_NORMAL}, @code{PTHREAD_MUTEX_RECURSIVE}, +The standard Unix98 identifiers @code{PTHREAD_MUTEX_DEFAULT}, +@code{PTHREAD_MUTEX_NORMAL}, @code{PTHREAD_MUTEX_RECURSIVE}, and @code{PTHREAD_MUTEX_ERRORCHECK} are also permitted. @end deftypefun diff --git a/locale/findlocale.c b/locale/findlocale.c index b1f940231f..162245f137 100644 --- a/locale/findlocale.c +++ b/locale/findlocale.c @@ -253,7 +253,7 @@ free_mem (void) struct loaded_l10nfile *here = runp; struct locale_data *data = (struct locale_data *) runp->data; - if (data != NULL && data->usage_count != UNDELETABLE) + if (data != NULL && data != _nl_C[category]) _nl_unload_locale (data); runp = runp->next; free ((char *) here->filename); |