Home | History | Annotate | Line # | Download | only in src
      1 /* Expression evaluation for plural form selection.
      2    Copyright (C) 2005-2006 Free Software Foundation, Inc.
      3    Written by Bruno Haible <bruno (at) 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 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
     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, write to the Free Software Foundation,
     17    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
     18 
     19 #ifndef _PLURAL_EVAL_H
     20 #define _PLURAL_EVAL_H
     21 
     22 
     23 /* Definition of 'struct expression', and
     24    declaration of extract_plural_expression() and plural_eval().  */
     25 #include "plural-exp.h"
     26 
     27 
     28 /* Protection against signals during plural evaluation.  */
     29 
     30 #include <setjmp.h>
     31 
     32 /* Some platforms don't have the sigjmp_buf type in <setjmp.h>.  */
     33 #if defined _MSC_VER || defined __MINGW32__
     34 /* Native Woe32 API.  */
     35 # define sigjmp_buf jmp_buf
     36 # define sigsetjmp(env,savesigs) setjmp (env)
     37 # define siglongjmp longjmp
     38 #endif
     39 
     40 /* We use siginfo to get precise information about the signal.
     41    But siginfo doesn't work on Irix 6.5 and on Cygwin 2005.  */
     42 #if HAVE_SIGINFO && !defined (__sgi) && !defined (__CYGWIN__)
     43 # define USE_SIGINFO 1
     44 #endif
     45 
     46 /* Exit point.  Must be set before calling install_sigfpe_handler().  */
     47 extern sigjmp_buf sigfpe_exit;
     48 
     49 #if USE_SIGINFO
     50 /* Additional information that is set before sigfpe_exit is invoked.  */
     51 extern int sigfpe_code;
     52 #endif
     53 
     54 /* Protect against signals during plural evaluation.  Must be called around
     55    calls to plural_eval().  Must be called in pairs.  */
     56 extern void install_sigfpe_handler (void);
     57 extern void uninstall_sigfpe_handler (void);
     58 
     59 
     60 #endif /* _PLURAL_EVAL_H */
     61