Annotation of gforth/compat/macros.fs, revision 1.1

1.1     ! anton       1: \ implementation of ]] ... [[
        !             2: 
        !             3: \ This file is in the public domain. NO WARRANTY.
        !             4: 
        !             5: \ Avoid having to write so many POSTPONEs; Instead of
        !             6: 
        !             7: \ POSTPONE a POSTPONE b POSTPONE c
        !             8: \ write
        !             9: \ ]] a b c [[
        !            10: 
        !            11: \ In addition there are some shortcuts for literals (not present in
        !            12: \ Gforth 0.7.0 and earlier):
        !            13: 
        !            14: \ 1  ]]L               is equivalent to    1  ]]  literal
        !            15: \ 1. ]]2L              is equivalent to    1. ]] 2literal
        !            16: \ 1e ]]FL              is equivalent to    1e ]] fliteral
        !            17: \ parse-name foo ]]SL  is equivalent to    parse-name foo ]] sliteral
        !            18: 
        !            19: s" X:parse-name" environment? drop \ just let the system know that we need it
        !            20: s" X:required"   environment? drop \ just let the system know that we need it
        !            21: 
        !            22: : refilling-parse-name ( -- old->in c-addr u )
        !            23:     begin
        !            24:        >in @ parse-name dup 0= while
        !            25:            2drop drop refill 0= -39 and throw
        !            26:     repeat ;
        !            27: 
        !            28: : ]] ( -- )
        !            29:     \ switch into postpone state
        !            30:     begin
        !            31:        refilling-parse-name s" [[" compare while
        !            32:            >in ! POSTPONE postpone
        !            33:     repeat
        !            34:     drop ; immediate
        !            35: 
        !            36: : postpone-literal  postpone  literal ;
        !            37: : postpone-2literal postpone 2literal ;
        !            38: : postpone-fliteral postpone fliteral ;
        !            39: : postpone-sliteral postpone sliteral ;
        !            40: 
        !            41: : ]]L ( postponing: x -- ; compiling: -- x )
        !            42:     \ Shortcut for @code{]] literal}.
        !            43:     ]] postpone-literal ]] [[ ; immediate
        !            44: 
        !            45: : ]]2L ( postponing: x1 x2 -- ; compiling: -- x1 x2 )
        !            46:     \ Shortcut for @code{]] 2literal}.
        !            47:     ]] postpone-2literal ]] [[ ; immediate
        !            48: 
        !            49: : ]]FL ( postponing: r -- ; compiling: -- r )
        !            50:     \ Shortcut for @code{]] fliteral}.
        !            51:     ]] postpone-fliteral ]] [[ ; immediate
        !            52: 
        !            53: : ]]SL ( postponing: addr1 u -- ; compiling: -- addr2 u )
        !            54:     \ Shortcut for @code{]] sliteral}; if the string already has been
        !            55:     \ allocated permanently, you can use @code{]]2L} instead.
        !            56:     ]] postpone-sliteral ]] [[ ; immediate

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