Display transition annotations in dotty output.

* src/tgbaalgos/dotty.cc (process_link): Call
transition_annotation().  Reported by Nikos Gorogiannis.
* src/tgba/tgba.hh (transition_annotation): More documentation.
This commit is contained in:
Alexandre Duret-Lutz 2011-11-17 18:36:23 +01:00
parent d573eb9b8d
commit 3010d7051b
4 changed files with 32 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2011-11-17 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Display transition annotations in dotty output.
* src/tgbaalgos/dotty.cc (process_link): Call
transition_annotation(). Reported by Nikos Gorogiannis.
* src/tgba/tgba.hh (transition_annotation): More documentation.
* NEWS: Mention this change.
2011-11-17 Alexandre Duret-Lutz <adl@lrde.epita.fr> 2011-11-17 Alexandre Duret-Lutz <adl@lrde.epita.fr>
* NEWS: Add an entry for the previous fix. * NEWS: Add an entry for the previous fix.

3
NEWS
View file

@ -16,6 +16,9 @@ New in spot 0.7.1a:
In that case, acceptance states are displayed with a double In that case, acceptance states are displayed with a double
circle. ltl2tgba (both command line and on-line) Use it to display circle. ltl2tgba (both command line and on-line) Use it to display
degeneralized automata. degeneralized automata.
- The dotty_reachable() function will also display transition
annotations (as returned by the tgba::transitition_annotation()).
This can be useful when displaying (small) state spaces.
- Identifiers used to name atomic proposition can contain dots. - Identifiers used to name atomic proposition can contain dots.
E.g.: X.Y is now an atomic proposition, while it was understood E.g.: X.Y is now an atomic proposition, while it was understood
as X&Y in previous versions. as X&Y in previous versions.

View file

@ -157,10 +157,19 @@ namespace spot
/// \brief Return a possible annotation for the transition /// \brief Return a possible annotation for the transition
/// pointed to by the iterator. /// pointed to by the iterator.
/// ///
/// Implementing this function is optional; the default annotation /// You may decide to use annotations when building a tgba class
/// it the empty string. /// that represents the state space of a model, for instance to
/// indicate how the tgba transitions relate to the original model
/// (e.g. the annotation could be the name of a PetriNet
/// transition, or the line number of some textual formalism).
/// ///
/// \param t a non-done tgba_succ_iterator for this automata /// Implementing this method is optional; the default annotation
/// is the empty string.
///
/// This method is used for instance in dotty_reachable(),
/// and replay_tgba_run().
///
/// \param t a non-done tgba_succ_iterator for this automaton
virtual std::string virtual std::string
transition_annotation(const tgba_succ_iterator* t) const; transition_annotation(const tgba_succ_iterator* t) const;

View file

@ -100,6 +100,14 @@ namespace spot
+ bdd_format_accset(automata_->get_dict(), + bdd_format_accset(automata_->get_dict(),
si->current_acceptance_conditions()); si->current_acceptance_conditions());
std::string s = automata_->transition_annotation(si);
if (!s.empty())
{
if (*label.rbegin() != '\n')
label += '\n';
label += s;
}
os_ << " " << in << " -> " << out << " " os_ << " " << in << " -> " << out << " "
<< dd_->link_decl(automata_, in_s, in, out_s, out, si, << dd_->link_decl(automata_, in_s, in, out_s, out, si,
escape_str(label)) escape_str(label))