This PR simplifies how we store the current input file name and handle setting and getting it.
It is now an option, that can also be set and get via setInfo() and getInfo().
int returnValue = 0;
{
// notify SmtEngine that we are starting to parse
- pExecutor->getSmtEngine()->notifyStartParsing(filenameStr);
+ pExecutor->getSmtEngine()->setInfo("filename", filenameStr);
// Parse and execute commands until we are done
std::unique_ptr<Command> cmd;
type = "bool"
help = "force interactive shell/non-interactive mode"
+[[option]]
+ name = "filename"
+ category = "undocumented"
+ long = "filename=FILENAME"
+ type = "std::string"
+ help = "filename of the input"
+
[[option]]
name = "segvSpin"
category = "regular"
d_topLevelSubs->setProofNodeManager(pnm);
}
-void Env::setFilename(const std::string& filename) { d_filename = filename; }
-
void Env::shutdown()
{
d_rewriter.reset(nullptr);
ProofNodeManager* Env::getProofNodeManager() { return d_proofNodeManager; }
-const std::string& Env::getFilename() const { return d_filename; }
-
bool Env::isSatProofProducing() const
{
return d_proofNodeManager != nullptr
*/
ProofNodeManager* getProofNodeManager();
- /** Return the input name, or the empty string if not set */
- const std::string& getFilename() const;
-
/**
* Check whether the SAT solver should produce proofs. Other than whether
* the proof node manager is set, SAT proofs are only generated when the
/** Set proof node manager if it exists */
void setProofNodeManager(ProofNodeManager* pnm);
- /**
- * Set that the file name of the current instance is the given string. This
- * is used for various purposes (e.g. get-info, SZS status).
- */
- void setFilename(const std::string& filename);
/* Private shutdown ------------------------------------------------------- */
/**
const Options* d_originalOptions;
/** Manager for limiting time and abstract resource usage. */
std::unique_ptr<ResourceManager> d_resourceManager;
-
- /**
- * The input file name or the name set through (set-info :filename ...), if
- * any.
- */
- std::string d_filename;
}; /* class Env */
} // namespace cvc5
#include "smt/proof_manager.h"
#include "options/base_options.h"
+#include "options/main_options.h"
#include "options/proof_options.h"
#include "options/smt_options.h"
#include "proof/dot/dot_printer.h"
}
else if (options::proofFormatMode() == options::ProofFormatMode::TPTP)
{
- out << "% SZS output start Proof for " << d_env.getFilename() << std::endl;
+ out << "% SZS output start Proof for " << d_env.getOptions().driver.filename << std::endl;
// TODO (proj #37) print in TPTP compliant format
out << *fp << std::endl;
- out << "% SZS output end Proof for " << d_env.getFilename() << std::endl;
+ out << "% SZS output end Proof for " << d_env.getOptions().driver.filename << std::endl;
}
else
{
return res;
}
-void SmtEngine::notifyStartParsing(const std::string& filename)
-{
- d_env->setFilename(filename);
- d_env->getStatisticsRegistry().registerValue<std::string>("driver::filename",
- filename);
- // Copy the original options. This is called prior to beginning parsing.
- // Hence reset should revert to these options, which note is after reading
- // the command line.
-}
-
-const std::string& SmtEngine::getFilename() const
-{
- return d_env->getFilename();
-}
-
-void SmtEngine::setResultStatistic(const std::string& result) {
- d_env->getStatisticsRegistry().registerValue<std::string>("driver::sat/unsat",
- result);
-}
void SmtEngine::setTotalTimeStatistic(double seconds) {
d_env->getStatisticsRegistry().registerValue<double>("driver::totalTime",
seconds);
if (key == "filename")
{
- d_env->setFilename(value);
+ d_env->d_options.driver.filename = value;
+ d_env->d_originalOptions->driver.filename = value;
+ d_env->getStatisticsRegistry().registerValue<std::string>(
+ "driver::filename", value);
}
else if (key == "smt-lib-version" && !getOptions().base.inputLanguageWasSetByUser)
{
{
return "immediate-exit";
}
+ if (key == "filename")
+ {
+ return d_env->getOptions().driver.filename;
+ }
if (key == "name")
{
return toSExpr(Configuration::getName());
Result SmtEngine::quickCheck() {
Assert(d_state->isFullyInited());
Trace("smt") << "SMT quickCheck()" << endl;
- const std::string& filename = d_env->getFilename();
+ const std::string& filename = d_env->getOptions().driver.filename;
return Result(
Result::ENTAILMENT_UNKNOWN, Result::REQUIRES_FULL_CHECK, filename);
}
{
printStatisticsDiff();
}
- return Result(Result::SAT_UNKNOWN, why, d_env->getFilename());
+ return Result(Result::SAT_UNKNOWN, why, d_env->getOptions().driver.filename);
}
}
}
// set the information on the SMT-level model
Assert(m != nullptr);
- m->d_inputName = d_env->getFilename();
+ m->d_inputName = d_env->getOptions().driver.filename;
m->d_isKnownSat = (d_state->getMode() == SmtMode::SAT);
return m;
}
/** Is this an internal subsolver? */
bool isInternalSubsolver() const;
- /**
- * Notify that we are now parsing the input with the given filename.
- * This call sets the filename maintained by this SmtEngine for bookkeeping
- * and also makes a copy of the current options of this SmtEngine. This
- * is required so that the SMT-LIB command (reset) returns the SmtEngine
- * to a state where its options were prior to parsing but after e.g.
- * reading command line options.
- */
- void notifyStartParsing(const std::string& filename) CVC5_EXPORT;
- /** return the input name (if any) */
- const std::string& getFilename() const;
-
- /**
- * Helper method for the API to put the last check result into the statistics.
- */
- void setResultStatistic(const std::string& result) CVC5_EXPORT;
/**
* Helper method for the API to put the total runtime into the statistics.
*/
#include "base/modal_exception.h"
#include "options/base_options.h"
+#include "options/main_options.h"
#include "options/option_exception.h"
#include "options/smt_options.h"
#include "smt/env.h"
Assert(status == "sat" || status == "unsat" || status == "unknown")
<< "SmtEngineState::notifyExpectedStatus: unexpected status string "
<< status;
- d_expectedStatus = Result(status, d_env.getFilename());
+ d_expectedStatus = Result(status, d_env.getOptions().driver.filename);
}
void SmtEngineState::notifyResetAssertions()
#include "smt/smt_solver.h"
+#include "options/main_options.h"
#include "options/smt_options.h"
#include "prop/prop_engine.h"
#include "smt/assertions.h"
Trace("smt") << "SmtSolver::check()" << endl;
- const std::string& filename = d_env.getFilename();
+ const std::string& filename = d_env.getOptions().driver.filename;
ResourceManager* rm = d_env.getResourceManager();
if (rm->out())
{
reg.registerHistogram<api::Kind>("api::TERM", false);
reg.registerValue<std::string>("driver::filename", false);
- reg.registerValue<std::string>("driver::sat/unsat", false);
reg.registerValue<double>("driver::totalTime", false);
for (theory::TheoryId id = theory::THEORY_FIRST; id != theory::THEORY_LAST;