Diff for /gforth/moofglos.fs between versions 1.2 and 1.4

version 1.2, 1999/02/28 23:00:29 version 1.4, 2000/08/23 21:03:52
Line 1 Line 1
 : method ( m v -- m' v ) \ mini-oof  \ This contains the same Forth source as mini-oof.fs, but
     \G Define a method.  \ also contains glossary information for the manual.
   
   : method ( m v "name" -- m' v ) \ mini-oof
       \G Define a selector.
     Create  over , swap cell+ swap      Create  over , swap cell+ swap
   DOES> ( ... o -- ... ) @ over @ + @ execute ;    DOES> ( ... o -- ... ) @ over @ + @ execute ;
   
 : var ( m v size -- m v' ) \ mini-oof  : var ( m v size "name" -- m v' ) \ mini-oof
     \G Define a variable with @var{size} bytes.      \G Define a variable with @var{size} bytes.
     Create  over , +      Create  over , +
   DOES> ( o -- addr ) @ + ;    DOES> ( o -- addr ) @ + ;
   
 : class ( class -- class methods vars ) \ mini-oof  : class ( class -- class selectors vars ) \ mini-oof
     \G Start the definition of a class.      \G Start the definition of a class.
     dup 2@ ;      dup 2@ ;
   
 : end-class  ( class methods vars -- ) \ mini-oof  : end-class  ( class selectors vars "name" -- ) \ mini-oof
     \G End the definition of a class.      \G End the definition of a class.
     Create  here >r , dup , 2 cells ?DO ['] noop , 1 cells +LOOP      Create  here >r , dup , 2 cells ?DO ['] noop , 1 cells +LOOP
     cell+ dup cell+ r> rot @ 2 cells /string move ;      cell+ dup cell+ r> rot @ 2 cells /string move ;
   
 : defines ( xt class "name" -- ) \ mini-oof  : defines ( xt class "name" -- ) \ mini-oof
     \G Bind @var{xt} to the method @var{name} in class @var{class}.      \G Bind @var{xt} to the selector @var{name} in class @var{class}.
     ' >body @ + ! ;      ' >body @ + ! ;
   
 : new ( class -- o ) \ mini-oof  : new ( class -- o ) \ mini-oof
Line 26 Line 29
     here over @ allot swap over ! ;      here over @ allot swap over ! ;
   
 : :: ( class "name" -- ) \ mini-oof colon-colon  : :: ( class "name" -- ) \ mini-oof colon-colon
     \G Compile the method @var{name} of the class @var{class} (not immediate!).      \G Compile the method for the selector @var{name} of the class
       \G @var{class} (not immediate!).
     ' >body @ + @ compile, ;      ' >body @ + @ compile, ;
   
 Create object ( -- a-addr ) \ mini-oof  Create object ( -- a-addr ) \ mini-oof

Removed from v.1.2  
changed lines
  Added in v.1.4


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