Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions lib/gis/parser_dependencies.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,30 @@ int G__has_required_rule(void)
return FALSE;
}

const struct Option *G__first_required_option_from_rules(void)
{
size_t i;

for (i = 0; i < rules.count; i++) {
const struct rule *rule = &((const struct rule *)rules.data)[i];

if (rule->type == RULE_REQUIRED) {
if (rule->count < 0)
G_fatal_error(
_("Internal error: the number of options is < 0"));
size_t j;
for (j = 0; j < (unsigned int)rule->count; j++) {
void *p = rule->opts[j];
if (is_flag(p))
continue;
else
return (const struct Option *)p;
}
}
}
return NULL;
}

static const char *const rule_types[] = {"exclusive", "required",
"requires", "requires-all",
"excludes", "collective"};
Expand Down
12 changes: 12 additions & 0 deletions lib/gis/parser_local_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,23 @@ struct state {

extern struct state *st;

#define MD_NEWLINE " "

/* functions which are used by several parser functions in different files */

void G__usage_xml(void);
void G__usage_html(void);
void G__usage_rest(void);

void G__usage_markdown(void);
void G__md_print_cli_short_version(FILE *file, const char *indent);
void G__md_print_python_short_version(FILE *file, const char *indent);
void G__md_print_cli_long_version(FILE *file, const char *indent);
void G__md_print_python_long_version(FILE *file, const char *indent);
void G__md_print_escaped(FILE *f, const char *str);
void G__md_print_escaped_for_options(FILE *f, const char *str);
int G__option_num_tuple_items(const struct Option *opt);

void G__usage_text(void);
void G__script(void);
char *G__json(void);
Expand All @@ -66,6 +77,7 @@ void G__split_gisprompt(const char *, char *, char *, char *);
void G__check_option_rules(void);
void G__describe_option_rules(void);
int G__has_required_rule(void);
const struct Option *G__first_required_option_from_rules(void);
void G__describe_option_rules_xml(FILE *);

#endif
Loading
Loading