Changeset 3740


Ignore:
Timestamp:
Mar 24, 2014, 1:27:52 AM (4 years ago)
Author:
ksherdy
Message:

Added asserts for EOF processing.

Location:
proto/RE/demo
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • proto/RE/demo/Makefile

    r3736 r3740  
    77
    88PABLO_DEMO=grep_demo.py
    9 INFILE=test/fruitlist0.dat
     9INFILE=test/fruitlist7.dat
    1010
    1111PABLO_DEBUG=-d
  • proto/RE/demo/grep_template_segment.cpp

    r3739 r3740  
    216216    bytes_remaining = bytes_avail;
    217217   
    218     block_base      = 0;   
     218   
    219219   
    220220    //if(feof(infile)) { KH: No! OPC /*bytes_remaining--;*/ }
     
    225225    //assert(("fread exceeded segment size.", bytes_avail <= SEGMENT_SIZE));
    226226   
    227     if (bytes_avail == SEGMENT_SIZE) { // (bytes_remaining >= SEGMENT_SIZE)
    228      
     227    if (bytes_remaining == SEGMENT_SIZE) { // (bytes_remaining >= SEGMENT_SIZE)
     228   
     229      block_base      = 0;     
     230       
    229231      if(only_matching) { 
    230232        match_scanner.init();
     
    309311    // Process a partial segment.
    310312    if(bytes_remaining > 0) {
    311 
     313               
    312314        block_index = 0;   
     315        block_base  = 0;   
    313316       
    314317        if(only_matching) {
     
    349352       @final_block_stmts
    350353   
     354       //print_register<BitBlock>("EOF_mask", EOF_mask);
     355       
    351356       if(only_matching) {
    352357          match_scanner.load_block(output.matches & EOF_mask, block_index);
     
    378383        if(!only_matching) {
    379384           
    380             assert(("Line length exceeds segment size.", line_ends_scanner.has_next() && line_starts_scanner.has_next())); 
     385            //assert(("Line length exceeds segment size.", line_ends_scanner.has_next() && line_starts_scanner.has_next())); 
    381386                       
    382387            //if(has_line_start) {
     
    413418    }
    414419   
     420    assert(("copy_back_offset", (copy_back_offset >= 0)));
     421    assert(("copy_back_size", (copy_back_offset < SEGMENT_SIZE)));
     422    assert(("copy_back_size", (copy_back_size >= 0)));
     423    assert(("copy_back_size", (copy_back_size < SEGMENT_SIZE)));
     424   
    415425    memmove(&buffer[0], &buffer[copy_back_offset], copy_back_size);
    416426   
  • proto/RE/demo/src/Makefile

    r3739 r3740  
    3030        $(CC) -o $(OUTFILE) $(SRCFILE) $(INCLUDES) $(AFLAGS)
    3131
     32test_all: test test_b test_o test_b_o
     33
    3234test: $(OUTFILE)
    33         for file in ../test/* ; do \
     35        for file in ../test/*.dat ; do \
    3436                # echo $$file ; \
    3537        ./$(OUTFILE) $$file > 0 ; \
     
    3840        done   
    3941
    40 test_all: test test_b test_o test_b_o
    41          
    42 
    4342test_b: $(OUTFILE)
    44         for file in ../test/* ; do \
     43        for file in ../test/*.dat ; do \
    4544                # echo $$file ; \
    4645        ./$(OUTFILE) $$file -b > 0 ; \
     
    5049
    5150test_o: $(OUTFILE)
    52         for file in ../test/* ; do \
     51        for file in ../test/*.dat ; do \
    5352                # echo $$file ; \
    5453        ./$(OUTFILE) $$file -o > 0 ; \
    5554        grep $(FIXED_PATTERN) $$file -o > 1 ; \
    5655        diff 0 1 > 2; \
     56        cat 2 ; \
    5757        done   
    5858   
    5959test_b_o: $(OUTFILE)
    60         for file in ../test/* ; do \
     60        for file in ../test/*.dat ; do \
    6161                # echo $$file ; \
    6262        ./$(OUTFILE) $$file -o -b > 0 ; \
Note: See TracChangeset for help on using the changeset viewer.