Ticket #1026: state.hpp.patch

File state.hpp.patch, 5.3 KB (added by Thomas Witt, 15 years ago)

Removed .txt extension

  • 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
     
    107107    bool found_partial_match_;
    108108
    109109    match_context context_;
    110     results_extras &extras_;
     110    results_extras *extras_;
    111111    action_state action_state_;
    112112
    113113    ///////////////////////////////////////////////////////////////////////////////
     
    128128      , flags_(flags)
    129129      , found_partial_match_(false)
    130130      , context_() // zero-initializes the fields of context_
    131       , extras_(core_access<BidiIter>::get_extras(what))
     131      , extras_(&core_access<BidiIter>::get_extras(what))
    132132      , action_state_(core_access<BidiIter>::get_action_state(what))
    133133    {
    134134        // reclaim any cached memory in the match_results struct
    135         this->extras_.sub_match_stack_.unwind();
     135        this->extras_->sub_match_stack_.unwind();
    136136
    137137        // initialize the context_ struct
    138138        this->init_(impl, what);
    139139
    140140        // move all the nested match_results structs into the match_results cache
    141         this->extras_.results_cache_.reclaim_all(access::get_nested_results(what));
     141        this->extras_->results_cache_.reclaim_all(access::get_nested_results(what));
    142142    }
    143143
    144144    ///////////////////////////////////////////////////////////////////////////////
     
    146146    //void reset(match_results &what, basic_regex const &rex)
    147147    void reset(match_results &what, regex_impl const &impl)
    148148    {
     149        this->extras_ = &core_access<BidiIter>::get_extras(what);
    149150        this->context_.prev_context_ = 0;
    150151        this->found_partial_match_ = false;
    151         this->extras_.sub_match_stack_.unwind();
     152        this->extras_->sub_match_stack_.unwind();
    152153        this->init_(impl, what);
    153         this->extras_.results_cache_.reclaim_all(access::get_nested_results(what));
     154        this->extras_->results_cache_.reclaim_all(access::get_nested_results(what));
    154155    }
    155156
    156157    ///////////////////////////////////////////////////////////////////////////////
     
    163164
    164165        // create a new nested match_results for this regex
    165166        nested_results<BidiIter> &nested = access::get_nested_results(*context.results_ptr_);
    166         match_results &what = this->extras_.results_cache_.append_new(nested);
     167        match_results &what = this->extras_->results_cache_.append_new(nested);
    167168
    168169        // (re)initialize the match context
    169170        this->init_(impl, what);
     
    191192
    192193            // send the match_results struct back to the cache
    193194            nested_results<BidiIter> &nested = access::get_nested_results(what);
    194             this->extras_.results_cache_.reclaim_last(nested);
     195            this->extras_->results_cache_.reclaim_last(nested);
    195196        }
    196197
    197198        // restore the state
     
    255256        this->context_.results_ptr_ = &what;
    256257        this->context_.traits_ = impl.traits_.get();
    257258        this->mark_count_ = impl.mark_count_ + 1;
    258         this->sub_matches_ = this->extras_.sub_match_stack_.push_sequence(total_mark_count);
     259        this->sub_matches_ = this->extras_->sub_match_stack_.push_sequence(total_mark_count);
    259260        this->sub_matches_ += impl.hidden_mark_count_;
    260261
    261262        // initialize the match_results struct
     
    264265
    265266    void uninit_(regex_impl const &impl, match_results &)
    266267    {
    267         extras_.sub_match_stack_.unwind_to(this->sub_matches_ - impl.hidden_mark_count_);
     268        extras_->sub_match_stack_.unwind_to(this->sub_matches_ - impl.hidden_mark_count_);
    268269    }
    269270
    270271    bool found_partial_match()
     
    292293{
    293294    memento<BidiIter> mem =
    294295    {
    295         state.extras_.sub_match_stack_.push_sequence(state.mark_count_, no_fill)
     296        state.extras_->sub_match_stack_.push_sequence(state.mark_count_, no_fill)
    296297      , state.context_.results_ptr_->nested_results().size()
    297298    };
    298299    std::copy(state.sub_matches_, state.sub_matches_ + state.mark_count_, mem.old_sub_matches_);
     
    308309    typedef core_access<BidiIter> access;
    309310    nested_results<BidiIter> &nested = access::get_nested_results(*state.context_.results_ptr_);
    310311    std::size_t count = state.context_.results_ptr_->nested_results().size() - mem.nested_results_count_;
    311     state.extras_.results_cache_.reclaim_last_n(nested, count);
     312    state.extras_->results_cache_.reclaim_last_n(nested, count);
    312313    std::copy(mem.old_sub_matches_, mem.old_sub_matches_ + state.mark_count_, state.sub_matches_);
    313     state.extras_.sub_match_stack_.unwind_to(mem.old_sub_matches_);
     314    state.extras_->sub_match_stack_.unwind_to(mem.old_sub_matches_);
    314315}
    315316
    316317///////////////////////////////////////////////////////////////////////////////
     
    322323    std::size_t count = state.context_.results_ptr_->nested_results().size() - mem.nested_results_count_;
    323324    if(count == 0)
    324325    {
    325         state.extras_.sub_match_stack_.unwind_to(mem.old_sub_matches_);
     326        state.extras_->sub_match_stack_.unwind_to(mem.old_sub_matches_);
    326327    }
    327328    // else we have we must orphan this block of backrefs because we are using the stack
    328329    // space above it.