mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 22:10:13 +00:00
intl: Merge with gettext version 0.19.3
This patch merges the latest release of gettext into the intl subdirectory. The initial motivation was to include the plural.y changes which enable building with bison 3.0, but the majority of the other changes are merely cosmetic so it seemed like merging the whole directory was simpler than trying to take it piecemeal. The merge was done by copying across the latext gettext code and adding in a few small glibc changes that have been added over the years that seemed beneficial, as well as a couple of small build fixes that should be merged back to gettext. I also reverted the gettext commit: commit 279b57fc367251666f00e8e2b599b83703451afb Author: Bruno Haible <bruno@clisp.org> Date: Fri Jun 14 12:03:49 2002 +0000 Make absolute pathnames inside $LANGUAGE work. As it caused localedata/tst-setlocale3 to fail and it wasn't clear that glibc wanted that behaviour. The merge has dropped many uses of __glibc_likely/unlikely. This is intentional given that it eases merging. It seems to me that the cost of continually rewriting these lines when merging and the risk of adding bugs when doing so outweighs the benefits of using these macros when code is shared with another project. Tested with make check on x86_64. ChangeLog: 2014-12-11 Will Newton <will.newton@linaro.org> Merge gettext 0.19.3 into intl/. This involves a number of cosmetic changes to comments and ANSI function definitions and prototypes throughout all the files. The gettext copyright header is used but with the date ranges taken from the glibc copy. * NEWS: Add gettext merge to 2.21. * intl/bindtextdom.c: Switch to gettext copyright. Use ANSI definitions and prototypes. Use gl_* locking primitives rather than __libc_* ones. Use __builtin_expect rather than __glibc_likely/unlikely. * intl/dcgettext.c: Switch to gettext copyright. Use ANSI definitions and prototypes. * intl/dcigettext.c: Switch to gettext copyright. Use ANSI definitions and prototypes. (INTDIV0_RAISES_SIGFPE): New define. Use gl_* locking primitives rather than __libc_* ones. Include eval-plural.h instead of plural-eval.c. Use __builtin_expect rather than __glibc_likely/unlikely. * intl/dcngettext.c: Switch to gettext copyright. Use ANSI definitions and prototypes. * intl/dgettext.c: Likewise. * intl/dngettext.c: Likewise. * intl/plural-eval.c: Renamed to... * intl/eval-plural.h: ...this. * intl/explodename.c: Switch to gettext copyright. Use ANSI definitions and prototypes. (_nl_explode_name): Use strchr instead of __rawmemchr. * intl/finddomain.c: Switch to gettext copyright. Use ANSI definitions and prototypes. Use gl_* locking primitives rather than __libc_* ones. (_nl_find_domain): Use malloc rather than alloca for allocation of temporary locale name. * intl/gettext.c: Switch to gettext copyright. Use ANSI definitions and prototypes. * intl/gettextP.h: Switch to gettext copyright. Use ANSI definitions and prototypes. Use gl_* locking primitives rather than __libc_* ones. * intl/gmo.h: Switch to gettext copyright. (struct sysdep_string): Move struct segment_pair outside of struct definition. * intl/hash-string.c: Use ANSI definitions and prototypes. * intl/hash-string.h: Switch to gettext copyright. Use ANSI definitions and prototypes. * intl/l10nflist.c: Switch to gettext copyright. Use ANSI definitions and prototypes. (_nl_normalize_codeset): Avoid integer overflow. * intl/loadinfo.h: Switch to gettext copyright. Use ANSI definitions and prototypes. (LIBINTL_DLL_EXPORTED): New define. (PATH_SEPARATOR): New define. * intl/loadmsgcat.c: Switch to gettext copyright. * intl/localealias.c: Switch to gettext copyright. Use ANSI definitions and prototypes. (_nl_expand_alias): Use PATH_SEPARATOR. * intl/ngettext.c: Switch to gettext copyright. Use ANSI definitions and prototypes. * intl/plural-exp.c: Likewise. * intl/plural-exp.h: Switch to gettext copyright. Use ANSI definitions and prototypes. (struct expression): Move definition of enum operator outside of struct definition. * intl/plural.c: Regenerate. * intl/plural.y: Switch to gettext copyright. Use ANSI definitions and prototypes. Port to bison 3.0. * intl/textdomain.c: Switch to gettext copyright. Use ANSI definitions and prototypes. Use gl_* locking primitives rather than __libc_* ones.
This commit is contained in:
parent
48c43298bf
commit
6d24885784
73
ChangeLog
73
ChangeLog
@ -1,3 +1,76 @@
|
|||||||
|
2014-12-11 Will Newton <will.newton@linaro.org>
|
||||||
|
|
||||||
|
Merge gettext 0.19.3 into intl/.
|
||||||
|
|
||||||
|
This involves a number of cosmetic changes to comments
|
||||||
|
and ANSI function definitions and prototypes throughout
|
||||||
|
all the files. The gettext copyright header is used but
|
||||||
|
with the date ranges taken from the glibc copy.
|
||||||
|
|
||||||
|
* NEWS: Add gettext merge to 2.21.
|
||||||
|
* intl/bindtextdom.c: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
Use gl_* locking primitives rather than __libc_* ones.
|
||||||
|
Use __builtin_expect rather than __glibc_likely/unlikely.
|
||||||
|
* intl/dcgettext.c: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
* intl/dcigettext.c: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
(INTDIV0_RAISES_SIGFPE): New define.
|
||||||
|
Use gl_* locking primitives rather than __libc_* ones.
|
||||||
|
Include eval-plural.h instead of plural-eval.c.
|
||||||
|
Use __builtin_expect rather than __glibc_likely/unlikely.
|
||||||
|
* intl/dcngettext.c: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
* intl/dgettext.c: Likewise.
|
||||||
|
* intl/dngettext.c: Likewise.
|
||||||
|
* intl/plural-eval.c: Renamed to...
|
||||||
|
* intl/eval-plural.h: ...this.
|
||||||
|
* intl/explodename.c: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
(_nl_explode_name): Use strchr instead of __rawmemchr.
|
||||||
|
* intl/finddomain.c: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
Use gl_* locking primitives rather than __libc_* ones.
|
||||||
|
(_nl_find_domain): Use malloc rather than alloca for
|
||||||
|
allocation of temporary locale name.
|
||||||
|
* intl/gettext.c: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
* intl/gettextP.h: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
Use gl_* locking primitives rather than __libc_* ones.
|
||||||
|
* intl/gmo.h: Switch to gettext copyright.
|
||||||
|
(struct sysdep_string): Move struct segment_pair outside of
|
||||||
|
struct definition.
|
||||||
|
* intl/hash-string.c: Use ANSI definitions and prototypes.
|
||||||
|
* intl/hash-string.h: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
* intl/l10nflist.c: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
(_nl_normalize_codeset): Avoid integer overflow.
|
||||||
|
* intl/loadinfo.h: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
(LIBINTL_DLL_EXPORTED): New define.
|
||||||
|
(PATH_SEPARATOR): New define.
|
||||||
|
* intl/loadmsgcat.c: Switch to gettext copyright.
|
||||||
|
* intl/localealias.c: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
(_nl_expand_alias): Use PATH_SEPARATOR.
|
||||||
|
* intl/ngettext.c: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
* intl/plural-exp.c: Likewise.
|
||||||
|
* intl/plural-exp.h: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
(struct expression): Move definition of enum operator outside
|
||||||
|
of struct definition.
|
||||||
|
* intl/plural.c: Regenerate.
|
||||||
|
* intl/plural.y: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
Port to bison 3.0.
|
||||||
|
* intl/textdomain.c: Switch to gettext copyright.
|
||||||
|
Use ANSI definitions and prototypes.
|
||||||
|
Use gl_* locking primitives rather than __libc_* ones.
|
||||||
|
|
||||||
2014-12-10 Steve Ellcey <sellcey@imgtec.com>
|
2014-12-10 Steve Ellcey <sellcey@imgtec.com>
|
||||||
|
|
||||||
* debug/warning-nop.c: Add used atrribute.
|
* debug/warning-nop.c: Add used atrribute.
|
||||||
|
3
NEWS
3
NEWS
@ -35,6 +35,9 @@ Version 2.21
|
|||||||
4.2BSD interface that inspired the POSIX.1 sigaction interface, which
|
4.2BSD interface that inspired the POSIX.1 sigaction interface, which
|
||||||
programs have been using instead for about 25 years. Of course, ABI
|
programs have been using instead for about 25 years. Of course, ABI
|
||||||
compatibility for old binaries using sigvec remains intact.
|
compatibility for old binaries using sigvec remains intact.
|
||||||
|
|
||||||
|
* Merged gettext 0.19.3 into the intl subdirectory. This fixes building
|
||||||
|
with newer versions of bison.
|
||||||
|
|
||||||
Version 2.20
|
Version 2.20
|
||||||
|
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
/* Implementation of the bindtextdomain(3) function
|
/* Implementation of the bindtextdomain(3) function
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -24,29 +22,21 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
#else
|
#else
|
||||||
# include "libgnuintl.h"
|
# include "libgnuintl.h"
|
||||||
#endif
|
#endif
|
||||||
#include "gettextP.h"
|
|
||||||
|
|
||||||
|
/* Handle multi-threaded applications. */
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
/* We have to handle multi-threaded applications. */
|
|
||||||
# include <bits/libc-lock.h>
|
# include <bits/libc-lock.h>
|
||||||
|
# define gl_rwlock_define __libc_rwlock_define
|
||||||
|
# define gl_rwlock_wrlock __libc_rwlock_wrlock
|
||||||
|
# define gl_rwlock_unlock __libc_rwlock_unlock
|
||||||
#else
|
#else
|
||||||
/* Provide dummy implementation if this is outside glibc. */
|
# include "lock.h"
|
||||||
# define __libc_rwlock_define(CLASS, NAME)
|
|
||||||
# define __libc_rwlock_wrlock(NAME)
|
|
||||||
# define __libc_rwlock_unlock(NAME)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The internal variables in the standalone libintl.a must have different
|
|
||||||
names than the internal variables in GNU libc, otherwise programs
|
|
||||||
using libintl.a cannot be linked statically. */
|
|
||||||
#if !defined _LIBC
|
|
||||||
# define _nl_default_dirname libintl_nl_default_dirname
|
|
||||||
# define _nl_domain_bindings libintl_nl_domain_bindings
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
|
/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
|
||||||
@ -56,17 +46,8 @@
|
|||||||
|
|
||||||
/* @@ end of prolog @@ */
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
/* Contains the default location of the message catalogs. */
|
|
||||||
extern const char _nl_default_dirname[];
|
|
||||||
#ifdef _LIBC
|
|
||||||
libc_hidden_proto (_nl_default_dirname)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* List with bindings of specific domains. */
|
|
||||||
extern struct binding *_nl_domain_bindings;
|
|
||||||
|
|
||||||
/* Lock variable to protect the global data in the gettext implementation. */
|
/* Lock variable to protect the global data in the gettext implementation. */
|
||||||
__libc_rwlock_define (extern, _nl_state_lock attribute_hidden)
|
gl_rwlock_define (extern, _nl_state_lock attribute_hidden)
|
||||||
|
|
||||||
|
|
||||||
/* Names for the libintl functions are a problem. They must not clash
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
@ -84,11 +65,6 @@ __libc_rwlock_define (extern, _nl_state_lock attribute_hidden)
|
|||||||
# define BIND_TEXTDOMAIN_CODESET libintl_bind_textdomain_codeset
|
# define BIND_TEXTDOMAIN_CODESET libintl_bind_textdomain_codeset
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
|
||||||
static void set_binding_values PARAMS ((const char *domainname,
|
|
||||||
const char **dirnamep,
|
|
||||||
const char **codesetp));
|
|
||||||
|
|
||||||
/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
|
/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
|
||||||
to be used for the DOMAINNAME message catalog.
|
to be used for the DOMAINNAME message catalog.
|
||||||
If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not
|
If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not
|
||||||
@ -96,10 +72,8 @@ static void set_binding_values PARAMS ((const char *domainname,
|
|||||||
If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither
|
If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither
|
||||||
modified nor returned. */
|
modified nor returned. */
|
||||||
static void
|
static void
|
||||||
set_binding_values (domainname, dirnamep, codesetp)
|
set_binding_values (const char *domainname,
|
||||||
const char *domainname;
|
const char **dirnamep, const char **codesetp)
|
||||||
const char **dirnamep;
|
|
||||||
const char **codesetp;
|
|
||||||
{
|
{
|
||||||
struct binding *binding;
|
struct binding *binding;
|
||||||
int modified;
|
int modified;
|
||||||
@ -114,7 +88,7 @@ set_binding_values (domainname, dirnamep, codesetp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
__libc_rwlock_wrlock (_nl_state_lock);
|
gl_rwlock_wrlock (_nl_state_lock);
|
||||||
|
|
||||||
modified = 0;
|
modified = 0;
|
||||||
|
|
||||||
@ -158,12 +132,12 @@ set_binding_values (domainname, dirnamep, codesetp)
|
|||||||
#else
|
#else
|
||||||
size_t len = strlen (dirname) + 1;
|
size_t len = strlen (dirname) + 1;
|
||||||
result = (char *) malloc (len);
|
result = (char *) malloc (len);
|
||||||
if (__glibc_likely (result != NULL))
|
if (__builtin_expect (result != NULL, 1))
|
||||||
memcpy (result, dirname, len);
|
memcpy (result, dirname, len);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__glibc_likely (result != NULL))
|
if (__builtin_expect (result != NULL, 1))
|
||||||
{
|
{
|
||||||
if (binding->dirname != _nl_default_dirname)
|
if (binding->dirname != _nl_default_dirname)
|
||||||
free (binding->dirname);
|
free (binding->dirname);
|
||||||
@ -196,11 +170,11 @@ set_binding_values (domainname, dirnamep, codesetp)
|
|||||||
#else
|
#else
|
||||||
size_t len = strlen (codeset) + 1;
|
size_t len = strlen (codeset) + 1;
|
||||||
result = (char *) malloc (len);
|
result = (char *) malloc (len);
|
||||||
if (__glibc_likely (result != NULL))
|
if (__builtin_expect (result != NULL, 1))
|
||||||
memcpy (result, codeset, len);
|
memcpy (result, codeset, len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (__glibc_likely (result != NULL))
|
if (__builtin_expect (result != NULL, 1))
|
||||||
{
|
{
|
||||||
free (binding->codeset);
|
free (binding->codeset);
|
||||||
|
|
||||||
@ -228,7 +202,7 @@ set_binding_values (domainname, dirnamep, codesetp)
|
|||||||
struct binding *new_binding =
|
struct binding *new_binding =
|
||||||
(struct binding *) malloc (offsetof (struct binding, domainname) + len);
|
(struct binding *) malloc (offsetof (struct binding, domainname) + len);
|
||||||
|
|
||||||
if (__glibc_unlikely (new_binding == NULL))
|
if (__builtin_expect (new_binding == NULL, 0))
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
memcpy (new_binding->domainname, domainname, len);
|
memcpy (new_binding->domainname, domainname, len);
|
||||||
@ -249,12 +223,12 @@ set_binding_values (domainname, dirnamep, codesetp)
|
|||||||
char *result;
|
char *result;
|
||||||
#if defined _LIBC || defined HAVE_STRDUP
|
#if defined _LIBC || defined HAVE_STRDUP
|
||||||
result = strdup (dirname);
|
result = strdup (dirname);
|
||||||
if (__glibc_unlikely (result == NULL))
|
if (__builtin_expect (result == NULL, 0))
|
||||||
goto failed_dirname;
|
goto failed_dirname;
|
||||||
#else
|
#else
|
||||||
size_t len = strlen (dirname) + 1;
|
size_t len = strlen (dirname) + 1;
|
||||||
result = (char *) malloc (len);
|
result = (char *) malloc (len);
|
||||||
if (__glibc_unlikely (result == NULL))
|
if (__builtin_expect (result == NULL, 0))
|
||||||
goto failed_dirname;
|
goto failed_dirname;
|
||||||
memcpy (result, dirname, len);
|
memcpy (result, dirname, len);
|
||||||
#endif
|
#endif
|
||||||
@ -278,12 +252,12 @@ set_binding_values (domainname, dirnamep, codesetp)
|
|||||||
|
|
||||||
#if defined _LIBC || defined HAVE_STRDUP
|
#if defined _LIBC || defined HAVE_STRDUP
|
||||||
result = strdup (codeset);
|
result = strdup (codeset);
|
||||||
if (__glibc_unlikely (result == NULL))
|
if (__builtin_expect (result == NULL, 0))
|
||||||
goto failed_codeset;
|
goto failed_codeset;
|
||||||
#else
|
#else
|
||||||
size_t len = strlen (codeset) + 1;
|
size_t len = strlen (codeset) + 1;
|
||||||
result = (char *) malloc (len);
|
result = (char *) malloc (len);
|
||||||
if (__glibc_unlikely (result == NULL))
|
if (__builtin_expect (result == NULL, 0))
|
||||||
goto failed_codeset;
|
goto failed_codeset;
|
||||||
memcpy (result, codeset, len);
|
memcpy (result, codeset, len);
|
||||||
#endif
|
#endif
|
||||||
@ -335,15 +309,13 @@ set_binding_values (domainname, dirnamep, codesetp)
|
|||||||
if (modified)
|
if (modified)
|
||||||
++_nl_msg_cat_cntr;
|
++_nl_msg_cat_cntr;
|
||||||
|
|
||||||
__libc_rwlock_unlock (_nl_state_lock);
|
gl_rwlock_unlock (_nl_state_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Specify that the DOMAINNAME message catalog will be found
|
/* Specify that the DOMAINNAME message catalog will be found
|
||||||
in DIRNAME rather than in the system locale data base. */
|
in DIRNAME rather than in the system locale data base. */
|
||||||
char *
|
char *
|
||||||
BINDTEXTDOMAIN (domainname, dirname)
|
BINDTEXTDOMAIN (const char *domainname, const char *dirname)
|
||||||
const char *domainname;
|
|
||||||
const char *dirname;
|
|
||||||
{
|
{
|
||||||
set_binding_values (domainname, &dirname, NULL);
|
set_binding_values (domainname, &dirname, NULL);
|
||||||
return (char *) dirname;
|
return (char *) dirname;
|
||||||
@ -352,9 +324,7 @@ BINDTEXTDOMAIN (domainname, dirname)
|
|||||||
/* Specify the character encoding in which the messages from the
|
/* Specify the character encoding in which the messages from the
|
||||||
DOMAINNAME message catalog will be returned. */
|
DOMAINNAME message catalog will be returned. */
|
||||||
char *
|
char *
|
||||||
BIND_TEXTDOMAIN_CODESET (domainname, codeset)
|
BIND_TEXTDOMAIN_CODESET (const char *domainname, const char *codeset)
|
||||||
const char *domainname;
|
|
||||||
const char *codeset;
|
|
||||||
{
|
{
|
||||||
set_binding_values (domainname, NULL, &codeset);
|
set_binding_values (domainname, NULL, &codeset);
|
||||||
return (char *) codeset;
|
return (char *) codeset;
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
/* Implementation of the dcgettext(3) function.
|
/* Implementation of the dcgettext(3) function.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -44,10 +42,7 @@
|
|||||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||||
locale. */
|
locale. */
|
||||||
char *
|
char *
|
||||||
DCGETTEXT (domainname, msgid, category)
|
DCGETTEXT (const char *domainname, const char *msgid, int category)
|
||||||
const char *domainname;
|
|
||||||
const char *msgid;
|
|
||||||
int category;
|
|
||||||
{
|
{
|
||||||
return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category);
|
return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,20 +1,18 @@
|
|||||||
/* Implementation of the dcngettext(3) function.
|
/* Implementation of the dcngettext(3) function.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -44,12 +42,9 @@
|
|||||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||||
locale. */
|
locale. */
|
||||||
char *
|
char *
|
||||||
DCNGETTEXT (domainname, msgid1, msgid2, n, category)
|
DCNGETTEXT (const char *domainname,
|
||||||
const char *domainname;
|
const char *msgid1, const char *msgid2, unsigned long int n,
|
||||||
const char *msgid1;
|
int category)
|
||||||
const char *msgid2;
|
|
||||||
unsigned long int n;
|
|
||||||
int category;
|
|
||||||
{
|
{
|
||||||
return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category);
|
return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category);
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,27 @@
|
|||||||
/* Implementation of the dgettext(3) function.
|
/* Implementation of the dgettext(3) function.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
#include "gettextP.h"
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
#else
|
#else
|
||||||
@ -46,9 +45,7 @@
|
|||||||
/* Look up MSGID in the DOMAINNAME message catalog of the current
|
/* Look up MSGID in the DOMAINNAME message catalog of the current
|
||||||
LC_MESSAGES locale. */
|
LC_MESSAGES locale. */
|
||||||
char *
|
char *
|
||||||
DGETTEXT (domainname, msgid)
|
DGETTEXT (const char *domainname, const char *msgid)
|
||||||
const char *domainname;
|
|
||||||
const char *msgid;
|
|
||||||
{
|
{
|
||||||
return DCGETTEXT (domainname, msgid, LC_MESSAGES);
|
return DCGETTEXT (domainname, msgid, LC_MESSAGES);
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,27 @@
|
|||||||
/* Implementation of the dngettext(3) function.
|
/* Implementation of the dngettext(3) function.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
#include "gettextP.h"
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
#else
|
#else
|
||||||
@ -46,11 +45,8 @@
|
|||||||
/* Look up MSGID in the DOMAINNAME message catalog of the current
|
/* Look up MSGID in the DOMAINNAME message catalog of the current
|
||||||
LC_MESSAGES locale and skip message according to the plural form. */
|
LC_MESSAGES locale and skip message according to the plural form. */
|
||||||
char *
|
char *
|
||||||
DNGETTEXT (domainname, msgid1, msgid2, n)
|
DNGETTEXT (const char *domainname,
|
||||||
const char *domainname;
|
const char *msgid1, const char *msgid2, unsigned long int n)
|
||||||
const char *msgid1;
|
|
||||||
const char *msgid2;
|
|
||||||
unsigned long int n;
|
|
||||||
{
|
{
|
||||||
return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES);
|
return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES);
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,28 @@
|
|||||||
/* Plural expression evaluation.
|
/* Plural expression evaluation.
|
||||||
Copyright (C) 2000-2014 Free Software Foundation, Inc.
|
Copyright (C) 2000-2003, 2007 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
static unsigned long int plural_eval (const struct expression *pexp,
|
#ifndef STATIC
|
||||||
unsigned long int n)
|
#define STATIC static
|
||||||
internal_function;
|
#endif
|
||||||
|
|
||||||
static unsigned long int
|
/* Evaluate the plural expression and return an index value. */
|
||||||
|
STATIC
|
||||||
|
unsigned long int
|
||||||
internal_function
|
internal_function
|
||||||
plural_eval (pexp, n)
|
plural_eval (const struct expression *pexp, unsigned long int n)
|
||||||
const struct expression *pexp;
|
|
||||||
unsigned long int n;
|
|
||||||
{
|
{
|
||||||
switch (pexp->nargs)
|
switch (pexp->nargs)
|
||||||
{
|
{
|
||||||
@ -62,8 +60,16 @@ plural_eval (pexp, n)
|
|||||||
case mult:
|
case mult:
|
||||||
return leftarg * rightarg;
|
return leftarg * rightarg;
|
||||||
case divide:
|
case divide:
|
||||||
|
#if !INTDIV0_RAISES_SIGFPE
|
||||||
|
if (rightarg == 0)
|
||||||
|
raise (SIGFPE);
|
||||||
|
#endif
|
||||||
return leftarg / rightarg;
|
return leftarg / rightarg;
|
||||||
case module:
|
case module:
|
||||||
|
#if !INTDIV0_RAISES_SIGFPE
|
||||||
|
if (rightarg == 0)
|
||||||
|
raise (SIGFPE);
|
||||||
|
#endif
|
||||||
return leftarg % rightarg;
|
return leftarg % rightarg;
|
||||||
case plus:
|
case plus:
|
||||||
return leftarg + rightarg;
|
return leftarg + rightarg;
|
@ -1,20 +1,18 @@
|
|||||||
/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -37,11 +35,13 @@
|
|||||||
|
|
||||||
/* @@ end of prolog @@ */
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
static char *_nl_find_language PARAMS ((const char *name));
|
/* Split a locale name NAME into a leading language part and all the
|
||||||
|
rest. Return a pointer to the first character after the language,
|
||||||
|
i.e. to the first byte of the rest. */
|
||||||
|
static char *_nl_find_language (const char *name);
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_nl_find_language (name)
|
_nl_find_language (const char *name)
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
while (name[0] != '\0' && name[0] != '_' && name[0] != '@' && name[0] != '.')
|
while (name[0] != '\0' && name[0] != '_' && name[0] != '@' && name[0] != '.')
|
||||||
++name;
|
++name;
|
||||||
@ -51,14 +51,10 @@ _nl_find_language (name)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
_nl_explode_name (name, language, modifier, territory, codeset,
|
_nl_explode_name (char *name,
|
||||||
normalized_codeset)
|
const char **language, const char **modifier,
|
||||||
char *name;
|
const char **territory, const char **codeset,
|
||||||
const char **language;
|
const char **normalized_codeset)
|
||||||
const char **modifier;
|
|
||||||
const char **territory;
|
|
||||||
const char **codeset;
|
|
||||||
const char **normalized_codeset;
|
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
int mask;
|
int mask;
|
||||||
@ -77,8 +73,8 @@ _nl_explode_name (name, language, modifier, territory, codeset,
|
|||||||
if (*language == cp)
|
if (*language == cp)
|
||||||
/* This does not make sense: language has to be specified. Use
|
/* This does not make sense: language has to be specified. Use
|
||||||
this entry as it is without exploding. Perhaps it is an alias. */
|
this entry as it is without exploding. Perhaps it is an alias. */
|
||||||
cp = __rawmemchr (*language, '\0');
|
cp = strchr (*language, '\0');
|
||||||
else if (cp[0] != '@')
|
else
|
||||||
{
|
{
|
||||||
if (cp[0] == '_')
|
if (cp[0] == '_')
|
||||||
{
|
{
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
/* Handle list of needed message catalogs
|
/* Handle list of needed message catalogs
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
|
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -33,11 +31,21 @@
|
|||||||
#include "gettextP.h"
|
#include "gettextP.h"
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
# include <bits/libc-lock.h>
|
|
||||||
#else
|
#else
|
||||||
# include "libgnuintl.h"
|
# include "libgnuintl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Handle multi-threaded applications. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <bits/libc-lock.h>
|
||||||
|
# define gl_rwlock_define_initialized __libc_rwlock_define_initialized
|
||||||
|
# define gl_rwlock_rdlock __libc_rwlock_rdlock
|
||||||
|
# define gl_rwlock_wrlock __libc_rwlock_wrlock
|
||||||
|
# define gl_rwlock_unlock __libc_rwlock_unlock
|
||||||
|
#else
|
||||||
|
# include "lock.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* @@ end of prolog @@ */
|
/* @@ end of prolog @@ */
|
||||||
/* List of already loaded domains. */
|
/* List of already loaded domains. */
|
||||||
static struct loaded_l10nfile *_nl_loaded_domains;
|
static struct loaded_l10nfile *_nl_loaded_domains;
|
||||||
@ -48,11 +56,8 @@ static struct loaded_l10nfile *_nl_loaded_domains;
|
|||||||
established bindings. */
|
established bindings. */
|
||||||
struct loaded_l10nfile *
|
struct loaded_l10nfile *
|
||||||
internal_function
|
internal_function
|
||||||
_nl_find_domain (dirname, locale, domainname, domainbinding)
|
_nl_find_domain (const char *dirname, char *locale,
|
||||||
const char *dirname;
|
const char *domainname, struct binding *domainbinding)
|
||||||
char *locale;
|
|
||||||
const char *domainname;
|
|
||||||
struct binding *domainbinding;
|
|
||||||
{
|
{
|
||||||
struct loaded_l10nfile *retval;
|
struct loaded_l10nfile *retval;
|
||||||
const char *language;
|
const char *language;
|
||||||
@ -65,7 +70,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
|
|||||||
|
|
||||||
/* LOCALE can consist of up to four recognized parts for the XPG syntax:
|
/* LOCALE can consist of up to four recognized parts for the XPG syntax:
|
||||||
|
|
||||||
language[_territory[.codeset]][@modifier]
|
language[_territory][.codeset][@modifier]
|
||||||
|
|
||||||
Beside the first part all of them are allowed to be missing. If
|
Beside the first part all of them are allowed to be missing. If
|
||||||
the full specified locale is not found, the less specific one are
|
the full specified locale is not found, the less specific one are
|
||||||
@ -78,15 +83,16 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* We need to protect modifying the _NL_LOADED_DOMAINS data. */
|
/* We need to protect modifying the _NL_LOADED_DOMAINS data. */
|
||||||
__libc_rwlock_define_initialized (static, lock);
|
gl_rwlock_define_initialized (static, lock);
|
||||||
__libc_rwlock_rdlock (lock);
|
gl_rwlock_rdlock (lock);
|
||||||
|
|
||||||
/* If we have already tested for this locale entry there has to
|
/* If we have already tested for this locale entry there has to
|
||||||
be one data set in the list of loaded domains. */
|
be one data set in the list of loaded domains. */
|
||||||
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
|
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
|
||||||
strlen (dirname) + 1, 0, locale, NULL, NULL,
|
strlen (dirname) + 1, 0, locale, NULL, NULL,
|
||||||
NULL, NULL, domainname, 0);
|
NULL, NULL, domainname, 0);
|
||||||
__libc_rwlock_unlock (lock);
|
|
||||||
|
gl_rwlock_unlock (lock);
|
||||||
|
|
||||||
if (retval != NULL)
|
if (retval != NULL)
|
||||||
{
|
{
|
||||||
@ -117,11 +123,23 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
|
|||||||
done. */
|
done. */
|
||||||
alias_value = _nl_expand_alias (locale);
|
alias_value = _nl_expand_alias (locale);
|
||||||
if (alias_value != NULL)
|
if (alias_value != NULL)
|
||||||
locale = strdupa (alias_value);
|
{
|
||||||
|
#if defined _LIBC || defined HAVE_STRDUP
|
||||||
|
locale = strdup (alias_value);
|
||||||
|
if (locale == NULL)
|
||||||
|
return NULL;
|
||||||
|
#else
|
||||||
|
size_t len = strlen (alias_value) + 1;
|
||||||
|
locale = (char *) malloc (len);
|
||||||
|
if (locale == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
memcpy (locale, alias_value, len);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Now we determine the single parts of the locale name. First
|
/* Now we determine the single parts of the locale name. First
|
||||||
look for the language. Termination symbols are `_' and `@' if
|
look for the language. Termination symbols are `_', '.', and `@'. */
|
||||||
we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */
|
|
||||||
mask = _nl_explode_name (locale, &language, &modifier, &territory,
|
mask = _nl_explode_name (locale, &language, &modifier, &territory,
|
||||||
&codeset, &normalized_codeset);
|
&codeset, &normalized_codeset);
|
||||||
if (mask == -1)
|
if (mask == -1)
|
||||||
@ -129,7 +147,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* We need to protect modifying the _NL_LOADED_DOMAINS data. */
|
/* We need to protect modifying the _NL_LOADED_DOMAINS data. */
|
||||||
__libc_rwlock_wrlock (lock);
|
gl_rwlock_wrlock (lock);
|
||||||
|
|
||||||
/* Create all possible locale entries which might be interested in
|
/* Create all possible locale entries which might be interested in
|
||||||
generalization. */
|
generalization. */
|
||||||
@ -137,7 +155,8 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
|
|||||||
strlen (dirname) + 1, mask, language, territory,
|
strlen (dirname) + 1, mask, language, territory,
|
||||||
codeset, normalized_codeset, modifier,
|
codeset, normalized_codeset, modifier,
|
||||||
domainname, 1);
|
domainname, 1);
|
||||||
__libc_rwlock_unlock (lock);
|
|
||||||
|
gl_rwlock_unlock (lock);
|
||||||
|
|
||||||
if (retval == NULL)
|
if (retval == NULL)
|
||||||
/* This means we are out of core. */
|
/* This means we are out of core. */
|
||||||
@ -157,6 +176,10 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The room for an alias was dynamically allocated. Free it now. */
|
||||||
|
if (alias_value != NULL)
|
||||||
|
free (locale);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
/* The space for normalized_codeset is dynamically allocated. Free it. */
|
/* The space for normalized_codeset is dynamically allocated. Free it. */
|
||||||
if (mask & XPG_NORM_CODESET)
|
if (mask & XPG_NORM_CODESET)
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
/* Implementation of gettext(3) function.
|
/* Implementation of gettext(3) function.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -52,8 +50,7 @@
|
|||||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||||
text). */
|
text). */
|
||||||
char *
|
char *
|
||||||
GETTEXT (msgid)
|
GETTEXT (const char *msgid)
|
||||||
const char *msgid;
|
|
||||||
{
|
{
|
||||||
return DCGETTEXT (NULL, msgid, LC_MESSAGES);
|
return DCGETTEXT (NULL, msgid, LC_MESSAGES);
|
||||||
}
|
}
|
||||||
|
237
intl/gettextP.h
237
intl/gettextP.h
@ -1,21 +1,19 @@
|
|||||||
/* Header describing internals of libintl library.
|
/* Header describing internals of libintl library.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
|
Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifndef _GETTEXTP_H
|
#ifndef _GETTEXTP_H
|
||||||
#define _GETTEXTP_H
|
#define _GETTEXTP_H
|
||||||
@ -30,20 +28,67 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Handle multi-threaded applications. */
|
||||||
|
#ifdef _LIBC
|
||||||
|
# include <bits/libc-lock.h>
|
||||||
|
# define gl_rwlock_define __libc_rwlock_define
|
||||||
|
#else
|
||||||
|
# include "lock.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
struct loaded_domain;
|
||||||
|
extern char *__gettext (const char *__msgid);
|
||||||
|
extern char *__dgettext (const char *__domainname, const char *__msgid);
|
||||||
|
extern char *__dcgettext (const char *__domainname, const char *__msgid,
|
||||||
|
int __category);
|
||||||
|
extern char *__ngettext (const char *__msgid1, const char *__msgid2,
|
||||||
|
unsigned long int __n);
|
||||||
|
extern char *__dngettext (const char *__domainname,
|
||||||
|
const char *__msgid1, const char *__msgid2,
|
||||||
|
unsigned long int n);
|
||||||
|
extern char *__dcngettext (const char *__domainname,
|
||||||
|
const char *__msgid1, const char *__msgid2,
|
||||||
|
unsigned long int __n, int __category);
|
||||||
|
extern char *__dcigettext (const char *__domainname,
|
||||||
|
const char *__msgid1, const char *__msgid2,
|
||||||
|
int __plural, unsigned long int __n,
|
||||||
|
int __category);
|
||||||
|
extern char *__textdomain (const char *__domainname);
|
||||||
|
extern char *__bindtextdomain (const char *__domainname,
|
||||||
|
const char *__dirname);
|
||||||
|
extern char *__bind_textdomain_codeset (const char *__domainname,
|
||||||
|
const char *__codeset);
|
||||||
|
extern void _nl_finddomain_subfreeres (void) attribute_hidden;
|
||||||
|
extern void _nl_unload_domain (struct loaded_domain *__domain)
|
||||||
|
internal_function attribute_hidden;
|
||||||
|
#else
|
||||||
|
/* Declare the exported libintl_* functions, in a way that allows us to
|
||||||
|
call them under their real name. */
|
||||||
|
# undef _INTL_REDIRECT_INLINE
|
||||||
|
# undef _INTL_REDIRECT_MACROS
|
||||||
|
# define _INTL_REDIRECT_MACROS
|
||||||
|
# include "libgnuintl.h"
|
||||||
|
# ifdef IN_LIBGLOCALE
|
||||||
|
extern char *gl_dcigettext (const char *__domainname,
|
||||||
|
const char *__msgid1, const char *__msgid2,
|
||||||
|
int __plural, unsigned long int __n,
|
||||||
|
int __category,
|
||||||
|
const char *__localename, const char *__encoding);
|
||||||
|
# else
|
||||||
|
extern char *libintl_dcigettext (const char *__domainname,
|
||||||
|
const char *__msgid1, const char *__msgid2,
|
||||||
|
int __plural, unsigned long int __n,
|
||||||
|
int __category);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "loadinfo.h"
|
#include "loadinfo.h"
|
||||||
|
|
||||||
#include "gmo.h" /* Get nls_uint32. */
|
#include "gmo.h" /* Get nls_uint32. */
|
||||||
|
|
||||||
/* @@ end of prolog @@ */
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
#ifndef PARAMS
|
|
||||||
# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
|
|
||||||
# define PARAMS(args) args
|
|
||||||
# else
|
|
||||||
# define PARAMS(args) ()
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef internal_function
|
#ifndef internal_function
|
||||||
# define internal_function
|
# define internal_function
|
||||||
#endif
|
#endif
|
||||||
@ -52,6 +97,12 @@
|
|||||||
# define attribute_hidden
|
# define attribute_hidden
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Tell the compiler when a conditional or integer expression is
|
||||||
|
almost always true or almost always false. */
|
||||||
|
#ifndef HAVE_BUILTIN_EXPECT
|
||||||
|
# define __builtin_expect(expr, val) (expr)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef W
|
#ifndef W
|
||||||
# define W(flag, data) ((flag) ? SWAP (data) : (data))
|
# define W(flag, data) ((flag) ? SWAP (data) : (data))
|
||||||
#endif
|
#endif
|
||||||
@ -61,11 +112,13 @@
|
|||||||
# include <byteswap.h>
|
# include <byteswap.h>
|
||||||
# define SWAP(i) bswap_32 (i)
|
# define SWAP(i) bswap_32 (i)
|
||||||
#else
|
#else
|
||||||
static nls_uint32 SWAP PARAMS ((nls_uint32 i));
|
|
||||||
|
|
||||||
static inline nls_uint32
|
static inline nls_uint32
|
||||||
|
# ifdef __cplusplus
|
||||||
|
SWAP (nls_uint32 i)
|
||||||
|
# else
|
||||||
SWAP (i)
|
SWAP (i)
|
||||||
nls_uint32 i;
|
nls_uint32 i;
|
||||||
|
# endif
|
||||||
{
|
{
|
||||||
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
|
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
|
||||||
}
|
}
|
||||||
@ -139,7 +192,7 @@ struct loaded_domain
|
|||||||
/* Cache of charset conversions of the translated strings. */
|
/* Cache of charset conversions of the translated strings. */
|
||||||
struct converted_domain *conversions;
|
struct converted_domain *conversions;
|
||||||
size_t nconversions;
|
size_t nconversions;
|
||||||
__libc_rwlock_define (, conversions_lock);
|
gl_rwlock_define (, conversions_lock)
|
||||||
|
|
||||||
const struct expression *plural;
|
const struct expression *plural;
|
||||||
unsigned long int nplurals;
|
unsigned long int nplurals;
|
||||||
@ -166,82 +219,92 @@ struct binding
|
|||||||
/* A counter which is incremented each time some previous translations
|
/* A counter which is incremented each time some previous translations
|
||||||
become invalid.
|
become invalid.
|
||||||
This variable is part of the external ABI of the GNU libintl. */
|
This variable is part of the external ABI of the GNU libintl. */
|
||||||
extern int _nl_msg_cat_cntr;
|
#ifdef IN_LIBGLOCALE
|
||||||
|
# include <glocale/config.h>
|
||||||
|
extern LIBGLOCALE_DLL_EXPORTED int _nl_msg_cat_cntr;
|
||||||
|
#else
|
||||||
|
extern LIBINTL_DLL_EXPORTED int _nl_msg_cat_cntr;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _LIBC
|
#ifndef _LIBC
|
||||||
const char *_nl_locale_name PARAMS ((int category, const char *categoryname));
|
extern const char *_nl_language_preferences_default (void);
|
||||||
|
# define gl_locale_name_canonicalize _nl_locale_name_canonicalize
|
||||||
|
extern void _nl_locale_name_canonicalize (char *name);
|
||||||
|
# define gl_locale_name_from_win32_LANGID _nl_locale_name_from_win32_LANGID
|
||||||
|
/* extern const char *_nl_locale_name_from_win32_LANGID (LANGID langid); */
|
||||||
|
# define gl_locale_name_from_win32_LCID _nl_locale_name_from_win32_LCID
|
||||||
|
/* extern const char *_nl_locale_name_from_win32_LCID (LCID lcid); */
|
||||||
|
# define gl_locale_name_thread_unsafe _nl_locale_name_thread_unsafe
|
||||||
|
extern const char *_nl_locale_name_thread_unsafe (int category,
|
||||||
|
const char *categoryname);
|
||||||
|
# define gl_locale_name_thread _nl_locale_name_thread
|
||||||
|
/* extern const char *_nl_locale_name_thread (int category,
|
||||||
|
const char *categoryname); */
|
||||||
|
# define gl_locale_name_posix _nl_locale_name_posix
|
||||||
|
extern const char *_nl_locale_name_posix (int category,
|
||||||
|
const char *categoryname);
|
||||||
|
# define gl_locale_name_environ _nl_locale_name_environ
|
||||||
|
extern const char *_nl_locale_name_environ (int category,
|
||||||
|
const char *categoryname);
|
||||||
|
# define gl_locale_name_default _nl_locale_name_default
|
||||||
|
extern const char *_nl_locale_name_default (void);
|
||||||
|
# define gl_locale_name _nl_locale_name
|
||||||
|
/* extern const char *_nl_locale_name (int category,
|
||||||
|
const char *categoryname); */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
|
struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale,
|
||||||
char *__locale,
|
const char *__domainname,
|
||||||
const char *__domainname,
|
struct binding *__domainbinding)
|
||||||
struct binding *__domainbinding))
|
|
||||||
internal_function;
|
internal_function;
|
||||||
void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
|
void _nl_load_domain (struct loaded_l10nfile *__domain,
|
||||||
struct binding *__domainbinding))
|
struct binding *__domainbinding)
|
||||||
internal_function;
|
internal_function;
|
||||||
|
|
||||||
char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
|
#ifdef IN_LIBGLOCALE
|
||||||
struct binding *domainbinding, const char *msgid,
|
char *_nl_find_msg (struct loaded_l10nfile *domain_file,
|
||||||
int convert, size_t *lengthp))
|
struct binding *domainbinding, const char *encoding,
|
||||||
|
const char *msgid,
|
||||||
|
size_t *lengthp)
|
||||||
internal_function;
|
internal_function;
|
||||||
|
|
||||||
#ifdef _LIBC
|
|
||||||
extern char *__gettext PARAMS ((const char *__msgid));
|
|
||||||
extern char *__dgettext PARAMS ((const char *__domainname,
|
|
||||||
const char *__msgid));
|
|
||||||
extern char *__dcgettext PARAMS ((const char *__domainname,
|
|
||||||
const char *__msgid, int __category));
|
|
||||||
extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
|
|
||||||
unsigned long int __n));
|
|
||||||
extern char *__dngettext PARAMS ((const char *__domainname,
|
|
||||||
const char *__msgid1, const char *__msgid2,
|
|
||||||
unsigned long int n));
|
|
||||||
extern char *__dcngettext PARAMS ((const char *__domainname,
|
|
||||||
const char *__msgid1, const char *__msgid2,
|
|
||||||
unsigned long int __n, int __category));
|
|
||||||
extern char *__dcigettext PARAMS ((const char *__domainname,
|
|
||||||
const char *__msgid1, const char *__msgid2,
|
|
||||||
int __plural, unsigned long int __n,
|
|
||||||
int __category));
|
|
||||||
extern char *__textdomain PARAMS ((const char *__domainname));
|
|
||||||
extern char *__bindtextdomain PARAMS ((const char *__domainname,
|
|
||||||
const char *__dirname));
|
|
||||||
extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
|
|
||||||
const char *__codeset));
|
|
||||||
extern void _nl_finddomain_subfreeres PARAMS ((void)) attribute_hidden;
|
|
||||||
extern void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
|
|
||||||
internal_function attribute_hidden;
|
|
||||||
#else
|
#else
|
||||||
extern char *libintl_gettext PARAMS ((const char *__msgid));
|
char *_nl_find_msg (struct loaded_l10nfile *domain_file,
|
||||||
extern char *libintl_dgettext PARAMS ((const char *__domainname,
|
struct binding *domainbinding, const char *msgid,
|
||||||
const char *__msgid));
|
int convert, size_t *lengthp)
|
||||||
extern char *libintl_dcgettext PARAMS ((const char *__domainname,
|
internal_function;
|
||||||
const char *__msgid, int __category));
|
|
||||||
extern char *libintl_ngettext PARAMS ((const char *__msgid1,
|
|
||||||
const char *__msgid2,
|
|
||||||
unsigned long int __n));
|
|
||||||
extern char *libintl_dngettext PARAMS ((const char *__domainname,
|
|
||||||
const char *__msgid1,
|
|
||||||
const char *__msgid2,
|
|
||||||
unsigned long int __n));
|
|
||||||
extern char *libintl_dcngettext PARAMS ((const char *__domainname,
|
|
||||||
const char *__msgid1,
|
|
||||||
const char *__msgid2,
|
|
||||||
unsigned long int __n,
|
|
||||||
int __category));
|
|
||||||
extern char *libintl_dcigettext PARAMS ((const char *__domainname,
|
|
||||||
const char *__msgid1,
|
|
||||||
const char *__msgid2,
|
|
||||||
int __plural, unsigned long int __n,
|
|
||||||
int __category));
|
|
||||||
extern char *libintl_textdomain PARAMS ((const char *__domainname));
|
|
||||||
extern char *libintl_bindtextdomain PARAMS ((const char *__domainname,
|
|
||||||
const char *__dirname));
|
|
||||||
extern char *libintl_bind_textdomain_codeset PARAMS ((const char *__domainname,
|
|
||||||
const char *__codeset));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The internal variables in the standalone libintl.a must have different
|
||||||
|
names than the internal variables in GNU libc, otherwise programs
|
||||||
|
using libintl.a cannot be linked statically. */
|
||||||
|
#if !defined _LIBC
|
||||||
|
# define _nl_default_dirname libintl_nl_default_dirname
|
||||||
|
# define _nl_domain_bindings libintl_nl_domain_bindings
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Contains the default location of the message catalogs. */
|
||||||
|
extern const char _nl_default_dirname[];
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_proto (_nl_default_dirname)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* List with bindings of specific domains. */
|
||||||
|
extern struct binding *_nl_domain_bindings;
|
||||||
|
|
||||||
|
/* The internal variables in the standalone libintl.a must have different
|
||||||
|
names than the internal variables in GNU libc, otherwise programs
|
||||||
|
using libintl.a cannot be linked statically. */
|
||||||
|
#if !defined _LIBC
|
||||||
|
# define _nl_default_default_domain libintl_nl_default_default_domain
|
||||||
|
# define _nl_current_default_domain libintl_nl_current_default_domain
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Name of the default text domain. */
|
||||||
|
extern const char _nl_default_default_domain[] attribute_hidden;
|
||||||
|
|
||||||
|
/* Default text domain in which entries for gettext(3) are to be found. */
|
||||||
|
extern const char *_nl_current_default_domain attribute_hidden;
|
||||||
|
|
||||||
/* @@ begin of epilog @@ */
|
/* @@ begin of epilog @@ */
|
||||||
|
|
||||||
#endif /* gettextP.h */
|
#endif /* gettextP.h */
|
||||||
|
39
intl/gmo.h
39
intl/gmo.h
@ -1,20 +1,18 @@
|
|||||||
/* Internal header for GNU gettext internationalization functions.
|
/* Description of GNU message catalog format: general file layout.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifndef _GETTEXT_H
|
#ifndef _GETTEXT_H
|
||||||
#define _GETTEXT_H 1
|
#define _GETTEXT_H 1
|
||||||
@ -124,6 +122,15 @@ struct sysdep_segment
|
|||||||
nls_uint32 offset;
|
nls_uint32 offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Pair of a static and a system dependent segment, in struct sysdep_string. */
|
||||||
|
struct segment_pair
|
||||||
|
{
|
||||||
|
/* Size of static segment. */
|
||||||
|
nls_uint32 segsize;
|
||||||
|
/* Reference to system dependent string segment, or ~0 at the end. */
|
||||||
|
nls_uint32 sysdepref;
|
||||||
|
};
|
||||||
|
|
||||||
/* Descriptor for system dependent string. */
|
/* Descriptor for system dependent string. */
|
||||||
struct sysdep_string
|
struct sysdep_string
|
||||||
{
|
{
|
||||||
@ -131,13 +138,7 @@ struct sysdep_string
|
|||||||
nls_uint32 offset;
|
nls_uint32 offset;
|
||||||
/* Alternating sequence of static and system dependent segments.
|
/* Alternating sequence of static and system dependent segments.
|
||||||
The last segment is a static segment, including the trailing NUL. */
|
The last segment is a static segment, including the trailing NUL. */
|
||||||
struct segment_pair
|
struct segment_pair segments[1];
|
||||||
{
|
|
||||||
/* Size of static segment. */
|
|
||||||
nls_uint32 segsize;
|
|
||||||
/* Reference to system dependent string segment, or ~0 at the end. */
|
|
||||||
nls_uint32 sysdepref;
|
|
||||||
} segments[1];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Marker for the end of the segments[] array. This has the value 0xFFFFFFFF,
|
/* Marker for the end of the segments[] array. This has the value 0xFFFFFFFF,
|
||||||
|
@ -16,6 +16,11 @@
|
|||||||
License along with the GNU C Library; if not, see
|
License along with the GNU C Library; if not, see
|
||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Specification. */
|
||||||
#include "hash-string.h"
|
#include "hash-string.h"
|
||||||
|
|
||||||
|
|
||||||
@ -23,8 +28,7 @@
|
|||||||
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
||||||
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
||||||
unsigned long int
|
unsigned long int
|
||||||
__hash_string (str_param)
|
__hash_string (const char *str_param)
|
||||||
const char *str_param;
|
|
||||||
{
|
{
|
||||||
unsigned long int hval, g;
|
unsigned long int hval, g;
|
||||||
const char *str = str_param;
|
const char *str = str_param;
|
||||||
|
@ -1,37 +1,34 @@
|
|||||||
/* Implements a string hashing function.
|
/* Description of GNU message catalog format: string hashing function.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* @@ end of prolog @@ */
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
#ifndef PARAMS
|
|
||||||
# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
|
|
||||||
# define PARAMS(Args) Args
|
|
||||||
# else
|
|
||||||
# define PARAMS(Args) ()
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We assume to have `unsigned long int' value with at least 32 bits. */
|
/* We assume to have `unsigned long int' value with at least 32 bits. */
|
||||||
#define HASHWORDBITS 32
|
#define HASHWORDBITS 32
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _LIBC
|
||||||
|
# ifdef IN_LIBINTL
|
||||||
|
# define __hash_string libintl_hash_string
|
||||||
|
# else
|
||||||
|
# define __hash_string hash_string
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Defines the so called `hashpjw' function by P.J. Weinberger
|
/* Defines the so called `hashpjw' function by P.J. Weinberger
|
||||||
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
||||||
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
||||||
extern unsigned long int __hash_string PARAMS ((const char *__str_param))
|
extern unsigned long int __hash_string (const char *str_param);
|
||||||
attribute_hidden;
|
|
||||||
|
108
intl/l10nflist.c
108
intl/l10nflist.c
@ -1,20 +1,18 @@
|
|||||||
/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* Tell glibc's <string.h> to provide a prototype for stpcpy().
|
/* Tell glibc's <string.h> to provide a prototype for stpcpy().
|
||||||
This must come before <config.h> because <config.h> may include
|
This must come before <config.h> because <config.h> may include
|
||||||
@ -58,20 +56,19 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifndef HAVE_STPCPY
|
# ifndef HAVE_STPCPY
|
||||||
static char *stpcpy PARAMS ((char *dest, const char *src));
|
static char *stpcpy (char *dest, const char *src);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define function which are usually not available. */
|
/* Define function which are usually not available. */
|
||||||
|
|
||||||
#if !defined _LIBC && !defined HAVE___ARGZ_COUNT
|
#if defined HAVE_ARGZ_COUNT
|
||||||
|
# undef __argz_count
|
||||||
|
# define __argz_count argz_count
|
||||||
|
#else
|
||||||
/* Returns the number of strings in ARGZ. */
|
/* Returns the number of strings in ARGZ. */
|
||||||
static size_t argz_count__ PARAMS ((const char *argz, size_t len));
|
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
argz_count__ (argz, len)
|
argz_count__ (const char *argz, size_t len)
|
||||||
const char *argz;
|
|
||||||
size_t len;
|
|
||||||
{
|
{
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
while (len > 0)
|
while (len > 0)
|
||||||
@ -85,18 +82,16 @@ argz_count__ (argz, len)
|
|||||||
}
|
}
|
||||||
# undef __argz_count
|
# undef __argz_count
|
||||||
# define __argz_count(argz, len) argz_count__ (argz, len)
|
# define __argz_count(argz, len) argz_count__ (argz, len)
|
||||||
#endif /* !_LIBC && !HAVE___ARGZ_COUNT */
|
#endif /* !_LIBC && !HAVE_ARGZ_COUNT */
|
||||||
|
|
||||||
#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
|
#if defined HAVE_ARGZ_STRINGIFY
|
||||||
|
# undef __argz_stringify
|
||||||
|
# define __argz_stringify argz_stringify
|
||||||
|
#else
|
||||||
/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
|
/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
|
||||||
except the last into the character SEP. */
|
except the last into the character SEP. */
|
||||||
static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep));
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
argz_stringify__ (argz, len, sep)
|
argz_stringify__ (char *argz, size_t len, int sep)
|
||||||
char *argz;
|
|
||||||
size_t len;
|
|
||||||
int sep;
|
|
||||||
{
|
{
|
||||||
while (len > 0)
|
while (len > 0)
|
||||||
{
|
{
|
||||||
@ -109,22 +104,20 @@ argz_stringify__ (argz, len, sep)
|
|||||||
}
|
}
|
||||||
# undef __argz_stringify
|
# undef __argz_stringify
|
||||||
# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
|
# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
|
||||||
#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */
|
#endif /* !_LIBC && !HAVE_ARGZ_STRINGIFY */
|
||||||
|
|
||||||
#if !defined _LIBC && !defined HAVE___ARGZ_NEXT
|
|
||||||
static char *argz_next__ PARAMS ((char *argz, size_t argz_len,
|
|
||||||
const char *entry));
|
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
#elif defined HAVE_ARGZ_NEXT
|
||||||
|
# undef __argz_next
|
||||||
|
# define __argz_next argz_next
|
||||||
|
#else
|
||||||
static char *
|
static char *
|
||||||
argz_next__ (argz, argz_len, entry)
|
argz_next__ (char *argz, size_t argz_len, const char *entry)
|
||||||
char *argz;
|
|
||||||
size_t argz_len;
|
|
||||||
const char *entry;
|
|
||||||
{
|
{
|
||||||
if (entry)
|
if (entry)
|
||||||
{
|
{
|
||||||
if (entry < argz + argz_len)
|
if (entry < argz + argz_len)
|
||||||
entry = strchr (entry, '\0') + 1;
|
entry = strchr (entry, '\0') + 1;
|
||||||
|
|
||||||
return entry >= argz + argz_len ? NULL : (char *) entry;
|
return entry >= argz + argz_len ? NULL : (char *) entry;
|
||||||
}
|
}
|
||||||
@ -136,16 +129,12 @@ argz_next__ (argz, argz_len, entry)
|
|||||||
}
|
}
|
||||||
# undef __argz_next
|
# undef __argz_next
|
||||||
# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry)
|
# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry)
|
||||||
#endif /* !_LIBC && !HAVE___ARGZ_NEXT */
|
#endif /* !_LIBC && !HAVE_ARGZ_NEXT */
|
||||||
|
|
||||||
|
|
||||||
/* Return number of bits set in X. */
|
/* Return number of bits set in X. */
|
||||||
#ifndef ARCH_POP
|
#ifndef ARCH_POP
|
||||||
static int pop PARAMS ((int x));
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
pop (x)
|
pop (int x)
|
||||||
int x;
|
|
||||||
{
|
{
|
||||||
/* We assume that no more than 16 bits are used. */
|
/* We assume that no more than 16 bits are used. */
|
||||||
x = ((x & ~0x5555) >> 1) + (x & 0x5555);
|
x = ((x & ~0x5555) >> 1) + (x & 0x5555);
|
||||||
@ -159,20 +148,12 @@ pop (x)
|
|||||||
|
|
||||||
|
|
||||||
struct loaded_l10nfile *
|
struct loaded_l10nfile *
|
||||||
_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
|
_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
|
||||||
territory, codeset, normalized_codeset, modifier,
|
const char *dirlist, size_t dirlist_len,
|
||||||
filename, do_allocate)
|
int mask, const char *language, const char *territory,
|
||||||
struct loaded_l10nfile **l10nfile_list;
|
const char *codeset, const char *normalized_codeset,
|
||||||
const char *dirlist;
|
const char *modifier,
|
||||||
size_t dirlist_len;
|
const char *filename, int do_allocate)
|
||||||
int mask;
|
|
||||||
const char *language;
|
|
||||||
const char *territory;
|
|
||||||
const char *codeset;
|
|
||||||
const char *normalized_codeset;
|
|
||||||
const char *modifier;
|
|
||||||
const char *filename;
|
|
||||||
int do_allocate;
|
|
||||||
{
|
{
|
||||||
char *abs_filename;
|
char *abs_filename;
|
||||||
struct loaded_l10nfile *last = NULL;
|
struct loaded_l10nfile *last = NULL;
|
||||||
@ -315,11 +296,9 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
|
|||||||
names. The return value is dynamically allocated and has to be
|
names. The return value is dynamically allocated and has to be
|
||||||
freed by the caller. */
|
freed by the caller. */
|
||||||
const char *
|
const char *
|
||||||
_nl_normalize_codeset (codeset, name_len)
|
_nl_normalize_codeset (const char *codeset, size_t name_len)
|
||||||
const char *codeset;
|
|
||||||
size_t name_len;
|
|
||||||
{
|
{
|
||||||
int len = 0;
|
size_t len = 0;
|
||||||
int only_digit = 1;
|
int only_digit = 1;
|
||||||
char *retval;
|
char *retval;
|
||||||
char *wp;
|
char *wp;
|
||||||
@ -343,9 +322,10 @@ _nl_normalize_codeset (codeset, name_len)
|
|||||||
|
|
||||||
if (retval != NULL)
|
if (retval != NULL)
|
||||||
{
|
{
|
||||||
wp = retval;
|
|
||||||
if (only_digit)
|
if (only_digit)
|
||||||
wp = stpcpy (wp, "iso");
|
wp = stpcpy (retval, "iso");
|
||||||
|
else
|
||||||
|
wp = retval;
|
||||||
|
|
||||||
for (cnt = 0; cnt < name_len; ++cnt)
|
for (cnt = 0; cnt < name_len; ++cnt)
|
||||||
if (__isalpha_l ((unsigned char) codeset[cnt], locale))
|
if (__isalpha_l ((unsigned char) codeset[cnt], locale))
|
||||||
@ -368,9 +348,7 @@ _nl_normalize_codeset (codeset, name_len)
|
|||||||
to be defined. */
|
to be defined. */
|
||||||
#if !_LIBC && !HAVE_STPCPY
|
#if !_LIBC && !HAVE_STPCPY
|
||||||
static char *
|
static char *
|
||||||
stpcpy (dest, src)
|
stpcpy (char *dest, const char *src)
|
||||||
char *dest;
|
|
||||||
const char *src;
|
|
||||||
{
|
{
|
||||||
while ((*dest++ = *src++) != '\0')
|
while ((*dest++ = *src++) != '\0')
|
||||||
/* Do nothing. */ ;
|
/* Do nothing. */ ;
|
||||||
|
110
intl/loadinfo.h
110
intl/loadinfo.h
@ -2,19 +2,18 @@
|
|||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifndef _LOADINFO_H
|
#ifndef _LOADINFO_H
|
||||||
#define _LOADINFO_H 1
|
#define _LOADINFO_H 1
|
||||||
@ -31,18 +30,29 @@
|
|||||||
in gettextP.h.
|
in gettextP.h.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PARAMS
|
|
||||||
# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
|
|
||||||
# define PARAMS(args) args
|
|
||||||
# else
|
|
||||||
# define PARAMS(args) ()
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef internal_function
|
#ifndef internal_function
|
||||||
# define internal_function
|
# define internal_function
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef LIBINTL_DLL_EXPORTED
|
||||||
|
# define LIBINTL_DLL_EXPORTED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Tell the compiler when a conditional or integer expression is
|
||||||
|
almost always true or almost always false. */
|
||||||
|
#ifndef HAVE_BUILTIN_EXPECT
|
||||||
|
# define __builtin_expect(expr, val) (expr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Separator in PATH like lists of pathnames. */
|
||||||
|
#if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
|
||||||
|
/* Win32, OS/2, DOS */
|
||||||
|
# define PATH_SEPARATOR ';'
|
||||||
|
#else
|
||||||
|
/* Unix */
|
||||||
|
# define PATH_SEPARATOR ':'
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Encoding of locale name parts. */
|
/* Encoding of locale name parts. */
|
||||||
#define XPG_NORM_CODESET 1
|
#define XPG_NORM_CODESET 1
|
||||||
#define XPG_CODESET 2
|
#define XPG_CODESET 2
|
||||||
@ -66,27 +76,55 @@ struct loaded_l10nfile
|
|||||||
names. Normalization allows the user to use any of the common
|
names. Normalization allows the user to use any of the common
|
||||||
names. The return value is dynamically allocated and has to be
|
names. The return value is dynamically allocated and has to be
|
||||||
freed by the caller. */
|
freed by the caller. */
|
||||||
extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
|
extern const char *_nl_normalize_codeset (const char *codeset,
|
||||||
size_t name_len));
|
size_t name_len);
|
||||||
|
|
||||||
|
/* Lookup a locale dependent file.
|
||||||
|
*L10NFILE_LIST denotes a pool of lookup results of locale dependent
|
||||||
|
files of the same kind, sorted in decreasing order of ->filename.
|
||||||
|
DIRLIST and DIRLIST_LEN are an argz list of directories in which to
|
||||||
|
look, containing at least one directory (i.e. DIRLIST_LEN > 0).
|
||||||
|
MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER
|
||||||
|
are the pieces of the locale name, as produced by _nl_explode_name().
|
||||||
|
FILENAME is the filename suffix.
|
||||||
|
The return value is the lookup result, either found in *L10NFILE_LIST,
|
||||||
|
or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL.
|
||||||
|
If the return value is non-NULL, it is added to *L10NFILE_LIST, and
|
||||||
|
its ->next field denotes the chaining inside *L10NFILE_LIST, and
|
||||||
|
furthermore its ->successor[] field contains a list of other lookup
|
||||||
|
results from which this lookup result inherits. */
|
||||||
extern struct loaded_l10nfile *
|
extern struct loaded_l10nfile *
|
||||||
_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
|
_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
|
||||||
const char *dirlist, size_t dirlist_len, int mask,
|
const char *dirlist, size_t dirlist_len, int mask,
|
||||||
const char *language, const char *territory,
|
const char *language, const char *territory,
|
||||||
const char *codeset,
|
const char *codeset, const char *normalized_codeset,
|
||||||
const char *normalized_codeset,
|
const char *modifier,
|
||||||
const char *modifier, const char *filename,
|
const char *filename, int do_allocate);
|
||||||
int do_allocate));
|
|
||||||
|
|
||||||
|
/* Lookup the real locale name for a locale alias NAME, or NULL if
|
||||||
|
NAME is not a locale alias (but possibly a real locale name).
|
||||||
|
The return value is statically allocated and must not be freed. */
|
||||||
|
/* Part of the libintl ABI only for the sake of the gettext.m4 macro. */
|
||||||
|
extern LIBINTL_DLL_EXPORTED const char *_nl_expand_alias (const char *name);
|
||||||
|
|
||||||
extern const char *_nl_expand_alias PARAMS ((const char *name));
|
/* Split a locale name NAME into its pieces: language, modifier,
|
||||||
|
territory, codeset.
|
||||||
/* normalized_codeset is dynamically allocated and has to be freed by
|
NAME gets destructively modified: NUL bytes are inserted here and
|
||||||
the caller. */
|
there. *LANGUAGE gets assigned NAME. Each of *MODIFIER, *TERRITORY,
|
||||||
extern int _nl_explode_name PARAMS ((char *name, const char **language,
|
*CODESET gets assigned either a pointer into the old NAME string, or
|
||||||
const char **modifier,
|
NULL. *NORMALIZED_CODESET gets assigned the expanded *CODESET, if it
|
||||||
const char **territory,
|
is different from *CODESET; this one is dynamically allocated and has
|
||||||
const char **codeset,
|
to be freed by the caller.
|
||||||
const char **normalized_codeset));
|
The return value is a bitmask, where each bit corresponds to one
|
||||||
|
filled-in value:
|
||||||
|
XPG_MODIFIER for *MODIFIER,
|
||||||
|
XPG_TERRITORY for *TERRITORY,
|
||||||
|
XPG_CODESET for *CODESET,
|
||||||
|
XPG_NORM_CODESET for *NORMALIZED_CODESET.
|
||||||
|
*/
|
||||||
|
extern int _nl_explode_name (char *name, const char **language,
|
||||||
|
const char **modifier, const char **territory,
|
||||||
|
const char **codeset,
|
||||||
|
const char **normalized_codeset);
|
||||||
|
|
||||||
#endif /* loadinfo.h */
|
#endif /* loadinfo.h */
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
/* Load needed message catalogs.
|
/* Load needed message catalogs.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* Tell glibc's <string.h> to provide a prototype for mempcpy().
|
/* Tell glibc's <string.h> to provide a prototype for mempcpy().
|
||||||
This must come before <config.h> because <config.h> may include
|
This must come before <config.h> because <config.h> may include
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
/* Handle aliases for locale names.
|
/* Handle aliases for locale names.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* Tell glibc's <string.h> to provide a prototype for mempcpy().
|
/* Tell glibc's <string.h> to provide a prototype for mempcpy().
|
||||||
This must come before <config.h> because <config.h> may include
|
This must come before <config.h> because <config.h> may include
|
||||||
@ -39,14 +37,19 @@
|
|||||||
# define alloca __builtin_alloca
|
# define alloca __builtin_alloca
|
||||||
# define HAVE_ALLOCA 1
|
# define HAVE_ALLOCA 1
|
||||||
#else
|
#else
|
||||||
# if defined HAVE_ALLOCA_H || defined _LIBC
|
# ifdef _MSC_VER
|
||||||
# include <alloca.h>
|
# include <malloc.h>
|
||||||
|
# define alloca _alloca
|
||||||
# else
|
# else
|
||||||
# ifdef _AIX
|
# if defined HAVE_ALLOCA_H || defined _LIBC
|
||||||
#pragma alloca
|
# include <alloca.h>
|
||||||
# else
|
# else
|
||||||
# ifndef alloca
|
# ifdef _AIX
|
||||||
|
#pragma alloca
|
||||||
|
# else
|
||||||
|
# ifndef alloca
|
||||||
char *alloca ();
|
char *alloca ();
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -57,6 +60,12 @@ char *alloca ();
|
|||||||
|
|
||||||
#include "gettextP.h"
|
#include "gettextP.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_RELOCATABLE
|
||||||
|
# include "relocatable.h"
|
||||||
|
#else
|
||||||
|
# define relocate(pathname) (pathname)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* @@ end of prolog @@ */
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
@ -70,11 +79,13 @@ char *alloca ();
|
|||||||
# endif
|
# endif
|
||||||
# define HAVE_MEMPCPY 1
|
# define HAVE_MEMPCPY 1
|
||||||
# define HAVE___FSETLOCKING 1
|
# define HAVE___FSETLOCKING 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* We need locking here since we can be called from different places. */
|
/* Handle multi-threaded applications. */
|
||||||
|
#ifdef _LIBC
|
||||||
# include <bits/libc-lock.h>
|
# include <bits/libc-lock.h>
|
||||||
|
#else
|
||||||
__libc_lock_define_initialized (static, lock);
|
# include "lock.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef internal_function
|
#ifndef internal_function
|
||||||
@ -99,16 +110,19 @@ __libc_lock_define_initialized (static, lock);
|
|||||||
# define freea(p) free (p)
|
# define freea(p) free (p)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED
|
#if defined _LIBC_REENTRANT || defined HAVE_DECL_FGETS_UNLOCKED
|
||||||
# undef fgets
|
# undef fgets
|
||||||
# define fgets(buf, len, s) fgets_unlocked (buf, len, s)
|
# define fgets(buf, len, s) fgets_unlocked (buf, len, s)
|
||||||
#endif
|
#endif
|
||||||
#if defined _LIBC_REENTRANT || defined HAVE_FEOF_UNLOCKED
|
#if defined _LIBC_REENTRANT || defined HAVE_DECL_FEOF_UNLOCKED
|
||||||
# undef feof
|
# undef feof
|
||||||
# define feof(s) feof_unlocked (s)
|
# define feof(s) feof_unlocked (s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
__libc_lock_define_initialized (static, lock)
|
||||||
|
|
||||||
|
|
||||||
struct alias_map
|
struct alias_map
|
||||||
{
|
{
|
||||||
const char *alias;
|
const char *alias;
|
||||||
@ -129,25 +143,25 @@ static size_t maxmap;
|
|||||||
|
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
|
static size_t read_alias_file (const char *fname, int fname_len)
|
||||||
internal_function;
|
internal_function;
|
||||||
static int extend_alias_table PARAMS ((void));
|
static int extend_alias_table (void);
|
||||||
static int alias_compare PARAMS ((const struct alias_map *map1,
|
static int alias_compare (const struct alias_map *map1,
|
||||||
const struct alias_map *map2));
|
const struct alias_map *map2);
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
_nl_expand_alias (name)
|
_nl_expand_alias (const char *name)
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
static const char *locale_alias_path = LOCALE_ALIAS_PATH;
|
static const char *locale_alias_path;
|
||||||
struct alias_map *retval;
|
struct alias_map *retval;
|
||||||
const char *result = NULL;
|
const char *result = NULL;
|
||||||
size_t added;
|
size_t added;
|
||||||
|
|
||||||
#ifdef _LIBC
|
|
||||||
__libc_lock_lock (lock);
|
__libc_lock_lock (lock);
|
||||||
#endif
|
|
||||||
|
if (locale_alias_path == NULL)
|
||||||
|
locale_alias_path = LOCALE_ALIAS_PATH;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -158,8 +172,8 @@ _nl_expand_alias (name)
|
|||||||
if (nmap > 0)
|
if (nmap > 0)
|
||||||
retval = (struct alias_map *) bsearch (&item, map, nmap,
|
retval = (struct alias_map *) bsearch (&item, map, nmap,
|
||||||
sizeof (struct alias_map),
|
sizeof (struct alias_map),
|
||||||
(int (*) PARAMS ((const void *,
|
(int (*) (const void *,
|
||||||
const void *))
|
const void *)
|
||||||
) alias_compare);
|
) alias_compare);
|
||||||
else
|
else
|
||||||
retval = NULL;
|
retval = NULL;
|
||||||
@ -177,11 +191,12 @@ _nl_expand_alias (name)
|
|||||||
{
|
{
|
||||||
const char *start;
|
const char *start;
|
||||||
|
|
||||||
while (locale_alias_path[0] == ':')
|
while (locale_alias_path[0] == PATH_SEPARATOR)
|
||||||
++locale_alias_path;
|
++locale_alias_path;
|
||||||
start = locale_alias_path;
|
start = locale_alias_path;
|
||||||
|
|
||||||
while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':')
|
while (locale_alias_path[0] != '\0'
|
||||||
|
&& locale_alias_path[0] != PATH_SEPARATOR)
|
||||||
++locale_alias_path;
|
++locale_alias_path;
|
||||||
|
|
||||||
if (start < locale_alias_path)
|
if (start < locale_alias_path)
|
||||||
@ -190,9 +205,7 @@ _nl_expand_alias (name)
|
|||||||
}
|
}
|
||||||
while (added != 0);
|
while (added != 0);
|
||||||
|
|
||||||
#ifdef _LIBC
|
|
||||||
__libc_lock_unlock (lock);
|
__libc_lock_unlock (lock);
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -200,9 +213,7 @@ _nl_expand_alias (name)
|
|||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
internal_function
|
internal_function
|
||||||
read_alias_file (fname, fname_len)
|
read_alias_file (const char *fname, int fname_len)
|
||||||
const char *fname;
|
|
||||||
int fname_len;
|
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *full_fname;
|
char *full_fname;
|
||||||
@ -218,9 +229,13 @@ read_alias_file (fname, fname_len)
|
|||||||
memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
|
memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
/* Note the file is opened with cancellation in the I/O functions
|
/* Note the file is opened with cancellation in the I/O functions
|
||||||
disabled. */
|
disabled. */
|
||||||
fp = fopen (full_fname, "rce");
|
fp = fopen (relocate (full_fname), "rce");
|
||||||
|
#else
|
||||||
|
fp = fopen (relocate (full_fname), "r");
|
||||||
|
#endif
|
||||||
freea (full_fname);
|
freea (full_fname);
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@ -274,9 +289,6 @@ read_alias_file (fname, fname_len)
|
|||||||
|
|
||||||
if (cp[0] != '\0')
|
if (cp[0] != '\0')
|
||||||
{
|
{
|
||||||
size_t alias_len;
|
|
||||||
size_t value_len;
|
|
||||||
|
|
||||||
value = cp++;
|
value = cp++;
|
||||||
while (cp[0] != '\0' && !isspace ((unsigned char) cp[0]))
|
while (cp[0] != '\0' && !isspace ((unsigned char) cp[0]))
|
||||||
++cp;
|
++cp;
|
||||||
@ -292,48 +304,62 @@ read_alias_file (fname, fname_len)
|
|||||||
else if (cp[0] != '\0')
|
else if (cp[0] != '\0')
|
||||||
*cp++ = '\0';
|
*cp++ = '\0';
|
||||||
|
|
||||||
if (nmap >= maxmap)
|
#ifdef IN_LIBGLOCALE
|
||||||
if (__glibc_unlikely (extend_alias_table ()))
|
/* glibc's locale.alias contains entries for ja_JP and ko_KR
|
||||||
goto out;
|
that make it impossible to use a Japanese or Korean UTF-8
|
||||||
|
locale under the name "ja_JP" or "ko_KR". Ignore these
|
||||||
alias_len = strlen (alias) + 1;
|
entries. */
|
||||||
value_len = strlen (value) + 1;
|
if (strchr (alias, '_') == NULL)
|
||||||
|
#endif
|
||||||
if (string_space_act + alias_len + value_len > string_space_max)
|
|
||||||
{
|
{
|
||||||
/* Increase size of memory pool. */
|
size_t alias_len;
|
||||||
size_t new_size = (string_space_max
|
size_t value_len;
|
||||||
+ (alias_len + value_len > 1024
|
|
||||||
? alias_len + value_len : 1024));
|
|
||||||
char *new_pool = (char *) realloc (string_space, new_size);
|
|
||||||
if (new_pool == NULL)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (__glibc_unlikely (string_space != new_pool))
|
if (nmap >= maxmap)
|
||||||
|
if (__builtin_expect (extend_alias_table (), 0))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
alias_len = strlen (alias) + 1;
|
||||||
|
value_len = strlen (value) + 1;
|
||||||
|
|
||||||
|
if (string_space_act + alias_len + value_len > string_space_max)
|
||||||
{
|
{
|
||||||
size_t i;
|
/* Increase size of memory pool. */
|
||||||
|
size_t new_size = (string_space_max
|
||||||
|
+ (alias_len + value_len > 1024
|
||||||
|
? alias_len + value_len : 1024));
|
||||||
|
char *new_pool = (char *) realloc (string_space, new_size);
|
||||||
|
if (new_pool == NULL)
|
||||||
|
goto out;
|
||||||
|
|
||||||
for (i = 0; i < nmap; i++)
|
if (__builtin_expect (string_space != new_pool, 0))
|
||||||
{
|
{
|
||||||
map[i].alias += new_pool - string_space;
|
size_t i;
|
||||||
map[i].value += new_pool - string_space;
|
|
||||||
|
for (i = 0; i < nmap; i++)
|
||||||
|
{
|
||||||
|
map[i].alias += new_pool - string_space;
|
||||||
|
map[i].value += new_pool - string_space;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string_space = new_pool;
|
||||||
|
string_space_max = new_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
string_space = new_pool;
|
map[nmap].alias =
|
||||||
string_space_max = new_size;
|
(const char *) memcpy (&string_space[string_space_act],
|
||||||
|
alias, alias_len);
|
||||||
|
string_space_act += alias_len;
|
||||||
|
|
||||||
|
map[nmap].value =
|
||||||
|
(const char *) memcpy (&string_space[string_space_act],
|
||||||
|
value, value_len);
|
||||||
|
string_space_act += value_len;
|
||||||
|
|
||||||
|
++nmap;
|
||||||
|
++added;
|
||||||
}
|
}
|
||||||
|
|
||||||
map[nmap].alias = memcpy (&string_space[string_space_act],
|
|
||||||
alias, alias_len);
|
|
||||||
string_space_act += alias_len;
|
|
||||||
|
|
||||||
map[nmap].value = memcpy (&string_space[string_space_act],
|
|
||||||
value, value_len);
|
|
||||||
string_space_act += value_len;
|
|
||||||
|
|
||||||
++nmap;
|
|
||||||
++added;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,14 +374,14 @@ read_alias_file (fname, fname_len)
|
|||||||
while (strchr (buf, '\n') == NULL);
|
while (strchr (buf, '\n') == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
/* Should we test for ferror()? I think we have to silently ignore
|
/* Should we test for ferror()? I think we have to silently ignore
|
||||||
errors. --drepper */
|
errors. --drepper */
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
if (added > 0)
|
if (added > 0)
|
||||||
qsort (map, nmap, sizeof (struct alias_map),
|
qsort (map, nmap, sizeof (struct alias_map),
|
||||||
(int (*) PARAMS ((const void *, const void *))) alias_compare);
|
(int (*) (const void *, const void *)) alias_compare);
|
||||||
|
|
||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
@ -381,9 +407,7 @@ extend_alias_table (void)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
alias_compare (map1, map2)
|
alias_compare (const struct alias_map *map1, const struct alias_map *map2)
|
||||||
const struct alias_map *map1;
|
|
||||||
const struct alias_map *map2;
|
|
||||||
{
|
{
|
||||||
#if defined _LIBC || defined HAVE_STRCASECMP
|
#if defined _LIBC || defined HAVE_STRCASECMP
|
||||||
return strcasecmp (map1->alias, map2->alias);
|
return strcasecmp (map1->alias, map2->alias);
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
/* Implementation of ngettext(3) function.
|
/* Implementation of ngettext(3) function.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -54,10 +52,7 @@
|
|||||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||||
text). */
|
text). */
|
||||||
char *
|
char *
|
||||||
NGETTEXT (msgid1, msgid2, n)
|
NGETTEXT (const char *msgid1, const char *msgid2, unsigned long int n)
|
||||||
const char *msgid1;
|
|
||||||
const char *msgid2;
|
|
||||||
unsigned long int n;
|
|
||||||
{
|
{
|
||||||
return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES);
|
return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES);
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
/* Expression parsing for plural form selection.
|
/* Expression parsing for plural form selection.
|
||||||
Copyright (C) 2000-2014 Free Software Foundation, Inc.
|
Copyright (C) 2000-2014 Free Software Foundation, Inc.
|
||||||
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -27,7 +25,8 @@
|
|||||||
|
|
||||||
#include "plural-exp.h"
|
#include "plural-exp.h"
|
||||||
|
|
||||||
#if (defined __GNUC__ && !defined __APPLE_CC__) \
|
#if (defined __GNUC__ && !(defined __APPLE_CC_ && __APPLE_CC__ > 1) && \
|
||||||
|
!defined __cplusplus) \
|
||||||
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
|
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
|
||||||
|
|
||||||
/* These structs are the constant expression for the germanic plural
|
/* These structs are the constant expression for the germanic plural
|
||||||
@ -96,10 +95,9 @@ init_germanic_plural (void)
|
|||||||
|
|
||||||
void
|
void
|
||||||
internal_function
|
internal_function
|
||||||
EXTRACT_PLURAL_EXPRESSION (nullentry, pluralp, npluralsp)
|
EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
|
||||||
const char *nullentry;
|
const struct expression **pluralp,
|
||||||
const struct expression **pluralp;
|
unsigned long int *npluralsp)
|
||||||
unsigned long int *npluralsp;
|
|
||||||
{
|
{
|
||||||
if (nullentry != NULL)
|
if (nullentry != NULL)
|
||||||
{
|
{
|
||||||
|
@ -1,33 +1,23 @@
|
|||||||
/* Expression parsing and evaluation for plural form selection.
|
/* Expression parsing and evaluation for plural form selection.
|
||||||
Copyright (C) 2000-2014 Free Software Foundation, Inc.
|
Copyright (C) 2000-2014 Free Software Foundation, Inc.
|
||||||
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifndef _PLURAL_EXP_H
|
#ifndef _PLURAL_EXP_H
|
||||||
#define _PLURAL_EXP_H
|
#define _PLURAL_EXP_H
|
||||||
|
|
||||||
#ifndef PARAMS
|
|
||||||
# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
|
|
||||||
# define PARAMS(args) args
|
|
||||||
# else
|
|
||||||
# define PARAMS(args) ()
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef internal_function
|
#ifndef internal_function
|
||||||
# define internal_function
|
# define internal_function
|
||||||
#endif
|
#endif
|
||||||
@ -36,36 +26,42 @@
|
|||||||
# define attribute_hidden
|
# define attribute_hidden
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
enum expression_operator
|
||||||
|
{
|
||||||
|
/* Without arguments: */
|
||||||
|
var, /* The variable "n". */
|
||||||
|
num, /* Decimal number. */
|
||||||
|
/* Unary operators: */
|
||||||
|
lnot, /* Logical NOT. */
|
||||||
|
/* Binary operators: */
|
||||||
|
mult, /* Multiplication. */
|
||||||
|
divide, /* Division. */
|
||||||
|
module, /* Modulo operation. */
|
||||||
|
plus, /* Addition. */
|
||||||
|
minus, /* Subtraction. */
|
||||||
|
less_than, /* Comparison. */
|
||||||
|
greater_than, /* Comparison. */
|
||||||
|
less_or_equal, /* Comparison. */
|
||||||
|
greater_or_equal, /* Comparison. */
|
||||||
|
equal, /* Comparison for equality. */
|
||||||
|
not_equal, /* Comparison for inequality. */
|
||||||
|
land, /* Logical AND. */
|
||||||
|
lor, /* Logical OR. */
|
||||||
|
/* Ternary operators: */
|
||||||
|
qmop /* Question mark operator. */
|
||||||
|
};
|
||||||
|
|
||||||
/* This is the representation of the expressions to determine the
|
/* This is the representation of the expressions to determine the
|
||||||
plural form. */
|
plural form. */
|
||||||
struct expression
|
struct expression
|
||||||
{
|
{
|
||||||
int nargs; /* Number of arguments. */
|
int nargs; /* Number of arguments. */
|
||||||
enum operator
|
enum expression_operator operation;
|
||||||
{
|
|
||||||
/* Without arguments: */
|
|
||||||
var, /* The variable "n". */
|
|
||||||
num, /* Decimal number. */
|
|
||||||
/* Unary operators: */
|
|
||||||
lnot, /* Logical NOT. */
|
|
||||||
/* Binary operators: */
|
|
||||||
mult, /* Multiplication. */
|
|
||||||
divide, /* Division. */
|
|
||||||
module, /* Modulo operation. */
|
|
||||||
plus, /* Addition. */
|
|
||||||
minus, /* Subtraction. */
|
|
||||||
less_than, /* Comparison. */
|
|
||||||
greater_than, /* Comparison. */
|
|
||||||
less_or_equal, /* Comparison. */
|
|
||||||
greater_or_equal, /* Comparison. */
|
|
||||||
equal, /* Comparison for equality. */
|
|
||||||
not_equal, /* Comparison for inequality. */
|
|
||||||
land, /* Logical AND. */
|
|
||||||
lor, /* Logical OR. */
|
|
||||||
/* Ternary operators: */
|
|
||||||
qmop /* Question mark operator. */
|
|
||||||
} operation;
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
unsigned long int num; /* Number value for `num'. */
|
unsigned long int num; /* Number value for `num'. */
|
||||||
@ -109,17 +105,23 @@ struct parse_args
|
|||||||
# define EXTRACT_PLURAL_EXPRESSION extract_plural_expression
|
# define EXTRACT_PLURAL_EXPRESSION extract_plural_expression
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void FREE_EXPRESSION PARAMS ((struct expression *exp))
|
extern void FREE_EXPRESSION (struct expression *exp)
|
||||||
internal_function;
|
internal_function;
|
||||||
extern int PLURAL_PARSE PARAMS ((void *arg));
|
extern int PLURAL_PARSE (struct parse_args *arg);
|
||||||
extern const struct expression GERMANIC_PLURAL attribute_hidden;
|
extern const struct expression GERMANIC_PLURAL attribute_hidden;
|
||||||
extern void EXTRACT_PLURAL_EXPRESSION PARAMS
|
extern void EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
|
||||||
((const char *nullentry, const struct expression **pluralp,
|
const struct expression **pluralp,
|
||||||
unsigned long int *npluralsp)) internal_function;
|
unsigned long int *npluralsp)
|
||||||
|
internal_function;
|
||||||
|
|
||||||
#if !defined (_LIBC) && !defined (IN_LIBINTL)
|
#if !defined (_LIBC) && !defined (IN_LIBINTL) && !defined (IN_LIBGLOCALE)
|
||||||
extern unsigned long int plural_eval PARAMS ((const struct expression *pexp,
|
extern unsigned long int plural_eval (const struct expression *pexp,
|
||||||
unsigned long int n));
|
unsigned long int n);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _PLURAL_EXP_H */
|
#endif /* _PLURAL_EXP_H */
|
||||||
|
190
intl/plural.c
190
intl/plural.c
@ -50,7 +50,7 @@
|
|||||||
#define YYSKELETON_NAME "yacc.c"
|
#define YYSKELETON_NAME "yacc.c"
|
||||||
|
|
||||||
/* Pure parsers. */
|
/* Pure parsers. */
|
||||||
#define YYPURE 1
|
#define YYPURE 2
|
||||||
|
|
||||||
/* Push parsers. */
|
/* Push parsers. */
|
||||||
#define YYPUSH 0
|
#define YYPUSH 0
|
||||||
@ -74,30 +74,30 @@
|
|||||||
|
|
||||||
/* Expression parsing for plural form selection.
|
/* Expression parsing for plural form selection.
|
||||||
Copyright (C) 2000-2014 Free Software Foundation, Inc.
|
Copyright (C) 2000-2014 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* The bison generated parser uses alloca. AIX 3 forces us to put this
|
/* For bison < 2.0, the bison generated parser uses alloca. AIX 3 forces us
|
||||||
declaration at the beginning of the file. The declaration in bison's
|
to put this declaration at the beginning of the file. The declaration in
|
||||||
skeleton file comes too late. This must come before <config.h>
|
bison's skeleton file comes too late. This must come before <config.h>
|
||||||
because <config.h> may include arbitrary system headers. */
|
because <config.h> may include arbitrary system headers.
|
||||||
|
This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0. */
|
||||||
#if defined _AIX && !defined __GNUC__
|
#if defined _AIX && !defined __GNUC__
|
||||||
#pragma alloca
|
#pragma alloca
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
@ -113,11 +113,9 @@
|
|||||||
# define __gettextparse PLURAL_PARSE
|
# define __gettextparse PLURAL_PARSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
|
|
||||||
#define YYPARSE_PARAM arg
|
|
||||||
|
|
||||||
/* Line 371 of yacc.c */
|
/* Line 371 of yacc.c */
|
||||||
#line 121 "plural.c"
|
#line 119 "plural.c"
|
||||||
|
|
||||||
# ifndef YY_NULL
|
# ifndef YY_NULL
|
||||||
# if defined __cplusplus && 201103L <= __cplusplus
|
# if defined __cplusplus && 201103L <= __cplusplus
|
||||||
@ -173,12 +171,12 @@ typedef union YYSTYPE
|
|||||||
#line 49 "plural.y"
|
#line 49 "plural.y"
|
||||||
|
|
||||||
unsigned long int num;
|
unsigned long int num;
|
||||||
enum operator op;
|
enum expression_operator op;
|
||||||
struct expression *exp;
|
struct expression *exp;
|
||||||
|
|
||||||
|
|
||||||
/* Line 387 of yacc.c */
|
/* Line 387 of yacc.c */
|
||||||
#line 182 "plural.c"
|
#line 180 "plural.c"
|
||||||
} YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
@ -194,7 +192,7 @@ int __gettextparse ();
|
|||||||
#endif
|
#endif
|
||||||
#else /* ! YYPARSE_PARAM */
|
#else /* ! YYPARSE_PARAM */
|
||||||
#if defined __STDC__ || defined __cplusplus
|
#if defined __STDC__ || defined __cplusplus
|
||||||
int __gettextparse (void);
|
int __gettextparse (struct parse_args *arg);
|
||||||
#else
|
#else
|
||||||
int __gettextparse ();
|
int __gettextparse ();
|
||||||
#endif
|
#endif
|
||||||
@ -207,28 +205,14 @@ int __gettextparse ();
|
|||||||
#line 55 "plural.y"
|
#line 55 "plural.y"
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
static struct expression *new_exp PARAMS ((int nargs, enum operator op,
|
static int yylex (YYSTYPE *lval, struct parse_args *arg);
|
||||||
struct expression * const *args));
|
static void yyerror (struct parse_args *arg, const char *str);
|
||||||
static inline struct expression *new_exp_0 PARAMS ((enum operator op));
|
|
||||||
static inline struct expression *new_exp_1 PARAMS ((enum operator op,
|
|
||||||
struct expression *right));
|
|
||||||
static struct expression *new_exp_2 PARAMS ((enum operator op,
|
|
||||||
struct expression *left,
|
|
||||||
struct expression *right));
|
|
||||||
static inline struct expression *new_exp_3 PARAMS ((enum operator op,
|
|
||||||
struct expression *bexp,
|
|
||||||
struct expression *tbranch,
|
|
||||||
struct expression *fbranch));
|
|
||||||
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
|
|
||||||
static void yyerror PARAMS ((const char *str));
|
|
||||||
|
|
||||||
/* Allocation of expressions. */
|
/* Allocation of expressions. */
|
||||||
|
|
||||||
static struct expression *
|
static struct expression *
|
||||||
new_exp (nargs, op, args)
|
new_exp (int nargs, enum expression_operator op,
|
||||||
int nargs;
|
struct expression * const *args)
|
||||||
enum operator op;
|
|
||||||
struct expression * const *args;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct expression *newp;
|
struct expression *newp;
|
||||||
@ -257,16 +241,13 @@ new_exp (nargs, op, args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline struct expression *
|
static inline struct expression *
|
||||||
new_exp_0 (op)
|
new_exp_0 (enum expression_operator op)
|
||||||
enum operator op;
|
|
||||||
{
|
{
|
||||||
return new_exp (0, op, NULL);
|
return new_exp (0, op, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct expression *
|
static inline struct expression *
|
||||||
new_exp_1 (op, right)
|
new_exp_1 (enum expression_operator op, struct expression *right)
|
||||||
enum operator op;
|
|
||||||
struct expression *right;
|
|
||||||
{
|
{
|
||||||
struct expression *args[1];
|
struct expression *args[1];
|
||||||
|
|
||||||
@ -275,10 +256,8 @@ new_exp_1 (op, right)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct expression *
|
static struct expression *
|
||||||
new_exp_2 (op, left, right)
|
new_exp_2 (enum expression_operator op, struct expression *left,
|
||||||
enum operator op;
|
struct expression *right)
|
||||||
struct expression *left;
|
|
||||||
struct expression *right;
|
|
||||||
{
|
{
|
||||||
struct expression *args[2];
|
struct expression *args[2];
|
||||||
|
|
||||||
@ -288,11 +267,8 @@ new_exp_2 (op, left, right)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline struct expression *
|
static inline struct expression *
|
||||||
new_exp_3 (op, bexp, tbranch, fbranch)
|
new_exp_3 (enum expression_operator op, struct expression *bexp,
|
||||||
enum operator op;
|
struct expression *tbranch, struct expression *fbranch)
|
||||||
struct expression *bexp;
|
|
||||||
struct expression *tbranch;
|
|
||||||
struct expression *fbranch;
|
|
||||||
{
|
{
|
||||||
struct expression *args[3];
|
struct expression *args[3];
|
||||||
|
|
||||||
@ -304,7 +280,7 @@ new_exp_3 (op, bexp, tbranch, fbranch)
|
|||||||
|
|
||||||
|
|
||||||
/* Line 390 of yacc.c */
|
/* Line 390 of yacc.c */
|
||||||
#line 308 "plural.c"
|
#line 284 "plural.c"
|
||||||
|
|
||||||
#ifdef short
|
#ifdef short
|
||||||
# undef short
|
# undef short
|
||||||
@ -596,8 +572,8 @@ static const yytype_int8 yyrhs[] =
|
|||||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||||
static const yytype_uint8 yyrline[] =
|
static const yytype_uint8 yyrline[] =
|
||||||
{
|
{
|
||||||
0, 174, 174, 182, 186, 190, 194, 198, 202, 206,
|
0, 152, 152, 160, 164, 168, 172, 176, 180, 184,
|
||||||
210, 214, 218, 223
|
188, 192, 196, 201
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -746,7 +722,7 @@ do \
|
|||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
yyerror (YY_("syntax error: cannot back up")); \
|
yyerror (arg, YY_("syntax error: cannot back up")); \
|
||||||
YYERROR; \
|
YYERROR; \
|
||||||
} \
|
} \
|
||||||
while (YYID (0))
|
while (YYID (0))
|
||||||
@ -766,7 +742,7 @@ while (YYID (0))
|
|||||||
#ifdef YYLEX_PARAM
|
#ifdef YYLEX_PARAM
|
||||||
# define YYLEX yylex (&yylval, YYLEX_PARAM)
|
# define YYLEX yylex (&yylval, YYLEX_PARAM)
|
||||||
#else
|
#else
|
||||||
# define YYLEX yylex (&yylval)
|
# define YYLEX yylex (&yylval, arg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable debugging if requested. */
|
/* Enable debugging if requested. */
|
||||||
@ -789,7 +765,7 @@ do { \
|
|||||||
{ \
|
{ \
|
||||||
YYFPRINTF (stderr, "%s ", Title); \
|
YYFPRINTF (stderr, "%s ", Title); \
|
||||||
yy_symbol_print (stderr, \
|
yy_symbol_print (stderr, \
|
||||||
Type, Value); \
|
Type, Value, arg); \
|
||||||
YYFPRINTF (stderr, "\n"); \
|
YYFPRINTF (stderr, "\n"); \
|
||||||
} \
|
} \
|
||||||
} while (YYID (0))
|
} while (YYID (0))
|
||||||
@ -803,19 +779,21 @@ do { \
|
|||||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||||
|| defined __cplusplus || defined _MSC_VER)
|
|| defined __cplusplus || defined _MSC_VER)
|
||||||
static void
|
static void
|
||||||
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
|
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct parse_args *arg)
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
|
yy_symbol_value_print (yyoutput, yytype, yyvaluep, arg)
|
||||||
FILE *yyoutput;
|
FILE *yyoutput;
|
||||||
int yytype;
|
int yytype;
|
||||||
YYSTYPE const * const yyvaluep;
|
YYSTYPE const * const yyvaluep;
|
||||||
|
struct parse_args *arg;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
FILE *yyo = yyoutput;
|
FILE *yyo = yyoutput;
|
||||||
YYUSE (yyo);
|
YYUSE (yyo);
|
||||||
if (!yyvaluep)
|
if (!yyvaluep)
|
||||||
return;
|
return;
|
||||||
|
YYUSE (arg);
|
||||||
# ifdef YYPRINT
|
# ifdef YYPRINT
|
||||||
if (yytype < YYNTOKENS)
|
if (yytype < YYNTOKENS)
|
||||||
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
||||||
@ -837,13 +815,14 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
|
|||||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||||
|| defined __cplusplus || defined _MSC_VER)
|
|| defined __cplusplus || defined _MSC_VER)
|
||||||
static void
|
static void
|
||||||
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
|
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct parse_args *arg)
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
yy_symbol_print (yyoutput, yytype, yyvaluep)
|
yy_symbol_print (yyoutput, yytype, yyvaluep, arg)
|
||||||
FILE *yyoutput;
|
FILE *yyoutput;
|
||||||
int yytype;
|
int yytype;
|
||||||
YYSTYPE const * const yyvaluep;
|
YYSTYPE const * const yyvaluep;
|
||||||
|
struct parse_args *arg;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (yytype < YYNTOKENS)
|
if (yytype < YYNTOKENS)
|
||||||
@ -851,7 +830,7 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
|
|||||||
else
|
else
|
||||||
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
|
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
|
||||||
|
|
||||||
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
|
yy_symbol_value_print (yyoutput, yytype, yyvaluep, arg);
|
||||||
YYFPRINTF (yyoutput, ")");
|
YYFPRINTF (yyoutput, ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -894,12 +873,13 @@ do { \
|
|||||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||||
|| defined __cplusplus || defined _MSC_VER)
|
|| defined __cplusplus || defined _MSC_VER)
|
||||||
static void
|
static void
|
||||||
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
|
yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct parse_args *arg)
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
yy_reduce_print (yyvsp, yyrule)
|
yy_reduce_print (yyvsp, yyrule, arg)
|
||||||
YYSTYPE *yyvsp;
|
YYSTYPE *yyvsp;
|
||||||
int yyrule;
|
int yyrule;
|
||||||
|
struct parse_args *arg;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int yynrhs = yyr2[yyrule];
|
int yynrhs = yyr2[yyrule];
|
||||||
@ -913,7 +893,7 @@ yy_reduce_print (yyvsp, yyrule)
|
|||||||
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
||||||
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
||||||
&(yyvsp[(yyi + 1) - (yynrhs)])
|
&(yyvsp[(yyi + 1) - (yynrhs)])
|
||||||
);
|
, arg);
|
||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -921,7 +901,7 @@ yy_reduce_print (yyvsp, yyrule)
|
|||||||
# define YY_REDUCE_PRINT(Rule) \
|
# define YY_REDUCE_PRINT(Rule) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
yy_reduce_print (yyvsp, Rule); \
|
yy_reduce_print (yyvsp, Rule, arg); \
|
||||||
} while (YYID (0))
|
} while (YYID (0))
|
||||||
|
|
||||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||||
@ -1201,16 +1181,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||||
|| defined __cplusplus || defined _MSC_VER)
|
|| defined __cplusplus || defined _MSC_VER)
|
||||||
static void
|
static void
|
||||||
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
|
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct parse_args *arg)
|
||||||
#else
|
#else
|
||||||
static void
|
static void
|
||||||
yydestruct (yymsg, yytype, yyvaluep)
|
yydestruct (yymsg, yytype, yyvaluep, arg)
|
||||||
const char *yymsg;
|
const char *yymsg;
|
||||||
int yytype;
|
int yytype;
|
||||||
YYSTYPE *yyvaluep;
|
YYSTYPE *yyvaluep;
|
||||||
|
struct parse_args *arg;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
YYUSE (yyvaluep);
|
YYUSE (yyvaluep);
|
||||||
|
YYUSE (arg);
|
||||||
|
|
||||||
if (!yymsg)
|
if (!yymsg)
|
||||||
yymsg = "Deleting";
|
yymsg = "Deleting";
|
||||||
@ -1245,11 +1227,11 @@ yyparse (YYPARSE_PARAM)
|
|||||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||||
|| defined __cplusplus || defined _MSC_VER)
|
|| defined __cplusplus || defined _MSC_VER)
|
||||||
int
|
int
|
||||||
yyparse (void)
|
yyparse (struct parse_args *arg)
|
||||||
#else
|
#else
|
||||||
int
|
int
|
||||||
yyparse ()
|
yyparse (arg)
|
||||||
|
struct parse_args *arg;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -1519,17 +1501,17 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 175 "plural.y"
|
#line 153 "plural.y"
|
||||||
{
|
{
|
||||||
if ((yyvsp[(1) - (1)].exp) == NULL)
|
if ((yyvsp[(1) - (1)].exp) == NULL)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
((struct parse_args *) arg)->res = (yyvsp[(1) - (1)].exp);
|
arg->res = (yyvsp[(1) - (1)].exp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 183 "plural.y"
|
#line 161 "plural.y"
|
||||||
{
|
{
|
||||||
(yyval.exp) = new_exp_3 (qmop, (yyvsp[(1) - (5)].exp), (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].exp));
|
(yyval.exp) = new_exp_3 (qmop, (yyvsp[(1) - (5)].exp), (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].exp));
|
||||||
}
|
}
|
||||||
@ -1537,7 +1519,7 @@ yyreduce:
|
|||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 187 "plural.y"
|
#line 165 "plural.y"
|
||||||
{
|
{
|
||||||
(yyval.exp) = new_exp_2 (lor, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
(yyval.exp) = new_exp_2 (lor, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
||||||
}
|
}
|
||||||
@ -1545,7 +1527,7 @@ yyreduce:
|
|||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 191 "plural.y"
|
#line 169 "plural.y"
|
||||||
{
|
{
|
||||||
(yyval.exp) = new_exp_2 (land, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
(yyval.exp) = new_exp_2 (land, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
||||||
}
|
}
|
||||||
@ -1553,7 +1535,7 @@ yyreduce:
|
|||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 195 "plural.y"
|
#line 173 "plural.y"
|
||||||
{
|
{
|
||||||
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
||||||
}
|
}
|
||||||
@ -1561,7 +1543,7 @@ yyreduce:
|
|||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 199 "plural.y"
|
#line 177 "plural.y"
|
||||||
{
|
{
|
||||||
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
||||||
}
|
}
|
||||||
@ -1569,7 +1551,7 @@ yyreduce:
|
|||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 203 "plural.y"
|
#line 181 "plural.y"
|
||||||
{
|
{
|
||||||
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
||||||
}
|
}
|
||||||
@ -1577,7 +1559,7 @@ yyreduce:
|
|||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 207 "plural.y"
|
#line 185 "plural.y"
|
||||||
{
|
{
|
||||||
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
|
||||||
}
|
}
|
||||||
@ -1585,7 +1567,7 @@ yyreduce:
|
|||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 211 "plural.y"
|
#line 189 "plural.y"
|
||||||
{
|
{
|
||||||
(yyval.exp) = new_exp_1 (lnot, (yyvsp[(2) - (2)].exp));
|
(yyval.exp) = new_exp_1 (lnot, (yyvsp[(2) - (2)].exp));
|
||||||
}
|
}
|
||||||
@ -1593,7 +1575,7 @@ yyreduce:
|
|||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 215 "plural.y"
|
#line 193 "plural.y"
|
||||||
{
|
{
|
||||||
(yyval.exp) = new_exp_0 (var);
|
(yyval.exp) = new_exp_0 (var);
|
||||||
}
|
}
|
||||||
@ -1601,7 +1583,7 @@ yyreduce:
|
|||||||
|
|
||||||
case 12:
|
case 12:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 219 "plural.y"
|
#line 197 "plural.y"
|
||||||
{
|
{
|
||||||
if (((yyval.exp) = new_exp_0 (num)) != NULL)
|
if (((yyval.exp) = new_exp_0 (num)) != NULL)
|
||||||
(yyval.exp)->val.num = (yyvsp[(1) - (1)].num);
|
(yyval.exp)->val.num = (yyvsp[(1) - (1)].num);
|
||||||
@ -1610,7 +1592,7 @@ yyreduce:
|
|||||||
|
|
||||||
case 13:
|
case 13:
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 224 "plural.y"
|
#line 202 "plural.y"
|
||||||
{
|
{
|
||||||
(yyval.exp) = (yyvsp[(2) - (3)].exp);
|
(yyval.exp) = (yyvsp[(2) - (3)].exp);
|
||||||
}
|
}
|
||||||
@ -1618,7 +1600,7 @@ yyreduce:
|
|||||||
|
|
||||||
|
|
||||||
/* Line 1792 of yacc.c */
|
/* Line 1792 of yacc.c */
|
||||||
#line 1622 "plural.c"
|
#line 1604 "plural.c"
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
/* User semantic actions sometimes alter yychar, and that requires
|
/* User semantic actions sometimes alter yychar, and that requires
|
||||||
@ -1668,7 +1650,7 @@ yyerrlab:
|
|||||||
{
|
{
|
||||||
++yynerrs;
|
++yynerrs;
|
||||||
#if ! YYERROR_VERBOSE
|
#if ! YYERROR_VERBOSE
|
||||||
yyerror (YY_("syntax error"));
|
yyerror (arg, YY_("syntax error"));
|
||||||
#else
|
#else
|
||||||
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
|
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
|
||||||
yyssp, yytoken)
|
yyssp, yytoken)
|
||||||
@ -1695,7 +1677,7 @@ yyerrlab:
|
|||||||
yymsgp = yymsg;
|
yymsgp = yymsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
yyerror (yymsgp);
|
yyerror (arg, yymsgp);
|
||||||
if (yysyntax_error_status == 2)
|
if (yysyntax_error_status == 2)
|
||||||
goto yyexhaustedlab;
|
goto yyexhaustedlab;
|
||||||
}
|
}
|
||||||
@ -1719,7 +1701,7 @@ yyerrlab:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
yydestruct ("Error: discarding",
|
yydestruct ("Error: discarding",
|
||||||
yytoken, &yylval);
|
yytoken, &yylval, arg);
|
||||||
yychar = YYEMPTY;
|
yychar = YYEMPTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1775,7 +1757,7 @@ yyerrlab1:
|
|||||||
|
|
||||||
|
|
||||||
yydestruct ("Error: popping",
|
yydestruct ("Error: popping",
|
||||||
yystos[yystate], yyvsp);
|
yystos[yystate], yyvsp, arg);
|
||||||
YYPOPSTACK (1);
|
YYPOPSTACK (1);
|
||||||
yystate = *yyssp;
|
yystate = *yyssp;
|
||||||
YY_STACK_PRINT (yyss, yyssp);
|
YY_STACK_PRINT (yyss, yyssp);
|
||||||
@ -1812,7 +1794,7 @@ yyabortlab:
|
|||||||
| yyexhaustedlab -- memory exhaustion comes here. |
|
| yyexhaustedlab -- memory exhaustion comes here. |
|
||||||
`-------------------------------------------------*/
|
`-------------------------------------------------*/
|
||||||
yyexhaustedlab:
|
yyexhaustedlab:
|
||||||
yyerror (YY_("memory exhausted"));
|
yyerror (arg, YY_("memory exhausted"));
|
||||||
yyresult = 2;
|
yyresult = 2;
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
#endif
|
#endif
|
||||||
@ -1824,7 +1806,7 @@ yyreturn:
|
|||||||
user semantic actions for why this is necessary. */
|
user semantic actions for why this is necessary. */
|
||||||
yytoken = YYTRANSLATE (yychar);
|
yytoken = YYTRANSLATE (yychar);
|
||||||
yydestruct ("Cleanup: discarding lookahead",
|
yydestruct ("Cleanup: discarding lookahead",
|
||||||
yytoken, &yylval);
|
yytoken, &yylval, arg);
|
||||||
}
|
}
|
||||||
/* Do not reclaim the symbols of the rule which action triggered
|
/* Do not reclaim the symbols of the rule which action triggered
|
||||||
this YYABORT or YYACCEPT. */
|
this YYABORT or YYACCEPT. */
|
||||||
@ -1833,7 +1815,7 @@ yyreturn:
|
|||||||
while (yyssp != yyss)
|
while (yyssp != yyss)
|
||||||
{
|
{
|
||||||
yydestruct ("Cleanup: popping",
|
yydestruct ("Cleanup: popping",
|
||||||
yystos[*yyssp], yyvsp);
|
yystos[*yyssp], yyvsp, arg);
|
||||||
YYPOPSTACK (1);
|
YYPOPSTACK (1);
|
||||||
}
|
}
|
||||||
#ifndef yyoverflow
|
#ifndef yyoverflow
|
||||||
@ -1850,13 +1832,12 @@ yyreturn:
|
|||||||
|
|
||||||
|
|
||||||
/* Line 2055 of yacc.c */
|
/* Line 2055 of yacc.c */
|
||||||
#line 229 "plural.y"
|
#line 207 "plural.y"
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
internal_function
|
internal_function
|
||||||
FREE_EXPRESSION (exp)
|
FREE_EXPRESSION (struct expression *exp)
|
||||||
struct expression *exp;
|
|
||||||
{
|
{
|
||||||
if (exp == NULL)
|
if (exp == NULL)
|
||||||
return;
|
return;
|
||||||
@ -1882,18 +1863,16 @@ FREE_EXPRESSION (exp)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
yylex (lval, pexp)
|
yylex (YYSTYPE *lval, struct parse_args *arg)
|
||||||
YYSTYPE *lval;
|
|
||||||
const char **pexp;
|
|
||||||
{
|
{
|
||||||
const char *exp = *pexp;
|
const char *exp = arg->cp;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (exp[0] == '\0')
|
if (exp[0] == '\0')
|
||||||
{
|
{
|
||||||
*pexp = exp;
|
arg->cp = exp;
|
||||||
return YYEOF;
|
return YYEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2020,15 +1999,14 @@ yylex (lval, pexp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pexp = exp;
|
arg->cp = exp;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
yyerror (str)
|
yyerror (struct parse_args *arg, const char *str)
|
||||||
const char *str;
|
|
||||||
{
|
{
|
||||||
/* Do nothing. We don't print error messages here. */
|
/* Do nothing. We don't print error messages here. */
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
%{
|
%{
|
||||||
/* Expression parsing for plural form selection.
|
/* Expression parsing for plural form selection.
|
||||||
Copyright (C) 2000-2014 Free Software Foundation, Inc.
|
Copyright (C) 2000-2014 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* The bison generated parser uses alloca. AIX 3 forces us to put this
|
/* For bison < 2.0, the bison generated parser uses alloca. AIX 3 forces us
|
||||||
declaration at the beginning of the file. The declaration in bison's
|
to put this declaration at the beginning of the file. The declaration in
|
||||||
skeleton file comes too late. This must come before <config.h>
|
bison's skeleton file comes too late. This must come before <config.h>
|
||||||
because <config.h> may include arbitrary system headers. */
|
because <config.h> may include arbitrary system headers.
|
||||||
|
This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0. */
|
||||||
#if defined _AIX && !defined __GNUC__
|
#if defined _AIX && !defined __GNUC__
|
||||||
#pragma alloca
|
#pragma alloca
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
@ -40,42 +40,28 @@
|
|||||||
# define __gettextparse PLURAL_PARSE
|
# define __gettextparse PLURAL_PARSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
|
|
||||||
#define YYPARSE_PARAM arg
|
|
||||||
%}
|
%}
|
||||||
%pure_parser
|
%parse-param {struct parse_args *arg}
|
||||||
|
%lex-param {struct parse_args *arg}
|
||||||
|
%define api.pure full
|
||||||
%expect 7
|
%expect 7
|
||||||
|
|
||||||
%union {
|
%union {
|
||||||
unsigned long int num;
|
unsigned long int num;
|
||||||
enum operator op;
|
enum expression_operator op;
|
||||||
struct expression *exp;
|
struct expression *exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
%{
|
%{
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
static struct expression *new_exp PARAMS ((int nargs, enum operator op,
|
static int yylex (YYSTYPE *lval, struct parse_args *arg);
|
||||||
struct expression * const *args));
|
static void yyerror (struct parse_args *arg, const char *str);
|
||||||
static inline struct expression *new_exp_0 PARAMS ((enum operator op));
|
|
||||||
static inline struct expression *new_exp_1 PARAMS ((enum operator op,
|
|
||||||
struct expression *right));
|
|
||||||
static struct expression *new_exp_2 PARAMS ((enum operator op,
|
|
||||||
struct expression *left,
|
|
||||||
struct expression *right));
|
|
||||||
static inline struct expression *new_exp_3 PARAMS ((enum operator op,
|
|
||||||
struct expression *bexp,
|
|
||||||
struct expression *tbranch,
|
|
||||||
struct expression *fbranch));
|
|
||||||
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
|
|
||||||
static void yyerror PARAMS ((const char *str));
|
|
||||||
|
|
||||||
/* Allocation of expressions. */
|
/* Allocation of expressions. */
|
||||||
|
|
||||||
static struct expression *
|
static struct expression *
|
||||||
new_exp (nargs, op, args)
|
new_exp (int nargs, enum expression_operator op,
|
||||||
int nargs;
|
struct expression * const *args)
|
||||||
enum operator op;
|
|
||||||
struct expression * const *args;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct expression *newp;
|
struct expression *newp;
|
||||||
@ -104,16 +90,13 @@ new_exp (nargs, op, args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline struct expression *
|
static inline struct expression *
|
||||||
new_exp_0 (op)
|
new_exp_0 (enum expression_operator op)
|
||||||
enum operator op;
|
|
||||||
{
|
{
|
||||||
return new_exp (0, op, NULL);
|
return new_exp (0, op, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct expression *
|
static inline struct expression *
|
||||||
new_exp_1 (op, right)
|
new_exp_1 (enum expression_operator op, struct expression *right)
|
||||||
enum operator op;
|
|
||||||
struct expression *right;
|
|
||||||
{
|
{
|
||||||
struct expression *args[1];
|
struct expression *args[1];
|
||||||
|
|
||||||
@ -122,10 +105,8 @@ new_exp_1 (op, right)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct expression *
|
static struct expression *
|
||||||
new_exp_2 (op, left, right)
|
new_exp_2 (enum expression_operator op, struct expression *left,
|
||||||
enum operator op;
|
struct expression *right)
|
||||||
struct expression *left;
|
|
||||||
struct expression *right;
|
|
||||||
{
|
{
|
||||||
struct expression *args[2];
|
struct expression *args[2];
|
||||||
|
|
||||||
@ -135,11 +116,8 @@ new_exp_2 (op, left, right)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline struct expression *
|
static inline struct expression *
|
||||||
new_exp_3 (op, bexp, tbranch, fbranch)
|
new_exp_3 (enum expression_operator op, struct expression *bexp,
|
||||||
enum operator op;
|
struct expression *tbranch, struct expression *fbranch)
|
||||||
struct expression *bexp;
|
|
||||||
struct expression *tbranch;
|
|
||||||
struct expression *fbranch;
|
|
||||||
{
|
{
|
||||||
struct expression *args[3];
|
struct expression *args[3];
|
||||||
|
|
||||||
@ -175,7 +153,7 @@ start: exp
|
|||||||
{
|
{
|
||||||
if ($1 == NULL)
|
if ($1 == NULL)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
((struct parse_args *) arg)->res = $1;
|
arg->res = $1;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -230,8 +208,7 @@ exp: exp '?' exp ':' exp
|
|||||||
|
|
||||||
void
|
void
|
||||||
internal_function
|
internal_function
|
||||||
FREE_EXPRESSION (exp)
|
FREE_EXPRESSION (struct expression *exp)
|
||||||
struct expression *exp;
|
|
||||||
{
|
{
|
||||||
if (exp == NULL)
|
if (exp == NULL)
|
||||||
return;
|
return;
|
||||||
@ -257,18 +234,16 @@ FREE_EXPRESSION (exp)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
yylex (lval, pexp)
|
yylex (YYSTYPE *lval, struct parse_args *arg)
|
||||||
YYSTYPE *lval;
|
|
||||||
const char **pexp;
|
|
||||||
{
|
{
|
||||||
const char *exp = *pexp;
|
const char *exp = arg->cp;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (exp[0] == '\0')
|
if (exp[0] == '\0')
|
||||||
{
|
{
|
||||||
*pexp = exp;
|
arg->cp = exp;
|
||||||
return YYEOF;
|
return YYEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,15 +370,14 @@ yylex (lval, pexp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pexp = exp;
|
arg->cp = exp;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
yyerror (str)
|
yyerror (struct parse_args *arg, const char *str)
|
||||||
const char *str;
|
|
||||||
{
|
{
|
||||||
/* Do nothing. We don't print error messages here. */
|
/* Do nothing. We don't print error messages here. */
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
/* Implementation of the textdomain(3) function.
|
/* Implementation of the textdomain(3) function.
|
||||||
Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
Copyright (C) 1995-2014 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
|
This program is free software: you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
License along with the GNU C Library; if not, see
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -23,39 +21,25 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gettextP.h"
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
#else
|
#else
|
||||||
# include "libgnuintl.h"
|
# include "libgnuintl.h"
|
||||||
#endif
|
#endif
|
||||||
#include "gettextP.h"
|
|
||||||
|
|
||||||
|
/* Handle multi-threaded applications. */
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
/* We have to handle multi-threaded applications. */
|
|
||||||
# include <bits/libc-lock.h>
|
# include <bits/libc-lock.h>
|
||||||
|
# define gl_rwlock_define __libc_rwlock_define
|
||||||
|
# define gl_rwlock_wrlock __libc_rwlock_wrlock
|
||||||
|
# define gl_rwlock_unlock __libc_rwlock_unlock
|
||||||
#else
|
#else
|
||||||
/* Provide dummy implementation if this is outside glibc. */
|
# include "lock.h"
|
||||||
# define __libc_rwlock_define(CLASS, NAME)
|
|
||||||
# define __libc_rwlock_wrlock(NAME)
|
|
||||||
# define __libc_rwlock_unlock(NAME)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The internal variables in the standalone libintl.a must have different
|
|
||||||
names than the internal variables in GNU libc, otherwise programs
|
|
||||||
using libintl.a cannot be linked statically. */
|
|
||||||
#if !defined _LIBC
|
|
||||||
# define _nl_default_default_domain libintl_nl_default_default_domain
|
|
||||||
# define _nl_current_default_domain libintl_nl_current_default_domain
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* @@ end of prolog @@ */
|
/* @@ end of prolog @@ */
|
||||||
|
|
||||||
/* Name of the default text domain. */
|
|
||||||
extern const char _nl_default_default_domain[] attribute_hidden;
|
|
||||||
|
|
||||||
/* Default text domain in which entries for gettext(3) are to be found. */
|
|
||||||
extern const char *_nl_current_default_domain attribute_hidden;
|
|
||||||
|
|
||||||
|
|
||||||
/* Names for the libintl functions are a problem. They must not clash
|
/* Names for the libintl functions are a problem. They must not clash
|
||||||
with existing names and they should follow ANSI C. But this source
|
with existing names and they should follow ANSI C. But this source
|
||||||
@ -71,14 +55,13 @@ extern const char *_nl_current_default_domain attribute_hidden;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Lock variable to protect the global data in the gettext implementation. */
|
/* Lock variable to protect the global data in the gettext implementation. */
|
||||||
__libc_rwlock_define (extern, _nl_state_lock attribute_hidden)
|
gl_rwlock_define (extern, _nl_state_lock attribute_hidden)
|
||||||
|
|
||||||
/* Set the current default message catalog to DOMAINNAME.
|
/* Set the current default message catalog to DOMAINNAME.
|
||||||
If DOMAINNAME is null, return the current default.
|
If DOMAINNAME is null, return the current default.
|
||||||
If DOMAINNAME is "", reset to the default of "messages". */
|
If DOMAINNAME is "", reset to the default of "messages". */
|
||||||
char *
|
char *
|
||||||
TEXTDOMAIN (domainname)
|
TEXTDOMAIN (const char *domainname)
|
||||||
const char *domainname;
|
|
||||||
{
|
{
|
||||||
char *new_domain;
|
char *new_domain;
|
||||||
char *old_domain;
|
char *old_domain;
|
||||||
@ -87,7 +70,7 @@ TEXTDOMAIN (domainname)
|
|||||||
if (domainname == NULL)
|
if (domainname == NULL)
|
||||||
return (char *) _nl_current_default_domain;
|
return (char *) _nl_current_default_domain;
|
||||||
|
|
||||||
__libc_rwlock_wrlock (_nl_state_lock);
|
gl_rwlock_wrlock (_nl_state_lock);
|
||||||
|
|
||||||
old_domain = (char *) _nl_current_default_domain;
|
old_domain = (char *) _nl_current_default_domain;
|
||||||
|
|
||||||
@ -131,7 +114,7 @@ TEXTDOMAIN (domainname)
|
|||||||
free (old_domain);
|
free (old_domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
__libc_rwlock_unlock (_nl_state_lock);
|
gl_rwlock_unlock (_nl_state_lock);
|
||||||
|
|
||||||
return new_domain;
|
return new_domain;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user