Loading...
Searching...
No Matches
calc.c
Go to the documentation of this file.
#include <unistd.h>
#include <signal.h>
#include <grass/calc.h>
/****************************************************************************/
volatile int floating_point_exception;
volatile int floating_point_exception_occurred;
int columns;
/****************************************************************************/
static void handle_fpe(int n G_UNUSED)
{
floating_point_exception = 1;
floating_point_exception_occurred = 1;
}
void pre_exec(void)
{
#ifndef _WIN32
#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 _WIN32
#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;
}
/****************************************************************************/
floating_point_exception
volatile int floating_point_exception
Definition calc.c:8
columns
int columns
Definition calc.c:11
pre_exec
void pre_exec(void)
Definition calc.c:21
post_exec
void post_exec(void)
Definition calc.c:38
calc_init
void calc_init(int cols)
Definition calc.c:55
floating_point_exception_occurred
volatile int floating_point_exception_occurred
Definition calc.c:9
NULL
#define NULL
Definition ccmath.h:32