|
coan
6.0.1
A C/C++ Configuration Analyzer
|
Manages coan's commandline arguments. More...
#include <options.h>
Static Public Member Functions | |
| static command_code | get_command () |
| Get the operative coan command code. | |
| static std::string const & | exec_path () |
Get our executable's full pathname, argv[0] | |
| static std::string const & | prog_name () |
| Get the program's name. | |
| static std::string const & | backup_suffix () |
| Get the file backup name suffix. | |
| static bool | got_opts () |
| Have we got all the options? | |
| static bool | replace () |
| Do we replace input files with output files? | |
| static bool | list_location () |
| Do we report file and line numbers for listed items? | |
| static bool | list_only_once () |
| Do we report only the first occurrence of listed items? | |
| static bool | list_once_per_file () |
| Do we report the listed items just once per input file? | |
| static bool | list_only_active () |
| Do we list items only from operative directives? | |
| static bool | list_only_inactive () |
| Do we list items only from inoperative directives? | |
| static bool | list_symbols_in_ifs () |
| Do we list items only from inoperative directives? | |
| static bool | list_symbols_in_defs () |
Do we list symbols in #define directives? | |
| static bool | list_symbols_in_undefs () |
Do we list symbols in #undef directives? | |
| static bool | list_symbols_in_includes () |
Do we list symbols in #include directives? | |
| static bool | list_symbols_in_lines () |
Do we list symbols in #line directives? | |
| static bool | list_system_includes () |
Do we list system #include directives? | |
| static bool | list_local_includes () |
Do we list local #include directives? | |
| static bool | complement () |
| Are we to output lines instead of dropping them and vice versa? | |
| static bool | eval_wip () |
| Do we evaluate constants in truth-functional contexts or treat them as unknowns. | |
| static bool | expand_references () |
| Do we report the expansions reported symbols? | |
| static discard_policy & | get_discard_policy () |
| Get the policy for discarding lines. | |
| static bool | line_directives () |
Do we output #line directives? | |
| static bool | plaintext () |
| Are we to omit parsing for C/C++ comments? | |
| static bool | recurse () |
| Do we recurse into directories? | |
| static bool | keep_going () |
| Shall we continue to process input files after errors? | |
| static bool | implicit () |
Do we implicitly --undef all unconfigured symbols? | |
| static bool | no_transients () |
| static bool | explain_references () |
| Do we report the progressive expansion of symbol references? | |
| static bool | selected_symbols () |
| Is symbol reporting restricted to a selected set? | |
| static unsigned & | max_expansion () |
| Is symbol reporting restricted to a selected set? | |
| static bool | have_source_output () |
| Say whether the current comment generates source code. | |
| static bool | list_at_most_once_per_file () |
| Say whether items are reportable at most once per file. | |
| static void | parse_executable (char **argv) |
| Parse the full and short names of the executable. More... | |
| static void | parse (int argc, char *argv[]) |
| Parse the commandline. More... | |
| static bool | diagnostic_gagged (unsigned reason) |
| Say whether a diagnostic reason code is gagged. | |
| static void | finish () |
| Analyse the class global state after parsing the commandline. More... | |
Private Types | |
| 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_EVALWIP = 'E', OPT_DISCARD = 'k', OPT_LINE = 1, OPT_POD = 'P', OPT_RECURSE = 'R', OPT_FILTER = 'F', OPT_KEEPGOING = 'K', OPT_IFS = 'i', OPT_DEFS = 'd', OPT_UNDEFS = 'u', OPT_INCLUDES = 2, OPT_LOCATE = 'L', OPT_ONCE = 'o', OPT_SYSTEM = 's', OPT_LOCAL = 'l', OPT_ACTIVE = 'A', OPT_INACTIVE = 'I', OPT_EXPAND = 3, OPT_IMPLICIT = 'm', OPT_DIR = 4, OPT_PREFIX = 'p', OPT_NO_TRANSIENTS = 5, OPT_EXPLAIN = 6, OPT_SELECT = 7, OPT_LNS = 8, OPT_EXPAND_MAX = 9, OPT_ONCE_PER_FILE = 10 } |
| Symbolic constants for the options of all coan commands. More... | |
Static Private Member Functions | |
| static void | make_opts_list () |
Assemble the shortopts arguments for getopts_long(). More... | |
| static void | config_diagnostics (std::string const &arg) |
| Configure diagnostic output. More... | |
| static void | finalise_diagnostics () |
| Configure the final state of diagnostic output filtering. More... | |
| static void | error_invalid_opt (struct cmd_option const *cmd, int bad_opt) |
| Raise a usage error when an option is invalid for the active command. More... | |
| static void | add_files (std::string const &path) |
| Add files to the input dataset. More... | |
| static void | parse_file (std::string const &argsfile) |
| Parse commandline options from a file. More... | |
| static void | parse_command_args (int argc, char *argv[]) |
| Parse the options to the active coan command. More... | |
| static bool | progress_gagged () |
| Say whether progress messages are suppressed. | |
Static Private Attributes | |
| static struct option | long_options [] |
| Array of structures specifying the valid options for all coan commands. | |
| static char | opts [] |
Array in which we will assemble the shortopts arguments for getopts_long() More... | |
| static struct cmd_option | commands [] |
| Array of structures specifying the valid coan commands. | |
| static int const | source_cmd_exclusions [] |
Excluded options for the source command. More... | |
| static int const | symbols_cmd_exclusions [] |
Excluded options for the symbols command. More... | |
| static int const | includes_cmd_exclusions [] |
Excluded options for the includes command. More... | |
| static int const | directives_cmd_exclusions [] |
Excluded options for the directives command. More... | |
| static int const | defs_cmd_exclusions [] |
Excluded options for the defs command. More... | |
| static int const | pragmas_cmd_exclusions [] |
Excluded options for the pragmas command. More... | |
| static int const | errors_cmd_exclusions [] |
Excluded options for the errors command. More... | |
| static int const | lines_cmd_exclusions [] |
Excluded options for the lines command. More... | |
| static int const | spin_cmd_exclusions [] |
Excluded options for the spin command. More... | |
| static struct exclusion_list const | cmd_exclusion_lists [] |
| Array of exclusion lists for the coan commands, indexed by command code. | |
| static struct cmd_option * | _command_ = nullptr |
| Pointer to the details of the operative coan command. | |
| static std::string | _exec_path_ |
argv[0] | |
| static std::string | _prog_name_ |
Filename element of exec_path | |
| static std::string | _backup_suffix_ |
| Suffix for backup files. | |
| static bool | _got_opts_ = false |
| Have we got all commandline options? | |
| static bool | _replace_ = false |
| Do we replace input files with output files? | |
| static bool | _list_locate_ = false |
| Do we report file and line numbers for listed items? | |
| static bool | _list_only_once_ = false |
| Do we report only the first occurrence of listed items? | |
| static bool | _list_once_per_file_ = false |
| Do we report only the first occurrence per file of listed items? | |
| static bool | _list_only_active_ = false |
| Do we list items only from kept lines? | |
| static bool | _list_only_inactive_ = false |
| Do list items only from dropped lines? | |
| static bool | _list_symbols_in_ifs_ = false |
| Do we list symbols in `#if/else/endif directives? | |
| static bool | _list_symbols_in_defs_ = false |
Do we list symbols in #define directives? | |
| static bool | _list_symbols_in_undefs_ = false |
Do we list symbols in #undef directives? | |
| static bool | _list_symbols_in_includes_ = false |
Do we list symbols in #include directives? | |
| static bool | _list_symbols_in_lines_ = false |
Do we list symbols in #line directives? | |
| static bool | _list_system_includes_ = false |
Do we list system #include directives? | |
| static bool | _list_local_includes_ = false |
Do we list local #include directives? | |
| static bool | _complement_ = false |
| Are to output lines instead of dropping tem and vice versa? | |
| static bool | _eval_wip_ = false |
| Do we evaluate constants in truth-functional contexts or treat them as unknowns? | |
| static bool | _expand_references_ = false |
| Do we report the expansions of symbol references? | |
| static discard_policy | _discard_policy_ |
| Policy for discarding lines. | |
| static bool | _line_directives_ = false |
Do we output #line directives? | |
| static bool | _plaintext_ = false |
| Are we to omit parsing for comments? | |
| static bool | _recurse_ = false |
| Recurse into directories? | |
| static bool | _keepgoing_ = false |
| Continue to process input files after errors. | |
| static bool | _implicit_ = false |
Do we implicitly --undef all unconfigured symbols? | |
| static bool | _no_transients_ = false |
| static bool | _explain_references_ = false |
| Do we report the derivation of symbol resolutions? | |
| static bool | _selected_symbols_ = false |
| Is symbol reporting restricted to a selected set? | |
| static unsigned | _max_expansion_ = 4096 |
| Limit size for reported macro expansions. | |
| static int | _diagnostic_filter_ = 0 |
| Bitmask of diagnostic filters. | |
| static std::vector< std::string > | _argfile_argv_ |
Array of options read from --file ARGFILE | |
| static std::string | _memfile_ |
Read whole ARGFILE into this storage. | |
| static int | _cmd_line_files_ = 0 |
| The number of input files/dirs specified on the commandline. | |
| static bool | _parsing_file_ = false |
| Are we parsing an argsfile ? | |
Manages coan's commandline arguments.
Definition at line 98 of file options.cpp.
|
private |
Symbolic constants for the options of all coan commands.
|
staticprivate |
Add files to the input dataset.
| path | File or directory to be included in the input dataset. |
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 350 of file options.cpp.
|
staticprivate |
Configure diagnostic output.
Configure diagnostic outputs in response to a --gag or --verbose option.
| arg | Either "verbose" or an argument to the --gag option |
Definition at line 275 of file options.cpp.
|
staticprivate |
Raise a usage error when an option is invalid for the active command.
| cmd | Pointer to details of the active coan command. |
| bad_opt | The code of the invalid option. |
Definition at line 340 of file options.cpp.
|
staticprivate |
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 326 of file options.cpp.
|
static |
Analyse the class global state after parsing the commandline.
Diagnose any errors and draw final conclusions.
Definition at line 731 of file options.cpp.
|
staticprivate |
Assemble the shortopts arguments 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..
Definition at line 252 of file options.cpp.
|
inlinestatic |
|
static |
Parse the commandline.
| argc | The number of commandline arguments. |
| argv | Array of commandline arguments. |
Definition at line 705 of file options.cpp.
|
staticprivate |
Parse the options to the active coan command.
| argc | The number of arguments to be parsed. |
| argv | The array of arguments to be parsed. |
Definition at line 382 of file options.cpp.
|
static |
Parse the full and short names of the executable.
Element 0 of argv is parsed to store the pathname and filename of our executable.
| argv | The array of commandline arguments. |
Definition at line 694 of file options.cpp.
|
staticprivate |
Parse commandline options from a file.
Parse commandline options specified with the --file option.
| argsfile | Name of the file from which to read options. |
Options are separated by whitespace in the file.
Definition at line 669 of file options.cpp.
|
staticprivate |
|
staticprivate |
Excluded options for the defs command.
|
staticprivate |
Excluded options for the directives command.
|
staticprivate |
Excluded options for the errors command.
|
staticprivate |
Excluded options for the includes command.
|
staticprivate |
Excluded options for the lines command.
|
staticprivate |
|
staticprivate |
Excluded options for the pragmas command.
|
staticprivate |
Excluded options for the source command.
|
staticprivate |
Excluded options for the spin command.
|
staticprivate |
Excluded options for the symbols command.