]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Merge with glibc: make plural_eval a static function inside glibc and libintl.
authorBruno Haible <bruno@clisp.org>
Thu, 29 Nov 2001 13:19:59 +0000 (13:19 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jun 2009 21:28:33 +0000 (23:28 +0200)
intl/ChangeLog
intl/dcigettext.c
intl/plural-eval.c
intl/plural-exp.h
src/ChangeLog
src/plural-eval.c

index 009851740c1ff69926abd26874131aab0c1f72e2..2577b6e86a32b5fe43995fbab26d584d3ae3f154 100644 (file)
@@ -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.
index 700f704b1022128ebeb0ff9f5df43a24d2985f33..8296666182d2eb0f89d68bb6df462b9b6b209656 100644 (file)
@@ -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.  */
index e35a6fa72dc5658138ae09d3305d06b00675eb1c..12d23264d3b9081fbc0075ee532b520a0cd8a4e3 100644 (file)
    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 */
index 6422b9b85942656e92477533960182cf8091cd5d..1bfec819c9780bcb4f3f701bd1e90af59092bc61 100644 (file)
@@ -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 */
index 8cb1c7c6972eb0e8742ba16fef2701c5f7b9b145..84dcffd47612c6670c97a1a0d47df3ebbac90214 100644 (file)
@@ -1,3 +1,7 @@
+2001-11-29  Bruno Haible  <bruno@clisp.org>
+
+       * plural-eval.c: Include config.h and plural-exp.h.
+
 2001-11-27  Bruno Haible  <bruno@clisp.org>
 
        * msgfmt.c (struct msgfmt_class_ty): New field
index 38f0b416101998596578f3440b17e809dfac1616..029cac9ecdf0c9f4b82f494af9bf1c416d893960 100644 (file)
    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 <config.h>
+#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"