Changeset 485 for pkpgcounter
- Timestamp:
- 11/17/07 14:43:40 (17 years ago)
- Location:
- pkpgcounter/trunk
- Files:
-
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/bin/pkpgcounter
r480 r485 53 53 * ESC/PageS03 54 54 * Brother HBP 55 * Hewlett-Packard LIDIL (hpijs) 55 56 56 The sevenlatter ones, as well as some TIFF documents, are currently57 The eight latter ones, as well as some TIFF documents, are currently 57 58 only supported in page counting mode. 58 59 -
pkpgcounter/trunk/NEWS
r480 r485 21 21 pkpgcounter News : 22 22 23 * 3.30 : 24 25 - Added a minimal parser for Hewlett-Packard LIDIL documents, as 26 produced by the hpijs driver. 27 23 28 * 3.20 : 24 29 -
pkpgcounter/trunk/pkpgpdls/analyzer.py
r480 r485 29 29 30 30 import version, pdlparser, postscript, pdf, pcl345, pclxl, hbp, \ 31 escp2, dvi, tiff, ooo, zjstream, qpdl, spl1, escpages03, plain31 lidil, escp2, dvi, tiff, ooo, zjstream, qpdl, spl1, escpages03, plain 32 32 import inkcoverage 33 33 … … 166 166 ooo, \ 167 167 hbp, \ 168 lidil, \ 168 169 pcl345, \ 169 170 escp2, \ -
pkpgcounter/trunk/pkpgpdls/lidil.py
r484 r485 36 36 import pdlparser 37 37 38 # Packet types taken from hplip-2.7.10/prnt/ldl.py 39 PACKET_TYPE_COMMAND = 0 40 PACKET_TYPE_DISABLE_PACING = 1 41 PACKET_TYPE_ENABLE_PACING = 2 42 PACKET_TYPE_RESUME_NORMAL_OPERATION = 3 43 PACKET_TYPE_DISABLE_RESPONSES = 4 44 PACKET_TYPE_ENABLE_RESPONSES = 5 45 PACKET_TYPE_RESET_LIDIL = 6 46 PACKET_TYPE_SYNC = 7 47 PACKET_TYPE_SYNC_COMPLETE = 8 48 49 # Command codes we are interested in. 50 LDL_LOAD_PAGE = 1 51 LDL_EJECT_PAGE = 2 52 38 53 class Parser(pdlparser.PDLParser) : 39 54 """A parser for HP LIDIL documents.""" … … 57 72 def getJobSize(self) : 58 73 """Computes the number of pages in a HP LIDIL document.""" 59 ejectpagemarker = "$\x00\x01\x00\x00\x02" # ensure it's a complete packet (ends with '$') 60 return 0 74 pagecount = 0 75 infileno = self.infile.fileno() 76 minfile = mmap.mmap(infileno, os.fstat(infileno)[6], prot=mmap.PROT_READ, flags=mmap.MAP_SHARED) 77 pos = 0 78 try : 79 try : 80 while 1 : 81 if minfile[pos] != "$" : # Frame Sync 82 raise pdlparser.PDLParserError, "This file doesn't seem to be valid Hewlett-Packard LIDIL datas" 83 try : 84 (framesync, 85 cmdlength, 86 dummy, 87 packettype, 88 commandnumber, 89 referencenumber, 90 datalength) = unpack(">BHBBBHH", minfile[pos:pos+10]) 91 except struct.error : 92 raise pdlparser.PDLParserError, "This file doesn't seem to be valid Hewlett-Packard LIDIL datas" 93 if (packettype == PACKET_TYPE_COMMAND) \ 94 and (commandnumber == LDL_EJECT_PAGE) : 95 pagecount += 1 96 pos += (cmdlength + datalength) 97 except IndexError : # EOF ? 98 pass 99 finally : 100 minfile.close() 101 return pagecount 61 102 62 103 if __name__ == "__main__" : -
pkpgcounter/trunk/pkpgpdls/version.py
r480 r485 22 22 23 23 24 __version__ = "3. 20"24 __version__ = "3.30" 25 25 26 26 __doc__ = """pkpgcounter : a generic Page Description Languages parser.""" -
pkpgcounter/trunk/README
r480 r485 53 53 - Brother HBP 54 54 55 The seven latter ones, as well as some TIFF documents, are currently 55 - Hewlett-Packard Lightweight Imaging Device Interface Language 56 57 The eight latter ones, as well as some TIFF documents, are currently 56 58 only supported in page counting mode. 57 59