diff --git a/misc/vms-dump-opt.py b/misc/vms-dump-opt.py new file mode 100644 index 00000000..b0ff3cb1 --- /dev/null +++ b/misc/vms-dump-opt.py @@ -0,0 +1,19 @@ +import struct +import sys + +jpeg = 0 +last = float('inf') + +with open(sys.argv[1]) as fh: + while True: + buf = fh.read(40) + if not buf: + break + val = struct.unpack('H')[0] + fh.seek(count - 2, 1) + + # Walk entropy-coded data + base = fh.tell() + print base + while True: + buf = fh.read(4 << 10) + if not buf: + break + off = 0 + while True: + off = buf.find('\xff', off) + if off == -1: + break + elif off == len(buf) - 1: + ch = fh.read(1) + if len(ch) != 1: + raise IOError('Short read') + buf += ch + marker_byte = struct.unpack('B', buf[off + 1])[0] + if marker_byte >= 0xd0 and marker_byte <= 0xd7: + print base + off + 2 + off += 2 + base += len(buf) + except EOFError: + pass + except Exception: + print 'At {}:'.format(fh.tell()) + raise