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

Modules

 Macro-generated code.

Files

file  args.c

Enumerations

enum  discard_policy_t { DISCARD_DROP, DISCARD_BLANK, DISCARD_COMMENT }
enum  command_codes {
  CMD_HELP = 1, CMD_VERSION, CMD_SOURCE, CMD_SYMBOLS,
  CMD_INCLUDES, CMD_DEFS, CMD_PRAGMAS, CMD_ERRORS,
  CMD_DIRECTIVES
}
enum  command_flags {
  CMD_HELP_MASK = 1 << (CMD_HELP - 1), CMD_VERSION_MASK = 1 << (CMD_VERSION - 1), CMD_SOURCE_MASK = 1 << (CMD_SOURCE - 1), CMD_SYMBOLS_MASK = 1 << (CMD_SYMBOLS - 1),
  CMD_INCLUDES_MASK = 1 << (CMD_INCLUDES - 1), CMD_DEFS_MASK = 1 << (CMD_DEFS - 1), CMD_PRAGMAS_MASK = 1 << (CMD_PRAGMAS - 1), CMD_ERRORS_MASK = 1 << (CMD_ERRORS - 1),
  CMD_DIRECTIVES_MASK
}

Functions

void parse_executable (char **argv)
void parse_args (int argc, char *argv[])
void finish_args (void)

Detailed Description

The interface provides acccess to the commandline arguments and operations to parse and analyse them.


Enumeration Type Documentation

Sequential symbolic constants for coan commands

Enumerator:
CMD_HELP 

The help command

CMD_VERSION 

The version command

CMD_SOURCE 

The source command

CMD_SYMBOLS 

The symbols command

CMD_INCLUDES 

The includes command

CMD_DEFS 

The defs command

CMD_PRAGMAS 

The pragmas command

CMD_ERRORS 

The errors command

CMD_DIRECTIVES 

The directives command

Definition at line 61 of file args.h.

Bitwise symbolic constants for coan commands

Enumerator:
CMD_HELP_MASK 

The help command

CMD_VERSION_MASK 

The version command

CMD_SOURCE_MASK 

The source command

CMD_SYMBOLS_MASK 

The symbols command

CMD_INCLUDES_MASK 

The includes command

CMD_DEFS_MASK 

The defs command

CMD_PRAGMAS_MASK 

The pragmas command

CMD_ERRORS_MASK 

The pragmas command

CMD_DIRECTIVES_MASK 

The directives command

Definition at line 74 of file args.h.

Enumeration of policies for discarding lines

Enumerator:
DISCARD_DROP 

Drop discarded lines

DISCARD_BLANK 

Blank discarded lines

DISCARD_COMMENT 

Comment discarded lines

Definition at line 54 of file args.h.


Function Documentation

void finish_args ( void  )

Analyse the component's state after parsing the commandline, diasgnose any errors and draw final conclusions.

Definition at line 1028 of file args.c.

References add_files(), bail(), CMD_INCLUDES, CMD_SOURCE, CMD_SYMBOLS, file_tree_count(), file_tree_is_empty(), FT_COUNT_FILES, GET_PUBLIC, GET_STATE, GRIPE_NOTHING_TO_DO, GRIPE_ONE_FILE_ONLY, GRIPE_USAGE_ERROR, PROGRESS_FILE_TALLY, read_filename(), report(), SET_PUBLIC, and usage_error().

Referenced by main().

Here is the call graph for this function:

void parse_args ( int  argc,
char *  argv[] 
)

Parse the commandline.

Parameters:
argcThe number of commandline arguments.
argvArray of commandline arguments.

Populate the component's state by parsing the commandline arguments.

Definition at line 996 of file args.c.

References cmd_option::cmd_code, CMD_DEFS, CMD_DIRECTIVES, CMD_ERRORS, CMD_HELP, CMD_INCLUDES, CMD_PRAGMAS, CMD_SYMBOLS, CMD_VERSION, get_command_option(), GRIPE_USAGE_ERROR, line_despatch_no_op(), parse_command_args(), SET_PUBLIC, usage_error(), usage_help(), and version().

Referenced by main().

Here is the call graph for this function:

void parse_executable ( char **  argv)

Parse the full and short names of the executable.

Parameters:
argvThe array of commandline arguments.

Element 0 of argv is parsed to find the complete pathname and filename of our executable and the addresses of these strings are stored respectively at exec_path and prog_name in the component's state.

Definition at line 983 of file args.c.

References PATH_DELIM, and SET_PUBLIC.

Referenced by main().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines