* src/TestOperations.cc (generateBuchiAutomaton): Forward SIGINT

and SIGQUIT.
* src/ExternalTranslator.cc (ExternalTranslator::translate): Likewise.
* src/main.cc (main): Do not intercept SIGINT in
non-interactive runs.
This commit is contained in:
Alexandre Duret-Lutz 2003-07-29 13:06:53 +00:00
parent ea90d2f8be
commit 48c03b89b8
7 changed files with 593 additions and 561 deletions

View file

@ -1,4 +1,12 @@
2003-07-13 Alexandre Duret-Lutz <adl@gnu.org> 2003-07-29 Alexandre Duret-Lutz <aduret@src.lip6.fr>
* src/TestOperations.cc (generateBuchiAutomaton): Forward SIGINT
and SIGQUIT.
* src/ExternalTranslator.cc (ExternalTranslator::translate): Likewise.
* src/main.cc (main): Do not intercept SIGINT in
non-interactive runs.
2003-07-13 Alexandre Duret-Lutz <aduret@src.lip6.fr>
* doc/lbtt.texi: Never use @-commands in @node names, recent Texinfo * doc/lbtt.texi: Never use @-commands in @node names, recent Texinfo
versions are stricter on this. versions are stricter on this.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1999, 2000, 2001, 2002 * Copyright (C) 1999, 2000, 2001, 2002, 2003
* Heikki Tauriainen <Heikki.Tauriainen@hut.fi> * Heikki Tauriainen <Heikki.Tauriainen@hut.fi>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -97,7 +97,7 @@ const struct Configuration::IntegerRange Configuration::STATESPACE_SIZE_RANGE
const struct Configuration::IntegerRange const struct Configuration::IntegerRange
Configuration::STATESPACE_MAX_SIZE_RANGE Configuration::STATESPACE_MAX_SIZE_RANGE
= {1, LONG_MAX, "minimum state space size exceeds the maximum state space " = {1, LONG_MAX, "minimum state space size exceeds the maximum state space "
"size"}; "size"};
@ -312,7 +312,7 @@ void Configuration::read(int argc, char* argv[])
{ {
long int interval_length long int interval_length
= parseCommandLineInteger = parseCommandLineInteger
(command_line_options[option_index].name, optarg); (command_line_options[option_index].name, optarg);
checkIntegerRange(interval_length, GENERATION_RANGE, false); checkIntegerRange(interval_length, GENERATION_RANGE, false);
if (opttype == OPT_FORMULACHANGEINTERVAL) if (opttype == OPT_FORMULACHANGEINTERVAL)
@ -426,14 +426,14 @@ void Configuration::read(int argc, char* argv[])
{ {
long int number_of_rounds long int number_of_rounds
= parseCommandLineInteger = parseCommandLineInteger
(command_line_options[option_index].name, optarg); (command_line_options[option_index].name, optarg);
checkIntegerRange(number_of_rounds, ROUND_COUNT_RANGE, false); checkIntegerRange(number_of_rounds, ROUND_COUNT_RANGE, false);
global_options.number_of_rounds = number_of_rounds; global_options.number_of_rounds = number_of_rounds;
locked_options.insert(make_pair(CFG_GLOBALOPTIONS, CFG_ROUNDS)); locked_options.insert(make_pair(CFG_GLOBALOPTIONS, CFG_ROUNDS));
} }
break; break;
case OPT_SHOWCONFIG : case OPT_SHOWCONFIG :
print_config = true; print_config = true;
break; break;
@ -446,7 +446,7 @@ void Configuration::read(int argc, char* argv[])
{ {
long int rounds_to_skip long int rounds_to_skip
= parseCommandLineInteger = parseCommandLineInteger
(command_line_options[option_index].name, optarg); (command_line_options[option_index].name, optarg);
checkIntegerRange(rounds_to_skip, ROUND_COUNT_RANGE, false); checkIntegerRange(rounds_to_skip, ROUND_COUNT_RANGE, false);
global_options.init_skip = rounds_to_skip; global_options.init_skip = rounds_to_skip;
} }
@ -465,7 +465,7 @@ void Configuration::read(int argc, char* argv[])
{ {
long int verbosity long int verbosity
= parseCommandLineInteger = parseCommandLineInteger
(command_line_options[option_index].name, optarg); (command_line_options[option_index].name, optarg);
checkIntegerRange(verbosity, VERBOSITY_RANGE, false); checkIntegerRange(verbosity, VERBOSITY_RANGE, false);
global_options.verbosity = verbosity; global_options.verbosity = verbosity;
locked_options.insert(make_pair(CFG_GLOBALOPTIONS, CFG_VERBOSITY)); locked_options.insert(make_pair(CFG_GLOBALOPTIONS, CFG_VERBOSITY));
@ -475,17 +475,17 @@ void Configuration::read(int argc, char* argv[])
case OPT_VERSION : case OPT_VERSION :
cout << "lbtt " PACKAGE_VERSION "\n" cout << "lbtt " PACKAGE_VERSION "\n"
"lbtt is free software; you may change and " "lbtt is free software; you may change and "
"redistribute it under the terms of\n" "redistribute it under the terms of\n"
"the GNU General Public License. lbtt comes with " "the GNU General Public License. lbtt comes with "
"NO WARRANTY. See the file\n" "NO WARRANTY. See the file\n"
"COPYING for details.\n"; "COPYING for details.\n";
exit(0); exit(0);
break; break;
case OPT_ABBREVIATEDOPERATORS : case OPT_ABBREVIATEDOPERATORS :
case OPT_NOABBREVIATEDOPERATORS : case OPT_NOABBREVIATEDOPERATORS :
formula_options.allow_abbreviated_operators formula_options.allow_abbreviated_operators
= (opttype == OPT_ABBREVIATEDOPERATORS); = (opttype == OPT_ABBREVIATEDOPERATORS);
locked_options.insert(make_pair(CFG_FORMULAOPTIONS, locked_options.insert(make_pair(CFG_FORMULAOPTIONS,
CFG_ABBREVIATEDOPERATORS)); CFG_ABBREVIATEDOPERATORS));
@ -512,7 +512,7 @@ void Configuration::read(int argc, char* argv[])
{ {
long int priority long int priority
= parseCommandLineInteger = parseCommandLineInteger
(command_line_options[option_index].name, optarg); (command_line_options[option_index].name, optarg);
checkIntegerRange(priority, PRIORITY_RANGE, false); checkIntegerRange(priority, PRIORITY_RANGE, false);
@ -546,7 +546,7 @@ void Configuration::read(int argc, char* argv[])
case OPT_FALSEPRIORITY : case OPT_FALSEPRIORITY :
symbol = ::Ltl::LTL_FALSE; symbol = ::Ltl::LTL_FALSE;
locked_options.insert(make_pair(CFG_FORMULAOPTIONS, locked_options.insert(make_pair(CFG_FORMULAOPTIONS,
CFG_FALSEPRIORITY)); CFG_FALSEPRIORITY));
break; break;
@ -594,7 +594,7 @@ void Configuration::read(int argc, char* argv[])
case OPT_RELEASEPRIORITY : case OPT_RELEASEPRIORITY :
symbol = ::Ltl::LTL_V; symbol = ::Ltl::LTL_V;
locked_options.insert(make_pair(CFG_FORMULAOPTIONS, locked_options.insert(make_pair(CFG_FORMULAOPTIONS,
CFG_RELEASEPRIORITY)); CFG_RELEASEPRIORITY));
break; break;
@ -658,13 +658,13 @@ void Configuration::read(int argc, char* argv[])
locked_options.insert(make_pair(CFG_FORMULAOPTIONS, CFG_OUTPUTMODE)); locked_options.insert(make_pair(CFG_FORMULAOPTIONS, CFG_OUTPUTMODE));
break; break;
case OPT_FORMULAPROPOSITIONS : case OPT_FORMULAPROPOSITIONS :
case OPT_STATESPACEPROPOSITIONS : case OPT_STATESPACEPROPOSITIONS :
{ {
long int num_propositions long int num_propositions
= parseCommandLineInteger = parseCommandLineInteger
(command_line_options[option_index].name, optarg); (command_line_options[option_index].name, optarg);
checkIntegerRange(num_propositions, PROPOSITION_COUNT_RANGE, false); checkIntegerRange(num_propositions, PROPOSITION_COUNT_RANGE, false);
@ -710,7 +710,7 @@ void Configuration::read(int argc, char* argv[])
{ {
long int size long int size
= parseCommandLineInteger = parseCommandLineInteger
(command_line_options[option_index].name, value); (command_line_options[option_index].name, value);
checkIntegerRange(size, min_size_range, false); checkIntegerRange(size, min_size_range, false);
@ -797,7 +797,7 @@ void Configuration::read(int argc, char* argv[])
locked_options.insert(make_pair(CFG_STATESPACEOPTIONS, locked_options.insert(make_pair(CFG_STATESPACEOPTIONS,
CFG_GENERATEMODE)); CFG_GENERATEMODE));
break; break;
case OPT_RANDOMCONNECTEDGRAPH : case OPT_RANDOMCONNECTEDGRAPH :
global_options.statespace_generation_mode = RANDOMCONNECTEDGRAPH; global_options.statespace_generation_mode = RANDOMCONNECTEDGRAPH;
locked_options.insert(make_pair(CFG_STATESPACEOPTIONS, locked_options.insert(make_pair(CFG_STATESPACEOPTIONS,
@ -840,15 +840,15 @@ void Configuration::read(int argc, char* argv[])
if (error) if (error)
throw ConfigurationException throw ConfigurationException
("", string("unrecognized argument (`") + optarg ("", string("unrecognized argument (`") + optarg
+ "') for option `--" + "') for option `--"
+ command_line_options[option_index].name + "'"); + command_line_options[option_index].name + "'");
} }
while (opttype != -1); while (opttype != -1);
if (optind != argc) if (optind != argc)
throw ConfigurationException throw ConfigurationException
("", string("unrecognized command line option `") ("", string("unrecognized command line option `")
+ argv[optind] + "'"); + argv[optind] + "'");
/* /*
* Read the configuration file. * Read the configuration file.
@ -857,8 +857,8 @@ void Configuration::read(int argc, char* argv[])
FILE* configuration_file = fopen(global_options.cfg_filename.c_str(), "r"); FILE* configuration_file = fopen(global_options.cfg_filename.c_str(), "r");
if (configuration_file == NULL) if (configuration_file == NULL)
throw ConfigurationException throw ConfigurationException
("", "error opening configuration file `" ("", "error opening configuration file `"
+ global_options.cfg_filename + "'"); + global_options.cfg_filename + "'");
try try
{ {
@ -903,7 +903,7 @@ void Configuration::read(int argc, char* argv[])
} }
for (set<unsigned long int, less<unsigned long int>, for (set<unsigned long int, less<unsigned long int>,
ALLOC(unsigned long int) >::const_iterator ALLOC(unsigned long int) >::const_iterator
id = algorithm_id_set.begin(); id = algorithm_id_set.begin();
id != algorithm_id_set.end(); id != algorithm_id_set.end();
++id) ++id)
@ -933,8 +933,8 @@ void Configuration::read(int argc, char* argv[])
if (global_options.number_of_rounds <= global_options.init_skip) if (global_options.number_of_rounds <= global_options.init_skip)
throw ConfigurationException throw ConfigurationException
("", "the argument for `--skip' must be less than the total " ("", "the argument for `--skip' must be less than the total "
"number of test rounds"); "number of test rounds");
/* /*
* Check that there is at least one algorithm available for use. * Check that there is at least one algorithm available for use.
@ -942,7 +942,7 @@ void Configuration::read(int argc, char* argv[])
if (algorithms.empty()) if (algorithms.empty())
throw ConfigurationException throw ConfigurationException
("", "no implementations defined in the configuration file"); ("", "no implementations defined in the configuration file");
/* /*
* The case where the number of available variables for propositional * The case where the number of available variables for propositional
@ -962,7 +962,7 @@ void Configuration::read(int argc, char* argv[])
&& formula_options.symbol_priority[::Ltl::LTL_TRUE] == 0 && formula_options.symbol_priority[::Ltl::LTL_TRUE] == 0
&& formula_options.symbol_priority[::Ltl::LTL_FALSE] == 0) && formula_options.symbol_priority[::Ltl::LTL_FALSE] == 0)
throw ConfigurationException("", "at least one atomic symbol must have " throw ConfigurationException("", "at least one atomic symbol must have "
"nonzero priority"); "nonzero priority");
/* /*
* If the operators ->, <->, xor, <>, [], W and M are disallowed, set their * If the operators ->, <->, xor, <>, [], W and M are disallowed, set their
@ -997,15 +997,15 @@ void Configuration::read(int argc, char* argv[])
it->second = formula_options.default_operator_priority; it->second = formula_options.default_operator_priority;
if (it->second > 0 && !unary_operator_allowed) if (it->second > 0 && !unary_operator_allowed)
unary_operator_allowed = unary_operator_allowed =
(it->first == ::Ltl::LTL_NEGATION || it->first == ::Ltl::LTL_NEXT (it->first == ::Ltl::LTL_NEGATION || it->first == ::Ltl::LTL_NEXT
|| it->first == ::Ltl::LTL_FINALLY || it->first == ::Ltl::LTL_FINALLY
|| it->first == ::Ltl::LTL_GLOBALLY); || it->first == ::Ltl::LTL_GLOBALLY);
} }
if (!unary_operator_allowed) if (!unary_operator_allowed)
throw ConfigurationException("", "at least one unary operator must have " throw ConfigurationException("", "at least one unary operator must have "
"a nonzero priority"); "a nonzero priority");
/* /*
* Initialize the random formula generator with priorities for the LTL * Initialize the random formula generator with priorities for the LTL
@ -1024,49 +1024,49 @@ void Configuration::read(int argc, char* argv[])
{ {
switch (it->first) switch (it->first)
{ {
case ::Ltl::LTL_ATOM : case ::Ltl::LTL_ATOM :
case ::Ltl::LTL_TRUE : case ::Ltl::LTL_TRUE :
case ::Ltl::LTL_FALSE : case ::Ltl::LTL_FALSE :
formula_options.formula_generator.useSymbol(it->first, it->second); formula_options.formula_generator.useSymbol(it->first, it->second);
break; break;
case ::Ltl::LTL_NEGATION : case ::Ltl::LTL_NEGATION :
formula_options.formula_generator.useShortOperator formula_options.formula_generator.useShortOperator
(it->first, it->second); (it->first, it->second);
total_short_unary_priority += it->second; total_short_unary_priority += it->second;
if (formula_options.generate_mode != NNF) if (formula_options.generate_mode != NNF)
{ {
formula_options.formula_generator.useLongOperator formula_options.formula_generator.useLongOperator
(it->first, it->second); (it->first, it->second);
total_long_unary_priority += it->second; total_long_unary_priority += it->second;
} }
break; break;
case ::Ltl::LTL_NEXT : case ::Ltl::LTL_NEXT :
case ::Ltl::LTL_FINALLY : case ::Ltl::LTL_FINALLY :
case ::Ltl::LTL_GLOBALLY : case ::Ltl::LTL_GLOBALLY :
formula_options.formula_generator.useShortOperator formula_options.formula_generator.useShortOperator
(it->first, it->second); (it->first, it->second);
total_short_unary_priority += it->second; total_short_unary_priority += it->second;
formula_options.formula_generator.useLongOperator formula_options.formula_generator.useLongOperator
(it->first, it->second); (it->first, it->second);
total_long_unary_priority += it->second; total_long_unary_priority += it->second;
break; break;
case ::Ltl::LTL_CONJUNCTION : case ::Ltl::LTL_CONJUNCTION :
case ::Ltl::LTL_DISJUNCTION : case ::Ltl::LTL_DISJUNCTION :
case ::Ltl::LTL_IMPLICATION : case ::Ltl::LTL_IMPLICATION :
case ::Ltl::LTL_EQUIVALENCE : case ::Ltl::LTL_EQUIVALENCE :
case ::Ltl::LTL_XOR : case ::Ltl::LTL_XOR :
case ::Ltl::LTL_UNTIL : case ::Ltl::LTL_UNTIL :
case ::Ltl::LTL_V : case ::Ltl::LTL_V :
case ::Ltl::LTL_WEAK_UNTIL : case ::Ltl::LTL_WEAK_UNTIL :
case ::Ltl::LTL_STRONG_RELEASE : case ::Ltl::LTL_STRONG_RELEASE :
case ::Ltl::LTL_BEFORE : case ::Ltl::LTL_BEFORE :
formula_options.formula_generator.useLongOperator formula_options.formula_generator.useLongOperator
(it->first, it->second); (it->first, it->second);
total_binary_priority += it->second; total_binary_priority += it->second;
break; break;
} }
} }
} }
@ -1091,9 +1091,9 @@ void Configuration::read(int argc, char* argv[])
++op) ++op)
{ {
if (op->second > 0) if (op->second > 0)
{ {
switch (op->first) switch (op->first)
{ {
case ::Ltl::LTL_ATOM : case ::Ltl::LTL_ATOM :
case ::Ltl::LTL_TRUE : case ::Ltl::LTL_TRUE :
case ::Ltl::LTL_FALSE : case ::Ltl::LTL_FALSE :
@ -1106,18 +1106,18 @@ void Configuration::read(int argc, char* argv[])
= formula_options.formula_generator.size; = formula_options.formula_generator.size;
s <= formula_options.formula_generator.max_size; s <= formula_options.formula_generator.max_size;
s++) s++)
{ {
if (k >= s) if (k >= s)
continue; continue;
probability += operatorProbability probability += operatorProbability
(op->first, k, s, (op->first, k, s,
total_short_unary_priority, total_short_unary_priority,
total_long_unary_priority, total_long_unary_priority,
total_binary_priority, total_binary_priority,
result_cache); result_cache);
} }
probability /= static_cast<double> probability /= static_cast<double>
(formula_options.formula_generator.max_size (formula_options.formula_generator.max_size
- formula_options.formula_generator.size - formula_options.formula_generator.size
+ 1); + 1);
@ -1158,18 +1158,18 @@ void Configuration::print(ostream& stream, int indent) const
Exceptional_ostream estream(&stream, ios::badbit | ios::failbit); Exceptional_ostream estream(&stream, ios::badbit | ios::failbit);
estream << string(indent, ' ') + "Program configuration:\n" estream << string(indent, ' ') + "Program configuration:\n"
+ string(indent, ' ') + string(22, '-') + "\n\n" + string(indent, ' ') + string(22, '-') + "\n\n"
+ string(indent + 2, ' ') + string(indent + 2, ' ')
+ toString(global_options.number_of_rounds) + toString(global_options.number_of_rounds)
+ " test round" + " test round"
+ (global_options.number_of_rounds > 1 ? "s" : ""); + (global_options.number_of_rounds > 1 ? "s" : "");
if (global_options.init_skip > 0) if (global_options.init_skip > 0)
estream << " (of which the first " estream << " (of which the first "
+ (global_options.init_skip > 1 + (global_options.init_skip > 1
? toString(global_options.init_skip) + " rounds " ? toString(global_options.init_skip) + " rounds "
: string("")) : string(""))
+ "will be skipped)"; + "will be skipped)";
estream << ".\n" + string(indent + 2, ' '); estream << ".\n" + string(indent + 2, ' ');
@ -1181,20 +1181,20 @@ void Configuration::print(ostream& stream, int indent) const
estream << "Running in batch mode.\n"; estream << "Running in batch mode.\n";
estream << string(indent + 2, ' ') estream << string(indent + 2, ' ')
+ "Using " + "Using "
+ (global_options.product_mode == GLOBAL + (global_options.product_mode == GLOBAL
? "global" : "local") ? "global" : "local")
+ " model checking for tests.\n"; + " model checking for tests.\n";
if (!global_options.transcript_filename.empty()) if (!global_options.transcript_filename.empty())
estream << string(indent + 2, ' ') + "Writing error log to `" estream << string(indent + 2, ' ') + "Writing error log to `"
+ global_options.transcript_filename + "'.\n"; + global_options.transcript_filename + "'.\n";
estream << '\n' + string(indent + 2, ' ') + "Implementations:\n"; estream << '\n' + string(indent + 2, ' ') + "Implementations:\n";
vector<AlgorithmInformation, ALLOC(AlgorithmInformation) >::size_type vector<AlgorithmInformation, ALLOC(AlgorithmInformation) >::size_type
algorithm_number = 0; algorithm_number = 0;
for (vector<AlgorithmInformation, ALLOC(AlgorithmInformation) > for (vector<AlgorithmInformation, ALLOC(AlgorithmInformation) >
::const_iterator a = algorithms.begin(); ::const_iterator a = algorithms.begin();
a != algorithms.end(); a != algorithms.end();
@ -1218,19 +1218,19 @@ void Configuration::print(ostream& stream, int indent) const
estream << "Enabled tests:\n"; estream << "Enabled tests:\n";
if (global_options.do_comp_test) if (global_options.do_comp_test)
estream << string(indent + 4, ' ') + estream << string(indent + 4, ' ') +
"Model checking result cross-comparison test\n"; "Model checking result cross-comparison test\n";
if (global_options.do_cons_test) if (global_options.do_cons_test)
estream << string(indent + 4, ' ') + estream << string(indent + 4, ' ') +
"Model checking result consistency check\n"; "Model checking result consistency check\n";
if (global_options.do_intr_test) if (global_options.do_intr_test)
estream << string(indent + 4, ' ') + estream << string(indent + 4, ' ') +
"Büchi automata intersection emptiness check\n"; "Büchi automata intersection emptiness check\n";
} }
else else
estream << "All automata correctness tests disabled.\n"; estream << "All automata correctness tests disabled.\n";
estream << '\n' + string(indent + 2, ' ') + "Random state spaces:\n" estream << '\n' + string(indent + 2, ' ') + "Random state spaces:\n"
+ string(indent + 4, ' '); + string(indent + 4, ' ');
switch (global_options.statespace_generation_mode) switch (global_options.statespace_generation_mode)
{ {
@ -1257,15 +1257,15 @@ void Configuration::print(ostream& stream, int indent) const
estream << "..." + toString(statespace_generator.max_size); estream << "..." + toString(statespace_generator.max_size);
estream << string(" state") estream << string(" state")
+ (statespace_generator.max_size == 1 ? "" : "s") + ", " + (statespace_generator.max_size == 1 ? "" : "s") + ", "
+ toString(statespace_generator.atoms_per_state) + toString(statespace_generator.atoms_per_state)
+ " atomic proposition" + " atomic proposition"
+ (statespace_generator.atoms_per_state == 1 ? "" : "s") + (statespace_generator.atoms_per_state == 1 ? "" : "s")
+ ")\n" + string(indent + 4, ' '); + ")\n" + string(indent + 4, ' ');
if (global_options.statespace_change_interval == 0 if (global_options.statespace_change_interval == 0
|| global_options.statespace_change_interval || global_options.statespace_change_interval
>= global_options.number_of_rounds) >= global_options.number_of_rounds)
estream << "Using a fixed state space.\n" + string(indent + 4, ' '); estream << "Using a fixed state space.\n" + string(indent + 4, ' ');
else else
{ {
@ -1297,16 +1297,16 @@ void Configuration::print(ostream& stream, int indent) const
if (global_options.statespace_generation_mode != ENUMERATEDPATH) if (global_options.statespace_generation_mode != ENUMERATEDPATH)
{ {
estream << "Random seed: " estream << "Random seed: "
+ toString(global_options.statespace_random_seed) + toString(global_options.statespace_random_seed)
+ '\n' + string(indent + 4, ' '); + '\n' + string(indent + 4, ' ');
if (global_options.statespace_generation_mode & GRAPH) if (global_options.statespace_generation_mode & GRAPH)
estream << "Random edge probability: " estream << "Random edge probability: "
+ toString(statespace_generator.edge_probability) + toString(statespace_generator.edge_probability)
+ '\n' + string(indent + 4, ' '); + '\n' + string(indent + 4, ' ');
estream << "Propositional truth probability: " estream << "Propositional truth probability: "
+ toString(statespace_generator.truth_probability) + toString(statespace_generator.truth_probability)
+ "\n"; + "\n";
} }
@ -1315,32 +1315,32 @@ void Configuration::print(ostream& stream, int indent) const
if (global_options.formula_input_filename.empty()) if (global_options.formula_input_filename.empty())
{ {
estream << "Random LTL formulas:\n" + string(indent + 4, ' ') estream << "Random LTL formulas:\n" + string(indent + 4, ' ')
+ toString(formula_options.formula_generator.size); + toString(formula_options.formula_generator.size);
if (formula_options.formula_generator.max_size if (formula_options.formula_generator.max_size
!= formula_options.formula_generator.size) != formula_options.formula_generator.size)
estream << "..." estream << "..."
+ toString(formula_options.formula_generator.max_size); + toString(formula_options.formula_generator.max_size);
estream << string(" parse tree node") estream << string(" parse tree node")
+ (formula_options.formula_generator.max_size == 1 ? "" : "s") + (formula_options.formula_generator.max_size == 1 ? "" : "s")
+ ", " + ", "
+ toString(formula_options.formula_generator. + toString(formula_options.formula_generator.
number_of_available_variables) number_of_available_variables)
+ " atomic proposition" + " atomic proposition"
+ (formula_options.formula_generator. + (formula_options.formula_generator.
number_of_available_variables == 1 ? "" : "s"); number_of_available_variables == 1 ? "" : "s");
} }
else else
estream << "Reading LTL formulas from `" estream << "Reading LTL formulas from `"
+ global_options.formula_input_filename + global_options.formula_input_filename
+ "'."; + "'.";
estream << '\n' + string(indent + 4, ' '); estream << '\n' + string(indent + 4, ' ');
if (global_options.formula_change_interval == 0 if (global_options.formula_change_interval == 0
|| global_options.formula_change_interval || global_options.formula_change_interval
>= global_options.number_of_rounds) >= global_options.number_of_rounds)
estream << "Using a fixed LTL formula."; estream << "Using a fixed LTL formula.";
else else
{ {
@ -1357,7 +1357,7 @@ void Configuration::print(ostream& stream, int indent) const
|| global_options.formula_change_interval % 100 >= 20) || global_options.formula_change_interval % 100 >= 20)
{ {
switch (global_options.formula_change_interval % 10) switch (global_options.formula_change_interval % 10)
{ {
case 1 : estream << "st"; break; case 1 : estream << "st"; break;
case 2 : estream << "nd"; break; case 2 : estream << "nd"; break;
case 3 : estream << "rd"; break; case 3 : estream << "rd"; break;
@ -1378,18 +1378,18 @@ void Configuration::print(ostream& stream, int indent) const
if (global_options.formula_input_filename.empty() if (global_options.formula_input_filename.empty()
&& formula_options.generate_mode == NNF) && formula_options.generate_mode == NNF)
estream << string(indent + 4, ' ') estream << string(indent + 4, ' ')
+ "Formulas will be generated into negation normal form.\n"; + "Formulas will be generated into negation normal form.\n";
else if (formula_options.output_mode == NNF) else if (formula_options.output_mode == NNF)
estream << string(indent + 4, ' ') estream << string(indent + 4, ' ')
+ "Formulas will be converted into negation normal form.\n"; + "Formulas will be converted into negation normal form.\n";
if (global_options.formula_input_filename.empty()) if (global_options.formula_input_filename.empty())
{ {
estream << string(indent + 4, ' ') + "Random seed: " estream << string(indent + 4, ' ') + "Random seed: "
+ toString(global_options.formula_random_seed) + toString(global_options.formula_random_seed)
+ '\n' + string(indent + 4, ' ') + '\n' + string(indent + 4, ' ')
+ "Atomic symbols in use (priority):\n" + "Atomic symbols in use (priority):\n"
+ string(indent + 6, ' '); + string(indent + 6, ' ');
bool first_printed = false; bool first_printed = false;
@ -1410,13 +1410,13 @@ void Configuration::print(ostream& stream, int indent) const
switch (op->first) switch (op->first)
{ {
case ::Ltl::LTL_ATOM : case ::Ltl::LTL_ATOM :
estream << "propositions"; estream << "propositions";
break; break;
case ::Ltl::LTL_TRUE : case ::Ltl::LTL_FALSE : case ::Ltl::LTL_TRUE : case ::Ltl::LTL_FALSE :
estream << ::Ltl::infixSymbol(op->first); estream << ::Ltl::infixSymbol(op->first);
break; break;
default : default :
break; break;
} }
@ -1425,7 +1425,7 @@ void Configuration::print(ostream& stream, int indent) const
estream << '\n' estream << '\n'
<< string(indent + 4, ' ') << string(indent + 4, ' ')
+ "Operators used for random LTL formula generation:"; + "Operators used for random LTL formula generation:";
string operator_name_string; string operator_name_string;
string operator_priority_string; string operator_priority_string;
@ -1452,7 +1452,7 @@ void Configuration::print(ostream& stream, int indent) const
{ {
operator_name_string = string(11, ' ') + operator_name_string; operator_name_string = string(11, ' ') + operator_name_string;
operator_priority_string = string(11, ' ') operator_priority_string = string(11, ' ')
+ operator_priority_string; + operator_priority_string;
operator_distribution_string operator_distribution_string
= string(indent + 6, ' ') + "occurrences/formula "; = string(indent + 6, ' ') + "occurrences/formula ";
} }
@ -1478,7 +1478,7 @@ void Configuration::print(ostream& stream, int indent) const
== max_operators_per_line - 1) == max_operators_per_line - 1)
{ {
estream << '\n' + operator_name_string + '\n' estream << '\n' + operator_name_string + '\n'
+ operator_priority_string + '\n'; + operator_priority_string + '\n';
if (!formula_options.symbol_distribution.empty()) if (!formula_options.symbol_distribution.empty())
estream << operator_distribution_string + '\n'; estream << operator_distribution_string + '\n';
@ -1498,7 +1498,7 @@ void Configuration::print(ostream& stream, int indent) const
if (number_of_operators_printed % max_operators_per_line != 0) if (number_of_operators_printed % max_operators_per_line != 0)
{ {
estream << '\n' + operator_name_string + '\n' + operator_priority_string estream << '\n' + operator_name_string + '\n' + operator_priority_string
+ '\n'; + '\n';
if (!formula_options.symbol_distribution.empty()) if (!formula_options.symbol_distribution.empty())
estream << operator_distribution_string + '\n'; estream << operator_distribution_string + '\n';
@ -1512,7 +1512,7 @@ void Configuration::print(ostream& stream, int indent) const
/* ========================================================================= */ /* ========================================================================= */
string Configuration::algorithmString string Configuration::algorithmString
(vector<Configuration::AlgorithmInformation, (vector<Configuration::AlgorithmInformation,
ALLOC(Configuration::AlgorithmInformation) >::size_type ALLOC(Configuration::AlgorithmInformation) >::size_type
algorithm_id) const algorithm_id) const
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* *
@ -1528,7 +1528,7 @@ string Configuration::algorithmString
using namespace ::StringUtil; using namespace ::StringUtil;
return toString(algorithm_id) + ": `" + *(algorithms[algorithm_id].name) return toString(algorithm_id) + ": `" + *(algorithms[algorithm_id].name)
+ '\''; + '\'';
} }
/* ========================================================================= */ /* ========================================================================= */
@ -1544,184 +1544,184 @@ void Configuration::showCommandLineHelp(const char* program_name)
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
{ {
cout << string("Usage: ") + program_name cout << string("Usage: ") + program_name
+ " [OPTION]...\n\nGeneral options:\n" + " [OPTION]...\n\nGeneral options:\n"
" --[no]comparisontest Enable or disable the model " " --[no]comparisontest Enable or disable the model "
"checking result\n" "checking result\n"
" cross-comparison test\n" " cross-comparison test\n"
" --configfile=FILE Read configuration from FILE\n" " --configfile=FILE Read configuration from FILE\n"
" --[no]consistencytest Enable or disable the model " " --[no]consistencytest Enable or disable the model "
"checking result\n" "checking result\n"
" consistency test\n" " consistency test\n"
" --disable=IMPLEMENTATION-ID[,IMPLEMENTATION-ID...]\n" " --disable=IMPLEMENTATION-ID[,IMPLEMENTATION-ID...]\n"
" Exclude implementation(s) from " " Exclude implementation(s) from "
"tests\n" "tests\n"
" --enable=IMPLEMENTATION-ID[,IMPLEMENTATION-ID,...]\n" " --enable=IMPLEMENTATION-ID[,IMPLEMENTATION-ID,...]\n"
" Include implementation(s) into " " Include implementation(s) into "
"tests\n" "tests\n"
" --formulafile=FILE Read LTL formulas from FILE\n" " --formulafile=FILE Read LTL formulas from FILE\n"
" --globalmodelcheck Use global model checking in " " --globalmodelcheck Use global model checking in "
"tests\n" "tests\n"
" (equivalent to " " (equivalent to "
"`--modelcheck=global')\n" "`--modelcheck=global')\n"
" -h, --help Show this help and exit\n" " -h, --help Show this help and exit\n"
" --interactive=MODE Set the interactivity mode " " --interactive=MODE Set the interactivity mode "
"(`always', `onerror', \n" "(`always', `onerror', \n"
" `never')\n" " `never')\n"
" --[no]intersectiontest Enable or disable the Büchi " " --[no]intersectiontest Enable or disable the Büchi "
"automata\n" "automata\n"
" intersection emptiness test\n" " intersection emptiness test\n"
" --localmodelcheck Use local model checking in tests" " --localmodelcheck Use local model checking in tests"
"\n" "\n"
" (equivalent to " " (equivalent to "
"`--modelcheck=local')\n" "`--modelcheck=local')\n"
" --logfile=FILE Write error log to FILE\n" " --logfile=FILE Write error log to FILE\n"
" --modelcheck=MODE Set model checking mode " " --modelcheck=MODE Set model checking mode "
"(`global' or `local')\n" "(`global' or `local')\n"
" --nopause Do not pause between test rounds " " --nopause Do not pause between test rounds "
"(equivalent to\n" "(equivalent to\n"
" `--interactive=never')\n" " `--interactive=never')\n"
" --pause Pause unconditionally after every " " --pause Pause unconditionally after every "
"test round\n" "test round\n"
" (equivalent to " " (equivalent to "
"`--interactive=always')\n" "`--interactive=always')\n"
" --pauseonerror Pause between test rounds only in " " --pauseonerror Pause between test rounds only in "
"case of an\n" "case of an\n"
" error (equivalent to " " error (equivalent to "
"`--interactive=onerror')\n" "`--interactive=onerror')\n"
" --profile Disable all automata correctness " " --profile Disable all automata correctness "
"tests\n" "tests\n"
" --quiet, --silent Run all tests silently without " " --quiet, --silent Run all tests silently without "
"interruption\n" "interruption\n"
" --rounds=NUMBER-OF-ROUNDS Set number of test rounds (1-)\n" " --rounds=NUMBER-OF-ROUNDS Set number of test rounds (1-)\n"
" --showconfig Display current configuration and " " --showconfig Display current configuration and "
"exit\n" "exit\n"
" --showoperatordistribution Display probability distribution " " --showoperatordistribution Display probability distribution "
"for LTL formula\n" "for LTL formula\n"
" operators\n" " operators\n"
" --skip=NUMBER-OF-ROUNDS Set number of test rounds to skip " " --skip=NUMBER-OF-ROUNDS Set number of test rounds to skip "
"before\n" "before\n"
" starting tests\n" " starting tests\n"
" --verbosity=INTEGER Set the verbosity of output (0-5)\n" " --verbosity=INTEGER Set the verbosity of output (0-5)\n"
" --version Display program version and exit" " --version Display program version and exit"
"\n\n" "\n\n"
"LTL formula generation options:\n" "LTL formula generation options:\n"
" --[no]abbreviatedoperators Allow or disallow operators ->, " " --[no]abbreviatedoperators Allow or disallow operators ->, "
"<->, xor, <>,\n" "<->, xor, <>,\n"
" [], u, w in the generated " " [], u, w in the generated "
"formulas\n" "formulas\n"
" --andpriority=INTEGER Set priority for the /\\ operator\n" " --andpriority=INTEGER Set priority for the /\\ operator\n"
" --beforepriority=INTEGER Set priority for the Before " " --beforepriority=INTEGER Set priority for the Before "
"operator\n" "operator\n"
" --defaultoperatorpriority=INTEGER\n" " --defaultoperatorpriority=INTEGER\n"
" Set default priority for operators" " Set default priority for operators"
"\n" "\n"
" --equivalencepriority=INTEGER\n" " --equivalencepriority=INTEGER\n"
" Set priority for the <-> operator\n" " Set priority for the <-> operator\n"
" --falsepriority=INTEGER Set priority for the constant " " --falsepriority=INTEGER Set priority for the constant "
"`false'\n" "`false'\n"
" --finallypriority=INTEGER Set priority for the <> operator\n" " --finallypriority=INTEGER Set priority for the <> operator\n"
" --formulachangeinterval=NUMBER-OF-ROUNDS\n" " --formulachangeinterval=NUMBER-OF-ROUNDS\n"
" Set formula generation interval in " " Set formula generation interval in "
"test rounds\n" "test rounds\n"
" (0-)\n" " (0-)\n"
" --formulageneratemode=MODE Set formula generation mode " " --formulageneratemode=MODE Set formula generation mode "
"(`normal', `nnf')\n" "(`normal', `nnf')\n"
" --formulaoutputmode=MODE Set formula output mode (`normal', " " --formulaoutputmode=MODE Set formula output mode (`normal', "
"`nnf')\n" "`nnf')\n"
" --formulapropositions=NUMBER-OF-PROPOSITIONS\n" " --formulapropositions=NUMBER-OF-PROPOSITIONS\n"
" Set maximum number of atomic " " Set maximum number of atomic "
"propositions in\n" "propositions in\n"
" generated formulas (0-)\n" " generated formulas (0-)\n"
" --formularandomseed=INTEGER Set random seed for the formula " " --formularandomseed=INTEGER Set random seed for the formula "
"generation\n" "generation\n"
" algorithm\n" " algorithm\n"
" --formulasize=SIZE,\n" " --formulasize=SIZE,\n"
" --formulasize=MIN-SIZE...MAX-SIZE\n" " --formulasize=MIN-SIZE...MAX-SIZE\n"
" Set size of random LTL formulas " " Set size of random LTL formulas "
"(1-)\n" "(1-)\n"
" --[no]generatennf Force or prevent generating LTL " " --[no]generatennf Force or prevent generating LTL "
"formulas in\n" "formulas in\n"
" negation normal form\n" " negation normal form\n"
" --globallypriority=INTEGER Set priority for the [] operator\n" " --globallypriority=INTEGER Set priority for the [] operator\n"
" --implicationpriority=INTEGER\n" " --implicationpriority=INTEGER\n"
" Set priority for the -> operator\n" " Set priority for the -> operator\n"
" --nextpriority=INTEGER Set priority for the Next operator" " --nextpriority=INTEGER Set priority for the Next operator"
"\n" "\n"
" --notpriority=INTEGER Set priority for the negation " " --notpriority=INTEGER Set priority for the negation "
"operator\n" "operator\n"
" --orpriority=INTEGER Set priority for the \\/ operator\n" " --orpriority=INTEGER Set priority for the \\/ operator\n"
" --[no]outputnnf Enable or disable formula " " --[no]outputnnf Enable or disable formula "
"translation to\n" "translation to\n"
" negation normal form before " " negation normal form before "
"invoking the\n" "invoking the\n"
" translators\n" " translators\n"
" --propositionpriority=INTEGER\n" " --propositionpriority=INTEGER\n"
" Set priority for atomic " " Set priority for atomic "
"propositions\n" "propositions\n"
" --releasepriority=INTEGER Set priority for the (Weak) Release" " --releasepriority=INTEGER Set priority for the (Weak) Release"
" operator\n" " operator\n"
" --strongreleasepriority=INTEGER\n" " --strongreleasepriority=INTEGER\n"
" Set priority for the Strong " " Set priority for the Strong "
"Release operator\n" "Release operator\n"
" --truepriority=INTEGER Set priority for the constant " " --truepriority=INTEGER Set priority for the constant "
"`true'\n" "`true'\n"
" --untilpriority=INTEGER Set priority for the (Strong) Until" " --untilpriority=INTEGER Set priority for the (Strong) Until"
" operator\n" " operator\n"
" --weakuntilpriority=INTEGER\n" " --weakuntilpriority=INTEGER\n"
" Set priority for the Weak Until " " Set priority for the Weak Until "
"operator\n" "operator\n"
" --xorpriority=INTEGER Set priority for the xor " " --xorpriority=INTEGER Set priority for the xor "
"operator\n\n" "operator\n\n"
"State space generation options:\n" "State space generation options:\n"
" --edgeprobability=PROBABILITY\n" " --edgeprobability=PROBABILITY\n"
" Set random edge probability for " " Set random edge probability for "
"state spaces\n" "state spaces\n"
" (0.0--1.0)\n" " (0.0--1.0)\n"
" --enumeratedpath Enumerate all paths of a given " " --enumeratedpath Enumerate all paths of a given "
"size and a given\n" "size and a given\n"
" number of propositions per state " " number of propositions per state "
"(equivalent to\n" "(equivalent to\n"
" `--statespacegeneratemode=" " `--statespacegeneratemode="
"enumeratedpath')\n" "enumeratedpath')\n"
" --randomconnectedgraph Generate connected graphs as state " " --randomconnectedgraph Generate connected graphs as state "
"spaces\n" "spaces\n"
" (equivalent to\n" " (equivalent to\n"
" `--statespacegeneratemode=" " `--statespacegeneratemode="
"randomconnectedgraph')\n" "randomconnectedgraph')\n"
" --randomgraph Generate random graphs as state " " --randomgraph Generate random graphs as state "
"spaces\n" "spaces\n"
" (equivalent to\n" " (equivalent to\n"
" `--statespacegeneratemode=" " `--statespacegeneratemode="
"randomgraph')\n" "randomgraph')\n"
" --randompath Generate random paths as state " " --randompath Generate random paths as state "
"spaces\n" "spaces\n"
" (equivalent to\n" " (equivalent to\n"
" `--statespacegeneratemode=" " `--statespacegeneratemode="
"randompath')\n" "randompath')\n"
" --statespacechangeinterval=NUMBER-OF-ROUNDS\n" " --statespacechangeinterval=NUMBER-OF-ROUNDS\n"
" Set state space generation " " Set state space generation "
"interval in test\n" "interval in test\n"
" rounds (0-)\n" " rounds (0-)\n"
" --statespacegeneratemode=MODE\n" " --statespacegeneratemode=MODE\n"
" Set state space generation mode\n" " Set state space generation mode\n"
" (`randomconnectedgraph', " " (`randomconnectedgraph', "
"`randomgraph',\n" "`randomgraph',\n"
" `randompath', `enumeratedpath')\n" " `randompath', `enumeratedpath')\n"
" --statespacepropositions=NUMBER-OF-PROPOSITIONS\n" " --statespacepropositions=NUMBER-OF-PROPOSITIONS\n"
" Set number of propositions per " " Set number of propositions per "
"state (0-)\n" "state (0-)\n"
" --statespacerandomseed=INTEGER\n" " --statespacerandomseed=INTEGER\n"
" Set random seed for the state " " Set random seed for the state "
"space generation\n" "space generation\n"
" algorithm\n" " algorithm\n"
" --statespacesize=SIZE,\n" " --statespacesize=SIZE,\n"
" --statespacesize=MIN-SIZE...MAX-SIZE\n" " --statespacesize=MIN-SIZE...MAX-SIZE\n"
" Set size of generated state spaces " " Set size of generated state spaces "
"(1-)\n" "(1-)\n"
" --truthprobability=PROBABILITY\n" " --truthprobability=PROBABILITY\n"
" Set truth probability of " " Set truth probability of "
"propositions (0.0--1.0)\n\n" "propositions (0.0--1.0)\n\n"
"Report bugs to <heikki.tauriainen@hut.fi>.\n"; "Report bugs to <heikki.tauriainen@hut.fi>.\n";
} }
/* ========================================================================= */ /* ========================================================================= */
@ -1809,12 +1809,12 @@ long int Configuration::parseCommandLineInteger
if (*endptr != '\0' || value.empty()) if (*endptr != '\0' || value.empty())
throw ConfigurationException throw ConfigurationException
("", "the argument for `--" + option + "' must be a nonnegative " ("", "the argument for `--" + option + "' must be a nonnegative "
"integer"); "integer");
if (val == LONG_MIN || val == LONG_MAX) if (val == LONG_MIN || val == LONG_MAX)
throw ConfigurationException throw ConfigurationException
("", "the argument for `--" + option + "' is out of range"); ("", "the argument for `--" + option + "' is out of range");
return val; return val;
} }
@ -1899,7 +1899,7 @@ double Configuration::operatorProbability
{ {
if (arity == 1 && total_short_unary_priority > 0) if (arity == 1 && total_short_unary_priority > 0)
result = static_cast<double>(priority) result = static_cast<double>(priority)
/ static_cast<double>(total_short_unary_priority); / static_cast<double>(total_short_unary_priority);
else else
result = 0.0; result = 0.0;
} }
@ -1931,7 +1931,7 @@ double Configuration::operatorProbability
total_long_unary_priority, total_long_unary_priority,
total_binary_priority, total_binary_priority,
result_cache) result_cache)
* operatorProbability(op, k - i, n - m - 1, * operatorProbability(op, k - i, n - m - 1,
total_short_unary_priority, total_short_unary_priority,
total_long_unary_priority, total_long_unary_priority,
total_binary_priority, total_binary_priority,
@ -1946,7 +1946,7 @@ double Configuration::operatorProbability
if (op != ::Ltl::LTL_NEGATION || formula_options.generate_mode != NNF) if (op != ::Ltl::LTL_NEGATION || formula_options.generate_mode != NNF)
result += static_cast<double>(priority) result += static_cast<double>(priority)
* operatorProbability(op, k - 1, n - 1, * operatorProbability(op, k - 1, n - 1,
total_short_unary_priority, total_short_unary_priority,
total_long_unary_priority, total_long_unary_priority,
total_binary_priority, total_binary_priority,
@ -1965,7 +1965,7 @@ double Configuration::operatorProbability
total_long_unary_priority, total_long_unary_priority,
total_binary_priority, total_binary_priority,
result_cache) result_cache)
* operatorProbability(op, k - 1 - i, n - m - 1, * operatorProbability(op, k - 1 - i, n - m - 1,
total_short_unary_priority, total_short_unary_priority,
total_long_unary_priority, total_long_unary_priority,
total_binary_priority, total_binary_priority,
@ -1976,7 +1976,7 @@ double Configuration::operatorProbability
} }
result += static_cast<double>(p1) result += static_cast<double>(p1)
* operatorProbability(op, k, n - 1, * operatorProbability(op, k, n - 1,
total_short_unary_priority, total_short_unary_priority,
total_long_unary_priority, total_long_unary_priority,
total_binary_priority, total_binary_priority,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1999, 2000, 2001, 2002 * Copyright (C) 1999, 2000, 2001, 2002, 2003
* Heikki Tauriainen <Heikki.Tauriainen@hut.fi> * Heikki Tauriainen <Heikki.Tauriainen@hut.fi>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -55,22 +55,22 @@ public:
~Configuration(); /* Destructor. */ ~Configuration(); /* Destructor. */
void read(int argc, char* argv[]); /* Reads the program void read(int argc, char* argv[]); /* Reads the program
* configuration. * configuration.
*/ */
void print /* Writes the current */ void print /* Writes the current */
(ostream& stream = cout, int indent = 0) const; /* configuration (in a (ostream& stream = cout, int indent = 0) const; /* configuration (in a
* textual form) to a * textual form) to a
* stream. * stream.
*/ */
struct AlgorithmInformation; /* See below. */ struct AlgorithmInformation; /* See below. */
string algorithmString /* Formats the the id */ string algorithmString /* Formats the the id */
(vector<AlgorithmInformation, /* of an algorithm and */ (vector<AlgorithmInformation, /* of an algorithm and */
ALLOC(AlgorithmInformation) >::size_type/* the name of the */ ALLOC(AlgorithmInformation) >::size_type/* the name of the */
algorithm_id) const; /* algorithm into a algorithm_id) const; /* algorithm into a
* string. * string.
*/ */
static void showCommandLineHelp /* Prints the list of */ static void showCommandLineHelp /* Prints the list of */
@ -79,52 +79,52 @@ public:
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
enum InteractionMode {NEVER, ALWAYS, ONERROR}; /* Enumeration constants enum InteractionMode {NEVER, ALWAYS, ONERROR}; /* Enumeration constants
* affecting the behaviour * affecting the behaviour
* of the program as * of the program as
* regards user control. * regards user control.
*/ */
enum FormulaMode {NORMAL, NNF}; /* Enumeration constants enum FormulaMode {NORMAL, NNF}; /* Enumeration constants
* affecting the generation * affecting the generation
* and output of random * and output of random
* formulae. * formulae.
*/ */
enum StateSpaceMode {RANDOMGRAPH = 1, /* Enumeration constants */ enum StateSpaceMode {RANDOMGRAPH = 1, /* Enumeration constants */
RANDOMCONNECTEDGRAPH = 2, /* affecting the */ RANDOMCONNECTEDGRAPH = 2, /* affecting the */
GRAPH = 3, /* generation of random */ GRAPH = 3, /* generation of random */
RANDOMPATH = 4, /* state spaces. */ RANDOMPATH = 4, /* state spaces. */
ENUMERATEDPATH = 8, ENUMERATEDPATH = 8,
PATH = 12}; PATH = 12};
enum ProductMode {LOCAL, GLOBAL}; /* Enumeration constants enum ProductMode {LOCAL, GLOBAL}; /* Enumeration constants
* for controlling the * for controlling the
* scope of synchronous * scope of synchronous
* products. * products.
*/ */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
struct AlgorithmInformation /* A structure for storing struct AlgorithmInformation /* A structure for storing
* information about a * information about a
* particular algorithm * particular algorithm
* (name, path to * (name, path to
* executable, command-line * executable, command-line
* parameters). * parameters).
*/ */
{ {
string* name; /* Name of the algorithm. string* name; /* Name of the algorithm.
*/ */
string* path_to_program; /* Path to the executable string* path_to_program; /* Path to the executable
* required for running * required for running
* the algorithm. * the algorithm.
*/ */
string* extra_parameters; /* Additional command-line string* extra_parameters; /* Additional command-line
* parameters required for * parameters required for
* running the executable. * running the executable.
*/ */
bool enabled; /* Determines whether the bool enabled; /* Determines whether the
* algorithm is enabled * algorithm is enabled
@ -136,42 +136,42 @@ public:
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
struct GlobalConfiguration /* A structure for storing struct GlobalConfiguration /* A structure for storing
* all the information * all the information
* affecting the general * affecting the general
* behaviour of the * behaviour of the
* program. * program.
*/ */
{ {
int verbosity; /* Determines the verbosity int verbosity; /* Determines the verbosity
* of program output (0-5, * of program output (0-5,
* the bigger the value, * the bigger the value,
* the more information * the more information
* will be shown). * will be shown).
*/ */
InteractionMode interactive; /* Controls the behaviour InteractionMode interactive; /* Controls the behaviour
* of the program as * of the program as
* regards the ability of * regards the ability of
* the user to enter * the user to enter
* commands between test * commands between test
* rounds. Possible values * rounds. Possible values
* and their meanings are: * and their meanings are:
* *
* NEVER: * NEVER:
* Run all tests without * Run all tests without
* interruption. * interruption.
* ALWAYS: * ALWAYS:
* Pause after each test * Pause after each test
* round to wait for * round to wait for
* user commands. * user commands.
* ONERROR: * ONERROR:
* Try to run the tests * Try to run the tests
* without interruption. * without interruption.
* However, in case of * However, in case of
* an error, pause and * an error, pause and
* wait for user * wait for user
* commands. * commands.
*/ */
unsigned long int number_of_rounds; /* Number of test rounds. unsigned long int number_of_rounds; /* Number of test rounds.
*/ */
@ -181,22 +181,22 @@ public:
*/ */
unsigned long int statespace_change_interval; /* Determines the frequency unsigned long int statespace_change_interval; /* Determines the frequency
* (in rounds) of how often * (in rounds) of how often
* a new state space is * a new state space is
* generated. * generated.
*/ */
StateSpaceMode statespace_generation_mode; /* Random state space StateSpaceMode statespace_generation_mode; /* Random state space
* generation mode. * generation mode.
* Available options are: * Available options are:
* *
* RANDOMGRAPH: * RANDOMGRAPH:
* Generate random * Generate random
* connected graphs as * connected graphs as
* state spaces. * state spaces.
* RANDOMPATH: * RANDOMPATH:
* Generate paths as * Generate paths as
* state spaces, choose * state spaces, choose
* the loop and the * the loop and the
* truth assignments for * truth assignments for
* atomic propositions * atomic propositions
@ -207,47 +207,47 @@ public:
* enumerating all * enumerating all
* possible paths of a * possible paths of a
* given length. * given length.
*/ */
unsigned long int formula_change_interval; /* Determines the frequency unsigned long int formula_change_interval; /* Determines the frequency
* (in rounds) of how often * (in rounds) of how often
* a new formula is * a new formula is
* generated. * generated.
*/ */
ProductMode product_mode; /* Determines the scope of ProductMode product_mode; /* Determines the scope of
* the synchronous products * the synchronous products
* computed by the program. * computed by the program.
* Possible values and * Possible values and
* their meanings are: * their meanings are:
* *
* LOCAL: * LOCAL:
* The synchronous * The synchronous
* products are computed * products are computed
* only with respect to * only with respect to
* the initial state of * the initial state of
* the system. This will * the system. This will
* save memory but makes * save memory but makes
* the algorithm cross- * the algorithm cross-
* comparisons less * comparisons less
* powerful, possibly * powerful, possibly
* at the cost of * at the cost of
* chances for finding * chances for finding
* inconsistencies in the * inconsistencies in the
* results. * results.
* GLOBAL: * GLOBAL:
* The synchronous * The synchronous
* products are computed * products are computed
* with respect to each * with respect to each
* system state (i.e. * system state (i.e.
* the formula is model * the formula is model
* checked in each system * checked in each system
* state separately). * state separately).
* This will usually * This will usually
* require more memory * require more memory
* than the other * than the other
* alternative. * alternative.
*/ */
string cfg_filename; /* Name for the string cfg_filename; /* Name for the
* configuration file. * configuration file.
@ -269,7 +269,7 @@ public:
bool do_cons_test; /* Is the model checking bool do_cons_test; /* Is the model checking
* result consistency check * result consistency check
* enabled? * enabled?
*/ */
bool do_intr_test; /* Is the automata bool do_intr_test; /* Is the automata
@ -285,9 +285,9 @@ public:
}; };
struct FormulaConfiguration /* A structure for storing struct FormulaConfiguration /* A structure for storing
* specific information * specific information
* affecting the generation * affecting the generation
* of random formulae. * of random formulae.
*/ */
{ {
int default_operator_priority; /* Default priority for all int default_operator_priority; /* Default priority for all
@ -304,79 +304,79 @@ public:
*/ */
bool allow_abbreviated_operators; /* Determines whether the bool allow_abbreviated_operators; /* Determines whether the
* operators ->, <->, xor, * operators ->, <->, xor,
* <>, [], W and M should * <>, [], W and M should
* be allowed when * be allowed when
* generating random * generating random
* formulae (these are * formulae (these are
* `abbreviated' operators * `abbreviated' operators
* since they could be * since they could be
* written in an equivalent * written in an equivalent
* form by using another * form by using another
* operators). * operators).
*/ */
Configuration::FormulaMode output_mode; /* Determines whether the Configuration::FormulaMode output_mode; /* Determines whether the
* generated formulae are * generated formulae are
* to be converted to * to be converted to
* negation normal form * negation normal form
* before passing them to * before passing them to
* the different * the different
* algorithms. Possible * algorithms. Possible
* values are: * values are:
* *
* NORMAL: * NORMAL:
* No conversion. * No conversion.
* NNF: * NNF:
* Do the conversion * Do the conversion
* (this may affect the * (this may affect the
* size of the formulae!) * size of the formulae!)
*/ */
Configuration::FormulaMode generate_mode; /* Determines whether the Configuration::FormulaMode generate_mode; /* Determines whether the
* formulae are to be * formulae are to be
* generated in negation * generated in negation
* normal form (strict * normal form (strict
* size requirement for * size requirement for
* formulae). Possible * formulae). Possible
* values are: * values are:
* *
* NORMAL: * NORMAL:
* Allow more flexibility * Allow more flexibility
* in the generation of * in the generation of
* formulae. * formulae.
* NNF: * NNF:
* Force generation into * Force generation into
* negation normal form. * negation normal form.
*/ */
::Ltl::FormulaRandomizer formula_generator; /* Interface to the random ::Ltl::FormulaRandomizer formula_generator; /* Interface to the random
* LTL formula generation * LTL formula generation
* algorithm. * algorithm.
*/ */
}; };
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
vector<AlgorithmInformation, /* A vector containing */ vector<AlgorithmInformation, /* A vector containing */
ALLOC(AlgorithmInformation) > algorithms; /* information about the ALLOC(AlgorithmInformation) > algorithms; /* information about the
* algorithms used in * algorithms used in
* the tests. * the tests.
*/ */
GlobalConfiguration global_options; /* General configuration GlobalConfiguration global_options; /* General configuration
* information. * information.
*/ */
FormulaConfiguration formula_options; /* Configuration FormulaConfiguration formula_options; /* Configuration
* information for * information for
* generating random * generating random
* formulae. * formulae.
*/ */
Graph::StateSpaceRandomizer /* Interface to the */ Graph::StateSpaceRandomizer /* Interface to the */
statespace_generator; /* random state space statespace_generator; /* random state space
* generation * generation
* algorithms. * algorithms.
*/ */
@ -392,10 +392,10 @@ public:
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
class ConfigurationException : public Exception /* A class for reporting class ConfigurationException : public Exception /* A class for reporting
* errors when reading * errors when reading
* the configuration file. * the configuration file.
*/ */
{ {
public: public:
ConfigurationException /* Constructors. */ ConfigurationException /* Constructors. */
(const string& info = "", (const string& info = "",
@ -458,7 +458,7 @@ private:
OPT_CONSISTENCYTEST, OPT_DISABLE, OPT_ENABLE, OPT_CONSISTENCYTEST, OPT_DISABLE, OPT_ENABLE,
OPT_FORMULACHANGEINTERVAL, OPT_FORMULAFILE, OPT_FORMULACHANGEINTERVAL, OPT_FORMULAFILE,
OPT_FORMULARANDOMSEED, OPT_HELP = 'h', OPT_FORMULARANDOMSEED, OPT_HELP = 'h',
OPT_GLOBALPRODUCT = 20000, OPT_INTERACTIVE, OPT_GLOBALPRODUCT = 20000, OPT_INTERACTIVE,
OPT_INTERSECTIONTEST, OPT_LOGFILE, OPT_INTERSECTIONTEST, OPT_LOGFILE,
OPT_MODELCHECK, OPT_NOCOMPARISONTEST, OPT_MODELCHECK, OPT_NOCOMPARISONTEST,
OPT_NOCONSISTENCYTEST, OPT_NOINTERSECTIONTEST, OPT_NOCONSISTENCYTEST, OPT_NOINTERSECTIONTEST,
@ -497,12 +497,12 @@ private:
OPT_STATESPACESIZE, OPT_TRUTHPROBABILITY}; OPT_STATESPACESIZE, OPT_TRUTHPROBABILITY};
typedef map<pair<int, int>, double, /* Type definitions for */ typedef map<pair<int, int>, double, /* Type definitions for */
less<pair<int, int> >, /* the result cache used */ less<pair<int, int> >, /* the result cache used */
ALLOC(double) > /* for computing the */ ALLOC(double) > /* for computing the */
ProbabilityMapElement; /* probability */ ProbabilityMapElement; /* probability */
typedef map<int, ProbabilityMapElement, /* distribution of LTL */ typedef map<int, ProbabilityMapElement, /* distribution of LTL */
less<int>, /* formula operators. */ less<int>, /* formula operators. */
ALLOC(ProbabilityMapElement) > ALLOC(ProbabilityMapElement) >
ProbabilityMap; ProbabilityMap;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
@ -514,8 +514,8 @@ private:
*/ */
void reset(); /* Initializes the void reset(); /* Initializes the
* configuration data * configuration data
* to default values. * to default values.
*/ */
long int parseCommandLineInteger /* Converts an integer */ long int parseCommandLineInteger /* Converts an integer */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1999, 2000, 2001, 2002 * Copyright (C) 1999, 2000, 2001, 2002, 2003
* Heikki Tauriainen <Heikki.Tauriainen@hut.fi> * Heikki Tauriainen <Heikki.Tauriainen@hut.fi>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -74,7 +74,7 @@ public:
virtual ~UserBreakException() throw(); /* Destructor. */ virtual ~UserBreakException() throw(); /* Destructor. */
UserBreakException& /* Assignment operator. */ UserBreakException& /* Assignment operator. */
operator=(const UserBreakException& e); operator=(const UserBreakException& e);
/* `what' inherited from class Exception */ /* `what' inherited from class Exception */
@ -289,13 +289,13 @@ public:
Exceptional_istream /* Constructor. */ Exceptional_istream /* Constructor. */
(istream *istr, (istream *istr,
ios::iostate mask = ios::goodbit); ios::iostate mask = ios::goodbit);
/* default copy constructor */ /* default copy constructor */
~Exceptional_istream(); /* Destructor. */ ~Exceptional_istream(); /* Destructor. */
/* default assignment operator */ /* default assignment operator */
template<class T> /* Operator for reading */ template<class T> /* Operator for reading */
Exceptional_istream &operator>>(T &t); /* from the stream. */ Exceptional_istream &operator>>(T &t); /* from the stream. */
@ -337,9 +337,9 @@ public:
Exceptional_ostream /* Constructor. */ Exceptional_ostream /* Constructor. */
(ostream* ostr, (ostream* ostr,
ios::iostate mask = ios::goodbit); ios::iostate mask = ios::goodbit);
/* default copy constructor */ /* default copy constructor */
~Exceptional_ostream(); /* Destructor. */ ~Exceptional_ostream(); /* Destructor. */
/* default assignment operator */ /* default assignment operator */
@ -353,7 +353,7 @@ public:
* aware output stream into * aware output stream into
* a regular output stream. * a regular output stream.
*/ */
private: private:
ostream* stream; /* A pointer to the ostream* stream; /* A pointer to the
* `regular' output stream * `regular' output stream
@ -482,7 +482,7 @@ inline UserBreakException& UserBreakException::operator=
(const UserBreakException& e) (const UserBreakException& e)
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* *
* Descrption: Assignment operator for class UserBreakException. Assigns the * Descrption: Assignment operator for class UserBreakException. Assigns the
* value of another UserBreakException to `this' one. * value of another UserBreakException to `this' one.
* *
* Argument: e -- A reference to a constant UserBreakException. * Argument: e -- A reference to a constant UserBreakException.
@ -808,7 +808,7 @@ inline FileWriteException::FileWriteException() :
inline FileWriteException::FileWriteException inline FileWriteException::FileWriteException
(const string& filename, const string& details) : (const string& filename, const string& details) :
IOException("error writing to " + filename IOException("error writing to " + filename
+ string(details.empty() ? "" : " " + details)) + string(details.empty() ? "" : " " + details))
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* *
* Description: Constructor for class FileWriteException. This constructor * Description: Constructor for class FileWriteException. This constructor
@ -954,7 +954,7 @@ inline Exceptional_istream::Exceptional_istream
* *
* Arguments: istr -- A pointer to an object of type istream. * Arguments: istr -- A pointer to an object of type istream.
* mask -- A bit mask determining when the Exceptional_istream * mask -- A bit mask determining when the Exceptional_istream
* should throw exceptions. The most useful constants * should throw exceptions. The most useful constants
* for the bit mask are * for the bit mask are
* ios::badbit Throw an exception if the input * ios::badbit Throw an exception if the input
* stream (after performing an input * stream (after performing an input
@ -1060,7 +1060,7 @@ inline Exceptional_ostream::Exceptional_ostream
* *
* Arguments: ostr -- A pointer to an object of type ostream. * Arguments: ostr -- A pointer to an object of type ostream.
* mask -- A bit mask determining when the Exceptional_ostream * mask -- A bit mask determining when the Exceptional_ostream
* should throw exceptions. The most useful constants * should throw exceptions. The most useful constants
* for the bit mask are * for the bit mask are
* ios::badbit Throw an exception if the output * ios::badbit Throw an exception if the output
* stream (after performing an output * stream (after performing an output

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1999, 2000, 2001, 2002 * Copyright (C) 1999, 2000, 2001, 2002, 2003
* Heikki Tauriainen <Heikki.Tauriainen@hut.fi> * Heikki Tauriainen <Heikki.Tauriainen@hut.fi>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -22,6 +22,7 @@
#endif /* __GNUC__ */ #endif /* __GNUC__ */
#include <config.h> #include <config.h>
#include <csignal>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <sys/stat.h> #include <sys/stat.h>
@ -125,10 +126,20 @@ void ExternalTranslator::translate
input_file.close(); input_file.close();
string command_line = string(command_line_arguments[2]) string command_line = string(command_line_arguments[2])
+ commandLine(external_program_input_file.getName(), + commandLine(external_program_input_file.getName(),
external_program_output_file.getName()); external_program_output_file.getName());
if (!execSuccess(system(command_line.c_str()))) int exitcode = system(command_line.c_str());
/*
* system() blocks SIGINT and SIGQUIT. If the child was killed
* by such a signal, forward the signal to the current process.
*/
if (WIFSIGNALED(exitcode) &&
(WTERMSIG(exitcode) == SIGINT || WTERMSIG(exitcode) == SIGQUIT))
raise(WTERMSIG(exitcode));
if (!execSuccess(exitcode))
throw ExecFailedException(command_line_arguments[2]); throw ExecFailedException(command_line_arguments[2]);
parseAutomaton(external_program_output_file.getName(), filename); parseAutomaton(external_program_output_file.getName(), filename);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1999, 2000, 2001, 2002 * Copyright (C) 1999, 2000, 2001, 2002, 2003
* Heikki Tauriainen <Heikki.Tauriainen@hut.fi> * Heikki Tauriainen <Heikki.Tauriainen@hut.fi>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -22,6 +22,7 @@
#endif /* __GNUC__ */ #endif /* __GNUC__ */
#include <config.h> #include <config.h>
#include <csignal>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <sys/times.h> #include <sys/times.h>
@ -207,7 +208,7 @@ void printFileContents
first_line_printed = true; first_line_printed = true;
estream << string(indent, ' ') + message + '\n'; estream << string(indent, ' ') + message + '\n';
} }
estream << string(indent, ' ') + line_prefix + message_line + '\n'; estream << string(indent, ' ') + line_prefix + message_line + '\n';
} }
} }
@ -245,8 +246,8 @@ void writeToTranscript(const string& message, bool show_formula_in_header)
const string roundstring = "Round " + toString(round_info.current_round); const string roundstring = "Round " + toString(round_info.current_round);
round_info.transcript_file << roundstring + '\n' round_info.transcript_file << roundstring + '\n'
+ string(roundstring.length(), '-') + string(roundstring.length(), '-')
+ "\n\n"; + "\n\n";
if (show_formula_in_header) if (show_formula_in_header)
{ {
@ -291,7 +292,7 @@ void generateStateSpace()
using ::Graph::StateSpace; using ::Graph::StateSpace;
if (configuration.global_options.statespace_generation_mode if (configuration.global_options.statespace_generation_mode
== Configuration::ENUMERATEDPATH) == Configuration::ENUMERATEDPATH)
{ {
StateSpace::size_type current_size StateSpace::size_type current_size
= configuration.statespace_generator.min_size; = configuration.statespace_generator.min_size;
@ -319,7 +320,7 @@ void generateStateSpace()
2, 2,
6); 6);
} }
else else
{ {
current_size = configuration.statespace_generator.min_size; current_size = configuration.statespace_generator.min_size;
printText("[All state spaces have been enumerated. Staring over]\n", printText("[All state spaces have been enumerated. Staring over]\n",
@ -333,7 +334,7 @@ void generateStateSpace()
{ {
round_info.path_iterator round_info.path_iterator
= new Graph::PathIterator = new Graph::PathIterator
(configuration.statespace_generator.atoms_per_state, (configuration.statespace_generator.atoms_per_state,
current_size); current_size);
} }
@ -367,16 +368,16 @@ void generateStateSpace()
{ {
switch (configuration.global_options.statespace_generation_mode) switch (configuration.global_options.statespace_generation_mode)
{ {
case Configuration::RANDOMGRAPH : case Configuration::RANDOMGRAPH :
statespace = configuration.statespace_generator.generateGraph(); statespace = configuration.statespace_generator.generateGraph();
break; break;
case Configuration::RANDOMCONNECTEDGRAPH : case Configuration::RANDOMCONNECTEDGRAPH :
statespace = configuration.statespace_generator. statespace = configuration.statespace_generator.
generateConnectedGraph(); generateConnectedGraph();
break; break;
default : /* Configuration::RANDOMPATH */ default : /* Configuration::RANDOMPATH */
statespace = configuration.statespace_generator.generatePath(); statespace = configuration.statespace_generator.generatePath();
break; break;
} }
@ -407,8 +408,8 @@ void generateStateSpace()
printText(" ok\n", 4); printText(" ok\n", 4);
if (configuration.statespace_generator.max_size if (configuration.statespace_generator.max_size
> configuration.statespace_generator.min_size) > configuration.statespace_generator.min_size)
printText("number of states: " printText("number of states: "
+ toString(round_info.statespace->size()) + toString(round_info.statespace->size())
+ '\n', + '\n',
@ -572,7 +573,7 @@ void generateFormulae(istream* formula_input_stream)
if (printText(" ok\n", 4)) if (printText(" ok\n", 4))
printText("<negating formula>", 4, 6); printText("<negating formula>", 4, 6);
round_info.formulae[3] = &(::Ltl::Not::construct(*round_info.formulae[2])); round_info.formulae[3] = &(::Ltl::Not::construct(*round_info.formulae[2]));
if (printText(" ok\n", 4)) if (printText(" ok\n", 4))
@ -587,7 +588,7 @@ void generateFormulae(istream* formula_input_stream)
for (int f = 0; f <= 1; f++) for (int f = 0; f <= 1; f++)
{ {
round_info.cout << string(6, ' ') + (f == 0 ? "" : "negated ") round_info.cout << string(6, ' ') + (f == 0 ? "" : "negated ")
+ "formula:" + string(19 - 8 * f, ' '); + "formula:" + string(19 - 8 * f, ' ');
round_info.formulae[f + 2]->print(round_info.cout); round_info.formulae[f + 2]->print(round_info.cout);
round_info.cout << '\n'; round_info.cout << '\n';
@ -742,7 +743,7 @@ void writeFormulaeToFiles()
void generateBuchiAutomaton void generateBuchiAutomaton
(int f, (int f,
vector<Configuration::AlgorithmInformation, vector<Configuration::AlgorithmInformation,
ALLOC(Configuration::AlgorithmInformation) >::size_type algorithm_id) ALLOC(Configuration::AlgorithmInformation) >::size_type algorithm_id)
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* *
* Description: Constructs a BuchiAutomaton by invoking an external program * Description: Constructs a BuchiAutomaton by invoking an external program
@ -811,9 +812,9 @@ void generateBuchiAutomaton
command_line += *(algorithm.extra_parameters) + ' '; command_line += *(algorithm.extra_parameters) + ' ';
command_line += string(round_info.formula_file_name[f]) command_line += string(round_info.formula_file_name[f])
+ ' ' + round_info.automaton_file_name + ' ' + round_info.automaton_file_name
+ " 1>" + round_info.cout_capture_file + " 1>" + round_info.cout_capture_file
+ " 2>" + round_info.cerr_capture_file; + " 2>" + round_info.cerr_capture_file;
if (!printText("<executing `" + command_line + "'>", 5, 10)) if (!printText("<executing `" + command_line + "'>", 5, 10))
printText("<computing Büchi automaton>", 4, 10); printText("<computing Büchi automaton>", 4, 10);
@ -836,11 +837,11 @@ void generateBuchiAutomaton
&& timing_information_begin.tms_cutime != static_cast<clock_t>(-1) && timing_information_begin.tms_cutime != static_cast<clock_t>(-1)
&& timing_information_end.tms_utime != static_cast<clock_t>(-1) && timing_information_end.tms_utime != static_cast<clock_t>(-1)
&& timing_information_end.tms_cutime != static_cast<clock_t>(-1)) && timing_information_end.tms_cutime != static_cast<clock_t>(-1))
automaton_stats.buchi_generation_time automaton_stats.buchi_generation_time
= static_cast<double>(timing_information_end.tms_utime = static_cast<double>(timing_information_end.tms_utime
+ timing_information_end.tms_cutime + timing_information_end.tms_cutime
- timing_information_begin.tms_utime - timing_information_begin.tms_utime
- timing_information_begin.tms_cutime) - timing_information_begin.tms_cutime)
/ sysconf(_SC_CLK_TCK); / sysconf(_SC_CLK_TCK);
/* /*
@ -851,6 +852,17 @@ void generateBuchiAutomaton
if (exitcode != 0) if (exitcode != 0)
{ {
/*
* system() blocks SIGINT and SIGQUIT. If the child was killed
* by such a signal, forward the signal to the current process.
* If lbtt is interactive, SIGINT will be handled as a user
* break. If lbtt is non-interactive, SIGINT will kill lbtt.
* This is what we expect when hitting C-c while lbtt is running.
*/
if (WIFSIGNALED(exitcode) &&
(WTERMSIG(exitcode) == SIGINT || WTERMSIG(exitcode) == SIGQUIT))
raise(WTERMSIG(exitcode));
ExecFailedException e; ExecFailedException e;
e.changeMessage("Execution of `" + *(algorithm.path_to_program) e.changeMessage("Execution of `" + *(algorithm.path_to_program)
+ "' failed" + "' failed"
@ -860,7 +872,7 @@ void generateBuchiAutomaton
2) 2)
+ " seconds elapsed)" + " seconds elapsed)"
: string("")) : string(""))
+ " with exit status " + toString(exitcode)); + " with exit status " + toString(exitcode));
throw e; throw e;
} }
@ -893,17 +905,17 @@ void generateBuchiAutomaton
if (round_info.transcript_file.is_open()) if (round_info.transcript_file.is_open())
{ {
writeToTranscript("Büchi automaton generation failed (" writeToTranscript("Büchi automaton generation failed ("
+ configuration.algorithmString(algorithm_id) + configuration.algorithmString(algorithm_id)
+ ", " + ", "
+ (f == 0 ? "posi" : "nega") + (f == 0 ? "posi" : "nega")
+ "tive formula)"); + "tive formula)");
if (automaton_stats.buchi_generation_time >= 0.0) if (automaton_stats.buchi_generation_time >= 0.0)
round_info.transcript_file << string(8, ' ') + "Elapsed time: " round_info.transcript_file << string(8, ' ') + "Elapsed time: "
+ toString(automaton_stats. + toString(automaton_stats.
buchi_generation_time, buchi_generation_time,
2) 2)
+ " seconds (user time)\n"; + " seconds (user time)\n";
} }
try try
@ -915,33 +927,33 @@ void generateBuchiAutomaton
printText(string(": ") + e.what(), 2); printText(string(": ") + e.what(), 2);
if (round_info.transcript_file.is_open()) if (round_info.transcript_file.is_open())
round_info.transcript_file << string(8, ' ') round_info.transcript_file << string(8, ' ')
+ "Program execution failed with exit " + "Program execution failed with exit "
"status " "status "
+ toString(exitcode); + toString(exitcode);
} }
catch (const BuchiAutomaton::AutomatonParseException& e) catch (const BuchiAutomaton::AutomatonParseException& e)
{ {
printText(string(" parsing input: ") + e.what(), 2); printText(string(" parsing input: ") + e.what(), 2);
if (round_info.transcript_file.is_open()) if (round_info.transcript_file.is_open())
round_info.transcript_file << string(8, ' ') round_info.transcript_file << string(8, ' ')
+ "Error reading automaton: " + "Error reading automaton: "
+ e.what(); + e.what();
} }
catch (const Exception& e) catch (const Exception& e)
{ {
printText(string(": ") + e.what(), 2); printText(string(": ") + e.what(), 2);
if (round_info.transcript_file.is_open()) if (round_info.transcript_file.is_open())
round_info.transcript_file << string(8, ' ') round_info.transcript_file << string(8, ' ')
+ "lbtt internal error: " + "lbtt internal error: "
+ e.what(); + e.what();
} }
catch (const bad_alloc&) catch (const bad_alloc&)
{ {
printText(": out of memory", 2); printText(": out of memory", 2);
if (round_info.transcript_file.is_open()) if (round_info.transcript_file.is_open())
round_info.transcript_file << string(8, ' ') round_info.transcript_file << string(8, ' ')
+ "Out of memory while reading " + "Out of memory while reading "
"automaton"; "automaton";
} }
printText("\n", 2); printText("\n", 2);
@ -1021,7 +1033,7 @@ void generateBuchiAutomaton
+= automaton_stats.number_of_buchi_transitions; += automaton_stats.number_of_buchi_transitions;
final_statistics[algorithm_id].total_number_of_acceptance_sets[f] final_statistics[algorithm_id].total_number_of_acceptance_sets[f]
+= automaton_stats.number_of_acceptance_sets; += automaton_stats.number_of_acceptance_sets;
if (final_statistics[algorithm_id].total_buchi_generation_time[f] < 0.0 if (final_statistics[algorithm_id].total_buchi_generation_time[f] < 0.0
|| automaton_stats.buchi_generation_time < 0.0) || automaton_stats.buchi_generation_time < 0.0)
final_statistics[algorithm_id].total_buchi_generation_time[f] = -1.0; final_statistics[algorithm_id].total_buchi_generation_time[f] = -1.0;
@ -1040,7 +1052,7 @@ void generateBuchiAutomaton
void generateProductAutomaton void generateProductAutomaton
(int f, (int f,
vector<Configuration::AlgorithmInformation, vector<Configuration::AlgorithmInformation,
ALLOC(Configuration::AlgorithmInformation) >::size_type algorithm_id) ALLOC(Configuration::AlgorithmInformation) >::size_type algorithm_id)
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* *
* Description: Computes the product of a Büchi automaton with a state * Description: Computes the product of a Büchi automaton with a state
@ -1098,7 +1110,7 @@ void generateProductAutomaton
if (round_info.transcript_file.is_open()) if (round_info.transcript_file.is_open())
writeToTranscript("Product automaton generation aborted (" writeToTranscript("Product automaton generation aborted ("
+ configuration.algorithmString(algorithm_id) + configuration.algorithmString(algorithm_id)
+ ", " + ", "
+ (f == 0 ? "posi" : "nega") + "tive formula)" + (f == 0 ? "posi" : "nega") + "tive formula)"
+ ". Product may be too large.\n"); + ". Product may be too large.\n");
@ -1110,7 +1122,7 @@ void generateProductAutomaton
{ {
if (!printText(" user break\n\n", 4)) if (!printText(" user break\n\n", 4))
printText("[User break]\n\n", 2, 10); printText("[User break]\n\n", 2, 10);
if (round_info.transcript_file.is_open()) if (round_info.transcript_file.is_open())
writeToTranscript("User break while generating product automaton (" writeToTranscript("User break while generating product automaton ("
+ configuration.algorithmString(algorithm_id) + configuration.algorithmString(algorithm_id)
@ -1173,7 +1185,7 @@ void generateProductAutomaton
void performEmptinessCheck void performEmptinessCheck
(int f, (int f,
vector<Configuration::AlgorithmInformation, vector<Configuration::AlgorithmInformation,
ALLOC(Configuration::AlgorithmInformation) >::size_type ALLOC(Configuration::AlgorithmInformation) >::size_type
algorithm_id) algorithm_id)
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* *
@ -1211,7 +1223,7 @@ void performEmptinessCheck
{ {
round_info.product_automaton->emptinessCheck round_info.product_automaton->emptinessCheck
(automaton_stats.emptiness_check_result); (automaton_stats.emptiness_check_result);
automaton_stats.emptiness_check_performed = true; automaton_stats.emptiness_check_performed = true;
} }
catch (const UserBreakException&) catch (const UserBreakException&)
@ -1221,7 +1233,7 @@ void performEmptinessCheck
if (round_info.transcript_file.is_open()) if (round_info.transcript_file.is_open())
writeToTranscript("User break while searching for accepting cycles (" writeToTranscript("User break while searching for accepting cycles ("
+ configuration.algorithmString(algorithm_id) + configuration.algorithmString(algorithm_id)
+ ", " + ", "
+ (f == 0 ? "posi" : "nega") + "tive formula)\n"); + (f == 0 ? "posi" : "nega") + "tive formula)\n");
@ -1252,7 +1264,7 @@ void performEmptinessCheck
/* ========================================================================= */ /* ========================================================================= */
void performConsistencyCheck void performConsistencyCheck
(vector<Configuration::AlgorithmInformation, (vector<Configuration::AlgorithmInformation,
ALLOC(Configuration::AlgorithmInformation) >::size_type ALLOC(Configuration::AlgorithmInformation) >::size_type
algorithm_id) algorithm_id)
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* *
@ -1322,10 +1334,10 @@ void performConsistencyCheck
} }
printText((result ? " ok\n" : " failed\n"), 4); printText((result ? " ok\n" : " failed\n"), 4);
if (configuration.global_options.verbosity >= 3) if (configuration.global_options.verbosity >= 3)
printConsistencyCheckStats(cout, 8, algorithm_id); printConsistencyCheckStats(cout, 8, algorithm_id);
} }
/* ========================================================================= */ /* ========================================================================= */
void compareResults() void compareResults()
@ -1378,7 +1390,7 @@ void compareResults()
unsigned long int dist unsigned long int dist
= alg_1_stats->emptiness_check_result.hammingDistance = alg_1_stats->emptiness_check_result.hammingDistance
(alg_2_stats->emptiness_check_result); (alg_2_stats->emptiness_check_result);
alg_1_stats->cross_comparison_stats[alg_2].first alg_1_stats->cross_comparison_stats[alg_2].first
= alg_2_stats->cross_comparison_stats[alg_1].first = alg_2_stats->cross_comparison_stats[alg_1].first
@ -1397,9 +1409,9 @@ void compareResults()
!= alg_2_stats->emptiness_check_result[0]) != alg_2_stats->emptiness_check_result[0])
{ {
(final_statistics[alg_1]. (final_statistics[alg_1].
initial_cross_comparison_mismatches[alg_2])++; initial_cross_comparison_mismatches[alg_2])++;
(final_statistics[alg_2]. (final_statistics[alg_2].
initial_cross_comparison_mismatches[alg_1])++; initial_cross_comparison_mismatches[alg_1])++;
} }
result = false; result = false;
@ -1479,13 +1491,13 @@ void performBuchiIntersectionCheck()
if (test_results[alg_1].automaton_stats[0].buchiAutomatonComputed() if (test_results[alg_1].automaton_stats[0].buchiAutomatonComputed()
&& test_results[alg_2].automaton_stats[1]. && test_results[alg_2].automaton_stats[1].
buchiAutomatonComputed()) buchiAutomatonComputed())
{ {
automaton_intersection = 0; automaton_intersection = 0;
automaton_intersection automaton_intersection
= BuchiAutomaton::intersect = BuchiAutomaton::intersect
(*(test_results[alg_1].automaton_stats[0].buchi_automaton), (*(test_results[alg_1].automaton_stats[0].buchi_automaton),
*(test_results[alg_2].automaton_stats[1].buchi_automaton)); *(test_results[alg_2].automaton_stats[1].buchi_automaton));
/* /*
@ -1519,18 +1531,18 @@ void performBuchiIntersectionCheck()
unsigned long int acceptance_set_counter = 0; unsigned long int acceptance_set_counter = 0;
for (set<GraphEdgeContainer::size_type, for (set<GraphEdgeContainer::size_type,
less<GraphEdgeContainer::size_type>, less<GraphEdgeContainer::size_type>,
ALLOC(GraphEdgeContainer::size_type) >::const_iterator ALLOC(GraphEdgeContainer::size_type) >::const_iterator
state = scc->begin(); state = scc->begin();
state != scc->end() state != scc->end()
&& acceptance_set_counter < number_of_acceptance_sets; && acceptance_set_counter < number_of_acceptance_sets;
++state) ++state)
{ {
accept_set = acceptance_set_counter; accept_set = acceptance_set_counter;
while (accept_set < number_of_acceptance_sets) while (accept_set < number_of_acceptance_sets)
{ {
if ((*automaton_intersection)[*state].acceptanceSets(). if ((*automaton_intersection)[*state].acceptanceSets().
test(accept_set)) test(accept_set))
{ {
acceptance_sets.setBit(accept_set); acceptance_sets.setBit(accept_set);
if (accept_set == acceptance_set_counter) if (accept_set == acceptance_set_counter)
@ -1538,7 +1550,7 @@ void performBuchiIntersectionCheck()
do do
acceptance_set_counter++; acceptance_set_counter++;
while (acceptance_set_counter while (acceptance_set_counter
< number_of_acceptance_sets < number_of_acceptance_sets
&& acceptance_sets[acceptance_set_counter]); && acceptance_sets[acceptance_set_counter]);
accept_set = acceptance_set_counter; accept_set = acceptance_set_counter;
continue; continue;
@ -1549,7 +1561,7 @@ void performBuchiIntersectionCheck()
} }
if (acceptance_set_counter == number_of_acceptance_sets) if (acceptance_set_counter == number_of_acceptance_sets)
{ {
test_results[alg_1].automaton_stats[0]. test_results[alg_1].automaton_stats[0].
buchi_intersection_check_stats[alg_2] = 0; buchi_intersection_check_stats[alg_2] = 0;
test_results[alg_2].automaton_stats[1]. test_results[alg_2].automaton_stats[1].
@ -1574,7 +1586,7 @@ void performBuchiIntersectionCheck()
automaton_intersection = 0; automaton_intersection = 0;
if (test_results[alg_1].automaton_stats[0]. if (test_results[alg_1].automaton_stats[0].
buchi_intersection_check_stats[alg_2] == -1) buchi_intersection_check_stats[alg_2] == -1)
{ {
test_results[alg_1].automaton_stats[0]. test_results[alg_1].automaton_stats[0].
buchi_intersection_check_stats[alg_2] = 1; buchi_intersection_check_stats[alg_2] = 1;
@ -1606,10 +1618,10 @@ void performBuchiIntersectionCheck()
writeToTranscript("User break during Büchi automata intersection " writeToTranscript("User break during Büchi automata intersection "
"emptiness check"); "emptiness check");
round_info.transcript_file << string(8, ' ') + "(+) " round_info.transcript_file << string(8, ' ') + "(+) "
+ configuration.algorithmString(alg_1) + configuration.algorithmString(alg_1)
+ ", (-) " + ", (-) "
+ configuration.algorithmString(alg_2) + configuration.algorithmString(alg_2)
+ "\n\n"; + "\n\n";
if (automaton_intersection != 0) if (automaton_intersection != 0)
{ {
@ -1640,10 +1652,10 @@ void performBuchiIntersectionCheck()
writeToTranscript("Out of memory during Büchi automata " writeToTranscript("Out of memory during Büchi automata "
"intersection emptiness check"); "intersection emptiness check");
round_info.transcript_file << string(8, ' ') + "(+) " round_info.transcript_file << string(8, ' ') + "(+) "
+ configuration.algorithmString(alg_1) + configuration.algorithmString(alg_1)
+ ", (-) " + ", (-) "
+ configuration.algorithmString(alg_2) + configuration.algorithmString(alg_2)
+ "\n\n"; + "\n\n";
} }
} }
} }

View file

@ -704,7 +704,8 @@ int main(int argc, char* argv[])
configuration.print(cout); configuration.print(cout);
user_break = false; user_break = false;
signal(SIGINT, breakHandler); if (configuration.global_options.interactive != Configuration::NEVER)
signal(SIGINT, breakHandler);
#ifdef HAVE_OBSTACK_H #ifdef HAVE_OBSTACK_H
obstack_alloc_failed_handler = &ObstackAllocator::failure; obstack_alloc_failed_handler = &ObstackAllocator::failure;