GRASS 8 Programmer's Manual
8.5.0(2026)-8d6ceba290
Toggle main menu visibility
Loading...
Searching...
No Matches
xdouble.c
Go to the documentation of this file.
1
#include <stdlib.h>
2
3
#include <grass/gis.h>
4
#include <grass/raster.h>
5
#include <grass/calc.h>
6
7
/**********************************************************************
8
double(x)
9
converts x to double
10
**********************************************************************/
11
12
int
f_double
(
int
argc,
const
int
*argt,
void
**args)
13
{
14
DCELL *res = args[0];
15
int
i;
16
17
if
(argc < 1)
18
return
E_ARG_LO;
19
if
(argc > 1)
20
return
E_ARG_HI;
21
22
if
(argt[0] != DCELL_TYPE)
23
return
E_RES_TYPE;
24
25
switch
(argt[1]) {
26
case
CELL_TYPE: {
27
CELL *arg1 = args[1];
28
29
for
(i = 0; i <
columns
; i++)
30
if
(IS_NULL_C(&arg1[i]))
31
SET_NULL_D(&res[i]);
32
else
33
res[i] = (DCELL)arg1[i];
34
return
0;
35
}
36
case
FCELL_TYPE: {
37
FCELL *arg1 = args[1];
38
39
for
(i = 0; i <
columns
; i++)
40
if
(IS_NULL_F(&arg1[i]))
41
SET_NULL_D(&res[i]);
42
else
43
res[i] = (DCELL)arg1[i];
44
return
0;
45
}
46
case
DCELL_TYPE: {
47
DCELL *arg1 = args[1];
48
49
for
(i = 0; i <
columns
; i++)
50
if
(IS_NULL_D(&arg1[i]))
51
SET_NULL_D(&res[i]);
52
else
53
res[i] = (DCELL)arg1[i];
54
return
0;
55
}
56
default
:
57
return
E_INV_TYPE;
58
}
59
}
60
61
int
c_double
(
int
argc,
int
*argt)
62
{
63
if
(argc < 1)
64
return
E_ARG_LO;
65
if
(argc > 1)
66
return
E_ARG_HI;
67
68
argt[0] = DCELL_TYPE;
69
/* argt[1] = argt[1]; */
70
71
return
0;
72
}
columns
int columns
Definition
calc.c:11
c_double
int c_double(int argc, int *argt)
Definition
xdouble.c:61
f_double
int f_double(int argc, const int *argt, void **args)
Definition
xdouble.c:12
calc
xdouble.c
Generated on
for GRASS 8 Programmer's Manual by
1.17.0