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, 5 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

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

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