Changeset 489 for pkpgcounter/trunk/pkpgpdls
- Timestamp:
- 11/17/07 16:21:11 (17 years ago)
- Location:
- pkpgcounter/trunk/pkpgpdls
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pkpgpdls/dvi.py
r463 r489 60 60 postchar = chr(0xf8) 61 61 try : 62 while minfile[pos] == eofchar : 63 pos -= 1 64 idbyte = minfile[pos] 65 if idbyte != minfile[1] : 66 raise IndexError, "Invalid DVI file." 67 pos = unpack(">I", minfile[pos - 4:pos])[0] 68 if minfile[pos] != postchar : 69 raise IndexError, "Invalid DVI file." 70 pagecount = unpack(">H", minfile[pos + 27: pos + 29])[0] 71 except IndexError : # EOF ? 72 pass 73 minfile.close() # reached EOF 62 try : 63 while minfile[pos] == eofchar : 64 pos -= 1 65 idbyte = minfile[pos] 66 if idbyte != minfile[1] : 67 raise IndexError, "Invalid DVI file." 68 pos = unpack(">I", minfile[pos - 4:pos])[0] 69 if minfile[pos] != postchar : 70 raise IndexError, "Invalid DVI file." 71 pagecount = unpack(">H", minfile[pos + 27: pos + 29])[0] 72 except IndexError : # EOF ? 73 pass 74 finally : 75 minfile.close() # reached EOF 74 76 return pagecount 75 77 -
pkpgcounter/trunk/pkpgpdls/hbp.py
r480 r489 61 61 pos = 0 62 62 try : 63 while True : 64 if (minfile[pos] == "@") \ 65 and (minfile[pos:pos+fflen] == formfeed) : 66 pagecount += 1 67 pos += fflen 68 else : 69 pos += 1 70 except IndexError : # EOF ? 71 pass 72 minfile.close() # reached EOF 63 try : 64 while True : 65 if (minfile[pos] == "@") \ 66 and (minfile[pos:pos+fflen] == formfeed) : 67 pagecount += 1 68 pos += fflen 69 else : 70 pos += 1 71 except IndexError : # EOF ? 72 pass 73 finally : 74 minfile.close() # reached EOF 73 75 return pagecount 74 76 -
pkpgcounter/trunk/pkpgpdls/tiff.py
r463 r489 66 66 raise pdlparser.PDLParserError, "Unknown file endianness." 67 67 pos = 4 68 try : 69 nextifdoffset = unpack(integerbyteorder, minfile[pos : pos + 4])[0] 70 while nextifdoffset : 71 direntrycount = unpack(shortbyteorder, minfile[nextifdoffset : nextifdoffset + 2])[0] 72 pos = nextifdoffset + 2 + (direntrycount * 12) 68 try : 69 try : 73 70 nextifdoffset = unpack(integerbyteorder, minfile[pos : pos + 4])[0] 74 pagecount += 1 75 except IndexError : 76 pass 77 minfile.close() 71 while nextifdoffset : 72 direntrycount = unpack(shortbyteorder, minfile[nextifdoffset : nextifdoffset + 2])[0] 73 pos = nextifdoffset + 2 + (direntrycount * 12) 74 nextifdoffset = unpack(integerbyteorder, minfile[pos : pos + 4])[0] 75 pagecount += 1 76 except IndexError : 77 pass 78 finally : 79 minfile.close() 78 80 return pagecount 79 81