Changeset 2900 for proto/PDF


Ignore:
Timestamp:
Feb 5, 2013, 2:48:38 PM (6 years ago)
Author:
lindanl
Message:

hex processing without WS

Location:
proto/PDF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/PDF/cb_pablo.py

    r2899 r2900  
    275275        hexString_ends = pablo.ScanThru(pablo.Advance(hexString_starts),lex.Hex|lex.WS)
    276276        #error = hexString_ends &~ lex.RAngle
    277         out_Callouts.hexString_mask = pablo.InclusiveSpan(hexString_starts,hexString_ends)
     277        out_Callouts.hexString_mask = pablo.ExclusiveSpan(hexString_starts,hexString_ends)
    278278        marker.hex_opener = hexString_starts
    279279
     
    291291
    292292       
    293 def Prepare_content_buffer(basis_bits, lex, escape_Callouts, out_Callouts):
     293def Prepare_content_buffer(basis_bits, lex, marker, parity, escape_Callouts, out_Callouts):
    294294
    295295    out_Callouts.bit_0 = basis_bits.bit_0
     
    304304    names_escapes_scope1 = pablo.Advance(out_Callouts.names_escapes)
    305305    names_escapes_scope2 = pablo.Advance(names_escapes_scope1)
    306     out_Callouts.hexString_mask |= names_escapes_scope1 | names_escapes_scope2
    307    
    308     if out_Callouts.hexString_mask:
     306    hexstring_nameescape_mask = out_Callouts.hexString_mask | names_escapes_scope1 | names_escapes_scope2
     307   
     308    if hexstring_nameescape_mask:
    309309     
    310310        out_Callouts.delmask |= out_Callouts.hexString_mask & lex.WS
    311311       
    312312        NondigitHexString = lex.Hex &~ lex.Digit
    313         out_Callouts.bit_0 &= ~out_Callouts.hexString_mask
    314         out_Callouts.bit_1 &= ~out_Callouts.hexString_mask
    315         out_Callouts.bit_2 &= ~out_Callouts.hexString_mask
    316         out_Callouts.bit_3 &= ~out_Callouts.hexString_mask
    317         out_Callouts.bit_4 |= (out_Callouts.hexString_mask & NondigitHexString)
    318         carry7 = out_Callouts.bit_7 & NondigitHexString & out_Callouts.hexString_mask
    319         out_Callouts.bit_7 ^= NondigitHexString & out_Callouts.hexString_mask
     313        out_Callouts.bit_0 &= ~hexstring_nameescape_mask
     314        out_Callouts.bit_1 &= ~hexstring_nameescape_mask
     315        out_Callouts.bit_2 &= ~hexstring_nameescape_mask
     316        out_Callouts.bit_3 &= ~hexstring_nameescape_mask
     317        out_Callouts.bit_4 |= (hexstring_nameescape_mask & NondigitHexString)
     318        carry7 = out_Callouts.bit_7 & NondigitHexString & hexstring_nameescape_mask
     319        out_Callouts.bit_7 ^= NondigitHexString & hexstring_nameescape_mask
    320320        carry6 = out_Callouts.bit_6 & carry7
    321321        out_Callouts.bit_6 ^= carry7
    322322        out_Callouts.bit_5 ^= carry6
     323       
     324    if out_Callouts.hexString_mask:
     325        hexsting_partial_start = marker.hex_opener
     326        hexsting_partial_odd_start = hexsting_partial_start & parity.odd
     327        hexsting_partial_even_start = hexsting_partial_start & parity.even
     328        hexsting_partial_odd_end = pablo.ScanThru(pablo.Advance(hexsting_partial_odd_start),lex.Hex)
     329        hexsting_partial_even_end = pablo.ScanThru(pablo.Advance(hexsting_partial_even_start),lex.Hex)
     330        hexsting_partial_odd_mask = pablo.ExclusiveSpan(hexsting_partial_odd_start,hexsting_partial_odd_end) | (hexsting_partial_odd_end & parity.odd)       
     331        hexsting_partial_even_mask = pablo.ExclusiveSpan(hexsting_partial_even_start,hexsting_partial_even_end) | (hexsting_partial_even_end & parity.even)
     332       
     333        out_Callouts.delmask |= (hexsting_partial_odd_mask & parity.even) | (hexsting_partial_even_mask & parity.odd)
     334        kept_position = (hexsting_partial_odd_mask & parity.odd) | (hexsting_partial_even_mask & parity.even)
     335       
     336         
     337        hexsting_partial_ends = hexsting_partial_odd_end | hexsting_partial_even_end
     338        hexsting_partial_masks = hexsting_partial_odd_mask | hexsting_partial_even_mask
     339        kept_positions = kept_position
     340        #while ~(hexsting_partial_end & lex.RBracket):
     341     
     342        out_Callouts.bit_4 &= ~hexsting_partial_ends
     343        out_Callouts.bit_5 &= ~hexsting_partial_ends
     344        out_Callouts.bit_6 &= ~hexsting_partial_ends
     345        out_Callouts.bit_7 &= ~hexsting_partial_ends
     346     
     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)
     351           
    323352       
    324353
  • proto/PDF/cb_template.cpp

    r2899 r2900  
    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], escape_Callouts, out_Callouts);
     260      prepare_content_buffer.do_block(basis_bits[i], lex[i], marker, parity, escape_Callouts, out_Callouts);
    261261      Build_ContentBuffer(out_Callouts, content_buf, &content_buf_ptr);
    262262    }
     
    266266    parse_HexStrings.do_final_block(lex[BLOCKS-1], marker, out_Callouts, EOF_mask);
    267267    parse_Names.do_final_block(lex[BLOCKS-1], marker, out_Callouts, EOF_mask);
    268     prepare_content_buffer.do_final_block(basis_bits[BLOCKS-1], lex[BLOCKS-1], escape_Callouts, out_Callouts, EOF_mask);
     268    prepare_content_buffer.do_final_block(basis_bits[BLOCKS-1], lex[BLOCKS-1], marker, parity, escape_Callouts, out_Callouts, EOF_mask);
    269269    out_Callouts.delmask |= ~EOF_mask;         
    270270    Build_ContentBuffer(out_Callouts, content_buf, &content_buf_ptr);
Note: See TracChangeset for help on using the changeset viewer.