On Mon, Aug 27, 2012 at 2:01 AM, Programmingkid programmingkidx@gmail.com wrote:
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 http://www.kernel.org/doc/Documentation/SubmittingPatches
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 --- a/forth/bootstrap/interpreter.fs +++ b/forth/bootstrap/interpreter.fs @@ -40,16 +40,10 @@ \ 7.3.9.2.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.
-: interpret
- 0 >in !
- begin
- parse-word dup 0> \ was there a word at all?
- while
- $find
+\ most of the old version of interpret +: oldInterpret
- $find if dup flags? 0<> state @ 0= or if execute
@@ -70,9 +64,34 @@ depth 0< if -4 throw then rdepth 200 >= if -5 throw then rdepth 0< if -6 throw then
- repeat
+;
+Defer mydefer +false VALUE usingLocals
+\ The refactored interpret - supports local variables +: interpret
- 0 >in !
- begin
- 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
oldInterpret
then
else \ if not using local variables
oldInterpret
then
2droprepeat
- ;
+;
: refill ( -- ) ib #ib @ expect 0 >in ! ; -- 1.7.5.4
-- OpenBIOS http://openbios.org/ Mailinglist: http://lists.openbios.org/mailman/listinfo Free your System - May the Forth be with you