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:
Alexandre Duret-Lutz 2015-11-14 14:49:31 +01:00
parent f86beb3c68
commit b3ff5655fb
4 changed files with 41 additions and 19 deletions

View file

@ -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))
{