Changeset 134


Ignore:
Timestamp:
May 6, 2008, 5:35:30 AM (11 years ago)
Author:
cameron
Message:

Simplify buffer processing by eliminated unused preserve_pos.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/markup_stats.cxx

    r133 r134  
    230230
    231231template <CodeUnit_Base C>
    232 inline void ParsingEngine<C>::FinalizeBuffer_action(int& preserve_pos) {
     232inline void ParsingEngine<C>::FinalizeBuffer_action() {
    233233       
    234234       
     
    240240                code_clocker->cc_end_interval(BUFFER_SIZE);
    241241        #endif
    242         preserve_pos = AbsPos();
    243        
    244242        #if defined(PAPI) and defined(CODE_CLOCKING) and (CODE_CLOCKING == BUFFER_TOTAL)
    245243                code_clocker->cc_start_interval();
  • trunk/src/engine.c

    r133 r134  
    185185
    186186template <CodeUnit_Base C>
    187 inline void ParsingEngine<C>::AdvanceBuffers(int preserve_pos){
     187inline void ParsingEngine<C>::AdvanceBuffers(){
    188188#if defined(PAPI) and defined(CODE_CLOCKING) and (CODE_CLOCKING == ADVANCE_BUFFERS)
    189189        code_clocker->cc_start_interval();
    190190#endif
    191191
    192         int advance_amt = min(preserve_pos, text_or_markup_start) - buffer_base_pos;
     192        int advance_amt = text_or_markup_start - buffer_base_pos;
    193193        advance_amt &= -PACKSIZE; // maintain alignment
    194194        byteplex->AdvanceInputBuffer(advance_amt);
     
    250250template <CodeUnit_Base C>
    251251inline void ParsingEngine<C>::Advance(int n) {
    252         int preserve_pos;
    253252        buffer_rel_pos += n;
    254 #ifndef OMIT_BITBUFFER_LIMIT_TEST_IN_ADVANCE
    255   if (buffer_rel_pos >= BUFFER_SIZE) {
    256        
    257         FinalizeBuffer_action(preserve_pos);
    258         AdvanceBuffers(preserve_pos);
     253  if (buffer_rel_pos >= BUFFER_SIZE) { 
     254        FinalizeBuffer_action();
     255        AdvanceBuffers();
    259256  }
    260 #endif
    261257}
    262258
     
    265261template <CodeUnit_Base C>
    266262inline void ParsingEngine<C>::ScanTo(int item) {
    267         int preserve_pos;
    268263  buffer_rel_pos = bitstream_scan(buf->item_stream[item],
    269264                                      buffer_rel_pos);
    270265  while (buffer_rel_pos >= BUFFER_SIZE) {
    271266        while (at_UTF8_suffix(cur())) buffer_rel_pos--;
    272         FinalizeBuffer_action(preserve_pos);
    273         AdvanceBuffers(preserve_pos);
     267        FinalizeBuffer_action();
     268        AdvanceBuffers();
    274269        buffer_rel_pos = bitstream_scan(buf->item_stream[item], buffer_rel_pos);
    275270  }
     
    284279template <CodeUnit_Base C>
    285280inline void ParsingEngine<C>::ScanToMarkupStart() {
    286         int preserve_pos;
    287281        text_or_markup_start = AbsPos();
    288282        buffer_rel_pos = bitstream_scan(buf->item_stream[MarkupStart], buffer_rel_pos);
     
    291285                Text_action(GetCodeUnitPtr(text_or_markup_start), LengthFrom(text_or_markup_start));
    292286                text_or_markup_start = AbsPos();
    293                 FinalizeBuffer_action(preserve_pos);
    294                 AdvanceBuffers(preserve_pos);
     287                FinalizeBuffer_action();
     288                AdvanceBuffers();
    295289                buffer_rel_pos = bitstream_scan(buf->item_stream[MarkupStart], buffer_rel_pos);
    296290        }
     
    299293template <CodeUnit_Base C>
    300294inline void ParsingEngine<C>::ScanToCD_End_check() {
    301         int preserve_pos;
    302295        buffer_rel_pos = bitstream_scan(buf->item_stream[CD_End_check], buffer_rel_pos);
    303296        while (buffer_rel_pos >= BUFFER_SIZE) {
     
    305298                Text_action(GetCodeUnitPtr(text_or_markup_start), LengthFrom(text_or_markup_start));
    306299                text_or_markup_start = AbsPos();
    307                 FinalizeBuffer_action(preserve_pos);
    308                 AdvanceBuffers(preserve_pos);
     300                FinalizeBuffer_action();
     301                AdvanceBuffers();
    309302                buffer_rel_pos = bitstream_scan(buf->item_stream[CD_End_check], buffer_rel_pos);
    310303        }
     
    326319      buffer_rel_pos = BUFFER_BLOCKS * BLOCKSIZE;
    327320      while (at_UTF8_suffix(cur())) buffer_rel_pos--;
    328       FinalizeBuffer_action(preserve_pos);
    329           AdvanceBuffers(preserve_pos);
     321        FinalizeBuffer_action();
     322        AdvanceBuffers();
    330323      buffer_rel_pos = bitstream_scan(buf->item_stream[item], buffer_rel_pos);
    331324    }
  • trunk/src/engine.h

    r124 r134  
    8686        void ScanToCD_End_check(); // Specialized version.
    8787
    88         void AdvanceBuffers(int preserve_pos);
     88        void AdvanceBuffers();
    8989        /* Parsing routines. */
    9090
     
    200200                              unsigned char * URI, int URI_end);
    201201       
    202         /*Action routine for end of buffer events.
    203          The preserve_pos should be set to indicate the position
    204          of data that must be copied into the new buffer.*/
    205         void FinalizeBuffer_action(int& preserve_pos);
     202        /*Action routine for end of buffer events. */
     203        void FinalizeBuffer_action();
    206204       
    207205        /*Document Type actions.*/
Note: See TracChangeset for help on using the changeset viewer.