Diff for /gforth/Attic/search-order.fs between versions 1.1 and 1.2

version 1.1, 1994/02/11 16:30:47 version 1.2, 1994/05/07 14:56:06
Line 29  AVariable voclink Line 29  AVariable voclink
   
 \ vocabulary find                                      14may93py  \ vocabulary find                                      14may93py
   
 : (vocfind)  ( addr count nfa1 -- nfa2 / false )  drop  : (vocfind)  ( addr count nfa1 -- nfa2|false )
   1 vp @ DO  2dup vp I cells + @ (search-wordlist)      \ !! generalize this to be independent of vp
              dup IF  nip nip UNLOOP exit  THEN  drop      drop 1 vp @
           -1 +LOOP  2drop false ;      DO  2dup vp I cells + @ (search-wordlist) dup
           IF  nip nip
               UNLOOP EXIT
           THEN  drop
       -1 +LOOP
       2drop false ;
   
   0 value locals-wordlist
   
   : (localsvocfind)  ( addr count nfa1 -- nfa2|false )
       \ !! use generalized (vocfind)
       drop locals-wordlist
       IF 2dup locals-wordlist (search-wordlist) dup
           IF nip nip
               EXIT
           THEN drop
       THEN
       0 (vocfind) ;
   
   \ In the kernal the dictionary search works on only one wordlist.
   \ The following stuff builds a thing that looks to the kernal like one
   \ wordlist, but when searched it searches the whole search order
   \  (including locals)
   
 Create vocsearch       ] (vocfind) (reveal) [  \ this is the wordlist-map of the dictionary
   Create vocsearch       ' (localsvocfind) A, ' (reveal) A,
   
 \ Only root                                            14may93py  \ Only root                                            14may93py
   
 wordlist vocsearch over cell+ A!  wordlist \ the wordlist structure
   vocsearch over cell+ A! \ patch the map into it
   
 Vocabulary Forth  Vocabulary Forth
 Vocabulary Root  Vocabulary Root
Line 51  Forth-wordlist @ ' Forth >body A! Line 75  Forth-wordlist @ ' Forth >body A!
   
 Only Forth also definitions  Only Forth also definitions
   
 search A!  search A! \ our dictionary search order becomes the law
   
 \ get-order set-order                                  14may93py  \ get-order set-order                                  14may93py
   

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>