#include <vector>
#include <utility>
#include <iterator>
+#include <sstream>
#include "expr/command.h"
#include "smt/smt_engine.h"
#include "smt/bad_option_exception.h"
#include "util/output.h"
+#include "util/sexpr.h"
using namespace std;
}
void SetBenchmarkStatusCommand::invoke(SmtEngine* smtEngine) {
- // FIXME: TODO: something to be done with the status
+ stringstream ss;
+ ss << d_status;
+ SExpr status = ss.str();
+ try {
+ smtEngine->setInfo(":status", status);
+ //d_result = "success";
+ } catch(ModalException& m) {
+ d_result = "error";
+ } catch(BadOptionException& bo) {
+ // should not happen
+ d_result = "error";
+ }
}
void SetBenchmarkStatusCommand::toStream(std::ostream& out) const {
}
void SetBenchmarkLogicCommand::invoke(SmtEngine* smtEngine) {
- // FIXME: TODO: something to be done with the logic
+ try {
+ smtEngine->setLogic(d_logic);
+ //d_result = "success";
+ } catch(ModalException& m) {
+ d_result = "error";
+ }
}
void SetBenchmarkLogicCommand::toStream(std::ostream& out) const {
try {
smtEngine->setInfo(d_flag, d_sexpr);
//d_result = "success";
+ } catch(ModalException& m) {
+ d_result = "error";
} catch(BadOptionException& bo) {
d_result = "unsupported";
}
try {
smtEngine->setOption(d_flag, d_sexpr);
//d_result = "success";
+ } catch(ModalException& m) {
+ d_result = "error";
} catch(BadOptionException& bo) {
d_result = "unsupported";
}
class CVC4_PUBLIC SetBenchmarkStatusCommand : public Command {
protected:
+ std::string d_result;
BenchmarkStatus d_status;
public:
SetBenchmarkStatusCommand(BenchmarkStatus status);
class CVC4_PUBLIC SetBenchmarkLogicCommand : public Command {
protected:
+ std::string d_result;
std::string d_logic;
public:
SetBenchmarkLogicCommand(std::string logic);
/**
* Asserts the given clause to the sat solver.
* @param node the node giving rise to this clause
- * @param clause the clasue to assert
+ * @param clause the clause to assert
*/
void assertClause(TNode node, SatClause& clause);
d_lazyDefinitionExpansion = opts.lazyDefinitionExpansion;
d_produceModels = opts.produceModels;
d_produceAssignments = opts.produceAssignments;
-
}
void SmtEngine::shutdown() {
delete d_decisionEngine;
}
+void SmtEngine::setLogic(const std::string& s) throw(ModalException) {
+ if(d_logic != "") {
+ throw ModalException("logic already set");
+ }
+ d_logic = s;
+}
+
void SmtEngine::setInfo(const std::string& key, const SExpr& value)
- throw(BadOptionException) {
+ throw(BadOptionException, ModalException) {
Debug("smt") << "SMT setInfo(" << key << ", " << value << ")" << endl;
if(key == ":name" ||
key == ":source" ||
}
void SmtEngine::setOption(const std::string& key, const SExpr& value)
- throw(BadOptionException) {
+ throw(BadOptionException, ModalException) {
Debug("smt") << "SMT setOption(" << key << ", " << value << ")" << endl;
+ if(d_logic != "") {
+ throw ModalException("logic already set; cannot set options");
+ }
if(key == ":print-success") {
throw BadOptionException();
} else if(key == ":expand-definitions") {
Assert(e.getExprManager() == d_exprManager);
Type type = e.getType(d_typeChecking);// ensure expr is type-checked at this point
Debug("smt") << "SMT getValue(" << e << ")" << endl;
- /* FIXME - for SMT-LIBv2 compliance, we need to check this ?!
- if(!d_interactive) {
- const char* msg =
- "Cannot get value when not in interactive mode.";
- throw ModalException(msg);
- }
- */
if(!d_produceModels) {
const char* msg =
"Cannot get value when produce-models options is off.";
*/
AssignmentSet* d_assignments;
+ /**
+ * The logic we're in.
+ */
+ std::string d_logic;
+
/**
* Whether or not we have added any
* assertions/declarations/definitions since the last checkSat/query
*/
~SmtEngine();
+ /**
+ * Set the logic of the script.
+ */
+ void setLogic(const std::string& logic) throw(ModalException);
+
/**
* Set information about the script executing.
*/
void setInfo(const std::string& key, const SExpr& value)
- throw(BadOptionException);
+ throw(BadOptionException, ModalException);
/**
* Query information about the SMT environment.
* Set an aspect of the current SMT execution environment.
*/
void setOption(const std::string& key, const SExpr& value)
- throw(BadOptionException);
+ throw(BadOptionException, ModalException);
/**
* Get an aspect of the current SMT execution environment.
break;
case LAZY_TYPE_CHECKING:
+ typeChecking = true;
earlyTypeChecking = false;
break;
#if defined(CVC4_MUZZLED) || defined(CVC4_COMPETITION_MODE)
# define DO_SEMANTIC_CHECKS_BY_DEFAULT false
-#else
+#else /* CVC4_MUZZLED || CVC4_COMPETITION_MODE */
# define DO_SEMANTIC_CHECKS_BY_DEFAULT true
-#endif
+#endif /* CVC4_MUZZLED || CVC4_COMPETITION_MODE */
#include <iostream>
#include <string>
return out;
}
-
-
}/* CVC4 namespace */
#undef USE_EARLY_TYPE_CHECKING_BY_DEFAULT
+#undef DO_SEMANTIC_CHECKS_BY_DEFAULT
#endif /* __CVC4__OPTIONS_H */