File:  [gforth] / gforth / moof-exm.fs
Revision 1.1: download - view: text, annotated - select for diffs
Sun Apr 12 21:49:13 1998 UTC (25 years, 11 months ago) by pazsan
Branches: MAIN
CVS tags: v0-5-0, v0-4-0, HEAD
Added mini-oof and example, started docu for that.
Corrected "load" bug in blocks.fs (seems to be that really noone uses blocks.fs).
Minor changes do gforth.el

    1: \ usage:
    2: 
    3: object class
    4:   cell var text
    5:   cell var len
    6:   cell var x
    7:   cell var y
    8:   method init
    9:   method draw
   10: end-class button
   11: 
   12: :noname ( o -- ) >r
   13:  r@ x @ r@ y @ at-xy  r@ text @ r> len @ type ;
   14:  button defines draw
   15: :noname ( addr u o -- ) >r
   16:  0 r@ x ! 0 r@ y ! r@ len ! r> text ! ;
   17:  button defines init
   18: 
   19: \ interitance
   20: 
   21: : bold   27 emit ." [1m" ;
   22: : normal 27 emit ." [0m" ;
   23: 
   24: button class end-class bold-button
   25: :noname bold [ button :: draw ] normal ; bold-button defines draw
   26: 
   27: \ Create and draw a button:
   28: 
   29: button new Constant foo
   30: s" thin foo" foo init
   31: page
   32: foo draw
   33: bold-button new Constant bar
   34: s" fat bar" bar init
   35: 1 bar y !
   36: bar draw

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