Using double borders for acceptance states in SBAs.

* src/tgbaalgos/dotty.hh (dotty_reachable): Take a new
assume_sba argument.
* src/tgbaalgos/dotty.cc (dotty_bfs): Take a new
mark_accepting_states arguments.
(dotty_bfs::process_state): Check if a state is accepting using
the state_is_accepting() method for tgba_sba_proxies, or by
looking at the first outgoing transition of the state.  Pass
the result to the dectorator.
(dotty_reachable): Adjust function.
* src/tgbaalgos/dottydec.hh, src/tgbaalgos/dottydec.cc,
src/tgbaalgos/rundotdec.hh, src/tgbaalgos/rundotdec.cc
(state_decl): Add an "accepting" argument, and use it to
decorate accepting states with a double border.
* src/tgbatest/ltl2tgba.cc: Keep track of whether the output
is an SBA or not, so that we can tell it to dotty().
* wrap/python/ajax/spot.in: Likewise.
* wrap/python/cgi-bin/ltl2tgba.in: Likewise.
This commit is contained in:
Alexandre Duret-Lutz 2011-03-04 21:06:02 +01:00
parent 2c5bae3d37
commit e1ef47d975
10 changed files with 151 additions and 47 deletions

View file

@ -1,3 +1,5 @@
// Copyright (C) 2011 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
@ -25,6 +27,7 @@
#include "tgba/bddprint.hh"
#include "reachiter.hh"
#include "misc/escape.hh"
#include "tgba/tgbatba.hh"
namespace spot
{
@ -33,8 +36,11 @@ namespace spot
class dotty_bfs : public tgba_reachable_iterator_breadth_first
{
public:
dotty_bfs(std::ostream& os, const tgba* a, dotty_decorator* dd)
: tgba_reachable_iterator_breadth_first(a), os_(os), dd_(dd)
dotty_bfs(std::ostream& os, const tgba* a, bool mark_accepting_states,
dotty_decorator* dd)
: tgba_reachable_iterator_breadth_first(a), os_(os),
mark_accepting_states_(mark_accepting_states), dd_(dd),
sba_(dynamic_cast<const tgba_sba_proxy*>(a))
{
}
@ -55,9 +61,31 @@ namespace spot
void
process_state(const state* s, int n, tgba_succ_iterator* si)
{
bool accepting;
if (mark_accepting_states_)
{
if (sba_)
{
accepting = sba_->state_is_accepting(s);
}
else
{
si->first();
accepting = ((!si->done())
&& (si->current_acceptance_conditions() ==
automata_->all_acceptance_conditions()));
}
}
else
{
accepting = false;
}
os_ << " " << n << " "
<< dd_->state_decl(automata_, s, n, si,
escape_str(automata_->format_state(s)))
escape_str(automata_->format_state(s)),
accepting)
<< std::endl;
}
@ -80,14 +108,17 @@ namespace spot
private:
std::ostream& os_;
bool mark_accepting_states_;
dotty_decorator* dd_;
const tgba_sba_proxy* sba_;
};
}
std::ostream&
dotty_reachable(std::ostream& os, const tgba* g, dotty_decorator* dd)
dotty_reachable(std::ostream& os, const tgba* g,
bool assume_sba, dotty_decorator* dd)
{
dotty_bfs d(os, g, dd);
dotty_bfs d(os, g, assume_sba, dd);
d.run();
return os;
}