ltlvisit: rename tostring.hh as print.hh and rename printer functions

This actually performs three related changes, but separating them
would be quite inconvenient.

1) rename tostring.hh to print.hh a welcome side-effect is that
I could fix several files that included this file for not reason.

2) de-overload some of the to_string functions, and rename them
as follow:

  to_string -> print_psl, print_sere, str_psl, str_sere
  to_utf8_string -> print_utf8_psl, print_utf8_sere,
                    str_utf8_psl, str_utf8_sere
  to_spin_string -> print_spin_ltl, str_spin_ltl
  to_wring_string -> print_wring_ltl, str_wing_ltl
  to_lbt_string -> print_lbt_ltl, str_lbt_ltl
  to_latex_string -> print_latex_psl, str_latex_psl
  to_sclatex_string -> print_sclatex_psl, str_sclatex_psl

Now it is clearer what these functions do, and their restrictions.

3) all those print_* functions now take the stream to write onto
as their first argument.  This fixes #88.

* src/ltlvisit/tostring.cc, src/ltlvisit/tostring.hh: Rename into...
* src/ltlvisit/print.cc, src/ltlvisit/print.hh: ... those, and make
the changes listed above.
* doc/org/tut01.org, src/bin/common_output.cc,
src/bin/common_trans.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc,
src/bin/ltlcross.cc, src/bin/ltldo.cc, src/bin/ltlfilt.cc,
src/bin/randltl.cc, src/ltlparse/ltlparse.yy,
src/ltlvisit/Makefile.am, src/ltlvisit/mark.cc,
src/ltlvisit/relabel.cc, src/ltlvisit/simplify.cc,
src/ltlvisit/snf.cc, src/ta/taexplicit.cc, src/ta/tgtaexplicit.cc,
src/taalgos/tgba2ta.cc, src/tests/equalsf.cc, src/tests/ltl2tgba.cc,
src/tests/ltlrel.cc, src/tests/randtgba.cc, src/tests/reduc.cc,
src/tests/syntimpl.cc, src/tests/tostring.cc, src/twa/bdddict.cc,
src/twa/bddprint.cc, src/twa/taatgba.cc, src/twa/taatgba.hh,
src/twa/twagraph.cc, src/twaalgos/compsusp.cc, src/twaalgos/lbtt.cc,
src/twaalgos/ltl2taa.cc, src/twaalgos/ltl2tgba_fm.cc,
src/twaalgos/neverclaim.cc, src/twaalgos/remprop.cc,
src/twaalgos/stats.cc, wrap/python/ajax/spot.in, wrap/python/spot.py,
wrap/python/spot_impl.i: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2015-06-04 22:56:57 +02:00
parent 0cf952e793
commit 8fb7b279f7
42 changed files with 365 additions and 312 deletions

View file

@ -23,8 +23,7 @@
#include <ostream>
#include <sstream>
#include <cassert>
#include <ltlvisit/tostring.hh>
#include <ltlvisit/tostring.hh>
#include <ltlvisit/print.hh>
#include <ltlast/atomic_prop.hh>
#include <ltlenv/defaultenv.hh>
#include "priv/bddalloc.hh"
@ -199,7 +198,7 @@ namespace spot
std::ostringstream s;
// FIXME: We could be smarter and reuse unused "$n" numbers.
s << ltl::to_string(i.f) << '$' << ++i.clone_counts;
ltl::print_psl(s, i.f) << '$' << ++i.clone_counts;
const ltl::formula* f =
ltl::atomic_prop::instance(s.str(),
ltl::default_environment::instance());
@ -378,10 +377,12 @@ namespace spot
os << (r.refs.empty() ? "Free" : "Anon");
break;
case acc:
os << "Acc[" << to_string(r.f) << ']';
os << "Acc[";
print_psl(os, r.f) << ']';
break;
case var:
os << "Var[" << to_string(r.f) << ']';
os << "Var[";
print_psl(os, r.f) << ']';
break;
}
if (!r.refs.empty())

View file

@ -24,7 +24,7 @@
#include <cassert>
#include <ostream>
#include "bddprint.hh"
#include "ltlvisit/tostring.hh"
#include "ltlvisit/print.hh"
#include "formula2bdd.hh"
#include "misc/minato.hh"
@ -40,12 +40,12 @@ namespace spot
static bool utf8;
static
std::ostream& print_ltl(const ltl::formula* f, std::ostream& o)
std::ostream& print_(std::ostream& o, const ltl::formula* f)
{
if (utf8)
ltl::to_utf8_string(f, o);
ltl::print_utf8_psl(o, f);
else
ltl::to_string(f, o);
ltl::print_psl(o, f);
return o;
}
@ -58,18 +58,18 @@ namespace spot
switch (ref.type)
{
case bdd_dict::var:
to_string(ref.f, o);
print_(o, ref.f);
break;
case bdd_dict::acc:
if (want_acc)
{
o << "Acc[";
print_ltl(ref.f, o) << ']';
print_(o, ref.f) << ']';
}
else
{
o << '"';
print_ltl(ref.f, o) << '"';
print_(o, ref.f) << '"';
}
break;
case bdd_dict::anon:
@ -173,7 +173,7 @@ namespace spot
bdd_print_formula(std::ostream& os, const bdd_dict_ptr& d, bdd b)
{
const ltl::formula* f = bdd_to_formula(b, d);
print_ltl(f, os);
print_(os, f);
f->destroy();
return os;
}

View file

@ -22,7 +22,7 @@
#include <iterator>
#include <iostream>
#include "twa/formula2bdd.hh"
#include "ltlvisit/tostring.hh"
#include "ltlvisit/print.hh"
#include "ltlvisit/clone.hh"
#include "taatgba.hh"
@ -360,7 +360,7 @@ namespace spot
std::string
taa_tgba_formula::label_to_string(const label_t& label) const
{
return ltl::to_string(label);
return ltl::str_psl(label);
}
const ltl::formula*

View file

@ -27,7 +27,6 @@
#include "ltlast/formula.hh"
#include "bdddict.hh"
#include "twa.hh"
#include "ltlvisit/tostring.hh"
namespace spot
{

View file

@ -19,7 +19,7 @@
#include "twagraph.hh"
#include "ltlast/constant.hh"
#include "ltlvisit/tostring.hh"
#include "ltlvisit/print.hh"
namespace spot
{
@ -38,7 +38,7 @@ namespace spot
auto f = n[i];
if (f)
{
(*v)[i] = to_string(f);
(*v)[i] = str_psl(f);
f->destroy();
}
}