summaryrefslogtreecommitdiff
path: root/src/expr
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2012-09-04 22:22:41 +0000
committerMorgan Deters <mdeters@gmail.com>2012-09-04 22:22:41 +0000
commitce6c366450cc9cb30c254f26089696c1c7c913c0 (patch)
treea7ea29ec2f222c0e7ae4d9559a486905be10a923 /src/expr
parent5d9670acc3c8eacdebdbb07302a8e35f837d0e52 (diff)
Accepted some patches from the Multicore Programming Group at Imperial College London (via Peter Collingbourne):
cvc4-0001-Look-for-cxxtestgen-as-well-as-cxxtestgen.pl-and-cxx.patch * better checking for cxxtest cvc4-0002-Do-not-read-an-additional-command-after-failure.patch * more correct failure behavior for interactive tools cvc4-0003-Only-exit-when-encountering-a-CommandFailure.patch * don't consider "unsupported" as a failure (accepted with modifications) cvc4-0004-Produce-SMT-LIB-v2-conformant-output-for-get-info.patch * better get-info responses (accepted with modifications) These patches will help the group build Boogie support for CVC4. (this commit was certified error- and warning-free by the test-and-commit script.)
Diffstat (limited to 'src/expr')
-rw-r--r--src/expr/command.cpp13
-rw-r--r--src/expr/command.h11
2 files changed, 18 insertions, 6 deletions
diff --git a/src/expr/command.cpp b/src/expr/command.cpp
index 648c64388..b058292f3 100644
--- a/src/expr/command.cpp
+++ b/src/expr/command.cpp
@@ -91,6 +91,10 @@ bool Command::ok() const throw() {
return d_commandStatus == NULL || dynamic_cast<const CommandSuccess*>(d_commandStatus) != NULL;
}
+bool Command::fail() const throw() {
+ return d_commandStatus != NULL && dynamic_cast<const CommandFailure*>(d_commandStatus) != NULL;
+}
+
void Command::invoke(SmtEngine* smtEngine, std::ostream& out) throw() {
invoke(smtEngine);
printResult(out);
@@ -1048,11 +1052,11 @@ std::string GetInfoCommand::getFlag() const throw() {
void GetInfoCommand::invoke(SmtEngine* smtEngine) throw() {
try {
- SExpr response = smtEngine->getInfo(d_flag);
+ vector<SExpr> v;
+ v.push_back(SExpr(SExpr::Keyword(string(":") + d_flag)));
+ v.push_back(smtEngine->getInfo(d_flag));
stringstream ss;
- ss << SExpr(SExpr::Keyword(d_flag))
- << ' '
- << response;
+ ss << SExpr(v);
d_result = ss.str();
d_commandStatus = CommandSuccess::instance();
} catch(UnrecognizedOptionException&) {
@@ -1136,7 +1140,6 @@ void GetOptionCommand::invoke(SmtEngine* smtEngine) throw() {
v.push_back(SExpr(SExpr::Keyword(string(":") + d_flag)));
v.push_back(smtEngine->getOption(d_flag));
stringstream ss;
-
ss << SExpr(v);
d_result = ss.str();
d_commandStatus = CommandSuccess::instance();
diff --git a/src/expr/command.h b/src/expr/command.h
index 4657755e7..0f517e7f2 100644
--- a/src/expr/command.h
+++ b/src/expr/command.h
@@ -211,9 +211,18 @@ public:
std::string toString() const throw();
- /** Either the command hasn't run yet, or it completed successfully. */
+ /**
+ * Either the command hasn't run yet, or it completed successfully
+ * (CommandSuccess, not CommandUnsupported or CommandFailure).
+ */
bool ok() const throw();
+ /**
+ * The command completed in a failure state (CommandFailure, not
+ * CommandSuccess or CommandUnsupported).
+ */
+ bool fail() const throw();
+
/** Get the command status (it's NULL if we haven't run yet). */
const CommandStatus* getCommandStatus() const throw() { return d_commandStatus; }
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback