mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Update.
2000-01-21 Ulrich Drepper <drepper@cygnus.com> * intl/Makefile (routines): Add dcigettext, dcngettext, dngettxt, ngettext, and plural. (distribute): Add plural.y, po2test.sed, and tst-gettext.sh. (test-srcs): Add tst-gettext. (before-compile): Add $(objpfx)msgs.h. Add rules for plural.c and msgs.h generation and running tst-gettext.\ * intl/Versions [GLIBC_2.2]: Add __dcngettext, dcngettext, dngettext, and ngettext. * intl/dcgettext.c: Move most code into dcigettext.c. Add call dcigettext with appropriate parameters. * intl/dcigettext.c: New file. * intl/dcngettext.c: New file. * intl/dngettext.c: New file. * intl/ngettext.c: New file. * intl/gettextP.h (struct expression): Define. (struct loaded_domain): Add plural and nplurals members. Add prototypes for new internal functions. * intl/libintl.h: Declare new functions. Add optimizations for them. * intl/loadinfo.h: Add new parameter to _nl_find_msg declaration. * intl/loadmsgcat.c (_nl_load_domain): Search for plural information in header entry and parse and store the expression. * intl/plural.y: New file. * intl/po2test.sed: New file. * intl/tst-gettext.c: New file. * intl/tst-gettext.sh: New file. * intl/gettext.c: Call __dcgettext directly.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* Header describing internals of gettext library
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -64,6 +64,51 @@ SWAP (i)
|
||||
#endif
|
||||
|
||||
|
||||
/* This is the representation of the expressions to determine the
|
||||
plural form. */
|
||||
struct expression
|
||||
{
|
||||
enum operator
|
||||
{
|
||||
var, /* The variable "n". */
|
||||
num, /* Decimal number. */
|
||||
mult, /* Multiplication. */
|
||||
divide, /* Division. */
|
||||
module, /* Module operation. */
|
||||
plus, /* Addition. */
|
||||
minus, /* Subtraction. */
|
||||
equal, /* Comparision for equality. */
|
||||
not_equal, /* Comparision for inequality. */
|
||||
land, /* Logical AND. */
|
||||
lor, /* Logical OR. */
|
||||
qmop /* Question mark operator. */
|
||||
} operation;
|
||||
union
|
||||
{
|
||||
unsigned long int num; /* Number value for `num'. */
|
||||
struct
|
||||
{
|
||||
struct expression *left; /* Left expression in binary operation. */
|
||||
struct expression *right; /* Right expression in binary operation. */
|
||||
} args2;
|
||||
struct
|
||||
{
|
||||
struct expression *bexp; /* Boolean expression in ?: operation. */
|
||||
struct expression *tbranch; /* True-branch in ?: operation. */
|
||||
struct expression *fbranch; /* False-branch in ?: operation. */
|
||||
} args3;
|
||||
} val;
|
||||
};
|
||||
|
||||
/* This is the data structure to pass information to the parser and get
|
||||
the result in a thread-safe way. */
|
||||
struct parse_args
|
||||
{
|
||||
const char *cp;
|
||||
struct expression *res;
|
||||
};
|
||||
|
||||
|
||||
struct loaded_domain
|
||||
{
|
||||
const char *data;
|
||||
@@ -83,6 +128,9 @@ struct loaded_domain
|
||||
# endif
|
||||
#endif
|
||||
char **conv_tab;
|
||||
|
||||
struct expression *plural;
|
||||
unsigned long int nplurals;
|
||||
};
|
||||
|
||||
struct binding
|
||||
@@ -103,6 +151,34 @@ void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain))
|
||||
void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
|
||||
internal_function;
|
||||
|
||||
#ifdef _LIBC
|
||||
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));
|
||||
#else
|
||||
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));
|
||||
#endif
|
||||
|
||||
extern int __gettextdebug;
|
||||
extern void __gettext_free_exp (struct expression *exp) internal_function;
|
||||
extern int __gettextparse (void *arg);
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
||||
#endif /* gettextP.h */
|
||||
|
Reference in New Issue
Block a user