Changeset 3513

Show
Ignore:
Timestamp:
11/22/09 12:01:28 (14 years ago)
Author:
jerome
Message:

Fixes #50. Such files use undocumented values in PCLXL class 3.0
streams. The 0x46 tag was already recognized, now the (0x31, 0x90) tag
is handled, although we don't have any way to know for sure if it's
fixed for good or not...

Files:
1 modified

Legend:

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

    r3491 r3513  
    295295        return 0 
    296296 
     297    def x31_class3(self, nextpos) : 
     298        """Undocumented tag 0x13 in class 3.0 streams.""" 
     299        #self.logdebug("x31 at 0x%08x" % (nextpos-1)) 
     300        minfile = self.minfile 
     301        val = ord(minfile[nextpos]) 
     302        if val == 0x90 : # Should we take care of this or not ? It's undocumented after all ! 
     303            # BTW we don't know if it's the 0x31 or the 0x90 which counts, since 0x90 is reserved for future use 
     304            try : 
     305                return unpack(self.unpackType[4], self.minfile[nextpos+1:nextpos+5])[0] + 5 
     306            except KeyError : 
     307                raise pdlparser.PDLParserError, "Error on size '%s' at %x" % (length, nextpos+1) 
     308        return 0 
     309 
    297310    def x46_class3(self, nextpos) : 
    298311        """Undocumented tag 0x46 in class 3.0 streams.""" 
     312        #self.logdebug("x46 at 0x%08x" % (nextpos-1)) 
    299313        pos = nextpos - 3 
    300314        minfile = self.minfile 
    301315        val = ord(minfile[pos]) 
    302316        while val == 0xf8 : 
     317            #self.logdebug("x46 continues at 0x%08x with 0x%02x" % (pos, val)) 
    303318            funcid = ord(minfile[pos+1]) 
    304319            try : 
     
    308323                break 
    309324            else : 
     325                #self.logdebug("x46 funcid 0x%02x" % funcid) 
    310326                pos -= offset 
     327                #self.logdebug("x46 new position 0x%08x" % pos) 
    311328                length = self.tags[ord(self.minfile[pos])] 
    312329                if callable(length) : 
    313330                    length = length(pos+1) 
     331                #self.logdebug("x46 length %i" % length) 
    314332                if funcid == 0x92 : # we want to skip these blocks 
    315333                    try : 
     
    420438        self.tags[0x29] = self.littleEndian # LittleEndian 
    421439 
     440        self.tags[0x31] = self.x31_class3   # What's this ? Does it always follow 0x46 ? 
    422441        self.tags[0x43] = self.beginPage    # BeginPage 
    423442        self.tags[0x44] = self.endPage      # EndPage 
     
    597616                    except OverflowError : 
    598617                        pos = oldpos + 1 
     618                    #self.logdebug("0x%08x : 0x%02x" % (pos, tag)) 
    599619                    pos += 1 
    600620                    length = tags[tag]