This PR adds the possibility to make option modules public. As shown on the example of the main driver options, this allows to get rid of the wrappers from options_public.h. We plan to make only very few option modules public (i.e. main and parser).
#include "main/time_limit.h"
#include "options/options.h"
#include "options/options_public.h"
+#include "options/main_options.h"
#include "options/set_language.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
string progNameStr = options::getBinaryName(opts);
progName = &progNameStr;
- if (options::getHelp(opts))
+ if (opts.driver.help)
{
printUsage(opts, true);
exit(1);
Options::printLanguageHelp(*(options::getOut(opts)));
exit(1);
}
- else if (options::getVersion(opts))
+ else if (opts.driver.version)
{
*(options::getOut(opts)) << Configuration::about().c_str() << flush;
exit(0);
}
- segvSpin = options::getSegvSpin(opts);
+ segvSpin = opts.driver.segvSpin;
// If in competition mode, set output stream option to flush immediately
#ifdef CVC5_COMPETITION_MODE
// if we're reading from stdin on a TTY, default to interactive mode
if (!options::wasSetByUserInteractive(opts))
{
- options::setInteractive(inputFromStdin && isatty(fileno(stdin)), opts);
+ opts.driver.interactive = inputFromStdin && isatty(fileno(stdin));
}
// Auto-detect input language by filename extension
// Parse and execute commands until we are done
std::unique_ptr<Command> cmd;
bool status = true;
- if (options::getInteractive(opts) && inputFromStdin)
+ if (opts.driver.interactive && inputFromStdin)
{
- if (options::getTearDownIncremental(opts) > 0)
+ if (opts.driver.tearDownIncremental > 0)
{
throw Exception(
"--tear-down-incremental doesn't work in interactive mode");
}
InteractiveShell shell(pExecutor->getSolver(),
pExecutor->getSymbolManager());
- if (options::getInteractivePrompt(opts))
+ if (opts.driver.interactivePrompt)
{
CVC5Message() << Configuration::getPackageName() << " "
<< Configuration::getVersionString();
}
}
}
- else if (options::getTearDownIncremental(opts) > 0)
+ else if (opts.driver.tearDownIncremental > 0)
{
if (!options::getIncrementalSolving(opts)
- && options::getTearDownIncremental(opts) > 1)
+ && opts.driver.tearDownIncremental > 1)
{
// For tear-down-incremental values greater than 1, need incremental
// on too.
}
if(dynamic_cast<PushCommand*>(cmd.get()) != nullptr) {
- if (needReset >= options::getTearDownIncremental(opts))
+ if (needReset >= opts.driver.tearDownIncremental)
{
pExecutor->reset();
for(size_t i = 0; i < allCommands.size() && !interrupted; ++i) {
}
} else if(dynamic_cast<PopCommand*>(cmd.get()) != nullptr) {
allCommands.pop_back(); // fixme leaks cmds here
- if (needReset >= options::getTearDownIncremental(opts))
+ if (needReset >= opts.driver.tearDownIncremental)
{
pExecutor->reset();
for(size_t i = 0; i < allCommands.size() && !interrupted; ++i) {
}
} else if(dynamic_cast<CheckSatCommand*>(cmd.get()) != nullptr ||
dynamic_cast<QueryCommand*>(cmd.get()) != nullptr) {
- if (needReset >= options::getTearDownIncremental(opts))
+ if (needReset >= opts.driver.tearDownIncremental)
{
pExecutor->reset();
for(size_t i = 0; i < allCommands.size() && !interrupted; ++i) {
pExecutor->flushOutputStreams();
#ifdef CVC5_DEBUG
- if (options::getEarlyExit(opts) && options::wasSetByUserEarlyExit(opts))
+ if (opts.driver.earlyExit && options::wasSetByUserEarlyExit(opts))
{
_exit(returnValue);
}
#else /* CVC5_DEBUG */
- if (options::getEarlyExit(opts))
+ if (opts.driver.earlyExit)
{
_exit(returnValue);
}
#include "base/output.h"
#include "expr/symbol_manager.h"
#include "options/language.h"
+#include "options/main_options.h"
#include "options/options.h"
#include "options/options_public.h"
#include "parser/input.h"
if (d_usingEditline)
{
#if HAVE_LIBEDITLINE
- lineBuf = ::readline(options::getInteractivePrompt(d_options)
+ lineBuf = ::readline(d_options.driver.interactivePrompt
? (line == "" ? "cvc5> " : "... > ")
: "");
if(lineBuf != NULL && lineBuf[0] != '\0') {
}
else
{
- if (options::getInteractivePrompt(d_options))
+ if (d_options.driver.interactivePrompt)
{
if(line == "") {
d_out << "cvc5> " << flush;
if (d_usingEditline)
{
#if HAVE_LIBEDITLINE
- lineBuf = ::readline(options::getInteractivePrompt(d_options) ? "... > "
+ lineBuf = ::readline(d_options.driver.interactivePrompt ? "... > "
: "");
if(lineBuf != NULL && lineBuf[0] != '\0') {
::add_history(lineBuf);
}
else
{
- if (options::getInteractivePrompt(d_options))
+ if (d_options.driver.interactivePrompt)
{
d_out << "... > " << flush;
}
id = "DRIVER"
name = "Driver"
+public = true
[[option]]
name = "version"
### Allowed attributes for module/option
MODULE_ATTR_REQ = ['id', 'name']
-MODULE_ATTR_ALL = MODULE_ATTR_REQ + ['option']
+MODULE_ATTR_ALL = MODULE_ATTR_REQ + ['option', 'public']
OPTION_ATTR_REQ = ['category', 'type']
OPTION_ATTR_ALL = OPTION_ATTR_REQ + [
help=help_mode_format(option),
long=option.long.split('=')[0]))
+ if module.public:
+ visibility_include = '#include "cvc5_public.h"'
+ else:
+ visibility_include = '#include "cvc5_private.h"'
+
filename = os.path.splitext(os.path.split(module.header)[1])[0]
write_file(dst_dir, '{}.h'.format(filename), tpl_module_h.format(
- filename=filename,
- header=module.header,
+ visibility_include=visibility_include,
id_cap=module.id_cap,
id=module.id,
includes='\n'.join(sorted(list(includes))),
* expands this template and generates a <module>_options.h file.
*/
-#include "cvc5_private.h"
+${visibility_include}$
#ifndef CVC5__OPTIONS__${id_cap}$_H
#define CVC5__OPTIONS__${id_cap}$_H
{
return opts.smt.dumpUnsatCores || opts.smt.dumpUnsatCoresFull;
}
-bool getEarlyExit(const Options& opts) { return opts.driver.earlyExit; }
bool getFilesystemAccess(const Options& opts)
{
return opts.parser.filesystemAccess;
{
return opts.smt.forceNoLimitCpuWhileDump;
}
-bool getHelp(const Options& opts) { return opts.driver.help; }
bool getIncrementalSolving(const Options& opts)
{
return opts.smt.incrementalSolving;
}
-bool getInteractive(const Options& opts) { return opts.driver.interactive; }
-bool getInteractivePrompt(const Options& opts)
-{
- return opts.driver.interactivePrompt;
-}
bool getLanguageHelp(const Options& opts) { return opts.base.languageHelp; }
bool getMemoryMap(const Options& opts) { return opts.parser.memoryMap; }
bool getParseOnly(const Options& opts) { return opts.base.parseOnly; }
bool getProduceModels(const Options& opts) { return opts.smt.produceModels; }
-bool getSegvSpin(const Options& opts) { return opts.driver.segvSpin; }
bool getSemanticChecks(const Options& opts)
{
return opts.parser.semanticChecks;
{
return opts.parser.strictParsing;
}
-int32_t getTearDownIncremental(const Options& opts)
-{
- return opts.driver.tearDownIncremental;
-}
uint64_t getCumulativeTimeLimit(const Options& opts)
{
return opts.resman.cumulativeMillisecondLimit;
}
-bool getVersion(const Options& opts) { return opts.driver.version; }
const std::string& getForceLogicString(const Options& opts)
{
return opts.parser.forceLogicString;
{
opts.base.inputLanguage = val;
}
-void setInteractive(bool val, Options& opts)
-{
- opts.driver.interactive = val;
-}
void setOut(std::ostream* val, Options& opts) { opts.base.out = val; }
void setOutputLanguage(OutputLanguage val, Options& opts)
{
bool getDumpModels(const Options& opts) CVC5_EXPORT;
bool getDumpProofs(const Options& opts) CVC5_EXPORT;
bool getDumpUnsatCores(const Options& opts) CVC5_EXPORT;
-bool getEarlyExit(const Options& opts) CVC5_EXPORT;
bool getFilesystemAccess(const Options& opts) CVC5_EXPORT;
bool getForceNoLimitCpuWhileDump(const Options& opts) CVC5_EXPORT;
-bool getHelp(const Options& opts) CVC5_EXPORT;
bool getIncrementalSolving(const Options& opts) CVC5_EXPORT;
-bool getInteractive(const Options& opts) CVC5_EXPORT;
-bool getInteractivePrompt(const Options& opts) CVC5_EXPORT;
bool getLanguageHelp(const Options& opts) CVC5_EXPORT;
bool getMemoryMap(const Options& opts) CVC5_EXPORT;
bool getParseOnly(const Options& opts) CVC5_EXPORT;
bool getProduceModels(const Options& opts) CVC5_EXPORT;
-bool getSegvSpin(const Options& opts) CVC5_EXPORT;
bool getSemanticChecks(const Options& opts) CVC5_EXPORT;
bool getStatistics(const Options& opts) CVC5_EXPORT;
bool getStatsEveryQuery(const Options& opts) CVC5_EXPORT;
bool getStrictParsing(const Options& opts) CVC5_EXPORT;
-int32_t getTearDownIncremental(const Options& opts) CVC5_EXPORT;
uint64_t getCumulativeTimeLimit(const Options& opts) CVC5_EXPORT;
-bool getVersion(const Options& opts) CVC5_EXPORT;
const std::string& getForceLogicString(const Options& opts) CVC5_EXPORT;
int32_t getVerbosity(const Options& opts) CVC5_EXPORT;
const std::string& getBinaryName(const Options& opts) CVC5_EXPORT;
void setInputLanguage(InputLanguage val, Options& opts) CVC5_EXPORT;
-void setInteractive(bool val, Options& opts) CVC5_EXPORT;
void setOut(std::ostream* val, Options& opts) CVC5_EXPORT;
void setOutputLanguage(OutputLanguage val, Options& opts) CVC5_EXPORT;