From 028a2ab785d0b9974f7a2582e764760b6c3dc183 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Fri, 20 Nov 2015 10:39:26 -0800 Subject: [PATCH] feat(library/blast): add get_config() --- src/library/blast/blast.cpp | 7 +++++-- src/library/blast/options.cpp | 17 +++++++++++++++++ src/library/blast/options.h | 12 +++++++++++- src/library/blast/simple_strategy.cpp | 2 +- src/library/blast/strategy.cpp | 10 ++++------ src/library/blast/strategy.h | 2 -- src/library/blast/trace.cpp | 4 ++-- src/library/blast/trace.h | 3 ++- 8 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/library/blast/blast.cpp b/src/library/blast/blast.cpp index 69141e0f5..ce0de0d14 100644 --- a/src/library/blast/blast.cpp +++ b/src/library/blast/blast.cpp @@ -29,6 +29,7 @@ Author: Leonardo de Moura #include "library/blast/choice_point.h" #include "library/blast/congruence_closure.h" #include "library/blast/trace.h" +#include "library/blast/options.h" namespace lean { namespace blast { @@ -792,7 +793,8 @@ struct scope_debug::imp { blastenv m_benv; scope_blastenv m_scope2; scope_congruence_closure m_scope3; - scope_trace m_scope4; + scope_config m_scope4; + scope_trace m_scope5; imp(environment const & env, io_state const & ios): m_scope1(true), m_benv(env, ios, list(), list()), @@ -890,7 +892,8 @@ optional blast_goal(environment const & env, io_state const & ios, list strategy::search() { if (get_num_choice_points() > m_init_num_choices) throw exception("invalid blast preprocessing action, preprocessing actions should not create choice points"); state s = curr_state(); - unsigned d = m_config.m_init_depth; + unsigned d = get_config().m_init_depth; while (true) { if (auto r = search_upto(d)) return r; - d += m_config.m_inc_depth; - if (d > m_config.m_max_depth) { + d += get_config().m_inc_depth; + if (d > get_config().m_max_depth) { trace_curr_state(); return none_expr(); } diff --git a/src/library/blast/strategy.h b/src/library/blast/strategy.h index ba08a39d6..77effe623 100644 --- a/src/library/blast/strategy.h +++ b/src/library/blast/strategy.h @@ -19,7 +19,6 @@ namespace blast { 2- Next action to be performed (next_action method) */ class strategy { - config m_config; unsigned m_init_num_choices; optional invoke_preprocess(); protected: @@ -32,7 +31,6 @@ protected: public: strategy(); optional operator()() { return search(); } - config cfg() const { return m_config; } }; #define TryStrategy(Code) {\ diff --git a/src/library/blast/trace.cpp b/src/library/blast/trace.cpp index 60c91abc4..93ad7536d 100644 --- a/src/library/blast/trace.cpp +++ b/src/library/blast/trace.cpp @@ -48,8 +48,8 @@ scope_trace::scope_trace(bool enable): g_trace = enable; } -scope_trace::scope_trace(options const & o): - scope_trace(get_blast_trace(o)) { +scope_trace::scope_trace(): + scope_trace(get_config().m_trace) { } scope_trace::~scope_trace() { diff --git a/src/library/blast/trace.h b/src/library/blast/trace.h index b19493846..f04717ff3 100644 --- a/src/library/blast/trace.h +++ b/src/library/blast/trace.h @@ -14,10 +14,11 @@ void trace(char const * msg); void trace_action(char const * a); void trace_curr_state_if(action_result r); bool is_trace_enabled(); + class scope_trace { bool m_old; public: - scope_trace(options const & o); + scope_trace(); scope_trace(bool enable); ~scope_trace(); };