]> gitweb.factorcode.org Git - factor.git/blob - extra/obj/view/view.factor
FUEL: Fix bug whereby true display-stacks? could hang the listener.
[factor.git] / extra / obj / view / view.factor
1
2 USING: kernel words namespaces arrays sequences prettyprint
3        help.topics help.markup bake combinators.cleave
4        obj obj.misc obj.print ;
5
6 IN: obj.view
7
8 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9
10 : $tab ( seq -- ) first print-table ;
11 : $obj ( seq -- ) first print-table ;
12 : $seq ( seq -- ) first print-seq   ;
13 : $ptr ( seq -- ) first get print-table ;
14
15 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16
17 PREDICATE: obj-type < symbol types member? ;
18
19 M: obj-type article-title ( type -- title ) unparse ;
20
21 M: obj-type article-content ( type -- content )
22    objects [ type -> = ] with filter
23    { $seq , } bake ;
24
25 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
26
27 M: ptr article-title ( ptr -- title ) [ title -> ] [ unparse ] bi or ;
28
29 M: ptr article-content ( ptr -- content )
30    {
31      [ get     { $obj , } bake ]
32      [ drop { $heading "Related\n" } ]
33      [ related { $seq , } bake ]
34    }
35    1arr ;
36
37 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
38
39 PREDICATE: obj-list < word \ objects = ;
40
41 M: obj-list article-title ( objects -- title ) drop "Objects" ;
42
43 ! M: obj-list article-content ( objects -- title )
44 !    execute
45 !    [ [ type -> ] [ ] bi 2array ] map
46 !    { $tab , } bake ;
47
48 M: obj-list article-content ( objects -- title )
49    drop
50    objects
51    [ [ type -> ] [ ] bi 2array ] map
52    { $tab , } bake ;