Changeset 398 for pkpgcounter/trunk

Show
Ignore:
Timestamp:
09/08/06 14:40:20 (18 years ago)
Author:
jerome
Message:

Improved parser a bit more.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pkpgpdls/newpcl345.py

    r397 r398  
    109109        """Reads a byte from the input stream.""" 
    110110        tag = ord(self.minfile[self.pos]) 
    111         if tag == 0x0c : 
    112             self.logdebug("%08x ====> %02x %02x %02x %02x" % 
    113                  (self.pos, 
    114                  ord(self.minfile[self.pos-2]), 
    115                  ord(self.minfile[self.pos-1]), 
    116                  ord(self.minfile[self.pos-0]), 
    117                  ord(self.minfile[self.pos+1]))) 
    118111        self.pos += 1 
    119112        return tag 
     
    121114    def endPage(self) :     
    122115        """Handle the FF marker.""" 
    123         self.logdebug("FORMFEED %i at %08x" % (self.pagecount, self.pos-1)) 
     116        #self.logdebug("FORMFEED %i at %08x" % (self.pagecount, self.pos-1)) 
    124117        self.pagecount += 1 
    125118         
     
    157150    def enterHPGL2(self) :     
    158151        """Enters HPGL2 mode.""" 
    159         self.logdebug("ENTERHPGL2 %08x" % self.pos) 
     152        #self.logdebug("ENTERHPGL2 %08x" % self.pos) 
    160153        self.hpgl2 = True 
    161154         
    162155    def exitHPGL2(self) :     
    163156        """Exits HPGL2 mode.""" 
    164         self.logdebug("EXITHPGL2 %08x" % self.pos) 
     157        #self.logdebug("EXITHPGL2 %08x" % self.pos) 
    165158        self.hpgl2 = False 
    166159         
     
    468461        self.logdebug("MediaSourcesNOTDefault : \t%i" % (len(self.mediasourcesvalues) - nbmediasourcesdefault)) 
    469462        self.logdebug("Orientations : \t\t\t%s" % self.orientationsvalues) 
    470         self.logdebug("NbOrientations : \t\t\t%i" % len(self.orientationsvalues)) 
     463        nborientations = len(self.orientationsvalues) 
     464        self.logdebug("NbOrientations : \t\t\t%i" % nborientations) 
    471465        self.logdebug("StartGfx : \t\t\t%s" % len(self.startgfx)) 
    472466        self.logdebug("EndGfx : \t\t\t%s" % len(self.endgfx)) 
     
    474468        self.logdebug("NbBackSides : \t\t\t%i" % len(self.backsides)) 
    475469         
     470        if len(self.startgfx) == len(self.endgfx) == 0 : 
     471            if self.resets % 2 : 
     472                if nborientations == self.pagecount + 1 : 
     473                    self.logdebug("Adjusting PageCount : +1") 
     474                    self.pagecount += 1 
     475                elif nborientations == self.pagecount - 1 : 
     476                    self.logdebug("Adjusting PageCount : -1") 
     477                    self.pagecount -= 1 
    476478        return self.pagecount or nbmediasourcesdefault 
    477479