wisp-cvs Mailing List for Wisp interpreter
Status: Alpha
Brought to you by:
digg
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(30) |
Sep
(312) |
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(5) |
Feb
(131) |
Mar
(17) |
Apr
(184) |
May
(252) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
|
From: <di...@us...> - 2004-10-10 20:50:55
|
Update of /cvsroot/wisp/wisp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15398 Modified Files: evm.c Log Message: fixed a side effect in GIH_j to make Wisp work when compiled with gcc 3.3 Index: evm.c =================================================================== RCS file: /cvsroot/wisp/wisp/src/evm.c,v retrieving revision 1.343 retrieving revision 1.344 diff -u -d -r1.343 -r1.344 --- evm.c 10 Oct 2004 20:47:09 -0000 1.343 +++ evm.c 10 Oct 2004 20:49:43 -0000 1.344 @@ -176,8 +176,8 @@ IH_J: GIH (j); { /* XXX: these used to be done in a single statement - * but that doesn't seem to work in gcc's interpretation of - * side-effected statements */ + * but that doesn't seem to work in gcc 3.3's interpretation + * of side-effected statements */ signed long int delta = *IP++; IP += delta; NEXT; |
|
From: <di...@us...> - 2004-10-10 20:48:13
|
Update of /cvsroot/wisp/wisp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14947 Modified Files: evm.c Log Message: fixed a side effect in GIH_j to make Wisp work when compiled with gcc 3.3 Index: evm.c =================================================================== RCS file: /cvsroot/wisp/wisp/src/evm.c,v retrieving revision 1.342 retrieving revision 1.343 diff -u -d -r1.342 -r1.343 --- evm.c 18 Sep 2002 21:03:05 -0000 1.342 +++ evm.c 10 Oct 2004 20:47:09 -0000 1.343 @@ -174,8 +174,14 @@ NS_push (*IP++); NEXT; IH_J: GIH (j); - IP += (signed long int) *IP++; - NEXT; + { + /* XXX: these used to be done in a single statement + * but that doesn't seem to work in gcc's interpretation of + * side-effected statements */ + signed long int delta = *IP++; + IP += delta; + NEXT; + } IH_B: GIH (b); IP = (void *) *IP; NEXT; |
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv4578 Modified Files: Makefile.am Removed Files: .pycheckrc bindump.py bits.py builtin.tran coff.py coff.tran com.py cpmhello.tran doshello.tran elf.py elf.tran elfdump.py hello.tran i80186.tran i80286.tran i80386.tran i80486.tran i8080.tran i8086.tran ia16.tran ia32.tran linkie.py makehello.py menuet.tran mmx.tran mswhello.tran mz.tran pe.py pe.tran pedump.py pentium.tran tran-builtins tran-emitters tran.py winapi.tran z80.tran Log Message: moved the Worth/RUG translator to a separate project, see http://www.sourceforge.net/projects/rug/ Index: Makefile.am =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/Makefile.am,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- Makefile.am 21 May 2003 12:22:27 -0000 1.32 +++ Makefile.am 23 May 2003 11:46:09 -0000 1.33 @@ -6,18 +6,9 @@ # #### @(#) $Id$ -EXTRA_DIST = .cvsignore .pycheckrc struburn.wisp bits.py linkie.py \ - coff.py com.py elf.py pe.py \ - tran.py tran-builtins tran-emitters builtin.tran \ - i8086.tran i80186.tran i80286.tran i80386.tran i80486.tran pentium.tran mmx.tran \ - i8080.tran z80.tran \ - ia16.tran ia32.tran \ - coff.tran elf.tran mz.tran pe.tran \ - winapi.tran menuetos.tran \ - hello.tran mswhello.tran doshello.tran cpmhello.tran \ - makehello.py elfdump.py +EXTRA_DIST = .cvsignore struburn.wisp all: clean: clean-am - -rm -f *.exe *.o *.pyc *.pyo *~ a.out hello hellowosym + -rm -f *~ --- .pycheckrc DELETED --- --- bindump.py DELETED --- --- bits.py DELETED --- --- builtin.tran DELETED --- --- coff.py DELETED --- --- coff.tran DELETED --- --- com.py DELETED --- --- cpmhello.tran DELETED --- --- doshello.tran DELETED --- --- elf.py DELETED --- --- elf.tran DELETED --- --- elfdump.py DELETED --- --- hello.tran DELETED --- --- i80186.tran DELETED --- --- i80286.tran DELETED --- --- i80386.tran DELETED --- --- i80486.tran DELETED --- --- i8080.tran DELETED --- --- i8086.tran DELETED --- --- ia16.tran DELETED --- --- ia32.tran DELETED --- --- linkie.py DELETED --- --- makehello.py DELETED --- --- menuet.tran DELETED --- --- mmx.tran DELETED --- --- mswhello.tran DELETED --- --- mz.tran DELETED --- --- pe.py DELETED --- --- pe.tran DELETED --- --- pedump.py DELETED --- --- pentium.tran DELETED --- --- tran-builtins DELETED --- --- tran-emitters DELETED --- --- tran.py DELETED --- --- winapi.tran DELETED --- --- z80.tran DELETED --- |
|
From: <di...@us...> - 2003-05-22 20:16:42
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv24610
Modified Files:
tran.py
Log Message:
dropped interpret_single
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- tran.py 22 May 2003 19:21:17 -0000 1.134
+++ tran.py 22 May 2003 19:54:09 -0000 1.135
@@ -346,24 +346,6 @@
tok = this.toksrc.get_token()
this.toksrc = None
-def interpret_single (toksrc, target, include = [], verbose = 0):
- if isinstance(toksrc, str): toksrc = toksrc.split() # FIXME: integers?
- if isinstance(toksrc, list): toksrc = Macro_Cursor(toksrc)
-
- if isinstance(target, str): target = Linkie(target) # byte order
- elif isinstance(target, Linkie): pass
- else: raise 'neither a linkie nor a byte order specifier', target
-
- if isinstance(include, str): include = include.split()
-
- interp = Interpreter(target)
- for i in include: interp.run(i + '.tran')
- interp.run(toksrc, verbose = verbose)
- if interp.regstack:
- raise 'regstack not empty after finishing interpretation', \
- interp.regstack
- return target
-
def main ():
from getopt import getopt
import elf
|
|
From: <di...@us...> - 2003-05-22 20:06:47
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv30277
Modified Files:
tran-builtins tran.py
Log Message:
implemented |roundup|
Index: tran-builtins
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran-builtins,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- tran-builtins 22 May 2003 17:21:01 -0000 1.41
+++ tran-builtins 22 May 2003 20:06:44 -0000 1.42
@@ -158,6 +158,11 @@
if not name[0] in '&#!': name = '&' + name
interpreter.regstack.append(Symbol_Literal(name))
+roundup int int
+ boundary = long(interpreter.regstack.pop())
+ value = long(interpreter.regstack.pop())
+ interpreter.regstack.append(Integer_Literal(roundup(value, boundary)))
+
section|name
interpreter.switch_to_section(name)
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- tran.py 22 May 2003 19:54:09 -0000 1.135
+++ tran.py 22 May 2003 20:06:44 -0000 1.136
@@ -14,6 +14,9 @@
from linkie import Linkie
from shlex import shlex
+def roundup (value, boundary):
+ return (value + boundary - 1) & ~(boundary - 1)
+
def abstract (this, *arg, **narg):
raise 'abstract method was called', (this, arg, narg)
|
|
From: <di...@us...> - 2003-05-22 19:48:30
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv21938
Modified Files:
elf.py
Log Message:
avoid usage of interpret_single
Index: elf.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- elf.py 22 May 2003 19:30:03 -0000 1.64
+++ elf.py 22 May 2003 19:48:27 -0000 1.65
@@ -322,7 +322,7 @@
NUM = 11
from linkie import Linkie
-from tran import interpret_single, Integer_Literal, Interpreter
+from tran import Integer_Literal, Interpreter
def make_ELF32_header (byte_order, reloc = 0):
h = Linkie(byte_order)
@@ -507,14 +507,18 @@
shentnames.append('.shstrtab')
sections['.shstrtab'] = ELF32_strtab('<')
+ do = Interpreter(binary).do
+ do('needs elf')
if not want_relocatable:
phentnames = []
for name in shentnames:
if guess_ELF32_pflags(name) <> 0:
phentnames.append(name)
- input = [Integer_Literal(len(phentnames)), 'make-elf32-phtable']
- for name in phentnames: input = ["'", name] + input # reversed
- interpret_single(input, binary, include = 'elf')
+ input = ''
+ for name in phentnames: input = "' " + name + ' ' + input # reversed
+ do(input)
+ do(`len(phentnames)`)
+ do('make-elf32-phtable')
for name in shentnames:
sections['.shstrtab'].emit_entry(name, '#.shstrtab/strings/' + name)
|
|
From: <di...@us...> - 2003-05-22 19:45:05
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv10188
Modified Files:
pe.py
Log Message:
avoid usage of interpret_single
Index: pe.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/pe.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- pe.py 21 May 2003 13:23:10 -0000 1.33
+++ pe.py 22 May 2003 19:27:24 -0000 1.34
@@ -8,7 +8,7 @@
from coff import *
import time
-from tran import Interpreter, interpret_single
+from tran import Interpreter
def roundup (value, boundary):
return (value + boundary - 1) & ~(boundary - 1)
@@ -29,7 +29,10 @@
raise 'MZ message may not contain dollar signs', message
if message.find('\r') == -1: # if no CRs, insert them
message = '\r\n'.join(message.split('\n'))
- b = interpret_single('make-pe-mz-stub-structure', '<', include = 'pe')
+ b = Linkie('<')
+ do = Interpreter(b).do
+ do('needs pe')
+ do('make-pe-mz-stub-structure')
message += '$' # Dollar the Terminator
# a pointer to the PE signature must appear at the offset 0x003C
|
|
From: <di...@us...> - 2003-05-22 19:44:38
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv6599
Modified Files:
tran.py
Log Message:
inlined interpret_multi into main
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- tran.py 22 May 2003 19:12:54 -0000 1.133
+++ tran.py 22 May 2003 19:21:17 -0000 1.134
@@ -364,26 +364,6 @@
interp.regstack
return target
-def interpret_multi (toksrc, target, include = [], verbose = 0):
- if isinstance(toksrc, str): toksrc = toksrc.split() # FIXME: integers?
- if isinstance(toksrc, list): toksrc = Macro_Cursor(toksrc)
-
- if isinstance(target, str): target = target.split()
-
- if isinstance(include, str): include = include.split()
-
- byte_order = target[0]
- sections = target[1:]
- interp = Interpreter(byte_order)
- for s in sections:
- interp.add_section(s)
- for i in include: interp.run(i + '.tran')
- interp.run(toksrc, verbose = verbose)
- if interp.regstack:
- raise 'regstack not empty after finishing interpretation', \
- interp.regstack
- return map((lambda n: interp.sections[n]), target[1:])
-
def main ():
from getopt import getopt
import elf
@@ -410,8 +390,17 @@
if output_name == None: output_name = default_output_names[format]
if len(args) != 1:
raise 'Invalid argument count -- must be 1', args
- text, data, bss = interpret_multi(Lexer(args[0]), '< .text .data .bss',
- verbose = verbose)
+ interp = Interpreter('<')
+ interp.add_section('.text')
+ interp.add_section('.data')
+ interp.add_section('.bss')
+ interp.run(Lexer(args[0]), verbose = verbose)
+ if interp.regstack:
+ raise 'regstack not empty after finishing interpretation', \
+ interp.regstack
+ text = interp.sections['.text']
+ data = interp.sections['.data']
+ bss = interp.sections['.bss']
text.dump(title = 'TEXT')
data.dump(title = 'DATA')
bss.dump(title = 'BSS')
|
|
From: <di...@us...> - 2003-05-22 19:30:13
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv11678
Modified Files:
elf.py
Log Message:
avoid usage of interpret_single
Index: elf.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- elf.py 18 May 2003 16:50:25 -0000 1.63
+++ elf.py 22 May 2003 19:30:03 -0000 1.64
@@ -322,11 +322,13 @@
NUM = 11
from linkie import Linkie
-from tran import interpret_single, Integer_Literal
+from tran import interpret_single, Integer_Literal, Interpreter
def make_ELF32_header (byte_order, reloc = 0):
h = Linkie(byte_order)
- interpret_single('make-elf32-header', h, include = 'elf')
+ do = Interpreter(h).do
+ do('needs elf')
+ do('make-elf32-header')
if byte_order == '<': h.place_symbol('#elf/byte-order', ELFDATA.TWOLSB)
elif byte_order == '>': h.place_symbol('#elf/byte-order', ELFDATA.TWOMSB)
else: raise 'Invalid byte order', byte_order
|
|
From: <di...@us...> - 2003-05-22 19:22:59
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv7484
Modified Files:
coff.py
Log Message:
minor cleanup
Index: coff.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/coff.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- coff.py 17 May 2003 15:37:14 -0000 1.4
+++ coff.py 22 May 2003 19:22:56 -0000 1.5
@@ -7,7 +7,6 @@
#### @(#) $Id$
from linkie import Linkie
-from tran import interpret_single
def make_coff_section_header (byte_order, name):
h = Linkie(byte_order)
|
|
From: <di...@us...> - 2003-05-22 19:12:57
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv1357
Modified Files:
tran.py
Log Message:
minor cleanup
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- tran.py 22 May 2003 18:59:52 -0000 1.132
+++ tran.py 22 May 2003 19:12:54 -0000 1.133
@@ -261,16 +261,16 @@
def switch_to_section (this, name):
this.current = this.sections[name]
- def __init__ (this, byte_order):
+ def __init__ (this, arg):
this.meaning = Interpreter.universal_meaning.copy()
this.current = None
this.sections = {}
# if first argument is a linkie, all output goes to that linkie
- if isinstance(byte_order, Linkie):
- this.current = byte_order
- this.byte_order = this.current.get_byte_order()
- else:
- this.byte_order = byte_order
+ if isinstance(arg, Linkie):
+ this.byte_order = arg.get_byte_order()
+ this.add_section('.all', arg)
+ else: # otherwise, it's treated as byte order indicator
+ this.byte_order = arg
this.register_names = {}
reg = Register([], names = this.register_names)
this.meaning['reg'] = reg
@@ -374,7 +374,7 @@
byte_order = target[0]
sections = target[1:]
- interp = Interpreter(byte_order = byte_order)
+ interp = Interpreter(byte_order)
for s in sections:
interp.add_section(s)
for i in include: interp.run(i + '.tran')
|
|
From: <di...@us...> - 2003-05-22 18:59:55
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv25625
Modified Files:
tran.py
Log Message:
dropped the section_name argument of Interpreter.__init__
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- tran.py 22 May 2003 18:11:40 -0000 1.131
+++ tran.py 22 May 2003 18:59:52 -0000 1.132
@@ -257,21 +257,20 @@
if linkie == None:
linkie = Linkie(this.byte_order)
this.sections[name] = linkie
+ if this.current == None: this.current = linkie
def switch_to_section (this, name):
this.current = this.sections[name]
- def __init__ (this, byte_order, section_name = '.text'):
+ def __init__ (this, byte_order):
this.meaning = Interpreter.universal_meaning.copy()
+ this.current = None
+ this.sections = {}
# if first argument is a linkie, all output goes to that linkie
if isinstance(byte_order, Linkie):
- this.sections = None
this.current = byte_order
this.byte_order = this.current.get_byte_order()
else:
- this.sections = {}
this.byte_order = byte_order
- this.add_section(section_name)
- this.current = this.sections[section_name]
this.register_names = {}
reg = Register([], names = this.register_names)
this.meaning['reg'] = reg
@@ -375,8 +374,8 @@
byte_order = target[0]
sections = target[1:]
- interp = Interpreter(byte_order = byte_order, section_name = sections[0])
- for s in sections[1:]:
+ interp = Interpreter(byte_order = byte_order)
+ for s in sections:
interp.add_section(s)
for i in include: interp.run(i + '.tran')
interp.run(toksrc, verbose = verbose)
|
|
From: <di...@us...> - 2003-05-22 18:11:45
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv29052
Modified Files:
tran.py
Log Message:
added the optional linkie argument to Interpreter.add_section
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- tran.py 22 May 2003 18:04:19 -0000 1.130
+++ tran.py 22 May 2003 18:11:40 -0000 1.131
@@ -251,10 +251,12 @@
__slots__ = 'sections current recordee regpaths hanging regstack state meaning register_names toksrc included byte_order'.split()
universal_meaning = make_universal_meaning()
- def add_section (this, name):
+ def add_section (this, name, linkie = None):
if this.sections.has_key(name):
raise 'Duplicate section name', name
- this.sections[name] = Linkie(this.byte_order)
+ if linkie == None:
+ linkie = Linkie(this.byte_order)
+ this.sections[name] = linkie
def switch_to_section (this, name):
this.current = this.sections[name]
|
|
From: <di...@us...> - 2003-05-22 18:04:23
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv26166
Modified Files:
tran.py
Log Message:
renamed the output named argument of Interpreter.__init__ by section_name
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- tran.py 22 May 2003 17:28:09 -0000 1.129
+++ tran.py 22 May 2003 18:04:19 -0000 1.130
@@ -258,7 +258,7 @@
def switch_to_section (this, name):
this.current = this.sections[name]
- def __init__ (this, byte_order, output = ['.text']):
+ def __init__ (this, byte_order, section_name = '.text'):
this.meaning = Interpreter.universal_meaning.copy()
# if first argument is a linkie, all output goes to that linkie
if isinstance(byte_order, Linkie):
@@ -268,8 +268,8 @@
else:
this.sections = {}
this.byte_order = byte_order
- for s in output: this.add_section(s)
- this.current = this.sections[output[0]]
+ this.add_section(section_name)
+ this.current = this.sections[section_name]
this.register_names = {}
reg = Register([], names = this.register_names)
this.meaning['reg'] = reg
@@ -373,7 +373,9 @@
byte_order = target[0]
sections = target[1:]
- interp = Interpreter(byte_order = byte_order, output = sections)
+ interp = Interpreter(byte_order = byte_order, section_name = sections[0])
+ for s in sections[1:]:
+ interp.add_section(s)
for i in include: interp.run(i + '.tran')
interp.run(toksrc, verbose = verbose)
if interp.regstack:
|
|
From: <di...@us...> - 2003-05-22 17:56:24
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv11143
Modified Files:
tran.py
Log Message:
minor cleanup
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- tran.py 22 May 2003 17:21:03 -0000 1.128
+++ tran.py 22 May 2003 17:28:09 -0000 1.129
@@ -240,7 +240,7 @@
if pa: flags |= MA_PREFIX
d[name] = 'builtin', _p, flags
-def make_universal_meaning (fn):
+def make_universal_meaning ():
um = {'...': Unique('...')}
for m in 'any const int lit sum sym'.split(' '): um[m] = Class_Marker(m)
load_primitives(um, 'tran-builtins')
@@ -249,7 +249,7 @@
class Interpreter (object):
__slots__ = 'sections current recordee regpaths hanging regstack state meaning register_names toksrc included byte_order'.split()
- universal_meaning = make_universal_meaning('tran-builtins')
+ universal_meaning = make_universal_meaning()
def add_section (this, name):
if this.sections.has_key(name):
|
|
From: <di...@us...> - 2003-05-22 17:35:47
|
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)
|
|
From: <di...@us...> - 2003-05-22 17:21:09
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv8273
Modified Files:
cpmhello.tran doshello.tran hello.tran mswhello.tran
tran-builtins tran.py
Log Message:
implemented the |section| word
Index: cpmhello.tran
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/cpmhello.tran,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cpmhello.tran 19 May 2003 09:21:09 -0000 1.2
+++ cpmhello.tran 22 May 2003 17:20:58 -0000 1.3
@@ -16,7 +16,7 @@
5 $call
0 $rst
-.data
+section .data
label message
"Hello, world!$"
times b,
Index: doshello.tran
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/doshello.tran,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- doshello.tran 18 May 2003 23:18:06 -0000 1.1
+++ doshello.tran 22 May 2003 17:21:00 -0000 1.2
@@ -20,7 +20,7 @@
%ax #x4C00 $mov
#x21 $int
-.data
+section .data
label message
"Hello, world!$"
times b,
Index: hello.tran
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/hello.tran,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- hello.tran 18 May 2003 22:45:15 -0000 1.8
+++ hello.tran 22 May 2003 17:21:01 -0000 1.9
@@ -21,7 +21,7 @@
%eax 1 $mov
#x80 $int
-.data
+section .data
label message
"Hello, world!\n"
dup =: #msglen \ assign its length to #msglen
Index: mswhello.tran
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/mswhello.tran,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- mswhello.tran 18 May 2003 22:45:15 -0000 1.17
+++ mswhello.tran 22 May 2003 17:21:01 -0000 1.18
@@ -17,13 +17,13 @@
'message '#msglen 'rckeep 0 WriteFile drop
0 ExitProcess
-.data
+section .data
label message
"Hello, world!\r\n"
dup =: #msglen
times b,
-.bss
+section .bss
label rckeep
1 tetras reserve
Index: tran-builtins
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran-builtins,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- tran-builtins 22 May 2003 06:27:36 -0000 1.40
+++ tran-builtins 22 May 2003 17:21:01 -0000 1.41
@@ -158,6 +158,9 @@
if not name[0] in '&#!': name = '&' + name
interpreter.regstack.append(Symbol_Literal(name))
+section|name
+ interpreter.switch_to_section(name)
+
swap any any
y = interpreter.regstack.pop(); x = interpreter.regstack.pop()
interpreter.regstack.append(y); interpreter.regstack.append(x)
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- tran.py 22 May 2003 17:17:38 -0000 1.127
+++ tran.py 22 May 2003 17:21:03 -0000 1.128
@@ -251,15 +251,10 @@
__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.switch_to_section(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 switch_to_section (this, name):
this.current = this.sections[name]
|
|
From: <di...@us...> - 2003-05-22 17:17:41
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv6799
Modified Files:
tran.py
Log Message:
implemented Interpreter.switch_to_section
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- tran.py 22 May 2003 17:02:14 -0000 1.126
+++ tran.py 22 May 2003 17:17:38 -0000 1.127
@@ -253,13 +253,15 @@
def make_section_switcher (this, name):
def switcher (interpreter):
- interpreter.current = interpreter.sections[name]
+ interpreter.switch_to_section(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 switch_to_section (this, name):
+ this.current = this.sections[name]
def __init__ (this, byte_order, output = ['.text']):
this.meaning = Interpreter.universal_meaning.copy()
|
|
From: <di...@us...> - 2003-05-22 17:05:49
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv32081
Modified Files:
linkie.py
Log Message:
implemented Linkie.get_byte_order
Index: linkie.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- linkie.py 18 May 2003 21:56:26 -0000 1.64
+++ linkie.py 22 May 2003 17:01:30 -0000 1.65
@@ -175,6 +175,8 @@
Returns length of the linker note list of this linkie."""
if this._unresolved_locals: raise 'Incomplete linkie', this
return len(this._linker_notes)
+ def get_byte_order (this):
+ return this._byte_order
def copy (this):
if this._unresolved_locals: raise 'Incomplete linkie', this
|
|
From: <di...@us...> - 2003-05-22 16:55:01
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv29321
Modified Files:
tran.py
Log Message:
minor cleanup
Index: tran.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- tran.py 21 May 2003 12:43:13 -0000 1.124
+++ tran.py 22 May 2003 16:54:57 -0000 1.125
@@ -390,7 +390,7 @@
'elf': 'a.out',
'pe': 'untitled.exe',
'com': 'prog.com',
- }
+ }
verbose = 0
format = 'elf'
opts, args = getopt(sys.argv[1:], 'vo:b:f:',
|
|
From: <di...@us...> - 2003-05-22 08:58:31
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv2668
Modified Files:
winapi.tran
Log Message:
reformatted winapi.tran
Index: winapi.tran
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/winapi.tran,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- winapi.tran 21 May 2003 14:39:00 -0000 1.10
+++ winapi.tran 22 May 2003 08:33:10 -0000 1.11
@@ -6,7 +6,7 @@
\
\\\\ @(#) $Id$
-:[ ] NULL 0 ;
+0 constant NULL
:[ ] GetStdHandle \ ( handle-number -- handle )
commit 'GetStdHandle@kernel32 $call %eax ;
@@ -33,44 +33,44 @@
commit 'FreeConsole@kernel32 $call %eax ;
\ flags for the share-mode argument of CreateFile*
-:[ ] FILE_SHARE_READ 1 ;
-:[ ] FILE_SHARE_WRITE 2 ;
-:[ ] FILE_SHARE_DELETE 4 ; \ Not supported in MSW ME/98/95
+1 constant FILE_SHARE_READ
+2 constant FILE_SHARE_WRITE
+4 constant FILE_SHARE_DELETE \ Not supported in MSW ME/98/95
\ values for the creation-disposition argument of CreateFile*
-:[ ] CREATE_NEW 1 ;
-:[ ] CREATE_ALWAYS 2 ;
-:[ ] OPEN_EXISTING 3 ;
-:[ ] OPEN_ALWAYS 4 ;
-:[ ] TRUNCATE_EXISTING 5 ;
+1 constant CREATE_NEW
+2 constant CREATE_ALWAYS
+3 constant OPEN_EXISTING
+4 constant OPEN_ALWAYS
+5 constant TRUNCATE_EXISTING
\ attributes for the flags-and-attrs argument of CreateFile*
-:[ ] FILE_ATTRIBUTE_READONLY 1 ;
-:[ ] FILE_ATTRIBUTE_HIDDEN 2 ;
-:[ ] FILE_ATTRIBUTE_SYSTEM 4 ;
-:[ ] FILE_ATTRIBUTE_ARCHIVE 32 ;
-:[ ] FILE_ATTRIBUTE_NORMAL 128 ; \ valid only if used alone
-:[ ] FILE_ATTRIBUTE_TEMPORARY 256 ;
-:[ ] FILE_ATTRIBUTE_OFFLINE 4096 ;
+1 constant FILE_ATTRIBUTE_READONLY
+2 constant FILE_ATTRIBUTE_HIDDEN
+4 constant FILE_ATTRIBUTE_SYSTEM
+32 constant FILE_ATTRIBUTE_ARCHIVE
+128 constant FILE_ATTRIBUTE_NORMAL \ valid only if used alone
+256 constant FILE_ATTRIBUTE_TEMPORARY
+4096 constant FILE_ATTRIBUTE_OFFLINE
\ flags for the flags-and-attrs argument of CreateFile*
-:[ ] FILE_FLAG_BACKUP_SEMANTICS 33554432 ;
-:[ ] FILE_FLAG_DELETE_ON_CLOSE 67108864 ;
-:[ ] FILE_FLAG_NO_BUFFERING 536870912 ;
-:[ ] FILE_FLAG_OVERLAPPED 1073741824 ;
-:[ ] FILE_FLAG_POSIX_SEMANTICS 16777216 ;
-:[ ] FILE_FLAG_RANDOM_ACCESS 268435456 ; \ optimization hint
-:[ ] FILE_FLAG_SEQUENTIAL_SCAN 134217728 ; \ optimization hint
-:[ ] FILE_FLAG_WRITE_THROUGH 0x80000000 ;
+16777216 constant FILE_FLAG_POSIX_SEMANTICS
+33554432 constant FILE_FLAG_BACKUP_SEMANTICS
+67108864 constant FILE_FLAG_DELETE_ON_CLOSE
+134217728 constant FILE_FLAG_SEQUENTIAL_SCAN \ optimization hint
+268435456 constant FILE_FLAG_RANDOM_ACCESS \ optimization hint
+536870912 constant FILE_FLAG_NO_BUFFERING
+1073741824 constant FILE_FLAG_OVERLAPPED
+#x80000000 constant FILE_FLAG_WRITE_THROUGH
\ yet more bits for the flags-and-attrs argument of CreateFile*
-:[ ] SECURITY_SQOS_PRESENT 1048576 ;
-:[ ] SECURITY_ANONYMOUS 0 ;
-:[ ] SECURITY_CONTEXT_TRACKING 262144 ;
-:[ ] SECURITY_DELEGATION 196608 ;
-:[ ] SECURITY_EFFECTIVE_ONLY 524288 ;
-:[ ] SECURITY_IDENTIFICATION 65536 ;
-:[ ] SECURITY_IMPERSONATION 131072 ;
+0 constant SECURITY_ANONYMOUS
+65536 constant SECURITY_IDENTIFICATION
+131072 constant SECURITY_IMPERSONATION
+196608 constant SECURITY_DELEGATION
+262144 constant SECURITY_CONTEXT_TRACKING
+524288 constant SECURITY_EFFECTIVE_ONLY
+1048576 constant SECURITY_SQOS_PRESENT
:[ ] CreateFileA \ ( filename desired-access share-mode security-attr
\ creation-disposition flags-and-attrs template-handle
|
|
From: <di...@us...> - 2003-05-22 06:27:40
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv13561
Modified Files:
tran-builtins
Log Message:
implemented |constant|
Index: tran-builtins
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/tran-builtins,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- tran-builtins 19 May 2003 13:02:21 -0000 1.39
+++ tran-builtins 22 May 2003 06:27:36 -0000 1.40
@@ -112,6 +112,11 @@
interpreter.regstack.reverse()
interpreter.toksrc.push(Macro_Cursor(['$push'] * len(interpreter.regstack)))
+constant int|name
+ if interpreter.meaning.has_key(name):
+ raise 'duplicate declaration', name
+ interpreter.meaning[name] = interpreter.regstack.pop()
+
drop any
interpreter.regstack.pop()
|
|
From: <di...@us...> - 2003-05-21 14:39:03
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv29999
Modified Files:
winapi.tran
Log Message:
wrapped ReadFile
Index: winapi.tran
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/winapi.tran,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- winapi.tran 21 May 2003 14:33:17 -0000 1.9
+++ winapi.tran 21 May 2003 14:39:00 -0000 1.10
@@ -6,6 +6,8 @@
\
\\\\ @(#) $Id$
+:[ ] NULL 0 ;
+
:[ ] GetStdHandle \ ( handle-number -- handle )
commit 'GetStdHandle@kernel32 $call %eax ;
@@ -79,5 +81,9 @@
\ creation-disposition flags-and-attrs template-handle
\ -- handle )
7rev commit 'CreateFileW@kernel32 $call %eax ;
+
+:[ ] ReadFile \ ( handle buffer byte-count *read-byte-count *overlapped
+ ] -- success? )
+ 5rev commit 'ReadFile@kernel32 $call %eax ;
\ vim: ft=tran
|
|
From: <di...@us...> - 2003-05-21 14:33:22
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv25062
Modified Files:
winapi.tran
Log Message:
wrapped CreateFile*
Index: winapi.tran
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/winapi.tran,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- winapi.tran 21 May 2003 13:20:09 -0000 1.8
+++ winapi.tran 21 May 2003 14:33:17 -0000 1.9
@@ -30,4 +30,54 @@
:[ ] FreeConsole \ ( -- success? )
commit 'FreeConsole@kernel32 $call %eax ;
+\ flags for the share-mode argument of CreateFile*
+:[ ] FILE_SHARE_READ 1 ;
+:[ ] FILE_SHARE_WRITE 2 ;
+:[ ] FILE_SHARE_DELETE 4 ; \ Not supported in MSW ME/98/95
+
+\ values for the creation-disposition argument of CreateFile*
+:[ ] CREATE_NEW 1 ;
+:[ ] CREATE_ALWAYS 2 ;
+:[ ] OPEN_EXISTING 3 ;
+:[ ] OPEN_ALWAYS 4 ;
+:[ ] TRUNCATE_EXISTING 5 ;
+
+\ attributes for the flags-and-attrs argument of CreateFile*
+:[ ] FILE_ATTRIBUTE_READONLY 1 ;
+:[ ] FILE_ATTRIBUTE_HIDDEN 2 ;
+:[ ] FILE_ATTRIBUTE_SYSTEM 4 ;
+:[ ] FILE_ATTRIBUTE_ARCHIVE 32 ;
+:[ ] FILE_ATTRIBUTE_NORMAL 128 ; \ valid only if used alone
+:[ ] FILE_ATTRIBUTE_TEMPORARY 256 ;
+:[ ] FILE_ATTRIBUTE_OFFLINE 4096 ;
+
+\ flags for the flags-and-attrs argument of CreateFile*
+:[ ] FILE_FLAG_BACKUP_SEMANTICS 33554432 ;
+:[ ] FILE_FLAG_DELETE_ON_CLOSE 67108864 ;
+:[ ] FILE_FLAG_NO_BUFFERING 536870912 ;
+:[ ] FILE_FLAG_OVERLAPPED 1073741824 ;
+:[ ] FILE_FLAG_POSIX_SEMANTICS 16777216 ;
+:[ ] FILE_FLAG_RANDOM_ACCESS 268435456 ; \ optimization hint
+:[ ] FILE_FLAG_SEQUENTIAL_SCAN 134217728 ; \ optimization hint
+:[ ] FILE_FLAG_WRITE_THROUGH 0x80000000 ;
+
+\ yet more bits for the flags-and-attrs argument of CreateFile*
+:[ ] SECURITY_SQOS_PRESENT 1048576 ;
+:[ ] SECURITY_ANONYMOUS 0 ;
+:[ ] SECURITY_CONTEXT_TRACKING 262144 ;
+:[ ] SECURITY_DELEGATION 196608 ;
+:[ ] SECURITY_EFFECTIVE_ONLY 524288 ;
+:[ ] SECURITY_IDENTIFICATION 65536 ;
+:[ ] SECURITY_IMPERSONATION 131072 ;
+
+:[ ] CreateFileA \ ( filename desired-access share-mode security-attr
+ \ creation-disposition flags-and-attrs template-handle
+ \ -- handle )
+ 7rev commit 'CreateFileA@kernel32 $call %eax ;
+
+:[ ] CreateFileW \ ( filename desired-access share-mode security-attr
+ \ creation-disposition flags-and-attrs template-handle
+ \ -- handle )
+ 7rev commit 'CreateFileW@kernel32 $call %eax ;
+
\ vim: ft=tran
|
|
From: <di...@us...> - 2003-05-21 13:31:57
|
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv1734
Modified Files:
winapi.tran
Log Message:
wrapped FreeConsole
Index: winapi.tran
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/winapi.tran,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- winapi.tran 21 May 2003 13:17:02 -0000 1.7
+++ winapi.tran 21 May 2003 13:20:09 -0000 1.8
@@ -27,4 +27,7 @@
:[ ] AllocConsole \ ( -- success? )
commit 'AllocConsole@kernel32 $call %eax ;
+:[ ] FreeConsole \ ( -- success? )
+ commit 'FreeConsole@kernel32 $call %eax ;
+
\ vim: ft=tran
|