aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2021-03-30 13:48:36 +0300
committerSergey Poznyakoff <gray@gnu.org>2021-03-30 13:57:51 +0300
commit534aebc175415f7acadc6331c94b8ffddfe7ca48 (patch)
tree614dc7706370bf05e76cf9da5fb7d2d5f5326ade /src/main.c
parentd3699cb19782ca87bad9e6e57db915a7b094746a (diff)
downloadcflow-534aebc175415f7acadc6331c94b8ffddfe7ca48.tar.gz
cflow-534aebc175415f7acadc6331c94b8ffddfe7ca48.tar.bz2
Accept multiple start symbols
* doc/cflow.texi: Document changes. * src/cflow.h (symbol_start): New flag. (install_starter,set_default_starter,clear_starters) (first_starter,next_starter): New protos. * src/main.c (no_main_option): New static; (start_name): Remove. (main): Change handling of the --main and --no-main options. * src/output.c (tree_output): Iterate over all defined starter symbols. * src/parser.c (get_symbol): Special handling for symbol_start. * src/symbol.c (install_starter,set_default_starter,clear_starters) (first_starter,next_starter): New functions.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 61dba8e..e6875e9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -196,6 +196,8 @@ int emacs_option; /* Format and check for use with Emacs cflow-mode */
int omit_arguments_option; /* Omit arguments from function declaration string */
int omit_symbol_names_option; /* Omit symbol name from symbol declaration string */
+static int no_main_option;
+
#define SM_FUNCTIONS 0x0001
#define SM_DATA 0x0002
#define SM_STATIC 0x0004
@@ -218,7 +220,6 @@ char *level_begin = "";
int preprocess_option = 0; /* Do they want to preprocess sources? */
-char *start_name = "main"; /* Name of start symbol */
int all_functions;
struct linked_list *arglist; /* List of command line arguments */
@@ -620,10 +621,11 @@ parse_opt (int key, char *arg, struct argp_state *state)
print_levels = 0;
break;
case 'm':
- start_name = strdup(arg);
+ install_starter(arg);
break;
case OPT_NO_MAIN:
- start_name = NULL;
+ clear_starters();
+ no_main_option = 1;
break;
case 'n':
print_line_numbers = 1;
@@ -786,6 +788,9 @@ main(int argc, char **argv)
if (argp_parse(&argp, argc, argv, ARGP_IN_ORDER, &index, NULL))
exit(EX_USAGE);
+ if (!no_main_option)
+ set_default_starter();
+
if (print_option == 0)
print_option = PRINT_TREE;

Return to:

Send suggestions and report system problems to the System administrator.