Changeset 1580
- Timestamp:
- 06/29/04 16:21:41 (20 years ago)
- Location:
- pykota/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/pdlanalyzer.py
r1577 r1580 22 22 # 23 23 # $Log$ 24 # Revision 1.22 2004/06/29 14:21:41 jalet 25 # Smallish optimization 26 # 24 27 # Revision 1.21 2004/06/28 23:11:26 jalet 25 28 # Code de-factorization in PCLXL parser … … 93 96 import os 94 97 import re 95 import struct 98 from struct import unpack 96 99 import tempfile 97 100 import mmap … … 347 350 pos = self.pos 348 351 posl = pos + length 349 sarraysize = self.minfile[pos:posl]350 352 self.pos = posl 351 353 if length == 1 : 352 return struct.unpack(self.endianness + "B", sarraysize)[0]354 return unpack("B", self.minfile[pos:posl])[0] 353 355 elif length == 2 : 354 return struct.unpack(self.endianness + "H", sarraysize)[0]356 return unpack(self.endianness + "H", self.minfile[pos:posl])[0] 355 357 elif length == 4 : 356 return struct.unpack(self.endianness + "I", sarraysize)[0]358 return unpack(self.endianness + "I", self.minfile[pos:posl])[0] 357 359 else : 358 360 raise PDLAnalyzerError, "Error on array size at %s" % self.pos … … 369 371 pos = self.pos 370 372 posl = pos + length 371 sarraysize = self.minfile[pos:posl]372 373 self.pos = posl 373 374 if length == 1 : 374 return 2 * struct.unpack(self.endianness + "B", sarraysize)[0]375 return 2 * unpack("B", self.minfile[pos:posl])[0] 375 376 elif length == 2 : 376 return 2 * struct.unpack(self.endianness + "H", sarraysize)[0]377 return 2 * unpack(self.endianness + "H", self.minfile[pos:posl])[0] 377 378 elif length == 4 : 378 return 2 * struct.unpack(self.endianness + "I", sarraysize)[0]379 return 2 * unpack(self.endianness + "I", self.minfile[pos:posl])[0] 379 380 else : 380 381 raise PDLAnalyzerError, "Error on array size at %s" % self.pos … … 391 392 pos = self.pos 392 393 posl = pos + length 393 sarraysize = self.minfile[pos:posl]394 394 self.pos = posl 395 395 if length == 1 : 396 return 4 * struct.unpack(self.endianness + "B", sarraysize)[0]396 return 4 * unpack("B", self.minfile[pos:posl])[0] 397 397 elif length == 2 : 398 return 4 * struct.unpack(self.endianness + "H", sarraysize)[0]398 return 4 * unpack(self.endianness + "H", self.minfile[pos:posl])[0] 399 399 elif length == 4 : 400 return 4 * struct.unpack(self.endianness + "I", sarraysize)[0]400 return 4 * unpack(self.endianness + "I", self.minfile[pos:posl])[0] 401 401 else : 402 402 raise PDLAnalyzerError, "Error on array size at %s" % self.pos … … 411 411 def embeddedData(self) : 412 412 """Handle normal amounts of data.""" 413 fmt = self.endianness + "I"414 413 pos = self.pos 415 414 pos4 = pos + 4 416 data = self.minfile[pos:pos4]417 415 self.pos = pos4 418 return struct.unpack(fmt, data)[0]416 return unpack(self.indianness + "I", self.minfile[pos:pos4])[0] 419 417 420 418 def littleEndian(self) : -
pykota/trunk/README
r1578 r1580 119 119 120 120 - Account balances can be set, incremented, or 121 decremented. 121 decremented. History of payments is kept. 122 122 123 123 - Both printers and users can be automatically added on