aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2005-09-26 12:51:24 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2005-09-26 12:51:24 +0000
commit6635ff5bfd4a5c1e52e3e9666c080d296fc7231b (patch)
tree5d7719be4723759a6cbfb5cd637337aacf4669b9 /src/main.c
parent9ad5a64c8b1478abf6f629b7c06a0a6ab9c7efb2 (diff)
downloadcflow-6635ff5bfd4a5c1e52e3e9666c080d296fc7231b.tar.gz
cflow-6635ff5bfd4a5c1e52e3e9666c080d296fc7231b.tar.bz2
Use --no-OPTION instead of --OPTION=no
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c122
1 files changed, 85 insertions, 37 deletions
diff --git a/src/main.c b/src/main.c
index 0e2c6aa..a3f0178 100644
--- a/src/main.c
+++ b/src/main.c
@@ -25,10 +25,23 @@ const char *argp_program_version = "cflow (" PACKAGE_NAME ") " VERSION;
const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
-static char doc[] = N_("generate a program flowgraph");
-
-#define OPT_DEFINES 256
-#define OPT_LEVEL_INDENT 257
-#define OPT_DEBUG 258
-#define OPT_PREPROCESS 259
-#define OPT_NO_PREPROCESS 260
-#define OPT_EMACS 261
+/* TRANSLATORS: Please, preserve the vertical tabulation (^K character)
+ in this message */
+static char doc[] = N_("generate a program flowgraph\vThe effect of any option, not taking an argument, can be cancelled by prepending 'no-' to the corresponding long option name (e.g. --no-cpp cancels --cpp)");
+
+enum option_code {
+ OPT_DEFINES = 256,
+ OPT_LEVEL_INDENT,
+ OPT_DEBUG,
+ OPT_PREPROCESS,
+ OPT_NO_PREPROCESS,
+ OPT_EMACS,
+ OPT_NO_USE_INDENTATION,
+ OPT_NO_ANSI,
+ OPT_NO_TREE,
+ OPT_NO_BRIEF,
+ OPT_NO_EMACS,
+ OPT_NO_VERBOSE,
+ OPT_NO_NUMBER,
+ OPT_NO_PRINT_LEVEL,
+ OPT_NO_REVERSE
+};
@@ -40,8 +53,6 @@ static struct argp_option options[] = {
N_("Set the depth at which the flowgraph is cut off"), GROUP_ID+1 },
- { "include", 'i', N_("SPEC"), 0,
- N_("Control the number of included symbols. SPEC is a string consisting of characters, specifying what class of symbols to include in the output (see below)."), GROUP_ID+1 },
-
-
+ { "include", 'i', N_("CLASSES"), 0,
+ N_("Include specified classes of symbols (see below). Prepend CLASSES with ^ or - to exclude them from the output"), GROUP_ID+1 },
{ "format", 'f', N_("NAME"), 0,
- N_("Use given output format NAME. Valid names are gnu (default) and posix"),
+ N_("Use given output format NAME. Valid names are `gnu' (default) and `posix'"),
GROUP_ID+1 },
@@ -58,10 +69,3 @@ static struct argp_option options[] = {
- { NULL, 0, NULL, 0,
- N_("Valid SPEC symbols for --include option:"), GROUP_ID+2 },
- {" +", 0, NULL, OPTION_DOC|OPTION_NO_TRANS,
- N_("Include symbols denoted by the following letters (default)"),
- GROUP_ID+3 },
- {" - or ^", 0, NULL, OPTION_DOC|OPTION_NO_TRANS,
- N_("Exclude symbols denoted by the following letters"),
- GROUP_ID+3 },
+ { NULL, 0, NULL, 0, N_("Symbols classes for --include argument"), GROUP_ID+2 },
{" x", 0, NULL, OPTION_DOC|OPTION_NO_TRANS,
@@ -74,2 +78,3 @@ static struct argp_option options[] = {
N_("typedefs (for cross-references only)"), GROUP_ID+3 },
+
@@ -79,10 +84,14 @@ static struct argp_option options[] = {
N_("Parser control:"), GROUP_ID },
- { "use-indentation", 'S', N_("BOOL"), OPTION_ARG_OPTIONAL,
+ { "use-indentation", 'S', NULL, 0,
N_("Rely on indentation"), GROUP_ID+1 },
+ { "no-use-indentation", OPT_NO_USE_INDENTATION, NULL, OPTION_HIDDEN,
+ "", GROUP_ID+1 },
{ "ansi", 'a', NULL, 0,
N_("Assume input to be written in ANSI C"), GROUP_ID+1 },
+ { "no-ansi", OPT_NO_ANSI, NULL, OPTION_HIDDEN,
+ "", GROUP_ID+1 },
{ "pushdown", 'p', N_("NUMBER"), 0,
N_("Set initial token stack size to NUMBER"), GROUP_ID+1 },
- { "symbol", 's', N_("SYM:TYPE"), 0,
- N_("Make cflow believe the symbol SYM is of type TYPE. Valid types are: keyword (or kw), modifier, identifier, type, wrapper. Any unambiguous abbreviation of the above is also accepted"), GROUP_ID+1 },
+ { "symbol", 's', N_("SYMBOL:TYPE"), 0,
+ N_("Register SYMBOL with given TYPE. Valid types are: keyword (or kw), modifier, identifier, type, wrapper. Any unambiguous abbreviation of the above is also accepted"), GROUP_ID+1 },
{ "main", 'm', N_("NAME"), 0,
@@ -98,5 +107,5 @@ static struct argp_option options[] = {
{ "cpp", 0, NULL, OPTION_ALIAS, NULL, GROUP_ID+1 },
- { "no-preprocess", OPT_NO_PREPROCESS, NULL, 0,
- N_("Do not preprocess the sources"), GROUP_ID+1 },
- { "no-cpp", 0, NULL, OPTION_ALIAS, NULL, GROUP_ID+1 },
+ { "no-preprocess", OPT_NO_PREPROCESS, NULL, OPTION_HIDDEN,
+ "", GROUP_ID+1 },
+ { "no-cpp", 0, NULL, OPTION_ALIAS|OPTION_HIDDEN, NULL, GROUP_ID+1 },
#undef GROUP_ID
@@ -105,6 +114,10 @@ static struct argp_option options[] = {
N_("Output control:"), GROUP_ID },
- { "number", 'n', N_("BOOL"), OPTION_ARG_OPTIONAL,
+ { "number", 'n', NULL, 0,
N_("Print line numbers"), GROUP_ID+1 },
+ { "no-number", OPT_NO_NUMBER, NULL, OPTION_HIDDEN,
+ "", GROUP_ID+1 },
{ "print-level", 'l', NULL, 0,
N_("Print nesting level along with the call tree"), GROUP_ID+1 },
+ { "no-print-level", OPT_NO_PRINT_LEVEL, NULL, OPTION_HIDDEN,
+ "", GROUP_ID+1 },
{ "level-indent", OPT_LEVEL_INDENT, "STRING", 0,
@@ -113,6 +126,12 @@ static struct argp_option options[] = {
N_("Draw ASCII art tree"), GROUP_ID+1 },
- { "brief", 'b', N_("BOOL"), OPTION_ARG_OPTIONAL,
+ { "no-tree", OPT_NO_TREE, NULL, OPTION_HIDDEN,
+ "", GROUP_ID+1 },
+ { "brief", 'b', NULL, 0,
N_("Brief output"), GROUP_ID+1 },
+ { "no-brief", OPT_NO_BRIEF, NULL, OPTION_HIDDEN,
+ "", GROUP_ID+1 },
{ "emacs", OPT_EMACS, NULL, 0,
N_("Additionally format output for use with GNU Emacs"), GROUP_ID+1 },
+ { "no-emacs", OPT_NO_EMACS, NULL, OPTION_HIDDEN,
+ "", GROUP_ID+1 },
#undef GROUP_ID
@@ -123,2 +142,4 @@ static struct argp_option options[] = {
N_("Be verbose on output"), GROUP_ID+1 },
+ { "no-verbose", OPT_NO_VERBOSE, NULL, OPTION_HIDDEN,
+ "", GROUP_ID+1 },
{ "license", 'L', 0, 0,
@@ -199,4 +220,2 @@ Consptr arglist; /* List of command line arguments */
-#define boolean_value(arg) ((arg) ? ((arg)[0] == 'y' || (arg)[0] == 'Y') : 1)
-
/* Given the option_type array and (possibly abbreviated) option argument
@@ -393,3 +412,3 @@ parse_level_string(const char *str, char **return_ptr)
}
- num = strtol(str+1, &str, 10);
+ num = strtol(str+1, (char**)&str, 10);
c = p[-1];
@@ -487,2 +506,5 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;
+ case OPT_NO_ANSI:
+ strict_ansi = 0;
+ break;
case OPT_DEBUG:
@@ -498,3 +520,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
case 'S':
- use_indentation = boolean_value(arg);
+ use_indentation = 1;
+ break;
+ case OPT_NO_USE_INDENTATION:
+ use_indentation = 0;
break;
@@ -507,4 +532,12 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;
+ case OPT_NO_TREE:
+ print_as_tree = 0;
+ level_indent[0] = level_indent[1] = NULL;
+ level_end[0] = level_end[0] = NULL;
+ break;
case 'b':
- brief_listing = boolean_value(arg);
+ brief_listing = 1;
+ break;
+ case OPT_NO_BRIEF:
+ brief_listing = 0;
break;
@@ -515,3 +548,3 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;
- case OPT_DEFINES:
+ case OPT_DEFINES: /* FIXME: Not used. */
record_defines = 1;
@@ -521,2 +554,5 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;
+ case OPT_NO_EMACS:
+ emacs_option = 0;
+ break;
case 'f':
@@ -555,3 +591,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
print_levels = 1;
- break;
+ break;
+ case OPT_NO_PRINT_LEVEL:
+ print_levels = 0;
+ break;
case 'm':
@@ -560,3 +599,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
case 'n':
- print_line_numbers = boolean_value(arg);
+ print_line_numbers = 1;
+ break;
+ case OPT_NO_NUMBER:
+ print_line_numbers = 0;
break;
@@ -573,2 +615,5 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;
+ case OPT_NO_REVERSE:
+ reverse_tree = 0;
+ break;
case 's':
@@ -579,2 +624,5 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;
+ case OPT_NO_VERBOSE:
+ verbose = 0;
+ break;
case 'x':

Return to:

Send suggestions and report system problems to the System administrator.