Changeset 1576 for pykota/trunk
- Timestamp:
- 06/29/04 00:38:41 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/pdlanalyzer.py
r1575 r1576 22 22 # 23 23 # $Log$ 24 # Revision 1.20 2004/06/28 22:38:41 jalet 25 # Increased speed by a factor of 2 in PCLXL parser 26 # 24 27 # Revision 1.19 2004/06/28 21:20:30 jalet 25 28 # PCLXL support now works ! … … 332 335 def handleArray(self, itemsize) : 333 336 """Handles arrays.""" 334 datatype = self.minfile[self.pos] 335 self.pos += 1 337 pos = self.pos 338 datatype = self.minfile[pos] 339 pos += 1 336 340 length = self.tags[ord(datatype)] 337 if length is None : 338 raise PDLAnalyzerError, "Error on array length at %s" % self.pos 339 elif callable(length) : 341 if callable(length) : 342 self.pos = pos 340 343 length = length() 341 pos = self.pos344 pos = self.pos 342 345 posl = pos + length 343 346 sarraysize = self.minfile[pos:posl] … … 372 375 def embeddedDataSmall(self) : 373 376 """Handle small amounts of data.""" 374 length = ord(self.minfile[self.pos]) 375 self.pos += 1 377 pos = self.pos 378 length = ord(self.minfile[pos]) 379 self.pos = pos + 1 376 380 return length 377 381 … … 401 405 """Counts pages in a PCLXL (PCL6) document.""" 402 406 infileno = self.infile.fileno() 403 self.minfile = mmap.mmap(infileno, os.fstat(infileno).st_size, access=mmap.ACCESS_READ) 407 self.minfile = minfile = mmap.mmap(infileno, os.fstat(infileno).st_size, access=mmap.ACCESS_READ) 408 tags = self.tags 404 409 self.pagecount = 0 405 self.pos = self.infile.tell()410 self.pos = pos = self.infile.tell() 406 411 try : 407 412 while 1 : 408 char = self.minfile[self.pos]409 self.pos += 1410 length = self.tags[ord(char)]411 if not length : 413 char = minfile[pos] 414 pos += 1 415 length = tags[ord(char)] 416 if not length : 412 417 continue 413 418 if callable(length) : 419 self.pos = pos 414 420 length = length() 415 self.pos += length 421 pos = self.pos 422 pos += length 416 423 except IndexError : # EOF ? 417 424 self.minfile.close() # reached EOF