File size: 826 Bytes
07c3cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/add-type {                        % => Object Class
  1 index get-types                % => Object Class Types
  array-append                     % => Object Types'
  /Types exch put
} def

/call-method {                     % => ...Params... Box Method 
  1 index get-box-dict             % => ...Params... Box Method Dict
  /Methods get                     % => ...Params... Box Method MethodList

% Check if method have been defined
  dup 2 index known not {
    (Method is not known:) print
    1 index ==
    quit
  } if
  
  exch get exec                    % => 
} def

/get-types {
  dup /Types known {
    dup /Types get
  } {
    []
  } ifelse

  exch pop
} def

/is-a {                            % => Object Class
  1 index get-types                % => Object Class Types
  exch array-find -1 ne
  exch pop
} def