File:  [gforth] / gforth / mini-oof.fs
Revision 1.4: download - view: text, annotated - select for diffs
Sat Oct 10 10:28:34 1998 UTC (25 years, 6 months ago) by pazsan
Branches: MAIN
CVS tags: v0-4-0, HEAD
Changed virtual method table pointer in dictionary objects to be compatible with
the other OO packages (VMT-pointer on first cell)

You need a new kernel.fi to recompile the kernel

: method ( m v -- m' v ) Create  over , swap cell+ swap
  DOES> ( ... o -- ... ) @ over @ + @ execute ;
: var ( m v size -- m v' ) Create  over , +
  DOES> ( o -- addr ) @ + ;
: class ( class -- class methods vars ) dup 2@ ;
: end-class  ( class methods vars -- )
  Create  here >r , dup , 2 cells ?DO ['] noop , 1 cells +LOOP
  cell+ dup cell+ r> rot @ 2 cells /string move ;
: defines ( xt class "name" -- ) ' >body @ + ! ;
: new ( class -- o )  here over @ allot swap over ! ;
: :: ( class "name" -- ) ' >body @ + @ compile, ;
Create object  1 cells , 2 cells ,

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