author | convert-repo |
Fri, 20 Dec 2019 04:27:46 +0000 | |
changeset 25157 | 5801b52c6f52 |
parent 22369 | 6510a4f3fbd9 |
permissions | -rw-r--r-- |
84 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
159 | 3 |
All Rights Reserved |
84 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5459 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
18944 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
84 | 16 |
Object subclass:#ExecutableFunction |
1180
7f4a68385ac7
only ExecutableFunction is fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
17 |
instanceVariableNames:'code*' |
7602
d048f13cd50a
Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents:
7257
diff
changeset
|
18 |
classVariableNames:'' |
1180
7f4a68385ac7
only ExecutableFunction is fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
19 |
poolDictionaries:'' |
7f4a68385ac7
only ExecutableFunction is fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
20 |
category:'Kernel-Methods' |
84 | 21 |
! |
22 |
||
23 |
!ExecutableFunction class methodsFor:'documentation'! |
|
24 |
||
88 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
159 | 28 |
All Rights Reserved |
88 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
84 | 39 |
documentation |
40 |
" |
|
88 | 41 |
This is an abstract class, to merge common attributes of all kinds of |
357 | 42 |
executable code objects; i.e. non-ST functions, Blocks and Methods |
43 |
and whatever there might be in the future. |
|
84 | 44 |
|
2244 | 45 |
Instances of ExecutableCode are not meant to be created by user code - |
20956 | 46 |
the compilers create instances of subclasses, such as Method & Block |
2244 | 47 |
(the VM would not even know what to do with such an instance, and triggered |
48 |
and exception, if ever encountered during block/method execution). |
|
49 |
||
1254 | 50 |
|
1669 | 51 |
NOTICE: layout known by runtime system and compiler - do not change |
52 |
||
1254 | 53 |
|
1293 | 54 |
[Instance variables:] |
225 | 55 |
code <not_an_object> the function pointer to the machine code. |
21623 | 56 |
Not accessible from smalltalk code. |
57 |
(notice the '*' in the instVarNames definition) |
|
225 | 58 |
|
59 |
||
1293 | 60 |
[Class variables:] |
225 | 61 |
ExecutionErrorSignal parent of all execution errors |
21623 | 62 |
(not raised itself) |
225 | 63 |
|
64 |
InvalidCodeSignal codeObject is not executable |
|
84 | 65 |
|
1293 | 66 |
|
67 |
[author:] |
|
21623 | 68 |
Claus Gittinger |
84 | 69 |
" |
70 |
! ! |
|
71 |
||
623 | 72 |
!ExecutableFunction class methodsFor:'queries'! |
84 | 73 |
|
18944 | 74 |
isAbstract |
75 |
^ self == ExecutableFunction |
|
76 |
! |
|
77 |
||
623 | 78 |
isBuiltInClass |
1264 | 79 |
"return true if this class is known by the run-time-system. |
80 |
Here, true is returned for myself, false for subclasses." |
|
84 | 81 |
|
2244 | 82 |
^ self == ExecutableFunction |
1180
7f4a68385ac7
only ExecutableFunction is fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
83 |
|
2244 | 84 |
"Modified: 23.1.1997 / 13:47:58 / cg" |
623 | 85 |
! ! |
84 | 86 |
|
623 | 87 |
!ExecutableFunction methodsFor:'accessing'! |
84 | 88 |
|
89 |
code |
|
21623 | 90 |
"return the code field. This is not an object but the address of the machine instructions. |
20511 | 91 |
Therefore an externalAddress representing the code-address is returned" |
84 | 92 |
|
93 |
%{ /* NOCONTEXT */ |
|
2870 | 94 |
unsigned INT addr; |
84 | 95 |
|
1133 | 96 |
if (__INST(code_) != nil) { |
21623 | 97 |
|
3421
78a276e71115
present code as an external function (for security & style)
Claus Gittinger <cg@exept.de>
parents:
3193
diff
changeset
|
98 |
#ifdef OLD |
21623 | 99 |
// returned an integer in very old versions. |
100 |
addr = (unsigned INT)__INST(code_); |
|
101 |
if (addr <= _MAX_INT) { |
|
102 |
RETURN ( __mkSmallInteger(addr) ); |
|
103 |
} |
|
104 |
RETURN ( __MKUINT(addr)); |
|
3421
78a276e71115
present code as an external function (for security & style)
Claus Gittinger <cg@exept.de>
parents:
3193
diff
changeset
|
105 |
#endif |
21623 | 106 |
RETURN (__MKEXTERNALADDRESS(__INST(code_))); |
84 | 107 |
} |
328 | 108 |
%}. |
84 | 109 |
^ nil |
623 | 110 |
! |
111 |
||
22369 | 112 |
getCode |
113 |
"return the code field. This is not an object but the address of the machine instructions. |
|
114 |
Therefore an externalAddress representing the code-address is returned" |
|
115 |
||
116 |
^ self code |
|
117 |
! |
|
118 |
||
623 | 119 |
instVarAt:index |
120 |
"have to catch instVar access to code - since its no object" |
|
121 |
||
122 |
(index == 1) ifTrue:[^ self code]. |
|
123 |
^ super instVarAt:index |
|
124 |
! |
|
125 |
||
126 |
instVarAt:index put:value |
|
127 |
"have to catch instVar access to code - since its no object" |
|
128 |
||
129 |
(index == 1) ifTrue:[^ self code:value]. |
|
130 |
^ super instVarAt:index put:value |
|
84 | 131 |
! ! |
132 |
||
133 |
||
134 |
!ExecutableFunction methodsFor:'error handling'! |
|
135 |
||
136 |
invalidCode |
|
1871 | 137 |
"{ Pragma: +optSpace }" |
138 |
||
84 | 139 |
"this error is triggered by the interpreter when something is wrong |
107 | 140 |
with the code object (any error not handled by Method-signals). |
84 | 141 |
In this case, the VM sends this to the bad method/block (the receiver). |
142 |
Can only happen when the Compiler/runtime system is broken or |
|
143 |
someone played around." |
|
144 |
||
7602
d048f13cd50a
Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents:
7257
diff
changeset
|
145 |
^ InvalidCodeError raise. |
1871 | 146 |
|
147 |
"Modified: 4.11.1996 / 22:47:21 / cg" |
|
84 | 148 |
! ! |
149 |
||
357 | 150 |
!ExecutableFunction methodsFor:'printing & storing'! |
151 |
||
152 |
printOn:aStream |
|
1254 | 153 |
"append a printed representation of the receiver to aStream" |
154 |
||
357 | 155 |
|addr| |
156 |
||
21623 | 157 |
addr := self getCode. |
357 | 158 |
addr isNil ifTrue:[^ super printOn:aStream]. |
159 |
||
3193 | 160 |
aStream nextPutAll:self class name; nextPutAll:'(address: 0x'. |
9260 | 161 |
addr address printOn:aStream base:16. |
3193 | 162 |
aStream nextPut:$) |
1254 | 163 |
|
3193 | 164 |
"Modified: / 22.4.1996 / 16:36:05 / cg" |
165 |
"Modified: / 20.1.1998 / 14:10:46 / stefan" |
|
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
166 |
! |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
167 |
|
5284 | 168 |
printStringForBrowserWithSelector:selector inClass:aClass |
169 |
"return a printString to represent myself to the user in a browser." |
|
170 |
||
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
171 |
^ selector |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
172 |
|
357 | 173 |
! ! |
174 |
||
7257 | 175 |
!ExecutableFunction methodsFor:'private-accessing'! |
623 | 176 |
|
177 |
code:anAddress |
|
21623 | 178 |
"set the code field - DANGER ALERT. |
623 | 179 |
This is not an object but the address of the machine instructions. |
180 |
Therefore the argument must be an integer representing this address. |
|
181 |
You can crash Smalltalk very badly when playing around here ... |
|
182 |
This method is for compiler support and very special cases (debugging) only |
|
183 |
- do not use" |
|
84 | 184 |
|
623 | 185 |
%{ /* NOCONTEXT */ |
84 | 186 |
|
3421
78a276e71115
present code as an external function (for security & style)
Claus Gittinger <cg@exept.de>
parents:
3193
diff
changeset
|
187 |
if (__isExternalAddress(anAddress)) { |
21623 | 188 |
__INST(code_) = (OBJ)(__externalAddressVal(anAddress)); |
3421
78a276e71115
present code as an external function (for security & style)
Claus Gittinger <cg@exept.de>
parents:
3193
diff
changeset
|
189 |
} else { |
21623 | 190 |
if (__isSmallInteger(anAddress)) |
191 |
__INST(code_) = (OBJ)(__intVal(anAddress)); |
|
192 |
else { |
|
193 |
if (anAddress == nil) { |
|
194 |
__INST(code_) = nil; |
|
195 |
} else { |
|
196 |
__INST(code_) = (OBJ)(__longIntVal(anAddress)); |
|
197 |
} |
|
198 |
} |
|
623 | 199 |
} |
200 |
%} |
|
9394 | 201 |
! |
202 |
||
203 |
invalidate |
|
204 |
self code:0 |
|
84 | 205 |
! ! |
623 | 206 |
|
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
207 |
!ExecutableFunction methodsFor:'queries'! |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
208 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
209 |
category |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
210 |
"return the category of this codeObject. |
20956 | 211 |
Return nil here, to allow alien codeObjects to be handled by the browsers." |
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
212 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
213 |
^ nil |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
214 |
|
20956 | 215 |
"Created: / 16-04-1996 / 16:31:15 / cg" |
216 |
"Modified (comment): / 12-11-2016 / 11:46:00 / cg" |
|
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
217 |
! |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
218 |
|
16270
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
219 |
hasCanvasResource |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
220 |
"Return true, if this method is an canvas-resource method, false otherwise. |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
221 |
This is done by looking for a #canvas key in the method's resources." |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
222 |
|
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
223 |
^ self hasResource:#canvas |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
224 |
|
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
225 |
"Modified (comment): / 20-03-2014 / 16:58:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
226 |
! |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
227 |
|
3932 | 228 |
hasCode |
5459 | 229 |
"return true, if this codeObject has machinecode to execute." |
19330 | 230 |
|
231 |
%{ /* NOCONTEXT */ |
|
3932 | 232 |
if (__INST(code_)) { |
21623 | 233 |
RETURN (true); |
3932 | 234 |
} |
19330 | 235 |
RETURN (false); |
5459 | 236 |
%}. |
237 |
^ false |
|
3932 | 238 |
|
239 |
"Created: / 13.11.1998 / 23:13:29 / cg" |
|
240 |
! |
|
241 |
||
16270
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
242 |
hasImageResource |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
243 |
"return true, if this method is an image-resource method. |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
244 |
This is done by looking for a #image key in the method's resources." |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
245 |
|
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
246 |
^ self hasResource:#image |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
247 |
! |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
248 |
|
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
249 |
hasMenuResource |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
250 |
"return true, if this method is a menu-resource method. |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
251 |
This is done by looking for a #image key in the method's resources." |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
252 |
|
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
253 |
^ self hasResource:#menu |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
254 |
! |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
255 |
|
5534 | 256 |
hasResource |
257 |
"return true, if this codeObject has a resource (false here - only real methods have)." |
|
258 |
||
259 |
^ false |
|
260 |
! |
|
261 |
||
16270
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
262 |
hasResource:aSymbol |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
263 |
"return true if the method has a <resource> definition for aSymbol." |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
264 |
|
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
265 |
^ self hasResource and:[ (self resources ? #()) includesKey:aSymbol ] |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
266 |
|
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
267 |
" |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
268 |
Method allInstancesDo:[:m | |
21623 | 269 |
(m hasResource:#image) ifTrue:[self halt] |
16270
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
270 |
]. |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
271 |
" |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
272 |
|
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
273 |
"Modified: / 01-12-2010 / 13:59:58 / cg" |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
274 |
! |
2b544a163c71
Moved hasResource, has(Image|Canvas|Menu)Resource to ExecutableFunction.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16263
diff
changeset
|
275 |
|
2532
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
276 |
isBreakpointed |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
277 |
"return true, if this is a wrapper method for a breakpoint. |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
278 |
False is returned here - this method is redefined in WrappedMethod" |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
279 |
|
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
280 |
^ false |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
281 |
|
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
282 |
"Created: 7.4.1997 / 17:24:40 / cg" |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
283 |
! |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
284 |
|
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
285 |
isExecutable |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
286 |
"return true, if this codeObject is executable." |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
287 |
|
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
288 |
self isInvalid ifTrue:[^ false]. |
3932 | 289 |
^ self hasCode |
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
290 |
|
3932 | 291 |
"Created: / 16.4.1996 / 20:13:32 / cg" |
292 |
"Modified: / 13.11.1998 / 23:16:32 / cg" |
|
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
293 |
! |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
294 |
|
12898 | 295 |
isInstrumented |
296 |
"return true, if this is an instrumented method. |
|
297 |
False is returned here - this method is redefined in InstrumentedMethod" |
|
298 |
||
299 |
^ false |
|
300 |
||
301 |
"Created: / 27-04-2010 / 12:26:05 / cg" |
|
302 |
! |
|
303 |
||
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
304 |
isInvalid |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
305 |
"return true, if this codeObject is invalidated. |
20956 | 306 |
Return false here, to allow alien codeObjects to be handled by the browsers." |
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
307 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
308 |
^ false |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
309 |
|
20956 | 310 |
"Created: / 16-04-1996 / 16:31:42 / cg" |
311 |
"Modified (comment): / 12-11-2016 / 11:46:07 / cg" |
|
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
312 |
! |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
313 |
|
3924 | 314 |
isJavaMethod |
315 |
^ false |
|
316 |
||
317 |
"Created: / 10.11.1998 / 18:26:44 / cg" |
|
318 |
! |
|
319 |
||
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
320 |
isLazyMethod |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
321 |
"return true, if this is a lazy method. |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
322 |
False is returned here - this method is redefined in LazyMethod" |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
323 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
324 |
^ false |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
325 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
326 |
"Created: 16.4.1996 / 16:32:11 / cg" |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
327 |
"Modified: 16.4.1996 / 16:32:36 / cg" |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
328 |
! |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
329 |
|
5936 | 330 |
isObsolete |
331 |
^ false |
|
332 |
! |
|
333 |
||
2536 | 334 |
isTimed |
335 |
"return true, if this is a wrapper method for a time measurement. |
|
336 |
False is returned here - this method is redefined in WrappedMethod" |
|
337 |
||
338 |
^ false |
|
339 |
||
340 |
"Created: 11.4.1997 / 17:06:32 / cg" |
|
341 |
! |
|
342 |
||
2532
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
343 |
isTraced |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
344 |
"return true, if this is a wrapper method for a trace point. |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
345 |
False is returned here - this method is redefined in WrappedMethod" |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
346 |
|
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
347 |
^ false |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
348 |
|
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
349 |
"Created: 7.4.1997 / 17:24:50 / cg" |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
350 |
! |
e555281237f1
moved isBreakPointed / isTrapped queries into method
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
351 |
|
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
352 |
isUnloaded |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
353 |
"return true, if the objects machine code has been unloaded |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
354 |
from the system (i.e. it is not executable)." |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
355 |
|
3932 | 356 |
^ self hasCode not |
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
357 |
|
3932 | 358 |
"Created: / 16.4.1996 / 20:15:52 / cg" |
359 |
"Modified: / 13.11.1998 / 23:19:52 / cg" |
|
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
360 |
! |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
361 |
|
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
362 |
isWrapped |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
363 |
"return true, if this is a wrapper method. |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
364 |
False is returned here - this method is redefined in WrappedMethod" |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
365 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
366 |
^ false |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
367 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
368 |
"Created: 16.4.1996 / 16:33:24 / cg" |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
369 |
! |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
370 |
|
5904 | 371 |
messagesSent |
372 |
^ #() "/ actually: unknown here in this abstract class |
|
373 |
! |
|
374 |
||
375 |
messagesSentToSelf |
|
376 |
^ #() "/ actually: unknown here in this abstract class |
|
377 |
! |
|
378 |
||
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
379 |
privacy |
22369 | 380 |
"return a symbol describing the method's access rights (privacy); |
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
381 |
Currently, this is one of #private, #protected, #public or #ignored. |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
382 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
383 |
Here we unconditionally return #public, to allow alien code objects |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
384 |
to be handled by the browsers." |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
385 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
386 |
^ #public |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
387 |
|
22369 | 388 |
"Created: / 16-04-1996 / 16:35:18 / cg" |
389 |
"Modified (comment): / 21-11-2017 / 13:01:32 / cg" |
|
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
390 |
! |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
391 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
392 |
referencesGlobal:aGlobalSymbol |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
393 |
"return true, if this method references the global |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
394 |
bound to aGlobalSymbol. |
20797 | 395 |
Return false (we don't know) here, to allow alien code objects to be |
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
396 |
handled by the browsers." |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
397 |
|
8464 | 398 |
^ false |
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
399 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
400 |
"Created: 16.4.1996 / 16:37:48 / cg" |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
401 |
! |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
402 |
|
4977 | 403 |
referencesGlobalMatching:aMatchPattern |
404 |
"return true, if this method references a global |
|
405 |
whose name matches aMatchPattern. |
|
20797 | 406 |
Return false (we don't know) here, to allow alien code objects to be |
4977 | 407 |
handled by the browsers." |
408 |
||
8464 | 409 |
^ false |
4977 | 410 |
|
411 |
"Created: / 9.11.1999 / 16:58:48 / cg" |
|
412 |
! |
|
413 |
||
5533 | 414 |
referencesLiteral:aLiteral |
5537 | 415 |
"return true, if this executable references the literal directly (i.e. a flat search). |
20797 | 416 |
Return false (we don't know) here, to allow alien code objects to be |
5533 | 417 |
handled by the browsers." |
418 |
||
8464 | 419 |
^ false |
5537 | 420 |
|
421 |
"Modified: / 18.8.2000 / 21:18:43 / cg" |
|
5533 | 422 |
! |
423 |
||
424 |
refersToLiteral:aLiteral |
|
5537 | 425 |
"return true, if this executable references the literal directly or indirectly (i.e. a deep search). |
16263 | 426 |
Return false (we don't know) here, to allow alien code objects to be |
5533 | 427 |
handled by the browsers." |
428 |
||
8464 | 429 |
^ false |
5537 | 430 |
|
431 |
"Modified: / 18.8.2000 / 21:18:03 / cg" |
|
5533 | 432 |
! |
433 |
||
14257
b971b4b2318a
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
434 |
refersToLiteralMatching:aMatchPattern |
b971b4b2318a
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
435 |
"return true if the receiver or recursively any array element in the |
b971b4b2318a
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
436 |
receiver is symbolic and matches aMatchPattern (i.e. a deep search). |
20797 | 437 |
Return false (we don't know) here, to allow alien code objects to be |
14257
b971b4b2318a
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
438 |
handled by the browsers." |
b971b4b2318a
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
439 |
|
b971b4b2318a
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
440 |
^ false |
b971b4b2318a
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
441 |
|
b971b4b2318a
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
442 |
"Modified: / 18-08-2000 / 21:18:03 / cg" |
b971b4b2318a
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
443 |
"Created: / 26-07-2012 / 15:38:26 / cg" |
b971b4b2318a
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
444 |
! |
b971b4b2318a
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
12898
diff
changeset
|
445 |
|
5533 | 446 |
resources |
447 |
^ nil |
|
448 |
||
449 |
"Created: / 3.11.1997 / 09:09:01 / cg" |
|
450 |
! |
|
451 |
||
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
452 |
sends:aSelectorSymbol |
21340 | 453 |
<resource: #obsolete> |
21623 | 454 |
|
455 |
"return true, if this code object contains a message-send with aSelectorSymbol as selector. |
|
456 |
- due to the simple check in the literal array, also simple uses |
|
21340 | 457 |
of aSelectorSymbol as symbol will return true. |
458 |
Should ask compiler, if there is really a send." |
|
459 |
||
21623 | 460 |
self obsoleteFeatureWarning:'please use #sendsSelector:'. |
21340 | 461 |
^ self sendsSelector:aSelectorSymbol |
462 |
||
463 |
"Created: / 16-04-1996 / 16:35:53 / cg" |
|
464 |
"Modified: / 05-02-2017 / 01:21:26 / cg" |
|
465 |
! |
|
466 |
||
467 |
sendsAny:aCollectionOfSelectorSymbols |
|
468 |
<resource: #obsolete> |
|
469 |
||
470 |
"return true, if this method contains a message-send |
|
471 |
to any of aCollectionOfSelectorSymbols." |
|
472 |
||
21623 | 473 |
self obsoleteFeatureWarning:'please use #sendsAnySelector:'. |
21340 | 474 |
^ self sendsAnySelector:aCollectionOfSelectorSymbols |
475 |
||
476 |
"Created: / 08-08-2011 / 18:53:24 / cg" |
|
477 |
"Modified: / 05-02-2017 / 01:31:22 / cg" |
|
478 |
! |
|
479 |
||
480 |
sendsAnySelector:aCollectionOfSelectorSymbols |
|
481 |
"return true, if this method contains a message-send |
|
482 |
to any of aCollectionOfSelectorSymbols." |
|
483 |
||
484 |
(aCollectionOfSelectorSymbols contains:[:sym | self referencesLiteral:sym]) ifTrue:[ |
|
21623 | 485 |
^ true. |
21340 | 486 |
]. |
487 |
^ false |
|
488 |
||
489 |
"Created: / 05-02-2017 / 01:27:11 / cg" |
|
490 |
! |
|
491 |
||
492 |
sendsSelector:aSelectorSymbol |
|
21623 | 493 |
"return true, if this code object contains a message-send with aSelectorSymbol as selector. |
494 |
- due to the simple check in the literal array, also simple uses |
|
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
495 |
of aSelectorSymbol as symbol will return true. |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
496 |
Should ask compiler, if there is really a send." |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
497 |
|
5533 | 498 |
^ self referencesLiteral:aSelectorSymbol |
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
499 |
|
21340 | 500 |
"Created: / 05-02-2017 / 01:19:03 / cg" |
5533 | 501 |
! |
502 |
||
503 |
usedGlobals |
|
504 |
"return a collection with the global names referred to by the receiver. |
|
505 |
Uses Parser to parse methods source and extract them." |
|
506 |
||
507 |
^ #() |
|
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
508 |
! ! |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1180
diff
changeset
|
509 |
|
1180
7f4a68385ac7
only ExecutableFunction is fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
510 |
!ExecutableFunction class methodsFor:'documentation'! |
7f4a68385ac7
only ExecutableFunction is fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
511 |
|
7f4a68385ac7
only ExecutableFunction is fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
512 |
version |
18944 | 513 |
^ '$Header$' |
12898 | 514 |
! |
515 |
||
516 |
version_CVS |
|
18944 | 517 |
^ '$Header$' |
1180
7f4a68385ac7
only ExecutableFunction is fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
518 |
! ! |
22369 | 519 |