24static struct colorinfo *get_colorinfo(
int *);
25static void free_colorinfo(
struct colorinfo *,
int);
27static int cmp_clrname(
const void *a,
const void *
b)
29 struct colorinfo *
ca = (
struct colorinfo *)a;
30 struct colorinfo *cb = (
struct colorinfo *)
b;
46 struct colorinfo *colorinfo;
51 colorinfo = get_colorinfo(&
nrules);
53 for (i = 0; i <
nrules; i++) {
54 name = colorinfo[i].name;
57 if (size < len + n + 2) {
69 free_colorinfo(colorinfo,
nrules);
83 const char *
name, *desc;
85 struct colorinfo *colorinfo;
91 colorinfo = get_colorinfo(&
nrules);
93 for (i = 0; i <
nrules; i++) {
94 name = colorinfo[i].name;
95 desc = colorinfo[i].desc;
98 desc =
_(
"no description");
112 free_colorinfo(colorinfo,
nrules);
127 struct colorinfo *colorinfo;
128 const char *
name, *desc, *type;
132 colorinfo = get_colorinfo(&
nrules);
138 for (i = 0; i <
nrules; i++) {
139 name = colorinfo[i].name;
140 desc = colorinfo[i].desc;
141 type = colorinfo[i].type;
165 free_colorinfo(colorinfo,
nrules);
178 struct colorinfo *colorinfo;
180 colorinfo = get_colorinfo(&
nrules);
182 for (i = 0; i <
nrules; i++)
185 free_colorinfo(colorinfo,
nrules);
203 colorinfo = get_colorinfo(&
nrules);
223 for (i = 0; i <
nrules; i++) {
224 if (colorinfo[i].desc) {
226 colorinfo[i].desc, colorinfo[i].type);
235 free_colorinfo(colorinfo,
nrules);
249 struct colorinfo *colorinfo,
csearch;
251 colorinfo = get_colorinfo(&
nrules);
255 cmp_clrname) !=
NULL);
257 free_colorinfo(colorinfo,
nrules);
262struct colorinfo *get_colorinfo(
int *
nrules)
267 struct colorinfo *colorinfo;
277 for (i = 0; i < *
nrules - 3; i++) {
284 colorinfo[i].desc =
NULL;
297 while (
G_getl2(buf,
sizeof(buf), fp)) {
298 char value[80], color[80];
309 if (
sscanf(buf,
"%s %[^\n]", value, color) != 2)
320 if (
sscanf(value,
"%lf%c", &x, &c) == 2 && c ==
'%') {
324 if (
sscanf(value,
"%lf", &x) == 1) {
340 colorinfo[i].type =
G_store(
_(
"range: map values"));
343 colorinfo[i].type =
G_store(buf);
361 qsort(colorinfo, *
nrules,
sizeof(
struct colorinfo), cmp_clrname);
377 if (!
G_getl2(buf,
sizeof(buf), fp))
402void free_colorinfo(
struct colorinfo *colorinfo,
int nrules)
406 for (i = 0; i <
nrules; i++) {
407 if (colorinfo[i].
name)
409 if (colorinfo[i].desc)
410 G_free(colorinfo[i].desc);
411 if (colorinfo[i].type)
412 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.