user-object.fs 671 Bytes
Newer Older
Bernd Paysan's avatar
Bernd Paysan committed
1 2 3 4 5 6
\ Mini-OOF extension: current object in user variable  08jan13py

Variable class-o

: user-o ( "name" -- )
    0 uallot class-o !  User ;
7 8
: uval-o ( "name" -- )
    0 uallot class-o !  UValue ;
Bernd Paysan's avatar
Bernd Paysan committed
9 10

: umethod ( m v -- m' v )
Bernd Paysan's avatar
Bernd Paysan committed
11
    postpone nocov[
Bernd Paysan's avatar
Bernd Paysan committed
12 13
    over >r : postpone u#exec class-o @ , r> cell/ , postpone ;
    swap cell+ swap
14 15 16
    ['] umethod, set-optimizer
    ['] is-umethod set-to
    ['] umethod-defer@ set-defer@
Bernd Paysan's avatar
Bernd Paysan committed
17
    postpone ]nocov ;
Bernd Paysan's avatar
Bernd Paysan committed
18 19

: uvar ( m v size -- m v' )
Bernd Paysan's avatar
Bernd Paysan committed
20
    postpone nocov[
Bernd Paysan's avatar
Bernd Paysan committed
21
    over >r : postpone u#+ class-o @ , r> , postpone ; +
22
    ['] uvar, set-optimizer
Bernd Paysan's avatar
Bernd Paysan committed
23
    postpone ]nocov ;
24 25

: uclass ( c "name" -- c m v )
26
    ' >body @ class-o ! dup cell- cell- 2@ ;