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:
parent
0cf952e793
commit
8fb7b279f7
42 changed files with 365 additions and 312 deletions
|
|
@ -34,7 +34,7 @@
|
|||
#include "ltlvisit/nenoform.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlvisit/simplify.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
#include "ltlvisit/print.hh"
|
||||
|
||||
void
|
||||
syntax(char* prog)
|
||||
|
|
@ -165,8 +165,7 @@ main(int argc, char** argv)
|
|||
{
|
||||
std::cerr
|
||||
<< "Source and simplified formulae are not equivalent!\n";
|
||||
std::cerr
|
||||
<< "Simplified: " << spot::ltl::to_string(f1) << '\n';
|
||||
spot::ltl::print_psl(std::cerr << "Simplified: ", f1) << '\n';
|
||||
exit_code = 1;
|
||||
}
|
||||
|
||||
|
|
@ -188,8 +187,7 @@ main(int argc, char** argv)
|
|||
{
|
||||
std::cerr
|
||||
<< "Source and simplified formulae are not equivalent!\n";
|
||||
std::cerr
|
||||
<< "Simplified: " << spot::ltl::to_string(f1) << '\n';
|
||||
spot::ltl::print_psl(std::cerr << "Simplified: ", f1) << '\n';
|
||||
exit_code = 1;
|
||||
}
|
||||
|
||||
|
|
@ -211,8 +209,7 @@ main(int argc, char** argv)
|
|||
{
|
||||
std::cerr
|
||||
<< "Source and simplified formulae are not equivalent!\n";
|
||||
std::cerr
|
||||
<< "Simplified: " << spot::ltl::to_string(f1) << '\n';
|
||||
spot::ltl::print_psl(std::cerr << "Simplified: ", f1) << '\n';
|
||||
exit_code = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include <fstream>
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include "ltlvisit/tostring.hh"
|
||||
#include "ltlvisit/print.hh"
|
||||
#include "ltlvisit/apcollect.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlparse/public.hh"
|
||||
|
|
@ -1041,9 +1041,9 @@ checked_main(int argc, char** argv)
|
|||
if (display_reduced_form)
|
||||
{
|
||||
if (utf8_opt)
|
||||
std::cout << spot::ltl::to_utf8_string(f) << std::endl;
|
||||
print_utf8_psl(std::cout, f) << '\n';
|
||||
else
|
||||
std::cout << spot::ltl::to_string(f) << std::endl;
|
||||
print_psl(std::cout, f) << '\n';
|
||||
}
|
||||
// This helps ltl_to_tgba_fm() to order BDD variables in
|
||||
// a more natural way.
|
||||
|
|
@ -1470,7 +1470,7 @@ checked_main(int argc, char** argv)
|
|||
}
|
||||
|
||||
if (f)
|
||||
a->set_named_prop("automaton-name", new std::string(to_string(f)));
|
||||
a->set_named_prop("automaton-name", new std::string(str_psl(f)));
|
||||
|
||||
if (output != -1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include "ltlparse/public.hh"
|
||||
#include "ltlvisit/relabel.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
#include "ltlvisit/print.hh"
|
||||
|
||||
void
|
||||
syntax(char *prog)
|
||||
|
|
@ -47,15 +47,15 @@ main(int argc, char **argv)
|
|||
spot::ltl::relabeling_map* m = new spot::ltl::relabeling_map;
|
||||
const spot::ltl::formula* f2 = spot::ltl::relabel_bse(f1, spot::ltl::Pnn, m);
|
||||
f1->destroy();
|
||||
spot::ltl::to_string(f2, std::cout) << '\n';
|
||||
spot::ltl::print_psl(std::cout, f2) << '\n';
|
||||
|
||||
|
||||
typedef std::map<std::string, std::string> map_t;
|
||||
map_t sorted_map;
|
||||
for (spot::ltl::relabeling_map::const_iterator i = m->begin();
|
||||
i != m->end(); ++i)
|
||||
sorted_map[spot::ltl::to_string(i->first)] =
|
||||
spot::ltl::to_string(i->second);
|
||||
sorted_map[spot::ltl::str_psl(i->first)] =
|
||||
spot::ltl::str_psl(i->second);
|
||||
for (map_t::const_iterator i = sorted_map.begin();
|
||||
i != sorted_map.end(); ++i)
|
||||
std::cout << " " << i->first << " -> "
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#include "ltlparse/public.hh"
|
||||
#include "ltlvisit/apcollect.hh"
|
||||
#include "ltlvisit/randomltl.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
#include "ltlvisit/print.hh"
|
||||
#include "ltlvisit/length.hh"
|
||||
#include "ltlvisit/simplify.hh"
|
||||
#include "twaalgos/randomgraph.hh"
|
||||
|
|
@ -527,7 +527,7 @@ generate_formula(const spot::ltl::random_ltl& rl,
|
|||
<< "of size " << opt_l << " or more." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
std::string txt = spot::ltl::to_string(f);
|
||||
std::string txt = spot::ltl::str_psl(f);
|
||||
if (!opt_u || unique.insert(txt).second)
|
||||
{
|
||||
return f;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include <cstring>
|
||||
#include "ltlparse/public.hh"
|
||||
#include "ltlvisit/dump.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
#include "ltlvisit/print.hh"
|
||||
#include "ltlvisit/simplify.hh"
|
||||
#include "ltlvisit/length.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
|
@ -214,7 +214,7 @@ main(int argc, char** argv)
|
|||
ftmp1->destroy();
|
||||
|
||||
int length_f1_before = spot::ltl::length(f1);
|
||||
std::string f1s_before = spot::ltl::to_string(f1);
|
||||
std::string f1s_before = spot::ltl::str_psl(f1);
|
||||
std::string f1l;
|
||||
|
||||
const spot::ltl::formula* input_f = f1;
|
||||
|
|
@ -222,14 +222,14 @@ main(int argc, char** argv)
|
|||
if (!simp_size->are_equivalent(input_f, f1))
|
||||
{
|
||||
std::cerr << "Incorrect reduction from `" << f1s_before
|
||||
<< "' to `" << spot::ltl::to_string(f1) << "'."
|
||||
<< std::endl;
|
||||
<< "' to `";
|
||||
print_psl(std::cerr, f1) << "'.\n";
|
||||
exit_code = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
const spot::ltl::formula* maybe_larger = simp->simplify(input_f);
|
||||
f1l = spot::ltl::to_string(maybe_larger);
|
||||
f1l = spot::ltl::str_psl(maybe_larger);
|
||||
if (!simp->are_equivalent(input_f, maybe_larger))
|
||||
{
|
||||
std::cerr << "Incorrect reduction (reduce_size_strictly=0) from `"
|
||||
|
|
@ -242,7 +242,7 @@ main(int argc, char** argv)
|
|||
input_f->destroy();
|
||||
|
||||
int length_f1_after = spot::ltl::length(f1);
|
||||
std::string f1s_after = spot::ltl::to_string(f1);
|
||||
std::string f1s_after = spot::ltl::str_psl(f1);
|
||||
|
||||
std::string f2s = "";
|
||||
if (f2)
|
||||
|
|
@ -250,7 +250,7 @@ main(int argc, char** argv)
|
|||
ftmp1 = f2;
|
||||
f2 = simp_size->negative_normal_form(f2, false);
|
||||
ftmp1->destroy();
|
||||
f2s = spot::ltl::to_string(f2);
|
||||
f2s = spot::ltl::str_psl(f2);
|
||||
}
|
||||
|
||||
sum_before += length_f1_before;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "ltlvisit/lunabbrev.hh"
|
||||
#include "ltlvisit/tunabbrev.hh"
|
||||
#include "ltlvisit/dump.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
#include "ltlvisit/print.hh"
|
||||
#include "ltlvisit/simplify.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlvisit/nenoform.hh"
|
||||
|
|
@ -62,8 +62,8 @@ main(int argc, char** argv)
|
|||
const spot::ltl::formula* f1 = spot::ltl::negative_normal_form(ftmp1);
|
||||
const spot::ltl::formula* f2 = spot::ltl::negative_normal_form(ftmp2);
|
||||
|
||||
std::string f1s = spot::ltl::to_string(f1);
|
||||
std::string f2s = spot::ltl::to_string(f2);
|
||||
std::string f1s = spot::ltl::str_psl(f1);
|
||||
std::string f2s = spot::ltl::str_psl(f2);
|
||||
|
||||
int exit_return = 0;
|
||||
spot::ltl::ltl_simplifier* c = new spot::ltl::ltl_simplifier;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include "ltlparse/public.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
#include "ltlvisit/print.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
||||
void
|
||||
|
|
@ -49,8 +49,8 @@ main(int argc, char **argv)
|
|||
// The string generated from an abstract tree should be parsable
|
||||
// again.
|
||||
|
||||
std::string f1s = spot::ltl::to_string(f1);
|
||||
std::cout << f1s << std::endl;
|
||||
std::string f1s = spot::ltl::str_psl(f1);
|
||||
std::cout << f1s << '\n';
|
||||
|
||||
auto* f2 = spot::ltl::parse_infix_psl(f1s, p1);
|
||||
|
||||
|
|
@ -64,8 +64,8 @@ main(int argc, char **argv)
|
|||
|
||||
// It should also map to the same string.
|
||||
|
||||
std::string f2s = spot::ltl::to_string(f2);
|
||||
std::cout << f2s << std::endl;
|
||||
std::string f2s = spot::ltl::str_psl(f2);
|
||||
std::cout << f2s << '\n';
|
||||
|
||||
if (f2s != f1s)
|
||||
return 1;
|
||||
|
|
@ -76,5 +76,6 @@ main(int argc, char **argv)
|
|||
assert(spot::ltl::unop::instance_count() == 0);
|
||||
assert(spot::ltl::binop::instance_count() == 0);
|
||||
assert(spot::ltl::multop::instance_count() == 0);
|
||||
assert(spot::ltl::bunop::instance_count() == 0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue