(*i).second = sv;
}
+void ValidityChecker::setUpOptions(CVC4::Options& options, const CLFlags& clflags) {
+ // always incremental and model-producing in CVC3 compatibility mode
+ options.incrementalSolving = true;
+ options.produceModels = true;
+
+ options.statistics = clflags["stats"].getBool();
+ options.satRandomSeed = double(clflags["seed"].getInt());
+ options.interactive = clflags["interactive"].getBool();
+ if(options.interactive) {
+ options.interactiveSetByUser = true;
+ }
+ options.parseOnly = clflags["parse-only"].getBool();
+ options.setInputLanguage(clflags["lang"].getString().c_str());
+ if(clflags["output-lang"].getString() == "") {
+ options.outputLanguage = CVC4::language::toOutputLanguage(options.inputLanguage);
+ } else {
+ options.setOutputLanguage(clflags["output-lang"].getString().c_str());
+ }
+}
+
ValidityChecker::ValidityChecker() :
d_clflags(new CLFlags()),
d_options() {
- d_options.incrementalSolving = true;
-#warning fixme other options from clflags ??
+ setUpOptions(d_options, *d_clflags);
d_em = new CVC4::ExprManager(d_options);
d_smt = new CVC4::SmtEngine(d_em);
}
ValidityChecker::ValidityChecker(const CLFlags& clflags) :
d_clflags(new CLFlags(clflags)),
d_options() {
- d_options.incrementalSolving = true;
-#warning fixme other options from clflags ??
+ setUpOptions(d_options, *d_clflags);
d_em = new CVC4::ExprManager(d_options);
d_smt = new CVC4::SmtEngine(d_em);
}
flags.addFlag("version",CLFlag(true, "print version information and exit"));
flags.addFlag("interactive", CLFlag(false, "Interactive mode"));
flags.addFlag("stats", CLFlag(false, "Print run-time statistics"));
- flags.addFlag("seed", CLFlag(1, "Set the seed for random sequence"));
+ flags.addFlag("seed", CLFlag(91648253, "Set the seed for random sequence"));
flags.addFlag("printResults", CLFlag(true, "Print results of interactive commands."));
flags.addFlag("dump-log", CLFlag("", "Dump API call log in CVC3 input "
"format to given file "
CVC4::Options opts = *d_em->getOptions();
opts.inputLanguage = lang;
opts.interactive = interactive;
+ opts.interactiveSetByUser = true;
CVC4::parser::ParserBuilder parserBuilder(d_em, fileName, opts);
CVC4::parser::Parser* parser = parserBuilder.build();
doCommands(parser, d_smt, opts);
CVC4::Options opts = *d_em->getOptions();
opts.inputLanguage = lang;
opts.interactive = interactive;
+ opts.interactiveSetByUser = true;
CVC4::parser::ParserBuilder parserBuilder(d_em, "[stream]", opts);
CVC4::parser::Parser* parser = parserBuilder.withStreamInput(is).build();
doCommands(parser, d_smt, opts);
}
binary_name = string(progName);
- // The strange string in this call is the short option string. The
+ // The strange string in this call is the short option string. An
// initial '+' means that option processing stops as soon as a
- // non-option argument is encountered. The initial ':' indicates
- // that getopt_long() should return ':' instead of '?' for a missing
- // option argument. Then, each letter is a valid short option for
- // getopt_long(), and if it's encountered, getopt_long() returns
- // that character. A ':' after an option character means an
- // argument is required; two colons indicates an argument is
- // optional; no colons indicate an argument is not permitted.
- // cmdlineOptions specifies all the long-options and the return
- // value for getopt_long() should they be encountered.
+ // non-option argument is encountered (it is not present, by design).
+ // The initial ':' indicates that getopt_long() should return ':'
+ // instead of '?' for a missing option argument. Then, each letter
+ // is a valid short option for getopt_long(), and if it's encountered,
+ // getopt_long() returns that character. A ':' after an option
+ // character means an argument is required; two colons indicates an
+ // argument is optional; no colons indicate an argument is not
+ // permitted. cmdlineOptions specifies all the long-options and the
+ // return value for getopt_long() should they be encountered.
while((c = getopt_long(argc, argv,
- "+:hVvqL:d:t:",
+ ":hVvqL:d:t:",
cmdlineOptions, NULL)) != -1) {
switch(c) {
case 'h':
help = true;
break;
- // options.printUsage(usage);
- // exit(1);
case 'V':
version = true;
break;
- // fputs(Configuration::about().c_str(), stdout);
- // exit(0);
case 'v':
++verbosity;
break;
case 'L':
- if(!strcmp(optarg, "cvc4") || !strcmp(optarg, "pl")) {
- inputLanguage = language::input::LANG_CVC4;
- break;
- } else if(!strcmp(optarg, "smtlib") || !strcmp(optarg, "smt")) {
- inputLanguage = language::input::LANG_SMTLIB;
- break;
- } else if(!strcmp(optarg, "smtlib2") || !strcmp(optarg, "smt2")) {
- inputLanguage = language::input::LANG_SMTLIB_V2;
- break;
- } else if(!strcmp(optarg, "auto")) {
- inputLanguage = language::input::LANG_AUTO;
- break;
- }
-
- if(strcmp(optarg, "help")) {
- throw OptionException(string("unknown language for --lang: `") +
- optarg + "'. Try --lang help.");
- }
-
- languageHelp = true;
+ setInputLanguage(optarg);
break;
case OUTPUT_LANGUAGE:
- if(!strcmp(optarg, "cvc4") || !strcmp(optarg, "pl")) {
- outputLanguage = language::output::LANG_CVC4;
- break;
- } else if(!strcmp(optarg, "smtlib") || !strcmp(optarg, "smt")) {
- outputLanguage = language::output::LANG_SMTLIB;
- break;
- } else if(!strcmp(optarg, "smtlib2") || !strcmp(optarg, "smt2")) {
- outputLanguage = language::output::LANG_SMTLIB_V2;
- break;
- } else if(!strcmp(optarg, "ast")) {
- outputLanguage = language::output::LANG_AST;
- break;
- } else if(!strcmp(optarg, "auto")) {
- outputLanguage = language::output::LANG_AUTO;
- break;
- }
-
- if(strcmp(optarg, "help")) {
- throw OptionException(string("unknown language for --output-lang: `") +
- optarg + "'. Try --output-lang help.");
- }
-
- languageHelp = true;
+ setOutputLanguage(optarg);
break;
case 't':
default:
throw OptionException(string("can't understand option `") + argv[optind - 1] + "'");
}
-
}
return optind;
}
+void Options::setOutputLanguage(const char* str) throw(OptionException) {
+ if(!strcmp(str, "cvc4") || !strcmp(str, "pl")) {
+ outputLanguage = language::output::LANG_CVC4;
+ return;
+ } else if(!strcmp(str, "smtlib") || !strcmp(str, "smt")) {
+ outputLanguage = language::output::LANG_SMTLIB;
+ return;
+ } else if(!strcmp(str, "smtlib2") || !strcmp(str, "smt2")) {
+ outputLanguage = language::output::LANG_SMTLIB_V2;
+ return;
+ } else if(!strcmp(str, "ast")) {
+ outputLanguage = language::output::LANG_AST;
+ return;
+ } else if(!strcmp(str, "auto")) {
+ outputLanguage = language::output::LANG_AUTO;
+ return;
+ }
+
+ if(strcmp(str, "help")) {
+ throw OptionException(string("unknown language for --output-lang: `") +
+ str + "'. Try --output-lang help.");
+ }
+
+ languageHelp = true;
+}
+
+void Options::setInputLanguage(const char* str) throw(OptionException) {
+ if(!strcmp(str, "cvc4") || !strcmp(str, "pl") || !strcmp(str, "presentation")) {
+ inputLanguage = language::input::LANG_CVC4;
+ return;
+ } else if(!strcmp(str, "smtlib") || !strcmp(str, "smt")) {
+ inputLanguage = language::input::LANG_SMTLIB;
+ return;
+ } else if(!strcmp(str, "smtlib2") || !strcmp(str, "smt2")) {
+ inputLanguage = language::input::LANG_SMTLIB_V2;
+ return;
+ } else if(!strcmp(str, "auto")) {
+ inputLanguage = language::input::LANG_AUTO;
+ return;
+ }
+
+ if(strcmp(str, "help")) {
+ throw OptionException(string("unknown language for --lang: `") +
+ str + "'. Try --lang help.");
+ }
+
+ languageHelp = true;
+}
+
std::ostream& operator<<(std::ostream& out, Options::ArithPivotRule rule) {
switch(rule) {
case Options::MINIMUM: