version 1.128, 2002/09/14 08:20:18
|
version 1.129, 2002/09/26 11:36:42
|
Line 1174 false DefaultValue header
|
Line 1174 false DefaultValue header
|
false DefaultValue backtrace |
false DefaultValue backtrace |
false DefaultValue new-input |
false DefaultValue new-input |
false DefaultValue peephole |
false DefaultValue peephole |
|
false DefaultValue abranch |
[THEN] |
[THEN] |
|
|
true DefaultValue interpreter |
true DefaultValue interpreter |
Line 2927 compile: does-resolved ;compile
|
Line 2928 compile: does-resolved ;compile
|
|
|
: branchoffset ( src dest -- ) - tchar / ; \ ?? jaw |
: branchoffset ( src dest -- ) - tchar / ; \ ?? jaw |
|
|
: >resolve ( sys -- ) |
|
X here ( dup ." >" hex. ) over branchoffset swap X ! ; |
|
|
|
: <resolve ( sys -- ) |
|
X here ( dup ." <" hex. ) branchoffset X , ; |
|
|
|
:noname compile branch X here branchoffset X , ; |
:noname compile branch X here branchoffset X , ; |
IS branch, ( target-addr -- ) |
IS branch, ( target-addr -- ) |
:noname compile ?branch X here branchoffset X , ; |
:noname compile ?branch X here branchoffset X , ; |
Line 2959 compile: does-resolved ;compile
|
Line 2954 compile: does-resolved ;compile
|
|
|
Variable tleavings 0 tleavings ! |
Variable tleavings 0 tleavings ! |
|
|
: (done) ( addr -- ) |
: (done) ( do-addr -- ) |
|
\G resolve branches of leave and ?leave and ?do |
|
\G do-addr is the address of the beginning of our |
|
\G loop so we can take care of nested loops |
tleavings @ |
tleavings @ |
BEGIN dup |
BEGIN dup |
WHILE |
WHILE |
Line 3009 Cond: ?LEAVE ?leave, ;Cond
|
Line 3007 Cond: ?LEAVE ?leave, ;Cond
|
0 DO dup @ swap 1 cells - LOOP |
0 DO dup @ swap 1 cells - LOOP |
free throw ; |
free throw ; |
|
|
: loop] branchto, dup <resolve tcell - (done) ; |
: loop] ( target-addr -- ) |
|
branchto, |
|
dup X here branchoffset X , |
|
tcell - (done) ; |
|
|
: skiploop] ?dup IF branchto, branchtoresolve, THEN ; |
: skiploop] ?dup IF branchto, branchtoresolve, THEN ; |
|
|
Line 3113 Cond: LOOP 1 ncontrols? loop, ;Cond
|
Line 3114 Cond: LOOP 1 ncontrols? loop, ;Cond
|
Cond: +LOOP 1 ncontrols? +loop, ;Cond |
Cond: +LOOP 1 ncontrols? +loop, ;Cond |
Cond: NEXT 1 ncontrols? next, ;Cond |
Cond: NEXT 1 ncontrols? next, ;Cond |
|
|
|
\ Absoulte branches 26sep02jaw |
|
|
|
\ This section defined different semantics for |
|
\ conditionals, using and compiling absolute branches |
|
|
|
X has? abranch [IF] |
|
|
|
Ghost abranch drop |
|
Ghost a?branch drop |
|
Ghost a(?do) drop |
|
Ghost a(do) drop |
|
Ghost a(next) drop |
|
Ghost a(+loop) drop |
|
Ghost a(loop) drop |
|
|
|
:noname compile abranch X a, ; plugin-of branch, |
|
|
|
:noname compile a?branch X a, ; plugin-of ?branch, |
|
|
|
:noname compile abranch T here 0 a, H ; plugin-of branchmark, |
|
|
|
:noname compile a?branch T here 0 a, H ; plugin-of ?branchmark, |
|
|
|
:noname |
|
dup X @ ABORT" CROSS: branch already resolved" |
|
X here swap X a! ; plugin-of branchtoresolve, |
|
|
|
:noname |
|
0 compile a(?do) ?domark, (leave) |
|
branchtomark, 2 to1 ; plugin-of ?do, |
|
|
|
: aloop] ( target-addr -- ) |
|
branchto, |
|
dup X a, |
|
tcell - (done) ; |
|
|
|
:noname |
|
1to compile a(loop) aloop] |
|
compile unloop skiploop] ; plugin-of loop, |
|
|
|
:noname |
|
1to compile a(+loop) aloop] |
|
compile unloop skiploop] ; plugin-of +loop, |
|
|
|
:noname |
|
compile a(next) aloop] compile unloop ; plugin-of next, |
|
|
|
[THEN] |
|
|
\ String words 23feb93py |
\ String words 23feb93py |
|
|
: ," [char] " parse ht-string, X align ; |
: ," [char] " parse ht-string, X align ; |