dot: add support for option +N
* src/twaalgos/dot.cc: Here. * NEWS, src/bin/common_aoutput.cc: Document it. * wrap/python/tests/automata.ipynb: Test it.
This commit is contained in:
parent
f86beb3c68
commit
b3ff5655fb
4 changed files with 41 additions and 19 deletions
|
|
@ -84,7 +84,7 @@ static const argp_option options[] =
|
|||
{
|
||||
/**************************************************/
|
||||
{ nullptr, 0, nullptr, 0, "Output format:", 3 },
|
||||
{ "dot", OPT_DOT, "1|a|b|B|c|e|f(FONT)|h|n|N|o|r|R|s|t|v",
|
||||
{ "dot", OPT_DOT, "1|a|b|B|c|e|f(FONT)|h|n|N|o|r|R|s|t|v|+INT",
|
||||
OPTION_ARG_OPTIONAL,
|
||||
"GraphViz's format (default). Add letters for "
|
||||
"(1) force numbered states, "
|
||||
|
|
@ -96,7 +96,8 @@ static const argp_option options[] =
|
|||
"(o) ordered transitions, "
|
||||
"(r) rainbow colors for acceptance sets, "
|
||||
"(R) color acceptance sets by Inf/Fin, (s) with SCCs, "
|
||||
"(t) force transition-based acceptance.", 0 },
|
||||
"(t) force transition-based acceptance, "
|
||||
"(+INT) add INT to all set numbers", 0 },
|
||||
{ "hoaf", 'H', "i|l|m|s|t|v", OPTION_ARG_OPTIONAL,
|
||||
"Output the automaton in HOA format. Add letters to select "
|
||||
"(i) use implicit labels for complete deterministic automata, "
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ namespace spot
|
|||
bool opt_all_bullets = false;
|
||||
bool opt_numbered_trans = false;
|
||||
bool opt_want_state_names_ = true;
|
||||
unsigned opt_shift_sets_ = 0;
|
||||
std::string opt_font_;
|
||||
|
||||
const char* const palette9[9] =
|
||||
|
|
@ -112,6 +113,16 @@ namespace spot
|
|||
parse_opts(def.c_str());
|
||||
break;
|
||||
}
|
||||
case '+':
|
||||
{
|
||||
char* end;
|
||||
opt_shift_sets_ = strtoul(options, &end, 10);
|
||||
if (options == end)
|
||||
throw std::runtime_error
|
||||
("missing number after '+' in print_dot() options");
|
||||
options = end;
|
||||
break;
|
||||
}
|
||||
case '1':
|
||||
opt_want_state_names_ = false;
|
||||
break;
|
||||
|
|
@ -189,6 +200,7 @@ namespace spot
|
|||
void
|
||||
output_set(std::ostream& os, int v) const
|
||||
{
|
||||
v += opt_shift_sets_;
|
||||
if (opt_bullet && (v >= 0) & (v <= MAX_BULLET))
|
||||
{
|
||||
static const char* const tab[MAX_BULLET + 1] = {
|
||||
|
|
@ -228,7 +240,7 @@ namespace spot
|
|||
html_set_color(int v) const
|
||||
{
|
||||
if (opt_rainbow)
|
||||
return palette[v % palette_mod];
|
||||
return palette[(v + opt_shift_sets_) % palette_mod];
|
||||
// Color according to Fin/Inf
|
||||
if (inf_sets_.has(v))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue