auto parsedval = {handler};
{predicates}
{module}.{name} = parsedval;
- {module}.{name}__setByUser__ = true;
+ {module}.{name}__setByUser = true;
Trace("options") << "user assigned option {name}" << std::endl;
}}"""
{{
{predicates}
{module}.{name} = value;
- {module}.{name}__setByUser__ = true;
+ {module}.{name}__setByUser = true;
Trace("options") << "user assigned option {name}" << std::endl;
}}"""
TPL_PUSHBACK_PREEMPT = 'extender->pushBackPreemption({});'
-TPL_HOLDER_MACRO_ATTR = " {type} {name};\\\n"
-TPL_HOLDER_MACRO_ATTR += " bool {name}__setByUser__ = false;"
+TPL_HOLDER_MACRO_ATTR = ''' {type} {name};
+ bool {name}__setByUser = false;'''
-TPL_HOLDER_MACRO_ATTR_DEF = " {type} {name} = {default};\\\n"
-TPL_HOLDER_MACRO_ATTR_DEF += " bool {name}__setByUser__ = false;"
+TPL_HOLDER_MACRO_ATTR_DEF = ''' {type} {name} = {default};
+ bool {name}__setByUser = false;'''
+
+TPL_DECL_SET_DEFAULT = 'void setDefault{funcname}(Options& opts, {type} value);'
+TPL_IMPL_SET_DEFAULT = TPL_DECL_SET_DEFAULT[:-1] + '''
+{{
+ if (!opts.{module}.{name}__setByUser) {{
+ opts.{module}.{name} = value;
+ }}
+}}'''
TPL_NAME_DECL = 'static constexpr const char* {name}__name = "{long_name}";'
return {module}.{name};
}}"""
-
TPL_DECL_WAS_SET_BY_USER = \
"""template <> bool Options::wasSetByUser(options::{name}__option_t) const;"""
TPL_IMPL_WAS_SET_BY_USER = TPL_DECL_WAS_SET_BY_USER[:-1] + \
"""
{{
- return {module}.{name}__setByUser__;
+ return {module}.{name}__setByUser;
}}"""
# Option specific methods
decls = []
specs = []
inls = []
+ default_decl = []
+ default_impl = []
mode_decl = []
mode_impl = []
decls.append(tpl_decl.format(name=option.name, type=option.type, long_name = long_name))
option_names.append(TPL_NAME_DECL.format(name=option.name, type=option.type, long_name = long_name))
+ capoptionname = option.name[0].capitalize() + option.name[1:]
+
# Generate module specialization
+ default_decl.append(TPL_DECL_SET_DEFAULT.format(module=module.id, name=option.name, funcname=capoptionname, type=option.type))
specs.append(TPL_DECL_SET.format(name=option.name))
specs.append(TPL_DECL_OP_BRACKET.format(name=option.name))
specs.append(TPL_DECL_WAS_SET_BY_USER.format(name=option.name))
### Generate code for {module.name}_options.cpp
# Accessors
+ default_impl.append(TPL_IMPL_SET_DEFAULT.format(module=module.id, name=option.name, funcname=capoptionname, type=option.type))
accs.append(TPL_IMPL_SET.format(module=module.id, name=option.name))
accs.append(TPL_IMPL_OP_BRACKET.format(module=module.id, name=option.name))
accs.append(TPL_IMPL_WAS_SET_BY_USER.format(module=module.id, name=option.name))
specs='\n'.join(specs),
option_names='\n'.join(option_names),
inls='\n'.join(inls),
+ defaults='\n'.join(default_decl),
modes=''.join(mode_decl)))
write_file(dst_dir, '{}.cpp'.format(filename), tpl_module_cpp.format(
header=module.header,
+ id=module.id,
accs='\n'.join(accs),
+ defaults='\n'.join(default_impl),
defs='\n'.join(defs),
modes=''.join(mode_impl)))
if option.mode and option.type not in default:
default = '{}::{}'.format(option.type, default)
defaults.append('{}({})'.format(option.name, default))
- defaults.append('{}__setByUser__(false)'.format(option.name))
+ defaults.append('{}__setByUser(false)'.format(option.name))
write_file(dst_dir, 'options.h', tpl_options_h.format(
holder_fwd_decls=get_holder_fwd_decls(modules),
{
throwLazyBBUnsupported(m);
}
- Options::current().setDefault(options::bitvectorToBool, true);
+ options::bv::setDefaultBitvectorToBool(*d_options, true);
}
}
{
if (m == options::BitblastMode::LAZY)
{
- Options::current().setDefault(options::bitvectorPropagate, true);
- Options::current().setDefault(options::bitvectorEqualitySolver, true);
- Options::current().setDefault(options::bitvectorInequalitySolver, true);
- Options::current().setDefault(options::bitvectorAlgebraicSolver, true);
+ options::bv::setDefaultBitvectorPropagate(*d_options, true);
+ options::bv::setDefaultBitvectorEqualitySolver(*d_options, true);
+ options::bv::setDefaultBitvectorInequalitySolver(*d_options, true);
+ options::bv::setDefaultBitvectorAlgebraicSolver(*d_options, true);
if (options::bvSatSolver() != options::SatSolverMode::MINISAT)
{
throwLazyBBUnsupported(options::bvSatSolver());
}
else if (m == BitblastMode::EAGER)
{
- Options::current().setDefault(options::bitvectorToBool, true);
+ options::bv::setDefaultBitvectorToBool(*d_options, true);
}
}