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 namespaces parser prettyprint
7 prettyprint.config quotations see source-files.errors
8 stack-checker threads tools.annotations tools.crossref
9 tools.test tools.time tools.walker ui.clipboards ui.commands
10 ui.gestures ui.operations ui.tools.browser ui.tools.deploy
11 ui.tools.inspector ui.tools.listener ui.tools.traceback vocabs
12 vocabs.loader vocabs.parser words ;
13 IN: ui.tools.operations
16 [ drop t ] \ inspector H{
20 : com-prettyprint ( obj -- ) ... ;
22 [ drop t ] \ com-prettyprint H{
26 : com-push ( obj -- obj ) ;
28 [ drop t ] \ com-push H{
32 : com-unparse ( obj -- ) [ unparse listener-input ] without-limits ;
34 [ drop t ] \ com-unparse H{ } define-operation
36 : com-copy-object ( obj -- ) [ unparse clipboard get set-clipboard-contents ] without-limits ;
38 [ drop t ] \ com-copy-object H{ } define-operation
41 [ { [ model? ] [ ref>> ] } 1&& ] \ inspect-model H{
46 : com-input ( obj -- ) string>> listener-input ;
48 [ input? ] \ com-input H{
54 [ restart? ] \ continue-restart H{
61 [ continuation? ] \ traceback-window H{
67 : com-thread-traceback-window ( thread -- )
68 thread-continuation traceback-window ;
70 [ thread? ] \ com-thread-traceback-window H{
75 [ pathname? ] \ edit-file H{
76 { +keyboard+ T{ key-down f { C+ } "e" } }
82 [ definition-mixin? ] \ edit H{
83 { +keyboard+ T{ key-down f { C+ } "e" } }
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-mixin? ] \ 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 [ annotated? not ] \ watch H{ } define-operation
124 [ annotated? ] \ reset H{ } define-operation
126 [ word? ] \ breakpoint H{ } define-operation
132 GENERIC: com-stack-effect ( obj -- )
134 M: quotation com-stack-effect infer. ;
136 M: word com-stack-effect 1quotation com-stack-effect ;
138 : com-enter-in ( vocab -- ) vocab-name set-current-vocab ;
140 [ vocab? ] \ com-enter-in H{
144 : com-use-vocab ( vocab -- ) vocab-name use-vocab ;
146 [ vocab-spec? ] \ com-use-vocab H{
151 [ vocab-spec? ] \ run H{
159 [ vocab-spec? ] \ deploy-tool H{ } define-operation
162 [ quotation? ] \ com-stack-effect H{
163 { +keyboard+ T{ key-down f { C+ } "i" } }
167 [ quotation? ] \ walk H{
168 { +keyboard+ T{ key-down f { C+ } "w" } }
172 [ quotation? ] \ time H{
173 { +keyboard+ T{ key-down f { C+ } "t" } }
177 : com-expand-macros ( quot -- ) expand-macros . ;
179 [ quotation? ] \ com-expand-macros H{
180 { +keyboard+ T{ key-down f { C+ } "m" } }
185 [ disposable? ] \ dispose H{ } define-operation
187 ! Disposables with a continuation
188 PREDICATE: tracked-disposable < disposable
189 continuation>> >boolean ;
191 PREDICATE: tracked-malloc-ptr < malloc-ptr
192 continuation>> >boolean ;
194 : com-creation-traceback ( disposable -- )
195 continuation>> traceback-window ;
197 [ tracked-disposable? ] \ com-creation-traceback H{
201 [ tracked-malloc-ptr? ] \ com-creation-traceback H{
205 ! Operations -> commands
208 "These commands operate on the entire contents of the input area."