Index: /pkpgcounter/trunk/debian/control
===================================================================
--- /pkpgcounter/trunk/debian/control (revision 476)
+++ /pkpgcounter/trunk/debian/control (revision 480)
@@ -43,5 +43,7 @@
    * ESC/PageS03
  .
- The six latter formats, as well as some TIFF files, are
+   * Brother HBP
+ .
+ The seven latter formats, as well as some TIFF files, are
  only supported in page counting mode.
  .
Index: /pkpgcounter/trunk/tests/runtest.sh
===================================================================
--- /pkpgcounter/trunk/tests/runtest.sh (revision 463)
+++ /pkpgcounter/trunk/tests/runtest.sh (revision 480)
@@ -19,5 +19,77 @@
 echo -n "Generating testsuite..."
 gunzip <master.ps.gz >master2.ps
-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
+for device in hl1240 \
+              hl1250 \
+              hl7x0 \
+              lj250 \
+              lj4dithp \
+              ljet2p \
+              ljet4pjl \
+              ljetplus \
+              laserjet \
+              ljet3 \
+              ljet4 \
+              lj5gray \
+              lj5mono \
+              pxlmono \
+              pxlcolor \
+              pdfwrite \
+              pswrite \
+              psgray \
+              psmono \
+              psrgb \
+              epson \
+              epsonc \
+              eps9mid \
+              eps9high \
+              stcolor \
+              st800 \
+              escp \
+              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
     if ! [ -f "testsuite.$device" ]  ; then
         gs -dQUIET -dBATCH -dNOPAUSE -sOutputFile="testsuite.$device" -sDEVICE="$device" master2.ps ; 
Index: /pkpgcounter/trunk/pkpgpdls/hbp.py
===================================================================
--- /pkpgcounter/trunk/pkpgpdls/hbp.py (revision 480)
+++ /pkpgcounter/trunk/pkpgpdls/hbp.py (revision 480)
@@ -0,0 +1,76 @@
+#! /usr/bin/env python
+# -*- coding: ISO-8859-15 -*-
+#
+# pkpgcounter : a generic Page Description Language parser
+#
+# (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet <alet@librelogiciel.com>
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# $Id$
+#
+
+"""This modules implements a page counter for Brother HBP documents."""
+
+import sys
+import os
+import mmap
+from struct import unpack
+
+import pdlparser
+
+class Parser(pdlparser.PDLParser) :
+    """A parser for HBP documents."""
+    def isValid(self) :        
+        """Returns True if data is HBP, else False."""
+        if self.firstblock.find("@PJL ENTER LANGUAGE = HBP\n") != -1 :
+            self.logdebug("DEBUG: Input file is in the HBP format.")
+            return True
+        else :    
+            return False
+            
+    def getJobSize(self) :
+        """Counts pages in a HBP document.
+        
+           Algorithm by Jerome Alet.
+           
+           The documentation used for this was :
+         
+           http://sf.net/projects/hbp-for-brother/
+           
+           IMPORTANT : this may not work since @F should be sufficient,
+           but the documentation really is unclear and I don't know
+           how to skip raster data blocks for now.
+        """
+        infileno = self.infile.fileno()
+        minfile = mmap.mmap(infileno, os.fstat(infileno)[6], prot=mmap.PROT_READ, flags=mmap.MAP_SHARED)
+        pagecount = 0
+        
+        formfeed = "@G" + chr(0) + chr(0) + chr(1) + chr(0xff) + "@F"
+        fflen = len(formfeed)
+        pos = 0
+        try :
+            while True :
+                if (minfile[pos] == "@") \
+                   and (minfile[pos:pos+fflen] == formfeed) :
+                    pagecount += 1
+                    pos += fflen
+                else :        
+                    pos += 1
+        except IndexError : # EOF ?
+            pass
+        minfile.close() # reached EOF
+        return pagecount
+        
+if __name__ == "__main__" :    
+    pdlparser.test(Parser)
Index: /pkpgcounter/trunk/pkpgpdls/analyzer.py
===================================================================
--- /pkpgcounter/trunk/pkpgpdls/analyzer.py (revision 476)
+++ /pkpgcounter/trunk/pkpgpdls/analyzer.py (revision 480)
@@ -28,5 +28,5 @@
 import tempfile
 
-import version, pdlparser, postscript, pdf, pcl345, pclxl, \
+import version, pdlparser, postscript, pdf, pcl345, pclxl, hbp, \
        escp2, dvi, tiff, ooo, zjstream, qpdl, spl1, escpages03, plain
 import inkcoverage
@@ -165,4 +165,5 @@
                            zjstream, \
                            ooo, \
+                           hbp, \
                            pcl345, \
                            escp2, \
Index: /pkpgcounter/trunk/pkpgpdls/version.py
===================================================================
--- /pkpgcounter/trunk/pkpgpdls/version.py (revision 478)
+++ /pkpgcounter/trunk/pkpgpdls/version.py (revision 480)
@@ -22,5 +22,5 @@
 
 
-__version__ = "3.11alpha"
+__version__ = "3.20"
 
 __doc__ = """pkpgcounter : a generic Page Description Languages parser."""
Index: /pkpgcounter/trunk/bin/pkpgcounter
===================================================================
--- /pkpgcounter/trunk/bin/pkpgcounter (revision 476)
+++ /pkpgcounter/trunk/bin/pkpgcounter (revision 480)
@@ -52,6 +52,7 @@
     * Samsung SPL1
     * ESC/PageS03
+    * Brother HBP
 
-The six latter ones, as well as some TIFF documents, are currently 
+The seven latter ones, as well as some TIFF documents, are currently 
 only supported in page counting mode. 
 
Index: /pkpgcounter/trunk/man/pkpgcounter.1
===================================================================
--- /pkpgcounter/trunk/man/pkpgcounter.1 (revision 476)
+++ /pkpgcounter/trunk/man/pkpgcounter.1 (revision 480)
@@ -1,8 +1,8 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.36.
-.TH PKPGCOUNTER "1" "September 2007" "C@LL - Conseil Internet & Logiciels Libres" "User Commands"
+.TH PKPGCOUNTER "1" "October 2007" "C@LL - Conseil Internet & Logiciels Libres" "User Commands"
 .SH NAME
-pkpgcounter \- manual page for pkpgcounter 3.10
+pkpgcounter \- manual page for pkpgcounter 3.20
 .SH DESCRIPTION
-pkpgcounter v3.10 (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet
+pkpgcounter v3.20 (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet
 .PP
 pkpgcounter is a generic Page Description Language parser.
@@ -29,6 +29,7 @@
 * Samsung SPL1
 * ESC/PageS03
+* Brother HBP
 .PP
-The six latter ones, as well as some TIFF documents, are currently
+The seven latter ones, as well as some TIFF documents, are currently
 only supported in page counting mode.
 .PP
Index: /pkpgcounter/trunk/NEWS
===================================================================
--- /pkpgcounter/trunk/NEWS (revision 473)
+++ /pkpgcounter/trunk/NEWS (revision 480)
@@ -21,4 +21,11 @@
 pkpgcounter News :
 
+  * 3.20 :
+   
+    - Added a minimal parser for Brother HBP documents.
+    
+    - Added support for Canon ImageRunner commands to the PCLXL parser,
+      much like it was already done for the PCL3/4/5 parser.
+      
   * 3.10 :
   
Index: /pkpgcounter/trunk/README
===================================================================
--- /pkpgcounter/trunk/README (revision 473)
+++ /pkpgcounter/trunk/README (revision 480)
@@ -51,5 +51,7 @@
         - ESC/PageS03
         
-The six latter ones, as well as some TIFF documents, are currently 
+        - Brother HBP
+        
+The seven latter ones, as well as some TIFF documents, are currently 
 only supported in page counting mode. 
 
