return res
-def get_getall(module, option):
- """Render snippet to add option to result of getAll()"""
- if option.type == 'bool':
- return 'res.push_back({{"{}", opts.{}.{} ? "true" : "false"}});'.format(
- option.long_name, module.id, option.name)
- elif option.type == 'std::string':
- return 'res.push_back({{"{}", opts.{}.{}}});'.format(
- option.long_name, module.id, option.name)
- elif is_numeric_cpp_type(option.type):
- return 'res.push_back({{"{}", std::to_string(opts.{}.{})}});'.format(
- option.long_name, module.id, option.name)
- else:
- return '{{ std::stringstream ss; ss << opts.{}.{}; res.push_back({{"{}", ss.str()}}); }}'.format(module.id,
- option.name, option.long_name)
-
-
class Module(object):
"""Options module.
headers_handler = set() # option includes (for handlers, predicates, ...)
getopt_short = [] # short options for getopt_long
getopt_long = [] # long options for getopt_long
- options_getall = [] # options for options::getAll()
options_get_info = [] # code for getOptionInfo()
options_handler = [] # option handler calls
options_names = set() # option names
cases.append(' break;')
options_handler.extend(cases)
- if option.name:
- # Build options for options::getOptions()
- if option.long_name:
- options_getall.append(get_getall(module, option))
-
options_all_names = ', '.join(map(lambda s: '"' + s + '"', sorted(options_names)))
options_all_names = '\n'.join(textwrap.wrap(options_all_names, width=80, break_on_hyphens=False))
'help_others': '\n'.join(help_others),
'options_handler': '\n '.join(options_handler),
'options_short': ''.join(getopt_short),
- 'options_getall': '\n '.join(options_getall),
'options_all_names': options_all_names,
'options_get_info': '\n '.join(sorted(options_get_info)),
'getoption_handlers': '\n'.join(getoption_handlers),
* directory for licensing information.
* ****************************************************************************
*
- * Global (command-line, set-option, ...) parameters for SMT.
+ * Implements a basic options API intended to be used by the external API:
+ * - list option names (`getNames()`)
+ * - get option value by name (`get()`)
+ * - set option value by name (`set()`)
+ * - get more detailed option information (`getInfo()`)
*/
#include "cvc5_public.h"
const std::string& name,
const std::string& optionarg) CVC5_EXPORT;
-/**
- * Get the setting for all options.
- */
-std::vector<std::vector<std::string> > getAll(const Options& opts) CVC5_EXPORT;
-
/**
* Get a (sorted) list of all option names that are available.
*/
}
Assert(key == "all-options");
// get the options, like all-statistics
- return toSExpr(options::getAll(getOptions()));
+ std::vector<std::vector<std::string>> res;
+ for (const auto& opt: options::getNames())
+ {
+ res.emplace_back(std::vector<std::string>{opt, options::get(getOptions(), opt)});
+ }
+ return toSExpr(res);
}
void SmtEngine::debugCheckFormals(const std::vector<Node>& formals, Node func)