]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/tools/operations/operations.factor
Fix conflict
[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 tools.test tools.time tools.walker vocabs
7 vocabs.loader words sequences tools.vocabs classes
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 ;
13 IN: ui.tools.operations
14
15 ! Objects
16 [ drop t ] \ inspector H{
17     { +primary+ t }
18 } define-operation
19
20 : com-prettyprint ( obj -- ) . ;
21
22 [ drop t ] \ com-prettyprint H{
23     { +listener+ t }
24 } define-operation
25
26 : com-push ( obj -- obj ) ;
27
28 [ drop t ] \ com-push H{
29     { +listener+ t }
30 } define-operation
31
32 : com-unparse ( obj -- ) unparse listener-input ;
33
34 [ drop t ] \ com-unparse H{ } define-operation
35
36 ! Models
37 [ model? ] \ inspect-model H{
38     { +primary+ t }
39 } define-operation
40
41 ! Input
42 : com-input ( obj -- ) string>> listener-input ;
43
44 [ input? ] \ com-input H{
45     { +primary+ t }
46     { +secondary+ t }
47 } define-operation
48
49 ! Restart
50 [ restart? ] \ restart H{
51     { +primary+ t }
52     { +secondary+ t }
53     { +listener+ t }
54 } define-operation
55
56 ! Continuation
57 [ continuation? ] \ traceback-window H{
58     { +primary+ t }
59     { +secondary+ t }
60 } define-operation
61
62 ! Thread
63 : com-thread-traceback-window ( thread -- )
64     continuation>> dup occupied>>
65     [ value>> traceback-window ]
66     [ drop beep ]
67     if ;
68
69 [ thread? ] \ com-thread-traceback-window H{
70     { +primary+ t }
71     { +secondary+ t }
72 } define-operation
73
74 ! Pathnames
75 : edit-file ( pathname -- ) edit ;
76
77 [ pathname? ] \ edit-file H{
78     { +keyboard+ T{ key-down f { C+ } "e" } }
79     { +primary+ t }
80     { +secondary+ t }
81     { +listener+ t }
82 } define-operation
83
84 UNION: definition word method-spec link vocab vocab-link ;
85
86 [ definition? ] \ edit H{
87     { +keyboard+ T{ key-down f { C+ } "e" } }
88     { +listener+ t }
89 } define-operation
90
91 : com-forget ( defspec -- )
92     [ forget ] with-compilation-unit ;
93
94 [ definition? ] \ com-forget H{ } define-operation
95
96 [ topic? ] \ com-follow H{
97     { +keyboard+ T{ key-down f { C+ } "h" } }
98     { +primary+ t }
99 } define-operation
100
101 [ word? ] \ usage. H{
102     { +keyboard+ T{ key-down f { C+ } "u" } }
103     { +listener+ t }
104 } define-operation
105
106 [ word? ] \ fix H{
107     { +keyboard+ T{ key-down f { C+ } "f" } }
108     { +listener+ t }
109 } define-operation
110
111 [ word? ] \ watch H{ } define-operation
112
113 [ word? ] \ breakpoint H{ } define-operation
114
115 GENERIC: com-stack-effect ( obj -- )
116
117 M: quotation com-stack-effect infer. ;
118
119 M: word com-stack-effect 1quotation com-stack-effect ;
120
121 : com-enter-in ( vocab -- ) vocab-name set-in ;
122
123 [ vocab? ] \ com-enter-in H{
124     { +listener+ t }
125 } define-operation
126
127 : com-use-vocab ( vocab -- ) vocab-name use+ ;
128
129 [ vocab-spec? ] \ com-use-vocab H{
130     { +secondary+ t }
131     { +listener+ t }
132 } define-operation
133
134 [ vocab-spec? ] \ run H{
135     { +listener+ t }
136 } define-operation
137
138 [ vocab? ] \ test H{
139     { +listener+ t }
140 } define-operation
141
142 [ vocab-spec? ] \ deploy-tool H{ } define-operation
143
144 ! Quotations
145 [ quotation? ] \ com-stack-effect H{
146     { +keyboard+ T{ key-down f { C+ } "i" } }
147     { +listener+ t }
148 } define-operation
149
150 [ quotation? ] \ walk H{
151     { +keyboard+ T{ key-down f { C+ } "w" } }
152     { +listener+ t }
153 } define-operation
154
155 [ quotation? ] \ time H{
156     { +keyboard+ T{ key-down f { C+ } "t" } }
157     { +listener+ t }
158 } define-operation
159
160 : com-profile ( quot -- ) profile profiler-window ;
161
162 [ quotation? ] \ com-profile H{
163     { +keyboard+ T{ key-down f { C+ } "o" } }
164     { +listener+ t }
165 } define-operation
166
167 : com-expand-macros ( quot -- ) expand-macros . ;
168
169 [ quotation? ] \ com-expand-macros H{
170     { +keyboard+ T{ key-down f { C+ } "m" } }
171     { +listener+ t }
172 } define-operation
173
174 ! Operations -> commands
175 interactor
176 "quotation"
177 "These commands operate on the entire contents of the input area."
178 [ ]
179 [ quot-action ]
180 define-operation-map