mirror of
https://github.com/Z3Prover/z3
synced 2025-08-17 00:32:16 +00:00
saved params work
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
c3055207ed
commit
cf28cbab0a
130 changed files with 1469 additions and 948 deletions
122
src/util/gparams.h
Normal file
122
src/util/gparams.h
Normal file
|
@ -0,0 +1,122 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
gparams.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Global parameter management.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2012-11-29
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef _GPARAMS_H_
|
||||
#define _GPARAMS_H_
|
||||
|
||||
#include"params.h"
|
||||
|
||||
class gparams {
|
||||
struct imp;
|
||||
static imp * g_imp;
|
||||
typedef z3_exception exception;
|
||||
public:
|
||||
/**
|
||||
\brief Set a global parameter \c name with \c value.
|
||||
|
||||
The name of parameter can be composed of characters [a-z][A-Z], digits [0-9], '-' and '_'.
|
||||
The character '.' is used a delimiter (more later).
|
||||
|
||||
The parameter names are case-insensitive. The character '-' should be viewed as an "alias" for '_'.
|
||||
Thus, the following parameter names are considered equivalent: "auto-config" and "AUTO_CONFIG".
|
||||
|
||||
This function can be used to set parameters for a specific Z3 module.
|
||||
This can be done by using <module-name>.<parameter-name>.
|
||||
For example:
|
||||
set_global_param('pp.decimal', 'true')
|
||||
will set the parameter "decimal" in the module "pp" to true.
|
||||
|
||||
An exception is thrown if the the parameter name is unknown, or if the value is incorrect.
|
||||
*/
|
||||
static void set(char const * name, char const * value);
|
||||
|
||||
/**
|
||||
\brief Auxiliary method used to implement get-option in SMT 2.0 front-end.
|
||||
|
||||
If the parameter is not set, then it just returns 'default'.
|
||||
|
||||
An exception is thrown if the the parameter name is unknown.
|
||||
*/
|
||||
static std::string get_value(char const * name);
|
||||
|
||||
/**
|
||||
\brief Register additional global parameters
|
||||
|
||||
This is an auxiliary function used by our automatic code generator.
|
||||
Example: the directive REG_PARAMS('collect_param_descrs')
|
||||
"tells" the automatic code generator how to register the additional global parameters.
|
||||
*/
|
||||
static void register_global(param_descrs & d);
|
||||
|
||||
/**
|
||||
\brief Register parameter descriptions for a Z3 module.
|
||||
The parameters of a given Z3 module can only be set using #set_global_param if
|
||||
they are registered in this module using this function.
|
||||
|
||||
This is an auxiliary function used by our automatic code generator.
|
||||
Each module will contain directives (in comments) such as
|
||||
Example: the directive REG_MODULE_PARAMS('nlsat', 'nlsat::solver::collect_param_descrs')
|
||||
"tells" the automatic code generator how to register the parameters for the given
|
||||
module.
|
||||
*/
|
||||
static void register_module(char const * module_name, param_descrs * d);
|
||||
|
||||
/**
|
||||
\brief Retrieves the parameters associated with the given module.
|
||||
|
||||
Example:
|
||||
// The following command sets the parameter "decimal" in the module "pp" to true.
|
||||
set_global_param("pp.decimal", "true");
|
||||
...
|
||||
// The following command will return the global parameters that were set for the module "pp".
|
||||
// In this example "p" will contain "decimal" -> true after executing this function.
|
||||
params_ref const & p = get_module_params("pp")
|
||||
*/
|
||||
static params_ref const & get_module(char const * module_name);
|
||||
static params_ref const & get_module(symbol const & module_name);
|
||||
|
||||
/**
|
||||
\brief Return the global parameter set (i.e., parameters that are not associated with any particular module).
|
||||
*/
|
||||
static params_ref const & get();
|
||||
|
||||
/**
|
||||
\brief Dump information about available parameters in the given output stream.
|
||||
*/
|
||||
static void display(std::ostream & out, unsigned indent = 0, bool smt2_style=false);
|
||||
|
||||
/**
|
||||
\brief Initialize the global parameter management module.
|
||||
|
||||
Remark: I set a priority in the initialization, because this module must be initialized
|
||||
after the core modules such as symbol.
|
||||
ADD_INITIALIZER('gparams::init();', 1)
|
||||
*/
|
||||
static void init();
|
||||
|
||||
/**
|
||||
\brief Finalize the global parameter management module.
|
||||
|
||||
ADD_FINALIZER('gparams::finalize();');
|
||||
*/
|
||||
static void finalize();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue