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
14 IN: ui.tools.operations
17 [ drop t ] \ inspector H{
21 : com-prettyprint ( obj -- ) . ;
23 [ drop t ] \ com-prettyprint H{
27 : com-push ( obj -- obj ) ;
29 [ drop t ] \ com-push H{
33 : com-unparse ( obj -- ) unparse listener-input ;
35 [ drop t ] \ com-unparse H{ } define-operation
38 [ model? ] \ inspect-model H{
43 : com-input ( obj -- ) string>> listener-input ;
45 [ input? ] \ com-input H{
51 [ restart? ] \ restart H{
58 [ continuation? ] \ traceback-window H{
64 : com-thread-traceback-window ( thread -- )
65 thread-continuation traceback-window ;
67 [ thread? ] \ com-thread-traceback-window H{
72 [ pathname? ] \ edit-file H{
73 { +keyboard+ T{ key-down f { C+ } "e" } }
79 [ definition? ] \ edit H{
80 { +keyboard+ T{ key-down f { C+ } "e" } }
85 [ source-file-error? ] \ edit-error H{
91 : com-reload ( error -- )
94 [ compiler-error? ] \ com-reload H{
99 : com-forget ( defspec -- )
100 [ forget ] with-compilation-unit ;
102 [ definition? ] \ com-forget H{ } define-operation
104 [ topic? ] \ com-browse H{
105 { +keyboard+ T{ key-down f { C+ } "h" } }
109 [ word? ] \ usage. H{
110 { +keyboard+ T{ key-down f { C+ } "u" } }
115 { +keyboard+ T{ key-down f { C+ } "f" } }
119 [ word? ] \ watch H{ } define-operation
121 [ word? ] \ breakpoint H{ } define-operation
123 GENERIC: com-stack-effect ( obj -- )
125 M: quotation com-stack-effect infer. ;
127 M: word com-stack-effect 1quotation com-stack-effect ;
129 : com-enter-in ( vocab -- ) vocab-name set-current-vocab ;
131 [ vocab? ] \ com-enter-in H{
135 : com-use-vocab ( vocab -- ) vocab-name use-vocab ;
137 [ vocab-spec? ] \ com-use-vocab H{
142 [ vocab-spec? ] \ run H{
150 [ vocab-spec? ] \ deploy-tool H{ } define-operation
153 [ quotation? ] \ com-stack-effect H{
154 { +keyboard+ T{ key-down f { C+ } "i" } }
158 [ quotation? ] \ walk H{
159 { +keyboard+ T{ key-down f { C+ } "w" } }
163 [ quotation? ] \ time H{
164 { +keyboard+ T{ key-down f { C+ } "t" } }
168 [ quotation? ] \ com-profile H{
169 { +keyboard+ T{ key-down f { C+ } "o" } }
173 : com-expand-macros ( quot -- ) expand-macros . ;
175 [ quotation? ] \ com-expand-macros H{
176 { +keyboard+ T{ key-down f { C+ } "m" } }
181 [ disposable? ] \ dispose H{ } define-operation
183 ! Disposables with a continuation
184 PREDICATE: tracked-disposable < disposable
185 continuation>> >boolean ;
187 PREDICATE: tracked-malloc-ptr < malloc-ptr
188 continuation>> >boolean ;
190 : com-creation-traceback ( disposable -- )
191 continuation>> traceback-window ;
193 [ tracked-disposable? ] \ com-creation-traceback H{ { +primary+ t } } define-operation
194 [ tracked-malloc-ptr? ] \ com-creation-traceback H{ { +primary+ t } } define-operation
196 ! Operations -> commands
199 "These commands operate on the entire contents of the input area."