25static struct colorinfo *get_colorinfo(
int *);
26static void free_colorinfo(
struct colorinfo *,
int);
28static int cmp_clrname(
const void *a,
const void *
b)
30 struct colorinfo *
ca = (
struct colorinfo *)a;
31 struct colorinfo *cb = (
struct colorinfo *)
b;
47 struct colorinfo *colorinfo;
52 colorinfo = get_colorinfo(&
nrules);
54 for (i = 0; i <
nrules; i++) {
55 name = colorinfo[i].name;
58 if (size < len + n + 2) {
70 free_colorinfo(colorinfo,
nrules);
84 const char *
name, *desc;
86 struct colorinfo *colorinfo;
92 colorinfo = get_colorinfo(&
nrules);
94 for (i = 0; i <
nrules; i++) {
95 name = colorinfo[i].name;
96 desc = colorinfo[i].desc;
99 desc =
_(
"no description");
113 free_colorinfo(colorinfo,
nrules);
128 struct colorinfo *colorinfo;
129 const char *
name, *desc, *type;
133 colorinfo = get_colorinfo(&
nrules);
139 for (i = 0; i <
nrules; i++) {
140 name = colorinfo[i].name;
141 desc = colorinfo[i].desc;
142 type = colorinfo[i].type;
166 free_colorinfo(colorinfo,
nrules);
179 struct colorinfo *colorinfo;
181 colorinfo = get_colorinfo(&
nrules);
183 for (i = 0; i <
nrules; i++)
186 free_colorinfo(colorinfo,
nrules);
204 colorinfo = get_colorinfo(&
nrules);
224 for (i = 0; i <
nrules; i++) {
225 if (colorinfo[i].desc) {
227 colorinfo[i].desc, colorinfo[i].type);
236 free_colorinfo(colorinfo,
nrules);
250 struct colorinfo *colorinfo,
csearch;
252 colorinfo = get_colorinfo(&
nrules);
256 cmp_clrname) !=
NULL);
258 free_colorinfo(colorinfo,
nrules);
263struct colorinfo *get_colorinfo(
int *
nrules)
268 struct colorinfo *colorinfo;
278 for (i = 0; i < *
nrules - 3; i++) {
285 colorinfo[i].desc =
NULL;
298 while (
G_getl2(buf,
sizeof(buf), fp)) {
299 char value[80], color[80];
310 if (
sscanf(buf,
"%s %[^\n]", value, color) != 2)
321 if (
sscanf(value,
"%lf%c", &x, &c) == 2 && c ==
'%') {
325 if (
sscanf(value,
"%lf", &x) == 1) {
341 colorinfo[i].type =
G_store(
_(
"range: map values"));
344 colorinfo[i].type =
G_store(buf);
362 qsort(colorinfo, *
nrules,
sizeof(
struct colorinfo), cmp_clrname);
378 if (!
G_getl2(buf,
sizeof(buf), fp))
403void free_colorinfo(
struct colorinfo *colorinfo,
int nrules)
407 for (i = 0; i <
nrules; i++) {
408 if (colorinfo[i].
name)
410 if (colorinfo[i].desc)
411 G_free(colorinfo[i].desc);
412 if (colorinfo[i].type)
413 G_free(colorinfo[i].type);
AMI_err name(char **stream_name)
int G_getl2(char *, int, FILE *)
Gets a line of text from a file of any pedigree.
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
const char * G_gisbase(void)
Get full path name of the top level module directory.
char ** G_tokenize(const char *, const char *)
Tokenize string.
void G_free_tokens(char **)
Free memory allocated to tokens.
void G_strip(char *)
Removes all leading and trailing white space from string.
int G_number_of_tokens(char **)
Return number of tokens.
char ** G_ls2(const char *, int *)
Stores a sorted directory listing in an array.
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
char * G_chop(char *)
Chop leading and trailing white spaces.
char * G_store(const char *)
Copy string to allocated memory.
char * G_color_rules_description_type(void)
Get color rules description for Option->descriptions.
char * G_color_rules_descriptions(void)
Get color rules description for Option->descriptions.
void G_list_color_rules(FILE *out)
Print color rules.
void G_list_color_rules_description_type(FILE *out, char *name)
Print color rules with description and type.
int G_find_color_rule(const char *name)
Check if color rule is defined.
char * G_color_rules_options(void)
Get list of color rules for Option->options.