Changeset 310 for proto


Ignore:
Timestamp:
Sep 25, 2009, 11:14:01 AM (10 years ago)
Author:
cameron
Message:

Use raw byte readfile; fix advance_bit7 temp.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/u8u16.py

    r278 r310  
    1919
    2020import byteclass
     21
     22def readfile(filename):
     23        f = open(filename, 'r')
     24        contents = f.read()
     25        f.close()
     26        return contents
     27
    2128
    2229def ShiftBack(stream):
     
    154161        u16lo[0] = u16lo[0] | (u8.scope43 & bitutil.Advance(s42lo0))
    155162        borrow1 = s42lo1 & ~u8bit[2]
    156         bitutil.Advance_bit7 = bitutil.Advance(u8bit[7])
    157         s42hi7 = bitutil.Advance_bit7 ^ borrow1
     163        Advance_bit7 = bitutil.Advance(u8bit[7])
     164        s42hi7 = Advance_bit7 ^ borrow1
    158165        u16hi[7]= u16hi[7] | (u8.scope43 & bitutil.Advance(s42hi7))
    159         borrow2 = borrow1 & ~bitutil.Advance_bit7
     166        borrow2 = borrow1 & ~Advance_bit7
    160167        s42hi6 = bitutil.Advance(u8bit[6]) ^ borrow2
    161168        u16hi[6] = u16hi[6] | (u8.scope43 & bitutil.Advance(s42hi6))
     
    192199                outfile = open(sys.argv[2],"w")
    193200        else: outfile = sys.stdout
    194         u8data = bitutil.readfile(sys.argv[1])
     201        u8data = readfile(sys.argv[1])
    195202        u8len = len(u8data)
    196         (u8bit, EOF_mask) = bitutil.transpose_streams(u8data)
     203        (u8bit, EOF_mask) = bitutil.transpose_u8_byte_streams(u8data)
    197204        (u8, control, lex) = byteclass.classify_bytes(u8bit)
    198205        u8 = validate_utf8(u8)
Note: See TracChangeset for help on using the changeset viewer.