1 ! Copyright (C) 2006, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors combinators.short-circuit compiler.errors
4 compiler.units continuations definitions destructors editors
5 help.topics io.pathnames io.styles kernel libc.private
6 macros.expander models parser prettyprint quotations see
7 source-files.errors stack-checker threads tools.annotations
8 tools.crossref tools.test tools.time tools.walker ui.commands
9 ui.gestures ui.operations ui.tools.browser ui.tools.deploy
10 ui.tools.inspector ui.tools.listener ui.tools.traceback vocabs
11 vocabs.loader vocabs.parser words ;
12 IN: ui.tools.operations
15 [ drop t ] \ inspector H{
19 : com-prettyprint ( obj -- ) . ;
21 [ drop t ] \ com-prettyprint H{
25 : com-push ( obj -- obj ) ;
27 [ drop t ] \ com-push H{
31 : com-unparse ( obj -- ) unparse listener-input ;
33 [ drop t ] \ com-unparse H{ } define-operation
36 [ { [ model? ] [ ref>> ] } 1&& ] \ inspect-model H{
41 : com-input ( obj -- ) string>> listener-input ;
43 [ input? ] \ com-input H{
49 [ restart? ] \ continue-restart H{
56 [ continuation? ] \ traceback-window H{
62 : com-thread-traceback-window ( thread -- )
63 thread-continuation traceback-window ;
65 [ thread? ] \ com-thread-traceback-window H{
70 [ pathname? ] \ edit-file H{
71 { +keyboard+ T{ key-down f { C+ } "e" } }
77 [ definition-mixin? ] \ edit H{
78 { +keyboard+ T{ key-down f { C+ } "e" } }
83 [ source-file-error? ] \ edit-error H{
89 : com-reload ( error -- )
92 [ compiler-error? ] \ com-reload H{
97 : com-forget ( defspec -- )
98 [ forget ] with-compilation-unit ;
100 [ definition-mixin? ] \ com-forget H{ } define-operation
102 [ topic? ] \ com-browse H{
103 { +keyboard+ T{ key-down f { C+ } "h" } }
107 [ word? ] \ usage. H{
108 { +keyboard+ T{ key-down f { C+ } "u" } }
113 { +keyboard+ T{ key-down f { C+ } "f" } }
117 [ annotated? not ] \ watch H{ } define-operation
119 [ annotated? ] \ reset H{ } define-operation
121 [ word? ] \ breakpoint H{ } define-operation
127 GENERIC: com-stack-effect ( obj -- )
129 M: quotation com-stack-effect infer. ;
131 M: word com-stack-effect 1quotation com-stack-effect ;
133 : com-enter-in ( vocab -- ) vocab-name set-current-vocab ;
135 [ vocab? ] \ com-enter-in H{
139 : com-use-vocab ( vocab -- ) vocab-name use-vocab ;
141 [ vocab-spec? ] \ com-use-vocab H{
146 [ vocab-spec? ] \ run H{
154 [ vocab-spec? ] \ deploy-tool H{ } define-operation
157 [ quotation? ] \ com-stack-effect H{
158 { +keyboard+ T{ key-down f { C+ } "i" } }
162 [ quotation? ] \ walk H{
163 { +keyboard+ T{ key-down f { C+ } "w" } }
167 [ quotation? ] \ time H{
168 { +keyboard+ T{ key-down f { C+ } "t" } }
172 : com-expand-macros ( quot -- ) expand-macros . ;
174 [ quotation? ] \ com-expand-macros H{
175 { +keyboard+ T{ key-down f { C+ } "m" } }
180 [ disposable? ] \ dispose H{ } define-operation
182 ! Disposables with a continuation
183 PREDICATE: tracked-disposable < disposable
184 continuation>> >boolean ;
186 PREDICATE: tracked-malloc-ptr < malloc-ptr
187 continuation>> >boolean ;
189 : com-creation-traceback ( disposable -- )
190 continuation>> traceback-window ;
192 [ tracked-disposable? ] \ com-creation-traceback H{ { +primary+ t } } define-operation
193 [ tracked-malloc-ptr? ] \ com-creation-traceback H{ { +primary+ t } } define-operation
195 ! Operations -> commands
198 "These commands operate on the entire contents of the input area."