From: Bruno Haible Date: Thu, 29 Nov 2001 13:19:59 +0000 (+0000) Subject: Merge with glibc: make plural_eval a static function inside glibc and libintl. X-Git-Tag: v0.11~255 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b511b028349c7b8fd35f2ade6cdeec326f1cbc2;p=thirdparty%2Fgettext.git Merge with glibc: make plural_eval a static function inside glibc and libintl. --- diff --git a/intl/ChangeLog b/intl/ChangeLog index 009851740..2577b6e86 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,3 +1,10 @@ +2001-11-27 Ulrich Drepper + + * plural-eval.c (plural_eval): Rename back from PLURAL_EVAL. + * plural-exp.h (PLURAL_EVAL): Remove declaration. + * dcigettext.c Include plural-eval.c. + (plural_lookup): Call plural_eval instead of PLURAL_EVAL. + 2001-11-22 Bruno Haible * plural-exp.h (GERMANIC_PLURAL): New declaration. diff --git a/intl/dcigettext.c b/intl/dcigettext.c index 700f704b1..829666618 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -377,6 +377,9 @@ static int enable_secure; } #endif +/* Get the function to evaluate the plural expression. */ +#include "plural-eval.c" + /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale and, if PLURAL is nonzero, search over string depending on the plural form determined by N. */ @@ -959,7 +962,7 @@ plural_lookup (domain, n, translation, translation_len) unsigned long int index; const char *p; - index = PLURAL_EVAL (domaindata->plural, n); + index = plural_eval (domaindata->plural, n); if (index >= domaindata->nplurals) /* This should never happen. It means the plural expression and the given maximum value do not match. */ diff --git a/intl/plural-eval.c b/intl/plural-eval.c index e35a6fa72..12d23264d 100644 --- a/intl/plural-eval.c +++ b/intl/plural-eval.c @@ -15,15 +15,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifdef HAVE_CONFIG_H -# include +#ifndef STATIC +#define STATIC static #endif -#include "plural-exp.h" +/* Evaluate the plural expression and return an index value. */ +STATIC unsigned long int plural_eval PARAMS ((struct expression *pexp, + unsigned long int n)) + internal_function; +STATIC unsigned long int internal_function -PLURAL_EVAL (pexp, n) +plural_eval (pexp, n) struct expression *pexp; unsigned long int n; { @@ -44,19 +48,19 @@ PLURAL_EVAL (pexp, n) case 1: { /* pexp->operation must be lnot. */ - unsigned long int arg = PLURAL_EVAL (pexp->val.args[0], n); + unsigned long int arg = plural_eval (pexp->val.args[0], n); return ! arg; } case 2: { - unsigned long int leftarg = PLURAL_EVAL (pexp->val.args[0], n); + unsigned long int leftarg = plural_eval (pexp->val.args[0], n); if (pexp->operation == lor) - return leftarg || PLURAL_EVAL (pexp->val.args[1], n); + return leftarg || plural_eval (pexp->val.args[1], n); else if (pexp->operation == land) - return leftarg && PLURAL_EVAL (pexp->val.args[1], n); + return leftarg && plural_eval (pexp->val.args[1], n); else { - unsigned long int rightarg = PLURAL_EVAL (pexp->val.args[1], n); + unsigned long int rightarg = plural_eval (pexp->val.args[1], n); switch (pexp->operation) { @@ -92,8 +96,8 @@ PLURAL_EVAL (pexp, n) case 3: { /* pexp->operation must be qmop. */ - unsigned long int boolarg = PLURAL_EVAL (pexp->val.args[0], n); - return PLURAL_EVAL (pexp->val.args[boolarg ? 1 : 2], n); + unsigned long int boolarg = plural_eval (pexp->val.args[0], n); + return plural_eval (pexp->val.args[boolarg ? 1 : 2], n); } } /* NOTREACHED */ diff --git a/intl/plural-exp.h b/intl/plural-exp.h index 6422b9b85..1bfec819c 100644 --- a/intl/plural-exp.h +++ b/intl/plural-exp.h @@ -93,19 +93,16 @@ struct parse_args # define PLURAL_PARSE __gettextparse # define GERMANIC_PLURAL __gettext_germanic_plural # define EXTRACT_PLURAL_EXPRESSION __gettext_extract_plural -# define PLURAL_EVAL __gettext_plural_eval #elif defined (IN_LIBINTL) # define FREE_EXPRESSION gettext_free_exp__ # define PLURAL_PARSE gettextparse__ # define GERMANIC_PLURAL gettext_germanic_plural__ # define EXTRACT_PLURAL_EXPRESSION gettext_extract_plural__ -# define PLURAL_EVAL gettext_plural_eval__ #else # define FREE_EXPRESSION free_plural_expression # define PLURAL_PARSE parse_plural_expression # define GERMANIC_PLURAL germanic_plural # define EXTRACT_PLURAL_EXPRESSION extract_plural_expression -# define PLURAL_EVAL plural_eval #endif extern void FREE_EXPRESSION PARAMS ((struct expression *exp)) @@ -117,9 +114,4 @@ extern void EXTRACT_PLURAL_EXPRESSION PARAMS ((const char *nullentry, unsigned long int *npluralsp)) internal_function; -/* Evaluate the plural expression and return an index value. */ -extern unsigned long int PLURAL_EVAL PARAMS ((struct expression *pexp, - unsigned long int n)) - internal_function; - #endif /* _PLURAL_EXP_H */ diff --git a/src/ChangeLog b/src/ChangeLog index 8cb1c7c69..84dcffd47 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2001-11-29 Bruno Haible + + * plural-eval.c: Include config.h and plural-exp.h. + 2001-11-27 Bruno Haible * msgfmt.c (struct msgfmt_class_ty): New field diff --git a/src/plural-eval.c b/src/plural-eval.c index 38f0b4161..029cac9ec 100644 --- a/src/plural-eval.c +++ b/src/plural-eval.c @@ -16,6 +16,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Include the expression evaluation code from libintl, with different function - names. */ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "plural-exp.h" + +#define STATIC /*extern*/ + +/* Include the expression evaluation code from libintl, this time with + 'extern' linkage. */ #include "../intl/plural-eval.c"