Anton,
Might I request a slight change to glocals.fs? We have a lot of people who like to use locals around here, and all of our other implementations allow for uninitialized locals. I see that locals.fs has them, but that code no longer loads. So, I played around a bit with glocals.fs and figured out how to do them. I've included the diffs below. If that could be put into the next release, it would save me from having to always maintain the file myself.
Thanks!
DaR
--- glocals.fs 2003/08/27 19:42:59 1.2 +++ glocals.fs 2004/05/20 18:21:08 1.3 @@ -139,6 +139,8 @@
variable locals-dp \ so here's the special dp for locals.
+false value init-local
+
: alignlp-w ( n1 -- n2 )
\ cell-align size and generate the corresponding code for aligning lp
aligned dup adjust-locals-size ;
@@ -156,6 +158,7 @@
\ stores the offset of the local variable to a-addr
locals-size @ alignlp-w cell+ dup locals-size !
swap !
+ init-local if postpone false then
postpone >l ;
\ locals list operations
@@ -210,18 +213,23 @@
: compile-pushlocal-f ( a-addr -- ) ( run-time: f -- )
locals-size @ alignlp-f float+ dup locals-size !
swap !
+ init-local if postpone false postpone >float then
postpone f>l ; : compile-pushlocal-d ( a-addr -- ) ( run-time: w1 w2 -- )
locals-size @ alignlp-w cell+ cell+ dup locals-size !
swap !
+ init-local if postpone false postpone false then
postpone swap postpone >l postpone >l ; : compile-pushlocal-c ( a-addr -- ) ( run-time: w -- )
-1 chars compile-lp+!
locals-size @ swap !
+ init-local if postpone false then
postpone lp@ postpone c! ;+: compile-init-local ( -- ) false to init-local ;
+
: create-local ( " name" -- a-addr )
\ defines the local "name"; the offset of the local shall be
\ stored in a-addr
@@ -356,6 +364,7 @@
get-order new-locals-wl swap 1+ set-order
also locals definitions locals-types
0 TO locals-wordlist
+ false to init-local
0 postpone [ ; immediate locals-types definitions
@@ -377,6 +386,8 @@
: -- ( addr wid 0 ... -- ) \ gforth dash-dash
}
[char] } parse 2drop ;
+
+: | ( -- ) true to init-local ['] compile-init-local ;forth definitions
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
