Changeset 198 for trunk/src/engine.c


Ignore:
Timestamp:
Oct 2, 2008, 12:05:08 PM (11 years ago)
Author:
cameron
Message:

Specialized UTF_8 version of Parse_Name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/engine.c

    r197 r198  
    482482#ifndef OPTIMIZE_SHORT_SCAN
    483483
    484 #define ScanTo(item) \
    485 do {\
    486   buffer_rel_pos = bitstream_scan(buf->item_stream[item], buffer_rel_pos);\
    487   while (buffer_rel_pos >= BUFFER_SIZE) {\
    488         AdjustBufferEndForIncompleteSequences();\
    489         Parser_Interface<W>::FinalizeBuffer_action();\
    490         AdvanceBuffers();\
    491         buffer_rel_pos = bitstream_scan(buf->item_stream[item], buffer_rel_pos);\
    492   }\
    493 } while(0)
    494 
    495 
    496 // template <class B, WorkingCharacterSet W>
    497 // inline void ParsingEngine<B, W>::ScanTo(int item) {
    498 //      buffer_rel_pos = bitstream_scan(buf->item_stream[item], buffer_rel_pos);
    499 //      while (buffer_rel_pos >= BUFFER_SIZE) {
    500 //              AdjustBufferEndForIncompleteSequences();
    501 //              Parser_Interface<W>::FinalizeBuffer_action();
    502 //              AdvanceBuffers();
    503 //              buffer_rel_pos = bitstream_scan(buf->item_stream[item], buffer_rel_pos);
    504 //      }
    505 // }
     484// #define ScanTo(item) \
     485// do {\
     486//   buffer_rel_pos = bitstream_scan(buf->item_stream[item], buffer_rel_pos);\
     487//   while (buffer_rel_pos >= BUFFER_SIZE) {\
     488//      AdjustBufferEndForIncompleteSequences();\
     489//      Parser_Interface<W>::FinalizeBuffer_action();\
     490//      AdvanceBuffers();\
     491//      buffer_rel_pos = bitstream_scan(buf->item_stream[item], buffer_rel_pos);\
     492//   }\
     493// } while(0)
     494
     495
     496template <class B, WorkingCharacterSet W>
     497inline void ParsingEngine<B, W>::ScanTo(int item) {
     498        buffer_rel_pos = bitstream_scan(buf->item_stream[item], buffer_rel_pos);
     499        while (buffer_rel_pos >= BUFFER_SIZE) {
     500                AdjustBufferEndForIncompleteSequences();
     501                Parser_Interface<W>::FinalizeBuffer_action();
     502                AdvanceBuffers();
     503                buffer_rel_pos = bitstream_scan(buf->item_stream[item], buffer_rel_pos);
     504        }
     505}
    506506
    507507template <class B, WorkingCharacterSet W>
     
    25962596// }
    25972597
    2598 // template <>
    2599 // inline int ParsingEngine<UTF8_Buffer, UTF_8>::Parse_Name() {
     2598// template <WorkingCharacterSet W>
     2599// inline int ParsingEngine<UTF8_Buffer, W>::Parse_Name() {
    26002600//      int name_pos = AbsPos();
    26012601//      ScanTo(NameFollow);
     
    26032603//      return Parser_Interface<UTF_8>::model_info->symbol_table->UTF8_Lookup_or_Insert_Name(&((char *)x8data)[buffer_rel_pos-lgth], lgth);
    26042604// }
     2605
     2606template <>
     2607inline int ParsingEngine<UTF8_Buffer, UTF_8>::Parse_Name() {
     2608        int name_pos = AbsPos();
     2609        ScanTo(NameFollow);
     2610        int lgth = AbsPos()-name_pos;
     2611        return Parser_Interface<UTF_8>::model_info->symbol_table->UTF8_Lookup_or_Insert_Name(&((char *)x8data)[buffer_rel_pos-lgth], lgth);
     2612}
    26052613
    26062614template <class B, WorkingCharacterSet W>
Note: See TracChangeset for help on using the changeset viewer.