--- gforth/compat/defer.fs 1998/04/29 17:09:46 1.1 +++ gforth/compat/defer.fs 2004/11/28 20:20:37 1.2 @@ -2,20 +2,38 @@ \ This file is in the public domain. NO WARRANTY. -: noop ; - : perform ( ? addr -- ? ) @ execute ; : defer ( "name" -- ) - create ['] noop , \ you should not rely on initialization with noop + create ['] abort , \ you should not rely on initialization with noop does> ( ? -- ? ) perform ; +: defer@ ( xt1 -- xt2 ) + >body @ ; + +: defer! ( xt2 xt1 -- ) + >body ! ; + : ( xt "name" -- ) - ' >body ! ; + ' defer! ; : [is] ( compilation: "name" -- ; run-time: xt -- ) - ' >body postpone Literal postpone ! ; immediate + postpone ['] postpone defer! ; immediate + +: is + state @ if + postpone [is] + else + + then ; immediate + +: action-of + state @ if + POSTPONE ['] POSTPONE defer@ + else + ' defer@ +then ; immediate