Changeset 293
- Timestamp:
- 12/07/05 08:31:08 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pkpgpdls/pclxl.py
r269 r293 121 121 savepos = pos 122 122 pos = pos - 1 123 startpos = size = None 123 124 while pos > 0 : # safety check : don't go back to far ! 124 125 val = ord(minfile[pos]) 125 126 pos -= 1 126 127 if val == 0xc8 : 128 length = self.tags[ord(minfile[pos+2])] # will probably always be a byte or uint16 129 if length == 1 : 130 startpos = pos + 4 131 size = unpack("B", self.minfile[pos+3:startpos])[0] 132 elif length == 2 : 133 startpos = pos + 5 134 size = unpack(self.endianness + "H", self.minfile[pos+3:startpos])[0] 135 elif length == 4 : 136 startpos = pos + 7 137 size = unpack(self.endianness + "I", self.minfile[pos+3:startpos])[0] 138 else : 139 raise pdlparser.PDLParserError, "Error on size at %s" % pos+2 127 140 break 128 mediatypelabel = minfile[ pos:savepos] # TODO : INCORRECT, WE HAVE TO STRIP OUT THE UBYTE ARRAY'S LENGTH !!!141 mediatypelabel = minfile[startpos:startpos+size] 129 142 # else : TODO : CUSTOM MEDIA SIZE AND UNIT ! 130 143 else : … … 297 310 if not line : 298 311 break 299 if line[1:12] == " HP-PCL XL;" : 312 pos = line.find(" HP-PCL XL;") 313 if pos != -1 : 300 314 found = 1 301 endian = ord(line[ 0])315 endian = ord(line[pos - 1]) 302 316 if endian == 0x29 : 303 317 self.littleEndian()