coan 4.2.4
The Args component internals.
Collaboration diagram for The Args component internals.:

Modules

 Macro-generated code.

Files

file  args.c

Defines

#define PROGRESS_GAGGED()   ((GET_PUBLIC(args,diagnostic_filter) & MSGCLASS_PROGRESS) != 0)
#define VERSION   "4.2.3"

Enumerations

enum  option_codes {
  OPT_FILE = 'f', OPT_REPLACE = 'r', OPT_BACKUP = 'b', OPT_DEF = 'D',
  OPT_UNDEF = 'U', OPT_CONFLICT = 'x', OPT_GAG = 'g', OPT_VERBOSE = 'V',
  OPT_COMPLEMENT = 'c', OPT_DEBUG = 1, OPT_EVALCONSTS = 'E', OPT_DISCARD = 'k',
  OPT_LINE = 2, OPT_POD = 'P', OPT_RECURSE = 'R', OPT_FILTER = 'F',
  OPT_KEEPGOING = 'K', OPT_IFS = 'i', OPT_DEFS = 'd', OPT_UNDEFS = 'u',
  OPT_INCLUDES = 3, OPT_LOCATE = 'L', OPT_ONCE = 'o', OPT_SYSTEM = 's',
  OPT_LOCAL = 'l', OPT_ACTIVE = 'A', OPT_INACTIVE = 'I', OPT_EVALSYMS = 'e',
  OPT_IMPLICIT = 'm'
}

Functions

static void make_opts_list (void)
static void usage (FILE *fp)
static void usage_error_summary (void)
static void usage_error (int reason, const char *format,...)
static void usage_help (void)
static void version (void)
static void config_diagnostics (const char *arg)
static void finalise_diagnostics (void)
static void error_invalid_opt (cmd_option_t const *cmd, int bad_opt)
static bool add_files (char const *path)
static void parse_args_file (const char *argsfile)
static void parse_command_args (int argc, char *argv[])

Variables

static struct option long_options []
static char opts [(sizeof(long_options)/sizeof(struct option))*3]
static struct cmd_option commands []
static int const source_cmd_exclusions []
static int const symbols_cmd_exclusions []
static int const includes_cmd_exclusions []
static int const directives_cmd_exclusions []
static int const defs_cmd_exclusions []
static int const pragmas_cmd_exclusions []
static int const errors_cmd_exclusions []
static struct exclusion_list const cmd_exclusion_lists []

Define Documentation

#define PROGRESS_GAGGED ( )    ((GET_PUBLIC(args,diagnostic_filter) & MSGCLASS_PROGRESS) != 0)

Say whether we are suppressing progress messages

Definition at line 104 of file args.c.

Referenced by parse_command_args().

#define VERSION   "4.2.3"

Version of coan. Only used in Windows builds; otherwise defined via autoconf.

Definition at line 539 of file args.c.

Referenced by version().


Enumeration Type Documentation

Enumeraton of codes for the options of all coan commands

Enumerator:
OPT_FILE 

The --file option

OPT_REPLACE 

The --replace option

OPT_BACKUP 

The --backup option

OPT_DEF 

The --define option

OPT_UNDEF 

The --undefine option

OPT_CONFLICT 

The --conflict option

OPT_GAG 

The --gag option

OPT_VERBOSE 

The --verbose option

OPT_COMPLEMENT 

The --complement option

OPT_DEBUG 

The --debug option

OPT_EVALCONSTS 

The --constant option

OPT_DISCARD 

The --discard option

OPT_LINE 

The --line option

OPT_POD 

The --pod option

OPT_RECURSE 

The --recurse option

OPT_FILTER 

The --filter option

OPT_KEEPGOING 

The --keepgoing option

OPT_IFS 

The --ifs option

OPT_DEFS 

The --defs option

OPT_UNDEFS 

The --undefs option

OPT_INCLUDES 

The --includes option

OPT_LOCATE 

The --locate option

OPT_ONCE 

The --once option

OPT_SYSTEM 

The --system option

OPT_LOCAL 

The --local option

OPT_ACTIVE 

The --active option

OPT_INACTIVE 

The --inactive option

OPT_EVALSYMS 

The --evalsyms option

OPT_IMPLICIT 

The --implicit option

Definition at line 109 of file args.c.


Function Documentation

static bool add_files ( char const *  path) [static]

Add files to the input dataset.

Parameters:
pathFile or directory to be included in the input dataset.
Returns:
True if path is added to the input dataset, else false.

If path is a file that satisfies any --filter option it is added to the input dataset.

If path is a directory and --recurse is in force then files recursively beneath it that satisfy any --filter option are added to the input dataset.

If path is a directory and --recurse is not in force then the directory is ignored.

Definition at line 665 of file args.c.

References dataset_add(), FS_IS_DIR, FS_IS_FILE, FS_IS_SLINK, FS_OBJ_NONE, fs_obj_type(), GET_PUBLIC, GRIPE_BROKEN_SYMLINK, GRIPE_DIR_IGNORED, GRIPE_NO_FILE, and report().

Referenced by finish_args(), and parse_command_args().

Here is the call graph for this function:

static void config_diagnostics ( const char *  arg) [static]

Configure diagnostic output in response to a --gag or --verbose option.

Parameters:
argEither "verbose" or an argument to the --gag option

Definition at line 556 of file args.c.

References GET_PUBLIC, GRIPE_DUPLICATE_MASK, GRIPE_USAGE_ERROR, GRIPE_VERBOSE_ONLY, MSGCLASS_ABEND, MSGCLASS_ERROR, MSGCLASS_INFO, MSGCLASS_NONE, MSGCLASS_PROGRESS, MSGCLASS_SUMMARY, MSGCLASS_WARNING, report(), SET_PUBLIC, and usage_error().

Referenced by finalise_diagnostics(), and parse_command_args().

Here is the call graph for this function:

static void error_invalid_opt ( cmd_option_t const *  cmd,
int  bad_opt 
) [static]

Raise a usage error when an option is invalid for the active command.

Parameters:
cmdPointer to details of the active coan command.
bad_optThe code of the invalid option.

Definition at line 634 of file args.c.

References get_long_opt_name(), GRIPE_INVALID_ARGS, cmd_option::name, and usage_error().

Referenced by parse_command_args().

Here is the call graph for this function:

static void finalise_diagnostics ( void  ) [static]

Configure the final state of diagnostic output filtering.

If no --gag or --verbose option has been seen, default to --gag info --gag summary.

Definition at line 613 of file args.c.

References config_diagnostics(), GET_PUBLIC, and SET_PUBLIC.

Referenced by parse_command_args().

Here is the call graph for this function:

static void make_opts_list ( void  ) [static]

Assemble the shortopts argument for getopts_long(). The string is constructed by scanning the long_options array to avoid the need for manually maintaining agreement between that structure and the shortopts string.

This function is called only once.

Definition at line 278 of file args.c.

References option::has_arg, long_options, option::name, no_argument, optional_argument, opts, required_argument, and option::val.

Referenced by parse_command_args().

static void parse_args_file ( const char *  argsfile) [static]

Parse commandline options from a file specified with the --file option.

Parameters:
argsfileName of the file from which to read options Options are separated by whitespace in the file. The parsed options are stored in an argv array held in the component's private state. This array can then be parsed by parse_args() as if passed to main().

Definition at line 940 of file args.c.

References bail(), GET_PUBLIC, GET_STATE, GRIPE_CANT_READ_INPUT, GRIPE_MULTIPLE_ARGFILES, open_file(), parse_command_args(), ptr_vector_append(), ptr_vector_begin(), ptr_vector_count(), SET_STATE, and zallocate().

Referenced by parse_command_args().

Here is the call graph for this function:

static void usage ( FILE *  fp) [static]

Write brief command usage information to a file

Parameters:
fpStream to which the info will be written.

Definition at line 306 of file args.c.

References GET_PUBLIC.

Referenced by usage_error_summary(), and usage_help().

static void usage_error ( int  reason,
const char *  format,
  ... 
) [static]

Write a usage error diagnostic on stderr followed by a usage summary, then terminate the program.

Parameters:
reasonReason code the for usage error
formatFormat for composing error disgnostic with subsequent args.

If format is NULL then the diagnostic is assumed to be "Invalid usage" and the reason is defaulted to GRIPE_USAGE_ERROR

Definition at line 508 of file args.c.

References GRIPE_USAGE_ERROR, usage_error_summary(), and vbail().

Referenced by config_diagnostics(), error_invalid_opt(), finish_args(), parse_args(), and parse_command_args().

Here is the call graph for this function:

static void usage_error_summary ( void  ) [static]

Wrapper for usage(stderr) call, used for atexit() registration

Definition at line 493 of file args.c.

References usage().

Referenced by usage_error().

Here is the call graph for this function:

static void usage_help ( void  ) [static]

Write brief command usage information to stdout for the --help option, then terminate the program wihtout error.

Definition at line 526 of file args.c.

References MSGCLASS_NONE, and usage().

Referenced by parse_args().

Here is the call graph for this function:

static void version ( void  ) [static]

Write version information about the program on stdout

Definition at line 544 of file args.c.

References GET_PUBLIC, MSGCLASS_NONE, OS_TYPE, and VERSION.

Referenced by parse_args().


Variable Documentation

struct exclusion_list const cmd_exclusion_lists[] [static]
Initial value:

Array of exclusion list for the coan commands, indexed by command code.

Definition at line 246 of file args.c.

struct cmd_option commands[] [static]
Initial value:
 {
    { "help", CMD_HELP, CMD_HELP_MASK },
    { "-h", CMD_HELP, CMD_HELP_MASK },
    { "--help", CMD_HELP, CMD_HELP_MASK },
    { "version", CMD_VERSION, CMD_VERSION_MASK },
    { "-v", CMD_VERSION, CMD_VERSION_MASK },
    { "--version", CMD_VERSION, CMD_VERSION_MASK },
    { "source", CMD_SOURCE, CMD_SOURCE_MASK },
    { "symbols", CMD_SYMBOLS, CMD_SYMBOLS_MASK },
    { "includes", CMD_INCLUDES, CMD_INCLUDES_MASK },
    { "defs", CMD_DEFS, CMD_DEFS_MASK },
    { "pragmas", CMD_PRAGMAS, CMD_PRAGMAS_MASK },
    { "errors", CMD_ERRORS, CMD_ERRORS_MASK },
    { "directives", CMD_DIRECTIVES, CMD_DIRECTIVES_MASK },
    { 0, 0 }
}

Array of structures specifying the valid coan commands

Definition at line 184 of file args.c.

Referenced by get_command_option().

int const defs_cmd_exclusions[] [static]
Initial value:

Excluded options for the defs command. .

Definition at line 223 of file args.c.

int const directives_cmd_exclusions[] [static]
Initial value:

Excluded options for the directives command. .

Definition at line 218 of file args.c.

int const errors_cmd_exclusions[] [static]
Initial value:

Excluded options for the errors command.

Definition at line 235 of file args.c.

int const includes_cmd_exclusions[] [static]
Initial value:

Excluded options for the includes command. .

Definition at line 213 of file args.c.

struct option long_options[] [static]

Array of structures specifying the valid options for all coan commands

Definition at line 143 of file args.c.

Referenced by make_opts_list().

char opts[(sizeof(long_options)/sizeof(struct option))*3] [static]

Array in which we will assemble the shortopts arguments for getopts_long() We allow 3 bytes per short option, i,e, the short option code possibly followed by up to 2 colons.

Definition at line 181 of file args.c.

Referenced by make_opts_list(), and parse_command_args().

int const pragmas_cmd_exclusions[] [static]
Initial value:

Excluded options for the pragmas command.

Definition at line 229 of file args.c.

int const source_cmd_exclusions[] [static]
Initial value:

Excluded options for the source command. .

Definition at line 202 of file args.c.

int const symbols_cmd_exclusions[] [static]
Initial value:

Excluded options for the symbols command. .

Definition at line 208 of file args.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines