Changeset 2901


Ignore:
Timestamp:
Feb 6, 2013, 4:08:56 PM (6 years ago)
Author:
lindanl
Message:

Hex parsing with WS

Location:
proto/PDF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/PDF/cb_pablo.py

    r2900 r2901  
    331331        hexsting_partial_even_mask = pablo.ExclusiveSpan(hexsting_partial_even_start,hexsting_partial_even_end) | (hexsting_partial_even_end & parity.even)
    332332       
    333         out_Callouts.delmask |= (hexsting_partial_odd_mask & parity.even) | (hexsting_partial_even_mask & parity.odd)
     333        del_position = (hexsting_partial_odd_mask & parity.even) | (hexsting_partial_even_mask & parity.odd)
    334334        kept_position = (hexsting_partial_odd_mask & parity.odd) | (hexsting_partial_even_mask & parity.even)
    335335       
    336336         
    337         hexsting_partial_ends = hexsting_partial_odd_end | hexsting_partial_even_end
    338         hexsting_partial_masks = hexsting_partial_odd_mask | hexsting_partial_even_mask
     337        hexsting_partial_end = hexsting_partial_odd_end | hexsting_partial_even_end
     338        hexsting_partial_ends = hexsting_partial_end
    339339        kept_positions = kept_position
    340         #while ~(hexsting_partial_end & lex.RBracket):
     340        del_positions = del_position
     341        del_pre_ends = 0
     342        while hexsting_partial_end & lex.WS:
     343          del_pre_end = del_position & pablo.Lookahead(lex.WS)
     344          kept_pre_end = kept_position & pablo.Lookahead(lex.WS)
     345         
     346          del_even_start = pablo.ScanThru(pablo.Advance(del_pre_end),lex.WS) & parity.even
     347          del_odd_start = pablo.ScanThru(pablo.Advance(del_pre_end),lex.WS) & parity.odd
     348          kept_even_start = pablo.ScanThru(pablo.Advance(kept_pre_end),lex.WS) & parity.even
     349          kept_odd_start = pablo.ScanThru(pablo.Advance(kept_pre_end),lex.WS) & parity.odd
     350           
     351          del_even_end = pablo.ScanThru(del_even_start,lex.Hex)
     352          del_odd_end = pablo.ScanThru(del_odd_start,lex.Hex)
     353          kept_even_end = pablo.ScanThru(kept_even_start,lex.Hex)
     354          kept_odd_end = pablo.ScanThru(kept_odd_start,lex.Hex)
     355         
     356          hexsting_partial_odd_mask = pablo.InclusiveSpan(del_even_start,del_even_end) | pablo.InclusiveSpan(kept_odd_start,kept_odd_end)
     357          hexsting_partial_even_mask = pablo.InclusiveSpan(del_odd_start,del_odd_end) | pablo.InclusiveSpan(kept_even_start,kept_even_end)   
     358         
     359          hexsting_partial_end = del_even_end | del_odd_end | kept_even_end | kept_odd_end
     360         
     361          kept_position = (hexsting_partial_odd_mask & parity.even) | (hexsting_partial_even_mask & parity.odd)
     362          del_position = (hexsting_partial_odd_mask & parity.odd) | (hexsting_partial_even_mask & parity.even)
     363          del_position = del_position &~ hexsting_partial_end
     364         
     365          hexsting_partial_ends |= hexsting_partial_end
     366          kept_positions |= kept_position
     367          del_positions |= del_position
     368          del_pre_ends |= del_pre_end
     369         
    341370     
    342371        out_Callouts.bit_4 &= ~hexsting_partial_ends
     
    345374        out_Callouts.bit_7 &= ~hexsting_partial_ends
    346375     
    347         out_Callouts.bit_0 = pablo.Advance(out_Callouts.delmask & hexsting_partial_masks & out_Callouts.bit_4) | (out_Callouts.bit_0 & ~kept_positions)
    348         out_Callouts.bit_1 = pablo.Advance(out_Callouts.delmask & hexsting_partial_masks & out_Callouts.bit_5) | (out_Callouts.bit_1 & ~kept_positions)
    349         out_Callouts.bit_2 = pablo.Advance(out_Callouts.delmask & hexsting_partial_masks & out_Callouts.bit_6) | (out_Callouts.bit_2 & ~kept_positions)
    350         out_Callouts.bit_3 = pablo.Advance(out_Callouts.delmask & hexsting_partial_masks & out_Callouts.bit_7) | (out_Callouts.bit_3 & ~kept_positions)
     376        out_Callouts.bit_0 = pablo.Advance(del_positions & out_Callouts.bit_4) | (out_Callouts.bit_0 & ~kept_positions) | pablo.ScanThru(pablo.Advance((out_Callouts.bit_4 & del_pre_ends)), lex.WS)
     377        out_Callouts.bit_1 = pablo.Advance(del_positions & out_Callouts.bit_5) | (out_Callouts.bit_1 & ~kept_positions) | pablo.ScanThru(pablo.Advance((out_Callouts.bit_5 & del_pre_ends)), lex.WS)
     378        out_Callouts.bit_2 = pablo.Advance(del_positions & out_Callouts.bit_6) | (out_Callouts.bit_2 & ~kept_positions) | pablo.ScanThru(pablo.Advance((out_Callouts.bit_6 & del_pre_ends)), lex.WS)
     379        out_Callouts.bit_3 = pablo.Advance(del_positions & out_Callouts.bit_7) | (out_Callouts.bit_3 & ~kept_positions) | pablo.ScanThru(pablo.Advance((out_Callouts.bit_7 & del_pre_ends)), lex.WS)
     380       
     381        out_Callouts.delmask |= del_positions
    351382           
    352383       
  • proto/PDF/cb_template.cpp

    r2900 r2901  
    66
    77#define LocalCarryDeclare(name, count)\
    8 CarryArray<count> name;\
     8CarryArray<count, 0> name;\
    99
    1010#include "../../simd-lib/bitblock.hpp"
     
    205205        for(int k=0; k<8; k++) units_per_reg.i8[k] = 0;
    206206        del_count(out_Callouts.delmask,units_per_reg.i128);
    207         for(int k=0; k<8; k++)
    208           printf("delcount=%i\n",units_per_reg.i8[k]);
     207//      for(int k=0; k<8; k++)
     208//        printf("delcount=%i\n",units_per_reg.i8[k]);
    209209
    210210        for(int j=0; j<8; j++){
     
    258258      parse_HexStrings.do_block(lex[i], marker, out_Callouts);
    259259      parse_Names.do_block(lex[i], marker, out_Callouts, lex[i+1]);
    260       prepare_content_buffer.do_block(basis_bits[i], lex[i], marker, parity, escape_Callouts, out_Callouts);
     260      prepare_content_buffer.do_block(basis_bits[i], lex[i], marker, parity, escape_Callouts, out_Callouts, lex[i+1]);
    261261      Build_ContentBuffer(out_Callouts, content_buf, &content_buf_ptr);
    262262    }
Note: See TracChangeset for help on using the changeset viewer.