1 /* Expression parsing and evaluation for plural form selection.
2 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
3 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 # define PARAMS(args) args
28 # define PARAMS(args) ()
32 #ifndef internal_function
33 # define internal_function
37 /* This is the representation of the expressions to determine the
41 int nargs
; /* Number of arguments. */
44 /* Without arguments: */
45 var
, /* The variable "n". */
46 num
, /* Decimal number. */
47 /* Unary operators: */
48 lnot
, /* Logical NOT. */
49 /* Binary operators: */
50 mult
, /* Multiplication. */
51 divide
, /* Division. */
52 module
, /* Modulo operation. */
54 minus
, /* Subtraction. */
55 less_than
, /* Comparison. */
56 greater_than
, /* Comparison. */
57 less_or_equal
, /* Comparison. */
58 greater_or_equal
, /* Comparison. */
59 equal
, /* Comparison for equality. */
60 not_equal
, /* Comparison for inequality. */
61 land
, /* Logical AND. */
62 lor
, /* Logical OR. */
63 /* Ternary operators: */
64 qmop
/* Question mark operator. */
68 unsigned long int num
; /* Number value for `num'. */
69 struct expression
*args
[3]; /* Up to three arguments. */
73 /* This is the data structure to pass information to the parser and get
74 the result in a thread-safe way. */
78 struct expression
*res
;
82 /* Names for the libintl functions are a problem. This source code is used
83 1. in the GNU C Library library,
84 2. in the GNU libintl library,
85 3. in the GNU gettext tools.
86 The function names in each situation must be different, to allow for
87 binary incompatible changes in 'struct expression'. Furthermore,
88 1. in the GNU C Library library, the names have a __ prefix,
89 2.+3. in the GNU libintl library and in the GNU gettext tools, the names
90 must follow ANSI C and not start with __.
91 So we have to distinguish the three cases. */
93 # define FREE_EXPRESSION __gettext_free_exp
94 # define PLURAL_PARSE __gettextparse
95 # define GERMANIC_PLURAL __gettext_germanic_plural
96 # define EXTRACT_PLURAL_EXPRESSION __gettext_extract_plural
97 #elif defined (IN_LIBINTL)
98 # define FREE_EXPRESSION gettext_free_exp__
99 # define PLURAL_PARSE gettextparse__
100 # define GERMANIC_PLURAL gettext_germanic_plural__
101 # define EXTRACT_PLURAL_EXPRESSION gettext_extract_plural__
103 # define FREE_EXPRESSION free_plural_expression
104 # define PLURAL_PARSE parse_plural_expression
105 # define GERMANIC_PLURAL germanic_plural
106 # define EXTRACT_PLURAL_EXPRESSION extract_plural_expression
109 extern void FREE_EXPRESSION
PARAMS ((struct expression
*exp
))
111 extern int PLURAL_PARSE
PARAMS ((void *arg
));
112 extern struct expression GERMANIC_PLURAL
;
113 extern void EXTRACT_PLURAL_EXPRESSION
PARAMS ((const char *nullentry
,
114 struct expression
**pluralp
,
115 unsigned long int *npluralsp
))
118 #endif /* _PLURAL_EXP_H */