--- a/Behavior.st Wed Feb 21 12:32:23 1996 +0100
+++ b/Behavior.st Wed Feb 21 13:35:16 1996 +0100
@@ -1368,7 +1368,7 @@
nInstVars = _intVal(_INST(instSize));
instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
- newobj = (OBJ) newNextPtr;
+ newobj = (OBJ) __newNextPtr;
nextPtr = ((char *)newobj) + instsize;
/*
@@ -1376,18 +1376,18 @@
* an extra nil-compare and branch in the common case ...
* (i.e. if no GC is needed, we fall through without a branch)
*/
- if (nextPtr < newEndPtr) {
+ if (nextPtr < __newEndPtr) {
_objPtr(newobj)->o_size = instsize;
/* o_allFlags(newobj) = 0; */
- /* _objPtr(newobj)->o_space = newSpace; */
- o_setAllFlags(newobj, newSpace);
+ /* _objPtr(newobj)->o_space = __newSpace; */
+ o_setAllFlags(newobj, __newSpace);
#ifdef ALIGN4
- newNextPtr = nextPtr;
+ __newNextPtr = nextPtr;
#else
if (instsize & (ALIGN-1)) {
- newNextPtr = (char *)newobj + (instsize & ~(ALIGN-1)) + ALIGN;
+ __newNextPtr = (char *)newobj + (instsize & ~(ALIGN-1)) + ALIGN;
} else {
- newNextPtr = nextPtr;
+ __newNextPtr = nextPtr;
}
#endif
@@ -2409,6 +2409,26 @@
"
View derivedInstanceCount
SequenceableCollection derivedInstanceCount
+ Object derivedInstanceCount
+ "
+!
+
+hasDerivedInstances
+ "return true, if there are any instances of myself or of any subclass"
+
+ "Read the documentation on why there seem to be no
+ instances of SmallInteger and UndefinedObject"
+
+ ObjectMemory allObjectsDo:[:anObject |
+ (anObject isKindOf:self) ifTrue:[
+ ^ true
+ ]
+ ].
+ ^ false
+
+ "
+ Object hasDerivedInstances - certainly true
+ SharedQueue hasDerivedInstances
"
!
@@ -2423,8 +2443,9 @@
"/ ^ true
"/ ]
"/ ].
+
ObjectMemory allInstancesOf:self do:[:anObject |
- ^ true
+ ^ true
].
^ false
@@ -2459,22 +2480,50 @@
implements:aSelector
"return true, if the receiver implements aSelector.
(i.e. implemented in THIS class - NOT in a superclass).
- Dont use this method to check if someone responds to a message -
- use #canUnderstand: on the class or #respondsTo: on the instance
- to do this."
-
- ^ (selectorArray identityIndexOf:aSelector startingAt:1) ~~ 0
+
+ Caveat:
+ This simply checks for the selector being present in the classes
+ selector table - therefore, it does not care for ignoredMethods.
+ (but: you should not use this method for protocol-testing, anyway).
+
+ Hint:
+ Dont use this method to check if someone responds to a message -
+ use #canUnderstand: on the class or #respondsTo: on the instance
+ to do this."
+
+ ^ self includesSelector:aSelector
"
- True implements:#ifTrue:
- True implements:#==
+ notice: this is class protocol
+
+ True implements:#ifTrue:
+ True implements:#==
+
+ notice: this is instance protocol
+
+ true respondsTo:#ifTrue:
+ true respondsTo:#==
+
+ notice: this is class protocol
+
+ True canUnderstand:#ifTrue:
+ True canUnderstand:#==
"
+
+ "Modified: 10.2.1996 / 13:15:56 / cg"
!
includesSelector:aSelector
- "for ST-80 compatibility"
-
- ^ self implements:aSelector
+ "return true, if the methodArray of THIS class includes
+ a method for aSelector.
+ (i.e. if aSelector is implemented in THIS class - NOT in a superclass).
+
+ Hint:
+ Dont use this method to check if someone responds to a message -
+ use #canUnderstand: on the class or #respondsTo: on the instance
+ to do this."
+
+ ^ (selectorArray identityIndexOf:aSelector startingAt:1) ~~ 0
!
inheritsFrom:aClass
@@ -2502,6 +2551,7 @@
"/ count := count + 1
"/ ]
"/ ].
+
ObjectMemory allInstancesOf:self do:[:anObject |
count := count + 1
].
@@ -2906,7 +2956,7 @@
cls := self.
[cls notNil] whileTrue:[
- (cls implements:aSelector) ifTrue:[^ cls].
+ (cls includesSelector:aSelector) ifTrue:[^ cls].
cls hasMultipleSuperclasses ifTrue:[
cls superclasses do:[:aSuperClass |
|implementingClass|
@@ -2978,5 +3028,5 @@
!Behavior class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.63 1996-01-05 12:33:03 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.64 1996-02-21 12:35:08 cg Exp $'
! !