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