Changeset 3015 for proto/RE/output


Ignore:
Timestamp:
Apr 12, 2013, 4:34:21 PM (6 years ago)
Author:
bhull
Message:

RE Changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/RE/output/pablo_template.cpp

    r3005 r3015  
    134134
    135135    @decl
    136 
     136        ForwardScanner<BitBlock, ScanWord> match_scanner;
     137        ForwardScanner<BitBlock, ScanWord> line_scanner;
     138bool line_match_found=false;
     139
     140
     141        int match_count=0;
    137142    int block_base  = 0;
    138143                int block_pos   = 0;
     
    182187
    183188          @block_stmts
    184 print_register2("Matches",output.matches, 128);
     189
     190
     191match_scanner.init(&output.matches);
     192line_scanner.init(&lex.LF);
     193match_scanner.scan_to_next();
     194line_scanner.scan_to_next();
     195while(!(match_scanner.is_done() || line_scanner.is_done())) {
     196        if (line_scanner.get_pos()<match_scanner.get_pos()) {
     197                line_match_found=false;
     198                line_scanner.scan_to_next();
     199        } else {
     200                if (!line_match_found) {
     201                        match_count++;
     202                        line_match_found=true;
     203                }
     204                match_scanner.scan_to_next();
     205        }
     206
     207}
     208if (!line_scanner.is_done()) {
     209        line_match_found=false;
     210} else if (!match_scanner.is_done()) {
     211        if (!line_match_found) {
     212                match_count++;
     213                line_match_found=true;
     214        }
     215
     216}
     217while(!match_scanner.is_done()) {
     218        match_count++;
     219        match_scanner.scan_to_next();
     220}
     221//print_register2("Matches",output.matches, 128);
    185222      }
    186223      PERF_SEC_END(parser_timer, chars_avail);
     
    208245                                s2p_do_block((BytePack *) &src_buffer[block_pos], basis_bits);
    209246                                @block_stmts
    210                                 print_register2("Matches",output.matches,128);
     247match_scanner.init(&output.matches);
     248line_scanner.init(&lex.LF);
     249match_scanner.scan_to_next();
     250line_scanner.scan_to_next();
     251while(!(match_scanner.is_done() || line_scanner.is_done())) {
     252        if (line_scanner.get_pos()<match_scanner.get_pos()) {
     253                line_match_found=false;
     254                line_scanner.scan_to_next();
     255        } else {
     256                if (!line_match_found) {
     257                        match_count++;
     258                        line_match_found=true;
     259                }
     260                match_scanner.scan_to_next();
     261        }
     262
     263}
     264if (!line_scanner.is_done()) {
     265        line_match_found=false;
     266} else if (!match_scanner.is_done()) {
     267        if (!line_match_found) {
     268                match_count++;
     269                line_match_found=true;
     270        }
     271
     272}
     273
     274
     275
     276                                //print_register2("Matches",output.matches,128);
    211277       block_pos += BLOCK_SIZE;
    212278          remaining -= BLOCK_SIZE;
     
    224290                                s2p_do_final_block((BytePack *) &src_buffer[block_pos], basis_bits, EOF_mask);
    225291          @final_block_stmts
    226 print_register2("Matches",output.matches,128);
     292
     293match_scanner.init(&output.matches);
     294line_scanner.init(&lex.LF);
     295match_scanner.scan_to_next();
     296line_scanner.scan_to_next();
     297while(!(match_scanner.is_done() || line_scanner.is_done())) {
     298        if (line_scanner.get_pos()<match_scanner.get_pos()) {
     299                line_match_found=false;
     300                line_scanner.scan_to_next();
     301        } else {
     302                if (!line_match_found) {
     303                        match_count++;
     304                        line_match_found=true;
     305                }
     306                match_scanner.scan_to_next();
     307        }
     308
     309}
     310if (!line_scanner.is_done()) {
     311        line_match_found=false;
     312} else if (!match_scanner.is_done()) {
     313        if (!line_match_found) {
     314                match_count++;
     315                line_match_found=true;
     316        }
     317
     318}
     319
     320//print_register2("Matches",output.matches,128);
    227321#ifdef USE_ANY_CARRY_TEST
    228322   }
     
    233327
    234328                PERF_SEC_END(parser_timer, chars_avail);
    235 }
    236 
     329printf("Matching Lines:%d\n",match_count);
     330}
     331
Note: See TracChangeset for help on using the changeset viewer.