3 /* Expression parsing and evaluation for plural form selection.
4 Copyright (C) 2000-2003 Free Software Foundation, Inc.
5 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Library General Public License as published
9 by the Free Software Foundation; either version 2, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
25 #ifndef internal_function
26 # define internal_function
29 #ifndef attribute_hidden
30 # define attribute_hidden
34 /* This is the representation of the expressions to determine the
38 int nargs
; /* Number of arguments. */
41 /* Without arguments: */
42 var
, /* The variable "n". */
43 num
, /* Decimal number. */
44 /* Unary operators: */
45 lnot
, /* Logical NOT. */
46 /* Binary operators: */
47 mult
, /* Multiplication. */
48 divide
, /* Division. */
49 module
, /* Modulo operation. */
51 minus
, /* Subtraction. */
52 less_than
, /* Comparison. */
53 greater_than
, /* Comparison. */
54 less_or_equal
, /* Comparison. */
55 greater_or_equal
, /* Comparison. */
56 equal
, /* Comparison for equality. */
57 not_equal
, /* Comparison for inequality. */
58 land
, /* Logical AND. */
59 lor
, /* Logical OR. */
60 /* Ternary operators: */
61 qmop
/* Question mark operator. */
65 unsigned long int num
; /* Number value for `num'. */
66 struct expression
*args
[3]; /* Up to three arguments. */
70 /* This is the data structure to pass information to the parser and get
71 the result in a thread-safe way. */
75 struct expression
*res
;
79 /* Names for the libintl functions are a problem. This source code is used
80 1. in the GNU C Library library,
81 2. in the GNU libintl library,
82 3. in the GNU gettext tools.
83 The function names in each situation must be different, to allow for
84 binary incompatible changes in 'struct expression'. Furthermore,
85 1. in the GNU C Library library, the names have a __ prefix,
86 2.+3. in the GNU libintl library and in the GNU gettext tools, the names
87 must follow ANSI C and not start with __.
88 So we have to distinguish the three cases. */
90 # define FREE_EXPRESSION __gettext_free_exp
91 # define PLURAL_PARSE __gettextparse
92 # define GERMANIC_PLURAL __gettext_germanic_plural
93 # define EXTRACT_PLURAL_EXPRESSION __gettext_extract_plural
94 #elif defined (IN_LIBINTL)
95 # define FREE_EXPRESSION libintl_gettext_free_exp
96 # define PLURAL_PARSE libintl_gettextparse
97 # define GERMANIC_PLURAL libintl_gettext_germanic_plural
98 # define EXTRACT_PLURAL_EXPRESSION libintl_gettext_extract_plural
100 # define FREE_EXPRESSION free_plural_expression
101 # define PLURAL_PARSE parse_plural_expression
102 # define GERMANIC_PLURAL germanic_plural
103 # define EXTRACT_PLURAL_EXPRESSION extract_plural_expression
106 extern void FREE_EXPRESSION (struct expression
*exp
)
108 extern int PLURAL_PARSE (void *arg
);
109 extern struct expression GERMANIC_PLURAL attribute_hidden
;
110 extern void EXTRACT_PLURAL_EXPRESSION (const char *nullentry
,
111 struct expression
**pluralp
,
112 unsigned long int *npluralsp
)
115 #if !defined (_LIBC) && !defined (IN_LIBINTL)
116 extern unsigned long int plural_eval (struct expression
*pexp
,
117 unsigned long int n
);
120 #endif /* _PLURAL_EXP_H */