Commit 77df39b4 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

Deprecate ltl::destroy(f) in favor of f->destroy()

* src/ltlast/formula.cc, src/ltlast/formula.hh (formula::clone):
Transform this static function into a member function.
* src/ltlvisit/destroy.hh (destroy): Document and declare as
deprecated.
* bench/split-product/cutscc.cc, iface/gspn/ltlgspn.cc,
src/eltlparse/eltlparse.yy, src/eltltest/acc.cc,
src/evtgbaalgos/tgba2evtgba.cc, src/evtgbatest/ltl2evtgba.cc,
src/ltlast/automatop.cc, src/ltlast/binop.cc,
src/ltlast/multop.cc, src/ltlast/unop.cc, src/ltlenv/declenv.cc,
src/ltlenv/declenv.hh, src/ltlparse/ltlparse.yy,
src/ltltest/equals.cc, src/ltltest/randltl.cc,
src/ltltest/readltl.cc, src/ltltest/reduc.cc,
src/ltltest/syntimpl.cc, src/ltltest/tostring.cc,
src/ltlvisit/destroy.cc src/ltlvisit/basicreduce.cc,
src/ltlvisit/contain.cc, src/ltlvisit/reduce.cc,
src/ltlvisit/syntimpl.cc, src/tgba/bdddict.cc,
src/tgba/bddprint.cc, src/tgba/taa.cc,
src/tgba/tgbabddconcretefactory.cc, src/tgba/tgbaexplicit.cc,
src/tgba/tgbafromfile.cc, src/tgbaalgos/eltl2tgba_lacim.cc,
src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/ltl2tgba_lacim.cc, src/tgbaalgos/neverclaim.cc,
src/tgbaalgos/randomgraph.cc, src/tgbaparse/tgbaparse.yy,
src/tgbatest/complementation.cc, src/tgbatest/eltl2tgba.cc,
src/tgbatest/ltl2tgba.cc, src/tgbatest/ltlprod.cc,
src/tgbatest/mixprod.cc, src/tgbatest/randtgba.cc,
src/tgbatest/reductgba.cc, wrap/python/cgi/ltl2tgba.in,
wrap/python/tests/ltl2tgba.py, wrap/python/tests/ltlparse.py,
wrap/python/tests/ltlsimple.py: Adjust destroy() usage, and remove
the #include "destroy.hh" when appropriate.
parent 48fb19ea
2009-11-08 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Deprecate ltl::destroy(f) in favor of f->destroy()
* src/ltlast/formula.cc, src/ltlast/formula.hh (formula::clone):
Transform this static function into a member function.
* src/ltlvisit/destroy.hh (destroy): Document and declare as
deprecated.
* bench/split-product/cutscc.cc, iface/gspn/ltlgspn.cc,
src/eltlparse/eltlparse.yy, src/eltltest/acc.cc,
src/evtgbaalgos/tgba2evtgba.cc, src/evtgbatest/ltl2evtgba.cc,
src/ltlast/automatop.cc, src/ltlast/binop.cc,
src/ltlast/multop.cc, src/ltlast/unop.cc, src/ltlenv/declenv.cc,
src/ltlenv/declenv.hh, src/ltlparse/ltlparse.yy,
src/ltltest/equals.cc, src/ltltest/randltl.cc,
src/ltltest/readltl.cc, src/ltltest/reduc.cc,
src/ltltest/syntimpl.cc, src/ltltest/tostring.cc,
src/ltlvisit/destroy.cc src/ltlvisit/basicreduce.cc,
src/ltlvisit/contain.cc, src/ltlvisit/reduce.cc,
src/ltlvisit/syntimpl.cc, src/tgba/bdddict.cc,
src/tgba/bddprint.cc, src/tgba/taa.cc,
src/tgba/tgbabddconcretefactory.cc, src/tgba/tgbaexplicit.cc,
src/tgba/tgbafromfile.cc, src/tgbaalgos/eltl2tgba_lacim.cc,
src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/ltl2tgba_lacim.cc, src/tgbaalgos/neverclaim.cc,
src/tgbaalgos/randomgraph.cc, src/tgbaparse/tgbaparse.yy,
src/tgbatest/complementation.cc, src/tgbatest/eltl2tgba.cc,
src/tgbatest/ltl2tgba.cc, src/tgbatest/ltlprod.cc,
src/tgbatest/mixprod.cc, src/tgbatest/randtgba.cc,
src/tgbatest/reductgba.cc, wrap/python/cgi/ltl2tgba.in,
wrap/python/tests/ltl2tgba.py, wrap/python/tests/ltlparse.py,
wrap/python/tests/ltlsimple.py: Adjust destroy() usage, and remove
the #include "destroy.hh" when appropriate.
2009-11-08 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Deprecate ltl::clone(f) in favor of f->clone().
......
......@@ -25,7 +25,6 @@
#include "tgbaalgos/scc.hh"
#include "tgba/tgbafromfile.hh"
#include "tgbaalgos/dotty.hh"
#include "ltlvisit/destroy.hh"
#include "tgbaalgos/randomgraph.hh"
#include "tgbaalgos/emptiness.hh"
#include "tgba/tgbaproduct.hh"
......
// Copyright (C) 2003, 2004, 2006, 2007, 2008 Laboratoire
// Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009 Laboratoire
// d'Informatique de Paris 6 (LIP6), dpartement Systmes Rpartis
// Coopratifs (SRC), Universit Pierre et Marie Curie.
//
......@@ -29,7 +29,6 @@
#include "tgbaparse/public.hh"
#endif
#include "ltlparse/public.hh"
#include "ltlvisit/destroy.hh"
#include "tgba/tgbatba.hh"
#include "tgba/tgbaproduct.hh"
#include "tgbaalgos/ltl2tgba_lacim.hh"
......@@ -265,7 +264,7 @@ main(int argc, char **argv)
a_f = spot::ltl_to_tgba_lacim(f, dict);
break;
}
spot::ltl::destroy(f);
f->destroy();
#ifndef SSP
spot::tgba* model = gspn.automaton();
......
/* Copyright (C) 2008 Laboratoire d'Informatique de
/* Copyright (C) 2008, 2009 Laboratoire d'Informatique de
** Paris 6 (LIP6), dpartement Systmes Rpartis Coopratifs (SRC),
** Universit Pierre et Marie Curie.
**
......@@ -37,8 +37,6 @@
#include "public.hh"
#include "ltlast/allnodes.hh"
#include "ltlast/formula_tree.hh"
#include "ltlvisit/destroy.hh"
#include "ltlvisit/clone.hh"
namespace spot
{
......@@ -234,7 +232,7 @@ using namespace spot::ltl;
%type <bval> nfa_arg_list
%destructor { delete $$; } "atomic proposition"
%destructor { spot::ltl::destroy($$); } subformula
%destructor { $$->destroy(); } subformula
%printer { debug_stream() << *$$; } "atomic proposition"
......@@ -425,8 +423,8 @@ subformula: ATOMIC_PROP
v.push_back($1);
v.push_back($3);
$$ = instanciate(i->second, v);
spot::ltl::destroy($1);
spot::ltl::destroy($3);
$1->destroy();
$3->destroy();
}
else
{
......@@ -449,7 +447,7 @@ subformula: ATOMIC_PROP
$$ = instanciate(i->second, *$3);
automatop::vec::iterator it = $3->begin();
while (it != $3->end())
spot::ltl::destroy(*it++);
(*it++)->destroy();
delete $3;
}
else
......@@ -463,7 +461,7 @@ subformula: ATOMIC_PROP
{
automatop::vec::iterator it = $3->begin();
while (it != $3->end())
spot::ltl::destroy(*it++);
(*it++)->destroy();
delete $3;
}
......
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
// Copyright (C) 2008, 2009 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
//
......@@ -22,7 +21,6 @@
#include <iostream>
#include <cassert>
#include "eltlparse/public.hh"
#include "ltlvisit/destroy.hh"
#include "ltlvisit/lunabbrev.hh"
#include "ltlvisit/nenoform.hh"
......@@ -38,20 +36,20 @@ main(int argc, char** argv)
if (f != 0)
{
std::cout << f->dump() << std::endl;
spot::ltl::destroy(f);
f->destroy();
}
return 1;
}
const spot::ltl::formula* f1 = spot::ltl::unabbreviate_logic(f);
const spot::ltl::formula* f2 = spot::ltl::negative_normal_form(f1);
spot::ltl::destroy(f1);
f1->destroy();
assert(f != 0);
std::cout << f->dump() << std::endl;
spot::ltl::destroy(f);
f->destroy();
assert(f2 != 0);
std::cout << f2->dump() << std::endl;
spot::ltl::destroy(f2);
f2->destroy();
}
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// Copyright (C) 2004, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
// dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre
// et Marie Curie.
//
......@@ -24,7 +24,6 @@
#include "evtgba/explicit.hh"
#include "tgbaalgos/reachiter.hh"
#include "ltlvisit/tostring.hh"
#include "ltlvisit/destroy.hh"
namespace spot
{
......
// Copyright (C) 2004, 2008 Laboratoire d'Informatique de Paris 6
// Copyright (C) 2004, 2008, 2009 Laboratoire d'Informatique de Paris 6
// (LIP6), dpartement Systmes Rpartis Coopratifs (SRC), Universit
// Pierre et Marie Curie.
//
......@@ -23,7 +23,6 @@
#include <cassert>
#include <cstdlib>
#include <cstring>
#include "ltlvisit/destroy.hh"
#include "ltlast/allnodes.hh"
#include "ltlparse/public.hh"
#include "evtgbaparse/public.hh"
......@@ -114,7 +113,7 @@ main(int argc, char** argv)
post_branching,
fair_loop_approx, unobservables);
spot::ltl::destroy(f);
f->destroy();
spot::evtgba* e = spot::tgba_to_evtgba(a);
if (dotty_opt)
......@@ -128,7 +127,7 @@ main(int argc, char** argv)
for (spot::ltl::atomic_prop_set::iterator i = unobservables->begin();
i != unobservables->end(); ++i)
spot::ltl::destroy(*i);
(*i)->destroy();
delete unobservables;
delete dict;
......
// Copyright (C) 2003, 2004, 2005, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
// dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre
// et Marie Curie.
// Copyright (C) 2003, 2004, 2005, 2009 Laboratoire d'Informatique de
// Paris 6 (LIP6), dpartement Systmes Rpartis Coopratifs (SRC),
// Universit Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
......
......@@ -50,7 +50,7 @@ namespace spot
// Dereference children.
for (unsigned n = 0; n < size(); ++n)
formula::destroy(nth(n));
nth(n)->destroy();
delete children_;
}
......@@ -79,7 +79,7 @@ namespace spot
{
// The instance already exists.
for (vec::iterator vi = v->begin(); vi != v->end(); ++vi)
formula::destroy(*vi);
(*vi)->destroy();
delete v;
return static_cast<automatop*>(i->second->clone());
}
......
......@@ -48,8 +48,8 @@ namespace spot
instances.erase(i);
// Dereference children.
formula::destroy(first());
formula::destroy(second());
first()->destroy();
second()->destroy();
}
void
......@@ -143,8 +143,8 @@ namespace spot
if (i != instances.end())
{
// This instance already exists.
formula::destroy(first);
formula::destroy(second);
first->destroy();
second->destroy();
return static_cast<binop*>(i->second->clone());
}
binop* ap = new binop(op, first, second);
......
......@@ -38,10 +38,10 @@ namespace spot
}
void
formula::destroy(formula* f)
formula::destroy() const
{
if (f->unref_())
delete f;
if (const_cast<formula*>(this)->unref_())
delete this;
}
void
......
......@@ -85,7 +85,7 @@ namespace spot
///
/// This decrements the reference counter of this node (if one is
/// used) and can free the object.
static void destroy(formula* f);
void destroy() const;
/// Return a canonic representation of the formula
const std::string& dump() const;
......
......@@ -55,7 +55,7 @@ namespace spot
// Dereference children.
for (unsigned n = 0; n < size(); ++n)
formula::destroy(nth(n));
nth(n)->destroy();
delete children_;
}
......@@ -131,7 +131,7 @@ namespace spot
unsigned ps = p->size();
for (unsigned n = 0; n < ps; ++n)
inlined.push_back(p->nth(n)->clone());
formula::destroy(*i);
(*i)->destroy();
i = v->erase(i);
}
else
......@@ -153,7 +153,7 @@ namespace spot
{
if (*i == last)
{
formula::destroy(*i);
(*i)->destroy();
i = v->erase(i);
}
else
......@@ -193,7 +193,7 @@ namespace spot
{
// The instance already exists.
for (vec::iterator vi = v->begin(); vi != v->end(); ++vi)
formula::destroy(*vi);
(*vi)->destroy();
delete v;
return static_cast<multop*>(i->second->clone());
}
......
......@@ -46,7 +46,7 @@ namespace spot
instances.erase(i);
// Dereference child.
formula::destroy(child());
child()->destroy();
}
void
......@@ -110,7 +110,7 @@ namespace spot
if (i != instances.end())
{
// This instance already exists.
formula::destroy(child);
child->destroy();
return static_cast<unop*>(i->second->clone());
}
unop* ap = new unop(op, child);
......
......@@ -33,7 +33,7 @@ namespace spot
declarative_environment::~declarative_environment()
{
for (prop_map::iterator i = props_.begin(); i != props_.end(); ++i)
ltl::destroy(i->second);
i->second->destroy();
}
bool
......
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// Copyright (C) 2004, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
......@@ -25,7 +25,6 @@
# include "environment.hh"
# include <string>
# include <map>
# include "ltlvisit/destroy.hh"
# include "ltlast/atomic_prop.hh"
namespace spot
......
......@@ -31,7 +31,6 @@
#include <string>
#include "public.hh"
#include "ltlast/allnodes.hh"
#include "ltlvisit/destroy.hh"
}
%parse-param {spot::ltl::parse_error_list &error_list}
......@@ -68,7 +67,7 @@ using namespace spot::ltl;
#define missing_right_binop(res, left, op, str) \
do \
{ \
destroy(left); \
left->destroy(); \
missing_right_op(res, op, str); \
} \
while (0);
......@@ -114,7 +113,7 @@ using namespace spot::ltl;
proposition"), then the %destructor should refer to that name.
References to ATOMIC_PROP are silently ignored. */
%destructor { delete $$; } "atomic proposition"
%destructor { spot::ltl::destroy($$); } subformula
%destructor { $$->destroy(); } subformula
%printer { debug_stream() << *$$; } "atomic proposition"
......
// Copyright (C) 2003, 2004, 2006, 2008 Laboratoire d'Informatique de
// Copyright (C) 2003, 2004, 2006, 2008, 2009 Laboratoire d'Informatique de
// Paris 6 (LIP6), dpartement Systmes Rpartis Coopratifs (SRC),
// Universit Pierre et Marie Curie.
//
......@@ -28,7 +28,6 @@
#include "ltlvisit/tunabbrev.hh"
#include "ltlvisit/dump.hh"
#include "ltlvisit/nenoform.hh"
#include "ltlvisit/destroy.hh"
#include "ltlvisit/contain.hh"
#include "ltlast/allnodes.hh"
#include "ltlvisit/reduce.hh"
......@@ -74,21 +73,21 @@ main(int argc, char** argv)
#ifdef LUNABBREV
tmp = f1;
f1 = spot::ltl::unabbreviate_logic(f1);
spot::ltl::destroy(tmp);
tmp->destroy();
spot::ltl::dump(std::cout, f1);
std::cout << std::endl;
#endif
#ifdef TUNABBREV
tmp = f1;
f1 = spot::ltl::unabbreviate_ltl(f1);
spot::ltl::destroy(tmp);
tmp->destroy();
spot::ltl::dump(std::cout, f1);
std::cout << std::endl;
#endif
#ifdef NENOFORM
tmp = f1;
f1 = spot::ltl::negative_normal_form(f1);
spot::ltl::destroy(tmp);
tmp->destroy();
spot::ltl::dump(std::cout, f1);
std::cout << std::endl;
#endif
......@@ -96,28 +95,28 @@ main(int argc, char** argv)
spot::ltl::formula* tmp;
tmp = f1;
f1 = spot::ltl::reduce(f1);
spot::ltl::destroy(tmp);
tmp->destroy();
spot::ltl::dump(std::cout, f1);
#endif
#ifdef REDUC_TAU
spot::ltl::formula* tmp;
tmp = f1;
f1 = spot::ltl::reduce_tau03(f1, false);
spot::ltl::destroy(tmp);
tmp->destroy();
spot::ltl::dump(std::cout, f1);
#endif
#ifdef REDUC_TAUSTR
spot::ltl::formula* tmp;
tmp = f1;
f1 = spot::ltl::reduce_tau03(f1, true);
spot::ltl::destroy(tmp);
tmp->destroy();
spot::ltl::dump(std::cout, f1);
#endif
int exit_code = f1 != f2;
spot::ltl::destroy(f1);
spot::ltl::destroy(f2);
f1->destroy();
f2->destroy();
assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);
......
......@@ -28,7 +28,6 @@
#include "ltlast/atomic_prop.hh"
#include "ltlvisit/randomltl.hh"
#include "ltlvisit/tostring.hh"
#include "ltlvisit/destroy.hh"
#include "ltlvisit/length.hh"
#include "ltlvisit/reduce.hh"
#include "ltlenv/defaultenv.hh"
......@@ -179,10 +178,10 @@ main(int argc, char** argv)
if (opt_r)
{
spot::ltl::formula* g = reduce(f);
spot::ltl::destroy(f);
f->destroy();
if (spot::ltl::length(g) < opt_r)
{
spot::ltl::destroy(g);
g->destroy();
continue;
}
f = g;
......@@ -201,7 +200,7 @@ main(int argc, char** argv)
exit(2);
}
std::string txt = spot::ltl::to_string(f);
spot::ltl::destroy(f);
f->destroy();
if (!opt_u || unique.insert(txt).second)
{
std::cout << txt << std::endl;
......@@ -223,7 +222,7 @@ main(int argc, char** argv)
{
spot::ltl::atomic_prop_set::const_iterator j = i;
++i;
spot::ltl::destroy(*j);
(*j)->destroy();
}
delete ap;
}
......@@ -26,7 +26,6 @@
#include "ltlparse/public.hh"
#include "ltlvisit/dump.hh"
#include "ltlvisit/dotty.hh"
#include "ltlvisit/destroy.hh"
#include "ltlast/allnodes.hh"
void
......@@ -93,7 +92,7 @@ main(int argc, char** argv)
spot::ltl::dump(std::cout, f);
std::cout << std::endl;
#endif
spot::ltl::destroy(f);
f->destroy();
if (debug_ref)
dump_instances("after");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment