1 \ @(#) forget.fth 98/01/26 1.2
\r
4 \ forget part of dictionary
\r
7 \ Copyright 1994 3DO, Phil Burk, Larry Polansky, Devid Rosenboom
\r
9 \ The pForth software code is dedicated to the public domain,
\r
10 \ and any third party may reproduce, distribute and modify
\r
11 \ the pForth software code or any derivative works thereof
\r
12 \ without any compensation or license. The pForth software
\r
13 \ code is provided on an "as is" basis without any warranty
\r
14 \ of any kind, including, without limitation, the implied
\r
15 \ warranties of merchantability and fitness for a particular
\r
16 \ purpose and their equivalents under the laws of any jurisdiction.
\r
18 \ 19970701 PLB Use unsigned compares for machines with "negative" addresses.
\r
20 variable RFENCE \ relocatable value below which we won't forget
\r
22 : FREEZE ( -- , protect below here )
\r
26 : FORGET.NFA ( nfa -- , set DP etc. )
\r
27 dup name> >code dp !
\r
28 prevname ( dup current ! ) dup context ! n>nextlink headers-ptr !
\r
31 : VERIFY.FORGET ( nfa -- , ask for verification if below fence )
\r
32 dup name> >code rfence a@ u< \ 19970701
\r
34 >newline dup id. ." is below fence!!" cr
\r
40 : (FORGET) ( <name> -- )
\r
43 ELSE ." FORGET - couldn't find " count type cr abort
\r
47 variable LAST-FORGET \ contains address of last if.forgotten frame
\r
50 : IF.FORGOTTEN ( <name> -- , place links in dictionary without header )
\r
53 here \ start of frame
\r
54 last-forget a@ a, \ Cell[0] = rel address of previous frame
\r
55 last-forget a! \ point to this frame
\r
56 compile, \ Cell[1] = xt for this frame
\r
57 ELSE ." IF.FORGOTTEN - couldn't find " dup 9 dump cr count type cr abort
\r
62 : [FORGET] ( <name> -- , forget then exec forgotten words )
\r
65 BEGIN a@ dup 0<> \ 19970701
\r
66 IF dup here u> \ 19970701
\r
67 IF dup cell+ x@ execute false
\r
68 ELSE dup last-forget a! true
\r
75 : FORGET ( <name> -- , execute latest [FORGET] )
\r
78 ELSE ." FORGET - couldn't find " count type cr abort
\r
82 : ANEW ( -- , forget if defined then redefine )
\r
85 IF over >in ! forget
\r
90 : MARKER ( <name> -- , define a word that forgets itself when executed, ANS )
\r
92 latest namebase - \ convert to relocatable
\r
95 @ namebase + \ convert back to NFA
\r