[gforth] / gforth / mini-oof.fs  

gforth: gforth/mini-oof.fs

Diff for /gforth/mini-oof.fs between version 1.4 and 1.5

version 1.4, Sat Oct 10 10:28:34 1998 UTC version 1.5, Tue Feb 16 06:32:28 1999 UTC
Line 1 
Line 1 
 : method ( m v -- m' v ) Create  over , swap cell+ swap  : method ( m v -- m' v ) \ mini-oof
       \G Define a method.
       Create  over , swap cell+ swap
   DOES> ( ... o -- ... ) @ over @ + @ execute ;    DOES> ( ... o -- ... ) @ over @ + @ execute ;
 : var ( m v size -- m v' ) Create  over , +  
   : var ( m v size -- m v' ) \ mini-oof
       \G Define a variable with @var{size} bytes.
       Create  over , +
   DOES> ( o -- addr ) @ + ;    DOES> ( o -- addr ) @ + ;
 : class ( class -- class methods vars ) dup 2@ ;  
 : end-class  ( class methods vars -- )  : class ( class -- class methods vars ) \ mini-oof
       \G Start the definition of a class.
       dup 2@ ;
   
   : end-class  ( class methods vars -- ) \ mini-oof
       \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" -- ) ' >body @ + ! ;  
 : new ( class -- o )  here over @ allot swap over ! ;  : defines ( xt class "name" -- ) \ mini-oof
 : :: ( class "name" -- ) ' >body @ + @ compile, ;      \G Bind @var{xt} to the method @var{name} in class @var{class}.
 Create object  1 cells , 2 cells ,      ' >body @ + ! ;
   
   : new ( class -- o ) \ mini-oof
       \G Create a new incarnation of the class @var{class}.
       here over @ allot swap over ! ;
   
   : :: ( class "name" -- ) \ mini-oof colon-colon
       \G Compile the method @var{name} of the class @var{class} (not immediate!).
       ' >body @ + @ compile, ;
   
   Create object ( -- a-addr ) \ mini-oof
   1 cells , 2 cells ,
   \G @var{object} is the base class of all objects.


Generate output suitable for use with a patch program
Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help