25 static void add_d_mask_rule(
d_Mask * d_mask,
double a,
double b,
int inf);
26 static void parse_d_mask_rule(
char *vallist,
d_Mask * d_mask,
char *where);
27 static void init_d_mask_rules(
d_Mask * d_mask);
29 void init_d_mask_rules(
d_Mask * d_mask)
34 void add_d_mask_rule(
d_Mask * d_mask,
double a,
double b,
int inf)
39 I->
low = a <= b ? a :
b;
40 I->
high = a >= b ? a :
b;
52 for (I = mask->
list; I; I = I->
next) {
67 return x >= I->
low && x <= I->
high;
70 void parse_d_mask_rule(
char *vallist,
d_Mask * d_mask,
char *where)
76 if (sscanf(vallist,
"%lf-%lf", &a, &b) == 2) {
78 add_d_mask_rule(d_mask, a, b, 0);
81 else if (sscanf(vallist,
"%[^ -\t]-%lf", junk, &a) == 2)
82 add_d_mask_rule(d_mask, a, a, -1);
85 else if (sscanf(vallist,
"%lf-%[^ \t]", &a, junk) == 2)
86 add_d_mask_rule(d_mask, a, a, 1);
89 else if (sscanf(vallist,
"%lf", &a) == 1)
90 add_d_mask_rule(d_mask, a, a, 0);
95 G_warning(
_(
"%s: illegal value spec"), vallist);
109 init_d_mask_rules(*d_mask);
113 for (; *vallist; vallist++) {
114 if (*vallist[0] ==
'/') {
115 fd = fopen(*vallist,
"r");
121 while (fgets(buf,
sizeof buf, fd)) {
122 if (sscanf(buf,
"%1s", x) != 1 || *x ==
'#')
124 parse_d_mask_rule(buf, *d_mask, *vallist);
129 parse_d_mask_rule(*vallist, *d_mask, (
char *)
NULL);
void G_message(const char *,...) __attribute__((format(printf
DCELL Rast3d_mask_match_d_interval(DCELL x, d_Interval *I)
struct _d_interval * next
void G_warning(const char *,...) __attribute__((format(printf
int Rast3d_mask_d_select(DCELL *x, d_Mask *mask)
void G_usage(void)
Command line help/usage message.
void Rast3d_parse_vallist(char **vallist, d_Mask **d_mask)