OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [intl/] [plural-exp.h] - Blame information for rev 326

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 205 julius
/* Expression parsing and evaluation for plural form selection.
2
   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
3
   Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
4
 
5
   This program is free software; you can redistribute it and/or modify it
6
   under the terms of the GNU Library General Public License as published
7
   by the Free Software Foundation; either version 2, or (at your option)
8
   any later version.
9
 
10
   This program is distributed in the hope that it will be useful,
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
   Library General Public License for more details.
14
 
15
   You should have received a copy of the GNU Library General Public
16
   License along with this program; if not, write to the Free Software
17
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
18
   USA.  */
19
 
20
#ifndef _PLURAL_EXP_H
21
#define _PLURAL_EXP_H
22
 
23
#ifndef PARAMS
24
# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
25
#  define PARAMS(args) args
26
# else
27
#  define PARAMS(args) ()
28
# endif
29
#endif
30
 
31
#ifndef internal_function
32
# define internal_function
33
#endif
34
 
35
#ifndef attribute_hidden
36
# define attribute_hidden
37
#endif
38
 
39
 
40
/* This is the representation of the expressions to determine the
41
   plural form.  */
42
struct expression
43
{
44
  int nargs;                    /* Number of arguments.  */
45
  enum operator
46
  {
47
    /* Without arguments:  */
48
    var,                        /* The variable "n".  */
49
    num,                        /* Decimal number.  */
50
    /* Unary operators:  */
51
    lnot,                       /* Logical NOT.  */
52
    /* Binary operators:  */
53
    mult,                       /* Multiplication.  */
54
    divide,                     /* Division.  */
55
    module,                     /* Modulo operation.  */
56
    plus,                       /* Addition.  */
57
    minus,                      /* Subtraction.  */
58
    less_than,                  /* Comparison.  */
59
    greater_than,               /* Comparison.  */
60
    less_or_equal,              /* Comparison.  */
61
    greater_or_equal,           /* Comparison.  */
62
    equal,                      /* Comparison for equality.  */
63
    not_equal,                  /* Comparison for inequality.  */
64
    land,                       /* Logical AND.  */
65
    lor,                        /* Logical OR.  */
66
    /* Ternary operators:  */
67
    qmop                        /* Question mark operator.  */
68
  } operation;
69
  union
70
  {
71
    unsigned long int num;      /* Number value for `num'.  */
72
    struct expression *args[3]; /* Up to three arguments.  */
73
  } val;
74
};
75
 
76
/* This is the data structure to pass information to the parser and get
77
   the result in a thread-safe way.  */
78
struct parse_args
79
{
80
  const char *cp;
81
  struct expression *res;
82
};
83
 
84
 
85
/* Names for the libintl functions are a problem.  This source code is used
86
   1. in the GNU C Library library,
87
   2. in the GNU libintl library,
88
   3. in the GNU gettext tools.
89
   The function names in each situation must be different, to allow for
90
   binary incompatible changes in 'struct expression'.  Furthermore,
91
   1. in the GNU C Library library, the names have a __ prefix,
92
   2.+3. in the GNU libintl library and in the GNU gettext tools, the names
93
         must follow ANSI C and not start with __.
94
   So we have to distinguish the three cases.  */
95
#ifdef _LIBC
96
# define FREE_EXPRESSION __gettext_free_exp
97
# define PLURAL_PARSE __gettextparse
98
# define GERMANIC_PLURAL __gettext_germanic_plural
99
# define EXTRACT_PLURAL_EXPRESSION __gettext_extract_plural
100
#elif defined (IN_LIBINTL)
101
# define FREE_EXPRESSION libintl_gettext_free_exp
102
# define PLURAL_PARSE libintl_gettextparse
103
# define GERMANIC_PLURAL libintl_gettext_germanic_plural
104
# define EXTRACT_PLURAL_EXPRESSION libintl_gettext_extract_plural
105
#else
106
# define FREE_EXPRESSION free_plural_expression
107
# define PLURAL_PARSE parse_plural_expression
108
# define GERMANIC_PLURAL germanic_plural
109
# define EXTRACT_PLURAL_EXPRESSION extract_plural_expression
110
#endif
111
 
112
extern void FREE_EXPRESSION PARAMS ((struct expression *exp))
113
     internal_function;
114
extern int PLURAL_PARSE PARAMS ((void *arg));
115
extern struct expression GERMANIC_PLURAL attribute_hidden;
116
extern void EXTRACT_PLURAL_EXPRESSION PARAMS ((const char *nullentry,
117
                                               struct expression **pluralp,
118
                                               unsigned long int *npluralsp))
119
     internal_function;
120
 
121
#if !defined (_LIBC) && !defined (IN_LIBINTL)
122
extern unsigned long int plural_eval PARAMS ((struct expression *pexp,
123
                                              unsigned long int n));
124
#endif
125
 
126
#endif /* _PLURAL_EXP_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.