Commit 51309cf7 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

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.
parent b1cdab6f
...@@ -51,9 +51,10 @@ static const argp_option options[] = ...@@ -51,9 +51,10 @@ static const argp_option options[] =
{ {
/**************************************************/ /**************************************************/
{ 0, 0, 0, 0, "Output format:", 3 }, { 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 " "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, " "(c) circular nodes, (f(FONT)) use FONT, (h) horizontal layout, "
"(v) vertical layout, (n) with name, (N) without name, " "(v) vertical layout, (n) with name, (N) without name, "
"(o) ordered transitions, " "(o) ordered transitions, "
......
...@@ -73,9 +73,10 @@ static const argp_option options[] = ...@@ -73,9 +73,10 @@ static const argp_option options[] =
"of the given property)", 0 }, "of the given property)", 0 },
/**************************************************/ /**************************************************/
{ 0, 0, 0, 0, "Output format:", 3 }, { 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 " "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, " "(c) circular nodes, (f(FONT)) use FONT, (h) horizontal layout, "
"(v) vertical layout, (n) with name, (N) without name, " "(v) vertical layout, (n) with name, (N) without name, "
"(o) ordered transitions, " "(o) ordered transitions, "
......
...@@ -84,6 +84,7 @@ namespace spot ...@@ -84,6 +84,7 @@ namespace spot
case 'v': case 'v':
opt_horizontal_ = false; opt_horizontal_ = false;
break; break;
case '1':
case 'a': case 'a':
case 'b': case 'b':
case 'n': case 'n':
......
...@@ -510,6 +510,28 @@ EOF ...@@ -510,6 +510,28 @@ EOF
$autfilt --dot=bao in >out $autfilt --dot=bao in >out
diff out expected diff out expected
cat >expected2 <<EOF
digraph G {
rankdir=LR
label="Fin(⓿) | (Fin(❶) & Inf(❷)) | Fin(❸)"
labelloc="t"
I [label="", style=invis, width=0]
0 [label="0"]
1 [label="1\n⓿❸"]
2 [label="2\n⓿❷❸"]
3 [label="3\n❸"]
4 [label="4\n❷❸"]
5 [label="5\n❶❸"]
6 [label="6\n⓿"]
7 [label="7\n⓿❷"]
8 [label="8\n⓿❸"]
9 [label="9\n⓿❷❸"]
}
EOF
# This should remove the state names
$autfilt --dot=bao1 in | grep -v '>' >out
diff out expected2
# Let's pretend that this is some used supplied input, as discussed in # Let's pretend that this is some used supplied input, as discussed in
# the comments of https://github.com/adl/hoaf/issues/39 # the comments of https://github.com/adl/hoaf/issues/39
......
...@@ -53,7 +53,7 @@ namespace spot ...@@ -53,7 +53,7 @@ namespace spot
bool opt_scc_ = false; bool opt_scc_ = false;
bool opt_html_labels_ = false; bool opt_html_labels_ = false;
const_twa_graph_ptr aut_; const_twa_graph_ptr aut_;
std::vector<std::string>* sn_; std::vector<std::string>* sn_ = nullptr;
std::string* name_ = nullptr; std::string* name_ = nullptr;
acc_cond::mark_t inf_sets_ = 0U; acc_cond::mark_t inf_sets_ = 0U;
acc_cond::mark_t fin_sets_ = 0U; acc_cond::mark_t fin_sets_ = 0U;
...@@ -61,6 +61,7 @@ namespace spot ...@@ -61,6 +61,7 @@ namespace spot
bool opt_bullet = false; bool opt_bullet = false;
bool opt_all_bullets = false; bool opt_all_bullets = false;
bool opt_numbered_trans = false; bool opt_numbered_trans = false;
bool opt_want_state_names_ = true;
std::string opt_font_; std::string opt_font_;
const char* const palette9[9] = const char* const palette9[9] =
...@@ -107,6 +108,9 @@ namespace spot ...@@ -107,6 +108,9 @@ namespace spot
parse_opts(def.c_str()); parse_opts(def.c_str());
break; break;
} }
case '1':
opt_want_state_names_ = false;
break;
case 'a': case 'a':
opt_show_acc_ = true; opt_show_acc_ = true;
break; break;
...@@ -436,7 +440,8 @@ namespace spot ...@@ -436,7 +440,8 @@ namespace spot
void print(const const_twa_graph_ptr& aut) void print(const const_twa_graph_ptr& aut)
{ {
aut_ = aut; aut_ = aut;
sn_ = aut->get_named_prop<std::vector<std::string>>("state-names"); if (opt_want_state_names_)
sn_ = aut->get_named_prop<std::vector<std::string>>("state-names");
if (opt_name_) if (opt_name_)
name_ = aut_->get_named_prop<std::string>("automaton-name"); name_ = aut_->get_named_prop<std::string>("automaton-name");
mark_states_ = !opt_force_acc_trans_ && aut_->has_state_based_acc(); mark_states_ = !opt_force_acc_trans_ && aut_->has_state_based_acc();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment