Use 'const formula*' instead of 'formula*' everywhere.
The distinction makes no sense since Spot 0.5, where we switched from mutable furmulae to immutable formulae. The difference between const_visitor and visitor made no sense either. They have been merged into one: visitor. * iface/dve2/dve2check.cc, iface/gspn/ltlgspn.cc, src/eltlparse/eltlparse.yy, src/eltlparse/public.hh, src/evtgbatest/ltl2evtgba.cc, src/kripkeparse/kripkeparse.yy, src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh, src/ltlast/automatop.cc, src/ltlast/automatop.hh, src/ltlast/binop.cc, src/ltlast/binop.hh, src/ltlast/bunop.cc, src/ltlast/bunop.hh, src/ltlast/constant.cc, src/ltlast/constant.hh, src/ltlast/formula.cc, src/ltlast/formula.hh, src/ltlast/formula_tree.cc, src/ltlast/formula_tree.hh, src/ltlast/multop.cc, src/ltlast/multop.hh, src/ltlast/predecl.hh, src/ltlast/refformula.cc, src/ltlast/refformula.hh, src/ltlast/unop.cc, src/ltlast/unop.hh, src/ltlast/visitor.hh, src/ltlenv/declenv.cc, src/ltlenv/declenv.hh, src/ltlenv/defaultenv.cc, src/ltlenv/defaultenv.hh, src/ltlenv/environment.hh, src/ltlparse/ltlfile.cc, src/ltlparse/ltlfile.hh, src/ltlparse/ltlparse.yy, src/ltlparse/public.hh, src/ltltest/consterm.cc, src/ltltest/equals.cc, src/ltltest/genltl.cc, src/ltltest/kind.cc, src/ltltest/length.cc, src/ltltest/randltl.cc, src/ltltest/readltl.cc, src/ltltest/reduc.cc, src/ltltest/syntimpl.cc, src/ltltest/tostring.cc, src/ltlvisit/apcollect.cc, src/ltlvisit/apcollect.hh, src/ltlvisit/clone.cc, src/ltlvisit/clone.hh, src/ltlvisit/contain.cc, src/ltlvisit/contain.hh, src/ltlvisit/dotty.cc, src/ltlvisit/length.cc, src/ltlvisit/lunabbrev.cc, src/ltlvisit/lunabbrev.hh, src/ltlvisit/mark.cc, src/ltlvisit/mark.hh, src/ltlvisit/nenoform.cc, src/ltlvisit/nenoform.hh, src/ltlvisit/postfix.cc, src/ltlvisit/postfix.hh, src/ltlvisit/randomltl.cc, src/ltlvisit/randomltl.hh, src/ltlvisit/reduce.cc, src/ltlvisit/reduce.hh, src/ltlvisit/simpfg.cc, src/ltlvisit/simpfg.hh, src/ltlvisit/simplify.cc, src/ltlvisit/simplify.hh, src/ltlvisit/snf.cc, src/ltlvisit/snf.hh, src/ltlvisit/tostring.cc, src/ltlvisit/tunabbrev.cc, src/ltlvisit/tunabbrev.hh, src/ltlvisit/wmunabbrev.cc, src/ltlvisit/wmunabbrev.hh, src/neverparse/neverclaimparse.yy, src/sabatest/sabacomplementtgba.cc, src/tgba/bdddict.cc, src/tgba/formula2bdd.cc, src/tgba/taatgba.cc, src/tgba/taatgba.hh, src/tgbaalgos/eltl2tgba_lacim.cc, src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_lacim.cc, src/tgbaalgos/minimize.cc, src/tgbaalgos/randomgraph.cc, src/tgbaparse/tgbaparse.yy, src/tgbatest/complementation.cc, src/tgbatest/ltl2tgba.cc, src/tgbatest/ltlprod.cc, src/tgbatest/mixprod.cc, src/tgbatest/randtgba.cc: Massive adjustment! * src/tgbatest/reductgba.cc: Delete.
This commit is contained in:
parent
0f0ada825a
commit
bf62d439c9
98 changed files with 1318 additions and 1535 deletions
|
|
@ -119,13 +119,7 @@ namespace spot
|
|||
}
|
||||
|
||||
void
|
||||
multop::accept(visitor& v)
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
void
|
||||
multop::accept(const_visitor& v) const
|
||||
multop::accept(visitor& v) const
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
|
@ -142,18 +136,12 @@ namespace spot
|
|||
return (*children_)[n];
|
||||
}
|
||||
|
||||
formula*
|
||||
multop::nth(unsigned n)
|
||||
{
|
||||
return (*children_)[n];
|
||||
}
|
||||
|
||||
formula*
|
||||
const formula*
|
||||
multop::all_but(unsigned n) const
|
||||
{
|
||||
unsigned s = size();
|
||||
vec* v = new vec;
|
||||
v->reserve(s-1);
|
||||
v->reserve(s - 1);
|
||||
for (unsigned pos = 0; pos < n; ++pos)
|
||||
v->push_back(nth(pos)->clone());
|
||||
for (unsigned pos = n + 1; pos < s; ++pos)
|
||||
|
|
@ -192,35 +180,37 @@ namespace spot
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gather_bool(multop::vec* v, multop::type op)
|
||||
namespace
|
||||
{
|
||||
// Gather all boolean terms.
|
||||
multop::vec* b = new multop::vec;
|
||||
multop::vec::iterator i = v->begin();
|
||||
while (i != v->end())
|
||||
{
|
||||
if ((*i)->is_boolean())
|
||||
{
|
||||
b->push_back(*i);
|
||||
i = v->erase(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
// - AndNLM(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
|
||||
// AndNLM(Exps1...,Exps2...,Exps3...,And(Bool1,Bool2))
|
||||
// - AndRat(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
|
||||
// AndRat(Exps1...,Exps2...,Exps3...,And(Bool1,Bool2))
|
||||
// - OrRat(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
|
||||
// AndRat(Exps1...,Exps2...,Exps3...,Or(Bool1,Bool2))
|
||||
if (!b->empty())
|
||||
v->push_back(multop::instance(op, b));
|
||||
else
|
||||
delete b;
|
||||
static void
|
||||
gather_bool(multop::vec* v, multop::type op)
|
||||
{
|
||||
// Gather all boolean terms.
|
||||
multop::vec* b = new multop::vec;
|
||||
multop::vec::iterator i = v->begin();
|
||||
while (i != v->end())
|
||||
{
|
||||
if ((*i)->is_boolean())
|
||||
{
|
||||
b->push_back(*i);
|
||||
i = v->erase(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
// - AndNLM(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
|
||||
// AndNLM(Exps1...,Exps2...,Exps3...,And(Bool1,Bool2))
|
||||
// - AndRat(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
|
||||
// AndRat(Exps1...,Exps2...,Exps3...,And(Bool1,Bool2))
|
||||
// - OrRat(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
|
||||
// AndRat(Exps1...,Exps2...,Exps3...,Or(Bool1,Bool2))
|
||||
if (!b->empty())
|
||||
v->push_back(multop::instance(op, b));
|
||||
else
|
||||
delete b;
|
||||
}
|
||||
}
|
||||
|
||||
multop::map multop::instances;
|
||||
|
|
@ -230,7 +220,7 @@ namespace spot
|
|||
// operator). For instance if `+' designates the OR operator and
|
||||
// `0' is false (the neutral element for `+') , then `f+f+0' is
|
||||
// equivalent to `f'.
|
||||
formula*
|
||||
const formula*
|
||||
multop::instance(type op, vec* v)
|
||||
{
|
||||
// Inline children of same kind.
|
||||
|
|
@ -252,9 +242,8 @@ namespace spot
|
|||
i = v->erase(i);
|
||||
continue;
|
||||
}
|
||||
if ((*i)->kind() == MultOp)
|
||||
if (const multop* p = is_multop(*i))
|
||||
{
|
||||
multop* p = static_cast<multop*>(*i);
|
||||
if (p->op() == op)
|
||||
{
|
||||
unsigned ps = p->size();
|
||||
|
|
@ -286,11 +275,11 @@ namespace spot
|
|||
|
||||
unsigned orig_size = v->size();
|
||||
|
||||
formula* neutral;
|
||||
formula* neutral2;
|
||||
formula* abs;
|
||||
formula* abs2;
|
||||
formula* weak_abs;
|
||||
const formula* neutral;
|
||||
const formula* neutral2;
|
||||
const formula* abs;
|
||||
const formula* abs2;
|
||||
const formula* weak_abs;
|
||||
switch (op)
|
||||
{
|
||||
case And:
|
||||
|
|
@ -343,7 +332,7 @@ namespace spot
|
|||
// If FExps2... and FExps3 all accept [*0].
|
||||
{
|
||||
vec::iterator i = v->begin();
|
||||
formula* os = bunop::one_star();
|
||||
const formula* os = bunop::one_star();
|
||||
while (i != v->end())
|
||||
{
|
||||
while (i != v->end() && !(*i)->accepts_eword())
|
||||
|
|
@ -433,7 +422,7 @@ namespace spot
|
|||
// std::unique(), because we must destroy() any formula we drop.
|
||||
// Also ignore neutral elements and handle absorbent elements.
|
||||
{
|
||||
formula* last = 0;
|
||||
const formula* last = 0;
|
||||
vec::iterator i = v->begin();
|
||||
bool weak_abs_seen = false;
|
||||
while (i != v->end())
|
||||
|
|
@ -512,11 +501,11 @@ namespace spot
|
|||
while (i != v->end())
|
||||
{
|
||||
vec::iterator fpos = i;
|
||||
formula* f;
|
||||
const formula* f;
|
||||
unsigned min;
|
||||
unsigned max;
|
||||
bool changed = false;
|
||||
if (bunop* is = is_Star(*i))
|
||||
if (const bunop* is = is_Star(*i))
|
||||
{
|
||||
f = is->child();
|
||||
min = is->min();
|
||||
|
|
@ -531,10 +520,10 @@ namespace spot
|
|||
++i;
|
||||
while (i != v->end())
|
||||
{
|
||||
formula* f2;
|
||||
const formula* f2;
|
||||
unsigned min2;
|
||||
unsigned max2;
|
||||
if (bunop* is = is_Star(*i))
|
||||
if (const bunop* is = is_Star(*i))
|
||||
{
|
||||
f2 = is->child();
|
||||
if (f2 != f)
|
||||
|
|
@ -563,8 +552,8 @@ namespace spot
|
|||
}
|
||||
if (changed)
|
||||
{
|
||||
formula* newfs = bunop::instance(bunop::Star, f->clone(),
|
||||
min, max);
|
||||
const formula* newfs =
|
||||
bunop::instance(bunop::Star, f->clone(), min, max);
|
||||
(*fpos)->destroy();
|
||||
*fpos = newfs;
|
||||
}
|
||||
|
|
@ -586,7 +575,7 @@ namespace spot
|
|||
// arguments of a Fusion operator to
|
||||
// a list with a single formula that
|
||||
// accepts [*0].
|
||||
formula* res = (*v)[0];
|
||||
const formula* res = (*v)[0];
|
||||
if (op != Fusion || orig_size == 1
|
||||
|| !res->accepts_eword())
|
||||
{
|
||||
|
|
@ -600,6 +589,8 @@ namespace spot
|
|||
// The hash key.
|
||||
pair p(op, v);
|
||||
|
||||
const multop* res;
|
||||
// FIXME: Use lower_bound or hash_map.
|
||||
map::iterator i = instances.find(p);
|
||||
if (i != instances.end())
|
||||
{
|
||||
|
|
@ -607,19 +598,20 @@ namespace spot
|
|||
for (vec::iterator vi = v->begin(); vi != v->end(); ++vi)
|
||||
(*vi)->destroy();
|
||||
delete v;
|
||||
return static_cast<multop*>(i->second->clone());
|
||||
res = i->second;
|
||||
}
|
||||
|
||||
// This is the first instance of this formula.
|
||||
|
||||
// Record the instance in the map,
|
||||
multop* ap = new multop(op, v);
|
||||
instances[p] = ap;
|
||||
return ap->clone();
|
||||
else
|
||||
{
|
||||
// This is the first instance of this formula.
|
||||
// Record the instance in the map,
|
||||
res = instances[p] = new multop(op, v);
|
||||
}
|
||||
res->clone();
|
||||
return res;
|
||||
}
|
||||
|
||||
formula*
|
||||
multop::instance(type op, formula* first, formula* second)
|
||||
const formula*
|
||||
multop::instance(type op, const formula* first, const formula* second)
|
||||
{
|
||||
vec* v = new vec;
|
||||
v->push_back(first);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue