mirror of
https://github.com/Z3Prover/z3
synced 2025-04-22 16:45:31 +00:00
added Z3_global_param_reset_all API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
7d24cd4ae3
commit
92a29b1e43
7 changed files with 56 additions and 71 deletions
|
@ -43,6 +43,13 @@ extern "C" {
|
|||
}
|
||||
}
|
||||
|
||||
void Z3_API Z3_global_param_reset_all() {
|
||||
memory::initialize(UINT_MAX);
|
||||
LOG_Z3_global_param_reset_all();
|
||||
gparams::reset();
|
||||
env_params::updt_params();
|
||||
}
|
||||
|
||||
std::string g_Z3_global_param_get_buffer;
|
||||
|
||||
Z3_bool_opt Z3_API Z3_global_param_get(Z3_string param_id, Z3_string_ptr param_value) {
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace z3 {
|
|||
inline void set_param(char const * param, char const * value) { Z3_global_param_set(param, value); }
|
||||
inline void set_param(char const * param, bool value) { Z3_global_param_set(param, value ? "true" : "false"); }
|
||||
inline void set_param(char const * param, int value) { std::ostringstream oss; oss << value; Z3_global_param_set(param, oss.str().c_str()); }
|
||||
inline void reset_params() { Z3_global_param_reset_all(); }
|
||||
|
||||
/**
|
||||
\brief Exception used to sign API usage errors.
|
||||
|
|
|
@ -219,6 +219,11 @@ def set_param(*args, **kws):
|
|||
Z3_global_param_set(str(prev), _to_param_value(a))
|
||||
prev = None
|
||||
|
||||
def reset_params():
|
||||
"""Reset all global (or module) parameters.
|
||||
"""
|
||||
Z3_global_param_reset_all()
|
||||
|
||||
def set_option(*args, **kws):
|
||||
"""Alias for 'set_param' for backward compatibility.
|
||||
"""
|
||||
|
|
|
@ -1260,6 +1260,17 @@ extern "C" {
|
|||
def_API('Z3_global_param_set', VOID, (_in(STRING), _in(STRING)))
|
||||
*/
|
||||
void Z3_API Z3_global_param_set(__in Z3_string param_id, __in Z3_string param_value);
|
||||
|
||||
|
||||
/**
|
||||
\brief Restore the value of all global (and module) parameters.
|
||||
This command will not affect already created objects (such as tactics and solvers).
|
||||
|
||||
\sa Z3_global_param_set
|
||||
|
||||
def_API('Z3_global_param_reset_all', VOID, ())
|
||||
*/
|
||||
void Z3_API Z3_global_param_reset_all();
|
||||
|
||||
/**
|
||||
\brief Get a global (or module) parameter.
|
||||
|
|
|
@ -60,20 +60,22 @@ public:
|
|||
}
|
||||
|
||||
~imp() {
|
||||
{
|
||||
dictionary<param_descrs*>::iterator it = m_module_param_descrs.begin();
|
||||
dictionary<param_descrs*>::iterator end = m_module_param_descrs.end();
|
||||
for (; it != end; ++it) {
|
||||
dealloc(it->m_value);
|
||||
}
|
||||
reset();
|
||||
dictionary<param_descrs*>::iterator it = m_module_param_descrs.begin();
|
||||
dictionary<param_descrs*>::iterator end = m_module_param_descrs.end();
|
||||
for (; it != end; ++it) {
|
||||
dealloc(it->m_value);
|
||||
}
|
||||
{
|
||||
dictionary<params_ref*>::iterator it = m_module_params.begin();
|
||||
dictionary<params_ref*>::iterator end = m_module_params.end();
|
||||
for (; it != end; ++it) {
|
||||
dealloc(it->m_value);
|
||||
}
|
||||
}
|
||||
|
||||
void reset() {
|
||||
m_params.reset();
|
||||
dictionary<params_ref*>::iterator it = m_module_params.begin();
|
||||
dictionary<params_ref*>::iterator end = m_module_params.end();
|
||||
for (; it != end; ++it) {
|
||||
dealloc(it->m_value);
|
||||
}
|
||||
m_module_params.reset();
|
||||
}
|
||||
|
||||
// -----------------------------------------------
|
||||
|
@ -448,6 +450,11 @@ public:
|
|||
|
||||
gparams::imp * gparams::g_imp = 0;
|
||||
|
||||
void gparams::reset() {
|
||||
SASSERT(g_imp != 0);
|
||||
g_imp->reset();
|
||||
}
|
||||
|
||||
void gparams::set(char const * name, char const * value) {
|
||||
TRACE("gparams", tout << "setting [" << name << "] <- '" << value << "'\n";);
|
||||
SASSERT(g_imp != 0);
|
||||
|
|
|
@ -27,6 +27,11 @@ class gparams {
|
|||
public:
|
||||
typedef default_exception exception;
|
||||
|
||||
/**
|
||||
\brief Reset all global and module parameters.
|
||||
*/
|
||||
static void reset();
|
||||
|
||||
/**
|
||||
\brief Set a global parameter \c name with \c value.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue