Annotation of gforth/compat/defer.fs, revision 1.2

1.1       anton       1: \ deferred words and perform
                      2: 
                      3: \ This file is in the public domain. NO WARRANTY.
                      4: 
                      5: : perform ( ? addr -- ? )
                      6:     @ execute ;
                      7: 
                      8: : defer ( "name" -- )
1.2     ! anton       9:     create ['] abort , \ you should not rely on initialization with noop
1.1       anton      10: does> ( ? -- ? )
                     11:     perform ;
                     12: 
1.2     ! anton      13: : defer@ ( xt1 -- xt2 )
        !            14:   >body @ ;
        !            15: 
        !            16: : defer! ( xt2 xt1 -- )
        !            17:   >body ! ;
        !            18: 
1.1       anton      19: : <is> ( xt "name" -- )
1.2     ! anton      20:     ' defer! ;
1.1       anton      21: 
                     22: : [is] ( compilation: "name" -- ; run-time: xt -- )
1.2     ! anton      23:     postpone ['] postpone defer! ; immediate
        !            24: 
        !            25: : is
        !            26:   state @ if
        !            27:     postpone [is]
        !            28:   else
        !            29:     <is>
        !            30:   then ; immediate
        !            31: 
        !            32: : action-of
        !            33:  state @ if
        !            34:    POSTPONE ['] POSTPONE defer@
        !            35:  else
        !            36:    ' defer@
        !            37: then ; immediate
1.1       anton      38:     
                     39: 

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