GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
calc.c
Go to the documentation of this file.
1 #include <unistd.h>
2 #include <signal.h>
3 
4 #include <grass/calc.h>
5 
6 /****************************************************************************/
7 
10 
11 int columns;
12 
13 /****************************************************************************/
14 
15 static void handle_fpe(int n UNUSED)
16 {
19 }
20 
21 void pre_exec(void)
22 {
23 #ifndef __MINGW32__
24 #ifdef SIGFPE
25  struct sigaction act;
26 
27  act.sa_handler = &handle_fpe;
28  act.sa_flags = 0;
29  sigemptyset(&act.sa_mask);
30 
31  sigaction(SIGFPE, &act, NULL);
32 #endif
33 #endif
34 
36 }
37 
38 void post_exec(void)
39 {
40 #ifndef __MINGW32__
41 #ifdef SIGFPE
42  struct sigaction act;
43 
44  act.sa_handler = SIG_DFL;
45  act.sa_flags = 0;
46  sigemptyset(&act.sa_mask);
47 
48  sigaction(SIGFPE, &act, NULL);
49 #endif
50 #endif
51 }
52 
53 /****************************************************************************/
54 
55 void calc_init(int cols)
56 {
57  columns = cols;
58 }
59 
60 /****************************************************************************/
volatile int floating_point_exception
Definition: calc.c:8
int columns
Definition: calc.c:11
void pre_exec(void)
Definition: calc.c:21
void post_exec(void)
Definition: calc.c:38
void calc_init(int cols)
Definition: calc.c:55
volatile int floating_point_exception_occurred
Definition: calc.c:9
#define NULL
Definition: ccmath.h:32
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
Definition: gis.h:47