~ubuntu-branches/ubuntu/saucy/m17n-lib/saucy

« back to all changes in this revision

Viewing changes to intl/plural-exp.h

  • Committer: Bazaar Package Importer
  • Author(s): Harshula Jayasuriya
  • Date: 2010-11-23 01:39:29 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20101123013929-rs3kpqgu4kr3qx32
Tags: 1.6.2-1
* New upstream release 1.6.2.
* Update Standards-Version to Debian Policy 3.9.1. (No changes)
* debian/control: Depends: m17n-db and m17n-contrib. (Closes: #599643)
* PATCH: (make_locale): Don't call setlocale.  Just parse the arg NAME.
         (Closes: #601858)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Expression parsing and evaluation for plural form selection.
2
 
   Copyright (C) 2000-2003 Free Software Foundation, Inc.
 
2
   Copyright (C) 2000-2003, 2005-2007 Free Software Foundation, Inc.
3
3
   Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
4
4
 
5
5
   This program is free software; you can redistribute it and/or modify it
14
14
 
15
15
   You should have received a copy of the GNU Library General Public
16
16
   License along with this program; if not, write to the Free Software
17
 
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 
17
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
18
18
   USA.  */
19
19
 
20
20
#ifndef _PLURAL_EXP_H
28
28
# define attribute_hidden
29
29
#endif
30
30
 
 
31
#ifdef __cplusplus
 
32
extern "C" {
 
33
#endif
 
34
 
 
35
 
 
36
enum expression_operator
 
37
{
 
38
  /* Without arguments:  */
 
39
  var,                          /* The variable "n".  */
 
40
  num,                          /* Decimal number.  */
 
41
  /* Unary operators:  */
 
42
  lnot,                         /* Logical NOT.  */
 
43
  /* Binary operators:  */
 
44
  mult,                         /* Multiplication.  */
 
45
  divide,                       /* Division.  */
 
46
  module,                       /* Modulo operation.  */
 
47
  plus,                         /* Addition.  */
 
48
  minus,                        /* Subtraction.  */
 
49
  less_than,                    /* Comparison.  */
 
50
  greater_than,                 /* Comparison.  */
 
51
  less_or_equal,                /* Comparison.  */
 
52
  greater_or_equal,             /* Comparison.  */
 
53
  equal,                        /* Comparison for equality.  */
 
54
  not_equal,                    /* Comparison for inequality.  */
 
55
  land,                         /* Logical AND.  */
 
56
  lor,                          /* Logical OR.  */
 
57
  /* Ternary operators:  */
 
58
  qmop                          /* Question mark operator.  */
 
59
};
31
60
 
32
61
/* This is the representation of the expressions to determine the
33
62
   plural form.  */
34
63
struct expression
35
64
{
36
65
  int nargs;                    /* Number of arguments.  */
37
 
  enum operator
38
 
  {
39
 
    /* Without arguments:  */
40
 
    var,                        /* The variable "n".  */
41
 
    num,                        /* Decimal number.  */
42
 
    /* Unary operators:  */
43
 
    lnot,                       /* Logical NOT.  */
44
 
    /* Binary operators:  */
45
 
    mult,                       /* Multiplication.  */
46
 
    divide,                     /* Division.  */
47
 
    module,                     /* Modulo operation.  */
48
 
    plus,                       /* Addition.  */
49
 
    minus,                      /* Subtraction.  */
50
 
    less_than,                  /* Comparison.  */
51
 
    greater_than,               /* Comparison.  */
52
 
    less_or_equal,              /* Comparison.  */
53
 
    greater_or_equal,           /* Comparison.  */
54
 
    equal,                      /* Comparison for equality.  */
55
 
    not_equal,                  /* Comparison for inequality.  */
56
 
    land,                       /* Logical AND.  */
57
 
    lor,                        /* Logical OR.  */
58
 
    /* Ternary operators:  */
59
 
    qmop                        /* Question mark operator.  */
60
 
  } operation;
 
66
  enum expression_operator operation;
61
67
  union
62
68
  {
63
69
    unsigned long int num;      /* Number value for `num'.  */
106
112
extern int PLURAL_PARSE (void *arg);
107
113
extern struct expression GERMANIC_PLURAL attribute_hidden;
108
114
extern void EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
109
 
                                       struct expression **pluralp,
 
115
                                       const struct expression **pluralp,
110
116
                                       unsigned long int *npluralsp)
111
117
     internal_function;
112
118
 
113
 
#if !defined (_LIBC) && !defined (IN_LIBINTL)
114
 
extern unsigned long int plural_eval (struct expression *pexp,
 
119
#if !defined (_LIBC) && !defined (IN_LIBINTL) && !defined (IN_LIBGLOCALE)
 
120
extern unsigned long int plural_eval (const struct expression *pexp,
115
121
                                      unsigned long int n);
116
122
#endif
117
123
 
 
124
 
 
125
#ifdef __cplusplus
 
126
}
 
127
#endif
 
128
 
118
129
#endif /* _PLURAL_EXP_H */