Diff for /gforth/quotations.fs between versions 1.1 and 1.3

version 1.1, 2011/12/16 21:18:01 version 1.3, 2012/02/09 17:27:37
Line 2 Line 2
   
 :noname  false :noname ;  :noname  false :noname ;
 :noname  locals-wordlist last @ lastcfa @  :noname  locals-wordlist last @ lastcfa @
     postpone SCOPE postpone AHEAD  true  :noname ;      postpone AHEAD
 interpret/compile: [:      locals-list @ locals-list off
       postpone SCOPE
       true  :noname  ;
   interpret/compile: [: ( -- quotation-sys )
   \G Starts a quotation
   
 : ;] ( compile-time: orig colon-sys -- ; run-time: -- xt )  : ;] ( compile-time: quotation-sys -- ; run-time: -- xt )
       \g ends a quotation
     POSTPONE ; >r IF      POSTPONE ; >r IF
         ]  postpone THEN  r> postpone ALiteral  postpone ENDSCOPE          ]  postpone ENDSCOPE
           locals-list !
           postpone THEN
         lastcfa ! last ! to locals-wordlist          lastcfa ! last ! to locals-wordlist
           r> postpone ALiteral
     ELSE  r>  THEN ( xt ) ; immediate      ELSE  r>  THEN ( xt ) ; immediate
   
 \\\  0 [IF] \ tests
 : if-else ( ... f xt1 xt2 -- ... )  : if-else ( ... f xt1 xt2 -- ... )
 \ Postscript-style if-else  \ Postscript-style if-else
     rot IF      rot IF
Line 28  interpret/compile: [: Line 36  interpret/compile: [:
         
 1 test cr \ writes "true"  1 test cr \ writes "true"
 0 test cr \ writes "false"  0 test cr \ writes "false"
   
   \ locals within quotations
   
   : foo { a b } a b
       [: { x y } x y + ;] execute . a . b . ;
   2 3 foo
   [THEN]
   

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


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