Diff for /gforth/doc/gforth.ds between versions 1.7 and 1.8

version 1.7, 1997/08/03 20:21:54 version 1.8, 1998/04/12 21:49:28
Line 2947  doc-struct Line 2947  doc-struct
   
 @cindex @file{objects.fs}  @cindex @file{objects.fs}
 @cindex @file{oof.fs}  @cindex @file{oof.fs}
 Gforth comes with two packets for object-oriented programming,  Gforth comes with three packets for object-oriented programming,
 @file{objects.fs} and @file{oof.fs}; none of them is preloaded, so you  @file{objects.fs}, @file{oof.fs}, and @file{mini-oof.fs}; none of them
 have to @code{include} them before use. This section describes the  is preloaded, so you have to @code{include} them before use. This
 @file{objects.fs} packet. You can find a description (in German) of  section describes the @file{objects.fs} packet. You can find a
 @file{oof.fs} in @cite{Object oriented bigFORTH} by Bernd Paysan,  description (in German) of @file{oof.fs} in @cite{Object oriented
 published in @cite{Vierte Dimension} 10(2), 1994. Both packets are  bigFORTH} by Bernd Paysan, published in @cite{Vierte Dimension} 10(2),
 written in ANS Forth and can be used with any other standard Forth.  1994. Both packets are written in ANS Forth and can be used with any
   other standard Forth.
 @c McKewan's and Zsoter's packages  @c McKewan's and Zsoter's packages
 @c this section is a variant of ...  @c this section is a variant of ...
   
Line 3759  doc-to-this Line 3760  doc-to-this
 doc-xt-new  doc-xt-new
   
 @c -------------------------------------------------------------  @c -------------------------------------------------------------
 @node Object Oriented Forth, Tokens for Words, Objects, Words  @node Object Oriented Forth, Mini-OOF, Objects, Words
 @section Object oriented Forth  @section Object oriented Forth
 @cindex oof  @cindex oof
 @cindex object-oriented programming  @cindex object-oriented programming
Line 4016  doc---oof-class; Line 4017  doc---oof-class;
 @subsection Class Implementation  @subsection Class Implementation
 @cindex class implementation  @cindex class implementation
   
   @node Mini-OOF, Tokens for Words, Object Oriented Forth, Words
   @section Mini-OOF
   @cindex mini-oof
   
   Gforth's third object oriented Forth package is a 12-liner. It uses a
   bit of a mixture of the @file{object.fs} and the @file{oof.fs} syntax,
   and reduces to the bare minimum of features.
   
   @example
   : 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 , cell +LOOP
     cell+ dup cell+ swap @ 2 - cells r> 2 cells + swap move ;
   : defines ( xt class -- ) ' >body @ + ! ;
   : new ( class -- o )  here over @ allot swap over ! ;
   : :: ( class "name" -- ) ' >body @ + @ compile, ;
   Create object  1 cells , 2 cells ,
   @end example
   
 @c -------------------------------------------------------------  @c -------------------------------------------------------------
 @node Tokens for Words, Wordlists, Object Oriented Forth, Words  @node Tokens for Words, Wordlists, Mini-OOF, Words
 @section Tokens for Words  @section Tokens for Words
 @cindex tokens for words  @cindex tokens for words
   

Removed from v.1.7  
changed lines
  Added in v.1.8


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