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 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{
73 : edit-file ( pathname -- ) edit ;
75 [ pathname? ] \ edit-file H{
76 { +keyboard+ T{ key-down f { C+ } "b" } }
82 [ definition? ] \ edit H{
83 { +keyboard+ T{ key-down f { C+ } "b" } }
88 [ source-file-error? ] \ edit-error H{
94 : com-reload ( error -- )
97 [ compiler-error? ] \ com-reload H{
102 : com-forget ( defspec -- )
103 [ forget ] with-compilation-unit ;
105 [ definition? ] \ com-forget H{ } define-operation
107 [ topic? ] \ com-browse H{
108 { +keyboard+ T{ key-down f { C+ } "h" } }
112 [ word? ] \ usage. H{
113 { +keyboard+ T{ key-down f { C+ } "u" } }
118 { +keyboard+ T{ key-down f { C+ } "f" } }
122 [ word? ] \ watch H{ } define-operation
124 [ word? ] \ breakpoint H{ } define-operation
126 GENERIC: com-stack-effect ( obj -- )
128 M: quotation com-stack-effect infer. ;
130 M: word com-stack-effect 1quotation com-stack-effect ;
132 : com-enter-in ( vocab -- ) vocab-name set-current-vocab ;
134 [ vocab? ] \ com-enter-in H{
138 : com-use-vocab ( vocab -- ) vocab-name use-vocab ;
140 [ vocab-spec? ] \ com-use-vocab H{
145 [ vocab-spec? ] \ run H{
153 [ vocab-spec? ] \ deploy-tool H{ } define-operation
156 [ quotation? ] \ com-stack-effect H{
157 { +keyboard+ T{ key-down f { C+ } "i" } }
161 [ quotation? ] \ walk H{
162 { +keyboard+ T{ key-down f { C+ } "w" } }
166 [ quotation? ] \ time H{
167 { +keyboard+ T{ key-down f { C+ } "t" } }
171 [ quotation? ] \ com-profile H{
172 { +keyboard+ T{ key-down f { C+ } "o" } }
176 : com-expand-macros ( quot -- ) expand-macros . ;
178 [ quotation? ] \ com-expand-macros H{
179 { +keyboard+ T{ key-down f { C+ } "m" } }
184 [ disposable? ] \ dispose H{ } define-operation
186 ! Disposables with a continuation
187 PREDICATE: tracked-disposable < disposable
188 continuation>> >boolean ;
190 PREDICATE: tracked-malloc-ptr < malloc-ptr
191 continuation>> >boolean ;
193 : com-creation-traceback ( disposable -- )
194 continuation>> traceback-window ;
196 [ tracked-disposable? ] \ com-creation-traceback H{ { +primary+ t } } define-operation
197 [ tracked-malloc-ptr? ] \ com-creation-traceback H{ { +primary+ t } } define-operation
199 ! Operations -> commands
202 "These commands operate on the entire contents of the input area."