author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 01 Apr 2013 13:42:45 +0100 | |
branch | jv |
changeset 18043 | 03660093fe98 |
parent 18040 | a11a12546f23 |
parent 14990 | 8ed060e047c7 |
child 18045 | c0c600e0d3b3 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
13419 | 3 |
All Rights Reserved |
1 | 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 |
" |
|
5368
192acdc335e6
added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
12 |
"{ Package: 'stx:libbasic' }" |
192acdc335e6
added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
13 |
|
1 | 14 |
Object subclass:#Behavior |
13419 | 15 |
instanceVariableNames:'superclass flags methodDictionary lookupObject instSize' |
13862 | 16 |
classVariableNames:'' |
13419 | 17 |
poolDictionaries:'' |
18 |
category:'Kernel-Classes' |
|
1 | 19 |
! |
20 |
||
1760 | 21 |
!Behavior class methodsFor:'documentation'! |
47 | 22 |
|
14065
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
23 |
VS |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
24 |
^ '§Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.315 2011/11/29 10:20:21 cg Exp §' |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
25 |
! |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
26 |
|
88 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
13419 | 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 |
||
47 | 41 |
documentation |
42 |
" |
|
68 | 43 |
Every class in the system inherits from Behavior (via Class, ClassDescription); |
44 |
so here is where most of the class messages end up being implemented. |
|
45 |
(to answer a FAQ: 'Point basicNew' will be done here :-) |
|
46 |
||
356 | 47 |
Beginners should keep in mind, that all classes are instances (of subclasses) |
12094 | 48 |
of Behavior, therefore you will find the above mentioned 'basicNew:' method |
49 |
under the 'instance'-methods of Behavior - NOT under the class methods |
|
50 |
('Behavior new' will create and return a new class, while sending 'new' to |
|
154 | 51 |
any instance of Behavior (i.e. any class) will return an instance of that class). |
68 | 52 |
|
2226 | 53 |
|
68 | 54 |
Behavior provides minimum support for all classes - additional stuff is |
77 | 55 |
found in ClassDescription and Class. Behaviors provides all mechanisms needed |
12094 | 56 |
to create instances, and send messages to those. However, Behavior does not provide |
77 | 57 |
all the (symbolic) information needed to compile methods for a class or to get |
58 |
useful information in inspectors. |
|
47 | 59 |
|
2226 | 60 |
for experts: |
61 |
||
62 |
Since instances of Behavior provide all that is needed to interact with the VM's |
|
63 |
message dispatch mechanism, these can be used as 'light weight' classes. |
|
64 |
I.e. it is possible, to generate completely anonymous classes (and instances thereof) |
|
65 |
on the fly - 'Behavior new new' is such a thingy. |
|
66 |
||
12094 | 67 |
The selectors and Methods are organized in a MethodDictionary (which is not a true |
2226 | 68 |
dictionary, but an Array with alternating selector/method entries). |
1494
dab70fc90ebc
Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
69 |
This avoids the need for knowledge about Dictionaries in the runtime library (VM) |
12094 | 70 |
(lookup and search in these is seldom anyway, so the added benefit from using a |
1494
dab70fc90ebc
Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
71 |
hashed dictionary is almost void). |
1 | 72 |
|
1285 | 73 |
[Instance variables:] |
74 |
||
13419 | 75 |
superclass <Class> the receivers superclass |
76 |
||
77 |
methodDictionary <MethodDictionary> inst-selectors and methods |
|
78 |
||
79 |
instSize <SmallInteger> the number of instance variables |
|
80 |
||
81 |
flags <SmallInteger> special flag bits coded in a number |
|
82 |
not for application use |
|
1 | 83 |
|
81 | 84 |
flag bits (see stc.h): |
47 | 85 |
|
68 | 86 |
NOTICE: layout known by compiler and runtime system; be careful when changing |
1285 | 87 |
|
1292 | 88 |
[author:] |
13419 | 89 |
Claus Gittinger |
1292 | 90 |
|
1285 | 91 |
[see also:] |
13419 | 92 |
Class ClassDescription Metaclass |
93 |
Method MethodDictionary |
|
47 | 94 |
" |
356 | 95 |
! |
96 |
||
12094 | 97 |
virtualMachineRelationship |
356 | 98 |
" |
2230
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
99 |
Expert info follows: |
12858
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
100 |
-------------------- |
12094 | 101 |
NOTICE: |
13419 | 102 |
the stuff described below may not be available on other |
103 |
Smalltalk implementations; be aware that these error mechanisms |
|
104 |
are ST/X specials and applications using these (tricks) may |
|
105 |
not be portable to other systems. |
|
12094 | 106 |
|
107 |
WARNING: |
|
13419 | 108 |
do not try the examples below on (some) other smalltalk systems; |
109 |
it has been reported, that some crash badly when doing this .... ;-) |
|
357 | 110 |
|
356 | 111 |
Instances of Behavior and subclasses (i.e. in sloppy words: classes) |
112 |
play a special role w.r.t. the VM. Only objects whose class-slot is marked |
|
113 |
as being behaviorLike (in the flag-instvar) are considered to be classLike |
|
114 |
and a message lookup will be done for it in the well known way. |
|
115 |
Thus, if an object has a class for which its class does NOT have |
|
362 | 116 |
this flag bit set, the VM will trigger an error on a message send. |
356 | 117 |
|
2230
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
118 |
|
356 | 119 |
Why is this so: |
12858
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
120 |
--------------- |
356 | 121 |
the above lets every object play the role of a class, |
122 |
which has been flagged as behaviorLike in its class's flag. |
|
12094 | 123 |
Thus, you can create arbitrary new classLike objects and have the VM |
356 | 124 |
play with them. |
125 |
This may offer the flexibility to create a totally different object scheme |
|
362 | 126 |
on top of ST/X (for example: Self like objects) where any object can play |
12858
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
127 |
a classRole for another object or even for itself. |
356 | 128 |
|
2148 | 129 |
[A concrete application of this is found in the Structure class, |
130 |
which creates objects which are their own class !! |
|
12094 | 131 |
This may look to be of theoretical value at first sight, |
132 |
however, such a construct saves memory, by not requiring an extra |
|
2148 | 133 |
class object per Structure object.] |
134 |
||
135 |
Be aware, that the VM trusts the isBehaviorLike flag - IF it is set for some |
|
136 |
object, the VM EXPECTS the object selector and methodDictionaries to be found |
|
362 | 137 |
at the instance positions as defined here. |
138 |
(i.e. instanceVariables with contents and semantic corresponding to |
|
13419 | 139 |
superclass |
140 |
flags |
|
141 |
methodDictionary |
|
362 | 142 |
must be present and have the same instVar-index as here). |
143 |
||
356 | 144 |
The VM (and the system) may crash badly, if this is not the case. |
362 | 145 |
|
356 | 146 |
Since every class in the system derives from Behavior, the flag setting |
357 | 147 |
(and instance variable layout) is correct for all 'normal' classes. |
148 |
If you experiment by creating new behaviorLike objects, please take |
|
149 |
care of this flag. If you want to use the VM's lookup function, the |
|
1494
dab70fc90ebc
Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
150 |
instVars 'superclass' and 'methodDictionary' are required |
357 | 151 |
and have to be at the same instVar index. |
362 | 152 |
(we suggest, you subclass Behavior, to make certain) |
357 | 153 |
|
2230
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
154 |
|
8503 | 155 |
Vice versa, defining 'dumb classes', which have the behaviorLike bit turned |
12858
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
156 |
off may be useful as well; if a message is sent to an instance of such |
2230
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
157 |
a thingy, the VM performs a recovery sequence, which is much like the |
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
158 |
#doesNotUnderstand: mechanism - however, since the instance is no good |
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
159 |
receiver of such a message, a #cannotSendMessage:to: is now sent to the |
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
160 |
class (which is not a real class), passing the original message (selector |
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
161 |
and arguments) along with the original receiver. |
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
162 |
The default behavior for this message is to raise an internalError signal - |
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
163 |
however, you may redefine this in your 'dum class' for recovery. |
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
164 |
One possible use of this is to provide new message send algorithms - the |
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
165 |
class may lookup a method and invoke it directly, via the #valueWithReceiver: |
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
166 |
interface. |
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
167 |
|
12094 | 168 |
All of the above is pure expert stuff |
2230
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
169 |
- You do not have to care about the above details if you are a 'normal' |
b7a86880ab9c
beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
170 |
ST-programmer, though (and even most of those will never use these features). |
357 | 171 |
|
356 | 172 |
|
759
908363ce8a32
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
746
diff
changeset
|
173 |
Examples (only of theoretical interest): |
12858
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
174 |
---------------------------------------- |
13419 | 175 |
take away the behaviorLike-flag from a class. |
176 |
-> The instances will not understand any messages, since the VM will |
|
177 |
not recognize its class as being a class ... |
|
178 |
||
179 |
|newMeta notRecognizedAsClass someInstance| |
|
180 |
||
181 |
newMeta := Metaclass new. |
|
182 |
newMeta flags:0. |
|
183 |
||
184 |
notRecognizedAsClass := newMeta new. |
|
185 |
||
186 |
someInstance := notRecognizedAsClass new. |
|
187 |
someInstance perform:#isNil |
|
356 | 188 |
|
357 | 189 |
|
190 |
Of course, this is an exception which can be handled ...: |
|
191 |
Example: |
|
192 |
||
13419 | 193 |
|newMeta notRecognizedAsClass someInstance| |
194 |
||
195 |
newMeta := Metaclass new. |
|
196 |
newMeta flags:0. |
|
197 |
||
198 |
notRecognizedAsClass := newMeta new. |
|
199 |
||
200 |
someInstance := notRecognizedAsClass new. |
|
201 |
Object errorSignal handle:[:ex | |
|
202 |
ex return |
|
203 |
] do:[ |
|
204 |
someInstance perform:#isNil |
|
205 |
] |
|
357 | 206 |
|
207 |
||
208 |
likewise, a doesNotUnderstand-notUnderstood can be handled: |
|
209 |
Example: |
|
210 |
||
13419 | 211 |
|newMeta funnyClass someInstance| |
212 |
||
213 |
newMeta := Metaclass new. |
|
214 |
||
215 |
funnyClass := newMeta new. |
|
216 |
funnyClass setSuperclass:nil. |
|
217 |
||
218 |
someInstance := funnyClass new. |
|
219 |
Object errorSignal handle:[:ex | |
|
220 |
ex return |
|
221 |
] do:[ |
|
222 |
someInstance perform:#isNil |
|
223 |
] |
|
357 | 224 |
|
225 |
||
362 | 226 |
more examples, which try to trick the VM ;-): |
13419 | 227 |
badly playing around with a classes internals ... |
228 |
||
229 |
|newClass someInstance| |
|
230 |
||
231 |
newClass := Class new. |
|
232 |
newClass setSuperclass:nil. |
|
233 |
someInstance := newClass new. |
|
234 |
someInstance inspect |
|
235 |
||
236 |
||
237 |
|newClass someInstance| |
|
238 |
||
239 |
newClass := Class new. |
|
240 |
newClass setSuperclass:newClass. |
|
241 |
someInstance := newClass new. |
|
242 |
someInstance inspect |
|
243 |
||
244 |
||
245 |
|newClass someInstance| |
|
246 |
||
247 |
newClass := Class new. |
|
248 |
newClass setSuperclass:1. |
|
249 |
someInstance := newClass new. |
|
250 |
someInstance inspect |
|
12858
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
251 |
|
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
252 |
|
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
253 |
Example: |
13419 | 254 |
creating totally anonymous classes: |
255 |
||
256 |
|newClass someInstance| |
|
257 |
||
258 |
newClass := Class new. |
|
259 |
someInstance := newClass new. |
|
260 |
someInstance inspect |
|
357 | 261 |
|
262 |
||
356 | 263 |
Example: |
13419 | 264 |
creating totally anonymous metaclasses: |
265 |
||
266 |
|newMeta newClass someInstance| |
|
267 |
||
268 |
newMeta := Metaclass new. |
|
269 |
newClass := newMeta new. |
|
270 |
someInstance := newClass new. |
|
271 |
someInstance inspect |
|
12094 | 272 |
|
273 |
||
274 |
PS: if you experiment with new behaviorLike objects, you may want |
|
13419 | 275 |
to turn off the VM's debugPrintouts |
276 |
with: |
|
277 |
'Smalltalk debugPrinting:false' |
|
278 |
and: |
|
279 |
'Smalltalk infoPrinting:false' |
|
12858
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
280 |
|
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
281 |
Meta-Object-Protocol support: |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
282 |
----------------------------- |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
283 |
the above tricks do not affect the inline caches, and are therefore somewhat slow. |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
284 |
Another hook is the lookupObject which, if non-nil, is consulted to do the lookup |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
285 |
instead of the hardwired VM lookup algorithm, and provide a method as return value. |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
286 |
This method (if non-nil) will be put into the inline-and polymorph caches for speedy |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
287 |
call the next time. If non-nil, the lookup object is sent the: |
13419 | 288 |
lookupMethodForSelector:aSelector |
289 |
directedTo:searchClass |
|
290 |
for:aReceiver |
|
291 |
withArguments:argArrayOrNil |
|
292 |
from:sendingContext |
|
12858
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
293 |
message. |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
294 |
'searchClass' is the object class or any of its superclasses (for directed/super sends). |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
295 |
You can return any arbitrary method there - for example to implement multiple inheritance, |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
296 |
selector namespace tricks or multi-dispatch on argument types (double dispatch for a method). |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
297 |
Be aware, that the returned method is cached, and the lookup is not consulted again for the |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
298 |
same receiver/callsite combination. So the returned method should check if it's ok to be called |
695cbd35ce8a
changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents:
12855
diff
changeset
|
299 |
again (maybe, a synthetic method is generated and returned). |
356 | 300 |
" |
47 | 301 |
! ! |
1 | 302 |
|
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
303 |
|
1760 | 304 |
!Behavior class methodsFor:'creating new classes'! |
1 | 305 |
|
306 |
new |
|
356 | 307 |
"creates and return a new behavior (which is like a class, |
308 |
but without the symbolic & name information). |
|
309 |
Not for normal applications. |
|
310 |
Sending the returned behavior the #new message gives you |
|
311 |
an instance if it. |
|
312 |
||
313 |
Notice: the returned class is given a superclass of Object; |
|
314 |
this allows for its new instances to be inspected and the like." |
|
1 | 315 |
|
316 |
|newClass| |
|
317 |
||
318 |
newClass := self basicNew. |
|
12094 | 319 |
newClass |
13419 | 320 |
setSuperclass:Object |
321 |
methodDictionary:(MethodDictionary new) |
|
322 |
instSize:0 |
|
323 |
flags:(self flagBehavior). |
|
1 | 324 |
^ newClass |
356 | 325 |
|
326 |
" |
|
327 |
Behavior new <- a new behavior |
|
328 |
Behavior new new <- an instance of it |
|
329 |
ClassDescription new <- a new classDescription |
|
330 |
ClassDescription new new <- an instance of it |
|
331 |
Class new <- a new class |
|
332 |
Class new new <- an instance of it |
|
333 |
Metaclass new <- a new metaclass |
|
334 |
Metaclass new new <- an instance (i.e. a class) of it |
|
335 |
Metaclass new new new <- an instance of this new class |
|
336 |
" |
|
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
337 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
338 |
"Modified: 7.6.1996 / 15:38:58 / stefan" |
1 | 339 |
! ! |
340 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
341 |
|
1760 | 342 |
!Behavior class methodsFor:'flag bit constants'! |
620 | 343 |
|
17936
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
344 |
flagAlien |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
345 |
"Return the flag code for Alien objects for Translucent Object implementation" |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
346 |
|
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
347 |
%{ /* NOCONTEXT */ |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
348 |
/* this is defined as a primitive to get defines from stc.h */ |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
349 |
|
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
350 |
RETURN ( __mkSmallInteger(ALIENPOINTERS) ); |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
351 |
%} |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
352 |
! |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
353 |
|
620 | 354 |
flagBehavior |
355 |
"return the flag code which marks Behavior-like instances. |
|
7190 | 356 |
Inline C-code and the VM check this single bit in the flag value when |
620 | 357 |
checking for behaviors." |
358 |
||
359 |
%{ /* NOCONTEXT */ |
|
360 |
/* this is defined as a primitive to get defines from stc.h */ |
|
361 |
||
8913 | 362 |
RETURN ( __mkSmallInteger(BEHAVIOR_INSTS) ); |
620 | 363 |
%} |
364 |
||
365 |
"consistency check: |
|
366 |
all class-entries must be behaviors; |
|
367 |
all behaviors must be flagged so (in its class's flags) |
|
368 |
(otherwise, VM will bark) |
|
369 |
all non-behaviors may not be flagged |
|
370 |
||
371 |
|bit| |
|
372 |
bit := Class flagBehavior. |
|
373 |
||
374 |
ObjectMemory allObjectsDo:[:o| |
|
375 |
o isBehavior ifTrue:[ |
|
13419 | 376 |
(o class flags bitTest:bit) ifFalse:[ |
377 |
self halt |
|
378 |
]. |
|
620 | 379 |
] ifFalse:[ |
13419 | 380 |
(o class flags bitTest:bit) ifTrue:[ |
381 |
self halt |
|
382 |
]. |
|
620 | 383 |
]. |
384 |
o class isBehavior ifFalse:[ |
|
13419 | 385 |
self halt |
620 | 386 |
] ifTrue:[ |
13419 | 387 |
(o class class flags bitTest:bit) ifFalse:[ |
388 |
self halt |
|
389 |
] |
|
620 | 390 |
] |
391 |
] |
|
392 |
" |
|
393 |
! |
|
394 |
||
395 |
flagBlock |
|
396 |
"return the flag code which marks Block-like instances. |
|
12094 | 397 |
The VM checks for either this bit or the blockLike bit in the flag |
2236 | 398 |
value when checking for blocks to be evaluated from bytecodes. |
399 |
However, compiled code only checks for the block bit." |
|
620 | 400 |
|
401 |
%{ /* NOCONTEXT */ |
|
402 |
/* this is defined as a primitive to get defines from stc.h */ |
|
403 |
||
8913 | 404 |
RETURN ( __mkSmallInteger(BLOCK_INSTS) ); |
620 | 405 |
%} |
406 |
! |
|
407 |
||
408 |
flagBlockContext |
|
409 |
"return the flag code which marks BlockContext-like instances. |
|
2226 | 410 |
The VM checks this single bit in the flag value when |
620 | 411 |
checking for blockContexts." |
412 |
||
413 |
%{ /* NOCONTEXT */ |
|
414 |
/* this is defined as a primitive to get defines from stc.h */ |
|
415 |
||
8913 | 416 |
RETURN ( __mkSmallInteger(BCONTEXT_INSTS) ); |
620 | 417 |
%} |
418 |
! |
|
419 |
||
2236 | 420 |
flagBlockLike |
421 |
"return the flag code which marks Block-like instances |
|
422 |
with respect to byteCode interpretation. |
|
12094 | 423 |
The VM checks for either this bit or the block bit in the flag |
2236 | 424 |
value when checking for blocks to be evaluated from bytecodes. |
425 |
However, compiled code only checks for the block bit." |
|
426 |
||
427 |
%{ /* NOCONTEXT */ |
|
428 |
/* this is defined as a primitive to get defines from stc.h */ |
|
429 |
||
8913 | 430 |
RETURN ( __mkSmallInteger(BLOCKLIKE_INSTS) ); |
2236 | 431 |
%} |
432 |
! |
|
433 |
||
620 | 434 |
flagBytes |
435 |
"return the flag code for byte-valued indexed instances. |
|
12094 | 436 |
The VM masks the flag value with the indexMask (maskIndexType) |
2226 | 437 |
and compares it to this flag value, when checking for byte valued |
438 |
variable instances." |
|
620 | 439 |
|
440 |
%{ /* NOCONTEXT */ |
|
441 |
/* this is defined as a primitive to get defines from stc.h */ |
|
442 |
||
8913 | 443 |
RETURN ( __mkSmallInteger(BYTEARRAY) ); |
620 | 444 |
%} |
445 |
" |
|
12094 | 446 |
Behavior flagBytes |
620 | 447 |
" |
448 |
! |
|
449 |
||
450 |
flagContext |
|
451 |
"return the flag code which marks Context-like instances. |
|
2226 | 452 |
The VM checks this single bit in the flag value when |
620 | 453 |
checking for contexts." |
454 |
||
455 |
%{ /* NOCONTEXT */ |
|
456 |
/* this is defined as a primitive to get defines from stc.h */ |
|
457 |
||
8913 | 458 |
RETURN ( __mkSmallInteger(CONTEXT_INSTS) ); |
620 | 459 |
%} |
460 |
! |
|
461 |
||
462 |
flagDoubles |
|
463 |
"return the flag code for double-valued indexed instances (i.e. 8-byte reals). |
|
12094 | 464 |
The VM masks the flag value with the indexMask (maskIndexType) |
2226 | 465 |
and compares it to this flag value, when checking for double valued |
466 |
variable instances." |
|
620 | 467 |
|
468 |
%{ /* NOCONTEXT */ |
|
469 |
/* this is defined as a primitive to get defines from stc.h */ |
|
470 |
||
8913 | 471 |
RETURN ( __mkSmallInteger(DOUBLEARRAY) ); |
620 | 472 |
%} |
473 |
" |
|
12094 | 474 |
Behavior flagDoubles |
475 |
||
476 |
(ByteArray flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles) |
|
477 |
(DoubleArray flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles) |
|
478 |
(Object flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles) |
|
620 | 479 |
" |
480 |
! |
|
481 |
||
7190 | 482 |
flagExternalBytes |
483 |
"return the flag code which marks ExternalBytes-like instances. |
|
484 |
Inline C-code and the VM check this single bit in the flag value when |
|
485 |
checking for an externalBytes-like objet." |
|
486 |
||
487 |
%{ /* NOCONTEXT */ |
|
488 |
/* this is defined as a primitive to get defines from stc.h */ |
|
489 |
||
8913 | 490 |
RETURN ( __mkSmallInteger(EXTERNALBYTES_INSTS) ); |
7190 | 491 |
%} |
492 |
! |
|
493 |
||
620 | 494 |
flagFloat |
495 |
"return the flag code which marks Float-like instances. |
|
7190 | 496 |
Inline C-code and the VM check this single bit in the flag value when |
2226 | 497 |
checking for a float." |
620 | 498 |
|
499 |
%{ /* NOCONTEXT */ |
|
500 |
/* this is defined as a primitive to get defines from stc.h */ |
|
501 |
||
8913 | 502 |
RETURN ( __mkSmallInteger(FLOAT_INSTS) ); |
620 | 503 |
%} |
504 |
! |
|
505 |
||
506 |
flagFloats |
|
507 |
"return the flag code for float-valued indexed instances (i.e. 4-byte reals). |
|
12094 | 508 |
The VM masks the flag value with the indexMask (maskIndexType) |
2226 | 509 |
and compares it to this flag value, when checking for double valued |
510 |
variable instances." |
|
620 | 511 |
|
512 |
%{ /* NOCONTEXT */ |
|
513 |
/* this is defined as a primitive to get defines from stc.h */ |
|
514 |
||
8913 | 515 |
RETURN ( __mkSmallInteger(FLOATARRAY) ); |
620 | 516 |
%} |
517 |
" |
|
12094 | 518 |
Behavior flagFloats |
620 | 519 |
" |
520 |
! |
|
521 |
||
1634 | 522 |
flagForSymbolic:aSymbol |
523 |
"return the flag code for indexed instances with aSymbolic type. |
|
12094 | 524 |
The argument may be one of |
13419 | 525 |
#float, #double, |
526 |
#word, #signedWord, |
|
527 |
#long, #signedLong |
|
528 |
#longLong, #signedLongLong, |
|
529 |
#byte |
|
530 |
#weakObjects |
|
6104 | 531 |
For VW compatibility, also accept: |
13419 | 532 |
#objects, #bytes, #weak. |
6104 | 533 |
" |
1634 | 534 |
|
535 |
%{ /* NOCONTEXT */ |
|
536 |
if (aSymbol == @symbol(float)) { |
|
13419 | 537 |
RETURN ( __mkSmallInteger(FLOATARRAY) ); |
1634 | 538 |
} |
539 |
if (aSymbol == @symbol(double)) { |
|
13419 | 540 |
RETURN ( __mkSmallInteger(DOUBLEARRAY) ); |
1634 | 541 |
} |
542 |
if (aSymbol == @symbol(long)) { |
|
13419 | 543 |
RETURN ( __mkSmallInteger(LONGARRAY) ); |
1634 | 544 |
} |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
545 |
if (aSymbol == @symbol(longLong)) { |
13419 | 546 |
RETURN ( __mkSmallInteger(LONGLONGARRAY) ); |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
547 |
} |
1634 | 548 |
if (aSymbol == @symbol(word)) { |
13419 | 549 |
RETURN ( __mkSmallInteger(WORDARRAY) ); |
1634 | 550 |
} |
551 |
if (aSymbol == @symbol(signedWord)) { |
|
13419 | 552 |
RETURN ( __mkSmallInteger(SWORDARRAY) ); |
1634 | 553 |
} |
554 |
if (aSymbol == @symbol(signedLong)) { |
|
13419 | 555 |
RETURN ( __mkSmallInteger(SLONGARRAY) ); |
1634 | 556 |
} |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
557 |
if (aSymbol == @symbol(signedLongLong)) { |
13419 | 558 |
RETURN ( __mkSmallInteger(SLONGLONGARRAY) ); |
6104 | 559 |
} |
560 |
if ((aSymbol == @symbol(byte)) || (aSymbol == @symbol(bytes))) { |
|
13419 | 561 |
RETURN ( __mkSmallInteger(BYTEARRAY) ); |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
562 |
} |
6104 | 563 |
if (aSymbol == @symbol(objects)) { |
13419 | 564 |
RETURN ( __mkSmallInteger(POINTERARRAY) ); |
6104 | 565 |
} |
10605 | 566 |
if ((aSymbol == @symbol(weakObjects)) || (aSymbol == @symbol(weak))) { |
13419 | 567 |
RETURN ( __mkSmallInteger(WKPOINTERARRAY) ); |
1634 | 568 |
} |
569 |
%}. |
|
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2569
diff
changeset
|
570 |
^ 0 "/ not indexed |
10605 | 571 |
|
572 |
"Modified: / 07-06-2007 / 11:57:44 / cg" |
|
1634 | 573 |
! |
574 |
||
3141 | 575 |
flagJavaClass |
576 |
"return the flag code which marks JavaClass-like instances. |
|
577 |
The VM checks this single bit in the flag value when |
|
578 |
checking for a javaClass." |
|
579 |
||
580 |
%{ /* NOCONTEXT */ |
|
581 |
/* this is defined as a primitive to get defines from stc.h */ |
|
582 |
||
8913 | 583 |
RETURN ( __mkSmallInteger(JCLASS_INSTS) ); |
3141 | 584 |
%} |
585 |
! |
|
586 |
||
2801 | 587 |
flagJavaMethod |
588 |
"return the flag code which marks JavaMethod-like instances. |
|
7190 | 589 |
Inline C-code and the VM check this single bit in the flag value when |
2801 | 590 |
checking for a method." |
591 |
||
592 |
%{ /* NOCONTEXT */ |
|
593 |
/* this is defined as a primitive to get defines from stc.h */ |
|
594 |
||
8913 | 595 |
RETURN ( __mkSmallInteger(JMETHOD_INSTS) ); |
2801 | 596 |
%} |
597 |
! |
|
598 |
||
4307 | 599 |
flagLongLongs |
600 |
"return the flag code for longlong-valued indexed instances (i.e. 8-byte). |
|
12094 | 601 |
The VM masks the flag value with the indexMask (maskIndexType) |
602 |
and compares it to this flag value, when checking for |
|
4307 | 603 |
unsigned long valued variable instances." |
604 |
||
605 |
%{ /* NOCONTEXT */ |
|
606 |
/* this is defined as a primitive to get defines from stc.h */ |
|
607 |
||
8913 | 608 |
RETURN ( __mkSmallInteger(LONGLONGARRAY) ); |
4307 | 609 |
%} |
610 |
" |
|
12094 | 611 |
Behavior flagLongLongs |
4307 | 612 |
" |
613 |
! |
|
614 |
||
620 | 615 |
flagLongs |
616 |
"return the flag code for long-valued indexed instances (i.e. 4-byte). |
|
12094 | 617 |
The VM masks the flag value with the indexMask (maskIndexType) |
618 |
and compares it to this flag value, when checking for |
|
2226 | 619 |
unsigned long valued variable instances." |
620 | 620 |
|
621 |
%{ /* NOCONTEXT */ |
|
622 |
/* this is defined as a primitive to get defines from stc.h */ |
|
623 |
||
8913 | 624 |
RETURN ( __mkSmallInteger(LONGARRAY) ); |
620 | 625 |
%} |
626 |
" |
|
12094 | 627 |
Behavior flagLongs |
620 | 628 |
" |
629 |
! |
|
630 |
||
5743 | 631 |
flagMetaMethod |
632 |
"return the flag code which marks MetaMethod-like instances. |
|
7190 | 633 |
Inline C-code and the VM check this single bit in the flag value when |
5743 | 634 |
about to evaluate a method." |
635 |
||
636 |
%{ /* NOCONTEXT */ |
|
637 |
/* this is defined as a primitive to get defines from stc.h */ |
|
638 |
||
8913 | 639 |
RETURN ( __mkSmallInteger(METAMETHOD_INSTS) ); |
5743 | 640 |
%} |
641 |
! |
|
642 |
||
620 | 643 |
flagMethod |
644 |
"return the flag code which marks Method-like instances. |
|
7190 | 645 |
Inline C-code and the VM check this single bit in the flag value when |
2226 | 646 |
checking for a method." |
620 | 647 |
|
648 |
%{ /* NOCONTEXT */ |
|
649 |
/* this is defined as a primitive to get defines from stc.h */ |
|
650 |
||
8913 | 651 |
RETURN ( __mkSmallInteger(METHOD_INSTS) ); |
620 | 652 |
%} |
653 |
! |
|
654 |
||
655 |
flagNonObjectInst |
|
656 |
"return the flag code which marks instances which have a |
|
657 |
non-object instance variable (in slot 1). |
|
658 |
(these are ignored by the garbage collector)" |
|
659 |
||
660 |
%{ /* NOCONTEXT */ |
|
661 |
/* this is defined as a primitive to get defines from stc.h */ |
|
662 |
||
8913 | 663 |
RETURN ( __mkSmallInteger(NONOBJECT_INSTS) ); |
620 | 664 |
%} |
665 |
! |
|
666 |
||
667 |
flagNotIndexed |
|
668 |
"return the flag code for non-indexed instances. |
|
669 |
You have to mask the flag value with indexMask when comparing |
|
670 |
it with flagNotIndexed." |
|
671 |
||
672 |
^ 0 |
|
673 |
! |
|
674 |
||
675 |
flagPointers |
|
676 |
"return the flag code for pointer indexed instances (i.e. Array of object). |
|
12094 | 677 |
The VM masks the flag value with the indexMask (maskIndexType) |
678 |
and compares it to this flag value, when checking for |
|
2226 | 679 |
pointer variable instances." |
620 | 680 |
|
681 |
%{ /* NOCONTEXT */ |
|
682 |
/* this is defined as a primitive to get defines from stc.h */ |
|
683 |
||
8913 | 684 |
RETURN ( __mkSmallInteger(POINTERARRAY) ); |
620 | 685 |
%} |
686 |
" |
|
12094 | 687 |
Behavior flagPointers |
620 | 688 |
" |
689 |
! |
|
690 |
||
1383 | 691 |
flagRegular |
692 |
"return the flag code which marks regular instances." |
|
693 |
||
694 |
^ 0 |
|
695 |
||
696 |
"Created: 12.5.1996 / 17:53:36 / cg" |
|
697 |
! |
|
698 |
||
4307 | 699 |
flagSignedLongLongs |
700 |
"return the flag code for signed longlong-valued indexed instances (i.e. 8-byte). |
|
12094 | 701 |
The VM masks the flag value with the indexMask (maskIndexType) |
702 |
and compares it to this flag value, when checking for |
|
4307 | 703 |
signed long valued variable instances." |
704 |
||
705 |
%{ /* NOCONTEXT */ |
|
706 |
/* this is defined as a primitive to get defines from stc.h */ |
|
707 |
||
8913 | 708 |
RETURN ( __mkSmallInteger(SLONGLONGARRAY) ); |
4307 | 709 |
%} |
710 |
" |
|
711 |
Behavior flagSignedLongLongs |
|
712 |
" |
|
713 |
! |
|
714 |
||
1634 | 715 |
flagSignedLongs |
716 |
"return the flag code for signed long-valued indexed instances (i.e. 4-byte). |
|
12094 | 717 |
The VM masks the flag value with the indexMask (maskIndexType) |
718 |
and compares it to this flag value, when checking for |
|
2226 | 719 |
signed long valued variable instances." |
1634 | 720 |
|
721 |
%{ /* NOCONTEXT */ |
|
722 |
/* this is defined as a primitive to get defines from stc.h */ |
|
723 |
||
8913 | 724 |
RETURN ( __mkSmallInteger(SLONGARRAY) ); |
1634 | 725 |
%} |
726 |
" |
|
727 |
Behavior flagSignedLongs |
|
728 |
" |
|
729 |
! |
|
730 |
||
731 |
flagSignedWords |
|
732 |
"return the flag code for signed word-valued indexed instances (i.e. 2-byte). |
|
12094 | 733 |
The VM masks the flag value with the indexMask (maskIndexType) |
734 |
and compares it to this flag value, when checking for |
|
2226 | 735 |
signed word valued variable instances." |
1634 | 736 |
|
737 |
%{ /* NOCONTEXT */ |
|
738 |
/* this is defined as a primitive to get defines from stc.h */ |
|
739 |
||
8913 | 740 |
RETURN ( __mkSmallInteger(SWORDARRAY) ); |
1634 | 741 |
%} |
742 |
" |
|
743 |
Behavior flagSignedWords |
|
744 |
" |
|
745 |
! |
|
746 |
||
620 | 747 |
flagSymbol |
748 |
"return the flag code which marks Symbol-like instances. |
|
7190 | 749 |
Inline C-code and the VM check this single bit in the flag value when |
620 | 750 |
checking for symbols." |
751 |
||
752 |
%{ /* NOCONTEXT */ |
|
753 |
/* this is defined as a primitive to get defines from stc.h */ |
|
754 |
||
8913 | 755 |
RETURN ( __mkSmallInteger(SYMBOL_INSTS) ); |
620 | 756 |
%} |
757 |
! |
|
758 |
||
10605 | 759 |
flagWeak |
760 |
"return the flag code for weak-object-pointer indexed instances. |
|
12094 | 761 |
The VM masks the flag value with the indexMask (maskIndexType) |
762 |
and compares it to this flag value, when checking for |
|
10605 | 763 |
weak pointer variable instances." |
764 |
||
765 |
%{ /* NOCONTEXT */ |
|
766 |
/* this is defined as a primitive to get defines from stc.h */ |
|
767 |
||
768 |
RETURN ( __mkSmallInteger(WKPOINTERARRAY) ); |
|
769 |
%} |
|
770 |
" |
|
12094 | 771 |
Behavior flagWeak |
10605 | 772 |
" |
773 |
||
774 |
"Created: / 07-06-2007 / 11:59:12 / cg" |
|
775 |
! |
|
776 |
||
620 | 777 |
flagWeakPointers |
778 |
"return the flag code for weak pointer indexed instances (i.e. WeakArray). |
|
12094 | 779 |
The VM masks the flag value with the indexMask (maskIndexType) |
2226 | 780 |
and compares it to this flag value, when checking for weak pointers." |
620 | 781 |
|
782 |
%{ /* NOCONTEXT */ |
|
783 |
/* this is defined as a primitive to get defines from stc.h */ |
|
784 |
||
8913 | 785 |
RETURN ( __mkSmallInteger(WKPOINTERARRAY) ); |
620 | 786 |
%} |
787 |
! |
|
788 |
||
789 |
flagWords |
|
790 |
"return the flag code for word-valued indexed instances (i.e. 2-byte). |
|
12094 | 791 |
The VM masks the flag value with the indexMask (maskIndexType) |
792 |
and compares it to this flag value, when checking for |
|
2226 | 793 |
unsigned word valued variable instances." |
620 | 794 |
|
795 |
%{ /* NOCONTEXT */ |
|
796 |
/* this is defined as a primitive to get defines from stc.h */ |
|
797 |
||
8913 | 798 |
RETURN ( __mkSmallInteger(WORDARRAY) ); |
620 | 799 |
%} |
800 |
" |
|
12094 | 801 |
Behavior flagWords |
620 | 802 |
" |
803 |
! |
|
804 |
||
805 |
maskIndexType |
|
806 |
"return a mask to extract all index-type bits" |
|
807 |
||
808 |
%{ /* NOCONTEXT */ |
|
809 |
/* this is defined as a primitive to get defines from stc.h */ |
|
810 |
||
8913 | 811 |
RETURN ( __mkSmallInteger(ARRAYMASK) ); |
620 | 812 |
%} |
813 |
! ! |
|
814 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
815 |
|
8962 | 816 |
!Behavior class methodsFor:'helpers'! |
817 |
||
9849 | 818 |
classesSortedByLoadOrder:someClasses |
819 |
"return a copy of the given collection of classes, which is sorted |
|
820 |
by inheritance and superclass-of-any-private class. |
|
821 |
This is the optimal order for loading, and the required order for compilation" |
|
822 |
||
823 |
|remaining classesInLoadOrder| |
|
824 |
||
10008
85b80de0562a
fix private class dependency handling in #classesSortedByLoadOrder:
Stefan Vogel <sv@exept.de>
parents:
9849
diff
changeset
|
825 |
"private classes are not loaded directly, so ignore them" |
14990 | 826 |
remaining := someClasses select:[:eachClass| eachClass isPrivate not] as:IdentitySet. |
13419 | 827 |
"JV-2011-05-05: Sort the classes by name to get more stable order. |
13414 | 828 |
This stabilizes order of classes in generated build files and |
829 |
makes text-based diffing/merging easier for both human beings |
|
830 |
and version control systems" |
|
831 |
remaining := remaining asOrderedCollection sort:[:a :b|a name < b name]. |
|
10008
85b80de0562a
fix private class dependency handling in #classesSortedByLoadOrder:
Stefan Vogel <sv@exept.de>
parents:
9849
diff
changeset
|
832 |
classesInLoadOrder := OrderedCollection new:(remaining size). |
85b80de0562a
fix private class dependency handling in #classesSortedByLoadOrder:
Stefan Vogel <sv@exept.de>
parents:
9849
diff
changeset
|
833 |
|
9849 | 834 |
[remaining notEmpty] whileTrue:[ |
14990 | 835 |
|thoseWithOtherSuperclasses thoseWhichCanBeLoadedNow| |
836 |
||
837 |
"find the next class(es) to be loaded. |
|
838 |
Consider first: |
|
839 |
all those, which do not have a superclass in the remaining set. |
|
840 |
and which do not use a shared pool defined in the remaining set" |
|
841 |
||
842 |
thoseWithOtherSuperclasses := |
|
843 |
remaining |
|
844 |
reject:[:eachClass | |
|
845 |
(remaining includes:eachClass superclass) |
|
846 |
or:[eachClass sharedPoolNames contains:[:eachPoolSymbol| |
|
847 |
remaining contains:[:eachRemainingClass| eachPoolSymbol = eachRemainingClass name] |
|
848 |
] |
|
849 |
]. |
|
850 |
]. |
|
851 |
||
852 |
"second: the subset with all those having no private classes, |
|
853 |
or having private classes, whose superclasses are NOT in the remaining set" |
|
854 |
||
855 |
thoseWhichCanBeLoadedNow := |
|
856 |
thoseWithOtherSuperclasses |
|
857 |
reject:[:eachClass | |
|
858 |
eachClass allPrivateClasses contains:[:eachPrivateClass| |superClassesOwner| |
|
859 |
superClassesOwner := eachPrivateClass superclass. |
|
860 |
"take care of classes inheriting from nil or ProtoObject" |
|
861 |
superClassesOwner isBehavior ifTrue:[ |
|
862 |
superClassesOwner := superClassesOwner owningClassOrYourself. |
|
863 |
]. |
|
864 |
superClassesOwner ~~ eachClass |
|
865 |
and:[remaining includes:superClassesOwner] |
|
866 |
]. |
|
867 |
]. |
|
868 |
||
869 |
thoseWhichCanBeLoadedNow isEmpty ifTrue:[ |
|
870 |
thoseWithOtherSuperclasses isEmpty ifTrue:[ |
|
871 |
"this does not normally happen" |
|
872 |
self error:'superclass order is cyclic'. |
|
873 |
] ifFalse:[ |
|
874 |
"no class found, that may be loaded - maybe there is a cyclic |
|
875 |
dependency involving private classes. |
|
876 |
If you proceed here, private class dependencies are ignored |
|
877 |
for this pass" |
|
878 |
self error:'load order is cyclic (care for private classes)' mayProceed:true. |
|
879 |
thoseWhichCanBeLoadedNow := thoseWithOtherSuperclasses. |
|
880 |
]. |
|
881 |
]. |
|
882 |
remaining removeAllFoundIn:thoseWhichCanBeLoadedNow. |
|
883 |
classesInLoadOrder addAll:(thoseWhichCanBeLoadedNow asArray sort:[:a :b | a name < b name]). |
|
9849 | 884 |
]. |
885 |
^ classesInLoadOrder |
|
886 |
||
887 |
" |
|
12094 | 888 |
Class classesSortedByLoadOrder:(Smalltalk allClassesInPackage:'stx:libbasic') |
889 |
Class classesSortedByLoadOrder:(Smalltalk allClassesInPackage:'stx:libbasic3') |
|
890 |
Class classesSortedByLoadOrder:(Smalltalk allClassesInPackage:'stx:libwidg') |
|
9849 | 891 |
" |
892 |
||
893 |
"Created: / 14-09-2006 / 11:21:25 / cg" |
|
13215
14d2bc8d5c5f
changed: #classesSortedByLoadOrder:
Claus Gittinger <cg@exept.de>
parents:
12936
diff
changeset
|
894 |
"Modified: / 18-01-2011 / 17:55:59 / cg" |
13414 | 895 |
"Modified: / 05-05-2011 / 12:43:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9849 | 896 |
! |
897 |
||
8962 | 898 |
commonSuperclassOf:listOfClassesOrClassNames |
11984 | 899 |
"given a list of classes, return the common superclass. |
900 |
A helper for the browser, some dialogs and some refactorings" |
|
901 |
||
8962 | 902 |
|common| |
903 |
||
904 |
listOfClassesOrClassNames do:[:classOrClassName | |
|
13419 | 905 |
|class| |
906 |
||
907 |
class := classOrClassName isBehavior |
|
908 |
ifTrue:[classOrClassName] |
|
909 |
ifFalse:[Smalltalk classNamed:classOrClassName]. |
|
910 |
||
911 |
common isNil ifTrue:[ |
|
912 |
common := class |
|
913 |
] ifFalse:[ |
|
914 |
(class isSubclassOf:common) ifTrue:[ |
|
915 |
"keep common" |
|
916 |
] ifFalse:[ |
|
917 |
(common isSubclassOf:class) ifTrue:[ |
|
918 |
common := class |
|
919 |
] ifFalse:[ |
|
920 |
common := common commonSuperclass:class. |
|
8962 | 921 |
|
922 |
"/ "walk up, checking" |
|
923 |
"/ found := false. |
|
924 |
"/ |
|
925 |
"/ common allSuperclassesDo:[:sup | |
|
926 |
"/ (found not and:[class isSubclassOf:sup]) ifTrue:[ |
|
927 |
"/ common := sup. |
|
928 |
"/ found := true. |
|
929 |
"/ ] |
|
930 |
"/ ]. |
|
931 |
"/ found ifFalse:[ |
|
932 |
"/ class allSuperclassesDo:[:sup | |
|
933 |
"/ (found not and:[common isSubclassOf:sup]) ifTrue:[ |
|
934 |
"/ common := sup. |
|
935 |
"/ found := true. |
|
936 |
"/ ] |
|
937 |
"/ ]. |
|
938 |
"/ ]. |
|
13419 | 939 |
] |
940 |
]. |
|
941 |
]. |
|
942 |
(common isNil or:[common == Object]) ifTrue:[^ common]. |
|
8962 | 943 |
]. |
944 |
^ common |
|
945 |
||
11984 | 946 |
" |
947 |
Class commonSuperclassOf:#(Array OrderedCollection Set) |
|
948 |
Class commonSuperclassOf:#(Character Number Point) |
|
949 |
" |
|
950 |
||
8962 | 951 |
"Modified: 17.6.1996 / 17:09:21 / stefan" |
952 |
"Modified: 5.9.1996 / 19:34:41 / cg" |
|
953 |
! ! |
|
954 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
955 |
|
4964 | 956 |
!Behavior class methodsFor:'misc'! |
957 |
||
958 |
autoload |
|
959 |
"for compatibility with autoloaded classes - dummy here" |
|
960 |
||
961 |
^ self |
|
962 |
||
963 |
! ! |
|
964 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
965 |
|
1760 | 966 |
!Behavior class methodsFor:'queries'! |
620 | 967 |
|
4332
c672bf261fbd
added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
968 |
definitionSelectorFirstParts |
c672bf261fbd
added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
969 |
"return a collection of partial class-definition selectors" |
c672bf261fbd
added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
970 |
|
c672bf261fbd
added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
971 |
^ #( #'subclass:' |
13419 | 972 |
#'variableSubclass:' |
973 |
#'variableByteSubclass:' |
|
974 |
#'variableWordSubclass:' |
|
975 |
#'variableLongSubclass:' |
|
976 |
#'variableSignedWordSubclass:' |
|
977 |
#'variableSignedLongSubclass:' |
|
978 |
#'variableLongLongSubclass:' |
|
979 |
#'variableSignedLongLongSubclass:' |
|
980 |
#'variableFloatSubclass:' |
|
981 |
#'variableDoubleSubclass:' |
|
12094 | 982 |
) |
4332
c672bf261fbd
added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
983 |
! |
c672bf261fbd
added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
984 |
|
4428 | 985 |
definitionSelectors |
986 |
"return a collection class-definition selectors" |
|
987 |
||
12094 | 988 |
^ #( |
13419 | 989 |
#'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
990 |
#'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
|
991 |
#'variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
|
992 |
#'variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
|
993 |
#'variableLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
|
994 |
#'variableSignedWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
|
995 |
#'variableSignedLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
|
996 |
#'variableLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
|
997 |
#'variableSignedLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
|
998 |
#'variableFloatSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
|
999 |
#'variableDoubleSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
|
1000 |
||
1001 |
"/ ST/X private subclasses |
|
1002 |
||
1003 |
#'subclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:' |
|
1004 |
#'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:' |
|
1005 |
#'variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:' |
|
1006 |
#'variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:' |
|
1007 |
#'variableLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:' |
|
1008 |
#'variableSignedWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:' |
|
1009 |
#'variableSignedLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:' |
|
1010 |
#'variableLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:' |
|
1011 |
#'variableSignedLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:' |
|
1012 |
#'variableFloatSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:' |
|
1013 |
#'variableDoubleSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:' |
|
1014 |
||
1015 |
"/ ST/V subclass messages |
|
1016 |
||
1017 |
#'subclass:instanceVariableNames:classVariableNames:poolDictionaries:' |
|
1018 |
#'variableByteSubclass:classVariableNames:poolDictionaries:' |
|
1019 |
#'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:' |
|
1020 |
||
1021 |
"/ Dolphin |
|
1022 |
#'subclass:instanceVariableNames:classVariableNames:poolDictionaries:classInstanceVariableNames:' |
|
12094 | 1023 |
) |
9194 | 1024 |
! |
1025 |
||
1026 |
isBuiltInClass |
|
1027 |
"return true if this class is known by the run-time-system. |
|
1028 |
Here, true is returned for myself, false for subclasses." |
|
1029 |
||
1030 |
^ (self == Behavior class) or:[self == Behavior] |
|
1031 |
||
1032 |
"Modified: 23.4.1996 / 15:55:52 / cg" |
|
14154
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
1033 |
! |
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
1034 |
|
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
1035 |
supportsMethodCategories |
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
1036 |
"return true, if my methods are categorized. |
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
1037 |
This is a hook for the browser to allow alien classes |
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
1038 |
to be handled (actually, this is not yet used)." |
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
1039 |
|
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
1040 |
^ true |
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
1041 |
|
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
1042 |
"Created: / 01-06-2012 / 20:37:46 / cg" |
9194 | 1043 |
! ! |
1044 |
||
14414
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
1045 |
|
7269 | 1046 |
!Behavior methodsFor:'Compatibility-Dolphin'! |
6329 | 1047 |
|
1048 |
allSubinstances |
|
11953 | 1049 |
"Compatibility method - do not use in new code. |
1050 |
Same as allSubInstances; added for Dolphin compatibility" |
|
1051 |
||
6865 | 1052 |
^ self allSubInstances |
1053 |
! |
|
1054 |
||
6889
7efa6d375ef7
+fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents:
6865
diff
changeset
|
1055 |
fromString:aString |
11953 | 1056 |
"reconstruct an instance of myself from the ascii-store string. |
1057 |
These bytes are typically the result from storing into a string/stream. |
|
1058 |
Same as readFrom:, for Dolphin compatibility." |
|
1059 |
||
14972 | 1060 |
|s result| |
1061 |
||
1062 |
s := aString readStream. |
|
1063 |
result := self readFrom:s. |
|
1064 |
"/ should check here for garbage - maybe later |
|
1065 |
"/ s atEnd ifFalse:[^ ConversionError raiseRequestWith:aString errorString:' - garbage at end of ', self name]. |
|
1066 |
^ result |
|
6889
7efa6d375ef7
+fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents:
6865
diff
changeset
|
1067 |
! |
7efa6d375ef7
+fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents:
6865
diff
changeset
|
1068 |
|
6865 | 1069 |
guid:aUUID |
11953 | 1070 |
"Compatibility method - do not use in new code. |
1071 |
An ignored dummy; for Dolphin compatibility." |
|
1072 |
||
1073 |
"/ intentionally left blank - for now |
|
11158 | 1074 |
! |
1075 |
||
1076 |
lookupMethod:selector |
|
11953 | 1077 |
"Compatibility method - do not use in new code. |
1078 |
Return the method for given selector aSelector or nil. |
|
1079 |
Only methods in the receiver - not in the superclass chain are returned. |
|
1080 |
For dolphin compatibility. |
|
1081 |
TODO: fixme if I am wrong, and dolphin does a full lookup here. If that is the case, |
|
1082 |
change to use lookupMethodFor:aSelector below." |
|
1083 |
||
11158 | 1084 |
^ self compiledMethodAt:selector |
6329 | 1085 |
! ! |
1086 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1087 |
|
7269 | 1088 |
!Behavior methodsFor:'Compatibility-Squeak'! |
4889 | 1089 |
|
12359 | 1090 |
classComment:comment stamp:commentStamp |
1091 |
self comment:comment |
|
1092 |
! |
|
1093 |
||
13600 | 1094 |
classSide |
1095 |
"alias for theMetaclass - return the metaclass" |
|
1096 |
||
1097 |
^ self theMetaclass |
|
1098 |
||
1099 |
"Created: / 26-08-2009 / 11:44:51 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
|
1100 |
"Modified: / 12-09-2010 / 16:38:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1101 |
"Modified (comment): / 20-08-2011 / 16:33:47 / cg" |
|
1102 |
! |
|
1103 |
||
9194 | 1104 |
defaultNameStemForInstances |
1105 |
"Answer a basis for names of default instances of the receiver" |
|
1106 |
||
1107 |
^ self name |
|
1108 |
||
1109 |
! |
|
5753
65cce9486ee9
added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
5743
diff
changeset
|
1110 |
|
65cce9486ee9
added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
5743
diff
changeset
|
1111 |
lookupSelector:aSelector |
65cce9486ee9
added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
5743
diff
changeset
|
1112 |
"return the method for a selector - Squeak compatibility" |
65cce9486ee9
added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
5743
diff
changeset
|
1113 |
|
65cce9486ee9
added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
5743
diff
changeset
|
1114 |
^ self lookupMethodFor:aSelector |
6147 | 1115 |
! |
1116 |
||
12094 | 1117 |
selectorsWithArgs:numberOfArgs |
6147 | 1118 |
"Return all selectors defined in this class that take this number of arguments." |
1119 |
||
12094 | 1120 |
^ self selectors |
13419 | 1121 |
select:[:sel | sel numArgs == numberOfArgs] |
6147 | 1122 |
|
1123 |
" |
|
12094 | 1124 |
SmallInteger selectorsWithArgs:0 |
1125 |
SmallInteger selectorsWithArgs:2 |
|
6147 | 1126 |
SmallInteger selectorsWithArgs:3 |
12094 | 1127 |
SmallInteger selectorsWithArgs:4 |
6147 | 1128 |
" |
13600 | 1129 |
! |
1130 |
||
1131 |
theNonMetaClass |
|
1132 |
"alias for theNonMetaclass - return the class" |
|
1133 |
||
1134 |
^ self theNonMetaclass |
|
1135 |
||
1136 |
"Created: / 26-08-2009 / 11:39:08 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
|
1137 |
"Modified (comment): / 20-08-2011 / 16:35:07 / cg" |
|
4889 | 1138 |
! ! |
1139 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1140 |
|
7269 | 1141 |
!Behavior methodsFor:'Compatibility-VW'! |
5964 | 1142 |
|
1143 |
>> aSelector |
|
1144 |
"return the method stored under the given selector; nil if there is none" |
|
1145 |
||
1146 |
^ self compiledMethodAt:aSelector |
|
1147 |
||
1148 |
" |
|
1149 |
self compiledMethodAt:#compiledMethodAt: |
|
1150 |
self >> #compiledMethodAt: |
|
1151 |
" |
|
6115 | 1152 |
! |
1153 |
||
1154 |
fixedFieldsMask |
|
1155 |
"Mask on the format word to indicate the number of fixed fields in instances |
|
1156 |
of a behavior. If this is non-zero, the behavior must be pointer-type" |
|
1157 |
||
1158 |
^ 255 |
|
1159 |
||
1160 |
! |
|
1161 |
||
1162 |
format |
|
1163 |
"Answer an Integer that encodes the kinds and numbers of |
|
1164 |
variables of instances of the receiver. |
|
1165 |
||
1166 |
See instSize method for reference to the fixedFieldsMask bit mask of the format. |
|
1167 |
See isVariable method for reference to the indexableMask bit mask of the format. |
|
1168 |
See isBits method for reference to the pointersMask bit mask of the format. |
|
1169 |
All other bits of the format are unused and should be 0." |
|
1170 |
||
1171 |
"/ simulate a VW5i mask |
|
1172 |
||
1173 |
^ (self instSize |
|
1174 |
bitOr:( self isPointers ifTrue:[16384] ifFalse:[0])) |
|
1175 |
bitOr:( self isVariable ifTrue:[ 4096] ifFalse:[0]) |
|
1176 |
||
1177 |
! |
|
1178 |
||
10085 | 1179 |
getMethodDictionary |
1180 |
"ST 80 compatibility: return the receivers method dictionary." |
|
1181 |
||
1182 |
^ self methodDictionary |
|
1183 |
||
1184 |
"Modified: / 6.3.1998 / 15:45:50 / stefan" |
|
1185 |
! |
|
1186 |
||
6115 | 1187 |
instanceBehavior |
12094 | 1188 |
"Answer the instance behavior of the receiver. |
1189 |
This is the receiver for non metaclasses. |
|
6115 | 1190 |
Metaclass overrides this to answer a Metaclass's sole instance. |
1191 |
Same as #theNonMetaclass - for VW compatibility |
|
1192 |
" |
|
1193 |
||
1194 |
^ self theNonMetaclass |
|
1195 |
||
6968 | 1196 |
! |
1197 |
||
1198 |
shortName |
|
1199 |
^ self nameWithoutPrefix |
|
5964 | 1200 |
! ! |
1201 |
||
9196
a6d45629bb3b
readFromString allows for whiteSpace after reading
Claus Gittinger <cg@exept.de>
parents:
9194
diff
changeset
|
1202 |
|
14972 | 1203 |
|
620 | 1204 |
!Behavior methodsFor:'accessing'! |
1205 |
||
1206 |
addSelector:newSelector withMethod:newMethod |
|
1207 |
"add the method given by 2nd argument under the selector given by |
|
734
a4378f483a86
pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
1208 |
1st argument to the methodDictionary. Flushes all caches." |
a4378f483a86
pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
1209 |
|
14550 | 1210 |
|oldMethod ns selector newLookupObject| |
734
a4378f483a86
pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
1211 |
|
7800 | 1212 |
(newSelector isMemberOf:Symbol) ifFalse:[ |
14535 | 1213 |
self error:'invalid selector'. |
7800 | 1214 |
]. |
13419 | 1215 |
|
14551 | 1216 |
ns := newMethod nameSpace. |
14550 | 1217 |
(ns notNil and:[ns ~= self programmingLanguage defaultSelectorNameSpacePrefix]) ifTrue:[ |
1218 |
selector := (':' , ns , '::' , newSelector) asSymbol. |
|
1219 |
newLookupObject := Smalltalk at: #NamespaceAwareLookup. "/ so it can be nilled to disable that feature |
|
1220 |
] ifFalse:[ |
|
1221 |
selector := newSelector |
|
1222 |
]. |
|
14535 | 1223 |
|
1224 |
"/ Q (cg): isn't that something that the caller should decide? |
|
13414 | 1225 |
oldMethod := self compiledMethodAt:selector. |
9469
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
1226 |
oldMethod notNil ifTrue:[ |
14535 | 1227 |
newMethod restricted:(oldMethod isRestricted). |
1228 |
newMethod setPrivacy:(oldMethod privacy) flushCaches:false. |
|
9469
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
1229 |
]. |
11578 | 1230 |
|
13414 | 1231 |
(self primAddSelector:selector withMethod:newMethod) ifFalse:[^ false]. |
1232 |
||
14550 | 1233 |
newLookupObject notNil ifTrue:[ |
1234 |
lookupObject ~= newLookupObject ifTrue:[ |
|
1235 |
self lookupObject: newLookupObject |
|
14535 | 1236 |
] |
13460 | 1237 |
]. |
734
a4378f483a86
pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
1238 |
|
620 | 1239 |
" |
1240 |
if I have no subclasses, all we have to flush is cached |
|
1241 |
data for myself ... (actually, in any case all that needs |
|
1242 |
to be flushed is info for myself and all of my subclasses) |
|
1243 |
" |
|
1244 |
" |
|
1245 |
problem: this is slower; since looking for all subclasses is (currently) |
|
14535 | 1246 |
a bit slow :-( |
1247 |
We need the hasSubclasses-info bit in Behavior; now |
|
620 | 1248 |
|
1249 |
self withAllSubclassesDo:[:aClass | |
|
14535 | 1250 |
ObjectMemory flushInlineCachesFor:aClass withArgs:nargs. |
1251 |
ObjectMemory flushMethodCacheFor:aClass |
|
620 | 1252 |
]. |
1253 |
" |
|
1254 |
||
3805
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1255 |
"/ |
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1256 |
"/ pass the selector AND the old method as changeArg |
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1257 |
"/ - this allows for watchers to find out if its a new method or a method-change |
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1258 |
"/ |
13414 | 1259 |
self changed:#methodDictionary with:(Array with:selector with:oldMethod). |
3805
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1260 |
|
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1261 |
"/ |
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1262 |
"/ also notify a change of Smalltalk; |
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1263 |
"/ this allows a dependent of Smalltalk to watch all class |
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1264 |
"/ changes (no need for observing all classes) |
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1265 |
"/ - this allows for watchers to find out if its a new method or a method-change |
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1266 |
"/ |
13414 | 1267 |
Smalltalk changed:#methodInClass with:(Array with:self with:selector with:oldMethod). |
11574 | 1268 |
^ true. |
3805
d525b3acc091
flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents:
3641
diff
changeset
|
1269 |
|
9469
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
1270 |
"Created: / 11-12-1995 / 13:59:37 / cg" |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
1271 |
"Modified: / 04-08-2006 / 11:39:28 / cg" |
13414 | 1272 |
"Modified: / 20-07-2010 / 11:29:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
620 | 1273 |
! |
1274 |
||
9445 | 1275 |
basicAddSelector:newSelector withMethod:newMethod |
1276 |
"add the method given by 2nd argument under the selector given by |
|
1277 |
1st argument to the methodDictionary. Flushes all caches." |
|
1278 |
||
1279 |
|nargs | |
|
1280 |
||
1281 |
self primAddSelector:newSelector withMethod:newMethod. |
|
1282 |
||
1283 |
nargs := newSelector numArgs. |
|
1284 |
||
1285 |
ObjectMemory flushMethodCacheForSelector:newSelector. |
|
1286 |
"/ ObjectMemory flushMethodCache. |
|
1287 |
ObjectMemory flushInlineCachesWithArgs:nargs. |
|
1288 |
ObjectMemory flushCachesForSelector:newSelector |
|
1289 |
||
1290 |
"Created: / 15-07-2006 / 16:56:43 / cg" |
|
1291 |
! |
|
1292 |
||
10535 | 1293 |
basicRemoveSelector:aSelector |
12094 | 1294 |
"remove the selector, aSelector and its associated method |
10535 | 1295 |
from the methodDictionary" |
1296 |
||
1297 |
|dict newDict| |
|
1298 |
||
12094 | 1299 |
(Smalltalk |
13419 | 1300 |
changeRequest:#methodInClassRemoved |
1301 |
with:(Array with:self with:aSelector) |
|
1302 |
) ifFalse:[ |
|
1303 |
^ false |
|
11578 | 1304 |
]. |
1305 |
||
10535 | 1306 |
dict := self methodDictionary. |
1307 |
newDict := dict removeKeyAndCompress:aSelector. |
|
12094 | 1308 |
newDict isNil ifTrue:[ |
13414 | 1309 |
^ false. |
10535 | 1310 |
]. |
1311 |
self setMethodDictionary:newDict. |
|
1312 |
||
1313 |
" |
|
1314 |
actually, we would do better with less flushing ... |
|
1315 |
" |
|
1316 |
"/ObjectMemory flushCaches. |
|
1317 |
||
1318 |
"yes, we can:" |
|
1319 |
ObjectMemory flushCachesForSelector:aSelector. |
|
1320 |
^ true |
|
1321 |
||
13414 | 1322 |
"Modified: / 12-06-1996 / 11:54:29 / stefan" |
1323 |
"Modified: / 19-07-2010 / 11:22:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10535 | 1324 |
! |
1325 |
||
14703 | 1326 |
containingNameSpace |
1327 |
"return the namespace which contains me. |
|
1328 |
Defined here as a dummy; actually only real classes should ever be put into a namespace." |
|
1329 |
||
1330 |
^ nil |
|
1331 |
! |
|
1332 |
||
620 | 1333 |
flags |
1334 |
"return the receivers flag bits" |
|
1335 |
||
1336 |
^ flags |
|
1337 |
! |
|
1338 |
||
1339 |
instSize |
|
1340 |
"return the number of instance variables of the receiver. |
|
1341 |
This includes all superclass instance variables." |
|
1342 |
||
1343 |
^ instSize |
|
1344 |
! |
|
1345 |
||
12842 | 1346 |
lookupObject |
1347 |
"return the lookupObject (Jan's MetaObjectProtocol support) or nil. |
|
1348 |
If non-nil, no lookup is performed by the VM, instead the lookupObject |
|
1349 |
has to provide a method object for message sends." |
|
1350 |
||
13414 | 1351 |
| behavior lookup | |
13419 | 1352 |
|
1353 |
Lookup isNil ifTrue:[^ nil]. |
|
1354 |
||
13414 | 1355 |
behavior := self. |
13419 | 1356 |
[ behavior notNil ] whileTrue:[ |
1357 |
lookup := behavior getLookupObject. |
|
1358 |
lookup notNil ifTrue: [^ lookup]. |
|
1359 |
behavior := behavior superclass |
|
1360 |
]. |
|
1361 |
||
1362 |
^ Lookup builtin. |
|
13414 | 1363 |
|
1364 |
"Modified: / 26-04-2010 / 21:05:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1365 |
! |
|
1366 |
||
1367 |
lookupObject: anObject |
|
14535 | 1368 |
lookupObject == anObject ifTrue:[^ self ]. |
13414 | 1369 |
anObject isNil ifTrue:[^self setLookupObject: anObject]. |
1370 |
||
17890
7a68614eeb3a
Behavior: fix for #lookupObject:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17869
diff
changeset
|
1371 |
(anObject respondsTo: #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:) |
13419 | 1372 |
ifFalse:[ |
17890
7a68614eeb3a
Behavior: fix for #lookupObject:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17869
diff
changeset
|
1373 |
self error:'Lookup object does not respond to #lookupMethodForSelector:directedTo:for:withArguments:from:ilc' |
13419 | 1374 |
]. |
1375 |
(anObject respondsTo:#superLookupObject:) |
|
1376 |
ifTrue:[ |
|
14535 | 1377 |
anObject superLookupObject: self lookupObject |
13419 | 1378 |
]. |
13414 | 1379 |
self setLookupObject: anObject. |
1380 |
||
1381 |
"Created: / 26-04-2010 / 13:35:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17890
7a68614eeb3a
Behavior: fix for #lookupObject:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17869
diff
changeset
|
1382 |
"Modified: / 26-10-2011 / 13:00:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12842 | 1383 |
! |
1384 |
||
620 | 1385 |
methodDictionary |
1634 | 1386 |
"return the receivers method dictionary." |
620 | 1387 |
|
1494
dab70fc90ebc
Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1388 |
^ methodDictionary |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1389 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1390 |
"Modified: 12.6.1996 / 13:47:08 / stefan" |
1634 | 1391 |
"Modified: 16.8.1996 / 14:55:21 / cg" |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1392 |
! |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1393 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1394 |
methodDictionary:dict |
12094 | 1395 |
"set the receivers method dictionary and flush inline caches." |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1396 |
|
1814 | 1397 |
dict isNil ifTrue:[ |
13419 | 1398 |
self error:'attempt to set methodDictionary to nil.' mayProceed:true. |
1399 |
^ self |
|
1814 | 1400 |
]. |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1401 |
self setMethodDictionary:dict. |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1402 |
ObjectMemory flushCaches. |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1403 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1404 |
"Created: 5.6.1996 / 11:29:36 / stefan" |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1405 |
"Modified: 7.6.1996 / 08:39:51 / stefan" |
620 | 1406 |
! |
1407 |
||
7605
945a2cd8115c
moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7435
diff
changeset
|
1408 |
package |
945a2cd8115c
moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7435
diff
changeset
|
1409 |
"for protocol compatibility with class" |
945a2cd8115c
moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7435
diff
changeset
|
1410 |
|
945a2cd8115c
moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7435
diff
changeset
|
1411 |
^ '' |
945a2cd8115c
moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7435
diff
changeset
|
1412 |
! |
945a2cd8115c
moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7435
diff
changeset
|
1413 |
|
620 | 1414 |
removeSelector:aSelector |
12094 | 1415 |
"remove the selector, aSelector and its associated method |
620 | 1416 |
from the methodDictionary" |
1417 |
||
10535 | 1418 |
^ self basicRemoveSelector:aSelector |
620 | 1419 |
! |
1420 |
||
1421 |
selectors |
|
1422 |
"return the receivers selector array as an orderedCollection. |
|
1423 |
Notice: this may not be compatible with ST-80. |
|
1424 |
(should we return a Set ?)" |
|
1425 |
||
1814 | 1426 |
|md| |
1427 |
||
1967
e8a6fb1e14ce
oops - iNil instead of isNil
Claus Gittinger <cg@exept.de>
parents:
1918
diff
changeset
|
1428 |
(md := self methodDictionary) isNil ifTrue:[ |
13419 | 1429 |
'oops - nil methodDictionary' errorPrintCR. |
1430 |
^ #() |
|
1814 | 1431 |
]. |
1432 |
^ md keys |
|
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1433 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
1434 |
"Modified: 7.6.1996 / 15:33:18 / stefan" |
1967
e8a6fb1e14ce
oops - iNil instead of isNil
Claus Gittinger <cg@exept.de>
parents:
1918
diff
changeset
|
1435 |
"Modified: 12.11.1996 / 11:31:51 / cg" |
620 | 1436 |
! |
1437 |
||
1438 |
superclass |
|
1439 |
"return the receivers superclass" |
|
1440 |
||
1441 |
^ superclass |
|
1442 |
! ! |
|
1443 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1444 |
|
620 | 1445 |
!Behavior methodsFor:'autoload check'! |
1446 |
||
1447 |
autoload |
|
12094 | 1448 |
"force autoloading - do nothing here; |
620 | 1449 |
redefined in Autoload; see comment there" |
1450 |
||
1451 |
^ self |
|
1452 |
! |
|
1453 |
||
1454 |
isLoaded |
|
12094 | 1455 |
"return true, if the class has been loaded; |
620 | 1456 |
redefined in Autoload; see comment there" |
1457 |
||
1458 |
^ true |
|
6727 | 1459 |
! |
1460 |
||
1461 |
wasAutoloaded |
|
1462 |
"return true, if this class came into the system via an |
|
1463 |
autoload; false otherwise. |
|
1464 |
Returning false here. This allows different Behavior-like objects |
|
1465 |
(alien classes) to be handled by the browser as well." |
|
1466 |
||
1467 |
^ false |
|
1468 |
||
1469 |
"Created: 16.4.1996 / 16:27:16 / cg" |
|
620 | 1470 |
! ! |
1471 |
||
11160
4a413380f57c
support for dolphin binary storage format
Claus Gittinger <cg@exept.de>
parents:
11158
diff
changeset
|
1472 |
|
9639 | 1473 |
!Behavior methodsFor:'compiler interface'! |
1474 |
||
1475 |
browserClass |
|
12094 | 1476 |
"return the browser to use for this class - |
9639 | 1477 |
this can be redefined in special classes, to get different browsers" |
1478 |
||
1479 |
^ self class browserClass. |
|
1480 |
! |
|
1481 |
||
1482 |
compilerClass |
|
12094 | 1483 |
"return the compiler to use for this class - |
9639 | 1484 |
this can be redefined in special classes, to compile classes with |
1485 |
Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
|
1486 |
||
1487 |
^ self class compilerClass. |
|
1488 |
! |
|
1489 |
||
12936 | 1490 |
dllPath |
13419 | 1491 |
"if a class contains ExternalFunctions, |
12936 | 1492 |
return a collection of pathNames where to find the DLLs |
1493 |
containing the external functions. |
|
1494 |
||
1495 |
Do not code absolute path names here - keep them in the system settings. |
|
1496 |
Use this if the DLL location is kept in some registry entry." |
|
1497 |
||
1498 |
^ #() |
|
1499 |
! |
|
1500 |
||
9639 | 1501 |
evaluatorClass |
12094 | 1502 |
"return the compiler to use for expression evaluation for this class - |
9639 | 1503 |
this can be redefined in special classes, to evaluate expressions with |
1504 |
Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
|
1505 |
||
1506 |
^ self class evaluatorClass. |
|
1507 |
! |
|
1508 |
||
1509 |
formatterClass |
|
12094 | 1510 |
"return the parser to use for formatting (prettyPrinting) this class - |
9639 | 1511 |
this can be redefined in special classes, to format classes with |
1512 |
Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
|
1513 |
||
1514 |
^ self class formatterClass. |
|
620 | 1515 |
! |
1516 |
||
11990 | 1517 |
language |
12936 | 1518 |
<resource: #obsolete> |
1519 |
self obsoleteMethodWarning:'use #programmingLanguage or Smalltalk language'. |
|
12148
e7a761017355
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12114
diff
changeset
|
1520 |
^ self class programmingLanguage |
11990 | 1521 |
|
1522 |
"Created: / 15-08-2009 / 09:06:46 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1523 |
! |
|
1524 |
||
9639 | 1525 |
parserClass |
12094 | 1526 |
"return the parser to use for parsing this class - |
9639 | 1527 |
this can be redefined in special classes, to parse classes with |
1528 |
Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
|
1529 |
||
1530 |
^ self class parserClass. |
|
1531 |
! |
|
1532 |
||
12148
e7a761017355
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12114
diff
changeset
|
1533 |
programmingLanguage |
e7a761017355
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12114
diff
changeset
|
1534 |
|
e7a761017355
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12114
diff
changeset
|
1535 |
^self class programmingLanguage |
e7a761017355
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12114
diff
changeset
|
1536 |
|
e7a761017355
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12114
diff
changeset
|
1537 |
"Created: / 15-08-2009 / 09:06:46 / Jan Vrany <vranyj1@fel.cvut.cz>" |
e7a761017355
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12114
diff
changeset
|
1538 |
! |
e7a761017355
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12114
diff
changeset
|
1539 |
|
9639 | 1540 |
subclassDefinerClass |
12094 | 1541 |
"Answer an evaluator class appropriate for evaluating definitions of new |
9639 | 1542 |
subclasses of this class." |
1543 |
||
1544 |
^ self class subclassDefinerClass. |
|
1545 |
! |
|
1546 |
||
1547 |
syntaxHighlighterClass |
|
12094 | 1548 |
"return the class to use for syntaxHighlighting (prettyPrinting) this class - |
9639 | 1549 |
this can be redefined in special classes, to highlight classes with |
1550 |
Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
|
1551 |
||
1552 |
^ self class syntaxHighlighterClass. |
|
1553 |
! ! |
|
1554 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1555 |
|
9639 | 1556 |
!Behavior methodsFor:'compiling'! |
1557 |
||
1558 |
compile:code notifying:requestor |
|
1559 |
"compile code, aString for this class; on any error, notify |
|
1560 |
requestor, anObject with the error reason. |
|
1561 |
Returns the new method or nil (on failure)." |
|
1562 |
||
1563 |
^ self compilerClass |
|
13419 | 1564 |
compile:code |
1565 |
forClass:self |
|
1566 |
notifying:requestor |
|
9639 | 1567 |
|
1568 |
"Modified: 13.12.1995 / 11:02:40 / cg" |
|
1569 |
"Created: 1.4.1997 / 23:43:43 / stefan" |
|
1570 |
! ! |
|
1571 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1572 |
|
9639 | 1573 |
!Behavior methodsFor:'copying'! |
1574 |
||
12094 | 1575 |
canCloneFrom:anObject |
620 | 1576 |
"return true, if this class can clone an obsolete object as retrieved |
1577 |
by a binary load. Subclasses which do not want to have obsolete objects |
|
1578 |
be converted, should redefine this method to return false. |
|
1579 |
(However, conversion is never done silently in a binary load; you |
|
1580 |
have to have a handler for the binaryload errors and for the conversion |
|
1581 |
request signal.)" |
|
1582 |
||
1583 |
^ true |
|
1584 |
! |
|
1585 |
||
1586 |
cloneFrom:aPrototype |
|
1587 |
"return an instance of myself with variables initialized from |
|
1588 |
a prototype. This is used when instances of obsolete classes are |
|
12094 | 1589 |
binary loaded and a conversion is done on the obsolete object. |
620 | 1590 |
UserClasses may redefine this for better conversions." |
1591 |
||
4738 | 1592 |
|newInst indexed| |
620 | 1593 |
|
1594 |
indexed := false. |
|
1595 |
aPrototype class isVariable ifTrue:[ |
|
13419 | 1596 |
self isVariable ifTrue:[ |
1597 |
indexed := true. |
|
1598 |
]. |
|
1599 |
"otherwise, these are lost ..." |
|
620 | 1600 |
]. |
1601 |
indexed ifTrue:[ |
|
13419 | 1602 |
newInst := self basicNew:aPrototype basicSize |
620 | 1603 |
] ifFalse:[ |
13419 | 1604 |
newInst := self basicNew |
620 | 1605 |
]. |
1606 |
||
4692
055edf6e95af
Redefine #cloneFrom: using #cloneInstanceVariablesFrom:.
Stefan Vogel <sv@exept.de>
parents:
4682
diff
changeset
|
1607 |
newInst cloneInstanceVariablesFrom:aPrototype. |
055edf6e95af
Redefine #cloneFrom: using #cloneInstanceVariablesFrom:.
Stefan Vogel <sv@exept.de>
parents:
4682
diff
changeset
|
1608 |
|
620 | 1609 |
^ newInst |
1610 |
||
1611 |
" |
|
1612 |
Class withoutUpdatingChangesDo:[ |
|
13419 | 1613 |
Point subclass:#Point3D |
1614 |
instanceVariableNames:'z' |
|
1615 |
classVariableNames:'' |
|
1616 |
poolDictionaries:'' |
|
1617 |
category:'testing'. |
|
1618 |
(Point3D cloneFrom:1@2) inspect. |
|
620 | 1619 |
] |
1620 |
" |
|
1621 |
||
1622 |
" |
|
1623 |
Class withoutUpdatingChangesDo:[ |
|
13419 | 1624 |
Point variableSubclass:#Point3D |
1625 |
instanceVariableNames:'z' |
|
1626 |
classVariableNames:'' |
|
1627 |
poolDictionaries:'' |
|
1628 |
category:'testing'. |
|
1629 |
(Point3D cloneFrom:#(1 2 3)) inspect. |
|
620 | 1630 |
] |
1631 |
" |
|
1632 |
||
1633 |
" |
|
1634 |
|someObject| |
|
1635 |
||
1636 |
Class withoutUpdatingChangesDo:[ |
|
13419 | 1637 |
Object subclass:#TestClass1 |
1638 |
instanceVariableNames:'foo bar' |
|
1639 |
classVariableNames:'' |
|
1640 |
poolDictionaries:'' |
|
1641 |
category:'testing'. |
|
1642 |
someObject := TestClass1 new. |
|
1643 |
someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'. |
|
1644 |
Object subclass:#TestClass2 |
|
1645 |
instanceVariableNames:'bar foo' |
|
1646 |
classVariableNames:'' |
|
1647 |
poolDictionaries:'' |
|
1648 |
category:'testing'. |
|
1649 |
(TestClass2 cloneFrom:someObject) inspect. |
|
620 | 1650 |
] |
1651 |
" |
|
1652 |
! |
|
1653 |
||
10949 | 1654 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
620 | 1655 |
"return a deep copy of the receiver |
1656 |
- return the receiver here - time will show if this is ok" |
|
1657 |
||
1658 |
^ self |
|
1659 |
! |
|
1660 |
||
1661 |
simpleDeepCopy |
|
1662 |
"return a deep copy of the receiver |
|
1663 |
- return the receiver here - time will show if this is ok" |
|
1664 |
||
1665 |
^ self |
|
1666 |
! ! |
|
1667 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1668 |
|
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1669 |
!Behavior methodsFor:'dummy changes management'! |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1670 |
|
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1671 |
addChangeRecordForClassRemove:aClassName |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1672 |
"add a change record that some class has been removed. |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1673 |
Defined as dummy here, since Behavior does not know about change management. |
9194 | 1674 |
(only Classes do). This allows different Behavior-like objects |
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1675 |
(alien classes) to be handled by the browser as well." |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1676 |
|
9194 | 1677 |
"Created: 16.4.1996 / 16:30:09 / cg" |
1678 |
"Modified: 16.4.1996 / 18:10:35 / cg" |
|
1679 |
! ! |
|
1680 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1681 |
|
9194 | 1682 |
!Behavior methodsFor:'dummy fileOut'! |
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1683 |
|
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1684 |
fileOutDefinitionOn:aStream |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1685 |
"dummy fileOut defined here. |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1686 |
This allows different Behavior-like objects |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1687 |
(alien classes) to be handled by the browser as well." |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1688 |
|
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1689 |
^ self |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1690 |
|
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1691 |
"Created: 16.4.1996 / 16:28:01 / cg" |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1692 |
! ! |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1693 |
|
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1694 |
|
620 | 1695 |
!Behavior methodsFor:'enumerating'! |
1696 |
||
1697 |
allDerivedInstancesDo:aBlock |
|
1698 |
"evaluate aBlock for all of my instances and all instances of subclasses. |
|
1699 |
This method is going to be removed for protocol compatibility with |
|
1700 |
other STs; use allSubInstancesDo:" |
|
1701 |
||
5862 | 1702 |
<resource:#obsolete> |
1703 |
||
9194 | 1704 |
self obsoleteMethodWarning:'use #allSubInstancesDo:'. |
1705 |
self allSubInstancesDo:aBlock |
|
1706 |
||
1707 |
" |
|
1708 |
StandardSystemView allDerivedInstancesDo:[:v | Transcript showCR:(v name)] |
|
1709 |
" |
|
1710 |
||
1711 |
"Modified: 31.7.1997 / 23:05:04 / cg" |
|
1712 |
! |
|
620 | 1713 |
|
1714 |
allInstancesDo:aBlock |
|
1715 |
"evaluate aBlock for all of my instances" |
|
1716 |
||
1717 |
ObjectMemory allInstancesOf:self do:[:anObject | |
|
13419 | 1718 |
aBlock value:anObject |
620 | 1719 |
] |
1720 |
||
1721 |
" |
|
1422 | 1722 |
StandardSystemView allInstancesDo:[:v | Transcript showCR:(v name)] |
620 | 1723 |
" |
1724 |
! |
|
1725 |
||
7809 | 1726 |
allOwningclassesDo:aBlock |
1727 |
"evaluate aBlock for all of my owners (i.e. owner, owner-of-owner etc)." |
|
1728 |
||
1729 |
|owner| |
|
1730 |
||
1731 |
owner := self owningClass. |
|
1732 |
[owner notNil] whileTrue:[ |
|
13419 | 1733 |
aBlock value:owner. |
1734 |
owner := owner owningClass. |
|
9194 | 1735 |
]. |
1736 |
||
1737 |
" |
|
1738 |
Method::MethodWhoInfo allOwningclassesDo:[:c | Transcript showCR:(c name)] |
|
1739 |
" |
|
1740 |
! |
|
7809 | 1741 |
|
5368
192acdc335e6
added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
1742 |
allSelectorsAndMethodsDo:aTwoArgBlock |
192acdc335e6
added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
1743 |
"evaluate the argument, aBlock for all selectors of mySelf and my metaclass, |
192acdc335e6
added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
1744 |
passing the corresponding method as second argument" |
192acdc335e6
added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
1745 |
|
8353 | 1746 |
<resource: #obsolete> |
6076
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1747 |
self obsoleteMethodWarning:'use #instAndClassSelectorsAndMethodsDo:'. |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1748 |
|
6022 | 1749 |
self selectorsAndMethodsDo:aTwoArgBlock. |
9194 | 1750 |
self class selectorsAndMethodsDo:aTwoArgBlock. |
1751 |
! |
|
5368
192acdc335e6
added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
1752 |
|
620 | 1753 |
allSubInstancesDo:aBlock |
1754 |
"evaluate aBlock for all of my instances and all instances of subclasses" |
|
1755 |
||
1756 |
ObjectMemory allObjectsDo:[:anObject | |
|
13419 | 1757 |
(anObject isKindOf:self) ifTrue:[ |
1758 |
aBlock value:anObject |
|
1759 |
] |
|
620 | 1760 |
] |
1761 |
||
1762 |
" |
|
1422 | 1763 |
StandardSystemView allSubInstancesDo:[:v | Transcript showCR:(v name)] |
620 | 1764 |
" |
1765 |
! |
|
1766 |
||
1767 |
allSubclassesDo:aBlock |
|
1768 |
"evaluate aBlock for all of my subclasses. |
|
1769 |
There is no specific order, in which the entries are enumerated. |
|
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
1770 |
Warning: |
13419 | 1771 |
This will only enumerate globally known classes - for anonymous |
1772 |
behaviors, you have to walk over all instances of Behavior." |
|
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
1773 |
|
6931 | 1774 |
self allSubclassesInOrderDo:aBlock |
1775 |
||
1776 |
"/ self isMeta ifTrue:[ |
|
1777 |
"/ "/ metaclasses are not found via Smalltalk allClassesDo: |
|
1778 |
"/ "/ here, walk over classes and enumerate corresponding metas. |
|
1779 |
"/ self soleInstance allSubclassesDo:[:aSubClass | |
|
1780 |
"/ aBlock value:(aSubClass class) |
|
1781 |
"/ ]. |
|
1782 |
"/ ] ifFalse:[ |
|
1783 |
"/ Smalltalk allClassesDo:[:aClass | |
|
1784 |
"/ (aClass isSubclassOf:self) ifTrue:[ |
|
1785 |
"/ aBlock value:aClass |
|
1786 |
"/ ] |
|
1787 |
"/ ] |
|
1788 |
"/ ] |
|
620 | 1789 |
|
1790 |
" |
|
1422 | 1791 |
Collection allSubclassesDo:[:c | Transcript showCR:(c name)] |
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
1792 |
Collection class allSubclassesDo:[:c | Transcript showCR:(c name)] |
620 | 1793 |
" |
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
1794 |
|
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
1795 |
"Modified: / 25.10.1997 / 21:17:13 / cg" |
9194 | 1796 |
! |
1797 |
||
1798 |
allSubclassesInOrderDo:aBlock |
|
620 | 1799 |
"evaluate aBlock for all of my subclasses. |
6931 | 1800 |
There is no specific order, in which the entries are enumerated. |
1801 |
Warning: |
|
13419 | 1802 |
This will only enumerate globally known classes - for anonymous |
1803 |
behaviors, you have to walk over all instances of Behavior." |
|
6931 | 1804 |
|
1805 |
|meta toDo cls| |
|
1806 |
||
1807 |
meta := self isMeta. |
|
12094 | 1808 |
|
6931 | 1809 |
toDo := OrderedCollection new. |
1810 |
toDo addAll:self theNonMetaclass subclasses. |
|
1811 |
[toDo notEmpty] whileTrue:[ |
|
13419 | 1812 |
cls := toDo removeFirst. |
1813 |
toDo addAll:cls subclasses. |
|
1814 |
meta ifTrue:[ |
|
1815 |
aBlock value:cls class. |
|
1816 |
] ifFalse:[ |
|
1817 |
aBlock value:cls. |
|
1818 |
] |
|
6931 | 1819 |
]. |
1820 |
||
1821 |
"/ self isMeta ifTrue:[ |
|
1822 |
"/ "/ metaclasses are not found via Smalltalk allClassesDo: |
|
1823 |
"/ "/ here, walk over classes and enumerate corresponding metas. |
|
1824 |
"/ self soleInstance allSubclassesDo:[:aSubClass | |
|
1825 |
"/ aBlock value:(aSubClass class) |
|
1826 |
"/ ]. |
|
1827 |
"/ ] ifFalse:[ |
|
1828 |
"/ Smalltalk allClassesDo:[:aClass | |
|
1829 |
"/ (aClass isSubclassOf:self) ifTrue:[ |
|
1830 |
"/ aBlock value:aClass |
|
1831 |
"/ ] |
|
1832 |
"/ ] |
|
1833 |
"/ ] |
|
620 | 1834 |
|
1835 |
" |
|
7435
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7358
diff
changeset
|
1836 |
Collection allSubclassesInOrderDo:[:c | Transcript showCR:(c name)] |
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7358
diff
changeset
|
1837 |
Collection class allSubclassesInOrderDo:[:c | Transcript showCR:(c name)] |
620 | 1838 |
" |
6931 | 1839 |
|
1840 |
"Modified: / 25.10.1997 / 21:17:13 / cg" |
|
9194 | 1841 |
! |
1842 |
||
1843 |
allSuperclassesDo:aBlock |
|
1844 |
"evaluate aBlock for all of my superclasses" |
|
1845 |
||
1846 |
|theClass| |
|
1847 |
||
1848 |
theClass := self superclass. |
|
1849 |
[theClass notNil] whileTrue:[ |
|
13419 | 1850 |
aBlock value:theClass. |
1851 |
theClass := theClass superclass |
|
9194 | 1852 |
] |
1853 |
||
1854 |
" |
|
1855 |
String allSuperclassesDo:[:c | Transcript showCR:(c name)] |
|
1856 |
" |
|
1857 |
! |
|
620 | 1858 |
|
6076
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1859 |
instAndClassMethodsDo:aOneArgBlock |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1860 |
"evaluate the argument, aBlock for all methods of mySelf and my metaclass |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1861 |
(i.e. for both instance- and class methods)" |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1862 |
|
6395
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
1863 |
self theNonMetaclass methodsDo:aOneArgBlock. |
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
1864 |
self theMetaclass methodsDo:aOneArgBlock. |
6076
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1865 |
! |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1866 |
|
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1867 |
instAndClassSelectorsAndMethodsDo:aTwoArgBlock |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1868 |
"evaluate the argument, aBlock for all selectors of mySelf and my metaclass, |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1869 |
passing the corresponding method as second argument" |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1870 |
|
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1871 |
self selectorsAndMethodsDo:aTwoArgBlock. |
9194 | 1872 |
self class selectorsAndMethodsDo:aTwoArgBlock. |
1873 |
! |
|
6076
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1874 |
|
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1875 |
methodsDo:aOneArgBlock |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1876 |
"evaluate the argument, aBlock for all my methods" |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1877 |
|
6395
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
1878 |
self methodDictionary do:aOneArgBlock |
6076
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1879 |
|
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1880 |
" |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1881 |
UndefinedObject methodsDo:[:m | Transcript showCR:m whoString] |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1882 |
UndefinedObject selectorsDo:[:sym | Transcript showCR:sym] |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1883 |
" |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1884 |
! |
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1885 |
|
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
1886 |
selectorsAndMethodsDo:aTwoArgBlock |
5368
192acdc335e6
added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
1887 |
"evaluate the argument, aBlock for all my selectors, |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
1888 |
passing the corresponding method as second argument" |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
1889 |
|
6395
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
1890 |
self methodDictionary keysAndValuesDo:aTwoArgBlock |
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
1891 |
|
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
1892 |
"Created: / 27.10.1997 / 14:09:27 / cg" |
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
1893 |
! |
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
1894 |
|
9194 | 1895 |
selectorsDo:aOneArgBlock |
1896 |
"evaluate the argument, aBlock for all my selectors" |
|
1897 |
||
1898 |
self methodDictionary keysDo:aOneArgBlock |
|
1899 |
! |
|
6076
2f75076b5597
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6030
diff
changeset
|
1900 |
|
620 | 1901 |
subclassesDo:aBlock |
1902 |
"evaluate the argument, aBlock for all immediate subclasses. |
|
1903 |
This will only enumerate globally known classes - for anonymous |
|
1904 |
behaviors, you have to walk over all instances of Behavior." |
|
1905 |
||
7435
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7358
diff
changeset
|
1906 |
"Do it the hard way. Subclasses redefine this" |
5581 | 1907 |
Smalltalk allClassesDo:[:aClass | |
13419 | 1908 |
(aClass superclass == self) ifTrue:[ |
1909 |
aBlock value:aClass |
|
1910 |
] |
|
9194 | 1911 |
] |
1912 |
! |
|
5638 | 1913 |
|
12094 | 1914 |
whichClassSatisfies: aBlock |
12862
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1915 |
"return the first class along the superclass-chain, which satisfies aBlock. |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1916 |
Return nil, if there is none." |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1917 |
|
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1918 |
|cls| |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1919 |
|
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1920 |
cls := self. |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1921 |
[cls notNil] whileTrue:[ |
13419 | 1922 |
(aBlock value: cls) ifTrue: [^ cls]. |
1923 |
cls := cls superclass. |
|
12862
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1924 |
]. |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1925 |
^ nil |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1926 |
|
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1927 |
" |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1928 |
SimpleView whichClassSatisfies:[:cls | cls instanceVariableNames includes:'gc'] |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
1929 |
" |
6727 | 1930 |
! |
1931 |
||
5638 | 1932 |
withAllSubclassesDo:aBlock |
1933 |
"evaluate aBlock for mySelf and all of my subclasses. |
|
1934 |
There is no specific order, in which the entries are enumerated. |
|
1935 |
Warning: |
|
13419 | 1936 |
This will only enumerate globally known classes - for anonymous |
1937 |
behaviors, you have to walk over all instances of Behavior." |
|
5638 | 1938 |
|
1939 |
aBlock value:self. |
|
1940 |
self allSubclassesDo:aBlock |
|
1941 |
||
1942 |
" |
|
1943 |
Collection withAllSubclassesDo:[:c | Transcript showCR:(c name)] |
|
1944 |
Collection class withAllSubclassesDo:[:c | Transcript showCR:(c name)] |
|
1945 |
" |
|
9194 | 1946 |
! |
1947 |
||
1948 |
withAllSuperclassesDo:aBlock |
|
1949 |
"evaluate aBlock for the class and all of its superclasses" |
|
1950 |
||
1951 |
|theSuperClass| |
|
1952 |
||
1953 |
aBlock value:self. |
|
1954 |
theSuperClass := self superclass. |
|
1955 |
[theSuperClass notNil] whileTrue:[ |
|
13419 | 1956 |
aBlock value:theSuperClass. |
1957 |
theSuperClass := theSuperClass superclass |
|
9194 | 1958 |
]. |
1959 |
||
1960 |
" |
|
12094 | 1961 |
String withAllSuperclassesDo:[:each| Transcript showCR:each] |
9194 | 1962 |
" |
1963 |
! ! |
|
1964 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1965 |
|
14469
239e909bf765
added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents:
14414
diff
changeset
|
1966 |
!Behavior methodsFor:'error handling'! |
239e909bf765
added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents:
14414
diff
changeset
|
1967 |
|
239e909bf765
added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents:
14414
diff
changeset
|
1968 |
abstractClassInstantiationError |
239e909bf765
added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents:
14414
diff
changeset
|
1969 |
"sent by an abstract classes redefined new method" |
239e909bf765
added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents:
14414
diff
changeset
|
1970 |
|
239e909bf765
added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents:
14414
diff
changeset
|
1971 |
^ AbstractClassInstantiationError raiseRequest |
239e909bf765
added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents:
14414
diff
changeset
|
1972 |
|
239e909bf765
added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents:
14414
diff
changeset
|
1973 |
"Created: / 02-11-2012 / 10:07:01 / cg" |
239e909bf765
added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents:
14414
diff
changeset
|
1974 |
! ! |
239e909bf765
added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents:
14414
diff
changeset
|
1975 |
|
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1976 |
|
9194 | 1977 |
!Behavior methodsFor:'initialization'! |
1 | 1978 |
|
620 | 1979 |
deinitialize |
1980 |
"deinitialize is sent to a class before it is physically unloaded. |
|
1981 |
This is only done with classes which have been loaded in from a binary |
|
1982 |
file. Classes may release any primitive memory or other stuff which is |
|
1983 |
not visible to smalltalk (for example, release internal memory). |
|
1984 |
The default action here is to do nothing." |
|
1985 |
||
1986 |
^ self |
|
1987 |
! |
|
1988 |
||
1 | 1989 |
initialize |
442 | 1990 |
"initialize is sent to a class either during startup, |
1991 |
(for all statically compiled-in classes) or after a class |
|
1992 |
has been loaded into the system (either bytecodes or machinecode). |
|
1993 |
The default action here is to do nothing." |
|
1 | 1994 |
|
1995 |
^ self |
|
1996 |
! |
|
1997 |
||
3442
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
1998 |
initializeWithAllPrivateClasses |
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
1999 |
"if implemented, send #initialize to myself and any private |
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
2000 |
class which does so. |
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
2001 |
This is sent to a class after it |
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
2002 |
has been loaded into the system. |
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
2003 |
Statically compiled classes are initialized by the VM" |
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
2004 |
|
6412
4d6aaac56707
implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents:
6395
diff
changeset
|
2005 |
(self class includesSelector:#initialize) ifTrue:[ |
13419 | 2006 |
self initialize. |
3442
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
2007 |
]. |
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
2008 |
self privateClassesSorted do:[:aPrivateClass | |
13419 | 2009 |
aPrivateClass initializeWithAllPrivateClasses. |
3442
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
2010 |
]. |
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
2011 |
|
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
2012 |
"Created: / 13.5.1998 / 23:33:16 / cg" |
d22afbb5864f
added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
2013 |
"Modified: / 13.5.1998 / 23:34:06 / cg" |
9194 | 2014 |
! |
2015 |
||
2016 |
postAutoload |
|
2017 |
"postAutoload is sent to a class after it has been autoloaded. |
|
2018 |
This gives it a chance to arrange for automatic unloading to be done |
|
2019 |
after a while ... |
|
2020 |
This is NOT sent to statically compiled in or explicitely filedIn |
|
2021 |
classes. |
|
2022 |
The default action here is to do nothing." |
|
2023 |
||
2024 |
^ self |
|
2025 |
! |
|
328 | 2026 |
|
1 | 2027 |
reinitialize |
442 | 2028 |
"reinitialize is sent to a class when an image has been restarted. |
2029 |
I.e. when the system is restarted. |
|
2030 |
This gives classes a chance to flush any device dependent or otherwise |
|
2031 |
obsolete data which may be a leftover from the previous live. |
|
2032 |
The default action here is to do nothing." |
|
2033 |
||
9194 | 2034 |
^ self |
2035 |
! ! |
|
2036 |
||
14414
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
2037 |
|
9194 | 2038 |
!Behavior methodsFor:'instance creation'! |
2039 |
||
2040 |
basicNew |
|
54 | 2041 |
"return an instance of myself without indexed variables. |
1 | 2042 |
If the receiver-class has indexed instvars, the new object will have |
12094 | 2043 |
a basicSize of zero - |
91 | 2044 |
i.e. 'aClass basicNew' is equivalent to 'aClass basicNew:0'. |
54 | 2045 |
|
1 | 2046 |
** Do not redefine this method in any class **" |
2047 |
||
2048 |
%{ /* NOCONTEXT */ |
|
81 | 2049 |
REGISTER OBJ newobj; |
2050 |
REGISTER char *nextPtr; |
|
14688 | 2051 |
unsigned INT instsize; |
2052 |
REGISTER unsigned INT nInstVars; |
|
1 | 2053 |
|
54 | 2054 |
/* |
369 | 2055 |
* the following ugly code is nothing more than a __new() followed |
54 | 2056 |
* by a nilling of the new instance. |
12094 | 2057 |
* Unrolled for a bit more speed since this is one of the central object |
91 | 2058 |
* allocation methods in the system |
54 | 2059 |
*/ |
1133 | 2060 |
nInstVars = __intVal(__INST(instSize)); |
92 | 2061 |
instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars); |
54 | 2062 |
|
983 | 2063 |
newobj = (OBJ) __newNextPtr; |
81 | 2064 |
nextPtr = ((char *)newobj) + instsize; |
2065 |
||
2066 |
/* |
|
12094 | 2067 |
* dont argue about the goto and the arrangement below - it saves |
81 | 2068 |
* an extra nil-compare and branch in the common case ... |
91 | 2069 |
* (i.e. if no GC is needed, we fall through without a branch) |
81 | 2070 |
*/ |
983 | 2071 |
if (nextPtr < __newEndPtr) { |
13419 | 2072 |
_objPtr(newobj)->o_size = instsize; |
2073 |
/* o_allFlags(newobj) = 0; */ |
|
2074 |
/* _objPtr(newobj)->o_space = __newSpace; */ |
|
2075 |
o_setAllFlags(newobj, __newSpace); |
|
2894 | 2076 |
#ifdef __HAS_ALIGN4__ |
13419 | 2077 |
/* |
2078 |
* if the alignment is 4, we are already sat, |
|
2079 |
* since a non-indexed object always has a word-aligned size. |
|
2080 |
*/ |
|
2081 |
__newNextPtr = nextPtr; |
|
91 | 2082 |
#else |
13419 | 2083 |
if (instsize & (__ALIGN__-1)) { |
2084 |
__newNextPtr = (char *)newobj + (instsize & ~(__ALIGN__-1)) + __ALIGN__; |
|
2085 |
} else { |
|
2086 |
__newNextPtr = nextPtr; |
|
2087 |
} |
|
91 | 2088 |
#endif |
82 | 2089 |
|
2090 |
ok: |
|
13419 | 2091 |
__InstPtr(newobj)->o_class = self; |
2092 |
__qSTORE(newobj, self); |
|
2093 |
||
2094 |
if (nInstVars) { |
|
788
e80f1c42b87b
dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
2095 |
#if defined(memset4) && defined(FAST_OBJECT_MEMSET4) || defined(FAST_MEMSET4) |
13419 | 2096 |
memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars); |
82 | 2097 |
#else |
13419 | 2098 |
REGISTER OBJ *op; |
2099 |
||
2100 |
op = __InstPtr(newobj)->i_instvars; |
|
2101 |
||
2102 |
/* |
|
2103 |
* knowing that nil is 0 |
|
2104 |
*/ |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2105 |
# if defined(FAST_OBJECT_MEMSET_DOUBLES_UNROLLED) |
13419 | 2106 |
if (nInstVars > 8) { |
2107 |
*op++ = nil; /* for alignment */ |
|
2108 |
nInstVars--; |
|
2109 |
while (nInstVars >= 8) { |
|
2110 |
*(double *)op = 0.0; |
|
2111 |
((double *)op)[1] = 0.0; |
|
2112 |
((double *)op)[2] = 0.0; |
|
2113 |
((double *)op)[3] = 0.0; |
|
2114 |
op += 8; |
|
2115 |
nInstVars -= 8; |
|
2116 |
} |
|
2117 |
} |
|
2118 |
while (nInstVars != 0) { |
|
2119 |
*op++ = 0; |
|
2120 |
nInstVars--; |
|
2121 |
} |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2122 |
# else |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2123 |
# if defined(FAST_OBJECT_MEMSET_LONGLONG_UNROLLED) |
13419 | 2124 |
if (nInstVars > 8) { |
2125 |
*op++ = nil; /* for alignment */ |
|
2126 |
nInstVars--; |
|
2127 |
while (nInstVars >= 8) { |
|
2128 |
*(long long *)op = 0; |
|
2129 |
((long long *)op)[1] = 0; |
|
2130 |
((long long *)op)[2] = 0; |
|
2131 |
((long long *)op)[3] = 0; |
|
2132 |
op += 8; |
|
2133 |
nInstVars -= 8; |
|
2134 |
} |
|
2135 |
} |
|
2136 |
while (nInstVars != 0) { |
|
2137 |
*op++ = 0; |
|
2138 |
nInstVars--; |
|
2139 |
} |
|
91 | 2140 |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2141 |
# else |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2142 |
# if defined(FAST_OBJECT_MEMSET_WORDS_UNROLLED) |
13419 | 2143 |
while (nInstVars >= 8) { |
2144 |
*op = nil; |
|
2145 |
*(op+1) = nil; |
|
2146 |
*(op+2) = nil; |
|
2147 |
*(op+3) = nil; |
|
2148 |
*(op+4) = nil; |
|
2149 |
*(op+5) = nil; |
|
2150 |
*(op+6) = nil; |
|
2151 |
*(op+7) = nil; |
|
2152 |
op += 8; |
|
2153 |
nInstVars -= 8; |
|
2154 |
} |
|
2155 |
while (nInstVars != 0) { |
|
2156 |
*op++ = nil; |
|
2157 |
nInstVars--; |
|
2158 |
} |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2159 |
# else |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2160 |
# if defined(FAST_MEMSET) |
13419 | 2161 |
memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE); |
91 | 2162 |
# else |
14688 | 2163 |
while (nInstVars >= 8) { |
2164 |
nInstVars -= 8; |
|
2165 |
op[0] = nil; op[1] = nil; |
|
2166 |
op[2] = nil; op[3] = nil; |
|
2167 |
op[4] = nil; op[5] = nil; |
|
2168 |
op[6] = nil; op[7] = nil; |
|
2169 |
op += 8; |
|
2170 |
} |
|
2171 |
while (nInstVars != 0) { |
|
13419 | 2172 |
*op++ = nil; |
2173 |
nInstVars--; |
|
14688 | 2174 |
} |
82 | 2175 |
# endif |
2176 |
# endif |
|
2177 |
# endif |
|
2178 |
# endif |
|
2179 |
#endif |
|
13419 | 2180 |
} |
2181 |
RETURN ( newobj ); |
|
81 | 2182 |
} |
54 | 2183 |
|
92 | 2184 |
/* |
2185 |
* the slow case - a GC will occur |
|
2186 |
*/ |
|
834 | 2187 |
__PROTECT_CONTEXT__ |
14688 | 2188 |
newobj = __STX___new((INT)instsize); |
834 | 2189 |
__UNPROTECT_CONTEXT__ |
82 | 2190 |
if (newobj != nil) goto ok; |
9194 | 2191 |
%} |
2192 |
. |
|
2193 |
" |
|
2194 |
memory allocation failed. |
|
2195 |
When we arrive here, there was no memory, even after |
|
12094 | 2196 |
a garbage collect. |
2197 |
This means, that the VM wanted to get some more memory from the |
|
9194 | 2198 |
Operatingsystem, which was not kind enough to give it. |
2199 |
Bad luck - you should increase the swap space on your machine. |
|
68 | 2200 |
" |
127 | 2201 |
^ ObjectMemory allocationFailureSignal raise. |
1 | 2202 |
! |
2203 |
||
9194 | 2204 |
basicNew:anInteger |
1 | 2205 |
"return an instance of myself with anInteger indexed variables. |
2206 |
If the receiver-class has no indexed instvars, this is only allowed |
|
2207 |
if the argument, anInteger is zero. |
|
2208 |
** Do not redefine this method in any class **" |
|
2209 |
||
2210 |
%{ /* NOCONTEXT */ |
|
2211 |
||
2212 |
OBJ newobj; |
|
14688 | 2213 |
unsigned INT nInstVars; |
2214 |
unsigned INT instsize; |
|
154 | 2215 |
INT nindexedinstvars; |
92 | 2216 |
unsigned INT flags; |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2217 |
#if ! defined(FAST_ARRAY_MEMSET) |
1 | 2218 |
REGISTER char *cp; |
2219 |
short *sp; |
|
2220 |
long *lp; |
|
2221 |
#endif |
|
2222 |
REGISTER OBJ *op; |
|
2223 |
float *fp; |
|
2224 |
double *dp; |
|
2225 |
||
249 | 2226 |
if (__isSmallInteger(anInteger)) { |
13419 | 2227 |
nindexedinstvars = __intVal(anInteger); |
2228 |
if (nindexedinstvars >= 0) { |
|
2229 |
nInstVars = __intVal(__INST(instSize)); |
|
2230 |
flags = __intVal(__INST(flags)) & ARRAYMASK; |
|
2231 |
switch (flags) { |
|
2232 |
case BYTEARRAY: |
|
2233 |
instsize = OHDR_SIZE + nindexedinstvars; |
|
2234 |
if (nInstVars == 0) { |
|
2235 |
if (__CanDoQuickNew(instsize)) { /* OBJECT ALLOCATION */ |
|
2236 |
/* |
|
2237 |
* the most common case |
|
2238 |
*/ |
|
2239 |
__qCheckedNew(newobj, instsize); |
|
2240 |
__InstPtr(newobj)->o_class = self; |
|
2241 |
__qSTORE(newobj, self); |
|
7858
65d77eb25fda
Have to call __STORE(), when assigning class.
Stefan Vogel <sv@exept.de>
parents:
7809
diff
changeset
|
2242 |
|
788
e80f1c42b87b
dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
2243 |
#if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4) |
13419 | 2244 |
nInstVars = nindexedinstvars >> 2; |
2245 |
if (nindexedinstvars & 3) nInstVars++; |
|
2246 |
memset4(__InstPtr(newobj)->i_instvars, 0, nInstVars); |
|
357 | 2247 |
#else |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2248 |
# if defined(FAST_ARRAY_MEMSET) |
13419 | 2249 |
memset(__InstPtr(newobj)->i_instvars, 0, nindexedinstvars); |
357 | 2250 |
# else |
13419 | 2251 |
cp = (char *)__InstPtr(newobj)->i_instvars; |
14688 | 2252 |
while (nindexedinstvars >= sizeof(INT)) { |
2253 |
*(INT *)cp = (INT)0; |
|
2254 |
cp += sizeof(INT); |
|
2255 |
nindexedinstvars -= sizeof(INT); |
|
13419 | 2256 |
} |
2257 |
while (nindexedinstvars--) |
|
2258 |
*cp++ = '\0'; |
|
357 | 2259 |
# endif |
92 | 2260 |
#endif |
13419 | 2261 |
RETURN ( newobj ); |
2262 |
} |
|
2263 |
} else { |
|
2264 |
instsize += __OBJS2BYTES__(nInstVars); |
|
2265 |
} |
|
2266 |
__PROTECT_CONTEXT__ |
|
2267 |
__qNew(newobj, instsize); /* OBJECT ALLOCATION */ |
|
2268 |
__UNPROTECT_CONTEXT__ |
|
2269 |
if (newobj == nil) { |
|
2270 |
break; |
|
2271 |
} |
|
2272 |
__InstPtr(newobj)->o_class = self; |
|
2273 |
__qSTORE(newobj, self); |
|
369 | 2274 |
|
788
e80f1c42b87b
dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
2275 |
#if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4) |
13419 | 2276 |
nInstVars = (instsize-OHDR_SIZE) >> 2; |
2277 |
if (instsize & 3) nInstVars++; |
|
2278 |
memset4(__InstPtr(newobj)->i_instvars, 0, nInstVars); |
|
357 | 2279 |
#else |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2280 |
# if defined(FAST_ARRAY_MEMSET) |
13419 | 2281 |
/* |
2282 |
* knowing that nil is 0 |
|
2283 |
*/ |
|
2284 |
memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE); |
|
357 | 2285 |
# else |
13419 | 2286 |
op = __InstPtr(newobj)->i_instvars; |
2287 |
while (nInstVars--) |
|
2288 |
*op++ = nil; |
|
2289 |
cp = (char *)op; |
|
14688 | 2290 |
while (nindexedinstvars >= sizeof(INT)) { |
2291 |
*(INT *)cp = 0; |
|
2292 |
cp += sizeof(INT); |
|
2293 |
nindexedinstvars -= sizeof(INT); |
|
13419 | 2294 |
} |
2295 |
while (nindexedinstvars--) |
|
2296 |
*cp++ = '\0'; |
|
357 | 2297 |
# endif |
1 | 2298 |
#endif |
13419 | 2299 |
RETURN ( newobj ); |
2300 |
break; |
|
2301 |
||
2302 |
case WORDARRAY: |
|
2303 |
case SWORDARRAY: |
|
2304 |
instsize = OHDR_SIZE + |
|
2305 |
__OBJS2BYTES__(nInstVars) + |
|
2306 |
nindexedinstvars * 2; |
|
2307 |
__PROTECT_CONTEXT__ |
|
2308 |
__qNew(newobj, instsize); /* OBJECT ALLOCATION */ |
|
2309 |
__UNPROTECT_CONTEXT__ |
|
2310 |
if (newobj == nil) { |
|
2311 |
break; |
|
2312 |
} |
|
2313 |
__InstPtr(newobj)->o_class = self; |
|
2314 |
__qSTORE(newobj, self); |
|
369 | 2315 |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2316 |
#if defined(FAST_ARRAY_MEMSET) |
13419 | 2317 |
/* |
2318 |
* knowing that nil is 0 |
|
2319 |
*/ |
|
2320 |
memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE); |
|
1 | 2321 |
#else |
13419 | 2322 |
op = __InstPtr(newobj)->i_instvars; |
2323 |
while (nInstVars--) |
|
2324 |
*op++ = nil; |
|
2325 |
sp = (short *)op; |
|
2326 |
while (nindexedinstvars--) |
|
2327 |
*sp++ = 0; |
|
1 | 2328 |
#endif |
13419 | 2329 |
RETURN ( newobj ); |
2330 |
break; |
|
2331 |
||
2332 |
case LONGARRAY: |
|
2333 |
case SLONGARRAY: |
|
2334 |
instsize = OHDR_SIZE + |
|
2335 |
__OBJS2BYTES__(nInstVars) + |
|
2336 |
nindexedinstvars * 4; |
|
2337 |
__PROTECT_CONTEXT__ |
|
2338 |
__qAlignedNew(newobj, instsize); /* OBJECT ALLOCATION */ |
|
2339 |
__UNPROTECT_CONTEXT__ |
|
2340 |
if (newobj == nil) { |
|
2341 |
break; |
|
2342 |
} |
|
2343 |
__InstPtr(newobj)->o_class = self; |
|
2344 |
__qSTORE(newobj, self); |
|
369 | 2345 |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2346 |
#if defined(memset4) |
13419 | 2347 |
/* |
2348 |
* knowing that nil is 0 |
|
2349 |
*/ |
|
2350 |
{ |
|
2351 |
int n4 = nInstVars + nindexedinstvars; |
|
2352 |
||
2353 |
memset4(__InstPtr(newobj)->i_instvars, 0, n4); |
|
2354 |
} |
|
1 | 2355 |
#else |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2356 |
# if defined(FAST_ARRAY_MEMSET) |
13419 | 2357 |
/* |
2358 |
* knowing that nil is 0 |
|
2359 |
*/ |
|
2360 |
memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE); |
|
1 | 2361 |
# else |
13419 | 2362 |
op = __InstPtr(newobj)->i_instvars; |
2363 |
while (nInstVars--) |
|
2364 |
*op++ = nil; |
|
2365 |
lp = (long *)op; |
|
2366 |
while (nindexedinstvars--) |
|
2367 |
*lp++ = 0; |
|
1 | 2368 |
# endif |
2369 |
#endif |
|
13419 | 2370 |
RETURN ( newobj ); |
2371 |
break; |
|
2372 |
||
2373 |
case LONGLONGARRAY: |
|
2374 |
case SLONGLONGARRAY: |
|
2375 |
instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars); |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2376 |
|
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2377 |
#ifdef __NEED_LONGLONG_ALIGN |
13419 | 2378 |
instsize = ((instsize-1) + __LONGLONG_ALIGN) & ~(__LONGLONG_ALIGN-1); |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2379 |
#endif |
13419 | 2380 |
instsize += nindexedinstvars * 8; |
2381 |
||
2382 |
__PROTECT_CONTEXT__ |
|
2383 |
__qAlignedNew(newobj, instsize); /* OBJECT ALLOCATION */ |
|
2384 |
__UNPROTECT_CONTEXT__ |
|
2385 |
if (newobj == nil) { |
|
2386 |
break; |
|
2387 |
} |
|
2388 |
__InstPtr(newobj)->o_class = self; |
|
2389 |
__qSTORE(newobj, self); |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2390 |
|
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2391 |
#if defined(memset4) |
13419 | 2392 |
{ |
2393 |
int n4 = (instsize-OHDR_SIZE) / 4; |
|
2394 |
||
2395 |
memset4(__InstPtr(newobj)->i_instvars, 0, n4); |
|
2396 |
} |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2397 |
#else |
13419 | 2398 |
memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE); |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2399 |
#endif |
13419 | 2400 |
RETURN ( newobj ); |
2401 |
break; |
|
2402 |
||
2403 |
case FLOATARRAY: |
|
2404 |
instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars); |
|
2405 |
instsize += nindexedinstvars * sizeof(float); |
|
2406 |
||
2407 |
__PROTECT_CONTEXT__ |
|
2408 |
__qNew(newobj, instsize); /* OBJECT ALLOCATION */ |
|
2409 |
__UNPROTECT_CONTEXT__ |
|
2410 |
if (newobj == nil) { |
|
2411 |
break; |
|
2412 |
} |
|
2413 |
__InstPtr(newobj)->o_class = self; |
|
2414 |
__qSTORE(newobj, self); |
|
2415 |
||
2416 |
op = __InstPtr(newobj)->i_instvars; |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2417 |
#if defined(__FLOAT0_IS_INT0) /* knowin that float 0.0 is all-zeros */ |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2418 |
# if defined(memset4) |
13419 | 2419 |
{ |
2420 |
int n4 = (instsize-OHDR_SIZE) / 4; |
|
2421 |
||
2422 |
memset4(__InstPtr(newobj)->i_instvars, 0, n4); |
|
2423 |
} |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2424 |
# else |
13419 | 2425 |
memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE); |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2426 |
# endif |
3870
ea7a0f0db4be
use memset to initialize float- and doubleArrays, if float0/double0 is int0
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
2427 |
#else |
13419 | 2428 |
while (nInstVars--) |
2429 |
*op++ = nil; |
|
2430 |
fp = (float *)op; |
|
2431 |
while (nindexedinstvars--) |
|
2432 |
*fp++ = 0.0; |
|
3870
ea7a0f0db4be
use memset to initialize float- and doubleArrays, if float0/double0 is int0
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
2433 |
#endif |
13419 | 2434 |
RETURN ( newobj ); |
2435 |
break; |
|
2436 |
||
2437 |
case DOUBLEARRAY: |
|
2438 |
instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars); |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2439 |
#ifdef __NEED_DOUBLE_ALIGN |
13419 | 2440 |
instsize = ((instsize-1) + __DOUBLE_ALIGN) & ~(__DOUBLE_ALIGN-1); |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2441 |
#endif |
13419 | 2442 |
instsize += nindexedinstvars * sizeof(double); |
2443 |
||
2444 |
__PROTECT_CONTEXT__ |
|
2445 |
__qAlignedNew(newobj, instsize); /* OBJECT ALLOCATION */ |
|
2446 |
__UNPROTECT_CONTEXT__ |
|
2447 |
if (newobj == nil) { |
|
2448 |
break; |
|
2449 |
} |
|
2450 |
__InstPtr(newobj)->o_class = self; |
|
2451 |
__qSTORE(newobj, self); |
|
369 | 2452 |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2453 |
#if defined(__DOUBLE0_IS_INT0) /* knowin that double 0.0 is all-zeros */ |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2454 |
# ifdef memset4 |
13419 | 2455 |
{ |
2456 |
int n4 = (instsize-OHDR_SIZE) / 4; |
|
2457 |
||
2458 |
memset4(__InstPtr(newobj)->i_instvars, 0, n4); |
|
2459 |
} |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2460 |
# else |
13419 | 2461 |
memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE); |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2462 |
# endif |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2463 |
#else |
13419 | 2464 |
op = __InstPtr(newobj)->i_instvars; |
2465 |
while (nInstVars--) |
|
2466 |
*op++ = nil; |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2467 |
|
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2468 |
# ifdef __NEED_DOUBLE_ALIGN |
13419 | 2469 |
/* |
2470 |
* care for double alignment |
|
2471 |
* add filler. |
|
2472 |
*/ |
|
2473 |
if ((INT)op & (__DOUBLE_ALIGN-1)) { |
|
2474 |
*op++ = nil; |
|
2475 |
} |
|
3870
ea7a0f0db4be
use memset to initialize float- and doubleArrays, if float0/double0 is int0
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
2476 |
# endif |
13419 | 2477 |
dp = (double *)op; |
2478 |
while (nindexedinstvars--) |
|
2479 |
*dp++ = 0.0; |
|
3870
ea7a0f0db4be
use memset to initialize float- and doubleArrays, if float0/double0 is int0
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
2480 |
#endif |
13419 | 2481 |
RETURN ( newobj ); |
2482 |
break; |
|
2483 |
||
2484 |
case WKPOINTERARRAY: |
|
2485 |
case POINTERARRAY: |
|
2486 |
nInstVars += nindexedinstvars; |
|
2487 |
instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars); |
|
2488 |
__PROTECT_CONTEXT__ |
|
2489 |
__qAlignedNew(newobj, instsize); /* OBJECT ALLOCATION */ |
|
2490 |
__UNPROTECT_CONTEXT__ |
|
2491 |
if (newobj == nil) { |
|
2492 |
break; |
|
2493 |
} |
|
2494 |
__InstPtr(newobj)->o_class = self; |
|
2495 |
__qSTORE(newobj, self); |
|
369 | 2496 |
|
788
e80f1c42b87b
dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
2497 |
#if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4) |
13419 | 2498 |
memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars); |
1 | 2499 |
#else |
13419 | 2500 |
/* |
2501 |
* knowing that nil is 0 |
|
2502 |
*/ |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2503 |
# ifdef sparc |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2504 |
# define FAST_ARRAY_MEMSET_DOUBLES_UNROLLED |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2505 |
# endif |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2506 |
|
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2507 |
# if defined(FAST_ARRAY_MEMSET_DOUBLES_UNROLLED) |
13419 | 2508 |
op = __InstPtr(newobj)->i_instvars; |
2509 |
if (nInstVars > 8) { |
|
2510 |
*op++ = nil; /* for alignment */ |
|
2511 |
nInstVars--; |
|
2512 |
while (nInstVars >= 8) { |
|
2513 |
*(double *)op = 0.0; |
|
2514 |
((double *)op)[1] = 0.0; |
|
2515 |
((double *)op)[2] = 0.0; |
|
2516 |
((double *)op)[3] = 0.0; |
|
2517 |
op += 8; |
|
2518 |
nInstVars -= 8; |
|
2519 |
} |
|
2520 |
} |
|
2521 |
while (nInstVars) { |
|
2522 |
*op++ = 0; |
|
2523 |
nInstVars--; |
|
2524 |
} |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2525 |
# else |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2526 |
# if defined(FAST_ARRAY_MEMSET_LONGLONG_UNROLLED) |
13419 | 2527 |
op = __InstPtr(newobj)->i_instvars; |
2528 |
if (nInstVars > 8) { |
|
2529 |
*op++ = nil; /* for alignment */ |
|
2530 |
nInstVars--; |
|
2531 |
while (nInstVars >= 8) { |
|
2532 |
*(long long *)op = 0; |
|
2533 |
((long long *)op)[1] = 0; |
|
2534 |
((long long *)op)[2] = 0; |
|
2535 |
((long long *)op)[3] = 0; |
|
2536 |
op += 8; |
|
2537 |
nInstVars -= 8; |
|
2538 |
} |
|
2539 |
} |
|
2540 |
while (nInstVars) { |
|
2541 |
*op++ = 0; |
|
2542 |
nInstVars--; |
|
2543 |
} |
|
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2544 |
# else |
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2545 |
# if defined(FAST_ARRAY_MEMSET) |
13419 | 2546 |
memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE); |
91 | 2547 |
# else |
13419 | 2548 |
op = __InstPtr(newobj)->i_instvars; |
14688 | 2549 |
while (nInstVars >= 8) { |
2550 |
nInstVars -= 8; |
|
2551 |
op[0] = nil; op[1] = nil; |
|
2552 |
op[2] = nil; op[3] = nil; |
|
2553 |
op[4] = nil; op[5] = nil; |
|
2554 |
op[6] = nil; op[7] = nil; |
|
2555 |
op += 8; |
|
2556 |
} |
|
13419 | 2557 |
while (nInstVars--) |
2558 |
*op++ = nil; |
|
82 | 2559 |
# endif |
2560 |
# endif |
|
1 | 2561 |
# endif |
2562 |
#endif |
|
13419 | 2563 |
RETURN ( newobj ); |
2564 |
break; |
|
2565 |
||
2566 |
default: |
|
2567 |
/* |
|
2568 |
* new:n for non-variable classes only allowed if |
|
2569 |
* n == 0 |
|
2570 |
*/ |
|
2571 |
if (nindexedinstvars == 0) { |
|
2572 |
instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars); |
|
2573 |
__PROTECT_CONTEXT__ |
|
2574 |
__qAlignedNew(newobj, instsize); /* OBJECT ALLOCATION */ |
|
2575 |
__UNPROTECT_CONTEXT__ |
|
2576 |
if (newobj == nil) { |
|
2577 |
break; |
|
2578 |
} |
|
2579 |
__InstPtr(newobj)->o_class = self; |
|
2580 |
__qSTORE(newobj, self); |
|
2581 |
||
2582 |
if (nInstVars) { |
|
788
e80f1c42b87b
dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
2583 |
#if defined(memset4) && defined(FAST_OBJECT_MEMSET4) || defined(FAST_MEMSET4) |
13419 | 2584 |
memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars); |
1 | 2585 |
#else |
3920
0c1b9b2fa23b
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3882
diff
changeset
|
2586 |
# if defined(FAST_MEMSET) |
13419 | 2587 |
/* |
2588 |
* knowing that nil is 0 |
|
2589 |
*/ |
|
2590 |
memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE); |
|
1 | 2591 |
# else |
13419 | 2592 |
op = __InstPtr(newobj)->i_instvars; |
2593 |
do { |
|
2594 |
*op++ = nil; |
|
2595 |
} while (--nInstVars); |
|
1 | 2596 |
# endif |
2597 |
#endif |
|
13419 | 2598 |
} |
2599 |
RETURN ( newobj ); |
|
2600 |
} |
|
2601 |
break; |
|
2602 |
} |
|
2603 |
} |
|
1 | 2604 |
} |
68 | 2605 |
%}. |
2606 |
" |
|
2607 |
arrive here if something went wrong ... |
|
2608 |
figure out what it was |
|
2609 |
" |
|
11 | 2610 |
|
1 | 2611 |
(anInteger isMemberOf:SmallInteger) ifFalse:[ |
13419 | 2612 |
" |
2613 |
the argument is either not an integer, |
|
2614 |
or a LargeInteger (which means that its definitely too big) |
|
2615 |
" |
|
2616 |
self error:'argument to new: must be Integer' mayProceed:true. |
|
2617 |
^ nil |
|
68 | 2618 |
]. |
2619 |
(anInteger < 0) ifTrue:[ |
|
13419 | 2620 |
" |
2621 |
the argument is negative, |
|
2622 |
" |
|
2623 |
self error:'bad (negative) argument to new:'. |
|
2624 |
^ nil |
|
68 | 2625 |
]. |
2626 |
self isVariable ifFalse:[ |
|
13419 | 2627 |
" |
2628 |
this class does not have any indexed instance variables |
|
2629 |
" |
|
2630 |
self error:'class has no indexed instvars - cannot create with new:'. |
|
2631 |
^ nil |
|
68 | 2632 |
]. |
2633 |
" |
|
2634 |
memory allocation failed. |
|
2635 |
When we arrive here, there was no memory, even after |
|
12094 | 2636 |
a garbage collect. |
2637 |
This means, that the VM wanted to get some more memory from the |
|
165 | 2638 |
Operatingsystem, which was not kind enough to give it. |
2639 |
Bad luck - you should increase the swap space on your machine. |
|
68 | 2640 |
" |
127 | 2641 |
^ ObjectMemory allocationFailureSignal raise. |
9194 | 2642 |
! |
2643 |
||
2644 |
decodeFromLiteralArray:anArray |
|
2645 |
"create & return a new instance from information encoded in anArray." |
|
2646 |
||
2647 |
^ self new fromLiteralArrayEncoding:anArray. |
|
2648 |
||
2649 |
" |
|
2650 |
Rectangle |
|
13419 | 2651 |
decodeFromLiteralArray:#(Rectangle 10 10 100 100) |
9194 | 2652 |
" |
2653 |
||
2654 |
"Modified: / 28.1.1998 / 17:40:30 / cg" |
|
2370
694ebbc71f04
added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
2655 |
! |
694ebbc71f04
added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
2656 |
|
9194 | 2657 |
new |
2658 |
"return an instance of myself without indexed variables" |
|
2659 |
||
2660 |
^ self basicNew |
|
2661 |
! |
|
2662 |
||
2663 |
new:anInteger |
|
2664 |
"return an instance of myself with anInteger indexed variables" |
|
2665 |
||
2666 |
^ self basicNew:anInteger |
|
2667 |
! |
|
2668 |
||
2669 |
niceBasicNew:anInteger |
|
620 | 2670 |
"same as basicNew:anInteger, but tries to avoid long pauses |
2671 |
due to garbage collection. This method checks to see if |
|
2672 |
allocation is possible without a pause, and does a background |
|
2673 |
incremental garbage collect first if there is not enough memory |
|
12094 | 2674 |
available at the moment for fast allocation. |
2675 |
This is useful in low-priority background processes which like to |
|
620 | 2676 |
avoid disturbing any higher priority foreground process while allocating |
2677 |
big amounts of memory. Of course, using this method only makes |
|
2678 |
sense for big or huge objects (say > 200k). |
|
2679 |
||
12094 | 2680 |
EXPERIMENTAL: this is a non-standard interface and should only |
620 | 2681 |
be used for special applications. There is no guarantee, that this |
2682 |
method will be available in future ST/X releases." |
|
2683 |
||
2684 |
|size| |
|
2685 |
||
2686 |
size := self sizeOfInst:anInteger. |
|
2687 |
(ObjectMemory checkForFastNew:size) ifFalse:[ |
|
13419 | 2688 |
" |
2689 |
incrementally collect garbage |
|
2690 |
" |
|
2691 |
ObjectMemory incrementalGC. |
|
620 | 2692 |
]. |
2693 |
^ self basicNew:anInteger |
|
9194 | 2694 |
! |
2695 |
||
2696 |
readFrom:aStream |
|
12094 | 2697 |
"read an objects printed representation from the argument, aStream |
2698 |
and return it. |
|
154 | 2699 |
The read object must be a kind of myself if its not, an error is raised. |
11 | 2700 |
This is the reverse operation to 'storeOn:'. |
43 | 2701 |
|
12094 | 2702 |
WARNING: storeOn: does not handle circular references and multiple |
14972 | 2703 |
references to the same object. |
2704 |
Use #storeBinary:/readBinaryFrom: for this." |
|
12094 | 2705 |
|
2706 |
^ self |
|
14972 | 2707 |
readFrom:aStream |
2708 |
onError:[ self conversionErrorSignal |
|
2709 |
raiseWith:aStream errorString:'conversion error for: ' , self name ] |
|
11 | 2710 |
|
91 | 2711 |
" |
2712 |
|s| |
|
11 | 2713 |
s := WriteStream on:String new. |
2714 |
#(1 2 3 4) storeOn:s. |
|
12094 | 2715 |
Object readFrom:(ReadStream on:s contents) |
11 | 2716 |
" |
9194 | 2717 |
! |
2718 |
||
2719 |
readFrom:aStream onError:exceptionBlock |
|
12094 | 2720 |
"read an objects printed representation from the argument, aStream |
198 | 2721 |
and return it (i.e. the stream should contain some representation of |
12094 | 2722 |
the object which was created using #storeOn:). |
198 | 2723 |
The read object must be a kind of myself if its not, the value of |
2724 |
exceptionBlock is returned. |
|
2725 |
To get any object, use 'Object readFrom:...', |
|
2726 |
To get any number, use 'Number readFrom:...' and so on. |
|
2727 |
This is the reverse operation to 'storeOn:'. |
|
2728 |
||
12094 | 2729 |
WARNING: storeOn: does not handle circular references and multiple |
13419 | 2730 |
references to the same object. |
2731 |
Use #storeBinary:/readBinaryFrom: for this." |
|
198 | 2732 |
|
6627
685ab6f994f0
Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents:
6596
diff
changeset
|
2733 |
^ [ |
13419 | 2734 |
|newObject| |
2735 |
newObject := self evaluatorClass evaluate:aStream ifFail:exceptionBlock. |
|
2736 |
(newObject isKindOf:self) ifTrue:[newObject] ifFalse:[exceptionBlock value]. |
|
6627
685ab6f994f0
Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents:
6596
diff
changeset
|
2737 |
] on:Error do:exceptionBlock. |
198 | 2738 |
|
2739 |
" |
|
2740 |
|s| |
|
2741 |
s := WriteStream on:String new. |
|
2742 |
#(1 2 3 4) storeOn:s. |
|
1422 | 2743 |
Transcript showCR:( |
13419 | 2744 |
Array readFrom:(ReadStream on:s contents) onError:'not an Array' |
293 | 2745 |
) |
198 | 2746 |
" |
2747 |
" |
|
2748 |
|s| |
|
2749 |
s := WriteStream on:String new. |
|
2750 |
#[1 2 3 4] storeOn:s. |
|
1422 | 2751 |
Transcript showCR:( |
13419 | 2752 |
Array readFrom:(ReadStream on:s contents) onError:'not an Array' |
345 | 2753 |
) |
198 | 2754 |
" |
5842
720736f72cb4
exceptionBlock handling in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents:
5753
diff
changeset
|
2755 |
" |
6627
685ab6f994f0
Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents:
6596
diff
changeset
|
2756 |
Object readFrom:'illegal' onError:['bla'] |
685ab6f994f0
Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents:
6596
diff
changeset
|
2757 |
String readFrom:'illegal' onError:'bla' |
5842
720736f72cb4
exceptionBlock handling in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents:
5753
diff
changeset
|
2758 |
" |
9194 | 2759 |
! |
2760 |
||
2761 |
readFromString:aString |
|
275 | 2762 |
"create an object from its printed representation. |
2763 |
For most classes, the string is expected to be in a format created by |
|
2764 |
storeOn: or storeString; however, some (Time, Date) expect a user |
|
2765 |
readable string here. |
|
2766 |
See comments in Behavior>>readFromString:onError:, |
|
2767 |
Behavior>>readFrom: and Behavior>>readFrom:onError:" |
|
11 | 2768 |
|
12094 | 2769 |
^ self |
13419 | 2770 |
readFromString:aString |
2771 |
onError:[ self conversionErrorSignal |
|
2772 |
raiseErrorString:'expected: ' , self name ] |
|
91 | 2773 |
|
2774 |
" |
|
12094 | 2775 |
Integer readFromString:'12345678901234567890' |
2776 |
Point readFromString:'1@2' |
|
2777 |
Point readFromString:'1' |
|
91 | 2778 |
" |
198 | 2779 |
! |
2780 |
||
2781 |
readFromString:aString onError:exceptionBlock |
|
275 | 2782 |
"create an object from its printed representation. |
2783 |
Here, the string is expected to be in a format created by |
|
12094 | 2784 |
storeOn: or storeString; |
9196
a6d45629bb3b
readFromString allows for whiteSpace after reading
Claus Gittinger <cg@exept.de>
parents:
9194
diff
changeset
|
2785 |
However, some classes (Time, Date) may redefine it to expect a user readable string here. |
198 | 2786 |
See comments in Behavior>>readFrom: and Behavior>>readFrom:onError:" |
2787 |
||
8531
2bbe01cfb56f
differenciate between readFrom: (which allows more text after read part)
Claus Gittinger <cg@exept.de>
parents:
8529
diff
changeset
|
2788 |
|str val| |
2bbe01cfb56f
differenciate between readFrom: (which allows more text after read part)
Claus Gittinger <cg@exept.de>
parents:
8529
diff
changeset
|
2789 |
|
2bbe01cfb56f
differenciate between readFrom: (which allows more text after read part)
Claus Gittinger <cg@exept.de>
parents:
8529
diff
changeset
|
2790 |
str := ReadStream on:aString. |
2bbe01cfb56f
differenciate between readFrom: (which allows more text after read part)
Claus Gittinger <cg@exept.de>
parents:
8529
diff
changeset
|
2791 |
val := self readFrom:str onError:[^ exceptionBlock value]. |
12094 | 2792 |
str atEnd ifFalse:[ |
13419 | 2793 |
str skipSeparators. |
2794 |
str atEnd ifFalse:[ |
|
2795 |
^ exceptionBlock value |
|
2796 |
] |
|
9196
a6d45629bb3b
readFromString allows for whiteSpace after reading
Claus Gittinger <cg@exept.de>
parents:
9194
diff
changeset
|
2797 |
]. |
8531
2bbe01cfb56f
differenciate between readFrom: (which allows more text after read part)
Claus Gittinger <cg@exept.de>
parents:
8529
diff
changeset
|
2798 |
^ val |
198 | 2799 |
|
2800 |
" |
|
12094 | 2801 |
Integer readFromString:'12345678901234567890' |
2802 |
Integer readFromString:'abc' |
|
275 | 2803 |
Integer readFromString:'abc' onError:0 |
12094 | 2804 |
Point readFromString:'1@2' |
2805 |
Point readFromString:'0' |
|
2806 |
Point readFromString:'0' onError:[0@0] |
|
198 | 2807 |
" |
9194 | 2808 |
! |
2809 |
||
2810 |
uninitializedNew |
|
2811 |
"create an instance of myself with uninitialized contents. |
|
2812 |
For all classes except ByteArray, this is the same as #basicNew." |
|
2813 |
||
2814 |
^ self basicNew |
|
2815 |
! |
|
2816 |
||
2817 |
uninitializedNew:anInteger |
|
2818 |
"create an instance of myself with uninitialized contents. |
|
2819 |
For all classes except ByteArray, this is the same as #basicNew:." |
|
2820 |
||
2821 |
^ self basicNew:anInteger |
|
2822 |
! ! |
|
2823 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
2824 |
|
9194 | 2825 |
!Behavior methodsFor:'misc'! |
3619 | 2826 |
|
4928 | 2827 |
browse |
5727 | 2828 |
"open a browser showing the receiver" |
2829 |
||
12094 | 2830 |
self browserClass openInClass:self |
4928 | 2831 |
|
2832 |
" |
|
5546 | 2833 |
Array browserClass |
4928 | 2834 |
Array browse |
2835 |
" |
|
2836 |
! |
|
2837 |
||
8725 | 2838 |
classOperationsMenu |
13260 | 2839 |
"a chance to return additional menu items for the browser's class-menu" |
8725 | 2840 |
|
2841 |
^ nil |
|
13260 | 2842 |
|
2843 |
"Modified: / 31-01-2011 / 11:05:49 / cg" |
|
8725 | 2844 |
! |
2845 |
||
12869 | 2846 |
flushSubclasses |
2847 |
"I dont keep my subclasses - but if anyone inherits from me, |
|
2848 |
it better knows how to ignore this" |
|
2849 |
! |
|
2850 |
||
10667
8d1076445237
icons in ToolbarIconLibrary
Claus Gittinger <cg@exept.de>
parents:
10605
diff
changeset
|
2851 |
iconInBrowserSymbol |
8d1076445237
icons in ToolbarIconLibrary
Claus Gittinger <cg@exept.de>
parents:
10605
diff
changeset
|
2852 |
"can be redefined for a private icon in the browser (for me and my subclasses). |
8d1076445237
icons in ToolbarIconLibrary
Claus Gittinger <cg@exept.de>
parents:
10605
diff
changeset
|
2853 |
The returned symbol must be a selector of the ToolbarIconLibrary." |
8d1076445237
icons in ToolbarIconLibrary
Claus Gittinger <cg@exept.de>
parents:
10605
diff
changeset
|
2854 |
|
14504 | 2855 |
<resource: #programImage> |
2856 |
||
2857 |
self isLoaded ifFalse:[ |
|
2858 |
^ #autoloadedClassBrowserIcon |
|
12094 | 2859 |
]. |
14504 | 2860 |
(self isBrowserStartable) ifTrue:[ |
2861 |
self isVisualStartable ifTrue:[ |
|
2862 |
^ #visualStartableClassBrowserIcon |
|
2863 |
]. |
|
2864 |
^ #startableClassBrowserIcon |
|
12094 | 2865 |
]. |
2866 |
||
14504 | 2867 |
"/ give ruby and other special metaclasses a chance to provide their own icon... |
12094 | 2868 |
^ self class iconInBrowserSymbol |
10667
8d1076445237
icons in ToolbarIconLibrary
Claus Gittinger <cg@exept.de>
parents:
10605
diff
changeset
|
2869 |
|
8d1076445237
icons in ToolbarIconLibrary
Claus Gittinger <cg@exept.de>
parents:
10605
diff
changeset
|
2870 |
"Created: / 20-07-2007 / 08:52:17 / cg" |
8d1076445237
icons in ToolbarIconLibrary
Claus Gittinger <cg@exept.de>
parents:
10605
diff
changeset
|
2871 |
! |
8d1076445237
icons in ToolbarIconLibrary
Claus Gittinger <cg@exept.de>
parents:
10605
diff
changeset
|
2872 |
|
3619 | 2873 |
sourceCodeTemplate |
2874 |
^ 'messageSelector and arguments |
|
2875 |
"method comment - purpose of message" |
|
2876 |
||
2877 |
|temporaries| |
|
2878 |
||
2879 |
statements |
|
2880 |
||
2881 |
" |
|
2882 |
example uses |
|
2883 |
" |
|
2884 |
' |
|
2885 |
||
2886 |
"Created: / 19.6.1998 / 02:14:02 / cg" |
|
2887 |
! ! |
|
2888 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
2889 |
|
9194 | 2890 |
!Behavior methodsFor:'printing & storing'! |
2891 |
||
14288
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2892 |
displayOn:aGCOrStream |
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2893 |
"return a string to display the receiver - include the |
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2894 |
count for your convenience. |
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2895 |
|
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2896 |
although behaviors have no name, we return something |
10085 | 2897 |
useful here - there are many places (inspectors) where |
2898 |
a classes name is asked for. |
|
2899 |
Implementing this message here allows instances of anonymous classes |
|
2900 |
to show a reasonable name." |
|
2901 |
||
14288
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2902 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2903 |
"/ ST/X (and some old ST80's) mean: draw-yourself on a GC. |
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2904 |
(aGCOrStream isStream) ifFalse:[ |
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2905 |
^ super displayOn:aGCOrStream |
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2906 |
]. |
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2907 |
|
d30ff513d793
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
14259
diff
changeset
|
2908 |
aGCOrStream nextPutAll:self name |
10085 | 2909 |
! |
2910 |
||
9194 | 2911 |
printOn:aStream |
2912 |
aStream nextPutAll:(self name). |
|
6590 | 2913 |
! ! |
6589 | 2914 |
|
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
2915 |
|
9194 | 2916 |
!Behavior methodsFor:'private-accessing'! |
2917 |
||
2918 |
flags:aNumber |
|
2919 |
"set the flags. |
|
2920 |
this method is for special uses only - there will be no recompilation |
|
12094 | 2921 |
and no change record written here; |
9194 | 2922 |
Do NOT use it." |
2923 |
||
2924 |
flags := aNumber |
|
2925 |
! |
|
620 | 2926 |
|
2927 |
instSize:aNumber |
|
2928 |
"set the instance size. |
|
2929 |
this method is for special uses only - there will be no recompilation |
|
12094 | 2930 |
and no change record written here; |
620 | 2931 |
Do NOT use it." |
2932 |
||
2933 |
instSize := aNumber |
|
2934 |
! |
|
2935 |
||
9469
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
2936 |
primAddSelector:aSelector withMethod:newMethod |
620 | 2937 |
"add the method given by 2nd argument under the selector given by |
12094 | 2938 |
the 1st argument to the methodDictionary. |
620 | 2939 |
Does NOT flush any caches, does NOT write a change record. |
2940 |
||
2941 |
Do not use this in normal situations, strange behavior will be |
|
2942 |
the consequence. |
|
12094 | 2943 |
I.e. executing obsolete methods, since the old method will still |
620 | 2944 |
be executed out of the caches." |
2945 |
||
9469
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
2946 |
|dict oldMethod| |
620 | 2947 |
|
2948 |
newMethod isNil ifTrue:[ |
|
13419 | 2949 |
self error:'invalid method'. |
620 | 2950 |
]. |
12094 | 2951 |
(Smalltalk |
13419 | 2952 |
changeRequest:#methodInClass |
2953 |
with:(Array with:self with:aSelector with:oldMethod)) ifFalse:[ |
|
2954 |
^ false |
|
11578 | 2955 |
]. |
10693
d397d49e1134
changed #primAddSelector:withMethod:
Claus Gittinger <cg@exept.de>
parents:
10669
diff
changeset
|
2956 |
"/ oldMethod := self compiledMethodAt:aSelector. |
620 | 2957 |
|
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
2958 |
dict := self methodDictionary. |
10693
d397d49e1134
changed #primAddSelector:withMethod:
Claus Gittinger <cg@exept.de>
parents:
10669
diff
changeset
|
2959 |
"/ oldMethod := dict at:aSelector ifAbsent:nil. |
9469
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
2960 |
|
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
2961 |
self setMethodDictionary:(dict at:aSelector putOrAppend:newMethod). |
7123
2af84f5b1447
pre-set the methods mclass cache when adding a method
Claus Gittinger <cg@exept.de>
parents:
6968
diff
changeset
|
2962 |
newMethod mclass:self. |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
2963 |
|
9469
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
2964 |
ObjectMemory flushCachesForSelector:aSelector. |
11578 | 2965 |
^ true |
9469
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
2966 |
|
9445 | 2967 |
"Modified: / 07-06-1996 / 14:48:45 / stefan" |
10693
d397d49e1134
changed #primAddSelector:withMethod:
Claus Gittinger <cg@exept.de>
parents:
10669
diff
changeset
|
2968 |
"Modified: / 31-08-2007 / 16:53:20 / cg" |
9194 | 2969 |
! |
2970 |
||
2971 |
setMethodDictionary:dict |
|
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
2972 |
"set the receivers method dictionary. |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
2973 |
Convert dict to a MethodDictionary if necessary. |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
2974 |
Do not flush inline caches, therefore old cached methods may be executed |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
2975 |
after this call" |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
2976 |
|
2228 | 2977 |
"/ since the only thing the VM is prepared to deal with are |
2978 |
"/ proper methodDictionaries (it cannot do another message send, to |
|
2979 |
"/ find any methods ...), we convert it here if required. |
|
2980 |
"/ No other classes instances are allowed. |
|
2981 |
||
1494
dab70fc90ebc
Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2982 |
dict class ~~ MethodDictionary ifTrue:[ |
13419 | 2983 |
methodDictionary := MethodDictionary withAll:dict. |
2984 |
methodDictionary isNil ifTrue:[ |
|
2985 |
||
2986 |
"/ refuse to do this |
|
2987 |
"/ (can only happen in case of memory allocation trouble, |
|
2988 |
"/ where the allocation failed and some exception handler returned |
|
2989 |
"/ nil ...) |
|
2990 |
||
2991 |
self error:'cannot set methodDictionary to nil' mayProceed:true. |
|
2992 |
^ self. |
|
2993 |
] |
|
1494
dab70fc90ebc
Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2994 |
] ifFalse:[ |
13419 | 2995 |
methodDictionary := dict. |
620 | 2996 |
]. |
1494
dab70fc90ebc
Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2997 |
^ self. |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
2998 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
2999 |
"Created: 5.6.1996 / 11:29:36 / stefan" |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
3000 |
"Modified: 12.6.1996 / 13:58:55 / stefan" |
2228 | 3001 |
"Modified: 22.1.1997 / 21:10:48 / cg" |
9194 | 3002 |
! |
3003 |
||
3004 |
setSuperclass:aClass |
|
3005 |
"set the superclass of the receiver. |
|
3006 |
this method is for special uses only - there will be no recompilation |
|
3007 |
and no change record written here. Also, if the receiver class has |
|
3008 |
already been in use, future operation of the system is not guaranteed to |
|
3009 |
be correct, since no caches are flushed. |
|
3010 |
Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)" |
|
3011 |
||
3012 |
superclass := aClass |
|
3013 |
||
3014 |
"Modified: 3.3.1997 / 13:27:00 / cg" |
|
3015 |
! |
|
620 | 3016 |
|
12094 | 3017 |
setSuperclass:aClass instSize:i |
3018 |
"set some inst vars. |
|
5906 | 3019 |
this method is for special uses only - there will be no recompilation |
12094 | 3020 |
and no change record is written here. Also, if the receiver class has |
5906 | 3021 |
already been in use, future operation of the system is not guaranteed to |
3022 |
be correct, since no caches are flushed. |
|
3023 |
Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)" |
|
3024 |
||
3025 |
self setSuperclass:aClass. |
|
3026 |
instSize := i. |
|
3027 |
! |
|
3028 |
||
9194 | 3029 |
setSuperclass:aClass methodDictionary:d instSize:i flags:f |
12094 | 3030 |
"set some inst vars. |
9194 | 3031 |
this method is for special uses only - there will be no recompilation |
12094 | 3032 |
and no change record is written here. Also, if the receiver class has |
9194 | 3033 |
already been in use, future operation of the system is not guaranteed to |
3034 |
be correct, since no caches are flushed. |
|
3035 |
Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)" |
|
3036 |
||
3037 |
self setSuperclass:aClass. |
|
3038 |
self setMethodDictionary:d. |
|
620 | 3039 |
instSize := i. |
3040 |
flags := f |
|
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
3041 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
3042 |
"Created: 7.6.1996 / 08:41:20 / stefan" |
2224 | 3043 |
"Modified: 22.1.1997 / 18:42:12 / cg" |
620 | 3044 |
! ! |
3045 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
3046 |
|
7260 | 3047 |
!Behavior methodsFor:'private-helpers'! |
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3048 |
|
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3049 |
addAllClassVarNamesTo:aCollection |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3050 |
"helper - add the name-strings of the class variables and of the class-vars |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3051 |
of all superclasses to the argument, aCollection. Return aCollection" |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3052 |
|
6395
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
3053 |
|classvars superclass| |
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
3054 |
|
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
3055 |
superclass := self superclass. |
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3056 |
(superclass notNil) ifTrue:[ |
13419 | 3057 |
superclass addAllClassVarNamesTo:aCollection |
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3058 |
]. |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3059 |
(classvars := self classVariableString) notNil ifTrue:[ |
13419 | 3060 |
aCollection addAll:(classvars asCollectionOfWords). |
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3061 |
]. |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3062 |
^ aCollection |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3063 |
|
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3064 |
"Created: 16.4.1996 / 18:00:38 / cg" |
9194 | 3065 |
! |
3066 |
||
3067 |
addAllInstVarNamesTo:aCollection |
|
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3068 |
"helper for allInstVarNames - add the name-strings of the instance variables |
12094 | 3069 |
and of the inst-vars of all superclasses to the argument, aCollection. |
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3070 |
Return aCollection." |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3071 |
|
6395
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
3072 |
|superclass| |
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
3073 |
|
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
3074 |
superclass := self superclass. |
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3075 |
(superclass notNil) ifTrue:[ |
13419 | 3076 |
superclass addAllInstVarNamesTo:aCollection |
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3077 |
]. |
5512 | 3078 |
aCollection addAll:self instVarNames. |
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3079 |
^ aCollection |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3080 |
|
5512 | 3081 |
" |
3082 |
SortedCollection allInstVarNames |
|
3083 |
SortedCollection instVarNames |
|
3084 |
" |
|
4371
dc83645cc903
support to recursively enumerate all private classes
Claus Gittinger <cg@exept.de>
parents:
4366
diff
changeset
|
3085 |
! |
dc83645cc903
support to recursively enumerate all private classes
Claus Gittinger <cg@exept.de>
parents:
4366
diff
changeset
|
3086 |
|
9194 | 3087 |
addAllPrivateClassesTo:aCollection |
3088 |
"add all of my private classes to aCollection" |
|
3089 |
||
3090 |
self privateClassesDo:[:aPrivateClass | |
|
13419 | 3091 |
aCollection add:aPrivateClass. |
3092 |
aPrivateClass addAllPrivateClassesTo:aCollection |
|
9194 | 3093 |
]. |
13414 | 3094 |
! |
3095 |
||
3096 |
getLookupObject |
|
3097 |
"return the lookupObject (Jan's MetaObjectProtocol support) or nil. |
|
3098 |
If non-nil, no lookup is performed by the VM, instead the lookupObject |
|
3099 |
has to provide a method object for message sends." |
|
3100 |
||
13419 | 3101 |
^ lookupObject |
13414 | 3102 |
|
3103 |
"Created: / 26-04-2010 / 13:36:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3104 |
! |
|
3105 |
||
3106 |
setLookupObject:aMethodLookupObject |
|
3107 |
"set the lookupObject (Jan's MetaObjectProtocol support) or nil. |
|
3108 |
If non-nil, no lookup is performed by the VM, instead the lookupObject |
|
3109 |
has to provide a method object for message sends." |
|
3110 |
||
14535 | 3111 |
lookupObject ~~ aMethodLookupObject ifTrue:[ |
3112 |
lookupObject := aMethodLookupObject. |
|
3113 |
ObjectMemory flushCachesFor: self. |
|
3114 |
self allSubclassesDo:[:cls|ObjectMemory flushCachesFor: cls] |
|
3115 |
] |
|
13414 | 3116 |
|
3117 |
"Modified: / 22-07-2010 / 18:10:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9194 | 3118 |
! ! |
3119 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
3120 |
|
9194 | 3121 |
!Behavior methodsFor:'queries'! |
620 | 3122 |
|
6727 | 3123 |
category |
12094 | 3124 |
"return the category of the class. |
6727 | 3125 |
Returning nil here, since Behavior does not define a category |
3126 |
(only ClassDescriptions do)." |
|
3127 |
||
3128 |
^ nil |
|
3129 |
||
3130 |
" |
|
12094 | 3131 |
Point category |
3132 |
Behavior new category |
|
6727 | 3133 |
" |
9194 | 3134 |
! |
6727 | 3135 |
|
3136 |
comment |
|
12094 | 3137 |
"return the comment of the class. |
6727 | 3138 |
Returning nil here, since Behavior does not define a category |
3139 |
(only Classes do). This allows different Behavior-like objects |
|
3140 |
(alien classes) to be handled by the browser as well." |
|
3141 |
||
9194 | 3142 |
^ nil |
3143 |
||
3144 |
"Modified: 16.4.1996 / 16:25:23 / cg" |
|
3145 |
! |
|
6727 | 3146 |
|
3147 |
definitionSelector |
|
3148 |
"return the selector with which I was (can be) defined in my superclass" |
|
3149 |
||
3150 |
^ (self firstDefinitionSelectorPart |
|
3151 |
, |
|
3152 |
'instanceVariableNames:classVariableNames:poolDictionaries:category:') asSymbol |
|
3153 |
||
3154 |
" |
|
3155 |
Object definitionSelector |
|
12094 | 3156 |
Array definitionSelector |
3157 |
ByteArray definitionSelector |
|
3158 |
FloatArray definitionSelector |
|
9194 | 3159 |
" |
3160 |
||
3161 |
"Modified: 3.3.1997 / 11:50:37 / cg" |
|
3162 |
! |
|
6727 | 3163 |
|
3164 |
definitionSelectorPrivate |
|
3165 |
"return the selector with which I was (can be) defined in my superclass |
|
3166 |
as a private class" |
|
3167 |
||
3168 |
^ (self firstDefinitionSelectorPart |
|
3169 |
, |
|
3170 |
'instanceVariableNames:classVariableNames:poolDictionaries:privateIn:') asSymbol |
|
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3171 |
|
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3172 |
" |
12094 | 3173 |
Array definitionSelector |
3174 |
Array definitionSelectorPrivate |
|
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3175 |
" |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
3176 |
|
6727 | 3177 |
"Modified: 23.6.1997 / 10:45:57 / cg" |
620 | 3178 |
! |
3179 |
||
9194 | 3180 |
firstDefinitionSelectorPart |
6727 | 3181 |
"return the first part of the selector with which I was (can be) defined in my superclass" |
3182 |
||
3183 |
self isVariable ifFalse:[ |
|
13419 | 3184 |
^ #'subclass:' |
6727 | 3185 |
]. |
3186 |
self isBytes ifTrue:[ |
|
13419 | 3187 |
^ #'variableByteSubclass:' |
6727 | 3188 |
]. |
3189 |
self isLongs ifTrue:[ |
|
13419 | 3190 |
^ #'variableLongSubclass:' |
6727 | 3191 |
]. |
3192 |
self isFloats ifTrue:[ |
|
13419 | 3193 |
^ #'variableFloatSubclass:' |
6727 | 3194 |
]. |
3195 |
self isDoubles ifTrue:[ |
|
13419 | 3196 |
^ #'variableDoubleSubclass:' |
6727 | 3197 |
]. |
3198 |
self isWords ifTrue:[ |
|
13419 | 3199 |
^ #'variableWordSubclass:' |
6727 | 3200 |
]. |
3201 |
self isSignedWords ifTrue:[ |
|
13419 | 3202 |
^ #'variableSignedWordSubclass:' |
6727 | 3203 |
]. |
3204 |
self isSignedLongs ifTrue:[ |
|
13419 | 3205 |
^ #'variableSignedLongSubclass:' |
6727 | 3206 |
]. |
3207 |
self isSignedLongLongs ifTrue:[ |
|
13419 | 3208 |
^ #'variableSignedLongLongSubclass:' |
6727 | 3209 |
]. |
3210 |
self isLongLongs ifTrue:[ |
|
13419 | 3211 |
^ #'variableLongLongSubclass:' |
6727 | 3212 |
]. |
3213 |
^ #'variableSubclass:' |
|
9194 | 3214 |
! |
3215 |
||
3216 |
fullName |
|
3217 |
"Answer the name of the receiver, fully qualified." |
|
3218 |
||
3219 |
^ self name asString |
|
3220 |
||
3221 |
! |
|
3222 |
||
9469
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3223 |
hasExtensions |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3224 |
^ false |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3225 |
|
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3226 |
"Created: / 06-08-2006 / 15:23:32 / cg" |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3227 |
! |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3228 |
|
14504 | 3229 |
isAbstract |
3230 |
^ false |
|
3231 |
! |
|
3232 |
||
9194 | 3233 |
isBehavior |
9219 | 3234 |
"return true, if the receiver is describing another objects behavior. |
3235 |
Defined to avoid the need to use isKindOf:" |
|
9194 | 3236 |
|
3237 |
^ true |
|
3238 |
||
3239 |
" |
|
12094 | 3240 |
True isBehavior |
9194 | 3241 |
true isBehavior |
3242 |
" |
|
3243 |
! |
|
620 | 3244 |
|
10043
22138758483e
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
10008
diff
changeset
|
3245 |
isBrowserStartable |
22138758483e
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
10008
diff
changeset
|
3246 |
^ false |
22138758483e
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
10008
diff
changeset
|
3247 |
|
22138758483e
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
10008
diff
changeset
|
3248 |
"Created: / 06-10-2006 / 11:33:42 / cg" |
22138758483e
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
10008
diff
changeset
|
3249 |
! |
22138758483e
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
10008
diff
changeset
|
3250 |
|
6727 | 3251 |
isBuiltInClass |
3252 |
"return true if this class is known by the run-time-system. |
|
3253 |
Here, false is returned as default. |
|
3254 |
Notice, this is instance protocol, which means that any class |
|
3255 |
other than those special ones) are non-builtIn by default." |
|
3256 |
||
3257 |
^ false |
|
3258 |
||
3259 |
"Modified: 23.4.1996 / 15:55:52 / cg" |
|
9194 | 3260 |
"Created: 28.10.1996 / 15:10:02 / cg" |
3261 |
! |
|
3262 |
||
3263 |
isPrivate |
|
3264 |
"return true, if the receiver is some private class" |
|
3265 |
||
3266 |
^ self owningClass notNil |
|
3267 |
||
3268 |
"Modified: 12.10.1996 / 20:11:05 / cg" |
|
3269 |
! |
|
6727 | 3270 |
|
9469
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3271 |
isStartableWithMain |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3272 |
^ false |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3273 |
|
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3274 |
"Created: / 06-08-2006 / 15:23:50 / cg" |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3275 |
! |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3276 |
|
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3277 |
isStartableWithStart |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3278 |
^ false |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3279 |
|
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3280 |
"Created: / 06-08-2006 / 15:23:57 / cg" |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3281 |
! |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3282 |
|
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3283 |
isVisualStartable |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3284 |
^ false |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3285 |
|
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3286 |
"Created: / 06-08-2006 / 15:23:38 / cg" |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3287 |
! |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3288 |
|
6727 | 3289 |
name |
3290 |
"although behaviors have no name, we return something |
|
3291 |
useful here - there are many places (inspectors) where |
|
3292 |
a classes name is asked for. |
|
3293 |
Implementing this message here allows anonymous classes |
|
9194 | 3294 |
and instances of them to be inspected." |
3295 |
||
3296 |
^ #'anonymous Behavior' |
|
3297 |
! |
|
3298 |
||
3299 |
nameInBrowser |
|
3300 |
"return a nameString as shown in browsers" |
|
3301 |
||
3302 |
^ self name ? '?' |
|
3303 |
! |
|
6727 | 3304 |
|
7331
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3305 |
nameWithArticle |
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3306 |
"return a string consisting of classname preceeded by an article. |
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3307 |
(dont expect me to write national variants for this ... :-) |
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3308 |
If you have special preferences, redefine it..." |
12094 | 3309 |
|
7331
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3310 |
|classname| |
12094 | 3311 |
|
7331
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3312 |
classname := self name. |
14259 | 3313 |
classname isEmptyOrNil ifTrue:[ ^ 'an anonymous' ]. |
7331
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3314 |
^ classname article , ' ' , classname |
12094 | 3315 |
|
7331
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3316 |
" |
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3317 |
SmallInteger nameWithArticle |
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3318 |
" |
9445 | 3319 |
|
14259 | 3320 |
"Modified: / 13-06-2012 / 14:50:03 / cg" |
7331
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3321 |
! |
cd0f1492d540
code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents:
7269
diff
changeset
|
3322 |
|
6727 | 3323 |
owningClass |
3324 |
"return my owning class - nil if I am a public class" |
|
3325 |
||
3326 |
"/ this information is in the metaclass ... |
|
3327 |
||
3328 |
^ self class owningClass |
|
3329 |
||
3330 |
"Created: 15.10.1996 / 21:19:32 / cg" |
|
3331 |
"Modified: 7.11.1996 / 13:49:28 / cg" |
|
3332 |
! |
|
3333 |
||
6733
4f8a80a22261
added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents:
6727
diff
changeset
|
3334 |
owningClassOrYourself |
4f8a80a22261
added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents:
6727
diff
changeset
|
3335 |
"return my owning class if I am private, myself otherwise" |
4f8a80a22261
added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents:
6727
diff
changeset
|
3336 |
|
9194 | 3337 |
self owningClass notNil ifTrue:[^ self topOwningClass]. |
3338 |
^ self |
|
3339 |
! |
|
6733
4f8a80a22261
added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents:
6727
diff
changeset
|
3340 |
|
9469
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3341 |
revision |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3342 |
^ nil |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3343 |
|
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3344 |
"Created: / 03-08-2006 / 01:53:44 / cg" |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3345 |
! |
580edc421e81
support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents:
9445
diff
changeset
|
3346 |
|
6727 | 3347 |
sourceCodeAt:aSelector |
3348 |
"return the methods source for given selector aSelector or nil. |
|
3349 |
Only methods in the receiver - not in the superclass chain are tested." |
|
3350 |
||
7676 | 3351 |
^ self sourceCodeAt:aSelector ifAbsent:nil |
6727 | 3352 |
|
3353 |
" |
|
3354 |
True sourceCodeAt:#ifTrue: |
|
3355 |
Object sourceCodeAt:#== |
|
3356 |
Behavior sourceCodeAt:#sourceCodeAt: |
|
2053 | 3357 |
" |
3358 |
! |
|
3359 |
||
7676 | 3360 |
sourceCodeAt:aSelector ifAbsent:exceptionalValue |
3361 |
"return the methods source for given selector aSelector or exceptionalValue. |
|
3362 |
Only methods in the receiver - not in the superclass chain are tested." |
|
3363 |
||
3364 |
|method| |
|
3365 |
||
3366 |
method := self compiledMethodAt:aSelector. |
|
3367 |
method isNil ifTrue:[^ exceptionalValue value]. |
|
9194 | 3368 |
^ method source |
3369 |
! |
|
7676 | 3370 |
|
6727 | 3371 |
sourceCodeManager |
12094 | 3372 |
"return the sourceCodeManager of the class. |
6727 | 3373 |
Returning nil here, since Behavior does not define any sourceCode management. |
3374 |
(only Classes do). This allows different Behavior-like objects |
|
3375 |
(alien classes) to be handled by the browser as well." |
|
3376 |
||
3377 |
^ nil |
|
3378 |
||
3379 |
"Created: 16.4.1996 / 16:26:03 / cg" |
|
9194 | 3380 |
! |
6727 | 3381 |
|
3382 |
supportsMethodCategories |
|
3383 |
"return true, if my methods are categorized. |
|
3384 |
This is a hook for the browser to allow alien classes |
|
14154
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
3385 |
to be handled (actually, this is not yet used)." |
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
3386 |
|
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
3387 |
^ self class supportsMethodCategories |
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
3388 |
|
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
3389 |
"Created: / 30-07-1997 / 14:59:08 / cg" |
2bbca940477e
added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents:
14065
diff
changeset
|
3390 |
"Modified: / 01-06-2012 / 20:38:03 / cg" |
620 | 3391 |
! |
3392 |
||
6727 | 3393 |
theMetaclass |
9696 | 3394 |
"return the metaClass of the class-meta pair. |
3395 |
Here, return my metaclass object, because I am the class. |
|
3396 |
Also implemented in my metaclass, which returns itself." |
|
9194 | 3397 |
|
3398 |
^ self class |
|
3399 |
||
3400 |
"Created: / 30.1.2000 / 23:08:30 / cg" |
|
3401 |
"Modified: / 31.1.2000 / 16:16:52 / cg" |
|
3402 |
! |
|
6727 | 3403 |
|
3404 |
theNonMetaclass |
|
9696 | 3405 |
"return the nonMetaClass of the class-meta pair. |
3406 |
Here, return myself, because I am the nonMetaclass. |
|
3407 |
Also implemented in my metaclass, which also returns me." |
|
6727 | 3408 |
|
3409 |
^ self |
|
3410 |
||
3411 |
"Created: / 30.1.2000 / 23:07:59 / cg" |
|
3412 |
"Modified: / 31.1.2000 / 16:17:46 / cg" |
|
3413 |
! |
|
3414 |
||
3415 |
topOwningClass |
|
3416 |
"return my outermost owning class - nil if I am a public class" |
|
3417 |
||
3418 |
"/ this information is in the metaclass ... |
|
3419 |
||
3420 |
^ self class topOwningClass |
|
3421 |
||
3422 |
"Created: 15.10.1996 / 21:19:32 / cg" |
|
3423 |
"Modified: 3.1.1997 / 19:18:49 / cg" |
|
3424 |
! ! |
|
3425 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
3426 |
|
9194 | 3427 |
!Behavior methodsFor:'queries-inheritance'! |
6727 | 3428 |
|
620 | 3429 |
allSubclasses |
3430 |
"return a collection of all subclasses (direct AND indirect) of |
|
3431 |
the receiver. There will be no specific order, in which entries |
|
10172 | 3432 |
are returned. NameSpaces are excluded from the list." |
620 | 3433 |
|
3434 |
|newColl| |
|
3435 |
||
3436 |
newColl := OrderedCollection new. |
|
3437 |
self allSubclassesDo:[:aClass | |
|
13419 | 3438 |
(aClass isRealNameSpace) ifFalse:[ |
3439 |
newColl add:aClass |
|
3440 |
] |
|
620 | 3441 |
]. |
3442 |
^ newColl |
|
3443 |
||
3444 |
" |
|
3445 |
Collection allSubclasses |
|
3446 |
" |
|
10172 | 3447 |
|
3448 |
"Modified: / 10-11-2006 / 17:22:58 / cg" |
|
620 | 3449 |
! |
3450 |
||
3451 |
allSubclassesInOrder |
|
3452 |
"return a collection of all subclasses (direct AND indirect) of |
|
10172 | 3453 |
the receiver. Higher level subclasses will come before lower ones. |
3454 |
NameSpaces are excluded from the list." |
|
620 | 3455 |
|
3456 |
|newColl| |
|
3457 |
||
3458 |
newColl := OrderedCollection new. |
|
3459 |
self allSubclassesInOrderDo:[:aClass | |
|
13419 | 3460 |
(aClass isRealNameSpace) ifFalse:[ |
3461 |
newColl add:aClass |
|
3462 |
] |
|
620 | 3463 |
]. |
3464 |
^ newColl |
|
3465 |
||
3466 |
" |
|
9194 | 3467 |
Collection allSubclassesInOrder |
3468 |
" |
|
10172 | 3469 |
|
3470 |
"Modified: / 10-11-2006 / 17:23:06 / cg" |
|
9194 | 3471 |
! |
620 | 3472 |
|
3473 |
allSuperclasses |
|
3474 |
"return a collection of the receivers accumulated superclasses" |
|
3475 |
||
3476 |
|aCollection theSuperClass| |
|
3477 |
||
6395
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
3478 |
theSuperClass := self superclass. |
4451 | 3479 |
theSuperClass isNil ifTrue:[ |
13419 | 3480 |
^ #() |
4451 | 3481 |
]. |
3482 |
aCollection := OrderedCollection new. |
|
3483 |
[theSuperClass notNil] whileTrue:[ |
|
13419 | 3484 |
aCollection add:theSuperClass. |
3485 |
theSuperClass := theSuperClass superclass |
|
620 | 3486 |
]. |
3487 |
^ aCollection |
|
3488 |
||
3489 |
" |
|
12094 | 3490 |
String allSuperclasses |
9194 | 3491 |
" |
3492 |
! |
|
620 | 3493 |
|
3494 |
canBeSubclassed |
|
3495 |
"return true, if its allowed to create subclasses of the receiver. |
|
3496 |
This method is redefined in SmallInteger and UndefinedObject, since |
|
3497 |
instances are detected by their pointer-fields, i.e. they do not have |
|
7435
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7358
diff
changeset
|
3498 |
a class entry (you don't have to understand this :-)" |
10 | 3499 |
|
3500 |
^ true |
|
3501 |
! |
|
3502 |
||
3641 | 3503 |
commonSuperclass:aClass |
3504 |
"Return the common superclass of the receiver and aClass. |
|
6754
d9c0f178f091
commonSuperClass: care for nil subclass
Claus Gittinger <cg@exept.de>
parents:
6733
diff
changeset
|
3505 |
Assumes that there is a common superclass of any two classes. |
14065
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3506 |
(might return nil, if either the receiver or the argument inherits from nil)" |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3507 |
|
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3508 |
(aClass == self) ifTrue:[^ self]. |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3509 |
(aClass isSubclassOf:self) ifTrue:[^ self]. |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3510 |
(self isSubclassOf:aClass) ifTrue:[^ aClass]. |
6754
d9c0f178f091
commonSuperClass: care for nil subclass
Claus Gittinger <cg@exept.de>
parents:
6733
diff
changeset
|
3511 |
superclass isNil ifTrue:[^ nil]. |
d9c0f178f091
commonSuperClass: care for nil subclass
Claus Gittinger <cg@exept.de>
parents:
6733
diff
changeset
|
3512 |
^ superclass commonSuperclass:aClass |
3641 | 3513 |
|
3514 |
" |
|
14065
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3515 |
Integer commonSuperclass:Fraction |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3516 |
SmallInteger commonSuperclass:Fraction |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3517 |
View commonSuperclass:Form |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3518 |
View commonSuperclass:Image |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3519 |
View commonSuperclass:View |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3520 |
Integer commonSuperclass:Autoload |
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3521 |
Integer commonSuperclass:Object |
3641 | 3522 |
" |
3523 |
||
14065
6f6d6223c947
changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents:
13862
diff
changeset
|
3524 |
"Modified (comment): / 17-03-2012 / 19:56:28 / cg" |
9194 | 3525 |
! |
3526 |
||
3527 |
hasMultipleSuperclasses |
|
12094 | 3528 |
"Return true, if this class inherits from other classes |
3529 |
(beside its primary superclass). |
|
3530 |
This method is a preparation for a future multiple inheritance extension |
|
9194 | 3531 |
- currently it is not supported by the VM" |
3532 |
||
3533 |
^ false |
|
3534 |
! |
|
6727 | 3535 |
|
13318 | 3536 |
includesBehavior:aClass |
3537 |
"return true, if the receiver includes the behavior of aClass; |
|
3538 |
i.e. if is either identical to a class or inherits from it." |
|
3539 |
||
3540 |
^ (self == aClass) or:[self isSubclassOf:aClass] |
|
3541 |
||
3542 |
" |
|
3543 |
True includesBehavior:Object |
|
3544 |
True includesBehavior:Boolean |
|
3545 |
True includesBehavior:True |
|
3546 |
True includesBehavior:False |
|
3547 |
" |
|
3548 |
||
3549 |
"Modified: 19.6.1997 / 18:14:35 / cg" |
|
3550 |
! |
|
3551 |
||
6727 | 3552 |
inheritsFrom:aClass |
3553 |
"return true, if the receiver inherits methods from aClass; |
|
3554 |
i.e. if aClass is on the receivers superclass chain." |
|
3555 |
||
3556 |
^ self isSubclassOf:aClass |
|
620 | 3557 |
|
293 | 3558 |
" |
6727 | 3559 |
True inheritsFrom:Object |
3560 |
LinkedList inheritsFrom:Array |
|
293 | 3561 |
" |
1088 | 3562 |
|
9194 | 3563 |
"Modified: 19.6.1997 / 18:13:21 / cg" |
3564 |
! |
|
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3565 |
|
13318 | 3566 |
isSubclassOf:aClass |
3567 |
"return true, if I am a subclass of the argument, aClass" |
|
3568 |
||
3569 |
%{ /* NOCONTEXT */ |
|
3570 |
OBJ __theClass = __INST(superclass); |
|
3571 |
||
3572 |
while (__theClass != nil) { |
|
13419 | 3573 |
if (__theClass == aClass) { |
3574 |
RETURN(true); |
|
3575 |
} |
|
3576 |
if (__isBehaviorLike(__theClass)) { |
|
3577 |
__theClass = __ClassInstPtr(__theClass)->c_superclass; |
|
3578 |
} else { |
|
3579 |
__theClass = nil; |
|
3580 |
} |
|
13318 | 3581 |
} |
3582 |
RETURN (false); |
|
3583 |
%}. |
|
3584 |
||
3585 |
"/ |theClass| |
|
3586 |
"/ |
|
3587 |
"/ theClass := superclass. |
|
3588 |
"/ [theClass notNil] whileTrue:[ |
|
3589 |
"/ (theClass == aClass) ifTrue:[^ true]. |
|
3590 |
"/%{ |
|
3591 |
"/ if (__isBehaviorLike(theClass)) { |
|
3592 |
"/ theClass = __ClassInstPtr(theClass)->c_superclass; |
|
3593 |
"/ } else { |
|
3594 |
"/ theClass = nil; |
|
3595 |
"/ } |
|
3596 |
"/%}. |
|
3597 |
"/"/ theClass := theClass superclass. |
|
3598 |
"/ ]. |
|
3599 |
"/ ^ false |
|
3600 |
||
3601 |
" |
|
13419 | 3602 |
String isSubclassOf:Collection |
3603 |
LinkedList isSubclassOf:Array |
|
13318 | 3604 |
1 isSubclassOf:Number <- will fail since 1 is no class |
13419 | 3605 |
Number isSubclassOf:1 |
13318 | 3606 |
" |
3607 |
! |
|
3608 |
||
6727 | 3609 |
subclasses |
3610 |
"return a collection of the direct subclasses of the receiver" |
|
3611 |
||
3612 |
|newColl| |
|
3613 |
||
3614 |
newColl := OrderedCollection new. |
|
3615 |
self subclassesDo:[:aClass | |
|
13419 | 3616 |
newColl add:aClass |
6727 | 3617 |
]. |
7435
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7358
diff
changeset
|
3618 |
^ newColl. |
6727 | 3619 |
! |
3620 |
||
3621 |
superclasses |
|
9194 | 3622 |
"return a collection of the receivers immediate superclasses. |
12094 | 3623 |
This method is a preparation for a future multiple inheritance extension |
9194 | 3624 |
- currently it is not supported by the VM" |
3625 |
||
3626 |
^ Array with:self superclass. |
|
3627 |
||
3628 |
" |
|
12094 | 3629 |
String superclasses |
9194 | 3630 |
" |
3631 |
! |
|
6727 | 3632 |
|
3633 |
withAllSubclasses |
|
12094 | 3634 |
"return a collection containing the receiver and |
6727 | 3635 |
all subclasses (direct AND indirect) of the receiver" |
3636 |
||
3637 |
|coll| |
|
3638 |
||
14414
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3639 |
coll := OrderedCollection new. |
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3640 |
self withAllSubclassesDo:[:eachClass | coll add:eachClass]. |
6727 | 3641 |
^ coll |
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3642 |
|
14414
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3643 |
"/ the following original code is slighly less efficient (makes big collections) |
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3644 |
"/ coll := self allSubclasses asOrderedCollection. |
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3645 |
"/ coll addFirst:self. |
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3646 |
"/ ^ coll |
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3647 |
|
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3648 |
" |
6727 | 3649 |
Collection withAllSubclasses |
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3650 |
" |
620 | 3651 |
! |
3652 |
||
6727 | 3653 |
withAllSuperclasses |
3654 |
"return a collection containing the receiver and all |
|
3655 |
of the receivers accumulated superclasses" |
|
3656 |
||
14414
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3657 |
|coll| |
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3658 |
|
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3659 |
coll := OrderedCollection new. |
6727 | 3660 |
self withAllSuperclassesDo:[:cls | |
14414
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3661 |
coll add:cls |
6727 | 3662 |
]. |
14414
5966c2554334
comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents:
14288
diff
changeset
|
3663 |
^ coll |
9194 | 3664 |
|
3665 |
" |
|
12094 | 3666 |
String withAllSuperclasses |
9194 | 3667 |
" |
3668 |
! ! |
|
3669 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
3670 |
|
9194 | 3671 |
!Behavior methodsFor:'queries-instances'! |
6727 | 3672 |
|
3673 |
allDerivedInstances |
|
12094 | 3674 |
"return a collection of all instances of myself and |
6727 | 3675 |
instances of all subclasses of myself. |
3676 |
This method is going to be removed for protocol compatibility with |
|
3677 |
other STs; use allSubInstances" |
|
3678 |
||
3679 |
<resource:#obsolete> |
|
3680 |
||
3681 |
self obsoleteMethodWarning:'use #allSubInstances'. |
|
3682 |
^ self allSubInstances |
|
3683 |
||
9194 | 3684 |
"Modified: 31.7.1997 / 23:04:59 / cg" |
3685 |
! |
|
2436 | 3686 |
|
6727 | 3687 |
allInstances |
3688 |
"return a collection of all my instances" |
|
3689 |
||
3690 |
"Read the documentation on why there seem to be no |
|
3691 |
instances of SmallInteger and UndefinedObject" |
|
3692 |
||
3693 |
|coll| |
|
3694 |
||
3695 |
coll := OrderedCollection new:100. |
|
3696 |
self allInstancesDo:[:anObject | |
|
13419 | 3697 |
coll add:anObject |
6727 | 3698 |
]. |
12094 | 3699 |
^ coll |
2713 | 3700 |
|
3701 |
" |
|
6727 | 3702 |
ScrollBar allInstances |
2713 | 3703 |
" |
6727 | 3704 |
! |
3705 |
||
3706 |
allInstancesWeakly:doWeakly |
|
3707 |
"return a collection of all my instances. |
|
3708 |
If weakly is true, a weak collection is returned." |
|
3709 |
||
3710 |
"Read the documentation on why there seem to be no |
|
3711 |
instances of SmallInteger and UndefinedObject" |
|
3712 |
||
3713 |
|coll| |
|
3714 |
||
3715 |
coll := self allInstances. |
|
3716 |
doWeakly ifTrue:[ |
|
13419 | 3717 |
coll := WeakArray withAll:coll |
9194 | 3718 |
]. |
3719 |
^ coll |
|
3720 |
||
3721 |
"Created: / 19.6.1998 / 02:17:20 / cg" |
|
3722 |
! |
|
6727 | 3723 |
|
3724 |
allSubInstances |
|
12094 | 3725 |
"return a collection of all instances of myself and |
6727 | 3726 |
instances of all subclasses of myself." |
3727 |
||
3728 |
|coll| |
|
3729 |
||
3730 |
coll := OrderedCollection new:100. |
|
3731 |
self allSubInstancesDo:[:anObject | |
|
13419 | 3732 |
(anObject isKindOf:self) ifTrue:[ |
3733 |
coll add:anObject |
|
3734 |
] |
|
6727 | 3735 |
]. |
12094 | 3736 |
^ coll |
6727 | 3737 |
|
3738 |
" |
|
3739 |
View allSubInstances |
|
3740 |
" |
|
2713 | 3741 |
! |
3742 |
||
10669 | 3743 |
anyInstance |
3744 |
"return any of my instances; raise an error, if there is none" |
|
3745 |
||
3746 |
"Read the documentation on why there seem to be no |
|
3747 |
instances of SmallInteger and UndefinedObject" |
|
3748 |
||
3749 |
self allInstancesDo:[:anObject | ^ anObject]. |
|
3750 |
self errorNotFound |
|
3751 |
||
3752 |
" |
|
3753 |
ScrollBar anyInstance |
|
3754 |
SmallInteger anyInstance |
|
3755 |
" |
|
3756 |
||
3757 |
"Created: / 24-07-2007 / 06:12:27 / cg" |
|
3758 |
! |
|
3759 |
||
620 | 3760 |
derivedInstanceCount |
3761 |
"return the number of instances of myself and of subclasses" |
|
3762 |
||
3763 |
|count| |
|
3764 |
||
3765 |
count := 0. |
|
3766 |
ObjectMemory allObjectsDo:[:anObject | |
|
13419 | 3767 |
(anObject isKindOf:self) ifTrue:[ |
3768 |
count := count + 1 |
|
3769 |
] |
|
620 | 3770 |
]. |
3771 |
^ count |
|
3772 |
||
293 | 3773 |
" |
620 | 3774 |
View derivedInstanceCount |
9194 | 3775 |
SequenceableCollection derivedInstanceCount |
3776 |
Object derivedInstanceCount |
|
3777 |
" |
|
3778 |
! |
|
983 | 3779 |
|
3780 |
hasDerivedInstances |
|
3781 |
"return true, if there are any instances of myself or of any subclass" |
|
3782 |
||
3783 |
"Read the documentation on why there seem to be no |
|
3784 |
instances of SmallInteger and UndefinedObject" |
|
3785 |
||
3786 |
ObjectMemory allObjectsDo:[:anObject | |
|
13419 | 3787 |
(anObject isKindOf:self) ifTrue:[ |
3788 |
^ true |
|
3789 |
] |
|
983 | 3790 |
]. |
3791 |
^ false |
|
3792 |
||
3793 |
" |
|
9194 | 3794 |
Object hasDerivedInstances - certainly true |
3795 |
SharedQueue hasDerivedInstances |
|
3796 |
" |
|
3797 |
! |
|
620 | 3798 |
|
2674
5278213b500c
added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2666
diff
changeset
|
3799 |
hasImmediateInstances |
4657
ace3dc642424
added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents:
4636
diff
changeset
|
3800 |
"return true if this class has immediate instances |
ace3dc642424
added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents:
4636
diff
changeset
|
3801 |
i.e. if the instances are represented in the pointer itself and |
ace3dc642424
added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents:
4636
diff
changeset
|
3802 |
no real object header/storage is used for the object. |
ace3dc642424
added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents:
4636
diff
changeset
|
3803 |
Redefined in classes which have so (only SmallInteger and UndefinedObject)" |
2674
5278213b500c
added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2666
diff
changeset
|
3804 |
|
5278213b500c
added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2666
diff
changeset
|
3805 |
^ false |
5278213b500c
added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2666
diff
changeset
|
3806 |
|
5278213b500c
added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2666
diff
changeset
|
3807 |
"Created: 3.6.1997 / 12:01:05 / cg" |
5278213b500c
added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2666
diff
changeset
|
3808 |
! |
5278213b500c
added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2666
diff
changeset
|
3809 |
|
620 | 3810 |
hasInstances |
3811 |
"return true, if there are any instances of myself" |
|
3812 |
||
3813 |
"Read the documentation on why there seem to be no |
|
3814 |
instances of SmallInteger and UndefinedObject" |
|
3815 |
||
3816 |
"/ ObjectMemory allObjectsDo:[:anObject | |
|
3817 |
"/ (anObject class == self) ifTrue:[ |
|
3818 |
"/ ^ true |
|
3819 |
"/ ] |
|
3820 |
"/ ]. |
|
983 | 3821 |
|
620 | 3822 |
ObjectMemory allInstancesOf:self do:[:anObject | |
13419 | 3823 |
^ true |
620 | 3824 |
]. |
3825 |
^ false |
|
3826 |
||
293 | 3827 |
" |
620 | 3828 |
Object hasInstances |
3829 |
SequenceableCollection hasInstances |
|
3830 |
Float hasInstances |
|
3831 |
SmallInteger hasInstances |
|
293 | 3832 |
" |
9194 | 3833 |
! |
3834 |
||
3835 |
hasSharedInstances |
|
3836 |
"return true if this class has shared instances, that is, instances |
|
3837 |
with the same value are identical. |
|
3838 |
False is returned here, only redefined in classes which have unified |
|
3839 |
instances (or should be treated so)." |
|
3840 |
||
3841 |
^ false |
|
3842 |
! |
|
3843 |
||
3844 |
instanceCount |
|
6727 | 3845 |
"return the number of instances of myself." |
3846 |
||
3847 |
"Read the documentation on why there seem to be no |
|
3848 |
instances of SmallInteger and UndefinedObject" |
|
3849 |
||
3850 |
|count| |
|
3851 |
||
3852 |
count := 0. |
|
3853 |
"/ ObjectMemory allObjectsDo:[:anObject | |
|
3854 |
"/ (anObject class == self) ifTrue:[ |
|
3855 |
"/ count := count + 1 |
|
3856 |
"/ ] |
|
3857 |
"/ ]. |
|
3858 |
||
3859 |
ObjectMemory allInstancesOf:self do:[:anObject | |
|
13419 | 3860 |
count := count + 1 |
6727 | 3861 |
]. |
3862 |
^ count |
|
3863 |
||
3864 |
" |
|
3865 |
View instanceCount |
|
3866 |
Object instanceCount |
|
3867 |
Float instanceCount |
|
3868 |
SequenceableCollection instanceCount |
|
3869 |
SmallInteger instanceCount .... mhmh - hear, hear |
|
3870 |
" |
|
9194 | 3871 |
! ! |
3872 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
3873 |
|
9194 | 3874 |
!Behavior methodsFor:'queries-instlayout'! |
6727 | 3875 |
|
3876 |
elementByteSize |
|
9194 | 3877 |
"for bit-like containers, return the number of bytes stored per |
3878 |
element. For pointer indexed classes, 0 is returned" |
|
3879 |
||
3880 |
self isBitsExtended ifTrue:[ |
|
13419 | 3881 |
self isBytes ifTrue:[^ 1]. |
3882 |
self isWords ifTrue:[^ 2]. |
|
3883 |
self isSignedWords ifTrue:[^ 2]. |
|
3884 |
self isLongs ifTrue:[^ 4]. |
|
3885 |
self isSignedLongs ifTrue:[^ 4]. |
|
3886 |
self isLongLongs ifTrue:[^ 8]. |
|
3887 |
self isSignedLongLongs ifTrue:[^ 8]. |
|
9194 | 3888 |
]. |
3889 |
self isFloats ifTrue:[^ 4]. |
|
3890 |
self isDoubles ifTrue:[^ 8]. |
|
3891 |
||
3892 |
^ 0 |
|
3893 |
||
3894 |
! |
|
6727 | 3895 |
|
17936
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
3896 |
isAlienBehavior |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
3897 |
"Returns true iff I'm an alien behavior." |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
3898 |
%{ |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
3899 |
RETURN( ( (INT)(__INST(flags)) & __MASKSMALLINT(ALIENPOINTERS)) ? true : false ) |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
3900 |
%}. |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
3901 |
|
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
3902 |
! |
dca64de9f809
alien Flag added to Behavior class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17928
diff
changeset
|
3903 |
|
6727 | 3904 |
isBits |
3905 |
"return true, if instances have indexed byte or short instance variables. |
|
3906 |
Ignore long, float and double arrays, since ST-80 code using isBits are probably |
|
3907 |
not prepared to handle them correctly." |
|
3908 |
||
3909 |
%{ /* NOCONTEXT */ |
|
3910 |
||
3911 |
REGISTER int what; |
|
3912 |
||
3913 |
what = (INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK); |
|
3914 |
RETURN (( (what == __MASKSMALLINT(BYTEARRAY)) |
|
13419 | 3915 |
|| (what == __MASKSMALLINT(WORDARRAY))) ? true : false ); |
6727 | 3916 |
%}. |
9194 | 3917 |
^ self isBytes or:[self isWords] |
3918 |
! |
|
3919 |
||
3920 |
isBitsExtended |
|
3921 |
"return true, if instances have indexed byte, short, long or longlong instance variables. |
|
3922 |
Ignore float and double arrays. |
|
3923 |
This is really the thing we expect #isBits to return, however, #isBits |
|
3924 |
is defined to only return true for byte- and wordIndexed instances. |
|
3925 |
This avoids confusion of ST80 code, which is not prepared for long or longLong |
|
3926 |
instVars." |
|
3927 |
||
3928 |
%{ /* NOCONTEXT */ |
|
3929 |
||
3930 |
REGISTER int what; |
|
3931 |
||
3932 |
what = (INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK); |
|
6727 | 3933 |
RETURN (( (what == __MASKSMALLINT(BYTEARRAY)) |
13419 | 3934 |
|| (what == __MASKSMALLINT(WORDARRAY)) |
3935 |
|| (what == __MASKSMALLINT(SWORDARRAY)) |
|
3936 |
|| (what == __MASKSMALLINT(LONGARRAY)) |
|
3937 |
|| (what == __MASKSMALLINT(SLONGARRAY)) |
|
3938 |
|| (what == __MASKSMALLINT(LONGLONGARRAY)) |
|
3939 |
|| (what == __MASKSMALLINT(SLONGLONGARRAY))) ? true : false ); |
|
6727 | 3940 |
%} |
3941 |
! |
|
3942 |
||
3943 |
isBytes |
|
3944 |
"return true, if instances have indexed byte instance variables" |
|
3945 |
||
3946 |
"this could also be defined as: |
|
13419 | 3947 |
^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagBytes |
6727 | 3948 |
" |
3949 |
%{ /* NOCONTEXT */ |
|
3950 |
||
12094 | 3951 |
RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(BYTEARRAY)) ? true : false ); |
6727 | 3952 |
%} |
3953 |
! |
|
3954 |
||
3955 |
isDoubles |
|
3956 |
"return true, if instances have indexed double instance variables" |
|
3957 |
||
3958 |
"this could also be defined as: |
|
13419 | 3959 |
^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagDoubles |
6727 | 3960 |
" |
3961 |
%{ /* NOCONTEXT */ |
|
3962 |
||
12094 | 3963 |
RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(DOUBLEARRAY)) ? true : false ); |
9194 | 3964 |
%} |
3965 |
! |
|
6727 | 3966 |
|
3967 |
isFixed |
|
3968 |
"return true, if instances do not have indexed instance variables" |
|
3969 |
||
3970 |
"this could also be defined as: |
|
13419 | 3971 |
^ self isVariable not |
6727 | 3972 |
" |
3973 |
||
3974 |
%{ /* NOCONTEXT */ |
|
3975 |
||
12094 | 3976 |
RETURN ( ((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) ? false : true ); |
6727 | 3977 |
%}. |
3978 |
^ self isVariable not |
|
3979 |
! |
|
3980 |
||
3981 |
isFloats |
|
9194 | 3982 |
"return true, if instances have indexed float instance variables" |
6727 | 3983 |
|
3984 |
"this could also be defined as: |
|
13419 | 3985 |
^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagFloats |
6727 | 3986 |
" |
9194 | 3987 |
%{ /* NOCONTEXT */ |
3988 |
||
12094 | 3989 |
RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(FLOATARRAY)) ? true : false ); |
9194 | 3990 |
%} |
3991 |
! |
|
3992 |
||
3993 |
isFloatsOrDoubles |
|
3994 |
"return true, if instances have indexed float or double instance variables" |
|
3995 |
||
3996 |
%{ /* NOCONTEXT */ |
|
3997 |
||
3998 |
int what; |
|
3999 |
||
4000 |
what = (INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK); |
|
4001 |
RETURN (( (what == __MASKSMALLINT(FLOATARRAY)) |
|
13419 | 4002 |
|| (what == __MASKSMALLINT(DOUBLEARRAY))) ? true : false ); |
9194 | 4003 |
%}. |
4004 |
^ self isFloats or:[self isDoubles] |
|
4005 |
||
4006 |
" |
|
12094 | 4007 |
(Object new) class isFloatsOrDoubles |
4008 |
(Point new) class isFloatsOrDoubles |
|
4009 |
(Array new) class isFloatsOrDoubles |
|
4010 |
(ByteArray new) class isFloatsOrDoubles |
|
4011 |
(FloatArray new) class isFloatsOrDoubles |
|
4012 |
(DoubleArray new) class isFloatsOrDoubles |
|
6727 | 4013 |
" |
4014 |
! |
|
4015 |
||
4016 |
isLongLongs |
|
4017 |
"return true, if instances have indexed long-long instance variables (8 byte uints)" |
|
4018 |
||
4019 |
%{ /* NOCONTEXT */ |
|
4020 |
||
4021 |
RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(LONGLONGARRAY)) ? true : false ); |
|
4022 |
%} |
|
4023 |
! |
|
4024 |
||
4025 |
isLongs |
|
9194 | 4026 |
"return true, if instances have indexed long instance variables (4 byte uints)" |
4027 |
||
4028 |
%{ /* NOCONTEXT */ |
|
4029 |
||
12094 | 4030 |
RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(LONGARRAY)) ? true : false ); |
9194 | 4031 |
%} |
4032 |
! |
|
4033 |
||
4034 |
isPointers |
|
12094 | 4035 |
"return true, if instances have pointer instance variables |
9194 | 4036 |
i.e. are either non-indexed or have indexed pointer variables" |
4037 |
||
4038 |
"QUESTION: should we ignore WeakPointers ?" |
|
6727 | 4039 |
|
4040 |
%{ /* NOCONTEXT */ |
|
4041 |
||
9194 | 4042 |
REGISTER int flags; |
4043 |
||
4044 |
flags = __intVal(__INST(flags)) & ARRAYMASK; |
|
4045 |
switch (flags) { |
|
13419 | 4046 |
default: |
4047 |
/* normal objects */ |
|
4048 |
RETURN ( true ); |
|
4049 |
||
4050 |
case BYTEARRAY: |
|
4051 |
case WORDARRAY: |
|
4052 |
case LONGARRAY: |
|
4053 |
case SWORDARRAY: |
|
4054 |
case SLONGARRAY: |
|
4055 |
case SLONGLONGARRAY: |
|
4056 |
case LONGLONGARRAY: |
|
4057 |
case FLOATARRAY: |
|
4058 |
case DOUBLEARRAY: |
|
4059 |
RETURN (false ); |
|
4060 |
||
4061 |
case WKPOINTERARRAY: |
|
4062 |
/* what about those ? */ |
|
4063 |
RETURN (true ); |
|
6727 | 4064 |
} |
4065 |
%} |
|
4066 |
! |
|
4067 |
||
4068 |
isSignedLongLongs |
|
4069 |
"return true, if instances have indexed signed long-long instance variables (8 byte ints)" |
|
4070 |
||
4071 |
%{ /* NOCONTEXT */ |
|
4072 |
||
4073 |
RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SLONGLONGARRAY)) ? true : false ); |
|
4074 |
%} |
|
4075 |
! |
|
4076 |
||
4077 |
isSignedLongs |
|
9194 | 4078 |
"return true, if instances have indexed signed long instance variables (4 byte ints)" |
4079 |
||
4080 |
%{ /* NOCONTEXT */ |
|
4081 |
||
4082 |
RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SLONGARRAY)) ? true : false ); |
|
4083 |
%} |
|
4084 |
! |
|
6727 | 4085 |
|
4086 |
isSignedWords |
|
4087 |
"return true, if instances have indexed signed short instance variables" |
|
4088 |
||
4089 |
%{ /* NOCONTEXT */ |
|
4090 |
||
4091 |
RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SWORDARRAY)) ? true : false ); |
|
4092 |
%} |
|
4093 |
! |
|
4094 |
||
4095 |
isVariable |
|
4096 |
"return true, if instances have indexed instance variables" |
|
4097 |
||
4098 |
"this could also be defined as: |
|
13419 | 4099 |
^ (flags bitAnd:(Behavior maskIndexType)) ~~ 0 |
9194 | 4100 |
" |
4101 |
||
4102 |
%{ /* NOCONTEXT */ |
|
4103 |
||
12094 | 4104 |
RETURN ( ((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) ? true : false ); |
9194 | 4105 |
%} |
4106 |
! |
|
6727 | 4107 |
|
4108 |
isWeakPointers |
|
4109 |
"return true, if instances have weak pointer instance variables" |
|
4110 |
||
4111 |
%{ /* NOCONTEXT */ |
|
4112 |
||
4113 |
REGISTER int flags; |
|
4114 |
||
4115 |
flags = __intVal(__INST(flags)) & ARRAYMASK; |
|
4116 |
if (flags == WKPOINTERARRAY) { |
|
13419 | 4117 |
RETURN ( true ); |
6727 | 4118 |
} |
4119 |
%}. |
|
4120 |
^ false |
|
4121 |
! |
|
4122 |
||
4123 |
isWords |
|
4124 |
"return true, if instances have indexed short instance variables" |
|
4125 |
||
4126 |
"this could also be defined as: |
|
13419 | 4127 |
^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagWords |
9194 | 4128 |
" |
4129 |
%{ /* NOCONTEXT */ |
|
4130 |
||
12094 | 4131 |
RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(WORDARRAY)) ? true : false ); |
6727 | 4132 |
%} |
9194 | 4133 |
! |
4134 |
||
4135 |
sizeOfInst:n |
|
6727 | 4136 |
"return the number of bytes required for an instance of |
12094 | 4137 |
myself with n indexed instance variables. The argument n |
6727 | 4138 |
should be zero for classes without indexed instance variables. |
4139 |
See Behavior>>niceNew: for an application of this." |
|
4140 |
||
4141 |
|nInstvars| |
|
4142 |
||
4143 |
nInstvars := self instSize. |
|
4144 |
%{ |
|
8910 | 4145 |
INT nBytes; |
6727 | 4146 |
|
12094 | 4147 |
nBytes = __intVal(nInstvars) * sizeof(OBJ) + OHDR_SIZE; |
6727 | 4148 |
if (__isSmallInteger(n)) { |
13419 | 4149 |
int nIndex; |
4150 |
||
4151 |
nIndex = __intVal(n); |
|
4152 |
switch (__intVal(__INST(flags)) & ARRAYMASK) { |
|
4153 |
case BYTEARRAY: |
|
4154 |
nBytes += nIndex; |
|
4155 |
if (nBytes & (__ALIGN__ - 1)) { |
|
4156 |
nBytes = (nBytes & ~(__ALIGN__ - 1)) + __ALIGN__; |
|
4157 |
} |
|
4158 |
break; |
|
4159 |
||
4160 |
case WORDARRAY: |
|
4161 |
case SWORDARRAY: |
|
4162 |
nBytes += nIndex * 2; |
|
4163 |
if (nBytes & (__ALIGN__ - 1)) { |
|
4164 |
nBytes = (nBytes & ~(__ALIGN__ - 1)) + __ALIGN__; |
|
4165 |
} |
|
4166 |
break; |
|
4167 |
||
4168 |
case LONGARRAY: |
|
4169 |
case SLONGARRAY: |
|
4170 |
nBytes += nIndex * 4; |
|
4171 |
break; |
|
4172 |
||
4173 |
case LONGLONGARRAY: |
|
4174 |
case SLONGLONGARRAY: |
|
4175 |
nBytes += nIndex * 8; |
|
4176 |
break; |
|
4177 |
||
4178 |
case FLOATARRAY: |
|
4179 |
nBytes += nIndex * sizeof(float); |
|
4180 |
break; |
|
4181 |
||
4182 |
case DOUBLEARRAY: |
|
4183 |
nBytes += nIndex * sizeof(double); |
|
4184 |
break; |
|
4185 |
||
4186 |
default: |
|
4187 |
nBytes += nIndex * sizeof(OBJ); |
|
4188 |
break; |
|
4189 |
} |
|
9194 | 4190 |
} |
4191 |
RETURN (__mkSmallInteger(nBytes)); |
|
4192 |
%} |
|
4193 |
! ! |
|
4194 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
4195 |
|
9194 | 4196 |
!Behavior methodsFor:'queries-protocol'! |
6727 | 4197 |
|
4198 |
allSelectors |
|
4199 |
"return a collection of all selectors understood by the receiver; |
|
4200 |
this includes my selectors and all superclass selectors |
|
4201 |
(i.e. the receivers full protocol)" |
|
4202 |
||
4203 |
|superclass| |
|
4204 |
||
4205 |
superclass := self superclass. |
|
4206 |
superclass notNil ifTrue:[ |
|
13419 | 4207 |
^ superclass allSelectors addAll:(self selectors); yourself. |
6727 | 4208 |
]. |
4209 |
^ self selectors asIdentitySet |
|
4210 |
||
4211 |
" |
|
4212 |
Point allSelectors |
|
4213 |
View allSelectors |
|
9194 | 4214 |
Array allSelectors |
4215 |
" |
|
4216 |
! |
|
4217 |
||
4218 |
cachedLookupMethodFor:aSelector |
|
4219 |
"return the method, which would be executed if aSelector was sent to |
|
4220 |
an instance of the receiver. I.e. the selector arrays of the receiver |
|
4221 |
and all of its superclasses are searched for aSelector. |
|
4222 |
Return the method, or nil if instances do not understand aSelector. |
|
4223 |
This interface provides exactly the same information as #lookupMethodFor:, |
|
12094 | 4224 |
but uses the lookup-cache in the VM for faster search. |
9194 | 4225 |
However, keep in mind, that doing a lookup through the cache also adds new |
12094 | 4226 |
entries and can thus slow down the system by polluting the cache with |
6727 | 4227 |
irrelevant entries. (do NOT loop over all objects calling this method). |
4228 |
Does NOT (currently) handle MI" |
|
4229 |
||
4230 |
%{ /* NOCONTEXT */ |
|
4231 |
RETURN ( __lookup(self, aSelector) ); |
|
4232 |
%} |
|
4233 |
||
4234 |
" |
|
4235 |
String cachedLookupMethodFor:#= |
|
4236 |
String cachedLookupMethodFor:#asOrderedCollection |
|
4237 |
" |
|
4238 |
! |
|
4239 |
||
4240 |
canUnderstand:aSelector |
|
9194 | 4241 |
"return true, if the receiver or one of its superclasses implements aSelector. |
4242 |
(i.e. true if my instances understand aSelector)" |
|
4243 |
||
13419 | 4244 |
|l| |
4245 |
||
4246 |
"JV @ 2010-08-22: Rewritten to respect lookup object." |
|
4247 |
(l := self lookupObject) notNil ifTrue:[ |
|
17891 | 4248 |
^ (l |
4249 |
lookupMethodForSelector:aSelector |
|
4250 |
directedTo:self |
|
4251 |
for: nil "Fake receiver" |
|
4252 |
withArguments: nil "Fake arguments" |
|
4253 |
from: thisContext sender |
|
4254 |
ilc: nil) notNil |
|
13419 | 4255 |
]. |
13414 | 4256 |
|
4257 |
"Original implementation" |
|
9194 | 4258 |
^ (self lookupMethodFor:aSelector) notNil |
4259 |
||
4260 |
" |
|
4261 |
True canUnderstand:#ifTrue: |
|
4262 |
True canUnderstand:#== |
|
4263 |
True canUnderstand:#do: |
|
4264 |
" |
|
17891 | 4265 |
|
4266 |
"Modified: / 28-10-2011 / 09:34:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9194 | 4267 |
! |
6727 | 4268 |
|
4269 |
compiledMethodAt:aSelector |
|
4270 |
"return the method for given selector aSelector or nil. |
|
4271 |
Only methods in the receiver - not in the superclass chain are tested." |
|
4272 |
||
4273 |
^ self compiledMethodAt:aSelector ifAbsent:nil |
|
4274 |
||
4275 |
" |
|
4276 |
Object compiledMethodAt:#== |
|
4277 |
(Object compiledMethodAt:#==) category |
|
4278 |
" |
|
4279 |
||
4280 |
"Modified: / 7.6.1996 / 14:43:32 / stefan" |
|
4281 |
"Modified: / 27.10.1997 / 20:18:55 / cg" |
|
4282 |
! |
|
4283 |
||
4284 |
compiledMethodAt:aSelector ifAbsent:exceptionValue |
|
4285 |
"return the method for given selector aSelector or the value |
|
4286 |
of exceptionValue if not present. |
|
4287 |
Only methods in the receiver - not in the superclass chain are tested." |
|
4288 |
||
4289 |
|dict| |
|
4290 |
||
4291 |
dict := self methodDictionary. |
|
4292 |
dict isNil ifTrue:[ |
|
13419 | 4293 |
('Behavior [warning]: nil methodDictionary in ' , self name printString) errorPrintCR. |
4294 |
^ exceptionValue value |
|
6727 | 4295 |
]. |
4296 |
||
4297 |
^ dict at:aSelector ifAbsent:exceptionValue |
|
4298 |
||
4299 |
" |
|
4300 |
Object compiledMethodAt:#== |
|
4301 |
(Object compiledMethodAt:#==) category |
|
4302 |
" |
|
4303 |
||
4304 |
"Modified: / 7.6.1996 / 14:43:32 / stefan" |
|
4305 |
"Modified: / 10.1.1997 / 17:27:21 / cg" |
|
4306 |
"Created: / 27.10.1997 / 20:18:28 / cg" |
|
9194 | 4307 |
! |
4308 |
||
13414 | 4309 |
compiledMethodNamed: methodName |
4310 |
"Warning: this method is here to support multiple languages. |
|
4311 |
Do not use in code that works just with the smalltalk code. |
|
4312 |
Use compiledMethodAt: selector instead" |
|
4313 |
||
4314 |
"Returns a method with given name. This differs from |
|
4315 |
#compiledMethodAt:, since class may contain more methods |
|
4316 |
with same names and different selectors. |
|
4317 |
||
4318 |
Only methods in the receiver - not in the superclass chain are tested." |
|
4319 |
||
4320 |
^ self compiledMethodNamed:methodName ifAbsent:nil |
|
4321 |
||
4322 |
" |
|
4323 |
Object compiledMethodNamed:#== |
|
4324 |
(Object compiledMethodNamed:#==) category |
|
4325 |
" |
|
4326 |
||
4327 |
"Created: / 24-08-2009 / 10:00:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4328 |
"Modified: / 28-06-2011 / 14:16:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4329 |
! |
|
4330 |
||
4331 |
compiledMethodNamed: name ifAbsent:exceptionValue |
|
4332 |
"Warning: this method is here to support multiple languages. |
|
4333 |
Do not use in code that works just with the smalltalk code. |
|
4334 |
Use compiledMethodAt: selector instead" |
|
4335 |
||
4336 |
"Returns a method with given name of value of exceptionValue |
|
13419 | 4337 |
if not present. This differs from #compiledMethodAt:, since class |
13414 | 4338 |
may contain more methods with same name and different selectors. |
4339 |
||
4340 |
Only methods in the receiver - not in the superclass chain are tested." |
|
4341 |
||
4342 |
|dict mth| |
|
4343 |
||
4344 |
dict := self methodDictionary. |
|
4345 |
dict isNil ifTrue:[ |
|
13838
1d91d75691f0
changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
13600
diff
changeset
|
4346 |
('Behavior [warning]: nil methodDictionary in ' , self name printString) errorPrintCR. |
1d91d75691f0
changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
13600
diff
changeset
|
4347 |
^ exceptionValue value |
13414 | 4348 |
]. |
13419 | 4349 |
"Quick check: look into method dictionary" |
13414 | 4350 |
mth := dict at: name asSymbol ifAbsent:nil. |
13838
1d91d75691f0
changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
13600
diff
changeset
|
4351 |
mth notNil ifTrue:[^mth]. |
13414 | 4352 |
|
4353 |
"Slow search..." |
|
13838
1d91d75691f0
changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
13600
diff
changeset
|
4354 |
dict do: [:each| |
1d91d75691f0
changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
13600
diff
changeset
|
4355 |
(each isSynthetic not and:[each name = name]) |
1d91d75691f0
changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
13600
diff
changeset
|
4356 |
ifTrue:[^each] |
1d91d75691f0
changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
13600
diff
changeset
|
4357 |
]. |
13414 | 4358 |
^exceptionValue value |
13419 | 4359 |
|
13414 | 4360 |
|
4361 |
" |
|
4362 |
Object compiledMethodNamed:#== |
|
4363 |
(Object compiledMethodNamed:#==) category |
|
4364 |
" |
|
4365 |
||
4366 |
"Created: / 24-08-2009 / 10:02:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4367 |
"Modified: / 28-06-2011 / 14:16:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13838
1d91d75691f0
changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
13600
diff
changeset
|
4368 |
"Modified (format): / 29-11-2011 / 11:20:08 / cg" |
13414 | 4369 |
! |
4370 |
||
9194 | 4371 |
containsMethod:aMethod |
4372 |
"Return true, if the argument, aMethod is a method of myself" |
|
4373 |
||
4374 |
|dict| |
|
4375 |
||
12094 | 4376 |
dict := self methodDictionary. |
9194 | 4377 |
dict isNil ifTrue:[^ false]. "degenerated class" |
4378 |
^ (dict keyAtValue:aMethod ifAbsent:[0]) ~~ 0 |
|
4379 |
||
4380 |
"Modified: 12.6.1996 / 13:33:53 / stefan" |
|
4381 |
! |
|
6727 | 4382 |
|
620 | 4383 |
hasMethods |
4384 |
"return true, if there are any (local) methods in this class" |
|
4385 |
||
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
4386 |
^ (self methodDictionary size ~~ 0) |
620 | 4387 |
|
293 | 4388 |
" |
620 | 4389 |
True hasMethods |
4390 |
True class hasMethods |
|
4391 |
" |
|
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
4392 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
4393 |
"Modified: 7.6.1996 / 15:43:09 / stefan" |
620 | 4394 |
! |
4395 |
||
4396 |
implements:aSelector |
|
4397 |
"return true, if the receiver implements aSelector. |
|
4398 |
(i.e. implemented in THIS class - NOT in a superclass). |
|
12302
656c61777a20
comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents:
12195
diff
changeset
|
4399 |
This is semantically equivalent to includesSelector: (which is ST/80/Squeak compatibility). |
983 | 4400 |
|
4401 |
Caveat: |
|
13419 | 4402 |
This simply checks for the selector being present in the classes |
4403 |
selector table - therefore, it does not care for ignoredMethods. |
|
4404 |
(but: you should not use this method for protocol-testing, anyway). |
|
983 | 4405 |
|
4406 |
Hint: |
|
13419 | 4407 |
Dont use this method to check if someone responds to a message - |
4408 |
use #canUnderstand: on the class or #respondsTo: on the instance |
|
4409 |
to do this." |
|
983 | 4410 |
|
4411 |
^ self includesSelector:aSelector |
|
620 | 4412 |
|
4413 |
" |
|
983 | 4414 |
notice: this is class protocol |
4415 |
||
12302
656c61777a20
comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents:
12195
diff
changeset
|
4416 |
True includesSelector:#ifTrue: |
656c61777a20
comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents:
12195
diff
changeset
|
4417 |
True includesSelector:#== |
656c61777a20
comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents:
12195
diff
changeset
|
4418 |
|
12094 | 4419 |
True implements:#ifTrue: |
4420 |
True implements:#== |
|
983 | 4421 |
|
4422 |
notice: this is instance protocol |
|
4423 |
||
12094 | 4424 |
true respondsTo:#ifTrue: |
4425 |
true respondsTo:#== |
|
983 | 4426 |
|
4427 |
notice: this is class protocol |
|
4428 |
||
12094 | 4429 |
True canUnderstand:#ifTrue: |
4430 |
True canUnderstand:#== |
|
620 | 4431 |
" |
983 | 4432 |
|
4433 |
"Modified: 10.2.1996 / 13:15:56 / cg" |
|
620 | 4434 |
! |
4435 |
||
9194 | 4436 |
includesSelector:aSelector |
9219 | 4437 |
"return true, if the methodDictionary of THIS class includes a method for aSelector. |
983 | 4438 |
(i.e. if aSelector is implemented in THIS class - NOT in a superclass). |
12302
656c61777a20
comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents:
12195
diff
changeset
|
4439 |
This is semantically equivalent to implements: (ST/80/Squeak compatibility). |
983 | 4440 |
|
4441 |
Hint: |
|
13419 | 4442 |
Dont use this method to check if someone responds to a message - |
4443 |
use #canUnderstand: on the class or #respondsTo: on the instance |
|
4444 |
to do this. |
|
12302
656c61777a20
comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents:
12195
diff
changeset
|
4445 |
|
656c61777a20
comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents:
12195
diff
changeset
|
4446 |
Caveat: |
13419 | 4447 |
This simply checks for the selector being present in the classes |
4448 |
selector table - therefore, it does not care for ignoredMethods. |
|
4449 |
(but: you should not use this method for protocol-testing, anyway)." |
|
4307 | 4450 |
|
10534 | 4451 |
^ self methodDictionary includesIdenticalKey:aSelector |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
4452 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
4453 |
" |
9219 | 4454 |
Object includesSelector:#== |
4455 |
Object includesSelector:#murks |
|
13372
d2e9922a9791
comment/format in: #includesSelector:
Stefan Vogel <sv@exept.de>
parents:
13318
diff
changeset
|
4456 |
Object includesSelector:nil |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
4457 |
" |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
4458 |
|
3882 | 4459 |
"Modified: / 7.6.1996 / 14:27:24 / stefan" |
4460 |
"Modified: / 16.10.1998 / 13:00:15 / cg" |
|
9194 | 4461 |
! |
4462 |
||
10085 | 4463 |
instAndClassMethods |
4464 |
^ (self theMetaclass methodDictionary values) , (self theNonMetaclass methodDictionary values) |
|
4465 |
||
4466 |
"Created: / 12-10-2006 / 18:36:57 / cg" |
|
4467 |
"Modified: / 12-10-2006 / 20:36:34 / cg" |
|
4468 |
! |
|
4469 |
||
9194 | 4470 |
lookupMethodFor:aSelector |
620 | 4471 |
"return the method, which would be executed if aSelector was sent to |
4472 |
an instance of the receiver. I.e. the selector arrays of the receiver |
|
4473 |
and all of its superclasses are searched for aSelector. |
|
4474 |
Return the method, or nil if instances do not understand aSelector. |
|
4475 |
EXPERIMENTAL: take care of multiple superclasses." |
|
4476 |
||
13419 | 4477 |
|l m cls| |
4478 |
||
4479 |
"JV @ 2010-08-22: Rewritten to respect lookup object." |
|
4480 |
(l := self lookupObject) notNil ifTrue:[ |
|
17891 | 4481 |
^ (l |
4482 |
lookupMethodForSelector:aSelector |
|
4483 |
directedTo:self |
|
4484 |
for: nil "fake receiver" |
|
4485 |
withArguments: nil "fake arguments" |
|
4486 |
from: thisContext sender |
|
4487 |
ilc: nil "fake ilc") |
|
13419 | 4488 |
]. |
620 | 4489 |
|
4490 |
cls := self. |
|
4491 |
[cls notNil] whileTrue:[ |
|
13419 | 4492 |
m := cls compiledMethodAt:aSelector. |
4493 |
m notNil ifTrue:[^ m]. |
|
4494 |
cls hasMultipleSuperclasses ifTrue:[ |
|
4495 |
cls superclasses do:[:aSuperClass | |
|
4496 |
m := aSuperClass lookupMethodFor:aSelector. |
|
4497 |
m notNil ifTrue:[^ m]. |
|
4498 |
]. |
|
4499 |
^ nil |
|
4500 |
] ifFalse:[ |
|
4501 |
cls := cls superclass |
|
4502 |
] |
|
620 | 4503 |
]. |
4504 |
^ nil |
|
17891 | 4505 |
|
4506 |
"Modified: / 28-10-2011 / 09:27:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
620 | 4507 |
! |
4508 |
||
6460 | 4509 |
responseTo:aSelector |
12094 | 4510 |
"return the method (from here or the inheritance chain), |
6460 | 4511 |
which implements aSelector; return nil if none." |
4512 |
||
4513 |
|cls| |
|
4514 |
||
4515 |
cls := self whichClassIncludesSelector:aSelector. |
|
4516 |
cls notNil ifTrue:[ |
|
13419 | 4517 |
^ cls compiledMethodAt:aSelector |
6460 | 4518 |
]. |
4519 |
^ nil |
|
4520 |
||
4521 |
" |
|
12094 | 4522 |
String responseTo:#== |
4523 |
String responseTo:#collect: |
|
4524 |
String responseTo:#, |
|
6460 | 4525 |
" |
4526 |
! |
|
4527 |
||
9194 | 4528 |
selectorAtMethod:aMethod |
4529 |
"Return the selector for given method aMethod." |
|
4530 |
||
4531 |
^ self selectorAtMethod:aMethod ifAbsent:[nil] |
|
4532 |
||
620 | 4533 |
" |
9194 | 4534 |
|m| |
4535 |
||
4536 |
m := Object compiledMethodAt:#copy. |
|
4537 |
Fraction selectorAtMethod:m. |
|
4538 |
" |
|
4539 |
" |
|
4540 |
|m| |
|
4541 |
||
4542 |
m := Object compiledMethodAt:#copy. |
|
4543 |
Object selectorAtMethod:m. |
|
4544 |
" |
|
356 | 4545 |
! |
4546 |
||
9194 | 4547 |
selectorAtMethod:aMethod ifAbsent:failBlock |
620 | 4548 |
"return the selector for given method aMethod |
4549 |
or the value of failBlock, if not found." |
|
4550 |
||
1814 | 4551 |
|md| |
4552 |
||
4553 |
md := self methodDictionary. |
|
4554 |
md isNil ifTrue:[ |
|
13419 | 4555 |
'OOPS - nil methodDictionary' errorPrintCR. |
4556 |
^ nil |
|
1814 | 4557 |
]. |
4558 |
^ md keyAtValue:aMethod ifAbsent:failBlock. |
|
216 | 4559 |
|
4560 |
" |
|
620 | 4561 |
|m| |
4562 |
||
4563 |
m := Object compiledMethodAt:#copy. |
|
4564 |
Object selectorAtMethod:m ifAbsent:['oops']. |
|
4565 |
" |
|
216 | 4566 |
" |
620 | 4567 |
|m| |
4568 |
||
4569 |
m := Object compiledMethodAt:#copy. |
|
4570 |
Fraction selectorAtMethod:m ifAbsent:['oops']. |
|
216 | 4571 |
" |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
4572 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1449
diff
changeset
|
4573 |
"Modified: 7.6.1996 / 15:15:45 / stefan" |
216 | 4574 |
! |
4575 |
||
2 | 4576 |
whichClassImplements:aSelector |
328 | 4577 |
"obsolete interface; |
4578 |
use whichClassIncludesSelector: for ST-80 compatibility." |
|
4579 |
||
9363 | 4580 |
<resource:#obsolete> |
4581 |
||
328 | 4582 |
^ self whichClassIncludesSelector:aSelector |
4583 |
! |
|
4584 |
||
4585 |
whichClassIncludesSelector:aSelector |
|
68 | 4586 |
"return the class in the inheritance chain, which implements the method |
4587 |
for aSelector; return nil if none. |
|
4588 |
EXPERIMENTAL: handle multiple superclasses" |
|
4589 |
||
4590 |
|cls| |
|
2 | 4591 |
|
68 | 4592 |
cls := self. |
4593 |
[cls notNil] whileTrue:[ |
|
13419 | 4594 |
(cls includesSelector:aSelector) ifTrue:[^ cls]. |
4595 |
cls hasMultipleSuperclasses ifTrue:[ |
|
4596 |
cls superclasses do:[:aSuperClass | |
|
4597 |
|implementingClass| |
|
4598 |
||
4599 |
implementingClass := aSuperClass whichClassIncludesSelector:aSelector. |
|
4600 |
implementingClass notNil ifTrue:[^ implementingClass]. |
|
4601 |
]. |
|
4602 |
^ nil |
|
4603 |
] ifFalse:[ |
|
4604 |
cls := cls superclass |
|
4605 |
] |
|
2 | 4606 |
]. |
4607 |
^ nil |
|
4608 |
||
91 | 4609 |
" |
328 | 4610 |
String whichClassIncludesSelector:#== |
4611 |
String whichClassIncludesSelector:#collect: |
|
91 | 4612 |
" |
6727 | 4613 |
! ! |
4614 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
4615 |
|
6931 | 4616 |
!Behavior methodsFor:'queries-variables'! |
6727 | 4617 |
|
4618 |
allClassVarNames |
|
4619 |
"return a collection of all the class variable name-strings |
|
4620 |
this includes all superclass-class variables" |
|
4621 |
||
4622 |
^ self addAllClassVarNamesTo:(OrderedCollection new) |
|
4623 |
||
4624 |
" |
|
4625 |
Float allClassVarNames |
|
4626 |
" |
|
4627 |
||
4628 |
"Modified: 16.4.1996 / 18:01:00 / cg" |
|
4629 |
! |
|
4630 |
||
4631 |
allInstVarNames |
|
4632 |
"return a collection of all the instance variable name-strings |
|
4633 |
this includes all superclass-instance variables. |
|
4634 |
Instvars of superclasses come first (i.e. the position matches |
|
4635 |
the instVarAt:-index)." |
|
4636 |
||
4637 |
self superclass isNil ifTrue:[^ self instVarNames]. |
|
4638 |
^ self addAllInstVarNamesTo:(OrderedCollection new) |
|
4639 |
||
4640 |
" |
|
12094 | 4641 |
Dictionary instVarNames |
4642 |
Dictionary allInstVarNames |
|
6727 | 4643 |
" |
4644 |
||
4645 |
"Modified: 16.4.1996 / 18:03:55 / cg" |
|
4646 |
! |
|
4647 |
||
4648 |
allInstanceVariableNames |
|
4649 |
"alias for allInstVarNames" |
|
4650 |
||
4651 |
^ self allInstVarNames |
|
4652 |
! |
|
4653 |
||
4654 |
classVarNames |
|
4655 |
"return a collection of the class variable name-strings. |
|
4656 |
Returning empty here, since Behavior does not define any classVariables. |
|
4657 |
(only Classes do). This allows different Behavior-like objects |
|
4658 |
(alien classes) to be handled by the browser as well." |
|
4659 |
||
4660 |
^ #() |
|
4661 |
||
4662 |
"Created: 16.4.1996 / 17:57:31 / cg" |
|
4663 |
! |
|
4664 |
||
4665 |
classVariableString |
|
4666 |
"return a string of the class variables names. |
|
4667 |
Returning empty here, since Behavior does not define any classVariables. |
|
4668 |
(only Classes do). This allows different Behavior-like objects |
|
4669 |
(alien classes) to be handled by the browser as well." |
|
4670 |
||
4671 |
^ '' |
|
4672 |
||
4673 |
"Created: 16.4.1996 / 16:28:56 / cg" |
|
4674 |
! |
|
4675 |
||
9445 | 4676 |
instVarNameForIndex:index |
4677 |
"Behavior does not provide this info - generate synthetic names." |
|
4678 |
||
4679 |
^ '* instVar' , index printString , ' *' |
|
4680 |
||
4681 |
"Created: / 17-07-2006 / 00:28:24 / cg" |
|
4682 |
! |
|
4683 |
||
6727 | 4684 |
instVarNames |
4685 |
"Behavior does not provide this info - generate synthetic names." |
|
4686 |
||
4687 |
|superclass superInsts| |
|
4688 |
||
4689 |
superclass := self superclass. |
|
4690 |
superclass isNil ifTrue:[ |
|
13419 | 4691 |
superInsts := 0 |
6727 | 4692 |
] ifFalse:[ |
13419 | 4693 |
superInsts := superclass instSize |
6727 | 4694 |
]. |
12094 | 4695 |
^ (superInsts+1 to:self instSize) |
9445 | 4696 |
collect:[:index | self instVarNameForIndex:index] |
4697 |
||
4698 |
"Modified: / 17-07-2006 / 00:28:40 / cg" |
|
6727 | 4699 |
! |
4700 |
||
4701 |
instanceVariableNames |
|
4702 |
"alias for instVarNames." |
|
4703 |
||
4704 |
^ self instVarNames |
|
12794
ccfaa18fac96
comment/format in: #instanceVariableNames
Claus Gittinger <cg@exept.de>
parents:
12359
diff
changeset
|
4705 |
|
ccfaa18fac96
comment/format in: #instanceVariableNames
Claus Gittinger <cg@exept.de>
parents:
12359
diff
changeset
|
4706 |
" |
ccfaa18fac96
comment/format in: #instanceVariableNames
Claus Gittinger <cg@exept.de>
parents:
12359
diff
changeset
|
4707 |
Point instanceVariableNames |
ccfaa18fac96
comment/format in: #instanceVariableNames
Claus Gittinger <cg@exept.de>
parents:
12359
diff
changeset
|
4708 |
" |
6727 | 4709 |
! |
4710 |
||
4711 |
instanceVariableString |
|
4712 |
"return a string with dummy names here - typically, your |
|
8857 | 4713 |
objects are instances of Class, not Behavior, |
4714 |
so this is only invoked for very artificial behaviors." |
|
4715 |
||
4716 |
|superclass s superInsts first n "{Class: SmallInteger }"| |
|
6727 | 4717 |
|
4718 |
superclass := self superclass. |
|
4719 |
s := ''. |
|
4720 |
superclass isNil ifTrue:[ |
|
13419 | 4721 |
superInsts := 0 |
6727 | 4722 |
] ifFalse:[ |
13419 | 4723 |
superInsts := superclass instSize |
6727 | 4724 |
]. |
4725 |
n := self instSize. |
|
8857 | 4726 |
first := true. |
6727 | 4727 |
superInsts+1 to:n do:[:i | |
13419 | 4728 |
first ifFalse:[s := s , ' '] ifTrue:[first := false]. |
4729 |
||
4730 |
s := s , 'instvar' , i printString |
|
6727 | 4731 |
]. |
4732 |
^ s |
|
4733 |
||
4734 |
" |
|
12094 | 4735 |
Behavior new instanceVariableString |
4736 |
(Behavior new instSize:2) instanceVariableString |
|
6727 | 4737 |
" |
4738 |
||
4739 |
"Modified: 7.5.1996 / 12:50:25 / cg" |
|
4740 |
"Modified: 3.6.1996 / 16:03:33 / stefan" |
|
4741 |
! |
|
4742 |
||
12862
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
4743 |
whichClassDefinesClassVar:aStringOrText |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
4744 |
|name| |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
4745 |
|
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
4746 |
name := aStringOrText asString string. |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
4747 |
^ self whichClassSatisfies:[:aClass | aClass classVarNames includes:name] |
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
4748 |
|
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
4749 |
" |
13419 | 4750 |
TextView whichClassDefinesClassVar:'CachedScales' |
4751 |
TextView whichClassDefinesClassVar:'xxx' |
|
12862
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
4752 |
" |
6727 | 4753 |
! |
4754 |
||
12094 | 4755 |
whichClassDefinesInstVar: aString |
12862
aab829fab334
comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents:
12858
diff
changeset
|
4756 |
^ self whichClassSatisfies: [:aClass | aClass instVarNames includes: aString] |
6727 | 4757 |
! |
4758 |
||
12094 | 4759 |
whichSelectorsAssign: instVarName |
13419 | 4760 |
"Answer a set of selectors whose methods write the argument, instVarName, |
4761 |
as a named instance variable." |
|
4762 |
||
4763 |
^ self whichSelectorsWrite: instVarName |
|
6727 | 4764 |
! |
4765 |
||
12094 | 4766 |
whichSelectorsRead: instVarName |
14239 | 4767 |
"Answer a set of selectors whose methods read the argument, instVarName, |
4768 |
as a named instance variable." |
|
4769 |
||
4770 |
"/ | instVarIndex methodDict| |
|
4771 |
"/ instVarIndex := self allInstVarNames indexOf: instVarName ifAbsent: [^Set new]. |
|
4772 |
"/ methodDict := self methodDictionary. |
|
4773 |
"/ ^methodDict keys select: [:sel | (methodDict at: sel) |
|
4774 |
"/ readsField: instVarIndex] |
|
4775 |
||
4776 |
| methodDict | |
|
4777 |
methodDict := self methodDictionary. |
|
4778 |
^ methodDict keys |
|
4779 |
select: [:sel | (methodDict at: sel) readsInstVar: instVarName] |
|
4780 |
||
4781 |
"Modified: / 23-07-2012 / 11:22:04 / cg" |
|
2 | 4782 |
! |
4783 |
||
9194 | 4784 |
whichSelectorsReferTo:someLiteralConstant |
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4785 |
"return a collection of selectors of methods which refer to the argument. |
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4786 |
Search the literal arrays of my methods to do this." |
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4787 |
|
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4788 |
|setOfSelectors| |
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4789 |
|
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4790 |
setOfSelectors := IdentitySet new. |
6395
2ad7a8e870ab
instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents:
6329
diff
changeset
|
4791 |
self methodDictionary keysAndValuesDo:[:sel :mthd | |
13419 | 4792 |
(mthd referencesLiteral:someLiteralConstant) ifTrue:[ |
4793 |
setOfSelectors add:sel |
|
4794 |
]. |
|
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4795 |
]. |
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4796 |
|
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4797 |
^ setOfSelectors |
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4798 |
|
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4799 |
" |
12094 | 4800 |
String whichSelectorsReferTo:#at: |
4801 |
String whichSelectorsReferTo:CharacterArray |
|
3053
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4802 |
" |
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4803 |
|
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4804 |
"Modified: / 28.10.1997 / 13:13:18 / cg" |
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4805 |
! |
d6aad366397f
added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4806 |
|
5297 | 4807 |
whichSelectorsReferToClassVariable:nameOfClassVariable |
4808 |
"return a collection of selectors of methods which refer to the argument. |
|
4809 |
Search the literal arrays of my methods to do this." |
|
4810 |
||
10413 | 4811 |
^ self whichSelectorsReferToGlobal:(self theNonMetaclass globalKeyForClassVar:nameOfClassVariable) |
5297 | 4812 |
|
4813 |
" |
|
4814 |
Object whichSelectorsReferToClassVariable:#Dependencies |
|
4815 |
" |
|
4816 |
||
10185 | 4817 |
"Modified: / 18-11-2006 / 17:14:08 / cg" |
5297 | 4818 |
! |
4819 |
||
4820 |
whichSelectorsReferToGlobal:nameOfGlobal |
|
4821 |
"return a collection of selectors of methods which refer to the argument. |
|
4822 |
Search the literal arrays of my methods to do this." |
|
4823 |
||
4824 |
|internalNameOfVar| |
|
4825 |
||
4826 |
internalNameOfVar := nameOfGlobal asSymbol. |
|
4827 |
^ self whichSelectorsReferTo:internalNameOfVar |
|
4828 |
||
4829 |
" |
|
4830 |
Object whichSelectorsReferToGlobal:#Debugger |
|
4831 |
" |
|
4832 |
||
4833 |
"Modified: / 4.2.2000 / 00:41:10 / cg" |
|
4834 |
! |
|
4835 |
||
12094 | 4836 |
whichSelectorsWrite: instVarName |
14239 | 4837 |
"Answer a set of selectors whose methods write the argument, instVarName, |
4838 |
as a named instance variable." |
|
4839 |
||
4840 |
"/ | instVarIndex methodDict | |
|
4841 |
"/ instVarIndex := self allInstVarNames indexOf: instVarName ifAbsent: [^Set new]. |
|
4842 |
"/ methodDict := self methodDictionary. |
|
4843 |
"/ ^methodDict keys select: [:sel | (methodDict at: sel) |
|
4844 |
"/ writesField: instVarIndex] |
|
4845 |
| methodDict | |
|
4846 |
methodDict := self methodDictionary. |
|
4847 |
^ methodDict keys |
|
4848 |
select: [:sel | (methodDict at: sel) writesInstVar: instVarName] |
|
4849 |
||
4850 |
"Modified: / 23-07-2012 / 11:21:17 / cg" |
|
2 | 4851 |
! ! |
620 | 4852 |
|
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
4853 |
|
620 | 4854 |
!Behavior methodsFor:'snapshots'! |
4855 |
||
9194 | 4856 |
postSnapshot |
4857 |
"sent by ObjectMemory to all classes, after a snapshot has been written. |
|
4858 |
Nothing done here. This can be redefined in classes which like to know |
|
4859 |
about snapshooting." |
|
4860 |
||
4861 |
"Modified: 16.4.1996 / 18:12:08 / cg" |
|
4862 |
! |
|
9189
3fbc934d46a9
readFromString: - allow for whitespace following the string
Claus Gittinger <cg@exept.de>
parents:
8962
diff
changeset
|
4863 |
|
3fbc934d46a9
readFromString: - allow for whitespace following the string
Claus Gittinger <cg@exept.de>
parents:
8962
diff
changeset
|
4864 |
preSnapshot |
3fbc934d46a9
readFromString: - allow for whitespace following the string
Claus Gittinger <cg@exept.de>
parents:
8962
diff
changeset
|
4865 |
"sent by ObjectMemory to all classes, before a snapshot is written. |
1192
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
4866 |
Nothing done here. This can be redefined in classes which like to know |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
4867 |
about snapshooting." |
b1c2b886f23c
moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
4868 |
|
9189
3fbc934d46a9
readFromString: - allow for whitespace following the string
Claus Gittinger <cg@exept.de>
parents:
8962
diff
changeset
|
4869 |
"Modified: 16.4.1996 / 18:12:14 / cg" |
620 | 4870 |
! ! |
4871 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
4872 |
|
4657
ace3dc642424
added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents:
4636
diff
changeset
|
4873 |
!Behavior methodsFor:'tracing'! |
ace3dc642424
added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents:
4636
diff
changeset
|
4874 |
|
9194 | 4875 |
traceInto:aRequestor level:level from:referrer |
4876 |
"double dispatch into tracer, passing my type implicitely in the selector" |
|
4877 |
||
4878 |
^ aRequestor traceBehavior:self level:level from:referrer |
|
4879 |
||
4880 |
||
4657
ace3dc642424
added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents:
4636
diff
changeset
|
4881 |
! ! |
ace3dc642424
added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents:
4636
diff
changeset
|
4882 |
|
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
4883 |
|
9194 | 4884 |
!Behavior methodsFor:'visiting'! |
4885 |
||
4886 |
acceptVisitor:aVisitor with:aParameter |
|
8398
666ef609ec93
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8353
diff
changeset
|
4887 |
|
666ef609ec93
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8353
diff
changeset
|
4888 |
^ aVisitor visitBehavior:self with:aParameter |
666ef609ec93
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8353
diff
changeset
|
4889 |
! ! |
666ef609ec93
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8353
diff
changeset
|
4890 |
|
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
4891 |
|
1760 | 4892 |
!Behavior class methodsFor:'documentation'! |
662 | 4893 |
|
13839
95b353c4d5f1
changed: #setTraitComposition:
Claus Gittinger <cg@exept.de>
parents:
13838
diff
changeset
|
4894 |
version |
14990 | 4895 |
^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.333 2013-03-28 15:54:34 stefan Exp $' |
13839
95b353c4d5f1
changed: #setTraitComposition:
Claus Gittinger <cg@exept.de>
parents:
13838
diff
changeset
|
4896 |
! |
95b353c4d5f1
changed: #setTraitComposition:
Claus Gittinger <cg@exept.de>
parents:
13838
diff
changeset
|
4897 |
|
12113
6fbe0157e258
changed: #definitionSelectors
Claus Gittinger <cg@exept.de>
parents:
12094
diff
changeset
|
4898 |
version_CVS |
14990 | 4899 |
^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.333 2013-03-28 15:54:34 stefan Exp $' |
662 | 4900 |
! ! |
14703 | 4901 |