Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions include/fsm/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ struct fsm_options {
*/
unsigned int always_hex:1;

/* use strongly-connected components names instead of state
* names */
unsigned int scc_names:1;

/* use state index names for state names */
unsigned int index_names:1;

/* for generated code, what kind of I/O API to generate */
enum fsm_io io;

Expand Down
12 changes: 11 additions & 1 deletion src/fsm/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ main(int argc, char *argv[])
{
int c;

while (c = getopt(argc, argv, "h" "acwXe:k:i:" "xpq:l:dmrt:"), c != -1) {
while (c = getopt(argc, argv, "h" "aCcwXe:k:i:" "xpq:l:dmrt:"), c != -1) {
switch (c) {
case 'a': opt.anonymous_states = 1; break;
case 'c': opt.consolidate_edges = 1; break;
Expand All @@ -333,6 +333,8 @@ main(int argc, char *argv[])
case 'e': opt.prefix = optarg; break;
case 'k': opt.io = io(optarg); break;

case 'C': opt.anonymous_states = 0;
opt.scc_names = 1; break;
case 'i':
iterations = strtoul(optarg, NULL, 10);
/* XXX: error handling */
Expand Down Expand Up @@ -534,6 +536,14 @@ main(int argc, char *argv[])
}
}

if (opt.scc_names) {
extern int fsm_label_epsilon_scc(struct fsm *fsm);
if (fsm_label_epsilon_scc(fsm) < 0) {
perror("fsm_label_epsilon_scc");
return EXIT_FAILURE;
}
}

if (print != NULL) {
print(stdout, fsm);
}
Expand Down
Loading