|
|
|
@ -31,17 +31,16 @@ def read_mapfile(fn):
|
|
|
|
|
class MapFile:
|
|
|
|
|
def __init__(self, filename, start=None, end=None):
|
|
|
|
|
self.mapfilename = filename
|
|
|
|
|
self.start = start
|
|
|
|
|
self.start = start if start is not None else 0
|
|
|
|
|
self.end = end
|
|
|
|
|
|
|
|
|
|
def load(self):
|
|
|
|
|
self.status, self.blocks, self.comments = read_mapfile(self.mapfilename)
|
|
|
|
|
if self.start is not None or self.end is not None:
|
|
|
|
|
if self.end is not None: # FIXME: what about only start being set?
|
|
|
|
|
self.filter_data()
|
|
|
|
|
self.size = max(map(lambda blk: blk[0]+blk[1], self.blocks))
|
|
|
|
|
|
|
|
|
|
def filter_data(self):
|
|
|
|
|
assert self.start is not None and self.end is not None
|
|
|
|
|
self.blocks = self.filter_blocks(self.blocks, self.start, self.end)
|
|
|
|
|
self.blocks = self.trim_blocks(self.blocks, self.start, self.end)
|
|
|
|
|
|
|
|
|
|