Index: state.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/xpressive/detail/core/state.hpp,v retrieving revision 1.6 diff -b -d -u -r1.6 state.hpp --- state.hpp 13 Feb 2006 01:05:37 -0000 1.6 +++ state.hpp 2 Jun 2007 02:19:24 -0000 @@ -107,7 +107,7 @@ bool found_partial_match_; match_context context_; - results_extras &extras_; + results_extras *extras_; action_state action_state_; /////////////////////////////////////////////////////////////////////////////// @@ -128,17 +128,17 @@ , flags_(flags) , found_partial_match_(false) , context_() // zero-initializes the fields of context_ - , extras_(core_access::get_extras(what)) + , extras_(&core_access::get_extras(what)) , action_state_(core_access::get_action_state(what)) { // reclaim any cached memory in the match_results struct - this->extras_.sub_match_stack_.unwind(); + this->extras_->sub_match_stack_.unwind(); // initialize the context_ struct this->init_(impl, what); // move all the nested match_results structs into the match_results cache - this->extras_.results_cache_.reclaim_all(access::get_nested_results(what)); + this->extras_->results_cache_.reclaim_all(access::get_nested_results(what)); } /////////////////////////////////////////////////////////////////////////////// @@ -146,11 +146,12 @@ //void reset(match_results &what, basic_regex const &rex) void reset(match_results &what, regex_impl const &impl) { + this->extras_ = &core_access::get_extras(what); this->context_.prev_context_ = 0; this->found_partial_match_ = false; - this->extras_.sub_match_stack_.unwind(); + this->extras_->sub_match_stack_.unwind(); this->init_(impl, what); - this->extras_.results_cache_.reclaim_all(access::get_nested_results(what)); + this->extras_->results_cache_.reclaim_all(access::get_nested_results(what)); } /////////////////////////////////////////////////////////////////////////////// @@ -163,7 +164,7 @@ // create a new nested match_results for this regex nested_results &nested = access::get_nested_results(*context.results_ptr_); - match_results &what = this->extras_.results_cache_.append_new(nested); + match_results &what = this->extras_->results_cache_.append_new(nested); // (re)initialize the match context this->init_(impl, what); @@ -191,7 +192,7 @@ // send the match_results struct back to the cache nested_results &nested = access::get_nested_results(what); - this->extras_.results_cache_.reclaim_last(nested); + this->extras_->results_cache_.reclaim_last(nested); } // restore the state @@ -255,7 +256,7 @@ this->context_.results_ptr_ = &what; this->context_.traits_ = impl.traits_.get(); this->mark_count_ = impl.mark_count_ + 1; - this->sub_matches_ = this->extras_.sub_match_stack_.push_sequence(total_mark_count); + this->sub_matches_ = this->extras_->sub_match_stack_.push_sequence(total_mark_count); this->sub_matches_ += impl.hidden_mark_count_; // initialize the match_results struct @@ -264,7 +265,7 @@ void uninit_(regex_impl const &impl, match_results &) { - extras_.sub_match_stack_.unwind_to(this->sub_matches_ - impl.hidden_mark_count_); + extras_->sub_match_stack_.unwind_to(this->sub_matches_ - impl.hidden_mark_count_); } bool found_partial_match() @@ -292,7 +293,7 @@ { memento mem = { - state.extras_.sub_match_stack_.push_sequence(state.mark_count_, no_fill) + state.extras_->sub_match_stack_.push_sequence(state.mark_count_, no_fill) , state.context_.results_ptr_->nested_results().size() }; std::copy(state.sub_matches_, state.sub_matches_ + state.mark_count_, mem.old_sub_matches_); @@ -308,9 +309,9 @@ typedef core_access access; nested_results &nested = access::get_nested_results(*state.context_.results_ptr_); std::size_t count = state.context_.results_ptr_->nested_results().size() - mem.nested_results_count_; - state.extras_.results_cache_.reclaim_last_n(nested, count); + state.extras_->results_cache_.reclaim_last_n(nested, count); std::copy(mem.old_sub_matches_, mem.old_sub_matches_ + state.mark_count_, state.sub_matches_); - state.extras_.sub_match_stack_.unwind_to(mem.old_sub_matches_); + state.extras_->sub_match_stack_.unwind_to(mem.old_sub_matches_); } /////////////////////////////////////////////////////////////////////////////// @@ -322,7 +323,7 @@ std::size_t count = state.context_.results_ptr_->nested_results().size() - mem.nested_results_count_; if(count == 0) { - state.extras_.sub_match_stack_.unwind_to(mem.old_sub_matches_); + state.extras_->sub_match_stack_.unwind_to(mem.old_sub_matches_); } // else we have we must orphan this block of backrefs because we are using the stack // space above it.