Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv32311
Modified Files:
tran.py
Log Message:
implemented Interpreter.add_section
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -d -r1.125 -r1.126
--- tran.py 22 May 2003 16:54:57 -0000 1.125
+++ tran.py 22 May 2003 17:02:14 -0000 1.126
@@ -248,13 +248,18 @@
return um
class Interpreter (object):
- __slots__ = 'sections current recordee regpaths hanging regstack state meaning register_names toksrc included'.split()
+ __slots__ = 'sections current recordee regpaths hanging regstack state meaning register_names toksrc included byte_order'.split()
universal_meaning = make_universal_meaning('tran-builtins')
def make_section_switcher (this, name):
def switcher (interpreter):
interpreter.current = interpreter.sections[name]
return switcher
+ def add_section (this, name):
+ if this.sections.has_key(name):
+ raise 'Duplicate section name', name
+ this.sections[name] = Linkie(this.byte_order)
+ this.meaning[name] = 'builtin', this.make_section_switcher(name), 0
def __init__ (this, byte_order, output = ['.text']):
this.meaning = Interpreter.universal_meaning.copy()
@@ -262,11 +267,11 @@
if isinstance(byte_order, Linkie):
this.sections = None
this.current = byte_order
+ this.byte_order = this.current.get_byte_order()
else:
this.sections = {}
- for s in output:
- this.sections[s] = Linkie(byte_order)
- this.meaning[s] = 'builtin', this.make_section_switcher(s), 0
+ this.byte_order = byte_order
+ for s in output: this.add_section(s)
this.current = this.sections[output[0]]
this.register_names = {}
reg = Register([], names = this.register_names)
|