diff options
author | Morgan Deters <mdeters@gmail.com> | 2011-11-22 05:17:55 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2011-11-22 05:17:55 +0000 |
commit | 38bfb8f76514b154c9d6cc370c5cdbdb8118e66c (patch) | |
tree | 34113c0cbde85ba3a987db81922f97ec6fa15fea /src/util/options.cpp | |
parent | ebba5e92588a500a7384f7337968758386db7888 (diff) |
More language bindings work:
* with a patched SWIG, the ocaml bindings build correctly.
** I will provide my patch to the SWIG dev team.
* fixed some class interfaces to play more nicely with SWIG.
* php, perl, tcl now work; examples added.
* improved binding module building and installation.
Also:
Stop #defining NULL ((void*) 0). This has been in cvc4_public.h for
a long, long time, I forget why I added it in the first place, and
it's a very, very bad idea. In C++, certain things are permitted
for NULL that aren't permitted for ((void*) 0), like for instance
implicit conversion to any pointer type. We didn't see an issue
here (until now, when interfacing with SWIG), because GCC is usually
pretty smart at working around such a broken #definition of NULL.
But that's fragile.
New exception-free Command architecture. Previously, some command
invocations were wrapped in a try {} catch() {} and printed out an
error. This is much more consistent now. Each Command invocation
results in a CommandStatus. The status can be "unsupported",
"error", or "success" (these are each derived classes, though, not
strings, so that they can be easily printed in a language-specific
way... e.g., in SMT-LIBv2, they are printed in a manner consistent
with the spec, and "success" is not printed if the print-success
option is off.) All Command functionality are now no-throw
functions, which @cconway reports is a Good Thing for Google
(where all C++ exceptions are suspect), and also I think is much
cleaner than the old way in this instance.
Added an --smtlib2 option that enables an "SMT-LIBv2 compliance
mode"---really it just sets a few other options like strictParsing,
inputLanguage, and printSuccess. In the future we might put other
options into a compliance mode, or we might choose to make it the
default.
Diffstat (limited to 'src/util/options.cpp')
-rw-r--r-- | src/util/options.cpp | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/src/util/options.cpp b/src/util/options.cpp index 94ddf082f..842bd84b2 100644 --- a/src/util/options.cpp +++ b/src/util/options.cpp @@ -27,6 +27,7 @@ #include <getopt.h> #include "expr/expr.h" +#include "expr/command.h" #include "util/configuration.h" #include "util/exception.h" #include "util/language.h" @@ -118,6 +119,8 @@ Most commonly-used CVC4 options:\n\ --no-interactive force non-interactive mode\n\ --produce-models | -m support the get-value command\n\ --produce-assignments support the get-assignment command\n\ + --print-success print the \"success\" output required of SMT-LIBv2\n\ + --smtlib2 SMT-LIBv2 conformance mode (implies other options)\n\ --proof turn on proof generation\n\ --incremental | -i enable incremental solving\n\ --tlimit=MS enable time limiting (give milliseconds)\n\ @@ -306,6 +309,8 @@ enum OptionValue { INTERACTIVE, NO_INTERACTIVE, PRODUCE_ASSIGNMENTS, + PRINT_SUCCESS, + SMTLIB2, PROOF, NO_TYPE_CHECKING, LAZY_TYPE_CHECKING, @@ -384,6 +389,8 @@ static struct option cmdlineOptions[] = { { "no-interactive", no_argument , NULL, NO_INTERACTIVE }, { "produce-models", no_argument , NULL, 'm' }, { "produce-assignments", no_argument, NULL, PRODUCE_ASSIGNMENTS }, + { "print-success", no_argument, NULL, PRINT_SUCCESS }, + { "smtlib2", no_argument, NULL, SMTLIB2 }, { "proof", no_argument, NULL, PROOF }, { "no-type-checking", no_argument , NULL, NO_TYPE_CHECKING }, { "lazy-type-checking", no_argument, NULL, LAZY_TYPE_CHECKING }, @@ -597,14 +604,12 @@ throw(OptionException) { break; case PRINT_EXPR_TYPES: - { - Debug.getStream() << Expr::printtypes(true); - Trace.getStream() << Expr::printtypes(true); - Notice.getStream() << Expr::printtypes(true); - Chat.getStream() << Expr::printtypes(true); - Message.getStream() << Expr::printtypes(true); - Warning.getStream() << Expr::printtypes(true); - } + Debug.getStream() << Expr::printtypes(true); + Trace.getStream() << Expr::printtypes(true); + Notice.getStream() << Expr::printtypes(true); + Chat.getStream() << Expr::printtypes(true); + Message.getStream() << Expr::printtypes(true); + Warning.getStream() << Expr::printtypes(true); break; case LAZY_DEFINITION_EXPANSION: @@ -648,7 +653,27 @@ throw(OptionException) { case PRODUCE_ASSIGNMENTS: produceAssignments = true; break; - + + case SMTLIB2: // smtlib v2 compliance mode + inputLanguage = language::input::LANG_SMTLIB_V2; + outputLanguage = language::output::LANG_SMTLIB_V2; + strictParsing = true; + // make sure entire expressions are printed on all the non-debug, non-trace streams + Notice.getStream() << Expr::setdepth(-1); + Chat.getStream() << Expr::setdepth(-1); + Message.getStream() << Expr::setdepth(-1); + Warning.getStream() << Expr::setdepth(-1); + /* intentionally fall through */ + + case PRINT_SUCCESS: + Debug.getStream() << Command::printsuccess(true); + Trace.getStream() << Command::printsuccess(true); + Notice.getStream() << Command::printsuccess(true); + Chat.getStream() << Command::printsuccess(true); + Message.getStream() << Command::printsuccess(true); + Warning.getStream() << Command::printsuccess(true); + break; + case PROOF: #ifdef CVC4_PROOF proof = true; |