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