c++11: use for(auto...) to simplify code in src/bin/.
* src/bin/common_finput.cc, src/bin/genltl.cc, src/bin/ltlcross.cc, src/bin/randltl.cc: Simplify.
This commit is contained in:
parent
34e91b7656
commit
557292bd11
4 changed files with 22 additions and 31 deletions
|
|
@ -343,13 +343,14 @@ int
|
||||||
job_processor::run()
|
job_processor::run()
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
jobs_t::const_iterator i;
|
for (auto& j: jobs)
|
||||||
for (i = jobs.begin(); i != jobs.end() && !abort_run; ++i)
|
|
||||||
{
|
{
|
||||||
if (!i->file_p)
|
if (!j.file_p)
|
||||||
error |= process_string(i->str);
|
error |= process_string(j.str);
|
||||||
else
|
else
|
||||||
error |= process_file(i->str);
|
error |= process_file(j.str);
|
||||||
|
if (abort_run)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -853,15 +853,14 @@ output_pattern(int pattern, int n)
|
||||||
static void
|
static void
|
||||||
run_jobs()
|
run_jobs()
|
||||||
{
|
{
|
||||||
jobs_t::const_iterator i;
|
for (auto& j: jobs)
|
||||||
for (i = jobs.begin(); i != jobs.end(); ++i)
|
|
||||||
{
|
{
|
||||||
int inc = (i->range.max < i->range.min) ? -1 : 1;
|
int inc = (j.range.max < j.range.min) ? -1 : 1;
|
||||||
int n = i->range.min;
|
int n = j.range.min;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
output_pattern(i->pattern, n);
|
output_pattern(j.pattern, n);
|
||||||
if (n == i->range.max)
|
if (n == j.range.max)
|
||||||
break;
|
break;
|
||||||
n += inc;
|
n += inc;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1161,17 +1161,13 @@ namespace
|
||||||
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))
|
||||||
{
|
{
|
||||||
const std::list<const spot::state*>& l = m->states_of(n);
|
spot::state* x = aut->project_state(i, sspace);
|
||||||
for (std::list<const spot::state*>::const_iterator i = l.begin();
|
|
||||||
i != l.end(); ++i)
|
|
||||||
{
|
|
||||||
spot::state* x = aut->project_state(*i, sspace);
|
|
||||||
if (!s.insert(x).second)
|
if (!s.insert(x).second)
|
||||||
x->destroy();
|
x->destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
||||||
|
|
@ -1183,9 +1179,8 @@ namespace
|
||||||
states_in_acc(pos, sspace, s);
|
states_in_acc(pos, sspace, s);
|
||||||
states_in_acc(neg, sspace, s);
|
states_in_acc(neg, sspace, s);
|
||||||
bool res = s.size() == states;
|
bool res = s.size() == states;
|
||||||
state_set::iterator it;
|
for (auto i: s)
|
||||||
for (it = s.begin(); it != s.end(); ++it)
|
i->destroy();
|
||||||
(*it)->destroy();
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,11 +160,10 @@ const spot::ltl::formula*
|
||||||
GF_n(spot::ltl::atomic_prop_set& ap)
|
GF_n(spot::ltl::atomic_prop_set& ap)
|
||||||
{
|
{
|
||||||
const spot::ltl::formula* res = 0;
|
const spot::ltl::formula* res = 0;
|
||||||
spot::ltl::atomic_prop_set::const_iterator i;
|
for (auto v: ap)
|
||||||
for (i = ap.begin(); i != ap.end(); ++i)
|
|
||||||
{
|
{
|
||||||
const spot::ltl::formula* f =
|
const spot::ltl::formula* f =
|
||||||
spot::ltl::unop::instance(spot::ltl::unop::F, (*i)->clone());
|
spot::ltl::unop::instance(spot::ltl::unop::F, v->clone());
|
||||||
f = spot::ltl::unop::instance(spot::ltl::unop::G, f);
|
f = spot::ltl::unop::instance(spot::ltl::unop::G, f);
|
||||||
if (res)
|
if (res)
|
||||||
res = spot::ltl::multop::instance(spot::ltl::multop::And, f, res);
|
res = spot::ltl::multop::instance(spot::ltl::multop::And, f, res);
|
||||||
|
|
@ -406,11 +405,8 @@ main(int argc, char** argv)
|
||||||
|
|
||||||
delete rf;
|
delete rf;
|
||||||
// Cleanup the unicity table.
|
// Cleanup the unicity table.
|
||||||
{
|
for (auto i: unique_set)
|
||||||
fset_t::const_iterator i;
|
i->destroy();
|
||||||
for (i = unique_set.begin(); i != unique_set.end(); ++i)
|
|
||||||
(*i)->destroy();
|
|
||||||
}
|
|
||||||
// Cleanup the atomic_prop set.
|
// Cleanup the atomic_prop set.
|
||||||
destroy_atomic_prop_set(aprops);
|
destroy_atomic_prop_set(aprops);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue