Changeset 480

Show
Ignore:
Timestamp:
10/01/07 23:24:10 (15 years ago)
Author:
jerome
Message:

v3.20 is out with support for Brother HBP and improved PCLXL
parser wrt the inclusion of Canon ImageRunner? commands.

Location:
pkpgcounter/trunk
Files:
8 modified
1 copied

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/bin/pkpgcounter

    r476 r480  
    5252    * Samsung SPL1 
    5353    * ESC/PageS03 
     54    * Brother HBP 
    5455 
    55 The six latter ones, as well as some TIFF documents, are currently  
     56The seven latter ones, as well as some TIFF documents, are currently  
    5657only supported in page counting mode.  
    5758 
  • pkpgcounter/trunk/debian/control

    r476 r480  
    4343   * ESC/PageS03 
    4444 . 
    45  The six latter formats, as well as some TIFF files, are 
     45   * Brother HBP 
     46 . 
     47 The seven latter formats, as well as some TIFF files, are 
    4648 only supported in page counting mode. 
    4749 . 
  • pkpgcounter/trunk/man/pkpgcounter.1

    r476 r480  
    11.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.36. 
    2 .TH PKPGCOUNTER "1" "September 2007" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
     2.TH PKPGCOUNTER "1" "October 2007" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NAME 
    4 pkpgcounter \- manual page for pkpgcounter 3.10 
     4pkpgcounter \- manual page for pkpgcounter 3.20 
    55.SH DESCRIPTION 
    6 pkpgcounter v3.10 (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet 
     6pkpgcounter v3.20 (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet 
    77.PP 
    88pkpgcounter is a generic Page Description Language parser. 
     
    2929* Samsung SPL1 
    3030* ESC/PageS03 
     31* Brother HBP 
    3132.PP 
    32 The six latter ones, as well as some TIFF documents, are currently 
     33The seven latter ones, as well as some TIFF documents, are currently 
    3334only supported in page counting mode. 
    3435.PP 
  • pkpgcounter/trunk/NEWS

    r473 r480  
    2121pkpgcounter News : 
    2222 
     23  * 3.20 : 
     24    
     25    - Added a minimal parser for Brother HBP documents. 
     26     
     27    - Added support for Canon ImageRunner commands to the PCLXL parser, 
     28      much like it was already done for the PCL3/4/5 parser. 
     29       
    2330  * 3.10 : 
    2431   
  • pkpgcounter/trunk/pkpgpdls/analyzer.py

    r476 r480  
    2828import tempfile 
    2929 
    30 import version, pdlparser, postscript, pdf, pcl345, pclxl, \ 
     30import version, pdlparser, postscript, pdf, pcl345, pclxl, hbp, \ 
    3131       escp2, dvi, tiff, ooo, zjstream, qpdl, spl1, escpages03, plain 
    3232import inkcoverage 
     
    165165                           zjstream, \ 
    166166                           ooo, \ 
     167                           hbp, \ 
    167168                           pcl345, \ 
    168169                           escp2, \ 
  • pkpgcounter/trunk/pkpgpdls/hbp.py

    r463 r480  
    2121# 
    2222 
    23 """This modules implements a page counter for DVI documents.""" 
     23"""This modules implements a page counter for Brother HBP documents.""" 
    2424 
    2525import sys 
     
    3131 
    3232class Parser(pdlparser.PDLParser) : 
    33     """A parser for DVI documents.""" 
    34     totiffcommands = [ 'cat >%(fname)s && dvips -q -o - %(fname)s | gs -sDEVICE=tiff24nc -dPARANOIDSAFER -dNOPAUSE -dBATCH -dQUIET -r%(dpi)i -sOutputFile="%(fname)s" -' ] 
     33    """A parser for HBP documents.""" 
    3534    def isValid(self) :         
    36         """Returns True if data is DVI, else False.""" 
    37         try : 
    38             if (ord(self.firstblock[0]) == 0xf7) and (ord(self.lastblock[-1]) == 0xdf) : 
    39                 self.logdebug("DEBUG: Input file is in the DVI format.") 
    40                 return True 
    41             else :     
    42                 return False 
    43         except IndexError :           
     35        """Returns True if data is HBP, else False.""" 
     36        if self.firstblock.find("@PJL ENTER LANGUAGE = HBP\n") != -1 : 
     37            self.logdebug("DEBUG: Input file is in the HBP format.") 
     38            return True 
     39        else :     
    4440            return False 
    4541             
    4642    def getJobSize(self) : 
    47         """Counts pages in a DVI document. 
     43        """Counts pages in a HBP document. 
    4844         
    4945           Algorithm by Jerome Alet. 
     
    5147           The documentation used for this was : 
    5248          
    53            http://www.math.umd.edu/~asnowden/comp-cont/dvi.html 
     49           http://sf.net/projects/hbp-for-brother/ 
     50            
     51           IMPORTANT : this may not work since @F should be sufficient, 
     52           but the documentation really is unclear and I don't know 
     53           how to skip raster data blocks for now. 
    5454        """ 
    5555        infileno = self.infile.fileno() 
    5656        minfile = mmap.mmap(infileno, os.fstat(infileno)[6], prot=mmap.PROT_READ, flags=mmap.MAP_SHARED) 
    5757        pagecount = 0 
    58         pos = -1 
    59         eofchar = chr(0xdf) 
    60         postchar = chr(0xf8) 
     58         
     59        formfeed = "@G" + chr(0) + chr(0) + chr(1) + chr(0xff) + "@F" 
     60        fflen = len(formfeed) 
     61        pos = 0 
    6162        try : 
    62             while minfile[pos] == eofchar : 
    63                 pos -= 1 
    64             idbyte = minfile[pos]     
    65             if idbyte != minfile[1] : 
    66                 raise IndexError, "Invalid DVI file." 
    67             pos = unpack(">I", minfile[pos - 4:pos])[0] 
    68             if minfile[pos] != postchar : 
    69                 raise IndexError, "Invalid DVI file." 
    70             pagecount = unpack(">H", minfile[pos + 27: pos + 29])[0] 
     63            while True : 
     64                if (minfile[pos] == "@") \ 
     65                   and (minfile[pos:pos+fflen] == formfeed) : 
     66                    pagecount += 1 
     67                    pos += fflen 
     68                else :         
     69                    pos += 1 
    7170        except IndexError : # EOF ? 
    7271            pass 
  • pkpgcounter/trunk/pkpgpdls/version.py

    r478 r480  
    2222 
    2323 
    24 __version__ = "3.11alpha" 
     24__version__ = "3.20" 
    2525 
    2626__doc__ = """pkpgcounter : a generic Page Description Languages parser.""" 
  • pkpgcounter/trunk/README

    r473 r480  
    5151        - ESC/PageS03 
    5252         
    53 The six latter ones, as well as some TIFF documents, are currently  
     53        - Brother HBP 
     54         
     55The seven latter ones, as well as some TIFF documents, are currently  
    5456only supported in page counting mode.  
    5557 
  • pkpgcounter/trunk/tests/runtest.sh

    r463 r480  
    1919echo -n "Generating testsuite..." 
    2020gunzip <master.ps.gz >master2.ps 
    21 for device in cups lj250 lj4dithp ljet2p ljet4pjl ljetplus laserjet ljet3 ljet4 lj5gray lj5mono pxlmono pxlcolor pdfwrite pswrite psgray psmono psrgb epson epsonc eps9mid eps9high stcolor st800 escp escpc pcl3 cdeskjet cdj1600 cdj500 cdj550 cdj670 cdj850 cdj880 cdj890 cdj970 cdjcolor cdjmono dj505j djet500 djet500c hpdj1120c hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510 hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c hpdj690c hpdj850c hpdj855c hpdj870c hpdj890c hpdjplus hpdjportable tiff12nc tiff24nc tiffcrle tiffg3 tiffg32d tiffg4 tifflzw tiffpack ; do 
     21for device in hl1240 \ 
     22              hl1250 \ 
     23              hl7x0 \ 
     24              lj250 \ 
     25              lj4dithp \ 
     26              ljet2p \ 
     27              ljet4pjl \ 
     28              ljetplus \ 
     29              laserjet \ 
     30              ljet3 \ 
     31              ljet4 \ 
     32              lj5gray \ 
     33              lj5mono \ 
     34              pxlmono \ 
     35              pxlcolor \ 
     36              pdfwrite \ 
     37              pswrite \ 
     38              psgray \ 
     39              psmono \ 
     40              psrgb \ 
     41              epson \ 
     42              epsonc \ 
     43              eps9mid \ 
     44              eps9high \ 
     45              stcolor \ 
     46              st800 \ 
     47              escp \ 
     48              pcl3 \ 
     49              cdeskjet \ 
     50              cdj1600 \ 
     51              cdj500 \ 
     52              cdj550 \ 
     53              cdj670 \ 
     54              cdj850 \ 
     55              cdj880 \ 
     56              cdj890 \ 
     57              cdj970 \ 
     58              cdjcolor \ 
     59              cdjmono \ 
     60              dj505j \ 
     61              djet500 \ 
     62              djet500c \ 
     63              hpdj1120c \ 
     64              hpdj310 \ 
     65              hpdj320 \ 
     66              hpdj340 \ 
     67              hpdj400 \ 
     68              hpdj500 \ 
     69              hpdj500c \ 
     70              hpdj510 \ 
     71              hpdj520 \ 
     72              hpdj540 \ 
     73              hpdj550c \ 
     74              hpdj560c \ 
     75              hpdj600 \ 
     76              hpdj660c \ 
     77              hpdj670c \ 
     78              hpdj680c \ 
     79              hpdj690c \ 
     80              hpdj850c \ 
     81              hpdj855c \ 
     82              hpdj870c \ 
     83              hpdj890c \ 
     84              hpdjplus \ 
     85              hpdjportable \ 
     86              tiff12nc \ 
     87              tiff24nc \ 
     88              tiffcrle \ 
     89              tiffg3 \ 
     90              tiffg32d \ 
     91              tiffg4 \ 
     92              tifflzw \ 
     93              tiffpack ; do 
    2294    if ! [ -f "testsuite.$device" ]  ; then 
    2395        gs -dQUIET -dBATCH -dNOPAUSE -sOutputFile="testsuite.$device" -sDEVICE="$device" master2.ps ;