~ubuntu-branches/ubuntu/maverick/texinfo/maverick

« back to all changes in this revision

Viewing changes to intl/eval-plural.h

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2005-10-28 15:10:30 UTC
  • mto: (2.1.1 dapper) (3.1.4 hardy)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20051028151030-9nsf2s2k2z3fktjt
Tags: upstream-4.8
ImportĀ upstreamĀ versionĀ 4.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Plural expression evaluation.
2
 
   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
 
2
   Copyright (C) 2000-2003 Free Software Foundation, Inc.
3
3
 
4
 
   This program is free software; you can redistribute it and/or modify
5
 
   it under the terms of the GNU General Public License as published by
6
 
   the Free Software Foundation; either version 2, or (at your option)
 
4
   This program is free software; you can redistribute it and/or modify it
 
5
   under the terms of the GNU Library General Public License as published
 
6
   by the Free Software Foundation; either version 2, or (at your option)
7
7
   any later version.
8
8
 
9
9
   This program is distributed in the hope that it will be useful,
10
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
   GNU General Public License for more details.
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Library General Public License for more details.
13
13
 
14
 
   You should have received a copy of the GNU General Public License
15
 
   along with this program; if not, write to the Free Software Foundation,
16
 
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
14
   You should have received a copy of the GNU Library General Public
 
15
   License along with this program; if not, write to the Free Software
 
16
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 
17
   USA.  */
17
18
 
18
19
#ifndef STATIC
19
20
#define STATIC static
20
21
#endif
21
22
 
22
23
/* Evaluate the plural expression and return an index value.  */
23
 
STATIC unsigned long int plural_eval PARAMS ((struct expression *pexp,
24
 
                                              unsigned long int n))
25
 
     internal_function;
26
 
 
27
24
STATIC
28
25
unsigned long int
29
26
internal_function
30
 
plural_eval (pexp, n)
31
 
     struct expression *pexp;
32
 
     unsigned long int n;
 
27
plural_eval (struct expression *pexp, unsigned long int n)
33
28
{
34
29
  switch (pexp->nargs)
35
30
    {
67
62
              case mult:
68
63
                return leftarg * rightarg;
69
64
              case divide:
 
65
#if !INTDIV0_RAISES_SIGFPE
 
66
                if (rightarg == 0)
 
67
                  raise (SIGFPE);
 
68
#endif
70
69
                return leftarg / rightarg;
71
70
              case module:
 
71
#if !INTDIV0_RAISES_SIGFPE
 
72
                if (rightarg == 0)
 
73
                  raise (SIGFPE);
 
74
#endif
72
75
                return leftarg % rightarg;
73
76
              case plus:
74
77
                return leftarg + rightarg;