Changeset 394 for pkpgcounter/trunk/pkpgpdls/newpcl345.py
- Timestamp:
- 09/08/06 07:50:41 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pkpgpdls/newpcl345.py
r393 r394 104 104 dic[attribute] = value 105 105 106 def readByte(self) : 107 """Reads a byte from the input stream.""" 108 tag = ord(self.minfile[self.pos]) 109 self.pos += 1 110 self.logdebug("BYTE %02x" % tag) 111 return tag 112 106 113 def endPage(self) : 107 114 """Handle the FF marker.""" 115 self.logdebug("FORMFEED %i" % self.pagecount) 108 116 self.pagecount += 1 109 self.logdebug("ENDPAGE %i" % self.pagecount)110 117 111 118 def escPercent(self) : … … 117 124 def handleTag(self, tagtable) : 118 125 """Handles tags.""" 119 tag = ord(self.minfile[self.pos]) 120 self.pos += 1 121 tagtable[tag]() 126 tagtable[self.readByte()]() 122 127 123 128 def escape(self) : … … 265 270 value = None 266 271 while 1 : 267 char = self.minfile[self.pos]272 char = chr(self.readByte()) 268 273 if char == ESCAPE : 274 self.pos -= 1 # Adjust position 269 275 return (None, None) 270 self.pos += 1271 276 if char == '-' : 272 277 sign = -1 … … 311 316 312 317 tags = [ lambda : None] * 256 313 tags[ FORMFEED] = self.endPage314 tags[ ESCAPE] = self.escape318 tags[ord(FORMFEED)] = self.endPage 319 tags[ord(ESCAPE)] = self.escape 315 320 316 321 self.esctags = [ lambda : None ] * 256 … … 337 342 try : 338 343 while 1 : 339 tag = ord(minfile[self.pos]) 340 self.logdebug("%08x ===> %02x" % (self.pos, tag)) 341 self.pos += 1 344 tag = self.readByte() 345 self.logdebug("%08x ===> %02x" % (self.pos-1, tag)) 342 346 tags[tag]() 343 347 except IndexError : # EOF ?