GRASS GIS 7 Programmer's Manual
7.2.1(2017)-exported
xor.c
Go to the documentation of this file.
1
2
#include <grass/gis.h>
3
#include <grass/raster.h>
4
#include <grass/calc.h>
5
6
/****************************************************************
7
or(a,b,c,...) = a || b || c || ...
8
****************************************************************/
9
10
int
f_or
(
int
argc,
const
int
*argt,
void
**args)
11
{
12
CELL *res = args[0];
13
int
i, j;
14
15
if
(argc < 1)
16
return
E_ARG_LO;
17
18
if
(argt[0] != CELL_TYPE)
19
return
E_RES_TYPE;
20
21
for
(i = 1; i <= argc; i++)
22
if
(argt[i] != argt[0])
23
return
E_ARG_TYPE;
24
25
for
(i = 0; i <
columns
; i++) {
26
res[i] = 0;
27
for
(j = 1; j <= argc; j++) {
28
CELL *arg = args[j];
29
if
(IS_NULL_C(&arg[i])) {
30
SET_NULL_C(&res[i]);
31
break
;
32
}
33
if
(arg[i])
34
res[i] = 1;
35
}
36
}
37
38
return
0;
39
}
columns
int columns
Definition:
calc.c:12
f_or
int f_or(int argc, const int *argt, void **args)
Definition:
xor.c:10
calc
xor.c
Generated on Sat Aug 5 2017 10:50:05 for GRASS GIS 7 Programmer's Manual by
1.8.13