twa_graph: add support for universal initial states

The only missing point is that the HOA parser cannot deal with multiple
universal initial states, as seen in parseaut.test.

* spot/graph/graph.hh (new_univ_dests): New function, extracted from...
(new_univ_edge): ... this one.
* spot/twa/twagraph.hh (set_univ_init_state): Implement using
new_univ_dests.
* spot/twaalgos/dot.cc, spot/twaalgos/hoa.cc, python/spot/impl.i:
Add support for universal initial states.
* spot/parseaut/parseaut.yy: Add preliminary support for
universal initial states.  Multiple universal initial states
are still not supported.
* tests/core/alternating.test, tests/core/parseaut.test,
tests/python/alternating.py: Adjust tests and exercise this new feature.
This commit is contained in:
Alexandre Duret-Lutz 2016-11-30 14:22:44 +01:00
parent d5c9c34514
commit 48c812a595
9 changed files with 193 additions and 88 deletions

View file

@ -360,6 +360,19 @@ namespace spot
return bdd_format_formula(aut_->get_dict(), label);
}
void
print_dst(int dst, const char* style = nullptr)
{
os_ << " " << dst << " [label=<>,width=0,height=0,shape=none]\n";
for (unsigned d: aut_->univ_dests(dst))
{
os_ << " " << dst << " -> " << d;
if (style && *style)
os_ << " [" << style << ']';
os_ << '\n';
}
}
void
start()
{
@ -444,7 +457,17 @@ namespace spot
os_ << " " << extra << '\n';
os_ << " I [label=\"\", style=invis, ";
os_ << (opt_vertical_ ? "height" : "width");
os_ << "=0]\n I -> " << aut_->get_init_state_number() << '\n';
int init = (int) aut_->get_init_state_number();
os_ << "=0]\n I -> " << init;
if (init >= 0)
{
os_ << '\n';
}
else
{
os_ << " [dir=none]\n";
print_dst(init);
}
}
void
@ -608,17 +631,7 @@ namespace spot
os_ << ", dir=none";
os_ << "]\n";
if ((int)t.dst < 0) // Universal destination
{
os_ << " " << (int)t.dst
<< "[label=<>,width=0,height=0,shape=none]\n";
for (unsigned d: aut_->univ_dests(t))
{
os_ << " " << (int)t.dst << " -> " << d;
if (!highlight.empty())
os_ << " [" << highlight << ']';
os_ << '\n';
}
}
print_dst(t.dst, highlight.c_str());
}
void print(const const_twa_graph_ptr& aut)