Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv15956
Modified Files:
elf.py
Log Message:
use cleaner syntax in elf.py
Index: elf.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- elf.py 21 Apr 2003 11:35:56 -0000 1.38
+++ elf.py 27 Apr 2003 12:54:15 -0000 1.39
@@ -327,14 +327,14 @@
h = Linkie(byte_order)
h.align(4)
h.emit_string('\x7F' + 'ELF') # magic
- h.emit_byte(ELFCLASS.TETRA)
+ h[::1] = ELFCLASS.TETRA
if byte_order == '<':
- h.emit_byte(ELFDATA.TWOLSB)
+ h[::1] = ELFDATA.TWOLSB
elif byte_order == '>':
- h.emit_byte(ELFDATA.TWOMSB)
+ h[::1] = ELFDATA.TWOMSB
else:
raise 'Invalid byte order', byte_order
- h.emit_byte(EV.CURRENT)
+ h[::1] = EV.CURRENT
h.emit_string('\0' * 9)
h.emit_wyde_sum(['#elf/type'])
h.emit_wyde_sum(['#elf/machine'])
@@ -395,7 +395,7 @@
def __init__ (this, byte_order):
Linkie.__init__(this, byte_order)
this._emitted_symbols = {}
- this.emit_byte(0)
+ this[::1] = 0
# Returns offset of the string added.
# Avoids introducing duplicate entries.
def emit_entry (this, s, entry_label = None):
@@ -405,7 +405,7 @@
if entry_label <> None: this.place_symbol(entry_label, ofs)
this._emitted_symbols[s] = ofs
this.emit_string(s)
- this.emit_byte(0)
+ this[::1] = 0
return ofs
class ELF32_symtab (Linkie):
@@ -424,8 +424,8 @@
if value == None: this.emit_tetra_sum([pname])
else: this.emit_tetra(value)
this.emit_tetra(0) # st_size
- this.emit_byte(STB.GLOBAL << 4 | STT.NOTYPE)
- this.emit_byte(0) # st_other; reserved
+ this[::1] = STB.GLOBAL << 4 | STT.NOTYPE
+ this[::1] = 0 # st_other; reserved
this.emit_wyde(section)
this._index += 1
return this._index
|