mirror of
https://github.com/Z3Prover/z3
synced 2025-05-05 06:45:45 +00:00
make front_end_params an optional argument in cmd_context
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
bef9390142
commit
c2e95bb0c5
7 changed files with 26 additions and 19 deletions
|
@ -300,12 +300,13 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
cmd_context::cmd_context(front_end_params & params, bool main_ctx, ast_manager * m, symbol const & l):
|
||||
cmd_context::cmd_context(front_end_params * params, bool main_ctx, ast_manager * m, symbol const & l):
|
||||
m_main_ctx(main_ctx),
|
||||
m_params(params),
|
||||
m_params(params == 0 ? alloc(front_end_params) : params),
|
||||
m_params_owner(params == 0),
|
||||
m_logic(l),
|
||||
m_interactive_mode(false),
|
||||
m_global_decls(!params.m_smtlib2_compliant), // SMTLIB 2.0 uses scoped decls.
|
||||
m_global_decls(!this->params().m_smtlib2_compliant), // SMTLIB 2.0 uses scoped decls.
|
||||
m_print_success(false), // params.m_smtlib2_compliant),
|
||||
m_random_seed(0),
|
||||
m_produce_unsat_cores(false),
|
||||
|
@ -340,6 +341,11 @@ cmd_context::~cmd_context() {
|
|||
finalize_cmds();
|
||||
finalize_tactic_cmds();
|
||||
finalize_probes();
|
||||
m_solver = 0;
|
||||
m_check_sat_result = 0;
|
||||
if (m_params_owner) {
|
||||
dealloc(m_params);
|
||||
}
|
||||
}
|
||||
|
||||
cmd_context::check_sat_state cmd_context::cs_state() const {
|
||||
|
@ -531,10 +537,10 @@ void cmd_context::init_manager() {
|
|||
SASSERT(m_manager == 0);
|
||||
SASSERT(m_pmanager == 0);
|
||||
m_check_sat_result = 0;
|
||||
m_manager = alloc(ast_manager, m_params.m_proof_mode, m_params.m_trace_stream);
|
||||
m_manager = alloc(ast_manager, params().m_proof_mode, params().m_trace_stream);
|
||||
m_pmanager = alloc(pdecl_manager, *m_manager);
|
||||
init_manager_core(true);
|
||||
if (m_params.m_smtlib2_compliant)
|
||||
if (params().m_smtlib2_compliant)
|
||||
m_manager->enable_int_real_coercions(false);
|
||||
}
|
||||
|
||||
|
@ -1240,7 +1246,7 @@ void cmd_context::check_sat(unsigned num_assumptions, expr * const * assumptions
|
|||
init_manager();
|
||||
if (m_solver) {
|
||||
m_check_sat_result = m_solver.get(); // solver itself stores the result.
|
||||
m_solver->set_front_end_params(m_params);
|
||||
m_solver->set_front_end_params(params());
|
||||
m_solver->set_progress_callback(this);
|
||||
m_solver->set_produce_proofs(produce_proofs());
|
||||
m_solver->set_produce_models(produce_models());
|
||||
|
@ -1390,7 +1396,7 @@ void cmd_context::validate_model() {
|
|||
void cmd_context::set_solver(solver * s) {
|
||||
m_check_sat_result = 0;
|
||||
m_solver = s;
|
||||
m_solver->set_front_end_params(m_params);
|
||||
m_solver->set_front_end_params(params());
|
||||
if (has_manager() && s != 0) {
|
||||
m_solver->init(m(), m_logic);
|
||||
// assert formulas and create scopes in the new solver.
|
||||
|
|
|
@ -133,7 +133,8 @@ public:
|
|||
|
||||
protected:
|
||||
bool m_main_ctx;
|
||||
front_end_params & m_params;
|
||||
front_end_params * m_params;
|
||||
bool m_params_owner;
|
||||
symbol m_logic;
|
||||
bool m_interactive_mode;
|
||||
bool m_global_decls;
|
||||
|
@ -246,9 +247,9 @@ protected:
|
|||
void print_unsupported_info(symbol const& s) { if (s != symbol::null) diagnostic_stream() << "; " << s << std::endl;}
|
||||
|
||||
public:
|
||||
cmd_context(front_end_params & params, bool main_ctx = true, ast_manager * m = 0, symbol const & l = symbol::null);
|
||||
cmd_context(front_end_params * params = 0, bool main_ctx = true, ast_manager * m = 0, symbol const & l = symbol::null);
|
||||
~cmd_context();
|
||||
bool is_smtlib2_compliant() const { return m_params.m_smtlib2_compliant; }
|
||||
bool is_smtlib2_compliant() const { return params().m_smtlib2_compliant; }
|
||||
void set_logic(symbol const & s);
|
||||
bool has_logic() const { return m_logic != symbol::null; }
|
||||
symbol const & get_logic() const { return m_logic; }
|
||||
|
@ -268,8 +269,8 @@ public:
|
|||
void set_global_decls(bool flag) { SASSERT(!has_manager()); m_global_decls = flag; }
|
||||
unsigned random_seed() const { return m_random_seed; }
|
||||
void set_random_seed(unsigned s) { m_random_seed = s; }
|
||||
bool produce_models() const { return m_params.m_model; }
|
||||
bool produce_proofs() const { return m_params.m_proof_mode != PGM_DISABLED; }
|
||||
bool produce_models() const { return params().m_model; }
|
||||
bool produce_proofs() const { return params().m_proof_mode != PGM_DISABLED; }
|
||||
bool produce_unsat_cores() const { return m_produce_unsat_cores; }
|
||||
void set_produce_unsat_cores(bool flag) { m_produce_unsat_cores = flag; }
|
||||
bool produce_assignments() const { return m_produce_assignments; }
|
||||
|
@ -283,7 +284,7 @@ public:
|
|||
virtual ast_manager & get_ast_manager() { return m(); }
|
||||
pdecl_manager & pm() const { if (!m_pmanager) const_cast<cmd_context*>(this)->init_manager(); return *m_pmanager; }
|
||||
sexpr_manager & sm() const { if (!m_sexpr_manager) const_cast<cmd_context*>(this)->m_sexpr_manager = alloc(sexpr_manager); return *m_sexpr_manager; }
|
||||
front_end_params & params() const { return m_params; }
|
||||
front_end_params & params() const { return *m_params; }
|
||||
|
||||
void set_solver(solver * s);
|
||||
solver * get_solver() const { return m_solver.get(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue