Changeset 493 for pkpgcounter/trunk/pkpgpdls/analyzer.py
- Timestamp:
- 11/21/07 16:41:06 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pkpgpdls/analyzer.py
r492 r493 136 136 if not os.stat(self.filename).st_size : 137 137 raise pdlparser.PDLParserError, "input file %s is empty !" % str(self.filename) 138 139 # Now read first and last block of the input file 140 # to be able to detect the real file format and the parser to use. 141 firstblock = self.workfile.read(pdlparser.FIRSTBLOCKSIZE) 142 try : 143 self.workfile.seek(-pdlparser.LASTBLOCKSIZE, 2) 144 lastblock = self.workfile.read(pdlparser.LASTBLOCKSIZE) 145 except IOError : 146 lastblock = "" 147 138 148 # IMPORTANT : the order is important below. FIXME. 139 149 for module in (postscript, \ … … 153 163 plain) : # IMPORTANT : don't move this one up ! 154 164 try : 155 return module.Parser(self.filename, self.options.debug) 165 return module.Parser(self.filename, firstblock, 166 lastblock, 167 self.options.debug) 156 168 except pdlparser.PDLParserError : 157 169 pass # try next parser