123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #include <unistd.h>
- #include <signal.h>
- #include <grass/calc.h>
- /****************************************************************************/
- volatile int floating_point_exception;
- volatile int floating_point_exception_occurred;
- int columns;
- /****************************************************************************/
- static RETSIGTYPE handle_fpe(int n)
- {
- floating_point_exception = 1;
- floating_point_exception_occurred = 1;
- }
- void pre_exec(void)
- {
- #ifndef __MINGW32__
- #ifdef SIGFPE
- struct sigaction act;
- act.sa_handler = &handle_fpe;
- act.sa_flags = 0;
- sigemptyset(&act.sa_mask);
- sigaction(SIGFPE, &act, NULL);
- #endif
- #endif
- floating_point_exception_occurred = 0;
- }
- void post_exec(void)
- {
- #ifndef __MINGW32__
- #ifdef SIGFPE
- struct sigaction act;
- act.sa_handler = SIG_DFL;
- act.sa_flags = 0;
- sigemptyset(&act.sa_mask);
- sigaction(SIGFPE, &act, NULL);
- #endif
- #endif
- }
- /****************************************************************************/
- void calc_init(int cols)
- {
- columns = cols;
- }
- /****************************************************************************/
|