|
1 "{ Package: 'stx:libtool' }" |
|
2 ! |
|
3 |
|
4 !ByteArray methodsFor:'inspecting'! |
|
5 |
|
6 inspectorExtraAttributes |
|
7 ^ Dictionary new |
|
8 add:'-hexadecimal' -> |
|
9 [ |
|
10 String |
|
11 streamContents:[:s | |
|
12 self class isWords ifTrue:[ |
|
13 self asWordArray printOn:s base:16 showRadix:true |
|
14 ] ifFalse:[ |
|
15 self class isLongs ifTrue:[ |
|
16 self asLongIntegerArray printOn:s base:16 showRadix:true |
|
17 ] ifFalse:[ |
|
18 self asByteArray printOn:s base:16 showRadix:true |
|
19 ] |
|
20 ] |
|
21 ] |
|
22 ]; |
|
23 yourself |
|
24 |
|
25 "Created: / 18-09-2006 / 21:29:59 / cg" |
|
26 ! ! |
|
27 |
|
28 !Color methodsFor:'inspecting'! |
|
29 |
|
30 inspectorClass |
|
31 "return the class of an appropriate inspector. |
|
32 ST/X has a specialized ColorInspectorView for that" |
|
33 |
|
34 ^ ColorInspectorView |
|
35 |
|
36 "Modified: 23.4.1996 / 13:39:50 / cg" |
|
37 ! ! |
|
38 |
|
39 !Dictionary methodsFor:'inspecting'! |
|
40 |
|
41 inspectorClass |
|
42 "redefined to use DictionaryInspector |
|
43 (instead of the default Inspector)." |
|
44 |
|
45 ^ DictionaryInspectorView |
|
46 ! ! |
|
47 |
|
48 !Form methodsFor:'inspecting'! |
|
49 |
|
50 inspectorClass |
|
51 "redefined to launch an ImageInspector |
|
52 (instead of the default InspectorView)." |
|
53 |
|
54 ^ ImageInspectorView |
|
55 ! ! |
|
56 |
|
57 !Image methodsFor:'inspecting'! |
|
58 |
|
59 inspectorClass |
|
60 "redefined to launch an ImageInspector |
|
61 (instead of the default InspectorView)." |
|
62 |
|
63 (width notNil and:[height notNil]) ifTrue:[ |
|
64 ^ ImageInspectorView |
|
65 ]. |
|
66 ^ super inspectorClass |
|
67 |
|
68 "Modified: 10.6.1996 / 18:23:55 / cg" |
|
69 ! ! |
|
70 |
|
71 !Integer methodsFor:'inspecting'! |
|
72 |
|
73 inspectorExtraAttributes |
|
74 ^ Dictionary new |
|
75 add:'-hexadecimal' -> [ self radixPrintStringRadix:16 ]; |
|
76 add:'-octal' -> [ self radixPrintStringRadix:8 ]; |
|
77 add:'-binary' -> [ self radixPrintStringRadix:2 ]; |
|
78 yourself |
|
79 |
|
80 " |
|
81 123 inspect |
|
82 " |
|
83 |
|
84 "Created: / 18-09-2006 / 21:22:46 / cg" |
|
85 ! ! |
|
86 |
|
87 !Method methodsFor:'inspecting'! |
|
88 |
|
89 inspectorExtraAttributes |
|
90 ^ Dictionary new |
|
91 add:'-code' -> [ String streamContents:[:s | self decompileTo:s] ]; |
|
92 add:'-source' -> [ self source ]; |
|
93 declareAllFrom:(super inspectorExtraAttributes); |
|
94 yourself |
|
95 |
|
96 " |
|
97 (Method compiledMethodAt:#inspectorExtraAttributes) inspect |
|
98 " |
|
99 |
|
100 "Created: / 18-09-2006 / 21:34:01 / cg" |
|
101 ! ! |
|
102 |
|
103 !Method methodsFor:'printing & storing'! |
|
104 |
|
105 printStringForBrowserWithSelector:selector inClass:aClass |
|
106 "return a printString to represent myself to the user in a browser. |
|
107 Defined here to allow for browsers to deal with nonStandard pseudoMethods" |
|
108 |
|
109 |s privInfo moreInfo p i n cls currentChangeSet isInChangeSet mthdPackage |
|
110 userPreferences shownSelector suppressPackage| |
|
111 |
|
112 moreInfo := ''. |
|
113 privInfo := ''. |
|
114 userPreferences := UserPreferences current. |
|
115 |
|
116 self isWrapped ifTrue:[ |
|
117 (MessageTracer isCounting:self) ifTrue:[ |
|
118 (MessageTracer isCountingMemoryUsage:self) ifTrue:[ |
|
119 moreInfo := moreInfo , |
|
120 ' (mem usage avg: ' , (MessageTracer memoryUsageOfMethod:self) printString allBold , ' bytes)'. |
|
121 ] ifFalse:[ |
|
122 moreInfo := moreInfo , |
|
123 ' (called ' , (MessageTracer executionCountOfMethod:self) printString allBold , ' times)'. |
|
124 ] |
|
125 ] ifFalse:[ |
|
126 (MessageTracer isTiming:self) ifTrue:[ |
|
127 i := MessageTracer executionTimesOfMethod:self. |
|
128 (i isNil or:[(n := i at:#count) == 0]) ifTrue:[ |
|
129 moreInfo := moreInfo , |
|
130 ' (cnt: ' , (i at:#count) printString , ')' |
|
131 ] ifFalse:[ |
|
132 n == 1 ifTrue:[ |
|
133 moreInfo := moreInfo , |
|
134 ' (t: ' , (i at:#avgTime) printString allBold, |
|
135 'ms cnt: ' , (i at:#count) printString , ')' |
|
136 ] ifFalse:[ |
|
137 moreInfo := moreInfo , |
|
138 ' (avg: ' , (i at:#avgTime) printString allBold, |
|
139 'ms min: ' , (i at:#minTime) printString , |
|
140 ' max: ' , (i at:#maxTime) printString , |
|
141 ' cnt: ' , (i at:#count) printString , ')' |
|
142 ]. |
|
143 ]. |
|
144 ] ifFalse:[ |
|
145 moreInfo := ' !!' |
|
146 ] |
|
147 ]. |
|
148 ]. |
|
149 p := self privacy. |
|
150 |
|
151 p ~~ #public ifTrue:[ |
|
152 privInfo := (' (* ' , p , ' *)') asText emphasizeAllWith:#italic. |
|
153 ]. |
|
154 |
|
155 "/ self isInvalid ifTrue:[ |
|
156 "/ moreInfo := ' (** not executable **)'. |
|
157 "/ ]. |
|
158 |
|
159 (self isLazyMethod not and:[self isUnloaded]) ifTrue:[ |
|
160 moreInfo := ' (** unloaded **)' |
|
161 ]. |
|
162 |
|
163 privInfo size ~~ 0 ifTrue:[ |
|
164 moreInfo := privInfo , ' ' , moreInfo |
|
165 ]. |
|
166 |
|
167 s := shownSelector := (self selectorPrintStringInBrowserFor:selector). |
|
168 (cls := aClass) isNil ifTrue:[ |
|
169 cls := self containingClass |
|
170 ]. |
|
171 |
|
172 currentChangeSet := ChangeSet current. |
|
173 isInChangeSet := currentChangeSet includesChangeForClass:cls selector:selector. |
|
174 |
|
175 isInChangeSet ifTrue:[ |
|
176 s := s asText emphasisAllAdd:(userPreferences emphasisForChangedCode) |
|
177 ]. |
|
178 |
|
179 (cls isNil or:[(mthdPackage := self package) ~= cls package]) ifTrue:[ |
|
180 suppressPackage := false. |
|
181 mthdPackage = Project noProjectID ifTrue:[ |
|
182 mthdPackage := '+'. |
|
183 "/ suppressPackage := true |
|
184 ]. |
|
185 suppressPackage ifFalse:[ |
|
186 p := ' [' , (mthdPackage ? '?') allItalic , '] '. |
|
187 p := p asText emphasisAllAdd:(userPreferences emphasisForDifferentPackage). |
|
188 s := s , ' ' , p |
|
189 ]. |
|
190 ]. |
|
191 |
|
192 moreInfo size == 0 ifTrue:[^ s]. |
|
193 |
|
194 s := shownSelector , moreInfo. |
|
195 |
|
196 self isInvalid ifTrue:[ |
|
197 s := s asText emphasizeAllWith:(userPreferences emphasisForObsoleteCode). |
|
198 ]. |
|
199 ^ s |
|
200 |
|
201 "Modified: / 23-01-1998 / 13:15:15 / stefan" |
|
202 "Created: / 05-02-2000 / 22:55:56 / cg" |
|
203 "Modified: / 06-09-2006 / 13:59:44 / cg" |
|
204 ! ! |
|
205 |
|
206 !Method methodsFor:'printing & storing'! |
|
207 |
|
208 selectorPrintStringInBrowserFor:selector |
|
209 ^ selector |
|
210 ! ! |
|
211 |
|
212 !MethodDictionary methodsFor:'inspecting'! |
|
213 |
|
214 inspectorClass |
|
215 "redefined to use DictionaryInspector |
|
216 (instead of the default Inspector)." |
|
217 |
|
218 ^ DictionaryInspectorView |
|
219 |
|
220 "Created: 12.6.1996 / 12:29:13 / stefan" |
|
221 ! ! |
|
222 |
|
223 !NameSpace class methodsFor:'inspecting'! |
|
224 |
|
225 inspectorClass |
|
226 "{ Pragma: +optSpace }" |
|
227 |
|
228 "redefined to launch a DictionaryInspector |
|
229 (instead of the default Inspector)." |
|
230 |
|
231 ^ DictionaryInspectorView |
|
232 |
|
233 |
|
234 ! ! |
|
235 |
|
236 !OrderedCollection methodsFor:'inspecting'! |
|
237 |
|
238 inspectorClass |
|
239 "redefined to launch an OrderedCollectionInspector |
|
240 (instead of the default InspectorView)." |
|
241 |
|
242 ^ OrderedCollectionInspectorView |
|
243 |
|
244 " |
|
245 (OrderedCollection withAll:#(3 2 1)) inspect |
|
246 (OrderedCollection withAll:#(3 2 1)) removeFirst; yourself; inspect |
|
247 #(0 8 15 3 99 2) asSortedCollection inspect |
|
248 " |
|
249 ! ! |
|
250 |
|
251 !RunArray methodsFor:'user interface'! |
|
252 |
|
253 inspectorClass |
|
254 "Re-reimplemented so that we don't get an ordered collection inspector |
|
255 which would get very confused when confronted with a runArray." |
|
256 |
|
257 ^ InspectorView |
|
258 |
|
259 "Modified: / 30.10.1997 / 14:28:20 / cg" |
|
260 ! ! |
|
261 |
|
262 !Set methodsFor:'inspecting'! |
|
263 |
|
264 inspectorClass |
|
265 "redefined to use SetInspector |
|
266 (instead of the default Inspector)." |
|
267 |
|
268 ^ SetInspectorView |
|
269 ! ! |
|
270 |
|
271 !Smalltalk class methodsFor:'inspecting'! |
|
272 |
|
273 inspectorClass |
|
274 "{ Pragma: +optSpace }" |
|
275 |
|
276 "redefined to launch a DictionaryInspector (instead of the default Inspector)." |
|
277 |
|
278 ^ DictionaryInspectorView |
|
279 ! ! |
|
280 |
|
281 !Text methodsFor:'inspecting'! |
|
282 |
|
283 inspectorExtraAttributes |
|
284 ^ Dictionary new |
|
285 add:'-text' -> [ self ]; |
|
286 declareAllFrom:(super inspectorExtraAttributes); |
|
287 yourself |
|
288 |
|
289 " |
|
290 'hello' allBold inspect |
|
291 " |
|
292 |
|
293 "Created: / 18-09-2006 / 21:25:52 / cg" |
|
294 ! ! |
|
295 |