summaryrefslogtreecommitdiffstats
path: root/intl
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2001-11-29 13:19:59 +0000
committerBruno Haible <bruno@clisp.org>2009-06-21 23:28:33 +0200
commit1b511b028349c7b8fd35f2ade6cdeec326f1cbc2 (patch)
tree9930c6f128710ea9586b374c0963b4767c7de223 /intl
parent46e510e8532ef3f902244838ea50e4ef7621cf10 (diff)
downloadexternal_gettext-1b511b028349c7b8fd35f2ade6cdeec326f1cbc2.zip
external_gettext-1b511b028349c7b8fd35f2ade6cdeec326f1cbc2.tar.gz
external_gettext-1b511b028349c7b8fd35f2ade6cdeec326f1cbc2.tar.bz2
Merge with glibc: make plural_eval a static function inside glibc and libintl.
Diffstat (limited to 'intl')
-rw-r--r--intl/ChangeLog7
-rw-r--r--intl/dcigettext.c5
-rw-r--r--intl/plural-eval.c26
-rw-r--r--intl/plural-exp.h8
4 files changed, 26 insertions, 20 deletions
diff --git a/intl/ChangeLog b/intl/ChangeLog
index 0098517..2577b6e 100644
--- a/intl/ChangeLog
+++ b/intl/ChangeLog
@@ -1,3 +1,10 @@
+2001-11-27 Ulrich Drepper <drepper@redhat.com>
+
+ * 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 <bruno@clisp.org>
* plural-exp.h (GERMANIC_PLURAL): New declaration.
diff --git a/intl/dcigettext.c b/intl/dcigettext.c
index 700f704..8296666 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 e35a6fa..12d2326 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 <config.h>
+#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 6422b9b..1bfec81 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 */