[Wisp-cvs] wisp/users/dig pe.py,1.14,1.15 tran.py,1.117,1.118
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2003-05-18 18:00:13
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv32513 Modified Files: pe.py tran.py Log Message: tranified some of make_pe_aout_header via Interpreter.do Index: pe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/pe.py,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pe.py 18 May 2003 15:56:30 -0000 1.14 +++ pe.py 18 May 2003 18:00:09 -0000 1.15 @@ -8,7 +8,7 @@ from coff import * import time -from tran import interpret_single +from tran import Interpreter, interpret_single def roundup (value, boundary): return (value + boundary - 1) & ~(boundary - 1) @@ -51,25 +51,32 @@ def make_pe_aout_header (): h = Linkie('<') - h.align(4) - # #aout/magic = 0x10B - h[::2] = '#aout/magic' - h[::1] = '#aout/linker-version-major', '#aout/linker-version-minor' - h[::4] = '#aout/text-size', '#aout/data-size', '#aout/bss-size' - h[::4] = '&_start #rva', '&.text #rva', - h[::4] = '&.data #rva' # not present in PE32+ (?) + interp = Interpreter(h) # #aout/image-base must be multiple of 64ki - h[::4] = '#aout/image-base' - h[::4] = '#aout/memory-align' # #aout/file-align must be a power of 2 in range of [512 ... 64Ki] - h[::4] = '#aout/file-align' - h[::2] = '#aout/os-version-major' - h[::2] = '#aout/os-version-minor' - h[::2] = '#aout/image-version-major' - h[::2] = '#aout/image-version-minor' - h[::2] = '#aout/subsys-version-major' - h[::2] = '#aout/subsys-version-minor' - h[::4] = 0 + interp.do(""" + 4 align + ' #aout/magic w, 0x10B =: #?aout/magic + ' #aout/linker-version-major (opt) b, + ' #aout/linker-version-minor (opt) b, + ' #aout/text-size t, + ' #aout/data-size t, + ' #aout/bss-size t, + ' &_start ' #rva + t, + ' &.text ' #rva + t, + ' &.data ' #rva + t,""" + # not present in PE32+ (?) + """ + ' #aout/image-base t, + ' #aout/memory-align t, + ' #aout/file-align t, + ' #aout/os-version-major w, + ' #aout/os-version-minor w, + ' #aout/image-version-major (opt) w, + ' #aout/image-version-minor (opt) w, + ' #aout/subsys-version-major w, + ' #aout/subsys-version-minor w, + 0 t, + """) # &aout/image-end must be a multiple of #aout/memory-align h.emit_tetra_sum(['&aout/image-end', '#rva']) # !aout/header-end must be a multiple of #aout/file-align Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.117 retrieving revision 1.118 diff -u -d -r1.117 -r1.118 --- tran.py 18 May 2003 17:43:27 -0000 1.117 +++ tran.py 18 May 2003 18:00:09 -0000 1.118 @@ -309,7 +309,7 @@ def do (this, phrase): # Note that parsing is only partial l = phrase.split() for i in range(len(l)): - try: l[i] = Integer_Literal(long(l[i])) + try: l[i] = Integer_Literal(long(l[i], 0)) except: pass this.run(Macro_Cursor(l)) def run (this, toksrc, verbose = 0): |