1.1 --- a/micropython/table.py Mon Aug 18 01:46:21 2008 +0200
1.2 +++ b/micropython/table.py Tue Aug 19 00:41:30 2008 +0200
1.3 @@ -132,6 +132,33 @@
1.4 if attr is not None:
1.5 self.displaced[offset+i] = offset, attr
1.6
1.7 + # Image production.
1.8 +
1.9 + def as_raw(self):
1.10 +
1.11 + "Return the raw contents of the table as a list of values."
1.12 +
1.13 + result = []
1.14 + for entry in self.displaced:
1.15 + if entry is None:
1.16 + result.append(None)
1.17 + else:
1.18 + offset, attr = entry
1.19 + if attr.parent is not None:
1.20 + location = attr.parent.location or 0
1.21 + else:
1.22 + location = 0
1.23 + if attr.position is not None:
1.24 + position = attr.position + location + 1 # skip structure header
1.25 + else:
1.26 + position = None # NOTE: Should fix unpositioned attributes.
1.27 +
1.28 + # Class offset/code, context instance override flag, location/position.
1.29 +
1.30 + result.append((offset, attr.defined_within_hierarchy(), position))
1.31 +
1.32 + return result
1.33 +
1.34 class Table:
1.35
1.36 "A lookup table."