| immediate |
immediate |
| |
|
| forth definitions |
forth definitions |
| |
also locals-types |
| |
|
| |
\ these "locals" are used for comparison in TO |
| |
|
| |
c: some-clocal 2drop |
| |
d: some-dlocal 2drop |
| |
f: some-flocal 2drop |
| |
w: some-wlocal 2drop |
| |
|
| \ the following gymnastics are for declaring locals without type specifier. |
\ the following gymnastics are for declaring locals without type specifier. |
| \ we exploit a feature of our dictionary: every wordlist |
\ we exploit a feature of our dictionary: every wordlist |
| \ So we create a vocabulary new-locals, that creates a 'w:' local named x |
\ So we create a vocabulary new-locals, that creates a 'w:' local named x |
| \ when it is asked if it contains x. |
\ when it is asked if it contains x. |
| |
|
| also locals-types |
|
| |
|
| : new-locals-find ( caddr u w -- nfa ) |
: new-locals-find ( caddr u w -- nfa ) |
| \ this is the find method of the new-locals vocabulary |
\ this is the find method of the new-locals vocabulary |
| \ make a new local with name caddr u; w is ignored |
\ make a new local with name caddr u; w is ignored |
| -&32 throw |
-&32 throw |
| endif ; |
endif ; |
| :noname |
:noname |
| 0 0 0. 0.0e0 { c: clocal w: wlocal d: dlocal f: flocal } |
|
| comp' drop dup >definer |
comp' drop dup >definer |
| case |
case |
| [ ' locals-wordlist ] literal >definer \ value |
[ ' locals-wordlist ] literal >definer \ value |
| \ !! dependent on c: etc. being does>-defining words |
\ !! dependent on c: etc. being does>-defining words |
| \ this works, because >definer uses >does-code in this case, |
\ this works, because >definer uses >does-code in this case, |
| \ which produces a relocatable address |
\ which produces a relocatable address |
| [ comp' clocal drop >definer ] literal |
[ comp' some-clocal drop ] literal >definer |
| OF POSTPONE laddr# >body @ lp-offset, POSTPONE c! ENDOF |
OF POSTPONE laddr# >body @ lp-offset, POSTPONE c! ENDOF |
| [ comp' wlocal drop >definer ] literal |
[ comp' some-wlocal drop ] literal >definer |
| OF POSTPONE laddr# >body @ lp-offset, POSTPONE ! ENDOF |
OF POSTPONE laddr# >body @ lp-offset, POSTPONE ! ENDOF |
| [ comp' dlocal drop >definer ] literal |
[ comp' some-dlocal drop ] literal >definer |
| OF POSTPONE laddr# >body @ lp-offset, POSTPONE 2! ENDOF |
OF POSTPONE laddr# >body @ lp-offset, POSTPONE 2! ENDOF |
| [ comp' flocal drop >definer ] literal |
[ comp' some-flocal drop ] literal >definer |
| OF POSTPONE laddr# >body @ lp-offset, POSTPONE f! ENDOF |
OF POSTPONE laddr# >body @ lp-offset, POSTPONE f! ENDOF |
| -&32 throw |
-&32 throw |
| endcase ; |
endcase ; |