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

@ -460,7 +460,7 @@ if output_type == 'f':
unbufprint(format_formula(f))
elif formula_format == 'i':
unbufprint('<div class="formula spin-format">'
+ spot.to_spin_string(f) + '</div>')
+ spot.str_spin_ltl(f) + '</div>')
if f.is_psl_formula() and not f.is_ltl_formula():
s = ''
if simpopt.reduce_size_strictly:
@ -470,12 +470,12 @@ if output_type == 'f':
if not f.is_ltl_formula():
unbufprint('<div class="error">PSL formulas cannot be expressed in this format.</div>')
else:
unbufprint('<div class="formula lbt-format">' + spot.to_lbt_string(f) + '</div>')
unbufprint('<div class="formula lbt-format">' + spot.str_lbt_ltl(f) + '</div>')
elif formula_format == 'g':
render_formula(f)
elif formula_format == 'p':
if utf8:
s = spot.to_utf8_string(f)
s = spot.str_utf8_psl(f)
else:
s = str(f)
unbufprint('Properties for ' + format_formula(f, 'span') + '<ul>\n')
@ -574,7 +574,7 @@ elif translator == 'l3':
l3opt.remove('-p')
args = ["@LTL3BA@", l3out]
args.extend(l3opt)
args.extend(['-f', spot.to_spin_string(f)])
args.extend(['-f', spot.str_spin_ltl(f)])
import subprocess
l3file = tmpdir + "/aut"
with open(l3file, "w+") as l3aut:

View file

@ -100,19 +100,19 @@ def _formula_str_ctor(self, str):
def _formula_to_str(self, format = 'spot', parenth = False):
if format == 'spot':
return to_string(self, parenth)
return str_psl(self, parenth)
elif format == 'spin':
return to_spin_string(self, parenth)
return str_spin_ltl(self, parenth)
elif format == 'utf8':
return to_utf8_string(self, parenth)
return str_utf8_psl(self, parenth)
elif format == 'lbt':
return to_lbt_string(self)
return str_lbt_ltl(self)
elif format == 'wring':
return to_wring_string(self)
return str_wring_ltl(self)
elif format == 'latex':
return to_latex_string(self, parenth)
return str_latex_psl(self, parenth)
elif format == 'sclatex':
return to_sclatex_string(self, parenth)
return str_sclatex_psl(self, parenth)
else:
raise ValueError("unknown string format: " + format)

View file

@ -101,8 +101,8 @@ namespace std {
#include "ltlvisit/dump.hh"
#include "ltlvisit/lunabbrev.hh"
#include "ltlvisit/nenoform.hh"
#include "ltlvisit/print.hh"
#include "ltlvisit/simplify.hh"
#include "ltlvisit/tostring.hh"
#include "ltlvisit/tunabbrev.hh"
#include "ltlvisit/randomltl.hh"
#include "ltlvisit/length.hh"
@ -243,8 +243,8 @@ using namespace spot;
%include "ltlvisit/dump.hh"
%include "ltlvisit/lunabbrev.hh"
%include "ltlvisit/nenoform.hh"
%include "ltlvisit/print.hh"
%include "ltlvisit/simplify.hh"
%include "ltlvisit/tostring.hh"
%include "ltlvisit/tunabbrev.hh"
%include "ltlvisit/randomltl.hh"
%include "ltlvisit/length.hh"
@ -336,12 +336,12 @@ spot::ltl::formula_ptr_less_than>;
size_t __hash__() { return self->hash(); }
std::string __repr__() { return spot::ltl::to_string(self); }
std::string __repr__() { return spot::ltl::str_psl(self); }
std::string _repr_latex_()
{
return std::string("$") + spot::ltl::to_sclatex_string(self) + '$';
return std::string("$") + spot::ltl::str_sclatex_psl(self) + '$';
}
std::string __str__() { return spot::ltl::to_string(self); }
std::string __str__() { return spot::ltl::str_psl(self); }
}
%extend spot::acc_cond::acc_code {