Index: pykota/trunk/pykota/pdlanalyzer.py
===================================================================
--- pykota/trunk/pykota/pdlanalyzer.py (revision 1572)
+++ pykota/trunk/pykota/pdlanalyzer.py (revision 1573)
@@ -22,4 +22,7 @@
 #
 # $Log$
+# Revision 1.17  2004/06/26 23:20:01  jalet
+# Additionnal speedup for GhostScript generated PCL5 files
+#
 # Revision 1.16  2004/06/26 15:31:00  jalet
 # mmap reintroduced in PCL5 parser
@@ -114,5 +117,5 @@
     def getJobSize(self) :    
         """Counts pages in a PDF document."""
-        regexp = re.compile(r"(/Type) ?(/Page)[/ \r\n]")
+        regexp = re.compile(r"(/Type) ?(/Page)[/ \t\r\n]")
         pagecount = 0
         for line in self.infile.xreadlines() : 
@@ -151,5 +154,4 @@
                      "*c" : "W", 
                      "(f" : "W", 
-                     "*b" : "VW",
                      "(s" : "W", 
                      ")s" : "W", 
@@ -157,4 +159,5 @@
                      "&l" : "XH",
                      "&a" : "G",
+                     # "*b" : "VW", # treated specially because it occurs very often
                    }  
         pagecount = resets = ejects = backsides = 0
@@ -192,30 +195,32 @@
                         continue             # skip to next tag
                     tag = tagstart + minfile[pos] ; pos += 1
-                    try :
-                        tagend = tagsends[tag]
-                    except KeyError :    
-                        pass    # Unsupported PCL tag
+                    if tag == "*b" : 
+                        tagend = "VW"
                     else :    
-                        # Now read the numeric argument
-                        size = 0
-                        while 1 :
-                            char = minfile[pos] ; pos += 1
-                            if not char.isdigit() :
-                                break
-                            size = (size * 10) + int(char)    
-                        if char in tagend :    
-                            if (tag == "&l") and (char == "X") : # copies for current page
-                                copies[pagecount] = size
-                            elif (tag == "&l") and (char == "H") and (size == 0) :    
-                                ejects += 1         # Eject 
-                            elif (tag == "&a") and (size == 2) :
-                                backsides += 1      # Back side in duplex mode
-                            else :    
-                                # we just ignore the block.
-                                if tag == "&n" : 
-                                    # we have to take care of the operation id byte
-                                    # which is before the string itself
-                                    size += 1
-                                pos += size    
+                        try :
+                            tagend = tagsends[tag]
+                        except KeyError :    
+                            continue # Unsupported PCL tag
+                    # Now read the numeric argument
+                    size = 0
+                    while 1 :
+                        char = minfile[pos] ; pos += 1
+                        if not char.isdigit() :
+                            break
+                        size = (size * 10) + int(char)    
+                    if char in tagend :    
+                        if (tag == "&l") and (char == "X") : # copies for current page
+                            copies[pagecount] = size
+                        elif (tag == "&l") and (char == "H") and (size == 0) :    
+                            ejects += 1         # Eject 
+                        elif (tag == "&a") and (size == 2) :
+                            backsides += 1      # Back side in duplex mode
+                        else :    
+                            # we just ignore the block.
+                            if tag == "&n" : 
+                                # we have to take care of the operation id byte
+                                # which is before the string itself
+                                size += 1
+                            pos += size    
         except IndexError : # EOF ?
             minfile.close() # reached EOF
Index: pykota/trunk/NEWS
===================================================================
--- pykota/trunk/NEWS (revision 1572)
+++ pykota/trunk/NEWS (revision 1573)
@@ -24,4 +24,7 @@
     - 1.19alpha27 :
     
+        - Additionnal 10% speed increase in PCL5 parser for GhostScript
+          generated files (untested yet with other PCL files).
+          
         - Reintroduced the use of mmap in PCL5 parser : this speedups
           PCL5 parsing by almost 4 times.
