]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/tools/operations/operations.factor
move counting profiler to tools.profiler.counting
[factor.git] / basis / ui / tools / operations / operations.factor
1 ! Copyright (C) 2006, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: continuations definitions generic help.topics threads
4 stack-checker summary io.pathnames io.styles kernel namespaces
5 parser prettyprint quotations tools.crossref tools.annotations
6 editors tools.profiler.counting tools.test tools.time tools.walker vocabs
7 vocabs.loader words sequences classes compiler.errors
8 compiler.units accessors vocabs.parser macros.expander ui
9 ui.tools.browser ui.tools.listener ui.tools.listener.completion
10 ui.tools.profiler ui.tools.inspector ui.tools.traceback
11 ui.commands ui.gadgets.editors ui.gestures ui.operations
12 ui.tools.deploy models help.tips source-files.errors destructors
13 libc libc.private ;
14 IN: ui.tools.operations
15
16 ! Objects
17 [ drop t ] \ inspector H{
18     { +primary+ t }
19 } define-operation
20
21 : com-prettyprint ( obj -- ) . ;
22
23 [ drop t ] \ com-prettyprint H{
24     { +listener+ t }
25 } define-operation
26
27 : com-push ( obj -- obj ) ;
28
29 [ drop t ] \ com-push H{
30     { +listener+ t }
31 } define-operation
32
33 : com-unparse ( obj -- ) unparse listener-input ;
34
35 [ drop t ] \ com-unparse H{ } define-operation
36
37 ! Models
38 [ model? ] \ inspect-model H{
39     { +primary+ t }
40 } define-operation
41
42 ! Input
43 : com-input ( obj -- ) string>> listener-input ;
44
45 [ input? ] \ com-input H{
46     { +primary+ t }
47     { +secondary+ t }
48 } define-operation
49
50 ! Restart
51 [ restart? ] \ restart H{
52     { +primary+ t }
53     { +secondary+ t }
54     { +listener+ t }
55 } define-operation
56
57 ! Continuation
58 [ continuation? ] \ traceback-window H{
59     { +primary+ t }
60     { +secondary+ t }
61 } define-operation
62
63 ! Thread
64 : com-thread-traceback-window ( thread -- )
65     thread-continuation traceback-window ;
66
67 [ thread? ] \ com-thread-traceback-window H{
68     { +primary+ t }
69     { +secondary+ t }
70 } define-operation
71
72 [ pathname? ] \ edit-file H{
73     { +keyboard+ T{ key-down f { C+ } "e" } }
74     { +primary+ t }
75     { +secondary+ t }
76     { +listener+ t }
77 } define-operation
78
79 [ definition? ] \ edit H{
80     { +keyboard+ T{ key-down f { C+ } "e" } }
81     { +listener+ t }
82 } define-operation
83
84 ! Source file error
85 [ source-file-error? ] \ edit-error H{
86     { +primary+ t }
87     { +secondary+ t }
88     { +listener+ t }
89 } define-operation
90
91 : com-reload ( error -- )
92     file>> run-file ;
93
94 [ compiler-error? ] \ com-reload H{
95     { +listener+ t }
96 } define-operation
97
98 ! Definitions
99 : com-forget ( defspec -- )
100     [ forget ] with-compilation-unit ;
101
102 [ definition? ] \ com-forget H{ } define-operation
103
104 [ topic? ] \ com-browse H{
105     { +keyboard+ T{ key-down f { C+ } "h" } }
106     { +primary+ t }
107 } define-operation
108
109 [ word? ] \ usage. H{
110     { +keyboard+ T{ key-down f { C+ } "u" } }
111     { +listener+ t }
112 } define-operation
113
114 [ word? ] \ fix H{
115     { +keyboard+ T{ key-down f { C+ } "f" } }
116     { +listener+ t }
117 } define-operation
118
119 [ word? ] \ watch H{ } define-operation
120
121 [ word? ] \ breakpoint H{ } define-operation
122
123 GENERIC: com-stack-effect ( obj -- )
124
125 M: quotation com-stack-effect infer. ;
126
127 M: word com-stack-effect 1quotation com-stack-effect ;
128
129 : com-enter-in ( vocab -- ) vocab-name set-current-vocab ;
130
131 [ vocab? ] \ com-enter-in H{
132     { +listener+ t }
133 } define-operation
134
135 : com-use-vocab ( vocab -- ) vocab-name use-vocab ;
136
137 [ vocab-spec? ] \ com-use-vocab H{
138     { +secondary+ t }
139     { +listener+ t }
140 } define-operation
141
142 [ vocab-spec? ] \ run H{
143     { +listener+ t }
144 } define-operation
145
146 [ vocab? ] \ test H{
147     { +listener+ t }
148 } define-operation
149
150 [ vocab-spec? ] \ deploy-tool H{ } define-operation
151
152 ! Quotations
153 [ quotation? ] \ com-stack-effect H{
154     { +keyboard+ T{ key-down f { C+ } "i" } }
155     { +listener+ t }
156 } define-operation
157
158 [ quotation? ] \ walk H{
159     { +keyboard+ T{ key-down f { C+ } "w" } }
160     { +listener+ t }
161 } define-operation
162
163 [ quotation? ] \ time H{
164     { +keyboard+ T{ key-down f { C+ } "t" } }
165     { +listener+ t }
166 } define-operation
167
168 [ quotation? ] \ com-profile H{
169     { +keyboard+ T{ key-down f { C+ } "o" } }
170     { +listener+ t }
171 } define-operation
172
173 : com-expand-macros ( quot -- ) expand-macros . ;
174
175 [ quotation? ] \ com-expand-macros H{
176     { +keyboard+ T{ key-down f { C+ } "m" } }
177     { +listener+ t }
178 } define-operation
179
180 ! Disposables
181 [ disposable? ] \ dispose H{ } define-operation
182
183 ! Disposables with a continuation
184 PREDICATE: tracked-disposable < disposable
185     continuation>> >boolean ;
186
187 PREDICATE: tracked-malloc-ptr < malloc-ptr
188     continuation>> >boolean ;
189
190 : com-creation-traceback ( disposable -- )
191     continuation>> traceback-window ;
192
193 [ tracked-disposable? ] \ com-creation-traceback H{ { +primary+ t } } define-operation
194 [ tracked-malloc-ptr? ] \ com-creation-traceback H{ { +primary+ t } } define-operation
195
196 ! Operations -> commands
197 interactor
198 "quotation"
199 "These commands operate on the entire contents of the input area."
200 [ ]
201 [ quot-action ]
202 define-operation-map