* src/ltlvisit/clone.cc (clone): New const version.

* src/ltlvisit/clone.hh (clone): Likewise.
* src/ltlvisit/destroy.cc (destroy): New const version.
* src/ltlvisit/destroy.hh (destroy): Likewise.
* src/tgba/tgbabddconcretefactory.cc
(tgba_bdd_concrete_factory::create_state,
tgba_bdd_concrete_factory::create_atomic_prop,
tgba_bdd_concrete_factory::promise): Clone new formulae.
* src/tgba/tgbabdddict.cc (tgba_bdd_dict::tgba_bdd_dict,
tgba_bdd_dict::~tgba_bdd_dict, tgba_bdd_dict::operator=): New methods
that clone and destroy formulae.
* src/tgbatest/ltl2tgba.test, src/tgbatest/ltl2tgba.cc: New files.
* src/tgbatest/Makefile.am (check_PROGRAMS): Add ltl2tgba.
(ltl2tgba_SOURCES): New variable.
(TESTS): Add ltl2tgba.test.
This commit is contained in:
Alexandre Duret-Lutz 2003-06-06 12:45:11 +00:00
parent 578fa26cf3
commit 3991a51a17
12 changed files with 170 additions and 6 deletions

59
src/tgbatest/ltl2tgba.cc Normal file
View file

@ -0,0 +1,59 @@
#include <iostream>
#include <cassert>
#include "ltlvisit/destroy.hh"
#include "ltlast/allnodes.hh"
#include "ltlparse/public.hh"
#include "tgba/ltl2tgba.hh"
#include "tgbaalgos/dotty.hh"
void
syntax(char* prog)
{
std::cerr << prog << " [-d] formula" << std::endl;
exit(2);
}
int
main(int argc, char** argv)
{
int exit_code = 0;
if (argc < 2)
syntax(argv[0]);
bool debug = false;
int formula_index = 1;
if (!strcmp(argv[1], "-d"))
{
debug = true;
if (argc < 3)
syntax(argv[0]);
formula_index = 2;
}
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::ltl::parse_error_list pel;
spot::ltl::formula* f = spot::ltl::parse(argv[formula_index],
pel, env, debug);
exit_code =
spot::ltl::format_parse_errors(std::cerr, argv[formula_index], pel);
if (f)
{
spot::tgba_bdd_concrete a = spot::ltl_to_tgba(f);
spot::ltl::destroy(f);
spot::dotty_reachable(std::cout, a);
}
else
{
exit_code = 1;
}
assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);
assert(spot::ltl::multop::instance_count() == 0);
return exit_code;
}