1
1
/* Plural expression evaluation.
2
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
2
Copyright (C) 2000-2003 Free Software Foundation, Inc.
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)
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.
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,
19
20
#define STATIC static
22
23
/* Evaluate the plural expression and return an index value. */
23
STATIC unsigned long int plural_eval PARAMS ((struct expression *pexp,
31
struct expression *pexp;
27
plural_eval (struct expression *pexp, unsigned long int n)
34
29
switch (pexp->nargs)
68
63
return leftarg * rightarg;
65
#if !INTDIV0_RAISES_SIGFPE
70
69
return leftarg / rightarg;
71
#if !INTDIV0_RAISES_SIGFPE
72
75
return leftarg % rightarg;
74
77
return leftarg + rightarg;