On Mon, Aug 27, 2012 at 2:01 AM, Programmingkid
I'm new to using git, so if there are any problems
with this patch, let me know and I will try to fix it.
Patch description and Signed-off-by: line are missing. I suppose this
patch only contains changes to one file, but a patch should change all
necessary pieces at once. Please check for example
I don't know Forth so well to comment on the actual content, sorry.
The indentation should match other code.
This patch is the first of two patches for adding local variable support to OpenBIOS. As
you may know, local variable support is required to be able to run Mac OS X in QEMU one
day. This and the second patch takes us one step closer to that day.
forth/bootstrap/interpreter.fs | 41 +++++++++++++++++++++++++++++----------
1 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/forth/bootstrap/interpreter.fs b/forth/bootstrap/interpreter.fs
index 5187058..486bb03 100644
@@ -40,16 +40,10 @@
\ 22.214.171.124.4 Miscellaneous dictionary
-\ interpreter. This word checks whether the interpreted word
-\ is a word in dictionary or a number. It honours compile mode
-\ and immediate/compile-only words.
- 0 >in !
- parse-word dup 0> \ was there a word at all?
+\ most of the old version of interpret
dup flags? 0<> state @ 0= or if
@@ -70,9 +64,34 @@
depth 0< if -4 throw then
rdepth 200 >= if -5 throw then
rdepth 0< if -6 throw then
+false VALUE usingLocals
+\ The refactored interpret - supports local variables
+ 0 >in !
+ parse-word dup 0> ( addr len flag ) \ was there a word at all?
+ while ( addr len )
+ usingLocals true = if ( addr len ) \ if local variables are being used
+ mydefer ( addr len flag )
+ not if ( ) \ if symbol is not a local variable
+ else \ if not using local variables
: refill ( -- )
ib #ib @ expect 0 >in ! ;
Free your System - May the Forth be with you