Changeset 2859 for proto/PDF/cb_pablo.py


Ignore:
Timestamp:
Jan 29, 2013, 1:14:15 PM (7 years ago)
Author:
lindanl
Message:

hex nyble precalculated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/PDF/cb_pablo.py

    r2853 r2859  
    5454
    5555class Out_Callouts():
     56    zeromask = 0
    5657    delmask = 0
     58    hexString_mask = 0
    5759    bit_0 = 0
    5860    bit_1 = 0
     
    6365    bit_6 = 0
    6466    bit_7 = 0
     67   
     68class marker():
     69    hex_opener = 0
    6570   
    6671
     
    207212        #escape_Callouts.Oct3 = lex.Oct & pablo.Advance(escape_Callouts.Oct2)
    208213        out_Callouts.delmask = escape_char
    209 
     214       
     215def Parse_HexStrings(lex, marker, out_Callouts) :
     216        hexString_starts = lex.LAngle #&~marker.mask
     217        hexString_ends = pablo.ScanThru(pablo.Advance(hexString_starts),lex.Hex|lex.WS)
     218        #error = hexString_ends &~ lex.RAngle
     219        out_Callouts.hexString_mask = pablo.InclusiveSpan(hexString_starts,hexString_ends)
     220        marker.hex_opener = hexString_starts
     221        out_Callouts.delmask |= out_Callouts.hexString_mask & lex.WS
     222
     223##def Parse_Names(lex, marker, out_Callouts) :
     224##      name_starts =lex.Slash #&~marker.mask
     225##      names_follows = pablo.ScanThru(pablo.Advance(name_starts), lex.Regular)
     226##      names_Callouts.escapes = (pablo.Advance(pablo.Advance(lex.Hash)) & pablo.Advance(lex.Hex) & lex.Hex) & pablo.SpanUpTo(names_starts, names_follows)
     227##      marker.name_starts = name_starts
     228##
     229##     
     230##def Parse_Numeric(lex, marker, out_Callouts) :
     231##      numeric_characters = (lex.Digit | lex.Period | lex.Sign)
     232##      numeric_starts = (numeric_characters &~ pablo.Advance(lex.Regular)) &~ marker.mask
     233##      numeric_follows = pablo.ScanThru(numeric_starts, lex.Regular)
     234##      marker.numeric_starts = numeric_starts
     235       
    210236def Prepare_content_buffer(basis_bits, lex, escape_Callouts, out_Callouts):
    211 
    212     out_Callouts.bit_1 = basis_bits.bit_1 ^ ( lex.pdf_mod_bit_1 & escape_Callouts.Nonoct)
    213     out_Callouts.bit_2 = basis_bits.bit_2 ^ ( lex.pdf_mod_bit_2 & escape_Callouts.Nonoct)
    214     out_Callouts.bit_3 = basis_bits.bit_3 ^ ( lex.pdf_mod_bit_3 & escape_Callouts.Nonoct)
    215     out_Callouts.bit_4 = basis_bits.bit_4 ^ ( lex.pdf_mod_bit_4 & escape_Callouts.Nonoct)
    216     out_Callouts.bit_5 = basis_bits.bit_5 ^ ( lex.pdf_mod_bit_5 & escape_Callouts.Nonoct)
    217     out_Callouts.bit_6 = basis_bits.bit_6 ^ ( lex.pdf_mod_bit_6 & escape_Callouts.Nonoct)
    218     out_Callouts.bit_7 = basis_bits.bit_7 ^ ( lex.pdf_mod_bit_7 & escape_Callouts.Nonoct)
    219 
    220     out_Callouts.bit_0 = out_Callouts.bit_0 &~ out_Callouts.delmask
    221     out_Callouts.bit_1 = out_Callouts.bit_1 &~ out_Callouts.delmask
    222     out_Callouts.bit_2 = out_Callouts.bit_2 &~ out_Callouts.delmask
    223     out_Callouts.bit_3 = out_Callouts.bit_3 &~ out_Callouts.delmask
    224     out_Callouts.bit_4 = out_Callouts.bit_4 &~ out_Callouts.delmask
    225     out_Callouts.bit_5 = out_Callouts.bit_5 &~ out_Callouts.delmask
    226     out_Callouts.bit_6 = out_Callouts.bit_6 &~ out_Callouts.delmask
    227     out_Callouts.bit_7 = out_Callouts.bit_7 &~ out_Callouts.delmask
     237 
     238    out_Callouts.zeromask |= out_Callouts.delmask
     239
     240    out_Callouts.bit_1 = basis_bits.bit_1
     241    out_Callouts.bit_2 = basis_bits.bit_2
     242    out_Callouts.bit_3 = basis_bits.bit_3
     243    out_Callouts.bit_4 = basis_bits.bit_4
     244    out_Callouts.bit_5 = basis_bits.bit_5
     245    out_Callouts.bit_6 = basis_bits.bit_6
     246    out_Callouts.bit_7 = basis_bits.bit_7
     247
     248   
     249    if out_Callouts.hexString_mask:
     250        NondigitHexString = lex.Hex &~ lex.Digit
     251        out_Callouts.bit_0 &= ~out_Callouts.hexString_mask
     252        out_Callouts.bit_1 &= ~out_Callouts.hexString_mask
     253        out_Callouts.bit_2 &= ~out_Callouts.hexString_mask
     254        out_Callouts.bit_3 &= ~out_Callouts.hexString_mask
     255        out_Callouts.bit_4 |= (out_Callouts.hexString_mask & NondigitHexString)
     256        carry7 = out_Callouts.bit_7 & NondigitHexString & out_Callouts.hexString_mask
     257        out_Callouts.bit_7 ^= NondigitHexString & out_Callouts.hexString_mask
     258        carry6 = out_Callouts.bit_6 & carry7
     259        out_Callouts.bit_6 ^= carry7
     260        out_Callouts.bit_5 ^= carry6
     261       
     262
     263    if escape_Callouts.Nonoct:       
     264        out_Callouts.bit_1 ^= ( lex.pdf_mod_bit_1 & escape_Callouts.Nonoct)
     265        out_Callouts.bit_2 ^= ( lex.pdf_mod_bit_2 & escape_Callouts.Nonoct)
     266        out_Callouts.bit_3 ^= ( lex.pdf_mod_bit_3 & escape_Callouts.Nonoct)
     267        out_Callouts.bit_4 ^= ( lex.pdf_mod_bit_4 & escape_Callouts.Nonoct)
     268        out_Callouts.bit_5 ^= ( lex.pdf_mod_bit_5 & escape_Callouts.Nonoct)
     269        out_Callouts.bit_6 ^= ( lex.pdf_mod_bit_6 & escape_Callouts.Nonoct)
     270        out_Callouts.bit_7 ^= ( lex.pdf_mod_bit_7 & escape_Callouts.Nonoct)
     271   
     272   
     273    out_Callouts.bit_0 = out_Callouts.bit_0 &~ out_Callouts.zeromask   
     274    out_Callouts.bit_1 = out_Callouts.bit_1 &~ out_Callouts.zeromask
     275    out_Callouts.bit_2 = out_Callouts.bit_2 &~ out_Callouts.zeromask
     276    out_Callouts.bit_3 = out_Callouts.bit_3 &~ out_Callouts.zeromask
     277    out_Callouts.bit_4 = out_Callouts.bit_4 &~ out_Callouts.zeromask
     278    out_Callouts.bit_5 = out_Callouts.bit_5 &~ out_Callouts.zeromask
     279    out_Callouts.bit_6 = out_Callouts.bit_6 &~ out_Callouts.zeromask
     280    out_Callouts.bit_7 = out_Callouts.bit_7 &~ out_Callouts.zeromask
     281   
     282   
    228283
    229284
     
    233288
    234289        Parse_Escaped(lex, parity, escape_Callouts, out_Callouts)
     290       
     291        Parse_HexStrings(lex, marker, out_Callouts)
    235292
    236293        Prepare_content_buffer(basis_bits, lex, escape_Callouts, out_Callouts)
Note: See TracChangeset for help on using the changeset viewer.