]> gitweb.factorcode.org Git - factor.git/blob - extra/obj/obj.factor
FUEL: Fix bug whereby true display-stacks? could hang the listener.
[factor.git] / extra / obj / obj.factor
1
2 USING: kernel words namespaces arrays vectors hashtables
3        sequences assocs sets grouping
4        combinators.conditional
5        combinators.short-circuit
6        obj.util obj.alist ;
7
8 IN: obj
9
10 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11
12 : properties ( -- properties ) V{ } ;
13
14 SYM: self  properties adjoin
15 SYM: type  properties adjoin
16 SYM: title properties adjoin
17
18 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
19
20 : types ( -- types ) V{ } ;
21
22 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
23
24 : >obj ( val -- obj ) [ symbol? ] [ get ] [ ] 1if ;
25
26 : -> ( obj pro -- val ) swap >obj at ;
27
28 PREDICATE: obj < alist { [ self -> ] [ type -> ] } 1&& ;
29
30 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
31
32 : objects ( -- objects ) V{ } ;
33
34 : define-object ( symbol table -- )
35   2 group >vector
36   self rot 2array prefix
37   dup dup self -> set-global
38   self -> objects adjoin ;
39
40 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
41
42 PREDICATE: ptr < symbol get obj? ;
43
44 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
45