GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
xbitor.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
bitor(a,b,c,...) = a | b | c | ...
8
****************************************************************/
9
10
int
f_bitor
(
int
argc,
const
int
*argt,
void
**args)
11
{
12
CELL
*res = args[0];
13
CELL
**argz = (
CELL
**) args;
14
int
i, j;
15
16
if
(argc < 1)
17
return
E_ARG_LO
;
18
19
if
(argt[0] !=
CELL_TYPE
)
20
return
E_RES_TYPE
;
21
22
for
(i = 1; i <= argc; i++)
23
if
(argt[i] !=
CELL_TYPE
)
24
return
E_ARG_TYPE
;
25
26
for
(i = 0; i <
columns
; i++) {
27
res[i] = 0;
28
for
(j = 1; j <= argc; j++) {
29
if
(
IS_NULL_C
(&argz[j][i])) {
30
SET_NULL_C
(&res[i]);
31
break
;
32
}
33
res[i] |= argz[j][i];
34
}
35
}
36
37
return
0;
38
}
CELL_TYPE
#define CELL_TYPE
Definition:
raster.h:11
SET_NULL_C
#define SET_NULL_C(x)
Definition:
calc.h:32
f_bitor
int f_bitor(int argc, const int *argt, void **args)
Definition:
xbitor.c:10
E_ARG_TYPE
Definition:
calc.h:14
IS_NULL_C
#define IS_NULL_C(x)
Definition:
calc.h:28
columns
int columns
Definition:
calc.c:12
raster.h
gis.h
E_ARG_LO
Definition:
calc.h:12
CELL
int CELL
Definition:
gis.h:602
E_RES_TYPE
Definition:
calc.h:15
calc.h
lib
calc
xbitor.c
Generated on Mon May 31 2021 05:21:32 for GRASS GIS 7 Programmer's Manual by
1.8.13