From 51309cf7426ff6c381a505eb4d842098e96edb06 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 28 Apr 2015 16:45:57 +0200 Subject: [PATCH] dot: --dot=1 to ignore names and force numbered states Fixes #78. * src/twaalgos/dotty.cc: Add option '1'. * src/taalgos/dotty.cc: Ignore '1'. * src/bin/dstar2tgba.cc, src/bin/common_aoutput.cc: Document it. * src/tests/readsave.test: Test it. --- src/bin/common_aoutput.cc | 5 +++-- src/bin/dstar2tgba.cc | 5 +++-- src/taalgos/dotty.cc | 1 + src/tests/readsave.test | 22 ++++++++++++++++++++++ src/twaalgos/dotty.cc | 9 +++++++-- 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/bin/common_aoutput.cc b/src/bin/common_aoutput.cc index 3582b0310..7f3f1b067 100644 --- a/src/bin/common_aoutput.cc +++ b/src/bin/common_aoutput.cc @@ -51,9 +51,10 @@ static const argp_option options[] = { /**************************************************/ { 0, 0, 0, 0, "Output format:", 3 }, - { "dot", OPT_DOT, "a|b|c|f(FONT)|h|n|N|r|R|s|t|v", OPTION_ARG_OPTIONAL, + { "dot", OPT_DOT, "1|a|b|c|f(FONT)|h|n|N|o|r|R|s|t|v", OPTION_ARG_OPTIONAL, "GraphViz's format (default). Add letters for " - "(a) acceptance display, (b) acceptance sets as bullets," + "(1) force numbered states, " + "(a) acceptance display, (b) acceptance sets as bullets, " "(c) circular nodes, (f(FONT)) use FONT, (h) horizontal layout, " "(v) vertical layout, (n) with name, (N) without name, " "(o) ordered transitions, " diff --git a/src/bin/dstar2tgba.cc b/src/bin/dstar2tgba.cc index b01236433..a0fc1461b 100644 --- a/src/bin/dstar2tgba.cc +++ b/src/bin/dstar2tgba.cc @@ -73,9 +73,10 @@ static const argp_option options[] = "of the given property)", 0 }, /**************************************************/ { 0, 0, 0, 0, "Output format:", 3 }, - { "dot", OPT_DOT, "a|b|c|f(FONT)|h|n|N|r|R|s|t|v", OPTION_ARG_OPTIONAL, + { "dot", OPT_DOT, "1|a|b|c|f(FONT)|h|n|N|o|r|R|s|t|v", OPTION_ARG_OPTIONAL, "GraphViz's format (default). Add letters for " - "(a) acceptance display, (b) acceptance sets as bullets," + "(1) force numbered states, " + "(a) acceptance display, (b) acceptance sets as bullets, " "(c) circular nodes, (f(FONT)) use FONT, (h) horizontal layout, " "(v) vertical layout, (n) with name, (N) without name, " "(o) ordered transitions, " diff --git a/src/taalgos/dotty.cc b/src/taalgos/dotty.cc index f5c5c8ccc..a88dda07d 100644 --- a/src/taalgos/dotty.cc +++ b/src/taalgos/dotty.cc @@ -84,6 +84,7 @@ namespace spot case 'v': opt_horizontal_ = false; break; + case '1': case 'a': case 'b': case 'n': diff --git a/src/tests/readsave.test b/src/tests/readsave.test index 2cb5af747..1fe6acfe2 100755 --- a/src/tests/readsave.test +++ b/src/tests/readsave.test @@ -510,6 +510,28 @@ EOF $autfilt --dot=bao in >out diff out expected +cat >expected2 <' >out +diff out expected2 # Let's pretend that this is some used supplied input, as discussed in # the comments of https://github.com/adl/hoaf/issues/39 diff --git a/src/twaalgos/dotty.cc b/src/twaalgos/dotty.cc index ee02d9740..c40b1d328 100644 --- a/src/twaalgos/dotty.cc +++ b/src/twaalgos/dotty.cc @@ -53,7 +53,7 @@ namespace spot bool opt_scc_ = false; bool opt_html_labels_ = false; const_twa_graph_ptr aut_; - std::vector* sn_; + std::vector* sn_ = nullptr; std::string* name_ = nullptr; acc_cond::mark_t inf_sets_ = 0U; acc_cond::mark_t fin_sets_ = 0U; @@ -61,6 +61,7 @@ namespace spot bool opt_bullet = false; bool opt_all_bullets = false; bool opt_numbered_trans = false; + bool opt_want_state_names_ = true; std::string opt_font_; const char* const palette9[9] = @@ -107,6 +108,9 @@ namespace spot parse_opts(def.c_str()); break; } + case '1': + opt_want_state_names_ = false; + break; case 'a': opt_show_acc_ = true; break; @@ -436,7 +440,8 @@ namespace spot void print(const const_twa_graph_ptr& aut) { aut_ = aut; - sn_ = aut->get_named_prop>("state-names"); + if (opt_want_state_names_) + sn_ = aut->get_named_prop>("state-names"); if (opt_name_) name_ = aut_->get_named_prop("automaton-name"); mark_states_ = !opt_force_acc_trans_ && aut_->has_state_based_acc();