Commit 51151ab2 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

Handle all automata through shared_ptr. (monstro patch)

A type such as 'const tgba_digraph*' and 'tgba_digraph*' are replaced
by 'const_tgba_digraph_ptr' and 'tgba_digraph_ptr'.  Additionally 'new
tgba_digraph(...)' is replaced by 'make_tgba_digraph(...)'.

This convention is followed by all automata types. Those smart
pointers should normally be passed by const reference as input of
function to avoid the atomic increments/decrements, but I probably
missed a few, as this huge patch took me nearly 12h.

* src/kripke/fwd.hh, src/tgba/fwd.hh: New files.
* src/kripke/Makefile.am, src/tgba/Makefile.am: Adjust.
* iface/dve2/dve2.cc, iface/dve2/dve2.hh, iface/dve2/dve2check.cc,
src/bin/common_output.hh, src/bin/dstar2tgba.cc,
src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc, src/bin/ltlcross.cc,
src/bin/ltlfilt.cc, src/dstarparse/dra2ba.cc,
src/dstarparse/dstar2tgba.cc, src/dstarparse/dstarparse.yy,
src/dstarparse/nra2nba.cc, src/dstarparse/nsa2tgba.cc,
src/dstarparse/public.hh, src/graphtest/tgbagraph.cc,
src/kripke/fairkripke.hh, src/kripke/kripke.hh,
src/kripke/kripkeexplicit.cc, src/kripke/kripkeexplicit.hh,
src/kripke/kripkeprint.cc, src/kripke/kripkeprint.hh,
src/kripkeparse/kripkeparse.yy, src/kripkeparse/public.hh,
src/kripketest/parse_print_test.cc, src/ltlvisit/apcollect.cc,
src/ltlvisit/apcollect.hh, src/ltlvisit/contain.cc,
src/ltlvisit/contain.hh, src/neverparse/neverclaimparse.yy,
src/neverparse/public.hh, src/priv/accmap.hh,
src/priv/countstates.cc, src/priv/countstates.hh, src/saba/saba.hh,
src/saba/sabacomplementtgba.cc, src/saba/sabacomplementtgba.hh,
src/sabaalgos/sabadotty.cc, src/sabaalgos/sabadotty.hh,
src/sabaalgos/sabareachiter.cc, src/sabaalgos/sabareachiter.hh,
src/sabatest/sabacomplementtgba.cc, src/ta/ta.hh,
src/ta/taexplicit.cc, src/ta/taexplicit.hh, src/ta/taproduct.cc,
src/ta/taproduct.hh, src/ta/tgta.hh, src/ta/tgtaexplicit.cc,
src/ta/tgtaexplicit.hh, src/ta/tgtaproduct.cc,
src/ta/tgtaproduct.hh, src/taalgos/dotty.cc, src/taalgos/dotty.hh,
src/taalgos/emptinessta.cc, src/taalgos/emptinessta.hh,
src/taalgos/minimize.cc, src/taalgos/minimize.hh,
src/taalgos/reachiter.cc, src/taalgos/reachiter.hh,
src/taalgos/statessetbuilder.cc, src/taalgos/statessetbuilder.hh,
src/taalgos/stats.cc, src/taalgos/stats.hh, src/taalgos/tgba2ta.cc,
src/taalgos/tgba2ta.hh, src/tgba/bdddict.cc, src/tgba/bdddict.hh,
src/tgba/formula2bdd.hh, src/tgba/futurecondcol.cc,
src/tgba/futurecondcol.hh, src/tgba/taatgba.hh, src/tgba/tgba.cc,
src/tgba/tgba.hh, src/tgba/tgbagraph.hh,
src/tgba/tgbakvcomplement.cc, src/tgba/tgbakvcomplement.hh,
src/tgba/tgbamask.cc, src/tgba/tgbamask.hh, src/tgba/tgbaproduct.cc,
src/tgba/tgbaproduct.hh, src/tgba/tgbaproxy.cc,
src/tgba/tgbaproxy.hh, src/tgba/tgbasafracomplement.cc,
src/tgba/tgbasafracomplement.hh, src/tgba/tgbascc.cc,
src/tgba/tgbascc.hh, src/tgba/tgbasgba.cc, src/tgba/tgbasgba.hh,
src/tgba/wdbacomp.cc, src/tgba/wdbacomp.hh,
src/tgbaalgos/bfssteps.cc, src/tgbaalgos/bfssteps.hh,
src/tgbaalgos/complete.cc, src/tgbaalgos/complete.hh,
src/tgbaalgos/compsusp.cc, src/tgbaalgos/compsusp.hh,
src/tgbaalgos/cycles.hh, src/tgbaalgos/degen.cc,
src/tgbaalgos/degen.hh, src/tgbaalgos/dotty.cc,
src/tgbaalgos/dotty.hh, src/tgbaalgos/dottydec.cc,
src/tgbaalgos/dottydec.hh, src/tgbaalgos/dtbasat.cc,
src/tgbaalgos/dtbasat.hh, src/tgbaalgos/dtgbacomp.cc,
src/tgbaalgos/dtgbacomp.hh, src/tgbaalgos/dtgbasat.cc,
src/tgbaalgos/dtgbasat.hh, src/tgbaalgos/dupexp.cc,
src/tgbaalgos/dupexp.hh, src/tgbaalgos/emptiness.cc,
src/tgbaalgos/emptiness.hh, src/tgbaalgos/gtec/gtec.cc,
src/tgbaalgos/gtec/gtec.hh, src/tgbaalgos/gtec/status.cc,
src/tgbaalgos/gtec/status.hh, src/tgbaalgos/gv04.cc,
src/tgbaalgos/gv04.hh, src/tgbaalgos/isdet.cc,
src/tgbaalgos/isdet.hh, src/tgbaalgos/isweakscc.cc,
src/tgbaalgos/lbtt.cc, src/tgbaalgos/lbtt.hh,
src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2taa.hh,
src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_fm.hh,
src/tgbaalgos/magic.cc, src/tgbaalgos/magic.hh,
src/tgbaalgos/minimize.cc, src/tgbaalgos/minimize.hh,
src/tgbaalgos/ndfs_result.hxx, src/tgbaalgos/neverclaim.cc,
src/tgbaalgos/neverclaim.hh, src/tgbaalgos/postproc.cc,
src/tgbaalgos/postproc.hh, src/tgbaalgos/powerset.cc,
src/tgbaalgos/powerset.hh, src/tgbaalgos/projrun.cc,
src/tgbaalgos/projrun.hh, src/tgbaalgos/randomgraph.cc,
src/tgbaalgos/randomgraph.hh, src/tgbaalgos/reachiter.cc,
src/tgbaalgos/reachiter.hh, src/tgbaalgos/reducerun.cc,
src/tgbaalgos/reducerun.hh, src/tgbaalgos/replayrun.cc,
src/tgbaalgos/replayrun.hh, src/tgbaalgos/rundotdec.cc,
src/tgbaalgos/rundotdec.hh, src/tgbaalgos/safety.cc,
src/tgbaalgos/safety.hh, src/tgbaalgos/save.cc,
src/tgbaalgos/save.hh, src/tgbaalgos/scc.cc, src/tgbaalgos/scc.hh,
src/tgbaalgos/sccfilter.cc, src/tgbaalgos/sccfilter.hh,
src/tgbaalgos/sccinfo.cc, src/tgbaalgos/sccinfo.hh,
src/tgbaalgos/se05.cc, src/tgbaalgos/se05.hh,
src/tgbaalgos/simulation.cc, src/tgbaalgos/simulation.hh,
src/tgbaalgos/stats.cc, src/tgbaalgos/stats.hh,
src/tgbaalgos/stripacc.cc, src/tgbaalgos/stripacc.hh,
src/tgbaalgos/tau03.cc, src/tgbaalgos/tau03.hh,
src/tgbaalgos/tau03opt.cc, src/tgbaalgos/tau03opt.hh,
src/tgbaalgos/translate.cc, src/tgbaalgos/translate.hh,
src/tgbaparse/public.hh, src/tgbaparse/tgbaparse.yy,
src/tgbatest/complementation.cc, src/tgbatest/explprod.cc,
src/tgbatest/ltl2tgba.cc, src/tgbatest/ltlprod.cc,
src/tgbatest/maskacc.cc, src/tgbatest/powerset.cc,
src/tgbatest/randtgba.cc, src/tgbatest/taatgba.cc,
src/tgbatest/tgbaread.cc, src/tgbatest/tripprod.cc,
wrap/python/ajax/spot.in, wrap/python/spot.i,
wrap/python/tests/interdep.py: Use shared pointers for automata.
parent ca85d418
...@@ -997,7 +997,7 @@ namespace spot ...@@ -997,7 +997,7 @@ namespace spot
} }
kripke* kripke_ptr
load_dve2(const std::string& file_arg, bdd_dict_ptr dict, load_dve2(const std::string& file_arg, bdd_dict_ptr dict,
const ltl::atomic_prop_set* to_observe, const ltl::atomic_prop_set* to_observe,
const ltl::formula* dead, const ltl::formula* dead,
...@@ -1112,6 +1112,6 @@ namespace spot ...@@ -1112,6 +1112,6 @@ namespace spot
return 0; return 0;
} }
return new dve2_kripke(d, dict, ps, dead, compress); return std::make_shared<dve2_kripke>(d, dict, ps, dead, compress);
} }
} }
...@@ -56,7 +56,7 @@ namespace spot ...@@ -56,7 +56,7 @@ namespace spot
// \a dead an atomic proposition or constant to use for looping on // \a dead an atomic proposition or constant to use for looping on
// dead states // dead states
// \a verbose whether to output verbose messages // \a verbose whether to output verbose messages
SPOT_API kripke* SPOT_API kripke_ptr
load_dve2(const std::string& file, bdd_dict_ptr dict, load_dve2(const std::string& file, bdd_dict_ptr dict,
const ltl::atomic_prop_set* to_observe, const ltl::atomic_prop_set* to_observe,
const ltl::formula* dead = ltl::constant::true_instance(), const ltl::formula* dead = ltl::constant::true_instance(),
......
...@@ -62,7 +62,7 @@ Options:\n\ ...@@ -62,7 +62,7 @@ Options:\n\
} }
int int
main(int argc, char **argv) checked_main(int argc, char **argv)
{ {
spot::timer_map tm; spot::timer_map tm;
...@@ -157,14 +157,14 @@ main(int argc, char **argv) ...@@ -157,14 +157,14 @@ main(int argc, char **argv)
spot::ltl::atomic_prop_set ap; spot::ltl::atomic_prop_set ap;
auto dict = spot::make_bdd_dict(); auto dict = spot::make_bdd_dict();
spot::kripke* model = 0; spot::const_kripke_ptr model = 0;
const spot::tgba* prop = 0; spot::const_tgba_ptr prop = 0;
spot::tgba* product = 0; spot::const_tgba_ptr product = 0;
spot::emptiness_check_instantiator* echeck_inst = 0; spot::emptiness_check_instantiator* echeck_inst = 0;
int exit_code = 0; int exit_code = 0;
const spot::ltl::formula* f = 0;
const spot::ltl::formula* deadf = 0;
spot::postprocessor post; spot::postprocessor post;
const spot::ltl::formula* deadf = 0;
const spot::ltl::formula* f = 0;
if (dead == 0 || !strcasecmp(dead, "true")) if (dead == 0 || !strcasecmp(dead, "true"))
{ {
...@@ -252,7 +252,7 @@ main(int argc, char **argv) ...@@ -252,7 +252,7 @@ main(int argc, char **argv)
goto safe_exit; goto safe_exit;
} }
product = new spot::tgba_product(model, prop); product = spot::product(model, prop);
if (output == DotProduct) if (output == DotProduct)
{ {
...@@ -362,9 +362,6 @@ main(int argc, char **argv) ...@@ -362,9 +362,6 @@ main(int argc, char **argv)
safe_exit: safe_exit:
delete echeck_inst; delete echeck_inst;
delete product;
delete prop;
delete model;
if (f) if (f)
f->destroy(); f->destroy();
...@@ -373,15 +370,24 @@ main(int argc, char **argv) ...@@ -373,15 +370,24 @@ main(int argc, char **argv)
if (use_timer) if (use_timer)
tm.print(std::cout); tm.print(std::cout);
tm.reset_all(); // This helps valgrind. tm.reset_all(); // This helps valgrind.
return exit_code;
}
int
main(int argc, char **argv)
{
auto exit_code = checked_main(argc, argv);
// Additional checks to debug reference counts in formulas.
spot::ltl::atomic_prop::dump_instances(std::cerr); spot::ltl::atomic_prop::dump_instances(std::cerr);
spot::ltl::unop::dump_instances(std::cerr); spot::ltl::unop::dump_instances(std::cerr);
spot::ltl::binop::dump_instances(std::cerr); spot::ltl::binop::dump_instances(std::cerr);
spot::ltl::multop::dump_instances(std::cerr); spot::ltl::multop::dump_instances(std::cerr);
spot::ltl::bunop::dump_instances(std::cerr);
assert(spot::ltl::atomic_prop::instance_count() == 0); assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0); assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0); assert(spot::ltl::binop::instance_count() == 0);
assert(spot::ltl::multop::instance_count() == 0); assert(spot::ltl::multop::instance_count() == 0);
assert(spot::ltl::bunop::instance_count() == 0);
exit(exit_code); exit(exit_code);
} }
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Développement // Copyright (C) 2012, 2013, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
...@@ -73,7 +73,8 @@ public: ...@@ -73,7 +73,8 @@ public:
} }
std::ostream& std::ostream&
print(const spot::tgba* aut, const spot::ltl::formula* f = 0, print(const spot::const_tgba_ptr& aut,
const spot::ltl::formula* f = 0,
double run_time = -1.) double run_time = -1.)
{ {
formula_ = f; formula_ = f;
......
...@@ -224,7 +224,8 @@ namespace ...@@ -224,7 +224,8 @@ namespace
/// The \a f argument is not needed if the Formula does not need /// The \a f argument is not needed if the Formula does not need
/// to be output. /// to be output.
std::ostream& std::ostream&
print(const spot::dstar_aut* daut, const spot::tgba* aut, print(const spot::const_dstar_aut_ptr& daut,
const spot::const_tgba_ptr& aut,
const char* filename, double run_time) const char* filename, double run_time)
{ {
filename_ = filename; filename_ = filename;
...@@ -292,17 +293,11 @@ namespace ...@@ -292,17 +293,11 @@ namespace
process_file(const char* filename) process_file(const char* filename)
{ {
spot::dstar_parse_error_list pel; spot::dstar_parse_error_list pel;
spot::dstar_aut* daut; auto daut = spot::dstar_parse(filename, pel, spot::make_bdd_dict());
daut = spot::dstar_parse(filename, pel, spot::make_bdd_dict());
if (spot::format_dstar_parse_errors(std::cerr, filename, pel)) if (spot::format_dstar_parse_errors(std::cerr, filename, pel))
{ return 2;
delete daut;
return 2;
}
if (!daut) if (!daut)
{ error(2, 0, "failed to read automaton from %s", filename);
error(2, 0, "failed to read automaton from %s", filename);
}
const xtime_t before = gethrxtime(); const xtime_t before = gethrxtime();
...@@ -336,8 +331,6 @@ namespace ...@@ -336,8 +331,6 @@ namespace
statistics.print(daut, aut, filename, conversion_time) << '\n'; statistics.print(daut, aut, filename, conversion_time) << '\n';
break; break;
} }
delete aut;
delete daut;
flush_cout(); flush_cout();
return 0; return 0;
} }
......
...@@ -214,7 +214,7 @@ namespace ...@@ -214,7 +214,7 @@ namespace
const char* filename = 0, int linenum = 0) const char* filename = 0, int linenum = 0)
{ {
const xtime_t before = gethrxtime(); const xtime_t before = gethrxtime();
const spot::tgba* aut = trans.run(&f); auto aut = trans.run(&f);
const xtime_t after = gethrxtime(); const xtime_t after = gethrxtime();
const double prec = XTIME_PRECISION; const double prec = XTIME_PRECISION;
const double translation_time = (after - before) / prec; const double translation_time = (after - before) / prec;
...@@ -254,7 +254,6 @@ namespace ...@@ -254,7 +254,6 @@ namespace
statistics.print(aut, f, translation_time) << '\n'; statistics.print(aut, f, translation_time) << '\n';
break; break;
} }
delete aut;
f->destroy(); f->destroy();
flush_cout(); flush_cout();
return 0; return 0;
......
...@@ -171,7 +171,7 @@ namespace ...@@ -171,7 +171,7 @@ namespace
process_formula(const spot::ltl::formula* f, process_formula(const spot::ltl::formula* f,
const char* filename = 0, int linenum = 0) const char* filename = 0, int linenum = 0)
{ {
const spot::tgba* aut = trans.run(&f); auto aut = trans.run(&f);
// This should not happen, because the parser we use can only // This should not happen, because the parser we use can only
// read PSL/LTL formula, but since our ltl::formula* type can // read PSL/LTL formula, but since our ltl::formula* type can
...@@ -189,36 +189,22 @@ namespace ...@@ -189,36 +189,22 @@ namespace
if (ta_type != TGTA) if (ta_type != TGTA)
{ {
spot::ta* testing_automaton = auto testing_automaton =
tgba_to_ta(aut, ap_set, type == spot::postprocessor::BA, tgba_to_ta(aut, ap_set, type == spot::postprocessor::BA,
opt_with_artificial_initial_state, opt_with_artificial_initial_state,
opt_single_pass_emptiness_check, opt_single_pass_emptiness_check,
opt_with_artificial_livelock); opt_with_artificial_livelock);
if (level != spot::postprocessor::Low) if (level != spot::postprocessor::Low)
{ testing_automaton = spot::minimize_ta(testing_automaton);
spot::ta* testing_automaton_nm = testing_automaton;
testing_automaton = spot::minimize_ta(testing_automaton);
delete testing_automaton_nm;
}
spot::dotty_reachable(std::cout, testing_automaton); spot::dotty_reachable(std::cout, testing_automaton);
delete testing_automaton;
} }
else else
{ {
spot::tgta_explicit* tgta = tgba_to_tgta(aut, ap_set); auto tgta = tgba_to_tgta(aut, ap_set);
if (level != spot::postprocessor::Low) if (level != spot::postprocessor::Low)
{ tgta = spot::minimize_tgta(tgta);
spot::tgta_explicit* a = spot::minimize_tgta(tgta); spot::dotty_reachable(std::cout, tgta->get_ta());
delete tgta;
tgta = a;
}
spot::dotty_reachable(std::cout,
dynamic_cast<spot::tgta_explicit*>(tgta)
->get_ta());
delete tgta;
} }
delete aut;
f->destroy(); f->destroy();
flush_cout(); flush_cout();
return 0; return 0;
......
...@@ -848,7 +848,7 @@ namespace ...@@ -848,7 +848,7 @@ namespace
string_to_tmp(string_ltl_wring, serial, filename_ltl_wring); string_to_tmp(string_ltl_wring, serial, filename_ltl_wring);
} }
const spot::tgba* spot::const_tgba_ptr
translate(unsigned int translator_num, char l, statistics_formula* fstats) translate(unsigned int translator_num, char l, statistics_formula* fstats)
{ {
output.reset(translator_num); output.reset(translator_num);
...@@ -867,7 +867,7 @@ namespace ...@@ -867,7 +867,7 @@ namespace
const char* status_str = 0; const char* status_str = 0;
const spot::tgba* res = 0; spot::const_tgba_ptr res = 0;
if (timed_out) if (timed_out)
{ {
// This is not considered to be a global error. // This is not considered to be a global error.
...@@ -911,8 +911,7 @@ namespace ...@@ -911,8 +911,7 @@ namespace
err << "error: failed to parse the produced neverclaim.\n"; err << "error: failed to parse the produced neverclaim.\n";
spot::format_neverclaim_parse_errors(err, filename, pel); spot::format_neverclaim_parse_errors(err, filename, pel);
end_error(); end_error();
delete res; res = nullptr;
res = 0;
} }
break; break;
} }
...@@ -947,8 +946,7 @@ namespace ...@@ -947,8 +946,7 @@ namespace
{ {
spot::dstar_parse_error_list pel; spot::dstar_parse_error_list pel;
std::string filename = output.val()->name(); std::string filename = output.val()->name();
spot::dstar_aut* aut; auto aut = spot::dstar_parse(filename, pel, dict);
aut = spot::dstar_parse(filename, pel, dict);
if (!pel.empty()) if (!pel.empty())
{ {
status_str = "parse error"; status_str = "parse error";
...@@ -958,8 +956,7 @@ namespace ...@@ -958,8 +956,7 @@ namespace
" output.\n"; " output.\n";
spot::format_dstar_parse_errors(err, filename, pel); spot::format_dstar_parse_errors(err, filename, pel);
end_error(); end_error();
delete aut; res = nullptr;
res = 0;
} }
else else
{ {
...@@ -992,7 +989,6 @@ namespace ...@@ -992,7 +989,6 @@ namespace
} }
// convert it into TGBA for further processing // convert it into TGBA for further processing
res = dstar_to_tgba(aut); res = dstar_to_tgba(aut);
delete aut;
} }
break; break;
} }
...@@ -1049,10 +1045,11 @@ namespace ...@@ -1049,10 +1045,11 @@ namespace
}; };
static void static void
check_empty_prod(const spot::tgba* aut_i, const spot::tgba* aut_j, check_empty_prod(const spot::const_tgba_ptr& aut_i,
const spot::const_tgba_ptr& aut_j,
size_t i, size_t j, bool icomp, bool jcomp) size_t i, size_t j, bool icomp, bool jcomp)
{ {
spot::tgba_product* prod = new spot::tgba_product(aut_i, aut_j); auto prod = spot::product(aut_i, aut_j);
spot::emptiness_check* ec = spot::couvreur99(prod); spot::emptiness_check* ec = spot::couvreur99(prod);
spot::emptiness_check_result* res = ec->check(); spot::emptiness_check_result* res = ec->check();
...@@ -1090,7 +1087,6 @@ namespace ...@@ -1090,7 +1087,6 @@ namespace
} }
delete res; delete res;
delete ec; delete ec;
delete prod;
} }
static void static void
...@@ -1154,16 +1150,18 @@ namespace ...@@ -1154,16 +1150,18 @@ namespace
// Collect all the states of SSPACE that appear in the accepting SCCs // Collect all the states of SSPACE that appear in the accepting SCCs
// of PROD. // of PROD.
static void static void
states_in_acc(const spot::scc_map* m, const spot::tgba* sspace, states_in_acc(const spot::scc_map* m,
const spot::const_tgba_ptr& sspace,
state_set& s) state_set& s)
{ {
const spot::tgba* aut = m->get_aut(); auto aut = m->get_aut();
unsigned c = m->scc_count(); unsigned c = m->scc_count();
for (unsigned n = 0; n < c; ++n) for (unsigned n = 0; n < c; ++n)
if (m->accepting(n)) if (m->accepting(n))
for (auto i: m->states_of(n)) for (auto i: m->states_of(n))
{ {
spot::state* x = aut->project_state(i, sspace); spot::state* x = aut->project_state(i, sspace);
assert(x);
if (!s.insert(x).second) if (!s.insert(x).second)
x->destroy(); x->destroy();
} }
...@@ -1171,7 +1169,7 @@ namespace ...@@ -1171,7 +1169,7 @@ namespace
static bool static bool
consistency_check(const spot::scc_map* pos, const spot::scc_map* neg, consistency_check(const spot::scc_map* pos, const spot::scc_map* neg,
const spot::tgba* sspace) const spot::const_tgba_ptr& sspace)
{ {
// the states of SSPACE should appear in the accepting SCC of at // the states of SSPACE should appear in the accepting SCC of at
// least one of POS or NEG. Maybe both. // least one of POS or NEG. Maybe both.
...@@ -1266,12 +1264,12 @@ namespace ...@@ -1266,12 +1264,12 @@ namespace
// These store the result of the translation of the positive and // These store the result of the translation of the positive and
// negative formulas. // negative formulas.
size_t m = translators.size(); size_t m = translators.size();
std::vector<const spot::tgba*> pos(m); std::vector<spot::const_tgba_ptr> pos(m);
std::vector<const spot::tgba*> neg(m); std::vector<spot::const_tgba_ptr> neg(m);
// These store the complement of the above results, when we can // These store the complement of the above results, when we can
// compute it easily. // compute it easily.
std::vector<const spot::tgba*> comp_pos(m); std::vector<spot::const_tgba_ptr> comp_pos(m);
std::vector<const spot::tgba*> comp_neg(m); std::vector<spot::const_tgba_ptr> comp_neg(m);
unsigned n = vstats.size(); unsigned n = vstats.size();
...@@ -1400,20 +1398,19 @@ namespace ...@@ -1400,20 +1398,19 @@ namespace
{ {
// build a random state-space. // build a random state-space.
spot::srand(seed); spot::srand(seed);
spot::tgba* statespace = spot::random_graph(states, density, auto statespace = spot::random_graph(states, density, ap, dict);
ap, dict);
// Products of the state space with the positive automata. // Products of the state space with the positive automata.
std::vector<spot::tgba*> pos_prod(m); std::vector<spot::const_tgba_ptr> pos_prod(m);
// Products of the state space with the negative automata. // Products of the state space with the negative automata.
std::vector<spot::tgba*> neg_prod(m); std::vector<spot::const_tgba_ptr> neg_prod(m);
// Associated SCC maps. // Associated SCC maps.
std::vector<spot::scc_map*> pos_map(m); std::vector<spot::scc_map*> pos_map(m);
std::vector<spot::scc_map*> neg_map(m); std::vector<spot::scc_map*> neg_map(m);
for (size_t i = 0; i < m; ++i) for (size_t i = 0; i < m; ++i)
if (pos[i]) if (pos[i])
{ {
spot::tgba* p = new spot::tgba_product(pos[i], statespace); auto p = spot::product(pos[i], statespace);
pos_prod[i] = p; pos_prod[i] = p;
spot::scc_map* sm = new spot::scc_map(p); spot::scc_map* sm = new spot::scc_map(p);
sm->build_map(); sm->build_map();
...@@ -1433,7 +1430,7 @@ namespace ...@@ -1433,7 +1430,7 @@ namespace
for (size_t i = 0; i < m; ++i) for (size_t i = 0; i < m; ++i)
if (neg[i]) if (neg[i])
{ {
spot::tgba* p = new spot::tgba_product(neg[i], statespace); auto p = spot::product(neg[i], statespace);
neg_prod[i] = p; neg_prod[i] = p;
spot::scc_map* sm = new spot::scc_map(p); spot::scc_map* sm = new spot::scc_map(p);
sm->build_map(); sm->build_map();
...@@ -1475,31 +1472,14 @@ namespace ...@@ -1475,31 +1472,14 @@ namespace
// Cleanup. // Cleanup.
if (!no_checks) if (!no_checks)
for (size_t i = 0; i < m; ++i) for (size_t i = 0; i < m; ++i)
{ delete neg_map[i];
delete neg_map[i];
delete neg_prod[i];
}
for (size_t i = 0; i < m; ++i) for (size_t i = 0; i < m; ++i)
{ delete pos_map[i];
delete pos_map[i];
delete pos_prod[i];
}
delete statespace;
++seed; ++seed;
} }
std::cerr << std::endl; std::cerr << std::endl;
delete ap; delete ap;
if (!no_checks)
for (size_t i = 0; i < m; ++i)
{
delete neg[i];
delete comp_neg[i];
delete comp_pos[i];
}
for (size_t i = 0; i < m; ++i)
delete pos[i];
// Shall we stop processing formulas now? // Shall we stop processing formulas now?
abort_run = global_error_flag && stop_on_error; abort_run = global_error_flag && stop_on_error;
return 0; return 0;
......
...@@ -560,9 +560,7 @@ namespace ...@@ -560,9 +560,7 @@ namespace
{ {
matched &= !guarantee || is_guarantee_automaton(min); matched &= !guarantee || is_guarantee_automaton(min);
matched &= !safety || is_safety_mwdba(min); matched &= !safety || is_safety_mwdba(min);
delete min;
} }
delete aut;
} }