sanity: Replace tabulars by spaces in *.cc *.hh *.hxx

* bin/autfilt.cc, bin/common_aoutput.cc, bin/common_aoutput.hh,
bin/common_finput.cc, bin/common_finput.hh, bin/common_hoaread.cc,
bin/common_output.cc, bin/common_output.hh, bin/common_post.cc,
bin/common_post.hh, bin/common_r.hh, bin/common_range.cc,
bin/common_range.hh, bin/common_setup.cc, bin/common_trans.cc,
bin/common_trans.hh, bin/dstar2tgba.cc, bin/genltl.cc,
bin/ltl2tgba.cc, bin/ltl2tgta.cc, bin/ltlcross.cc, bin/ltldo.cc,
bin/ltlfilt.cc, bin/ltlgrind.cc, bin/randaut.cc, bin/randltl.cc,
bin/spot-x.cc, spot/graph/graph.hh, spot/graph/ngraph.hh,
spot/kripke/kripkegraph.hh, spot/ltsmin/ltsmin.cc,
spot/ltsmin/ltsmin.hh, spot/misc/bareword.cc, spot/misc/bitvect.cc,
spot/misc/bitvect.hh, spot/misc/common.hh, spot/misc/escape.cc,
spot/misc/fixpool.hh, spot/misc/formater.cc, spot/misc/hash.hh,
spot/misc/intvcmp2.cc, spot/misc/intvcmp2.hh, spot/misc/intvcomp.cc,
spot/misc/intvcomp.hh, spot/misc/location.hh, spot/misc/minato.cc,
spot/misc/minato.hh, spot/misc/mspool.hh, spot/misc/optionmap.cc,
spot/misc/optionmap.hh, spot/misc/random.cc, spot/misc/random.hh,
spot/misc/satsolver.cc, spot/misc/satsolver.hh, spot/misc/timer.cc,
spot/misc/timer.hh, spot/misc/tmpfile.cc, spot/misc/trival.hh,
spot/parseaut/fmterror.cc, spot/parseaut/parsedecl.hh,
spot/parseaut/public.hh, spot/parsetl/fmterror.cc,
spot/parsetl/parsedecl.hh, spot/priv/accmap.hh, spot/priv/bddalloc.cc,
spot/priv/freelist.cc, spot/priv/trim.cc, spot/priv/weight.cc,
spot/priv/weight.hh, spot/ta/taexplicit.cc, spot/ta/taexplicit.hh,
spot/ta/taproduct.cc, spot/ta/taproduct.hh, spot/ta/tgtaexplicit.cc,
spot/ta/tgtaexplicit.hh, spot/ta/tgtaproduct.cc,
spot/ta/tgtaproduct.hh, spot/taalgos/dot.cc, spot/taalgos/dot.hh,
spot/taalgos/emptinessta.cc, spot/taalgos/emptinessta.hh,
spot/taalgos/minimize.cc, spot/taalgos/tgba2ta.cc,
spot/taalgos/tgba2ta.hh, spot/tl/apcollect.cc, spot/tl/contain.cc,
spot/tl/contain.hh, spot/tl/dot.cc, spot/tl/exclusive.cc,
spot/tl/exclusive.hh, spot/tl/formula.cc, spot/tl/formula.hh,
spot/tl/length.cc, spot/tl/mark.cc, spot/tl/mutation.cc,
spot/tl/mutation.hh, spot/tl/parse.hh, spot/tl/print.cc,
spot/tl/print.hh, spot/tl/randomltl.cc, spot/tl/randomltl.hh,
spot/tl/relabel.cc, spot/tl/relabel.hh, spot/tl/remove_x.cc,
spot/tl/simplify.cc, spot/tl/simplify.hh, spot/tl/snf.cc,
spot/tl/snf.hh, spot/tl/unabbrev.cc, spot/tl/unabbrev.hh,
spot/twa/acc.cc, spot/twa/acc.hh, spot/twa/bdddict.cc,
spot/twa/bdddict.hh, spot/twa/bddprint.cc, spot/twa/formula2bdd.cc,
spot/twa/formula2bdd.hh, spot/twa/taatgba.cc, spot/twa/taatgba.hh,
spot/twa/twa.cc, spot/twa/twa.hh, spot/twa/twagraph.cc,
spot/twa/twagraph.hh, spot/twa/twaproduct.cc, spot/twa/twaproduct.hh,
spot/twaalgos/are_isomorphic.cc, spot/twaalgos/are_isomorphic.hh,
spot/twaalgos/bfssteps.cc, spot/twaalgos/bfssteps.hh,
spot/twaalgos/cleanacc.cc, spot/twaalgos/complete.cc,
spot/twaalgos/compsusp.cc, spot/twaalgos/compsusp.hh,
spot/twaalgos/copy.cc, spot/twaalgos/cycles.cc,
spot/twaalgos/cycles.hh, spot/twaalgos/degen.cc,
spot/twaalgos/degen.hh, spot/twaalgos/determinize.cc,
spot/twaalgos/determinize.hh, spot/twaalgos/dot.cc,
spot/twaalgos/dot.hh, spot/twaalgos/dtbasat.cc,
spot/twaalgos/dtbasat.hh, spot/twaalgos/dtwasat.cc,
spot/twaalgos/dtwasat.hh, spot/twaalgos/emptiness.cc,
spot/twaalgos/emptiness.hh, spot/twaalgos/emptiness_stats.hh,
spot/twaalgos/gtec/ce.cc, spot/twaalgos/gtec/ce.hh,
spot/twaalgos/gtec/gtec.cc, spot/twaalgos/gtec/gtec.hh,
spot/twaalgos/gtec/sccstack.cc, spot/twaalgos/gtec/status.cc,
spot/twaalgos/gv04.cc, spot/twaalgos/hoa.cc, spot/twaalgos/hoa.hh,
spot/twaalgos/isdet.cc, spot/twaalgos/isunamb.cc,
spot/twaalgos/isweakscc.cc, spot/twaalgos/lbtt.cc,
spot/twaalgos/lbtt.hh, spot/twaalgos/ltl2taa.cc,
spot/twaalgos/ltl2taa.hh, spot/twaalgos/ltl2tgba_fm.cc,
spot/twaalgos/ltl2tgba_fm.hh, spot/twaalgos/magic.cc,
spot/twaalgos/magic.hh, spot/twaalgos/mask.cc, spot/twaalgos/mask.hh,
spot/twaalgos/minimize.cc, spot/twaalgos/minimize.hh,
spot/twaalgos/ndfs_result.hxx, spot/twaalgos/neverclaim.cc,
spot/twaalgos/neverclaim.hh, spot/twaalgos/postproc.cc,
spot/twaalgos/postproc.hh, spot/twaalgos/powerset.cc,
spot/twaalgos/powerset.hh, spot/twaalgos/product.cc,
spot/twaalgos/product.hh, spot/twaalgos/projrun.cc,
spot/twaalgos/projrun.hh, spot/twaalgos/randomgraph.cc,
spot/twaalgos/randomgraph.hh, spot/twaalgos/randomize.cc,
spot/twaalgos/randomize.hh, spot/twaalgos/reachiter.cc,
spot/twaalgos/reachiter.hh, spot/twaalgos/relabel.cc,
spot/twaalgos/relabel.hh, spot/twaalgos/remfin.cc,
spot/twaalgos/remprop.cc, spot/twaalgos/sbacc.cc,
spot/twaalgos/sccfilter.cc, spot/twaalgos/sccfilter.hh,
spot/twaalgos/sccinfo.cc, spot/twaalgos/sccinfo.hh,
spot/twaalgos/se05.cc, spot/twaalgos/se05.hh,
spot/twaalgos/sepsets.cc, spot/twaalgos/simulation.cc,
spot/twaalgos/simulation.hh, spot/twaalgos/stats.cc,
spot/twaalgos/stats.hh, spot/twaalgos/strength.cc,
spot/twaalgos/strength.hh, spot/twaalgos/stripacc.cc,
spot/twaalgos/stutter.cc, spot/twaalgos/stutter.hh,
spot/twaalgos/tau03.cc, spot/twaalgos/tau03opt.cc,
spot/twaalgos/tau03opt.hh, spot/twaalgos/totgba.cc,
spot/twaalgos/translate.cc, spot/twaalgos/word.cc, tests/core/acc.cc,
tests/core/bitvect.cc, tests/core/checkpsl.cc, tests/core/checkta.cc,
tests/core/consterm.cc, tests/core/emptchk.cc, tests/core/equalsf.cc,
tests/core/graph.cc, tests/core/ikwiad.cc, tests/core/intvcmp2.cc,
tests/core/intvcomp.cc, tests/core/kind.cc, tests/core/kripkecat.cc,
tests/core/ltlrel.cc, tests/core/ngraph.cc, tests/core/randtgba.cc,
tests/core/readltl.cc, tests/core/reduc.cc, tests/core/safra.cc,
tests/core/syntimpl.cc, tests/ltsmin/modelcheck.cc: Replace tabulars by
8 spaces.
* tests/sanity/style.test: Add checks for no tabulars in *.cc *.hh *.hxx
This commit is contained in:
Laurent XU 2016-03-09 00:23:20 +01:00 committed by Alexandre Duret-Lutz
parent 1eee12b8b4
commit f7e7b4f14e
239 changed files with 25359 additions and 25355 deletions

View file

@ -363,9 +363,9 @@ parse_opt(int key, char* arg, struct argp_state*)
break;
case 'x':
{
const char* opt = extra_options.parse_options(arg);
if (opt)
error(2, 0, "failed to parse --options near '%s'", opt);
const char* opt = extra_options.parse_options(arg);
if (opt)
error(2, 0, "failed to parse --options near '%s'", opt);
}
break;
case OPT_AP_N:
@ -376,15 +376,15 @@ parse_opt(int key, char* arg, struct argp_state*)
break;
case OPT_ACCEPT_WORD:
try
{
opt->acc_words.push_back(spot::parse_word(arg, opt->dict)
->as_automaton());
}
{
opt->acc_words.push_back(spot::parse_word(arg, opt->dict)
->as_automaton());
}
catch (const spot::parse_error& e)
{
error(2, 0, "failed to parse the argument of --accept-word:\n%s",
e.what());
}
{
error(2, 0, "failed to parse the argument of --accept-word:\n%s",
e.what());
}
break;
case OPT_ARE_ISOMORPHIC:
opt->are_isomorphic = read_automaton(arg, opt->dict);
@ -420,27 +420,27 @@ parse_opt(int key, char* arg, struct argp_state*)
break;
case OPT_EQUIVALENT_TO:
if (opt->equivalent_pos)
error(2, 0, "only one --equivalent-to option can be given");
error(2, 0, "only one --equivalent-to option can be given");
opt->equivalent_pos = read_automaton(arg, opt->dict);
opt->equivalent_neg =
spot::dtwa_complement(ensure_deterministic(opt->equivalent_pos));
spot::dtwa_complement(ensure_deterministic(opt->equivalent_pos));
break;
case OPT_INSTUT:
if (!arg || (arg[0] == '1' && arg[1] == 0))
opt_instut = 1;
opt_instut = 1;
else if (arg[0] == '2' && arg[1] == 0)
opt_instut = 2;
opt_instut = 2;
else
error(2, 0, "unknown argument for --instut: %s", arg);
error(2, 0, "unknown argument for --instut: %s", arg);
break;
case OPT_INCLUDED_IN:
{
auto aut = ensure_deterministic(read_automaton(arg, opt->dict));
aut = spot::dtwa_complement(aut);
if (!opt->included_in)
opt->included_in = aut;
else
opt->included_in = spot::product_or(opt->included_in, aut);
auto aut = ensure_deterministic(read_automaton(arg, opt->dict));
aut = spot::dtwa_complement(aut);
if (!opt->included_in)
opt->included_in = aut;
else
opt->included_in = spot::product_or(opt->included_in, aut);
}
break;
case OPT_INTERSECT:
@ -472,18 +472,18 @@ parse_opt(int key, char* arg, struct argp_state*)
break;
case OPT_MASK_ACC:
{
for (auto res : to_longs(arg))
{
if (res < 0)
error(2, 0, "acceptance sets should be non-negative:"
" --mask-acc=%ld", res);
if (static_cast<unsigned long>(res)
> sizeof(spot::acc_cond::mark_t::value_t))
error(2, 0, "this implementation does not support that many"
" acceptance sets: --mask-acc=%ld", res);
opt_mask_acc.set(res);
}
break;
for (auto res : to_longs(arg))
{
if (res < 0)
error(2, 0, "acceptance sets should be non-negative:"
" --mask-acc=%ld", res);
if (static_cast<unsigned long>(res)
> sizeof(spot::acc_cond::mark_t::value_t))
error(2, 0, "this implementation does not support that many"
" acceptance sets: --mask-acc=%ld", res);
opt_mask_acc.set(res);
}
break;
}
case OPT_KEEP_STATES:
{
@ -491,71 +491,71 @@ parse_opt(int key, char* arg, struct argp_state*)
if (!values.empty())
opt_keep_states_initial = values[0];
for (auto res : values)
{
if (res < 0)
error(2, 0, "state ids should be non-negative:"
" --mask-acc=%ld", res);
{
if (res < 0)
error(2, 0, "state ids should be non-negative:"
" --mask-acc=%ld", res);
// We don't know yet how many states the automata contain.
if (opt_keep_states.size() <= static_cast<unsigned long>(res))
opt_keep_states.resize(res + 1, false);
opt_keep_states[res] = true;
}
opt_rem_unreach = true;
break;
opt_keep_states[res] = true;
}
opt_rem_unreach = true;
break;
}
case OPT_PRODUCT_AND:
{
auto a = read_automaton(arg, opt->dict);
if (!opt->product_and)
opt->product_and = std::move(a);
else
opt->product_and = spot::product(std::move(opt->product_and),
std::move(a));
auto a = read_automaton(arg, opt->dict);
if (!opt->product_and)
opt->product_and = std::move(a);
else
opt->product_and = spot::product(std::move(opt->product_and),
std::move(a));
}
break;
case OPT_PRODUCT_OR:
{
auto a = read_automaton(arg, opt->dict);
if (!opt->product_or)
opt->product_or = std::move(a);
else
opt->product_or = spot::product_or(std::move(opt->product_or),
std::move(a));
auto a = read_automaton(arg, opt->dict);
if (!opt->product_or)
opt->product_or = std::move(a);
else
opt->product_or = spot::product_or(std::move(opt->product_or),
std::move(a));
}
break;
case OPT_RANDOMIZE:
if (arg)
{
for (auto p = arg; *p; ++p)
switch (*p)
{
case 's':
randomize_st = true;
break;
case 't':
randomize_tr = true;
break;
default:
error(2, 0, "unknown argument for --randomize: '%c'", *p);
}
}
{
for (auto p = arg; *p; ++p)
switch (*p)
{
case 's':
randomize_st = true;
break;
case 't':
randomize_tr = true;
break;
default:
error(2, 0, "unknown argument for --randomize: '%c'", *p);
}
}
else
{
randomize_tr = true;
randomize_st = true;
}
{
randomize_tr = true;
randomize_st = true;
}
break;
case OPT_REJECT_WORD:
try
{
opt->rej_words.push_back(spot::parse_word(arg, opt->dict)
->as_automaton());
}
{
opt->rej_words.push_back(spot::parse_word(arg, opt->dict)
->as_automaton());
}
catch (const spot::parse_error& e)
{
error(2, 0, "failed to parse the argument of --reject-word:\n%s",
e.what());
}
{
error(2, 0, "failed to parse the argument of --reject-word:\n%s",
e.what());
}
break;
case OPT_REM_AP:
opt->rem_ap.add_ap(arg);
@ -621,7 +621,7 @@ namespace
int
process_automaton(const spot::const_parsed_aut_ptr& haut,
const char* filename)
const char* filename)
{
spot::stopwatch sw;
sw.start();
@ -630,30 +630,30 @@ namespace
// never modify the original automaton (e.g. with
// merge_edges()) and the statistics about it make sense.
auto aut = ((automaton_format == Stats) || opt_name)
? spot::make_twa_graph(haut->aut, spot::twa::prop_set::all())
: haut->aut;
? spot::make_twa_graph(haut->aut, spot::twa::prop_set::all())
: haut->aut;
// Preprocessing.
if (opt_stripacc)
spot::strip_acceptance_here(aut);
spot::strip_acceptance_here(aut);
if (opt_merge)
aut->merge_edges();
aut->merge_edges();
if (opt_clean_acc || opt_rem_fin)
cleanup_acceptance_here(aut);
cleanup_acceptance_here(aut);
if (opt_sep_sets)
separate_sets_here(aut);
separate_sets_here(aut);
if (opt_complement_acc)
aut->set_acceptance(aut->acc().num_sets(),
aut->get_acceptance().complement());
aut->set_acceptance(aut->acc().num_sets(),
aut->get_acceptance().complement());
if (opt_rem_fin)
aut = remove_fin(aut);
aut = remove_fin(aut);
if (opt_dnf_acc)
aut->set_acceptance(aut->acc().num_sets(),
aut->get_acceptance().to_dnf());
aut->set_acceptance(aut->acc().num_sets(),
aut->get_acceptance().to_dnf());
if (opt_cnf_acc)
aut->set_acceptance(aut->acc().num_sets(),
aut->get_acceptance().to_cnf());
aut->set_acceptance(aut->acc().num_sets(),
aut->get_acceptance().to_cnf());
// Filters.
@ -664,46 +664,46 @@ namespace
matched &= opt_accsets.contains(aut->acc().num_sets());
matched &= opt_ap_n.contains(aut->ap().size());
if (opt_is_complete)
matched &= is_complete(aut);
matched &= is_complete(aut);
if (opt_is_deterministic)
matched &= is_deterministic(aut);
matched &= is_deterministic(aut);
if (opt_is_deterministic)
matched &= is_deterministic(aut);
matched &= is_deterministic(aut);
else if (opt_is_unambiguous)
matched &= is_unambiguous(aut);
matched &= is_unambiguous(aut);
if (opt_is_terminal)
matched &= is_terminal_automaton(aut);
matched &= is_terminal_automaton(aut);
else if (opt_is_weak)
matched &= is_weak_automaton(aut);
matched &= is_weak_automaton(aut);
else if (opt_is_inherently_weak)
matched &= is_inherently_weak_automaton(aut);
matched &= is_inherently_weak_automaton(aut);
if (opt->are_isomorphic)
matched &= opt->isomorphism_checker->is_isomorphic(aut);
if (opt_is_empty)
matched &= aut->is_empty();
matched &= aut->is_empty();
if (opt->intersect)
matched &= !spot::product(aut, opt->intersect)->is_empty();
matched &= !spot::product(aut, opt->intersect)->is_empty();
if (opt->included_in)
matched &= spot::product(aut, opt->included_in)->is_empty();
matched &= spot::product(aut, opt->included_in)->is_empty();
if (opt->equivalent_pos)
matched &= spot::product(aut, opt->equivalent_neg)->is_empty()
&& spot::product(dtwa_complement(ensure_deterministic(aut)),
opt->equivalent_pos)->is_empty();
matched &= spot::product(aut, opt->equivalent_neg)->is_empty()
&& spot::product(dtwa_complement(ensure_deterministic(aut)),
opt->equivalent_pos)->is_empty();
if (matched && !opt->acc_words.empty())
for (auto& word_aut: opt->acc_words)
if (spot::product(aut, word_aut)->is_empty())
{
matched = false;
break;
}
for (auto& word_aut: opt->acc_words)
if (spot::product(aut, word_aut)->is_empty())
{
matched = false;
break;
}
if (matched && !opt->rej_words.empty())
for (auto& word_aut: opt->rej_words)
if (!spot::product(aut, word_aut)->is_empty())
{
matched = false;
break;
}
for (auto& word_aut: opt->rej_words)
if (!spot::product(aut, word_aut)->is_empty())
{
matched = false;
break;
}
// Drop or keep matched automata depending on the --invert option
if (matched == opt_invert)
@ -712,65 +712,65 @@ namespace
// Postprocessing.
if (opt_mask_acc)
aut = mask_acc_sets(aut, opt_mask_acc & aut->acc().all_sets());
aut = mask_acc_sets(aut, opt_mask_acc & aut->acc().all_sets());
if (!opt->excl_ap.empty())
aut = opt->excl_ap.constrain(aut, opt_simplify_exclusive_ap);
aut = opt->excl_ap.constrain(aut, opt_simplify_exclusive_ap);
if (!opt->rem_ap.empty())
aut = opt->rem_ap.strip(aut);
aut = opt->rem_ap.strip(aut);
if (opt_destut)
aut = spot::closure(std::move(aut));
aut = spot::closure(std::move(aut));
if (opt_instut == 1)
aut = spot::sl(std::move(aut));
aut = spot::sl(std::move(aut));
else if (opt_instut == 2)
aut = spot::sl2(std::move(aut));
aut = spot::sl2(std::move(aut));
if (!opt_keep_states.empty())
aut = mask_keep_states(aut, opt_keep_states, opt_keep_states_initial);
aut = mask_keep_states(aut, opt_keep_states, opt_keep_states_initial);
if (opt_rem_dead)
aut->purge_dead_states();
aut->purge_dead_states();
else if (opt_rem_unreach)
aut->purge_unreachable_states();
aut->purge_unreachable_states();
if (opt->product_and)
aut = spot::product(std::move(aut), opt->product_and);
aut = spot::product(std::move(aut), opt->product_and);
if (opt->product_or)
aut = spot::product_or(std::move(aut), opt->product_or);
aut = spot::product_or(std::move(aut), opt->product_or);
if (opt_decompose_strength)
{
aut = decompose_strength(aut, opt_decompose_strength);
if (!aut)
return 0;
}
{
aut = decompose_strength(aut, opt_decompose_strength);
if (!aut)
return 0;
}
if (opt_sat_minimize)
{
aut = spot::sat_minimize(aut, opt_sat_minimize, sbacc);
if (!aut)
return 0;
}
{
aut = spot::sat_minimize(aut, opt_sat_minimize, sbacc);
if (!aut)
return 0;
}
if (opt_complement)
aut = spot::dtwa_complement(ensure_deterministic(aut));
aut = spot::dtwa_complement(ensure_deterministic(aut));
aut = post.run(aut, nullptr);
if (randomize_st || randomize_tr)
spot::randomize(aut, randomize_st, randomize_tr);
spot::randomize(aut, randomize_st, randomize_tr);
const double conversion_time = sw.stop();
if (opt->uniq)
{
auto tmp =
spot::canonicalize(make_twa_graph(aut,
spot::twa::prop_set::all()));
spot::canonicalize(make_twa_graph(aut,
spot::twa::prop_set::all()));
if (!opt->uniq->emplace(tmp->edge_vector().begin() + 1,
tmp->edge_vector().end()).second)
return 0;
tmp->edge_vector().end()).second)
return 0;
}
++match_count;
@ -778,7 +778,7 @@ namespace
printer.print(aut, nullptr, filename, -1, conversion_time, haut);
if (opt_max_count >= 0 && match_count >= opt_max_count)
abort_run = true;
abort_run = true;
return 0;
}
@ -796,19 +796,19 @@ namespace
auto hp = spot::automaton_stream_parser(filename, opt_parse);
int err = 0;
while (!abort_run)
{
auto haut = hp.parse(opt->dict);
if (!haut->aut && haut->errors.empty())
break;
if (haut->format_errors(std::cerr))
err = 2;
if (!haut->aut)
error(2, 0, "failed to read automaton from %s", filename);
else if (haut->aborted)
err = std::max(err, aborted(haut, filename));
else
{
auto haut = hp.parse(opt->dict);
if (!haut->aut && haut->errors.empty())
break;
if (haut->format_errors(std::cerr))
err = 2;
if (!haut->aut)
error(2, 0, "failed to read automaton from %s", filename);
else if (haut->aborted)
err = std::max(err, aborted(haut, filename));
else
process_automaton(haut, filename);
}
}
return err;
}
};
@ -820,7 +820,7 @@ main(int argc, char** argv)
setup(argv);
const argp ap = { options, parse_opt, "[FILENAMES...]",
argp_program_doc, children, nullptr, nullptr };
argp_program_doc, children, nullptr, nullptr };
try
{
@ -834,23 +834,23 @@ main(int argc, char** argv)
pref = spot::postprocessor::Any;
type = spot::postprocessor::Generic;
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, nullptr, nullptr))
exit(err);
exit(err);
if (level_set && !pref_set)
pref = spot::postprocessor::Small;
pref = spot::postprocessor::Small;
if (pref_set && !level_set)
level = spot::postprocessor::High;
level = spot::postprocessor::High;
if (jobs.empty())
jobs.emplace_back("-", true);
jobs.emplace_back("-", true);
if (opt->are_isomorphic)
{
if (opt_merge)
opt->are_isomorphic->merge_edges();
opt->isomorphism_checker = std::unique_ptr<spot::isomorphism_checker>
(new spot::isomorphism_checker(opt->are_isomorphic));
}
{
if (opt_merge)
opt->are_isomorphic->merge_edges();
opt->isomorphism_checker = std::unique_ptr<spot::isomorphism_checker>
(new spot::isomorphism_checker(opt->are_isomorphic));
}
spot::srand(opt_seed);
@ -862,7 +862,7 @@ main(int argc, char** argv)
hoa_processor processor(post);
if (processor.run())
return 2;
return 2;
}
catch (const std::runtime_error& e)
{

View file

@ -136,7 +136,7 @@ static const argp_option options[] =
};
const struct argp aoutput_argp = { options, parse_opt_aoutput, nullptr, nullptr,
nullptr, nullptr, nullptr };
nullptr, nullptr, nullptr };
// Those can be overridden by individual tools. E.g. randaut has no
// notion of input file, so %F and %L represent something else.
@ -181,8 +181,8 @@ static const argp_option io_options[] =
};
const struct argp aoutput_io_format_argp = { io_options, nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr };
nullptr, nullptr,
nullptr, nullptr };
static const argp_option o_options[] =
{
@ -221,8 +221,8 @@ static const argp_option o_options[] =
};
const struct argp aoutput_o_format_argp = { o_options,
nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr };
nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr };
int parse_opt_aoutput(int key, char* arg, struct argp_state*)
{
@ -249,15 +249,15 @@ int parse_opt_aoutput(int key, char* arg, struct argp_state*)
case 's':
automaton_format = Spin;
if (type != spot::postprocessor::Monitor)
type = spot::postprocessor::BA;
type = spot::postprocessor::BA;
automaton_format_opt = arg;
break;
case OPT_CHECK:
automaton_format = Hoa;
if (arg)
opt_check |= XARGMATCH("--check", arg, check_args, check_types);
opt_check |= XARGMATCH("--check", arg, check_args, check_types);
else
opt_check |= check_all;
opt_check |= check_all;
break;
case OPT_LBTT:
automaton_format = Lbtt;
@ -266,14 +266,14 @@ int parse_opt_aoutput(int key, char* arg, struct argp_state*)
// because print_lbtt will raise an exception anyway. The
// error message is slightly better in the current way.
if (arg && (arg[0] != 't' || arg[1] != 0))
error(2, 0, "unknown argument for --lbtt: '%s'", arg);
error(2, 0, "unknown argument for --lbtt: '%s'", arg);
break;
case OPT_NAME:
opt_name = arg;
break;
case OPT_STATS:
if (!*arg)
error(2, 0, "empty format string for --stats");
error(2, 0, "empty format string for --stats");
stats = arg;
automaton_format = Stats;
break;
@ -288,23 +288,23 @@ void setup_default_output_format()
if (auto val = getenv("SPOT_DEFAULT_FORMAT"))
{
static char const *const args[] =
{
"dot", "hoa", "hoaf", nullptr
};
{
"dot", "hoa", "hoaf", nullptr
};
static automaton_format_t const format[] =
{
Dot, Hoa, Hoa
};
{
Dot, Hoa, Hoa
};
auto eq = strchr(val, '=');
if (eq)
{
val = strndup(val, eq - val);
automaton_format_opt = eq + 1;
}
{
val = strndup(val, eq - val);
automaton_format_opt = eq + 1;
}
ARGMATCH_VERIFY(args, format);
automaton_format = XARGMATCH("SPOT_DEFAULT_FORMAT", val, args, format);
if (eq)
free(val);
free(val);
}
}
@ -320,24 +320,24 @@ automaton_printer::automaton_printer(stat_style input)
void
automaton_printer::print(const spot::twa_graph_ptr& aut,
spot::formula f,
// Input location for errors and statistics.
const char* filename,
int loc,
// Time and input automaton for statistics
double time,
const spot::const_parsed_aut_ptr& haut,
const char* csv_prefix,
const char* csv_suffix)
spot::formula f,
// Input location for errors and statistics.
const char* filename,
int loc,
// Time and input automaton for statistics
double time,
const spot::const_parsed_aut_ptr& haut,
const char* csv_prefix,
const char* csv_suffix)
{
if (opt_check)
{
if (opt_check & check_stutter)
spot::check_stutter_invariance(aut, f);
spot::check_stutter_invariance(aut, f);
if (opt_check & check_unambiguous)
spot::check_unambiguous(aut);
spot::check_unambiguous(aut);
if (opt_check & check_strength)
spot::check_strength(aut);
spot::check_strength(aut);
}
// Name the output automaton.
@ -353,11 +353,11 @@ automaton_printer::print(const spot::twa_graph_ptr& aut,
{
outputname.str("");
outputnamer.print(haut, aut, f, filename, loc, time,
csv_prefix, csv_suffix);
csv_prefix, csv_suffix);
std::string fname = outputname.str();
auto p = outputfiles.emplace(fname, nullptr);
if (p.second)
p.first->second.reset(new output_file(fname.c_str()));
p.first->second.reset(new output_file(fname.c_str()));
out = &p.first->second->ostream();
}
@ -383,7 +383,7 @@ automaton_printer::print(const spot::twa_graph_ptr& aut,
case Stats:
statistics.set_output(*out);
statistics.print(haut, aut, f, filename, loc, time,
csv_prefix, csv_suffix) << '\n';
csv_prefix, csv_suffix) << '\n';
break;
}
flush_cout();

View file

@ -75,25 +75,25 @@ class hoa_stat_printer: protected spot::stat_printer
{
public:
hoa_stat_printer(std::ostream& os, const char* format,
stat_style input = no_input)
stat_style input = no_input)
: spot::stat_printer(os, format)
{
if (input == aut_input)
{
declare('A', &haut_acc_);
declare('C', &haut_scc_);
declare('E', &haut_edges_);
declare('G', &haut_gen_acc_);
declare('M', &haut_name_);
declare('S', &haut_states_);
declare('T', &haut_trans_);
declare('A', &haut_acc_);
declare('C', &haut_scc_);
declare('E', &haut_edges_);
declare('G', &haut_gen_acc_);
declare('M', &haut_name_);
declare('S', &haut_states_);
declare('T', &haut_trans_);
}
declare('<', &csv_prefix_);
declare('>', &csv_suffix_);
declare('F', &filename_);
declare('L', &location_);
if (input != ltl_input)
declare('f', &filename_); // Override the formula printer.
declare('f', &filename_); // Override the formula printer.
declare('m', &aut_name_);
declare('w', &aut_word_);
}
@ -107,93 +107,93 @@ public:
/// to be output.
std::ostream&
print(const spot::const_parsed_aut_ptr& haut,
const spot::const_twa_graph_ptr& aut,
spot::formula f,
const char* filename, int loc, double run_time,
const char* csv_prefix, const char* csv_suffix)
const spot::const_twa_graph_ptr& aut,
spot::formula f,
const char* filename, int loc, double run_time,
const char* csv_prefix, const char* csv_suffix)
{
filename_ = filename ? filename : "";
csv_prefix_ = csv_prefix ? csv_prefix : "";
csv_suffix_ = csv_suffix ? csv_suffix : "";
if (loc >= 0 && has('L'))
{
std::ostringstream os;
os << loc;
location_ = os.str();
std::ostringstream os;
os << loc;
location_ = os.str();
}
if (haut)
{
if (loc < 0 && has('L'))
{
std::ostringstream os;
os << haut->loc;
location_ = os.str();
}
if (loc < 0 && has('L'))
{
std::ostringstream os;
os << haut->loc;
location_ = os.str();
}
if (has('T'))
{
spot::twa_sub_statistics s = sub_stats_reachable(haut->aut);
haut_states_ = s.states;
haut_edges_ = s.edges;
haut_trans_ = s.transitions;
}
else if (has('E'))
{
spot::twa_sub_statistics s = sub_stats_reachable(haut->aut);
haut_states_ = s.states;
haut_edges_ = s.edges;
}
if (has('M'))
{
auto n = haut->aut->get_named_prop<std::string>("automaton-name");
if (n)
haut_name_ = *n;
else
haut_name_.val().clear();
}
if (has('S'))
haut_states_ = haut->aut->num_states();
if (has('T'))
{
spot::twa_sub_statistics s = sub_stats_reachable(haut->aut);
haut_states_ = s.states;
haut_edges_ = s.edges;
haut_trans_ = s.transitions;
}
else if (has('E'))
{
spot::twa_sub_statistics s = sub_stats_reachable(haut->aut);
haut_states_ = s.states;
haut_edges_ = s.edges;
}
if (has('M'))
{
auto n = haut->aut->get_named_prop<std::string>("automaton-name");
if (n)
haut_name_ = *n;
else
haut_name_.val().clear();
}
if (has('S'))
haut_states_ = haut->aut->num_states();
if (has('A'))
haut_acc_ = haut->aut->acc().num_sets();
if (has('A'))
haut_acc_ = haut->aut->acc().num_sets();
if (has('C'))
haut_scc_ = spot::scc_info(haut->aut).scc_count();
if (has('C'))
haut_scc_ = spot::scc_info(haut->aut).scc_count();
if (has('G'))
{
std::ostringstream os;
os << haut->aut->get_acceptance();
haut_gen_acc_ = os.str();
}
if (has('G'))
{
std::ostringstream os;
os << haut->aut->get_acceptance();
haut_gen_acc_ = os.str();
}
}
if (has('m'))
{
auto n = aut->get_named_prop<std::string>("automaton-name");
if (n)
aut_name_ = *n;
else
aut_name_.val().clear();
}
{
auto n = aut->get_named_prop<std::string>("automaton-name");
if (n)
aut_name_ = *n;
else
aut_name_.val().clear();
}
if (has('w'))
{
auto res = spot::couvreur99(aut)->check();
if (res)
{
auto run = res->accepting_run();
assert(run);
spot::twa_word w(run->reduce());
w.simplify();
std::ostringstream out;
out << w;
aut_word_ = out.str();
}
else
{
aut_word_.val().clear();
}
}
{
auto res = spot::couvreur99(aut)->check();
if (res)
{
auto run = res->accepting_run();
assert(run);
spot::twa_word w(run->reduce());
w.simplify();
std::ostringstream out;
out << w;
aut_word_ = out.str();
}
else
{
aut_word_.val().clear();
}
}
return this->spot::stat_printer::print(aut, f, run_time);
}
@ -230,15 +230,15 @@ public:
void
print(const spot::twa_graph_ptr& aut,
spot::formula f = nullptr,
// Input location for errors and statistics.
const char* filename = nullptr,
int loc = -1,
// Time and input automaton for statistics
double time = 0.0,
const spot::const_parsed_aut_ptr& haut = nullptr,
const char* csv_prefix = nullptr,
const char* csv_suffix = nullptr);
spot::formula f = nullptr,
// Input location for errors and statistics.
const char* filename = nullptr,
int loc = -1,
// Time and input automaton for statistics
double time = 0.0,
const spot::const_parsed_aut_ptr& haut = nullptr,
const char* csv_prefix = nullptr,
const char* csv_suffix = nullptr);
void add_stat(char c, const spot::printable* p);
};

View file

@ -49,8 +49,8 @@ static const argp_option options[] =
};
const struct argp finput_argp = { options, parse_opt_finput,
nullptr, nullptr, nullptr,
nullptr, nullptr };
nullptr, nullptr, nullptr,
nullptr, nullptr };
int
parse_opt_finput(int key, char* arg, struct argp_state*)
@ -105,15 +105,15 @@ job_processor::~job_processor()
int
job_processor::process_string(const std::string& input,
const char* filename,
int linenum)
const char* filename,
int linenum)
{
auto pf = parse_formula(input);
if (!pf.f || !pf.errors.empty())
{
if (filename)
error_at_line(0, 0, filename, linenum, "parse error:");
error_at_line(0, 0, filename, linenum, "parse error:");
pf.format_errors(std::cerr);
return 1;
}
@ -122,7 +122,7 @@ job_processor::process_string(const std::string& input,
int
job_processor::process_stream(std::istream& is,
const char* filename)
const char* filename)
{
int error = 0;
int linenum = 1;
@ -141,148 +141,148 @@ job_processor::process_stream(std::istream& is,
while (!abort_run && std::getline(is, line))
if (!line.empty())
{
if (col_to_read == 0)
{
error |= process_string(line, filename, linenum++);
}
else // We are reading column COL_TO_READ in a CSV file.
{
// If the line we have read contains an odd number
// of double-quotes, then it is an incomplete CSV line
// that should be completed by the next lines.
unsigned dquotes = 0;
std::string fullline;
unsigned csvlines = 0;
do
{
++csvlines;
size_t s = line.size();
for (unsigned i = 0; i < s; ++i)
dquotes += line[i] == '"';
if (fullline.empty())
fullline = line;
else
(fullline += '\n') += line;
if (!(dquotes &= 1))
break;
}
while (std::getline(is, line));
if (dquotes)
error_at_line(2, errno, filename, linenum,
"mismatched double-quote, "
"reached EOF while parsing this line");
if (col_to_read == 0)
{
error |= process_string(line, filename, linenum++);
}
else // We are reading column COL_TO_READ in a CSV file.
{
// If the line we have read contains an odd number
// of double-quotes, then it is an incomplete CSV line
// that should be completed by the next lines.
unsigned dquotes = 0;
std::string fullline;
unsigned csvlines = 0;
do
{
++csvlines;
size_t s = line.size();
for (unsigned i = 0; i < s; ++i)
dquotes += line[i] == '"';
if (fullline.empty())
fullline = line;
else
(fullline += '\n') += line;
if (!(dquotes &= 1))
break;
}
while (std::getline(is, line));
if (dquotes)
error_at_line(2, errno, filename, linenum,
"mismatched double-quote, "
"reached EOF while parsing this line");
// Now that we have a full CSV line, extract the right
// column.
// Now that we have a full CSV line, extract the right
// column.
const char* str = fullline.c_str();
const char* col1_start = str;
// Delimiters for the extracted column.
const char* coln_start = str;
const char* coln_end = nullptr;
// The current column. (1-based)
int colnum = 1;
// Whether we are parsing a double-quoted string.
bool instring = false;
// Note that RFC 4180 has strict rules about
// double-quotes: ① if a field is double-quoted, the first
// and last characters of the field should be
// double-quotes; ② if a field contains a double-quote
// then it should be double quoted, and the occurrences
// of double-quotes should be doubled. Therefore a CSV file
// may no contain a line such as:
// foo,bar"ba""z",12
// Tools have different interpretation of such a line.
// For instance Python's pandas.read_csv() function will
// load the second field verbatim as the string 'bar"ba""z"',
// while R's read.csv() function will load it as the
// string 'barba"z'. We use this second interpretation, because
// it also makes it possible to parse CSVs fields formatted
// with leading spaces (often for cosmetic purpose). When
// extracting the second field of
// foo, "ba""z", 12
// we will return ' baz' and the leading space will be ignored
// by our LTL formula parser.
while (*str)
{
switch (*str)
{
case '"':
// Doubled double-quotes are used to escape
// double-quotes.
if (instring && str[1] == '"')
++str;
else
instring = !instring;
break;
case ',':
if (!instring)
{
if (col_to_read == colnum)
coln_end = str;
++colnum;
if (col_to_read == colnum)
coln_start = str + 1;
}
break;
}
// Once we have the end delimiter for our target
// column, we have all we need.
if (coln_end)
break;
++str;
}
if (!*str)
{
if (colnum != col_to_read)
// Skip this line as it has no enough columns.
continue;
else
// The target columns ends at the end of the line.
coln_end = str;
}
const char* str = fullline.c_str();
const char* col1_start = str;
// Delimiters for the extracted column.
const char* coln_start = str;
const char* coln_end = nullptr;
// The current column. (1-based)
int colnum = 1;
// Whether we are parsing a double-quoted string.
bool instring = false;
// Note that RFC 4180 has strict rules about
// double-quotes: ① if a field is double-quoted, the first
// and last characters of the field should be
// double-quotes; ② if a field contains a double-quote
// then it should be double quoted, and the occurrences
// of double-quotes should be doubled. Therefore a CSV file
// may no contain a line such as:
// foo,bar"ba""z",12
// Tools have different interpretation of such a line.
// For instance Python's pandas.read_csv() function will
// load the second field verbatim as the string 'bar"ba""z"',
// while R's read.csv() function will load it as the
// string 'barba"z'. We use this second interpretation, because
// it also makes it possible to parse CSVs fields formatted
// with leading spaces (often for cosmetic purpose). When
// extracting the second field of
// foo, "ba""z", 12
// we will return ' baz' and the leading space will be ignored
// by our LTL formula parser.
while (*str)
{
switch (*str)
{
case '"':
// Doubled double-quotes are used to escape
// double-quotes.
if (instring && str[1] == '"')
++str;
else
instring = !instring;
break;
case ',':
if (!instring)
{
if (col_to_read == colnum)
coln_end = str;
++colnum;
if (col_to_read == colnum)
coln_start = str + 1;
}
break;
}
// Once we have the end delimiter for our target
// column, we have all we need.
if (coln_end)
break;
++str;
}
if (!*str)
{
if (colnum != col_to_read)
// Skip this line as it has no enough columns.
continue;
else
// The target columns ends at the end of the line.
coln_end = str;
}
// Skip the line if it has an empty field.
if (coln_start == coln_end)
continue;
// Skip the line if it has an empty field.
if (coln_start == coln_end)
continue;
// save the contents before and after that columns for the
// %< and %> escapes (ignoring the trailing and leading
// commas).
prefix = (col_to_read != 1) ?
strndup(col1_start, coln_start - col1_start - 1) : nullptr;
suffix = (*coln_end != 0) ? strdup(coln_end + 1) : nullptr;
std::string field(coln_start, coln_end);
// Remove double-quotes if any.
if (field.find('"') != std::string::npos)
{
unsigned dst = 0;
bool instring = false;
for (; coln_start != coln_end; ++coln_start)
if (*coln_start == '"')
// A doubled double-quote instead a double-quoted
// string is an escaped double-quote.
if (instring && coln_start[1] == '"')
field[dst++] = *++coln_start;
else
instring = !instring;
else
field[dst++] = *coln_start;
field.resize(dst);
}
error |= process_string(field, filename, linenum);
linenum += csvlines;
if (prefix)
{
free(prefix);
prefix = nullptr;
}
if (suffix)
{
free(suffix);
suffix = nullptr;
}
}
// save the contents before and after that columns for the
// %< and %> escapes (ignoring the trailing and leading
// commas).
prefix = (col_to_read != 1) ?
strndup(col1_start, coln_start - col1_start - 1) : nullptr;
suffix = (*coln_end != 0) ? strdup(coln_end + 1) : nullptr;
std::string field(coln_start, coln_end);
// Remove double-quotes if any.
if (field.find('"') != std::string::npos)
{
unsigned dst = 0;
bool instring = false;
for (; coln_start != coln_end; ++coln_start)
if (*coln_start == '"')
// A doubled double-quote instead a double-quoted
// string is an escaped double-quote.
if (instring && coln_start[1] == '"')
field[dst++] = *++coln_start;
else
instring = !instring;
else
field[dst++] = *coln_start;
field.resize(dst);
}
error |= process_string(field, filename, linenum);
linenum += csvlines;
if (prefix)
{
free(prefix);
prefix = nullptr;
}
if (suffix)
{
free(suffix);
suffix = nullptr;
}
}
}
return error;
}
@ -315,23 +315,23 @@ job_processor::process_file(const char* filename)
long int col = strtol(slash + 1, &end, 10);
// strtol ate all remaining characters and NN is positive
if (errno == 0 && !*end && col != 0)
{
col_to_read = col;
if (real_filename)
free(real_filename);
real_filename = strndup(filename, slash - filename);
{
col_to_read = col;
if (real_filename)
free(real_filename);
real_filename = strndup(filename, slash - filename);
// Special case for stdin.
if (real_filename[0] == '-' && real_filename[1] == 0)
return process_stream(std::cin, real_filename);
// Special case for stdin.
if (real_filename[0] == '-' && real_filename[1] == 0)
return process_stream(std::cin, real_filename);
std::ifstream input(real_filename);
if (input)
return process_stream(input, real_filename);
std::ifstream input(real_filename);
if (input)
return process_stream(input, real_filename);
error(2, errno, "cannot open '%s' nor '%s'",
filename, real_filename);
}
error(2, errno, "cannot open '%s' nor '%s'",
filename, real_filename);
}
}
error(2, saved_errno, "cannot open '%s'", filename);
@ -345,11 +345,11 @@ job_processor::run()
for (auto& j: jobs)
{
if (!j.file_p)
error |= process_string(j.str);
error |= process_string(j.str);
else
error |= process_file(j.str);
error |= process_file(j.str);
if (abort_run)
break;
break;
}
return error;
}

View file

@ -28,7 +28,7 @@
struct job
{
const char* str;
bool file_p; // true if str is a filename, false if it is a formula
bool file_p; // true if str is a filename, false if it is a formula
job(const char* str, bool file_p)
: str(str), file_p(file_p)
@ -58,11 +58,11 @@ public:
virtual int
process_formula(spot::formula f,
const char* filename = nullptr, int linenum = 0) = 0;
const char* filename = nullptr, int linenum = 0) = 0;
virtual int
process_string(const std::string& str,
const char* filename = nullptr, int linenum = 0);
const char* filename = nullptr, int linenum = 0);
virtual int
process_stream(std::istream& is, const char* filename);

View file

@ -41,8 +41,8 @@ spot::twa_graph_ptr
read_automaton(const char* filename, spot::bdd_dict_ptr& dict)
{
auto p = spot::parse_aut(filename, dict,
spot::default_environment::instance(),
opt_parse);
spot::default_environment::instance(),
opt_parse);
if (p->format_errors(std::cerr))
error(2, 0, "failed to read automaton from %s", filename);
if (p->aborted)
@ -86,5 +86,5 @@ parse_opt_hoaread(int key, char* arg, struct argp_state*)
const struct argp hoaread_argp = { options, parse_opt_hoaread,
nullptr, nullptr, nullptr,
nullptr, nullptr };
nullptr, nullptr, nullptr,
nullptr, nullptr };

View file

@ -65,13 +65,13 @@ static const argp_option options[] =
};
const struct argp output_argp = { options, parse_opt_output,
nullptr, nullptr, nullptr,
nullptr, nullptr };
nullptr, nullptr, nullptr,
nullptr, nullptr };
static
void
report_not_ltl(spot::formula f,
const char* filename, int linenum, const char* syn)
const char* filename, int linenum, const char* syn)
{
std::string s = spot::str_psl(f);
static const char msg[] =
@ -84,30 +84,30 @@ report_not_ltl(spot::formula f,
std::ostream&
stream_formula(std::ostream& out,
spot::formula f, const char* filename, int linenum)
spot::formula f, const char* filename, int linenum)
{
switch (output_format)
{
case lbt_output:
if (f.is_ltl_formula())
spot::print_lbt_ltl(out, f);
spot::print_lbt_ltl(out, f);
else
report_not_ltl(f, filename, linenum, "LBT");
report_not_ltl(f, filename, linenum, "LBT");
break;
case spot_output:
spot::print_psl(out, f, full_parenth);
break;
case spin_output:
if (f.is_ltl_formula())
spot::print_spin_ltl(out, f, full_parenth);
spot::print_spin_ltl(out, f, full_parenth);
else
report_not_ltl(f, filename, linenum, "Spin");
report_not_ltl(f, filename, linenum, "Spin");
break;
case wring_output:
if (f.is_ltl_formula())
spot::print_wring_ltl(out, f);
spot::print_wring_ltl(out, f);
else
report_not_ltl(f, filename, linenum, "Wring");
report_not_ltl(f, filename, linenum, "Wring");
break;
case utf8_output:
spot::print_utf8_psl(out, f, full_parenth);
@ -124,8 +124,8 @@ stream_formula(std::ostream& out,
static void
stream_escapable_formula(std::ostream& os,
spot::formula f,
const char* filename, int linenum)
spot::formula f,
const char* filename, int linenum)
{
if (escape_csv)
{
@ -260,17 +260,17 @@ parse_opt_output(int key, char* arg, struct argp_state*)
static void
output_formula(std::ostream& out,
spot::formula f,
const char* filename = nullptr, int linenum = 0,
const char* prefix = nullptr, const char* suffix = nullptr)
spot::formula f,
const char* filename = nullptr, int linenum = 0,
const char* prefix = nullptr, const char* suffix = nullptr)
{
if (!format)
{
if (prefix)
out << prefix << ',';
out << prefix << ',';
stream_escapable_formula(out, f, filename, linenum);
if (suffix)
out << ',' << suffix;
out << ',' << suffix;
}
else
{
@ -287,14 +287,14 @@ void
void
output_formula_checked(spot::formula f,
const char* filename, int linenum,
const char* prefix, const char* suffix)
const char* filename, int linenum,
const char* prefix, const char* suffix)
{
if (output_format == count_output)
{
if (outputnamer)
throw std::runtime_error
("options --output and --count are incompatible");
throw std::runtime_error
("options --output and --count are incompatible");
return;
}
if (output_format == quiet_output)
@ -308,7 +308,7 @@ output_formula_checked(spot::formula f,
std::string fname = outputname.str();
auto p = outputfiles.emplace(fname, nullptr);
if (p.second)
p.first->second.reset(new output_file(fname.c_str()));
p.first->second.reset(new output_file(fname.c_str()));
out = &p.first->second->ostream();
}
output_formula(*out, f, filename, linenum, prefix, suffix);

View file

@ -30,7 +30,7 @@
#include "common_file.hh"
enum output_format_t { spot_output, spin_output, utf8_output,
lbt_output, wring_output, latex_output,
lbt_output, wring_output, latex_output,
quiet_output, count_output };
extern output_format_t output_format;
extern bool full_parenth;
@ -43,12 +43,12 @@ int parse_opt_output(int key, char* arg, struct argp_state* state);
// Low-level output
std::ostream&
stream_formula(std::ostream& out,
spot::formula f, const char* filename, int linenum);
spot::formula f, const char* filename, int linenum);
void output_formula_checked(spot::formula f,
const char* filename = nullptr, int linenum = 0,
const char* prefix = nullptr,
const char* suffix = nullptr);
const char* filename = nullptr, int linenum = 0,
const char* prefix = nullptr,
const char* suffix = nullptr);
class printable_formula:
@ -72,15 +72,15 @@ public:
aut_stat_printer(std::ostream& os, const char* format)
: spot::stat_printer(os, format)
{
declare('f', &formula_); // Override the formula printer.
declare('f', &formula_); // Override the formula printer.
}
using spot::formater::set_output;
std::ostream&
print(const spot::const_twa_graph_ptr& aut,
spot::formula f = nullptr,
double run_time = -1.)
spot::formula f = nullptr,
double run_time = -1.)
{
formula_ = f;
return this->spot::stat_printer::print(aut, f, run_time);

View file

@ -155,7 +155,7 @@ parse_opt_post(int key, char*, struct argp_state*)
break;
case OPT_TGBA:
if (automaton_format == Spin)
error(2, 0, "--spin and --tgba are incompatible");
error(2, 0, "--spin and --tgba are incompatible");
type = spot::postprocessor::TGBA;
break;
default:
@ -165,7 +165,7 @@ parse_opt_post(int key, char*, struct argp_state*)
}
const struct argp post_argp = { options, parse_opt_post,
nullptr, nullptr, nullptr, nullptr, nullptr };
nullptr, nullptr, nullptr, nullptr, nullptr };
const struct argp post_argp_disabled = { options_disabled, parse_opt_post,
nullptr, nullptr, nullptr,
nullptr, nullptr };
nullptr, nullptr, nullptr,
nullptr, nullptr };

View file

@ -23,7 +23,7 @@
#include <spot/twaalgos/postproc.hh>
#include <argp.h>
extern const struct argp post_argp; // postprocessing enabled
extern const struct argp post_argp; // postprocessing enabled
extern const struct argp post_argp_disabled; // postprocessing disabled
extern spot::postprocessor::output_type type;

View file

@ -24,21 +24,21 @@
#define OPT_R 'r'
#define DECLARE_OPT_R \
{ "simplify", OPT_R, "LEVEL", OPTION_ARG_OPTIONAL, \
"simplify formulas according to LEVEL (see below); LEVEL is " \
#define DECLARE_OPT_R \
{ "simplify", OPT_R, "LEVEL", OPTION_ARG_OPTIONAL, \
"simplify formulas according to LEVEL (see below); LEVEL is " \
"set to 3 if omitted", 0 }
#define LEVEL_DOC(g) \
{ nullptr, 0, nullptr, 0, \
"The simplification LEVEL may be set as follows.", g }, \
{ " 0", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \
"No rewriting", 0 }, \
{ " 1", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \
"basic rewritings and eventual/universal rules", 0 }, \
{ " 2", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \
"additional syntactic implication rules", 0 }, \
{ " 3", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \
#define LEVEL_DOC(g) \
{ nullptr, 0, nullptr, 0, \
"The simplification LEVEL may be set as follows.", g }, \
{ " 0", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \
"No rewriting", 0 }, \
{ " 1", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \
"basic rewritings and eventual/universal rules", 0 }, \
{ " 2", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \
"additional syntactic implication rules", 0 }, \
{ " 3", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \
"better implications using containment", 0 }
extern int simplification_level;

View file

@ -42,7 +42,7 @@ parse_range(const char* str, int missing_left, int missing_right)
// No leading number. It's OK as long as the string is not
// empty.
if (!*end)
error(1, 0, "invalid empty range");
error(1, 0, "invalid empty range");
res.min = missing_left;
}
if (!*end)
@ -54,24 +54,24 @@ parse_range(const char* str, int missing_left, int missing_right)
{
// Skip : or ..
if (end[0] == ':')
++end;
++end;
else if (end[0] == '.' && end[1] == '.')
end += 2;
end += 2;
if (!*end && missing_right != 0)
{
res.max = missing_right;
}
{
res.max = missing_right;
}
else
{
// Parse the next integer.
char* end2;
res.max = strtol(end, &end2, 10);
if (end == end2)
error(1, 0, "invalid range '%s' (missing end?)", str);
if (*end2)
error(1, 0, "invalid range '%s' (trailing garbage?)", str);
}
{
// Parse the next integer.
char* end2;
res.max = strtol(end, &end2, 10);
if (end == end2)
error(1, 0, "invalid range '%s' (missing end?)", str);
if (*end2)
error(1, 0, "invalid range '%s' (trailing garbage?)", str);
}
}
if (res.min < 0 || res.max < 0)

View file

@ -19,15 +19,15 @@
#pragma once
#define RANGE_DOC \
{ nullptr, 0, nullptr, 0, \
"RANGE may have one of the following forms: 'INT', " \
#define RANGE_DOC \
{ nullptr, 0, nullptr, 0, \
"RANGE may have one of the following forms: 'INT', " \
"'INT..INT', or '..INT'.\nIn the latter case, the missing number " \
"is assumed to be 1.", 0 }
#define RANGE_DOC_FULL \
{ nullptr, 0, nullptr, 0, \
"RANGE may have one of the following forms: 'INT', " \
#define RANGE_DOC_FULL \
{ nullptr, 0, nullptr, 0, \
"RANGE may have one of the following forms: 'INT', " \
"'INT..INT', '..INT', or 'INT..'", 0 }
struct range
@ -47,4 +47,4 @@ struct range
// values. Additionally, if missing_right == 0, then the INT.. form
// is disallowed.
range parse_range(const char* str,
int missing_left = 1, int missing_right = 0);
int missing_left = 1, int missing_right = 0);

View file

@ -129,7 +129,7 @@ parse_opt_misc(int key, char*, struct argp_state* state)
break;
case OPT_USAGE:
argp_state_help(state, state->out_stream,
ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
break;
case OPT_VERSION:
display_version(state->out_stream, state);
@ -143,8 +143,8 @@ parse_opt_misc(int key, char*, struct argp_state* state)
const struct argp misc_argp = { options, parse_opt_misc,
nullptr, nullptr, nullptr, nullptr, nullptr };
nullptr, nullptr, nullptr, nullptr, nullptr };
const struct argp misc_argp_hidden = { options_hidden, parse_opt_misc,
nullptr, nullptr, nullptr,
nullptr, nullptr };
nullptr, nullptr, nullptr,
nullptr, nullptr };

View file

@ -53,17 +53,17 @@ static void show_shorthands()
{
std::cout
<< ("If a COMMANDFMT does not use any %-sequence, and starts with one of\n"
"the following words, then the string on the right is appended.\n\n");
"the following words, then the string on the right is appended.\n\n");
for (auto& s: shorthands)
std::cout << " "
<< std::left << std::setw(12) << s.prefix
<< s.suffix << '\n';
<< std::left << std::setw(12) << s.prefix
<< s.suffix << '\n';
std::cout
<< ("\nAny {name} and directory component is skipped for the purpose of\n"
"matching those prefixes. So for instance\n"
" '{DRA} ~/mytools/ltl2dstar-0.5.2'\n"
"will changed into\n"
" '{DRA} ~/mytools/ltl2dstar-0.5.2 --output-format=hoa %L %O'\n");
"matching those prefixes. So for instance\n"
" '{DRA} ~/mytools/ltl2dstar-0.5.2'\n"
"will changed into\n"
" '{DRA} ~/mytools/ltl2dstar-0.5.2 --output-format=hoa %L %O'\n");
}
@ -76,19 +76,19 @@ translator_spec::translator_spec(const char* spec)
const char* pos = cmd;
unsigned count = 1;
while (*++pos)
{
if (*pos == '{')
++count;
else if (*pos == '}')
if (!--count)
{
name = strndup(cmd + 1, pos - cmd - 1);
cmd = pos + 1;
while (*cmd == ' ' || *cmd == '\t')
++cmd;
break;
}
}
{
if (*pos == '{')
++count;
else if (*pos == '}')
if (!--count)
{
name = strndup(cmd + 1, pos - cmd - 1);
cmd = pos + 1;
while (*cmd == ' ' || *cmd == '\t')
++cmd;
break;
}
}
}
// If there is no % in the string, look for a known
// command from our shorthand list. If we find it,
@ -100,29 +100,29 @@ translator_spec::translator_spec(const char* spec)
auto basename = cmd;
auto pos = cmd;
while (*pos)
{
if (*pos == '/')
basename = pos + 1;
else if (*pos == ' ')
break;
++pos;
}
{
if (*pos == '/')
basename = pos + 1;
else if (*pos == ' ')
break;
++pos;
}
// Match a shorthand.
for (auto& p: shorthands)
{
int n = strlen(p.prefix);
if (strncmp(basename, p.prefix, n) == 0)
{
int m = strlen(p.suffix);
int q = strlen(cmd);
char* tmp = static_cast<char*>(malloc(q + m + 1));
strcpy(tmp, cmd);
strcpy(tmp + q, p.suffix);
cmd = tmp;
allocated = true;
break;
}
}
{
int n = strlen(p.prefix);
if (strncmp(basename, p.prefix, n) == 0)
{
int m = strlen(p.suffix);
int q = strlen(cmd);
char* tmp = static_cast<char*>(malloc(q + m + 1));
strcpy(tmp, cmd);
strcpy(tmp + q, p.suffix);
cmd = tmp;
allocated = true;
break;
}
}
}
if (!allocated)
cmd = strdup(cmd);
@ -186,7 +186,7 @@ printable_result_filename::print(std::ostream& os, const char*) const
translator_runner::translator_runner(spot::bdd_dict_ptr dict,
bool no_output_allowed)
bool no_output_allowed)
: dict(dict)
{
declare('f', &string_ltl_spot);
@ -213,17 +213,17 @@ translator_runner::translator_runner(spot::bdd_dict_ptr dict,
const translator_spec& t = translators[n];
scan(t.cmd, has);
if (!(has['f'] || has['s'] || has['l'] || has['w']
|| has['F'] || has['S'] || has['L'] || has['W']))
error(2, 0, "no input %%-sequence in '%s'.\n Use "
"one of %%f,%%s,%%l,%%w,%%F,%%S,%%L,%%W to indicate how "
"to pass the formula.", t.spec);
|| has['F'] || has['S'] || has['L'] || has['W']))
error(2, 0, "no input %%-sequence in '%s'.\n Use "
"one of %%f,%%s,%%l,%%w,%%F,%%S,%%L,%%W to indicate how "
"to pass the formula.", t.spec);
if (!no_output_allowed
&& !(has['O'] ||
// backward-compatibility
has['D'] || has['N'] || has['T'] || has['H']))
error(2, 0, "no output %%-sequence in '%s'.\n Use "
"%%O to indicate where the automaton is output.",
t.spec);
&& !(has['O'] ||
// backward-compatibility
has['D'] || has['N'] || has['T'] || has['H']))
error(2, 0, "no output %%-sequence in '%s'.\n Use "
"%%O to indicate where the automaton is output.",
t.spec);
// Remember the %-sequences used by all translators.
prime(t.cmd);
}
@ -231,7 +231,7 @@ translator_runner::translator_runner(spot::bdd_dict_ptr dict,
void
translator_runner::string_to_tmp(std::string& str, unsigned n,
std::string& tmpname)
std::string& tmpname)
{
char prefix[30];
snprintf(prefix, sizeof prefix, "lcr-i%u-", n);
@ -302,18 +302,18 @@ sig_handler(int sig)
{
timed_out = true;
if (--alarm_on)
{
// Send SIGTERM to children.
kill(-child_pid, SIGTERM);
// Try again later if it didn't work. (alarm() will be reset
// if it did work and the call to wait() returns)
alarm(2);
}
{
// Send SIGTERM to children.
kill(-child_pid, SIGTERM);
// Try again later if it didn't work. (alarm() will be reset
// if it did work and the call to wait() returns)
alarm(2);
}
else
{
// After a few gentle tries, really kill that child.
kill(-child_pid, SIGKILL);
}
{
// After a few gentle tries, really kill that child.
kill(-child_pid, SIGKILL);
}
}
else
{
@ -370,7 +370,7 @@ exec_with_timeout(const char* cmd)
alarm_on = 0;
if (w == -1)
error(2, errno, "error during wait()");
error(2, errno, "error during wait()");
alarm(0);
}
@ -424,7 +424,7 @@ static int parse_opt_trans(int key, char* arg, struct argp_state*)
timeout = to_pos_int(arg);
#if !ENABLE_TIMEOUT
std::cerr << "warning: setting a timeout is not supported "
<< "on your platform" << std::endl;
<< "on your platform" << std::endl;
#endif
break;
case OPT_LIST:
@ -437,4 +437,4 @@ static int parse_opt_trans(int key, char* arg, struct argp_state*)
}
const struct argp trans_argp = { options, parse_opt_trans, nullptr, nullptr,
nullptr, nullptr, nullptr };
nullptr, nullptr, nullptr };

View file

@ -89,9 +89,9 @@ public:
using spot::formater::has;
translator_runner(spot::bdd_dict_ptr dict,
// whether we accept the absence of output
// specifier
bool no_output_allowed = false);
// whether we accept the absence of output
// specifier
bool no_output_allowed = false);
void string_to_tmp(std::string& str, unsigned n, std::string& tmpname);
const std::string& formula() const;
void round_formula(spot::formula f, unsigned serial);

View file

@ -89,9 +89,9 @@ parse_opt(int key, char* arg, struct argp_state*)
break;
case 'x':
{
const char* opt = extra_options.parse_options(arg);
if (opt)
error(2, 0, "failed to parse --options near '%s'", opt);
const char* opt = extra_options.parse_options(arg);
if (opt)
error(2, 0, "failed to parse --options near '%s'", opt);
}
break;
case ARGP_KEY_ARG:
@ -125,7 +125,7 @@ namespace
int
process_automaton(const spot::const_parsed_aut_ptr& haut,
const char* filename)
const char* filename)
{
spot::stopwatch sw;
sw.start();
@ -151,19 +151,19 @@ namespace
auto hp = spot::automaton_stream_parser(filename, opt_parse);
int err = 0;
while (!abort_run)
{
auto haut = hp.parse(spot::make_bdd_dict());
if (!haut->aut && haut->errors.empty())
break;
if (haut->format_errors(std::cerr))
err = 2;
if (!haut->aut)
error(2, 0, "failed to read automaton from %s", filename);
else if (haut->aborted)
err = std::max(err, aborted(haut, filename));
else
{
auto haut = hp.parse(spot::make_bdd_dict());
if (!haut->aut && haut->errors.empty())
break;
if (haut->format_errors(std::cerr))
err = 2;
if (!haut->aut)
error(2, 0, "failed to read automaton from %s", filename);
else if (haut->aborted)
err = std::max(err, aborted(haut, filename));
else
process_automaton(haut, filename);
}
}
return err;
}
};
@ -175,7 +175,7 @@ main(int argc, char** argv)
setup(argv);
const argp ap = { options, parse_opt, "[FILENAMES...]",
argp_program_doc, children, nullptr, nullptr };
argp_program_doc, children, nullptr, nullptr };
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, nullptr, nullptr))
exit(err);
@ -192,7 +192,7 @@ main(int argc, char** argv)
{
dstar_processor processor(post);
if (processor.run())
return 2;
return 2;
}
catch (const std::runtime_error& e)
{

View file

@ -43,8 +43,8 @@
// @InProceedings{gastin.01.cav,
// author = {Paul Gastin and Denis Oddoux},
// title = {Fast {LTL} to {B\"u}chi Automata Translation},
// booktitle = {Proceedings of the 13th International Conference on
// Computer Aided Verification (CAV'01)},
// booktitle = {Proceedings of the 13th International Conference on
// Computer Aided Verification (CAV'01)},
// pages = {53--65},
// year = 2001,
// editor = {G. Berry and H. Comon and A. Finkel},
@ -58,7 +58,7 @@
// author = {Kristin Y. Rozier and Moshe Y. Vardi},
// title = {LTL Satisfiability Checking},
// booktitle = {Proceedings of the 12th International SPIN Workshop on
// Model Checking of Software (SPIN'07)},
// Model Checking of Software (SPIN'07)},
// pages = {149--167},
// year = {2007},
// volume = {4595},
@ -294,9 +294,9 @@ E_n(std::string name, int n)
p << name << n;
formula f = formula::ap(p.str());
if (result)
result = And_(f, result);
result = And_(f, result);
else
result = f;
result = f;
result = F_(result);
}
return result;
@ -314,9 +314,9 @@ phi_n(std::string name, int n)
for (; n > 0; --n)
{
if (result)
result = And_(p, X_(result));
result = And_(p, X_(result));
else
result = p;
result = p;
}
return result;
}
@ -339,14 +339,14 @@ phi_prime_n(std::string name, int n)
for (; n > 0; --n)
{
if (result)
{
p = X_(p);
result = And_(result, p);
}
{
p = X_(p);
result = And_(result, p);
}
else
{
result = p;
}
{
result = p;
}
}
return result;
}
@ -377,9 +377,9 @@ GF_n(std::string name, int n, bool conj = true)
formula f = G_(F_(formula::ap(p.str())));
if (result)
result = formula::multop(o, {f, result});
result = formula::multop(o, {f, result});
else
result = f;
result = f;
}
return result;
}
@ -403,9 +403,9 @@ FG_n(std::string name, int n, bool conj = false)
formula f = F_(G_(formula::ap(p.str())));
if (result)
result = formula::multop(o, {f, result});
result = formula::multop(o, {f, result});
else
result = f;
result = f;
}
return result;
}
@ -426,11 +426,11 @@ bin_n(std::string name, int n, op o, bool right_assoc = false)
p << name << (right_assoc ? (n + 1 - i) : i);
formula f = formula::ap(p.str());
if (!result)
result = f;
result = f;
else if (right_assoc)
result = formula::binop(o, f, result);
result = formula::binop(o, f, result);
else
result = formula::binop(o, result, f);
result = formula::binop(o, result, f);
}
return result;
}
@ -464,9 +464,9 @@ R_n(std::string name, int n)
formula f = Or_(gf, fg);
if (result)
result = And_(f, result);
result = And_(f, result);
else
result = f;
result = f;
}
return result;
}
@ -501,9 +501,9 @@ Q_n(std::string name, int n)
f = Or_(f, g);
if (result)
result = And_(f, result);
result = And_(f, result);
else
result = f;
result = f;
}
return result;
}
@ -527,9 +527,9 @@ combunop_n(std::string name, int n, op o, bool conj = false)
formula f = formula::unop(o, formula::ap(p.str()));
if (result)
result = formula::multop(cop, {f, result});
result = formula::multop(cop, {f, result});
else
result = f;
result = f;
}
return result;
}
@ -575,7 +575,7 @@ ltl_counter(std::string bit, std::string marker, int n, bool linear)
// G(m -> X(!m)&XX(!m)&XXX(m)) [if n = 3]
std::vector<formula> v(n);
for (int i = 0; i + 1 < n; ++i)
v[i] = X_n(neg_m, i + 1);
v[i] = X_n(neg_m, i + 1);
v[n - 1] = X_n(m, n);
res[0] = And_(m, G_(Implies_(m, formula::And(std::move(v)))));
}
@ -584,7 +584,7 @@ ltl_counter(std::string bit, std::string marker, int n, bool linear)
// G(m -> X(!m & X(!m X(m)))) [if n = 3]
formula p = m;
for (int i = n - 1; i > 0; --i)
p = And_(neg_m, X_(p));
p = And_(neg_m, X_(p));
res[0] = And_(m, G_(Implies_(m, X_(p))));
}
@ -594,7 +594,7 @@ ltl_counter(std::string bit, std::string marker, int n, bool linear)
// !b & X(!b) & XX(!b) [if n = 3]
std::vector<formula> v2(n);
for (int i = 0; i < n; ++i)
v2[i] = X_n(neg_b, i);
v2[i] = X_n(neg_b, i);
res[1] = formula::And(std::move(v2));
}
else
@ -602,7 +602,7 @@ ltl_counter(std::string bit, std::string marker, int n, bool linear)
// !b & X(!b & X(!b)) [if n = 3]
formula p = neg_b;
for (int i = n - 1; i > 0; --i)
p = And_(neg_b, X_(p));
p = And_(neg_b, X_(p));
res[1] = p;
}
@ -613,26 +613,26 @@ ltl_counter(std::string bit, std::string marker, int n, bool linear)
formula Xnm1_b = X_n(b, n - 1);
formula Xn_b = X_(Xnm1_b);
res[2] = G_(Implies_(And_(m, neg_b),
AndX_(Xnm1_b, U_(And_(Not_(m), Equiv_(b, Xn_b)), m))));
AndX_(Xnm1_b, U_(And_(Not_(m), Equiv_(b, Xn_b)), m))));
// From the least significant bit to the first 0, all the bits
// are flipped on the next value. Remaining bits are identical.
formula Xnm1_negb = X_n(neg_b, n - 1);
formula Xn_negb = X_(Xnm1_negb);
res[3] = G_(Implies_(And_(m, b),
AndX_(Xnm1_negb,
U_(And_(And_(b, neg_m), Xn_negb),
Or_(m, And_(And_(neg_m, neg_b),
AndX_(Xnm1_b,
U_(And_(neg_m,
Equiv_(b, Xn_b)),
m))))))));
AndX_(Xnm1_negb,
U_(And_(And_(b, neg_m), Xn_negb),
Or_(m, And_(And_(neg_m, neg_b),
AndX_(Xnm1_b,
U_(And_(neg_m,
Equiv_(b, Xn_b)),
m))))))));
return formula::And(std::move(res));
}
static formula
ltl_counter_carry(std::string bit, std::string marker,
std::string carry, int n, bool linear)
std::string carry, int n, bool linear)
{
formula b = formula::ap(bit);
formula neg_b = Not_(b);
@ -650,7 +650,7 @@ ltl_counter_carry(std::string bit, std::string marker,
// G(m -> X(!m)&XX(!m)&XXX(m)) [if n = 3]
std::vector<formula> v(n);
for (int i = 0; i + 1 < n; ++i)
v[i] = X_n(neg_m, i + 1);
v[i] = X_n(neg_m, i + 1);
v[n - 1] = X_n(m, n);
res[0] = And_(m, G_(Implies_(m, formula::And(std::move(v)))));
}
@ -659,7 +659,7 @@ ltl_counter_carry(std::string bit, std::string marker,
// G(m -> X(!m & X(!m X(m)))) [if n = 3]
formula p = m;
for (int i = n - 1; i > 0; --i)
p = And_(neg_m, X_(p));
p = And_(neg_m, X_(p));
res[0] = And_(m, G_(Implies_(m, X_(p))));
}
@ -669,7 +669,7 @@ ltl_counter_carry(std::string bit, std::string marker,
// !b & X(!b) & XX(!b) [if n = 3]
std::vector<formula> v2(n);
for (int i = 0; i < n; ++i)
v2[i] = X_n(neg_b, i);
v2[i] = X_n(neg_b, i);
res[1] = formula::And(std::move(v2));
}
else
@ -677,7 +677,7 @@ ltl_counter_carry(std::string bit, std::string marker,
// !b & X(!b & X(!b)) [if n = 3]
formula p = neg_b;
for (int i = n - 1; i > 0; --i)
p = And_(neg_b, X_(p));
p = And_(neg_b, X_(p));
res[1] = p;
}
@ -694,24 +694,24 @@ ltl_counter_carry(std::string bit, std::string marker,
{
// If there's no carry, then all of the bits stay the same n steps later.
res[4] = G_(Implies_(And_(neg_c, X_(neg_m)),
And_(X_(Not_(c)), Equiv_(X_(b), X_(Xn_b)))));
And_(X_(Not_(c)), Equiv_(X_(b), X_(Xn_b)))));
// If there's a carry, then add one: flip the bits of b and
// adjust the carry.
res[5] = G_(Implies_(c, And_(Implies_(X_(neg_b),
And_(X_(neg_c), X_(Xn_b))),
Implies_(X_(b),
And_(X_(c), X_(Xn_negb))))));
And_(X_(neg_c), X_(Xn_b))),
Implies_(X_(b),
And_(X_(c), X_(Xn_negb))))));
}
else
{
// If there's no carry, then all of the bits stay the same n steps later.
res[4] = G_(Implies_(And_(neg_c, X_(neg_m)),
X_(And_(Not_(c), Equiv_(b, Xn_b)))));
X_(And_(Not_(c), Equiv_(b, Xn_b)))));
// If there's a carry, then add one: flip the bits of b and
// adjust the carry.
res[5] = G_(Implies_(c, X_(And_(Implies_(neg_b, And_(neg_c, Xn_b)),
Implies_(b, And_(c, Xn_negb))))));
Implies_(b, And_(c, Xn_negb))))));
}
return formula::And(std::move(res));
}
@ -804,12 +804,12 @@ run_jobs()
int inc = (j.range.max < j.range.min) ? -1 : 1;
int n = j.range.min;
for (;;)
{
output_pattern(j.pattern, n);
if (n == j.range.max)
break;
n += inc;
}
{
output_pattern(j.pattern, n);
if (n == j.range.max)
break;
n += inc;
}
}
}
@ -820,14 +820,14 @@ main(int argc, char** argv)
setup(argv);
const argp ap = { options, parse_opt, nullptr, argp_program_doc,
children, nullptr, nullptr };
children, nullptr, nullptr };
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, nullptr, nullptr))
exit(err);
if (jobs.empty())
error(1, 0, "Nothing to do. Try '%s --help' for more information.",
program_name);
program_name);
run_jobs();
return 0;

View file

@ -90,9 +90,9 @@ parse_opt(int key, char* arg, struct argp_state*)
break;
case 'x':
{
const char* opt = extra_options.parse_options(arg);
if (opt)
error(2, 0, "failed to parse --options near '%s'", opt);
const char* opt = extra_options.parse_options(arg);
if (opt)
error(2, 0, "failed to parse --options near '%s'", opt);
}
break;
case ARGP_KEY_ARG:
@ -122,19 +122,19 @@ namespace
int
process_formula(spot::formula f,
const char* filename = nullptr, int linenum = 0)
const char* filename = nullptr, int linenum = 0)
{
// This should not happen, because the parser we use can only
// read PSL/LTL formula, but since our formula type can
// represent more than PSL formula, let's make this
// future-proof.
if (!f.is_psl_formula())
{
std::string s = spot::str_psl(f);
error_at_line(2, 0, filename, linenum,
"formula '%s' is not an LTL or PSL formula",
s.c_str());
}
{
std::string s = spot::str_psl(f);
error_at_line(2, 0, filename, linenum,
"formula '%s' is not an LTL or PSL formula",
s.c_str());
}
spot::stopwatch sw;
sw.start();
@ -142,7 +142,7 @@ namespace
const double translation_time = sw.stop();
printer.print(aut, f, filename, linenum, translation_time, nullptr,
prefix, suffix);
prefix, suffix);
return 0;
}
};
@ -157,7 +157,7 @@ main(int argc, char** argv)
setup(argv);
const argp ap = { options, parse_opt, "[FORMULA...]",
argp_program_doc, children, nullptr, nullptr };
argp_program_doc, children, nullptr, nullptr };
simplification_level = 3;
@ -166,7 +166,7 @@ main(int argc, char** argv)
if (jobs.empty())
error(2, 0, "No formula to translate? Run '%s --help' for usage.",
program_name);
program_name);
spot::translator trans(&extra_options);
trans.set_pref(pref | comp | sbacc | unambig);
@ -177,7 +177,7 @@ main(int argc, char** argv)
{
trans_processor processor(trans);
if (processor.run())
return 2;
return 2;
}
catch (const std::runtime_error& e)
{

View file

@ -119,9 +119,9 @@ parse_opt(int key, char* arg, struct argp_state*)
break;
case 'x':
{
const char* opt = extra_options.parse_options(arg);
if (opt)
error(2, 0, "failed to parse --options near '%s'", opt);
const char* opt = extra_options.parse_options(arg);
if (opt)
error(2, 0, "failed to parse --options near '%s'", opt);
}
break;
case OPT_TGTA:
@ -171,7 +171,7 @@ namespace
int
process_formula(spot::formula f,
const char* filename = nullptr, int linenum = 0)
const char* filename = nullptr, int linenum = 0)
{
auto aut = trans.run(&f);
@ -180,33 +180,33 @@ namespace
// represent more than PSL formula, let's make this
// future-proof.
if (!f.is_psl_formula())
{
std::string s = spot::str_psl(f);
error_at_line(2, 0, filename, linenum,
"formula '%s' is not an LTL or PSL formula",
s.c_str());
}
{
std::string s = spot::str_psl(f);
error_at_line(2, 0, filename, linenum,
"formula '%s' is not an LTL or PSL formula",
s.c_str());
}
bdd ap_set = atomic_prop_collect_as_bdd(f, aut);
if (ta_type != TGTA)
{
auto testing_automaton =
tgba_to_ta(aut, ap_set, type == spot::postprocessor::BA,
opt_with_artificial_initial_state,
opt_single_pass_emptiness_check,
opt_with_artificial_livelock);
if (level != spot::postprocessor::Low)
testing_automaton = spot::minimize_ta(testing_automaton);
spot::print_dot(std::cout, testing_automaton);
}
{
auto testing_automaton =
tgba_to_ta(aut, ap_set, type == spot::postprocessor::BA,
opt_with_artificial_initial_state,
opt_single_pass_emptiness_check,
opt_with_artificial_livelock);
if (level != spot::postprocessor::Low)
testing_automaton = spot::minimize_ta(testing_automaton);
spot::print_dot(std::cout, testing_automaton);
}
else
{
auto tgta = tgba_to_tgta(aut, ap_set);
if (level != spot::postprocessor::Low)
tgta = spot::minimize_tgta(tgta);
spot::print_dot(std::cout, tgta->get_ta());
}
{
auto tgta = tgba_to_tgta(aut, ap_set);
if (level != spot::postprocessor::Low)
tgta = spot::minimize_tgta(tgta);
spot::print_dot(std::cout, tgta->get_ta());
}
flush_cout();
return 0;
}
@ -219,7 +219,7 @@ main(int argc, char** argv)
setup(argv);
const argp ap = { options, parse_opt, "[FORMULA...]",
argp_program_doc, children, nullptr, nullptr };
argp_program_doc, children, nullptr, nullptr };
simplification_level = 3;
@ -228,7 +228,7 @@ main(int argc, char** argv)
if (jobs.empty())
error(2, 0, "No formula to translate? Run '%s --help' for usage.",
program_name);
program_name);
spot::translator trans(&extra_options);
trans.set_pref(pref | comp | sbacc);

File diff suppressed because it is too large Load diff

View file

@ -151,57 +151,57 @@ namespace
spot::twa_graph_ptr res = nullptr;
if (timed_out)
{
problem = false; // A timeout is considered benign
std::cerr << "warning: timeout during execution of command \""
<< cmd << "\"\n";
++timeout_count;
}
{
problem = false; // A timeout is considered benign
std::cerr << "warning: timeout during execution of command \""
<< cmd << "\"\n";
++timeout_count;
}
else if (WIFSIGNALED(es))
{
problem = true;
es = WTERMSIG(es);
std::cerr << "error: execution of command \"" << cmd
<< "\" terminated by signal " << es << ".\n";
}
{
problem = true;
es = WTERMSIG(es);
std::cerr << "error: execution of command \"" << cmd
<< "\" terminated by signal " << es << ".\n";
}
else if (WIFEXITED(es) && WEXITSTATUS(es) != 0)
{
problem = true;
es = WEXITSTATUS(es);
std::cerr << "error: execution of command \"" << cmd
<< "\" returned exit code " << es << ".\n";
}
{
problem = true;
es = WEXITSTATUS(es);
std::cerr << "error: execution of command \"" << cmd
<< "\" returned exit code " << es << ".\n";
}
else if (output.val())
{
problem = false;
auto aut = spot::parse_aut(output.val()->name(), dict,
spot::default_environment::instance(),
opt_parse);
if (!aut->errors.empty())
{
problem = true;
std::cerr << "error: failed to parse the automaton "
"produced by \"" << cmd << "\".\n";
aut->format_errors(std::cerr);
res = nullptr;
}
else if (aut->aborted)
{
problem = true;
std::cerr << "error: command \"" << cmd
<< "\" aborted its output.\n";
res = nullptr;
}
else
{
res = aut->aut;
}
}
else // No automaton output
{
problem = false;
res = nullptr;
}
{
problem = false;
auto aut = spot::parse_aut(output.val()->name(), dict,
spot::default_environment::instance(),
opt_parse);
if (!aut->errors.empty())
{
problem = true;
std::cerr << "error: failed to parse the automaton "
"produced by \"" << cmd << "\".\n";
aut->format_errors(std::cerr);
res = nullptr;
}
else if (aut->aborted)
{
problem = true;
std::cerr << "error: command \"" << cmd
<< "\" aborted its output.\n";
res = nullptr;
}
else
{
res = aut->aut;
}
}
else // No automaton output
{
problem = false;
res = nullptr;
}
output.cleanup();
return res;
@ -234,18 +234,18 @@ namespace
int
process_string(const std::string& input,
const char* filename,
int linenum)
const char* filename,
int linenum)
{
spot::parsed_formula pf = parse_formula(input);
if (!pf.f || !pf.errors.empty())
{
if (filename)
error_at_line(0, 0, filename, linenum, "parse error:");
pf.format_errors(std::cerr);
return 1;
}
{
if (filename)
error_at_line(0, 0, filename, linenum, "parse error:");
pf.format_errors(std::cerr);
return 1;
}
inputf = input;
process_formula(pf.f, filename, linenum);
@ -255,43 +255,43 @@ namespace
int
process_formula(spot::formula f,
const char* filename = nullptr, int linenum = 0)
const char* filename = nullptr, int linenum = 0)
{
std::unique_ptr<spot::relabeling_map> relmap;
// If atomic propositions are incompatible with one of the
// output, relabel the formula.
if ((!f.has_lbt_atomic_props() &&
(runner.has('l') || runner.has('L') || runner.has('T')))
|| (!f.has_spin_atomic_props() &&
(runner.has('s') || runner.has('S'))))
{
relmap.reset(new spot::relabeling_map);
f = spot::relabel(f, spot::Pnn, relmap.get());
}
(runner.has('l') || runner.has('L') || runner.has('T')))
|| (!f.has_spin_atomic_props() &&
(runner.has('s') || runner.has('S'))))
{
relmap.reset(new spot::relabeling_map);
f = spot::relabel(f, spot::Pnn, relmap.get());
}
static unsigned round = 1;
runner.round_formula(f, round);
unsigned ts = translators.size();
for (unsigned t = 0; t < ts; ++t)
{
bool problem;
double translation_time;
auto aut = runner.translate(t, problem, translation_time);
if (problem)
error_at_line(2, 0, filename, linenum, "aborting here");
if (aut)
{
if (relmap)
relabel_here(aut, relmap.get());
aut = post.run(aut, f);
cmdname = translators[t].name;
roundval = round;
printer.print(aut, f, filename, linenum, translation_time,
nullptr, prefix, suffix);
};
}
{
bool problem;
double translation_time;
auto aut = runner.translate(t, problem, translation_time);
if (problem)
error_at_line(2, 0, filename, linenum, "aborting here");
if (aut)
{
if (relmap)
relabel_here(aut, relmap.get());
aut = post.run(aut, f);
cmdname = translators[t].name;
roundval = round;
printer.print(aut, f, filename, linenum, translation_time,
nullptr, prefix, suffix);
};
}
spot::cleanup_tmpfiles();
++round;
return 0;
@ -305,7 +305,7 @@ main(int argc, char** argv)
setup(argv);
const argp ap = { options, parse_opt, "[COMMANDFMT...]",
argp_program_doc, children, nullptr, nullptr };
argp_program_doc, children, nullptr, nullptr };
// Disable post-processing as much as possible by default.
level = spot::postprocessor::Low;
@ -319,7 +319,7 @@ main(int argc, char** argv)
if (translators.empty())
error(2, 0, "No translator to run? Run '%s --help' for usage.",
program_name);
program_name);
setup_sig_handler();
@ -332,7 +332,7 @@ main(int argc, char** argv)
{
processor p(post);
if (p.run())
return 2;
return 2;
}
catch (const std::runtime_error& e)
{

View file

@ -348,10 +348,10 @@ parse_opt(int key, char* arg, struct argp_state*)
break;
case OPT_EQUIVALENT_TO:
{
if (opt->equivalent_to)
error(2, 0, "only one --equivalent-to option can be given");
opt->equivalent_to = parse_formula_arg(arg);
break;
if (opt->equivalent_to)
error(2, 0, "only one --equivalent-to option can be given");
opt->equivalent_to = parse_formula_arg(arg);
break;
}
case OPT_EXCLUSIVE_AP:
opt->excl_ap.add_group(arg);
@ -364,17 +364,17 @@ parse_opt(int key, char* arg, struct argp_state*)
break;
case OPT_IMPLIED_BY:
{
spot::formula i = parse_formula_arg(arg);
// a→c∧b→c ≡ (ab)→c
opt->implied_by = spot::formula::Or({opt->implied_by, i});
break;
spot::formula i = parse_formula_arg(arg);
// a→c∧b→c ≡ (ab)→c
opt->implied_by = spot::formula::Or({opt->implied_by, i});
break;
}
case OPT_IMPLY:
{
// a→b∧a→c ≡ a→(b∧c)
spot::formula i = parse_formula_arg(arg);
opt->imply = spot::formula::And({opt->imply, i});
break;
// a→b∧a→c ≡ a→(b∧c)
spot::formula i = parse_formula_arg(arg);
opt->imply = spot::formula::And({opt->imply, i});
break;
}
case OPT_LTL:
ltl = true;
@ -392,13 +392,13 @@ parse_opt(int key, char* arg, struct argp_state*)
case OPT_RELABEL_BOOL:
relabeling = (key == OPT_RELABEL_BOOL ? BseRelabeling : ApRelabeling);
if (!arg || !strncasecmp(arg, "abc", 6))
style = spot::Abc;
style = spot::Abc;
else if (!strncasecmp(arg, "pnn", 4))
style = spot::Pnn;
style = spot::Pnn;
else
error(2, 0, "invalid argument for --relabel%s: '%s'",
(key == OPT_RELABEL_BOOL ? "-bool" : ""),
arg);
error(2, 0, "invalid argument for --relabel%s: '%s'",
(key == OPT_RELABEL_BOOL ? "-bool" : ""),
arg);
break;
case OPT_REMOVE_WM:
unabbreviate += "MW";
@ -426,9 +426,9 @@ parse_opt(int key, char* arg, struct argp_state*)
break;
case OPT_UNABBREVIATE:
if (arg)
unabbreviate += arg;
unabbreviate += arg;
else
unabbreviate += spot::default_unabbrev_string;
unabbreviate += spot::default_unabbrev_string;
break;
case OPT_AP_N:
ap_n = parse_range(arg, 0, std::numeric_limits<int>::max());
@ -479,87 +479,87 @@ namespace
int
process_string(const std::string& input,
const char* filename = nullptr, int linenum = 0)
const char* filename = nullptr, int linenum = 0)
{
spot::parsed_formula pf = parse_formula(input);
if (!pf.f || !pf.errors.empty())
{
if (!ignore_errors)
{
if (filename)
error_at_line(0, 0, filename, linenum, "parse error:");
pf.format_errors(std::cerr);
}
{
if (!ignore_errors)
{
if (filename)
error_at_line(0, 0, filename, linenum, "parse error:");
pf.format_errors(std::cerr);
}
if (error_style == skip_errors)
std::cout << input << '\n';
else
assert(error_style == drop_errors);
check_cout();
return !ignore_errors;
}
if (error_style == skip_errors)
std::cout << input << '\n';
else
assert(error_style == drop_errors);
check_cout();
return !ignore_errors;
}
try
{
return process_formula(pf.f, filename, linenum);
}
{
return process_formula(pf.f, filename, linenum);
}
catch (const std::runtime_error& e)
{
error_at_line(2, 0, filename, linenum, "%s", e.what());
SPOT_UNREACHABLE();
}
{
error_at_line(2, 0, filename, linenum, "%s", e.what());
SPOT_UNREACHABLE();
}
}
int
process_formula(spot::formula f,
const char* filename = nullptr, int linenum = 0)
const char* filename = nullptr, int linenum = 0)
{
if (opt_max_count >= 0 && match_count >= opt_max_count)
{
abort_run = true;
return 0;
}
{
abort_run = true;
return 0;
}
if (negate)
f = spot::formula::Not(f);
f = spot::formula::Not(f);
if (remove_x)
{
// If simplification are enabled, we do them before and after.
if (simplification_level)
f = simpl.simplify(f);
f = spot::remove_x(f);
}
{
// If simplification are enabled, we do them before and after.
if (simplification_level)
f = simpl.simplify(f);
f = spot::remove_x(f);
}
if (simplification_level || boolean_to_isop)
f = simpl.simplify(f);
f = simpl.simplify(f);
if (nnf)
f = simpl.negative_normal_form(f);
f = simpl.negative_normal_form(f);
switch (relabeling)
{
case ApRelabeling:
{
relmap.clear();
f = spot::relabel(f, style, &relmap);
break;
}
case BseRelabeling:
{
relmap.clear();
f = spot::relabel_bse(f, style, &relmap);
break;
}
case NoRelabeling:
break;
}
{
case ApRelabeling:
{
relmap.clear();
f = spot::relabel(f, style, &relmap);
break;
}
case BseRelabeling:
{
relmap.clear();
f = spot::relabel_bse(f, style, &relmap);
break;
}
case NoRelabeling:
break;
}
if (!unabbreviate.empty())
f = spot::unabbreviate(f, unabbreviate.c_str());
f = spot::unabbreviate(f, unabbreviate.c_str());
if (!opt->excl_ap.empty())
f = opt->excl_ap.constrain(f);
f = opt->excl_ap.constrain(f);
bool matched = true;
@ -575,32 +575,32 @@ namespace
matched &= !syntactic_persistence || f.is_syntactic_persistence();
matched &= !syntactic_si || f.is_syntactic_stutter_invariant();
if (matched && (ap_n.min > 0 || ap_n.max >= 0))
{
auto s = atomic_prop_collect(f);
int n = s->size();
delete s;
matched &= (ap_n.min <= 0) || (n >= ap_n.min);
matched &= (ap_n.max < 0) || (n <= ap_n.max);
}
{
auto s = atomic_prop_collect(f);
int n = s->size();
delete s;
matched &= (ap_n.min <= 0) || (n >= ap_n.min);
matched &= (ap_n.max < 0) || (n <= ap_n.max);
}
if (matched && (size.min > 0 || size.max >= 0))
{
int l = spot::length(f);
matched &= (size.min <= 0) || (l >= size.min);
matched &= (size.max < 0) || (l <= size.max);
}
{
int l = spot::length(f);
matched &= (size.min <= 0) || (l >= size.min);
matched &= (size.max < 0) || (l <= size.max);
}
if (matched && (bsize.min > 0 || bsize.max >= 0))
{
int l = spot::length_boolone(f);
matched &= (bsize.min <= 0) || (l >= bsize.min);
matched &= (bsize.max < 0) || (l <= bsize.max);
}
{
int l = spot::length_boolone(f);
matched &= (bsize.min <= 0) || (l >= bsize.min);
matched &= (bsize.max < 0) || (l <= bsize.max);
}
matched &= !opt->implied_by || simpl.implication(opt->implied_by, f);
matched &= !opt->imply || simpl.implication(f, opt->imply);
matched &= !opt->equivalent_to
|| simpl.are_equivalent(f, opt->equivalent_to);
|| simpl.are_equivalent(f, opt->equivalent_to);
matched &= !stutter_insensitive || spot::is_stutter_invariant(f);
// Match obligations and subclasses using WDBA minimization.
@ -608,46 +608,46 @@ namespace
// have to compute it on formulas that have been discarded for
// other reasons.
if (matched && obligation)
{
auto aut = ltl_to_tgba_fm(f, simpl.get_dict());
auto min = minimize_obligation(aut, f);
assert(min);
if (aut == min)
{
// Not an obligation
matched = false;
}
else
{
matched &= !guarantee || is_terminal_automaton(min);
matched &= !safety || is_safety_mwdba(min);
}
}
{
auto aut = ltl_to_tgba_fm(f, simpl.get_dict());
auto min = minimize_obligation(aut, f);
assert(min);
if (aut == min)
{
// Not an obligation
matched = false;
}
else
{
matched &= !guarantee || is_terminal_automaton(min);
matched &= !safety || is_safety_mwdba(min);
}
}
matched ^= invert;
if (unique && !unique_set.insert(f).second)
matched = false;
matched = false;
if (matched)
{
if (opt->output_define
&& output_format != count_output
&& output_format != quiet_output)
{
// Sort the formulas alphabetically.
std::map<std::string, spot::formula> m;
for (auto& p: relmap)
m.emplace(str_psl(p.first), p.second);
for (auto& p: m)
stream_formula(opt->output_define->ostream()
<< "#define " << p.first << " (",
p.second, filename, linenum) << ")\n";
}
one_match = true;
output_formula_checked(f, filename, linenum, prefix, suffix);
++match_count;
}
{
if (opt->output_define
&& output_format != count_output
&& output_format != quiet_output)
{
// Sort the formulas alphabetically.
std::map<std::string, spot::formula> m;
for (auto& p: relmap)
m.emplace(str_psl(p.first), p.second);
for (auto& p: m)
stream_formula(opt->output_define->ostream()
<< "#define " << p.first << " (",
p.second, filename, linenum) << ")\n";
}
one_match = true;
output_formula_checked(f, filename, linenum, prefix, suffix);
++match_count;
}
return 0;
}
};
@ -659,7 +659,7 @@ main(int argc, char** argv)
setup(argv);
const argp ap = { options, parse_opt, "[FILENAME[/COL]...]",
argp_program_doc, children, nullptr, nullptr };
argp_program_doc, children, nullptr, nullptr };
try
{
@ -669,20 +669,20 @@ main(int argc, char** argv)
opt = &o;
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, nullptr, nullptr))
exit(err);
exit(err);
if (jobs.empty())
jobs.emplace_back("-", 1);
jobs.emplace_back("-", 1);
if (boolean_to_isop && simplification_level == 0)
simplification_level = 1;
simplification_level = 1;
spot::tl_simplifier_options opt(simplification_level);
opt.boolean_to_isop = boolean_to_isop;
spot::tl_simplifier simpl(opt);
ltl_processor processor(simpl);
if (processor.run())
return 2;
return 2;
}
catch (const std::runtime_error& e)
{

View file

@ -113,12 +113,12 @@ namespace
public:
int
process_formula(spot::formula f, const char* filename = nullptr,
int linenum = 0)
int linenum = 0)
{
auto mutations =
spot::mutate(f, mut_opts, max_output, mutation_nb, opt_sort);
spot::mutate(f, mut_opts, max_output, mutation_nb, opt_sort);
for (auto g: mutations)
output_formula_checked(g, filename, linenum, prefix, suffix);
output_formula_checked(g, filename, linenum, prefix, suffix);
return 0;
}
};
@ -182,7 +182,7 @@ main(int argc, char* argv[])
setup(argv);
const argp ap = { options, parse_opt, "[FILENAME[/COL]...]", argp_program_doc,
children, nullptr, nullptr };
children, nullptr, nullptr };
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, nullptr, nullptr))
exit(err);

View file

@ -191,24 +191,24 @@ parse_opt(int key, char* arg, struct argp_state* as)
case 'a':
opt_acc_prob = to_float(arg);
if (opt_acc_prob < 0.0 || opt_acc_prob > 1.0)
error(2, 0, "probability of acceptance set membership "
"should be between 0.0 and 1.0");
error(2, 0, "probability of acceptance set membership "
"should be between 0.0 and 1.0");
break;
case 'A':
if (looks_like_a_range(arg))
{
opt_acc_sets = parse_range(arg);
if (opt_acc_sets.min > opt_acc_sets.max)
std::swap(opt_acc_sets.min, opt_acc_sets.max);
if (opt_acc_sets.min < 0)
error(2, 0, "number of acceptance sets should be positive");
gba_wanted = true;
}
{
opt_acc_sets = parse_range(arg);
if (opt_acc_sets.min > opt_acc_sets.max)
std::swap(opt_acc_sets.min, opt_acc_sets.max);
if (opt_acc_sets.min < 0)
error(2, 0, "number of acceptance sets should be positive");
gba_wanted = true;
}
else
{
opt_acceptance = arg;
generic_wanted = true;
}
{
opt_acceptance = arg;
generic_wanted = true;
}
break;
case 'B':
ba_options();
@ -217,7 +217,7 @@ parse_opt(int key, char* arg, struct argp_state* as)
case 'e':
opt_density = to_float(arg);
if (opt_density < 0.0 || opt_density > 1.0)
error(2, 0, "density should be between 0.0 and 1.0");
error(2, 0, "density should be between 0.0 and 1.0");
break;
case 'D':
opt_deterministic = true;
@ -228,9 +228,9 @@ parse_opt(int key, char* arg, struct argp_state* as)
case 'Q':
opt_states = parse_range(arg);
if (opt_states.min > opt_states.max)
std::swap(opt_states.min, opt_states.max);
std::swap(opt_states.min, opt_states.max);
if (opt_states.min == 0)
error(1, 0, "cannot build an automaton with 0 states");
error(1, 0, "cannot build an automaton with 0 states");
break;
case 'S':
opt_state_acc = true;
@ -255,14 +255,14 @@ parse_opt(int key, char* arg, struct argp_state* as)
// last non-option argument, and if aprops.empty() we know this
// is the also the first one.
if (opt->aprops.empty()
&& as->argc == as->next && looks_like_a_range(arg))
{
ap_count_given = parse_range(arg);
// Create the set once if the count is fixed.
if (ap_count_given.min == ap_count_given.max)
opt->aprops = spot::create_atomic_prop_set(ap_count_given.min);
break;
}
&& as->argc == as->next && looks_like_a_range(arg))
{
ap_count_given = parse_range(arg);
// Create the set once if the count is fixed.
if (ap_count_given.min == ap_count_given.max)
opt->aprops = spot::create_atomic_prop_set(ap_count_given.min);
break;
}
opt->aprops.insert(spot::formula::ap(arg));
break;
@ -281,7 +281,7 @@ main(int argc, char** argv)
setup(argv);
const argp ap = { options, parse_opt, "N|PROP...", argp_program_doc,
children, nullptr, nullptr };
children, nullptr, nullptr };
try
{
@ -291,43 +291,43 @@ main(int argc, char** argv)
opt = &o;
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, nullptr, nullptr))
exit(err);
exit(err);
// running 'randaut 0' is one way to generate automata using no
// atomic propositions so do not complain in that case.
if (opt->aprops.empty() && ap_count_given.max < 0)
error(2, 0,
"No atomic proposition supplied? Run '%s --help' for usage.",
program_name);
error(2, 0,
"No atomic proposition supplied? Run '%s --help' for usage.",
program_name);
if (generic_wanted && automaton_format == Spin)
error(2, 0,
"--spin implies --ba so should not be used with --acceptance");
error(2, 0,
"--spin implies --ba so should not be used with --acceptance");
if (generic_wanted && ba_wanted)
error(2, 0, "--acceptance and --ba may not be used together");
error(2, 0, "--acceptance and --ba may not be used together");
if (automaton_format == Spin && opt_acc_sets.max > 1)
error(2, 0, "--spin is incompatible with --acceptance=%d..%d",
opt_acc_sets.min, opt_acc_sets.max);
error(2, 0, "--spin is incompatible with --acceptance=%d..%d",
opt_acc_sets.min, opt_acc_sets.max);
if (ba_wanted && opt_acc_sets.min != 1 && opt_acc_sets.max != 1)
error(2, 0, "--ba is incompatible with --acceptance=%d..%d",
opt_acc_sets.min, opt_acc_sets.max);
error(2, 0, "--ba is incompatible with --acceptance=%d..%d",
opt_acc_sets.min, opt_acc_sets.max);
if (ba_wanted && generic_wanted)
error(2, 0,
"--ba is incompatible with --acceptance=%s", opt_acceptance);
error(2, 0,
"--ba is incompatible with --acceptance=%s", opt_acceptance);
if (automaton_format == Spin)
ba_options();
ba_options();
if (opt_colored && opt_acc_sets.min == -1 && !generic_wanted)
error(2, 0, "--colored requires at least one acceptance set; "
"use --acceptance");
error(2, 0, "--colored requires at least one acceptance set; "
"use --acceptance");
if (opt_colored && opt_acc_sets.min == 0)
error(2, 0, "--colored requires at least one acceptance set; "
"fix the range of --acceptance");
error(2, 0, "--colored requires at least one acceptance set; "
"fix the range of --acceptance");
if (opt_acc_sets.min == -1)
opt_acc_sets.min = 0;
opt_acc_sets.min = 0;
spot::srand(opt_seed);
auto d = spot::make_bdd_dict();
@ -340,70 +340,70 @@ main(int argc, char** argv)
int automaton_num = 0;
for (;;)
{
spot::stopwatch sw;
sw.start();
{
spot::stopwatch sw;
sw.start();
if (ap_count_given.max > 0
&& ap_count_given.min != ap_count_given.max)
{
int c = spot::rrand(ap_count_given.min, ap_count_given.max);
opt->aprops = spot::create_atomic_prop_set(c);
}
if (ap_count_given.max > 0
&& ap_count_given.min != ap_count_given.max)
{
int c = spot::rrand(ap_count_given.min, ap_count_given.max);
opt->aprops = spot::create_atomic_prop_set(c);
}
int size = opt_states.min;
if (size != opt_states.max)
size = spot::rrand(size, opt_states.max);
int size = opt_states.min;
if (size != opt_states.max)
size = spot::rrand(size, opt_states.max);
int accs = opt_acc_sets.min;
if (accs != opt_acc_sets.max)
accs = spot::rrand(accs, opt_acc_sets.max);
int accs = opt_acc_sets.min;
if (accs != opt_acc_sets.max)
accs = spot::rrand(accs, opt_acc_sets.max);
spot::acc_cond::acc_code code;
if (opt_acceptance)
{
code = spot::acc_cond::acc_code(opt_acceptance);
accs = code.used_sets().max_set();
if (opt_colored && accs == 0)
error(2, 0, "--colored requires at least one acceptance set; "
"fix the range of --acceptance");
}
spot::acc_cond::acc_code code;
if (opt_acceptance)
{
code = spot::acc_cond::acc_code(opt_acceptance);
accs = code.used_sets().max_set();
if (opt_colored && accs == 0)
error(2, 0, "--colored requires at least one acceptance set; "
"fix the range of --acceptance");
}
auto aut =
spot::random_graph(size, opt_density, &opt->aprops, d,
accs, opt_acc_prob, 0.5,
opt_deterministic, opt_state_acc,
opt_colored);
auto aut =
spot::random_graph(size, opt_density, &opt->aprops, d,
accs, opt_acc_prob, 0.5,
opt_deterministic, opt_state_acc,
opt_colored);
if (opt_acceptance)
aut->set_acceptance(accs, code);
if (opt_acceptance)
aut->set_acceptance(accs, code);
if (opt_uniq)
{
auto tmp = spot::canonicalize
(make_twa_graph(aut, spot::twa::prop_set::all()));
std::vector<tr_t> trans(tmp->edge_vector().begin() + 1,
tmp->edge_vector().end());
if (!opt_uniq->emplace(trans).second)
{
--trials;
if (trials == 0)
error(2, 0, "failed to generate a new unique automaton"
" after %d trials", max_trials);
continue;
}
trials = max_trials;
}
if (opt_uniq)
{
auto tmp = spot::canonicalize
(make_twa_graph(aut, spot::twa::prop_set::all()));
std::vector<tr_t> trans(tmp->edge_vector().begin() + 1,
tmp->edge_vector().end());
if (!opt_uniq->emplace(trans).second)
{
--trials;
if (trials == 0)
error(2, 0, "failed to generate a new unique automaton"
" after %d trials", max_trials);
continue;
}
trials = max_trials;
}
auto runtime = sw.stop();
auto runtime = sw.stop();
printer.print(aut, nullptr,
opt_seed_str, automaton_num, runtime, nullptr);
printer.print(aut, nullptr,
opt_seed_str, automaton_num, runtime, nullptr);
++automaton_num;
if (opt_automata > 0 && automaton_num >= opt_automata)
break;
}
++automaton_num;
if (opt_automata > 0 && automaton_num >= opt_automata)
break;
}
}
catch (const std::runtime_error& e)
{

View file

@ -197,7 +197,7 @@ parse_opt(int key, char* arg, struct argp_state* as)
case OPT_TREE_SIZE:
opt_tree_size = parse_range(arg);
if (opt_tree_size.min > opt_tree_size.max)
std::swap(opt_tree_size.min, opt_tree_size.max);
std::swap(opt_tree_size.min, opt_tree_size.max);
break;
case OPT_WF:
opt_wf = true;
@ -211,16 +211,16 @@ parse_opt(int key, char* arg, struct argp_state* as)
// last non-option argument, and if aprops.empty() we know this
// is the also the first one.
if (opt->aprops.empty() && as->argc == as->next)
{
char* endptr;
int res = strtol(arg, &endptr, 10);
if (!*endptr && res >= 0) // arg is a number
{
ap_count_given = true;
opt->aprops = spot::create_atomic_prop_set(res);
break;
}
}
{
char* endptr;
int res = strtol(arg, &endptr, 10);
if (!*endptr && res >= 0) // arg is a number
{
ap_count_given = true;
opt->aprops = spot::create_atomic_prop_set(res);
break;
}
}
opt->aprops.insert(spot::default_environment::instance().require(arg));
break;
default:
@ -235,7 +235,7 @@ main(int argc, char** argv)
setup(argv);
const argp ap = { options, parse_opt, "N|PROP...", argp_program_doc,
children, nullptr, nullptr };
children, nullptr, nullptr };
try
{
@ -245,78 +245,78 @@ main(int argc, char** argv)
opt = &o;
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, nullptr, nullptr))
exit(err);
exit(err);
// running 'randltl 0' is one way to generate formulas using no
// atomic propositions so do not complain in that case.
if (opt->aprops.empty() && !ap_count_given)
error(2, 0, "No atomic proposition supplied? "
"Run '%s --help' for usage.", program_name);
error(2, 0, "No atomic proposition supplied? "
"Run '%s --help' for usage.", program_name);
spot::srand(opt_seed);
spot::randltlgenerator rg
(opt->aprops,
[&] (){
spot::option_map opts;
opts.set("output", output);
opts.set("tree_size_min", opt_tree_size.min);
opts.set("tree_size_max", opt_tree_size.max);
opts.set("wf", opt_wf);
opts.set("seed", opt_seed);
opts.set("simplification_level", simplification_level);
return opts;
}(), opt_pL, opt_pS, opt_pB);
(opt->aprops,
[&] (){
spot::option_map opts;
opts.set("output", output);
opts.set("tree_size_min", opt_tree_size.min);
opts.set("tree_size_max", opt_tree_size.max);
opts.set("wf", opt_wf);
opts.set("seed", opt_seed);
opts.set("simplification_level", simplification_level);
return opts;
}(), opt_pL, opt_pS, opt_pB);
if (opt_dump_priorities)
{
switch (output)
{
case OUTPUTLTL:
std::cout <<
"Use --ltl-priorities to set the following LTL priorities:\n";
rg.dump_ltl_priorities(std::cout);
break;
case OUTPUTBOOL:
std::cout <<
"Use --boolean-priorities to set the following Boolean "
"formula priorities:\n";
rg.dump_bool_priorities(std::cout);
break;
case OUTPUTPSL:
std::cout <<
"Use --ltl-priorities to set the following LTL priorities:\n";
rg.dump_psl_priorities(std::cout);
// Fall through.
case OUTPUTSERE:
std::cout <<
"Use --sere-priorities to set the following SERE priorities:\n";
rg.dump_sere_priorities(std::cout);
std::cout <<
"Use --boolean-priorities to set the following Boolean "
"formula priorities:\n";
rg.dump_sere_bool_priorities(std::cout);
break;
default:
error(2, 0, "internal error: unknown type of output");
}
exit(0);
}
{
switch (output)
{
case OUTPUTLTL:
std::cout <<
"Use --ltl-priorities to set the following LTL priorities:\n";
rg.dump_ltl_priorities(std::cout);
break;
case OUTPUTBOOL:
std::cout <<
"Use --boolean-priorities to set the following Boolean "
"formula priorities:\n";
rg.dump_bool_priorities(std::cout);
break;
case OUTPUTPSL:
std::cout <<
"Use --ltl-priorities to set the following LTL priorities:\n";
rg.dump_psl_priorities(std::cout);
// Fall through.
case OUTPUTSERE:
std::cout <<
"Use --sere-priorities to set the following SERE priorities:\n";
rg.dump_sere_priorities(std::cout);
std::cout <<
"Use --boolean-priorities to set the following Boolean "
"formula priorities:\n";
rg.dump_sere_bool_priorities(std::cout);
break;
default:
error(2, 0, "internal error: unknown type of output");
}
exit(0);
}
while (opt_formulas < 0 || opt_formulas--)
{
static int count = 0;
spot::formula f = rg.next();
if (!f)
{
error(2, 0, "failed to generate a new unique formula after %d " \
"trials", MAX_TRIALS);
}
else
{
output_formula_checked(f, nullptr, ++count);
}
};
{
static int count = 0;
spot::formula f = rg.next();
if (!f)
{
error(2, 0, "failed to generate a new unique formula after %d " \
"trials", MAX_TRIALS);
}
else
{
output_formula_checked(f, nullptr, ++count);
}
};
}
catch (const std::runtime_error& e)
{

View file

@ -113,7 +113,7 @@ Enabled by default.") },
if the TGBA is not already deterministic. Doing so will degeneralize \
the automaton. This is disabled by default, unless sat-minimize is set.") },
{ DOC("sat-minimize",
"Set to 1 to enable SAT-based minimization of deterministic \
"Set to 1 to enable SAT-based minimization of deterministic \
TGBA: it starts with the number of states of the input, and iteratively \
tries to find a deterministic TGBA with one less state. Set to 2 to perform \
a binary search instead. Disabled (0) by default. The sat solver to use \
@ -123,7 +123,7 @@ set; this can be changed with the sat-acc option, or of course by using -B \
to construct a Büchi automaton. Enabling SAT-based minimization will \
also enable tba-det.") },
{ DOC("sat-states",
"When this is set to some positive integer, the SAT-based \
"When this is set to some positive integer, the SAT-based \
minimization will attempt to construct a TGBA with the given number of \
states. It may however return an automaton with less states if some of \
these are unreachable or useless. Setting sat-states automatically \
@ -131,13 +131,13 @@ enables sat-minimize, but no iteration is performed. If no equivalent \
automaton could be constructed with the given number of states, the original \
automaton is returned.") },
{ DOC("sat-acc",
"When this is set to some positive integer, the SAT-based will \
"When this is set to some positive integer, the SAT-based will \
attempt to construct a TGBA with the given number of acceptance sets. \
states. It may however return an automaton with less acceptance sets if \
some of these are useless. Setting sat-acc automatically \
sets sat-minimize to 1 if not set differently.") },
{ DOC("state-based",
"Set to 1 to instruct the SAT-minimization procedure to produce \
"Set to 1 to instruct the SAT-minimization procedure to produce \
a TGBA where all outgoing transition of a state have the same acceptance \
sets. By default this is only enabled when option -B is used.") },
{ nullptr, 0, nullptr, 0, nullptr, 0 }
@ -155,13 +155,13 @@ main(int argc, char** argv)
setup(argv);
const argp ap = { options, nullptr, nullptr, argp_program_doc, children,
nullptr, nullptr };
nullptr, nullptr };
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, nullptr, nullptr))
exit(err);
std::cerr << "This binary serves no purpose other than generating"
<< " the spot-x.7 manpage.\n";
<< " the spot-x.7 manpage.\n";
return 1;
}