1/* Expression evaluation for plural form selection.
2   Copyright (C) 2005-2006 Free Software Foundation, Inc.
3   Written by Bruno Haible <bruno@clisp.org>, 2005.
4
5   This program is free software: you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 3 of the License, or
8   (at your option) 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
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18#ifndef _PLURAL_EVAL_H
19#define _PLURAL_EVAL_H
20
21
22/* Definition of 'struct expression', and
23   declaration of extract_plural_expression() and plural_eval().  */
24#include "plural-exp.h"
25
26
27/* Protection against signals during plural evaluation.  */
28
29#include <setjmp.h>
30
31/* Some platforms don't have the sigjmp_buf type in <setjmp.h>.  */
32#if defined _MSC_VER || defined __MINGW32__
33/* Native Woe32 API.  */
34# define sigjmp_buf jmp_buf
35# define sigsetjmp(env,savesigs) setjmp (env)
36# define siglongjmp longjmp
37#endif
38
39/* We use siginfo to get precise information about the signal.
40   But siginfo doesn't work on Irix 6.5 and on Cygwin 2005.  */
41#if HAVE_SIGINFO && !defined (__sgi) && !defined (__CYGWIN__)
42# define USE_SIGINFO 1
43#endif
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49/* Exit point.  Must be set before calling install_sigfpe_handler().  */
50extern sigjmp_buf sigfpe_exit;
51
52#if USE_SIGINFO
53/* Additional information that is set before sigfpe_exit is invoked.  */
54extern int sigfpe_code;
55#endif
56
57/* Protect against signals during plural evaluation.  Must be called around
58   calls to plural_eval().  Must be called in pairs.  */
59extern void install_sigfpe_handler (void);
60extern void uninstall_sigfpe_handler (void);
61
62#ifdef __cplusplus
63}
64#endif
65
66
67#endif /* _PLURAL_EVAL_H */
68