GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
parser_dependencies.c File Reference

GIS Library - Argument parsing functions (dependencies between options) More...

#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include "parser_local_proto.h"
Include dependency graph for parser_dependencies.c:

Go to the source code of this file.

Functions

void G_option_rule (int type, int nopts, void **opts)
 Set generic option rule. More...
 
void G_option_exclusive (void *first,...)
 Sets the options to be mutually exclusive. More...
 
void G_option_required (void *first,...)
 Sets the options to be required. More...
 
void G_option_requires (void *first,...)
 Define a list of options from which at least one option is required if first option is present. More...
 
void G_option_requires_all (void *first,...)
 Define additionally required options for an option. More...
 
void G_option_excludes (void *first,...)
 Exclude selected options. More...
 
void G_option_collective (void *first,...)
 Sets the options to be collective. More...
 
void G__check_option_rules (void)
 Check for option rules (internal use only) More...
 
void G__describe_option_rules (void)
 Describe option rules (stderr) More...
 
int G__has_required_rule (void)
 Checks if there is any rule RULE_REQUIRED (internal use only). More...
 
void G__describe_option_rules_xml (FILE *fp)
 Describe option rules in XML format (internal use only) More...
 

Detailed Description

GIS Library - Argument parsing functions (dependencies between options)

(C) 2014-2015 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Glynn Clements Jun. 2014

Definition in file parser_dependencies.c.

Function Documentation

◆ G__check_option_rules()

void G__check_option_rules ( void  )

Check for option rules (internal use only)

Definition at line 367 of file parser_dependencies.c.

References RULE_EXCLUSIVE.

◆ G__describe_option_rules()

void G__describe_option_rules ( void  )

Describe option rules (stderr)

Definition at line 401 of file parser_dependencies.c.

References RULE_EXCLUSIVE.

◆ G__describe_option_rules_xml()

void G__describe_option_rules_xml ( FILE *  fp)

Describe option rules in XML format (internal use only)

Parameters
fpfile where to print XML info

Definition at line 468 of file parser_dependencies.c.

◆ G__has_required_rule()

int G__has_required_rule ( void  )

Checks if there is any rule RULE_REQUIRED (internal use only).

Returns
1 if there is such rule
0 if not

Definition at line 443 of file parser_dependencies.c.

References FALSE, RULE_REQUIRED, and TRUE.

◆ G_option_collective()

void G_option_collective ( void *  first,
  ... 
)

Sets the options to be collective.

If any option is present, all the other options must also be present all or nothing from a set.

Parameters
firstfirst given option

Definition at line 347 of file parser_dependencies.c.

◆ G_option_excludes()

void G_option_excludes ( void *  first,
  ... 
)

Exclude selected options.

If the first option is present, none of the other options may also (should?) be present.

Parameters
firstfirst given option

Definition at line 320 of file parser_dependencies.c.

◆ G_option_exclusive()

void G_option_exclusive ( void *  first,
  ... 
)

Sets the options to be mutually exclusive.

When running the module, at most one option from a set can be provided.

Parameters
firstfirst given option

Definition at line 202 of file parser_dependencies.c.

◆ G_option_required()

void G_option_required ( void *  first,
  ... 
)

Sets the options to be required.

At least one option from a set must be given.

Parameters
firstfirst given option

Definition at line 226 of file parser_dependencies.c.

◆ G_option_requires()

void G_option_requires ( void *  first,
  ... 
)

Define a list of options from which at least one option is required if first option is present.

If the first option is present, at least one of the other options must also be present.

If you want all options to be provided use G_option_requires_all() function. If you want more than one option to be present but not all, call this function multiple times.

Parameters
firstfirst given option

Definition at line 257 of file parser_dependencies.c.

◆ G_option_requires_all()

void G_option_requires_all ( void *  first,
  ... 
)

Define additionally required options for an option.

If the first option is present, all the other options must also be present.

If it is enough if only one option from a set is present, use G_option_requires() function.

See also
G_option_collective()
Parameters
firstfirst given option

Definition at line 293 of file parser_dependencies.c.

◆ G_option_rule()

void G_option_rule ( int  type,
int  nopts,
void **  opts 
)

Set generic option rule.

Supported rule types:

  • RULE_EXCLUSIVE
  • RULE_REQUIRED
  • RULE_REQUIRES
  • RULE_REQUIRES_ALL
  • RULE_EXCLUDES
  • RULE_COLLECTIVE
Parameters
typerule type
noptsnumber of options in the array
optsarray of options

Definition at line 76 of file parser_dependencies.c.