--- gforth/glocals.fs 2003/03/22 10:04:07 1.53 +++ gforth/glocals.fs 2005/10/02 11:30:32 1.56 @@ -1,6 +1,6 @@ \ A powerful locals implementation -\ Copyright (C) 1995,1996,1997,1998,2000,2003 Free Software Foundation, Inc. +\ Copyright (C) 1995,1996,1997,1998,2000,2003,2004 Free Software Foundation, Inc. \ This file is part of Gforth. @@ -310,15 +310,21 @@ immediate immediate 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. \ we exploit a feature of our dictionary: every wordlist \ has it's own methods for finding words etc. \ So we create a vocabulary new-locals, that creates a 'w:' local named x \ when it is asked if it contains x. -also locals-types - : new-locals-find ( caddr u w -- nfa ) \ this is the find method of the new-locals vocabulary \ make a new local with name caddr u; w is ignored @@ -632,7 +638,7 @@ forth definitions 2drop endif ; -: >definer ( xt -- definer ) +: >definer ( xt -- definer ) \ gforth \G @var{Definer} is a unique identifier for the way the @var{xt} \G was defined. Words defined with different @code{does>}-codes \G have different definers. The definer can be used for @@ -644,7 +650,7 @@ forth definitions >code-address then ; -: definer! ( definer xt -- ) +: definer! ( definer xt -- ) \ gforth \G The word represented by @var{xt} changes its behaviour to the \G behaviour associated with @var{definer}. over 1 and if @@ -661,7 +667,6 @@ forth definitions -&32 throw endif ; :noname - 0 0 0. 0.0e0 { c: clocal w: wlocal d: dlocal f: flocal } comp' drop dup >definer case [ ' locals-wordlist ] literal >definer \ value @@ -669,13 +674,13 @@ forth definitions \ !! dependent on c: etc. being does>-defining words \ this works, because >definer uses >does-code in this case, \ 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 - [ comp' wlocal drop >definer ] literal + [ comp' some-wlocal drop ] literal >definer 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 - [ comp' flocal drop >definer ] literal + [ comp' some-flocal drop ] literal >definer OF POSTPONE laddr# >body @ lp-offset, POSTPONE f! ENDOF -&32 throw endcase ;