|
|
Class: Behavior
Object
|
+--Behavior
|
+--ClassDescription
- Package:
- stx:libbasic
- Category:
- Kernel-Classes
- Version:
- rev:
1.304
date: 2010/04/12 16:30:42
- user: cg
- file: Behavior.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Claus Gittinger
Every class in the system inherits from Behavior (via Class, ClassDescription);
so here is where most of the class messages end up being implemented.
(to answer a FAQ: 'Point basicNew' will be done here :-)
Beginners should keep in mind, that all classes are instances (of subclasses)
of Behavior, therefore you will find the above mentioned 'basicNew:' method
under the 'instance'-methods of Behavior - NOT under the class methods
('Behavior new' will create and return a new class, while sending 'new' to
any instance of Behavior (i.e. any class) will return an instance of that class).
Behavior provides minimum support for all classes - additional stuff is
found in ClassDescription and Class. Behaviors provides all mechanisms needed
to create instances, and send messages to those. However, Behavior does not provide
all the (symbolic) information needed to compile methods for a class or to get
useful information in inspectors.
for experts:
Since instances of Behavior provide all that is needed to interact with the VM's
message dispatch mechanism, these can be used as 'light weight' classes.
I.e. it is possible, to generate completely anonymous classes (and instances thereof)
on the fly - 'Behavior new new' is such a thingy.
The selectors and Methods are organized in a MethodDictionary (which is not a true
dictionary, but an Array with alternating selector/method entries).
This avoids the need for knowledge about Dictionaries in the runtime library (VM)
(lookup and search in these is seldom anyway, so the added benefit from using a
hashed dictionary is almost void).
[Instance variables:]
superclass <Class> the receivers superclass
methodDictionary <MethodDictionary> inst-selectors and methods
instSize <SmallInteger> the number of instance variables
flags <SmallInteger> special flag bits coded in a number
not for application use
flag bits (see stc.h):
NOTICE: layout known by compiler and runtime system; be careful when changing
Class
ClassDescription
Metaclass
Method
MethodDictionary
creating new classes
-
new
-
creates and return a new behavior (which is like a class,
but without the symbolic & name information).
Not for normal applications.
Sending the returned behavior the #new message gives you
an instance if it.
Notice: the returned class is given a superclass of Object;
this allows for its new instances to be inspected and the like.
flag bit constants
-
flagBehavior
-
return the flag code which marks Behavior-like instances.
Inline C-code and the VM check this single bit in the flag value when
checking for behaviors.
-
flagBlock
-
return the flag code which marks Block-like instances.
The VM checks for either this bit or the blockLike bit in the flag
value when checking for blocks to be evaluated from bytecodes.
However, compiled code only checks for the block bit.
-
flagBlockContext
-
return the flag code which marks BlockContext-like instances.
The VM checks this single bit in the flag value when
checking for blockContexts.
-
flagBlockLike
-
return the flag code which marks Block-like instances
with respect to byteCode interpretation.
The VM checks for either this bit or the block bit in the flag
value when checking for blocks to be evaluated from bytecodes.
However, compiled code only checks for the block bit.
-
flagBytes
-
return the flag code for byte-valued indexed instances.
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for byte valued
variable instances.
-
flagContext
-
return the flag code which marks Context-like instances.
The VM checks this single bit in the flag value when
checking for contexts.
-
flagDoubles
-
return the flag code for double-valued indexed instances (i.e. 8-byte reals).
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for double valued
variable instances.
-
flagExternalBytes
-
return the flag code which marks ExternalBytes-like instances.
Inline C-code and the VM check this single bit in the flag value when
checking for an externalBytes-like objet.
-
flagFloat
-
return the flag code which marks Float-like instances.
Inline C-code and the VM check this single bit in the flag value when
checking for a float.
-
flagFloats
-
return the flag code for float-valued indexed instances (i.e. 4-byte reals).
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for double valued
variable instances.
-
flagForSymbolic: aSymbol
-
return the flag code for indexed instances with aSymbolic type.
The argument may be one of
#float, #double,
#word, #signedWord,
#long, #signedLong
#longLong, #signedLongLong,
#byte
#weakObjects
For VW compatibility, also accept:
#objects, #bytes, #weak.
-
flagJavaClass
-
return the flag code which marks JavaClass-like instances.
The VM checks this single bit in the flag value when
checking for a javaClass.
-
flagJavaMethod
-
return the flag code which marks JavaMethod-like instances.
Inline C-code and the VM check this single bit in the flag value when
checking for a method.
-
flagLongLongs
-
return the flag code for longlong-valued indexed instances (i.e. 8-byte).
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for
unsigned long valued variable instances.
-
flagLongs
-
return the flag code for long-valued indexed instances (i.e. 4-byte).
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for
unsigned long valued variable instances.
-
flagMetaMethod
-
return the flag code which marks MetaMethod-like instances.
Inline C-code and the VM check this single bit in the flag value when
about to evaluate a method.
-
flagMethod
-
return the flag code which marks Method-like instances.
Inline C-code and the VM check this single bit in the flag value when
checking for a method.
-
flagNonObjectInst
-
return the flag code which marks instances which have a
non-object instance variable (in slot 1).
(these are ignored by the garbage collector)
-
flagNotIndexed
-
return the flag code for non-indexed instances.
You have to mask the flag value with indexMask when comparing
it with flagNotIndexed.
-
flagPointers
-
return the flag code for pointer indexed instances (i.e. Array of object).
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for
pointer variable instances.
-
flagRegular
-
return the flag code which marks regular instances.
-
flagSignedLongLongs
-
return the flag code for signed longlong-valued indexed instances (i.e. 8-byte).
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for
signed long valued variable instances.
-
flagSignedLongs
-
return the flag code for signed long-valued indexed instances (i.e. 4-byte).
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for
signed long valued variable instances.
-
flagSignedWords
-
return the flag code for signed word-valued indexed instances (i.e. 2-byte).
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for
signed word valued variable instances.
-
flagSymbol
-
return the flag code which marks Symbol-like instances.
Inline C-code and the VM check this single bit in the flag value when
checking for symbols.
-
flagWeak
-
return the flag code for weak-object-pointer indexed instances.
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for
weak pointer variable instances.
-
flagWeakPointers
-
return the flag code for weak pointer indexed instances (i.e. WeakArray).
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for weak pointers.
-
flagWords
-
return the flag code for word-valued indexed instances (i.e. 2-byte).
The VM masks the flag value with the indexMask (maskIndexType)
and compares it to this flag value, when checking for
unsigned word valued variable instances.
-
maskIndexType
-
return a mask to extract all index-type bits
helpers
-
classesSortedByLoadOrder: someClasses
-
return a copy of the given collection of classes, which is sorted
by inheritance and superclass-of-any-private class.
This is the optimal order for loading, and the required order for compilation
-
commonSuperclassOf: listOfClassesOrClassNames
-
given a list of classes, return the common superclass.
A helper for the browser, some dialogs and some refactorings
misc
-
autoload
-
for compatibility with autoloaded classes - dummy here
queries
-
definitionSelectorFirstParts
-
return a collection of partial class-definition selectors
-
definitionSelectors
-
return a collection class-definition selectors
-
isBuiltInClass
-
return true if this class is known by the run-time-system.
Here, true is returned for myself, false for subclasses.
Camp Smalltalk
-
sunitAllSelectors
-
-
sunitSelectors
-
Compatibility-Dolphin
-
allSubinstances
-
Compatibility method - do not use in new code.
Same as allSubInstances; added for Dolphin compatibility
-
fromString: aString
-
reconstruct an instance of myself from the ascii-store string.
These bytes are typically the result from storing into a string/stream.
Same as readFrom:, for Dolphin compatibility.
-
guid: aUUID
-
Compatibility method - do not use in new code.
An ignored dummy; for Dolphin compatibility.
-
lookupMethod: selector
-
Compatibility method - do not use in new code.
Return the method for given selector aSelector or nil.
Only methods in the receiver - not in the superclass chain are returned.
For dolphin compatibility.
TODO: fixme if I am wrong, and dolphin does a full lookup here. If that is the case,
change to use lookupMethodFor:aSelector below.
Compatibility-Squeak
-
classComment: comment stamp: commentStamp
-
-
defaultNameStemForInstances
-
Answer a basis for names of default instances of the receiver
-
kindOfSubclass
-
Answer a String that is the keyword that describes the receiver's kind
of subclass, either a regular subclass, a variableSubclass, a
variableByteSubclass, a variableWordSubclass, or a weakSubclass.
-
lookupSelector: aSelector
-
return the method for a selector - Squeak compatibility
-
selectorsWithArgs: numberOfArgs
-
Return all selectors defined in this class that take this number of arguments.
Compatibility-VW
-
>> aSelector
-
return the method stored under the given selector; nil if there is none
-
fixedFieldsMask
-
Mask on the format word to indicate the number of fixed fields in instances
of a behavior. If this is non-zero, the behavior must be pointer-type
-
format
-
Answer an Integer that encodes the kinds and numbers of
variables of instances of the receiver.
See instSize method for reference to the fixedFieldsMask bit mask of the format.
See isVariable method for reference to the indexableMask bit mask of the format.
See isBits method for reference to the pointersMask bit mask of the format.
All other bits of the format are unused and should be 0.
-
getMethodDictionary
-
ST 80 compatibility: return the receivers method dictionary.
-
instanceBehavior
-
Answer the instance behavior of the receiver.
This is the receiver for non metaclasses.
Metaclass overrides this to answer a Metaclass's sole instance.
Same as #theNonMetaclass - for VW compatibility
-
shortName
-
Javascript support
-
js_new
-
redefinable JS-new
-
js_new: argument
-
redefinable JS-new:
accessing
-
addSelector: newSelector withMethod: newMethod
-
add the method given by 2nd argument under the selector given by
1st argument to the methodDictionary. Flushes all caches.
-
basicAddSelector: newSelector withMethod: newMethod
-
add the method given by 2nd argument under the selector given by
1st argument to the methodDictionary. Flushes all caches.
-
basicRemoveSelector: aSelector
-
remove the selector, aSelector and its associated method
from the methodDictionary
-
flags
-
return the receivers flag bits
-
instSize
-
return the number of instance variables of the receiver.
This includes all superclass instance variables.
-
lookupObject
-
return the lookupObject (Jan's MetaObjectProtocol support) or nil.
If non-nil, no lookup is performed by the VM, instead the lookupObject
has to provide a method object for message sends.
-
methodDictionary
-
return the receivers method dictionary.
-
methodDictionary: dict
-
set the receivers method dictionary and flush inline caches.
-
package
-
for protocol compatibility with class
-
removeSelector: aSelector
-
remove the selector, aSelector and its associated method
from the methodDictionary
-
selectors
-
return the receivers selector array as an orderedCollection.
Notice: this may not be compatible with ST-80.
(should we return a Set ?)
-
setLookupObject: aMethodLookupObject
-
set the lookupObject (Jan's MetaObjectProtocol support) or nil.
If non-nil, no lookup is performed by the VM, instead the lookupObject
has to provide a method object for message sends.
-
superclass
-
return the receivers superclass
autoload check
-
autoload
-
force autoloading - do nothing here;
redefined in Autoload; see comment there
-
isLoaded
-
return true, if the class has been loaded;
redefined in Autoload; see comment there
-
wasAutoloaded
-
return true, if this class came into the system via an
autoload; false otherwise.
Returning false here. This allows different Behavior-like objects
(alien classes) to be handled by the browser as well.
binary storage
-
binaryDefinitionFrom: stream manager: manager
-
sent during a binary read by the input manager.
Read the definition on an empty instance (of my class) from stream.
All pointer instances are left nil, while all bits are read in here.
return the new object.
-
fromBinaryStoreBytes: bytes
-
reconstruct an instance of myself from the binary-store bytes.
These bytes are typically the result from binaryStoring into a byteArray.
I.e. this is the reverse operation to #binaryStoreBytes
-
readBinaryFrom: aStream
-
read an objects binary representation from the argument,
aStream and return it.
The read object must be a kind of myself, otherwise an error is raised.
To get any object, use 'Object readBinaryFrom:...',
To get any number, use 'Number readBinaryFrom:...' and so on.
This is the reverse operation to 'storeBinaryOn:'.
-
readBinaryFrom: aStream onError: exceptionBlock
-
read an objects binary representation from the argument,
aStream and return it.
The read object must be a kind of myself, otherwise the value of
the exceptionBlock is returned.
To get any object, use 'Object readBinaryFrom:...',
To get any number, use 'Number readBinaryFrom:...' and so on.
This is the reverse operation to 'storeBinaryOn:'.
-
storeBinaryDefinitionOn: stream manager: manager
-
binary store of a classes definition.
Classes will store the name only and restore by looking for
that name in the Smalltalk dictionary.
This is an internal interface for the binary storage mechanism.
compiler interface
-
browserClass
-
return the browser to use for this class -
this can be redefined in special classes, to get different browsers
-
compilerClass
-
return the compiler to use for this class -
this can be redefined in special classes, to compile classes with
Lisp, Prolog, ASN1, Basic :-) or whatever syntax.
-
evaluatorClass
-
return the compiler to use for expression evaluation for this class -
this can be redefined in special classes, to evaluate expressions with
Lisp, Prolog, ASN1, Basic :-) or whatever syntax.
-
formatterClass
-
return the parser to use for formatting (prettyPrinting) this class -
this can be redefined in special classes, to format classes with
Lisp, Prolog, ASN1, Basic :-) or whatever syntax.
-
language
-
-
parserClass
-
return the parser to use for parsing this class -
this can be redefined in special classes, to parse classes with
Lisp, Prolog, ASN1, Basic :-) or whatever syntax.
-
programmingLanguage
-
-
subclassDefinerClass
-
Answer an evaluator class appropriate for evaluating definitions of new
subclasses of this class.
-
syntaxHighlighterClass
-
return the class to use for syntaxHighlighting (prettyPrinting) this class -
this can be redefined in special classes, to highlight classes with
Lisp, Prolog, ASN1, Basic :-) or whatever syntax.
compiling
-
compile: code notifying: requestor
-
compile code, aString for this class; on any error, notify
requestor, anObject with the error reason.
Returns the new method or nil (on failure).
copying
-
canCloneFrom: anObject
-
return true, if this class can clone an obsolete object as retrieved
by a binary load. Subclasses which do not want to have obsolete objects
be converted, should redefine this method to return false.
(However, conversion is never done silently in a binary load; you
have to have a handler for the binaryload errors and for the conversion
request signal.)
-
cloneFrom: aPrototype
-
return an instance of myself with variables initialized from
a prototype. This is used when instances of obsolete classes are
binary loaded and a conversion is done on the obsolete object.
UserClasses may redefine this for better conversions.
-
deepCopyUsing: aDictionary postCopySelector: postCopySelector
-
return a deep copy of the receiver
- return the receiver here - time will show if this is ok
-
simpleDeepCopy
-
return a deep copy of the receiver
- return the receiver here - time will show if this is ok
dummy changes management
-
addChangeRecordForClassRemove: aClassName
-
add a change record that some class has been removed.
Defined as dummy here, since Behavior does not know about change management.
(only Classes do). This allows different Behavior-like objects
(alien classes) to be handled by the browser as well.
dummy fileOut
-
fileOutDefinitionOn: aStream
-
dummy fileOut defined here.
This allows different Behavior-like objects
(alien classes) to be handled by the browser as well.
enumerating
-
allDerivedInstancesDo: aBlock
-
evaluate aBlock for all of my instances and all instances of subclasses.
This method is going to be removed for protocol compatibility with
other STs; use allSubInstancesDo:
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
allInstancesDo: aBlock
-
evaluate aBlock for all of my instances
-
allOwningclassesDo: aBlock
-
evaluate aBlock for all of my owners (i.e. owner, owner-of-owner etc).
-
allSelectorsAndMethodsDo: aTwoArgBlock
-
evaluate the argument, aBlock for all selectors of mySelf and my metaclass,
passing the corresponding method as second argument
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
allSubInstancesDo: aBlock
-
evaluate aBlock for all of my instances and all instances of subclasses
-
allSubclassesDo: aBlock
-
evaluate aBlock for all of my subclasses.
There is no specific order, in which the entries are enumerated.
Warning:
This will only enumerate globally known classes - for anonymous
behaviors, you have to walk over all instances of Behavior.
-
allSubclassesInOrderDo: aBlock
-
evaluate aBlock for all of my subclasses.
There is no specific order, in which the entries are enumerated.
Warning:
This will only enumerate globally known classes - for anonymous
behaviors, you have to walk over all instances of Behavior.
-
allSuperclassesDo: aBlock
-
evaluate aBlock for all of my superclasses
-
instAndClassMethodsDo: aOneArgBlock
-
evaluate the argument, aBlock for all methods of mySelf and my metaclass
(i.e. for both instance- and class methods)
-
instAndClassSelectorsAndMethodsDo: aTwoArgBlock
-
evaluate the argument, aBlock for all selectors of mySelf and my metaclass,
passing the corresponding method as second argument
-
methodsDo: aOneArgBlock
-
evaluate the argument, aBlock for all my methods
-
selectorsAndMethodsDo: aTwoArgBlock
-
evaluate the argument, aBlock for all my selectors,
passing the corresponding method as second argument
-
selectorsDo: aOneArgBlock
-
evaluate the argument, aBlock for all my selectors
-
subclassesDo: aBlock
-
evaluate the argument, aBlock for all immediate subclasses.
This will only enumerate globally known classes - for anonymous
behaviors, you have to walk over all instances of Behavior.
-
whichClassSatisfies: aBlock
-
return the first class along the superclass-chain, which satisfies aBlock.
Return nil, if there is none.
-
withAllSubclassesDo: aBlock
-
evaluate aBlock for mySelf and all of my subclasses.
There is no specific order, in which the entries are enumerated.
Warning:
This will only enumerate globally known classes - for anonymous
behaviors, you have to walk over all instances of Behavior.
-
withAllSuperclassesDo: aBlock
-
evaluate aBlock for the class and all of its superclasses
initialization
-
deinitialize
-
deinitialize is sent to a class before it is physically unloaded.
This is only done with classes which have been loaded in from a binary
file. Classes may release any primitive memory or other stuff which is
not visible to smalltalk (for example, release internal memory).
The default action here is to do nothing.
-
initialize
-
initialize is sent to a class either during startup,
(for all statically compiled-in classes) or after a class
has been loaded into the system (either bytecodes or machinecode).
The default action here is to do nothing.
-
initializeWithAllPrivateClasses
-
if implemented, send #initialize to myself and any private
class which does so.
This is sent to a class after it
has been loaded into the system.
Statically compiled classes are initialized by the VM
-
postAutoload
-
postAutoload is sent to a class after it has been autoloaded.
This gives it a chance to arrange for automatic unloading to be done
after a while ...
This is NOT sent to statically compiled in or explicitely filedIn
classes.
The default action here is to do nothing.
-
reinitialize
-
reinitialize is sent to a class when an image has been restarted.
I.e. when the system is restarted.
This gives classes a chance to flush any device dependent or otherwise
obsolete data which may be a leftover from the previous live.
The default action here is to do nothing.
instance creation
-
basicNew
-
return an instance of myself without indexed variables.
If the receiver-class has indexed instvars, the new object will have
a basicSize of zero -
i.e. 'aClass basicNew' is equivalent to 'aClass basicNew:0'.
** Do not redefine this method in any class **
-
basicNew: anInteger
-
return an instance of myself with anInteger indexed variables.
If the receiver-class has no indexed instvars, this is only allowed
if the argument, anInteger is zero.
** Do not redefine this method in any class **
-
decodeFromLiteralArray: anArray
-
create & return a new instance from information encoded in anArray.
-
new
-
return an instance of myself without indexed variables
-
new: anInteger
-
return an instance of myself with anInteger indexed variables
-
niceBasicNew: anInteger
-
same as basicNew:anInteger, but tries to avoid long pauses
due to garbage collection. This method checks to see if
allocation is possible without a pause, and does a background
incremental garbage collect first if there is not enough memory
available at the moment for fast allocation.
This is useful in low-priority background processes which like to
avoid disturbing any higher priority foreground process while allocating
big amounts of memory. Of course, using this method only makes
sense for big or huge objects (say > 200k).
EXPERIMENTAL: this is a non-standard interface and should only
be used for special applications. There is no guarantee, that this
method will be available in future ST/X releases.
-
readFrom: aStream
-
read an objects printed representation from the argument, aStream
and return it.
The read object must be a kind of myself if its not, an error is raised.
This is the reverse operation to 'storeOn:'.
WARNING: storeOn: does not handle circular references and multiple
references to the same object.
Use #storeBinary:/readBinaryFrom: for this.
-
readFrom: aStream onError: exceptionBlock
-
read an objects printed representation from the argument, aStream
and return it (i.e. the stream should contain some representation of
the object which was created using #storeOn:).
The read object must be a kind of myself if its not, the value of
exceptionBlock is returned.
To get any object, use 'Object readFrom:...',
To get any number, use 'Number readFrom:...' and so on.
This is the reverse operation to 'storeOn:'.
WARNING: storeOn: does not handle circular references and multiple
references to the same object.
Use #storeBinary:/readBinaryFrom: for this.
-
readFromString: aString
-
create an object from its printed representation.
For most classes, the string is expected to be in a format created by
storeOn: or storeString; however, some (Time, Date) expect a user
readable string here.
See comments in Behavior>>readFromString:onError:,
Behavior>>readFrom: and Behavior>>readFrom:onError:
-
readFromString: aString onError: exceptionBlock
-
create an object from its printed representation.
Here, the string is expected to be in a format created by
storeOn: or storeString;
However, some classes (Time, Date) may redefine it to expect a user readable string here.
See comments in Behavior>>readFrom: and Behavior>>readFrom:onError:
-
uninitializedNew
-
create an instance of myself with uninitialized contents.
For all classes except ByteArray, this is the same as #basicNew.
-
uninitializedNew: anInteger
-
create an instance of myself with uninitialized contents.
For all classes except ByteArray, this is the same as #basicNew:.
misc
-
browse
-
open a browser showing the receiver
-
classOperationsMenu
-
a chance to return additional menu items for the browsers class-menu
-
flushSubclasses
-
I dont keep my subclasses - but if anyone inherits from me,
it better knows how to ignore this
-
iconInBrowserSymbol
-
can be redefined for a private icon in the browser (for me and my subclasses).
The returned symbol must be a selector of the ToolbarIconLibrary.
-
sourceCodeTemplate
-
printing & storing
-
displayString
-
although behaviors have no name, we return something
useful here - there are many places (inspectors) where
a classes name is asked for.
Implementing this message here allows instances of anonymous classes
to show a reasonable name.
-
printOn: aStream
-
private-accessing
-
flags: aNumber
-
set the flags.
this method is for special uses only - there will be no recompilation
and no change record written here;
Do NOT use it.
-
instSize: aNumber
-
set the instance size.
this method is for special uses only - there will be no recompilation
and no change record written here;
Do NOT use it.
-
primAddSelector: aSelector withMethod: newMethod
-
add the method given by 2nd argument under the selector given by
the 1st argument to the methodDictionary.
Does NOT flush any caches, does NOT write a change record.
Do not use this in normal situations, strange behavior will be
the consequence.
I.e. executing obsolete methods, since the old method will still
be executed out of the caches.
-
setMethodDictionary: dict
-
set the receivers method dictionary.
Convert dict to a MethodDictionary if necessary.
Do not flush inline caches, therefore old cached methods may be executed
after this call
-
setSuperclass: aClass
-
set the superclass of the receiver.
this method is for special uses only - there will be no recompilation
and no change record written here. Also, if the receiver class has
already been in use, future operation of the system is not guaranteed to
be correct, since no caches are flushed.
Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)
-
setSuperclass: aClass instSize: i
-
set some inst vars.
this method is for special uses only - there will be no recompilation
and no change record is written here. Also, if the receiver class has
already been in use, future operation of the system is not guaranteed to
be correct, since no caches are flushed.
Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)
-
setSuperclass: aClass methodDictionary: d instSize: i flags: f
-
set some inst vars.
this method is for special uses only - there will be no recompilation
and no change record is written here. Also, if the receiver class has
already been in use, future operation of the system is not guaranteed to
be correct, since no caches are flushed.
Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)
private-helpers
-
addAllClassVarNamesTo: aCollection
-
helper - add the name-strings of the class variables and of the class-vars
of all superclasses to the argument, aCollection. Return aCollection
-
addAllInstVarNamesTo: aCollection
-
helper for allInstVarNames - add the name-strings of the instance variables
and of the inst-vars of all superclasses to the argument, aCollection.
Return aCollection.
-
addAllPrivateClassesTo: aCollection
-
add all of my private classes to aCollection
queries
-
category
-
return the category of the class.
Returning nil here, since Behavior does not define a category
(only ClassDescriptions do).
-
comment
-
return the comment of the class.
Returning nil here, since Behavior does not define a category
(only Classes do). This allows different Behavior-like objects
(alien classes) to be handled by the browser as well.
-
definitionSelector
-
return the selector with which I was (can be) defined in my superclass
-
definitionSelectorPrivate
-
return the selector with which I was (can be) defined in my superclass
as a private class
-
firstDefinitionSelectorPart
-
return the first part of the selector with which I was (can be) defined in my superclass
-
fullName
-
Answer the name of the receiver, fully qualified.
-
hasExtensions
-
-
isBehavior
-
return true, if the receiver is describing another objects behavior.
Defined to avoid the need to use isKindOf:
-
isBrowserStartable
-
-
isBuiltInClass
-
return true if this class is known by the run-time-system.
Here, false is returned as default.
Notice, this is instance protocol, which means that any class
other than those special ones) are non-builtIn by default.
-
isPrivate
-
return true, if the receiver is some private class
-
isStartableWithMain
-
-
isStartableWithStart
-
-
isSubclassOf: aClass
-
return true, if I am a subclass of the argument, aClass
-
isVisualStartable
-
-
name
-
although behaviors have no name, we return something
useful here - there are many places (inspectors) where
a classes name is asked for.
Implementing this message here allows anonymous classes
and instances of them to be inspected.
-
nameInBrowser
-
return a nameString as shown in browsers
-
nameWithArticle
-
return a string consisting of classname preceeded by an article.
(dont expect me to write national variants for this ... :-)
If you have special preferences, redefine it...
-
owningClass
-
return my owning class - nil if I am a public class
-
owningClassOrYourself
-
return my owning class if I am private, myself otherwise
-
revision
-
-
sourceCodeAt: aSelector
-
return the methods source for given selector aSelector or nil.
Only methods in the receiver - not in the superclass chain are tested.
-
sourceCodeAt: aSelector ifAbsent: exceptionalValue
-
return the methods source for given selector aSelector or exceptionalValue.
Only methods in the receiver - not in the superclass chain are tested.
-
sourceCodeManager
-
return the sourceCodeManager of the class.
Returning nil here, since Behavior does not define any sourceCode management.
(only Classes do). This allows different Behavior-like objects
(alien classes) to be handled by the browser as well.
-
supportsMethodCategories
-
return true, if my methods are categorized.
This is a hook for the browser to allow alien classes
to be handled (aktually, this is not yet used).
-
theMetaclass
-
return the metaClass of the class-meta pair.
Here, return my metaclass object, because I am the class.
Also implemented in my metaclass, which returns itself.
-
theNonMetaclass
-
return the nonMetaClass of the class-meta pair.
Here, return myself, because I am the nonMetaclass.
Also implemented in my metaclass, which also returns me.
-
topOwningClass
-
return my outermost owning class - nil if I am a public class
queries-inheritance
-
allSubclasses
-
return a collection of all subclasses (direct AND indirect) of
the receiver. There will be no specific order, in which entries
are returned. NameSpaces are excluded from the list.
-
allSubclassesInOrder
-
return a collection of all subclasses (direct AND indirect) of
the receiver. Higher level subclasses will come before lower ones.
NameSpaces are excluded from the list.
-
allSuperclasses
-
return a collection of the receivers accumulated superclasses
-
canBeSubclassed
-
return true, if its allowed to create subclasses of the receiver.
This method is redefined in SmallInteger and UndefinedObject, since
instances are detected by their pointer-fields, i.e. they do not have
a class entry (you don't have to understand this :-)
-
commonSuperclass: aClass
-
Return the common superclass of the receiver and aClass.
Assumes that there is a common superclass of any two classes.
(might return nil, if either the receiver or the argument inherit from nil)
-
hasMultipleSuperclasses
-
Return true, if this class inherits from other classes
(beside its primary superclass).
This method is a preparation for a future multiple inheritance extension
- currently it is not supported by the VM
-
inheritsFrom: aClass
-
return true, if the receiver inherits methods from aClass;
i.e. if aClass is on the receivers superclass chain.
-
subclasses
-
return a collection of the direct subclasses of the receiver
-
superclasses
-
return a collection of the receivers immediate superclasses.
This method is a preparation for a future multiple inheritance extension
- currently it is not supported by the VM
-
withAllSubclasses
-
return a collection containing the receiver and
all subclasses (direct AND indirect) of the receiver
-
withAllSuperclasses
-
return a collection containing the receiver and all
of the receivers accumulated superclasses
queries-instances
-
allDerivedInstances
-
return a collection of all instances of myself and
instances of all subclasses of myself.
This method is going to be removed for protocol compatibility with
other STs; use allSubInstances
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
allInstances
-
return a collection of all my instances
-
allInstancesWeakly: doWeakly
-
return a collection of all my instances.
If weakly is true, a weak collection is returned.
-
allSubInstances
-
return a collection of all instances of myself and
instances of all subclasses of myself.
-
anyInstance
-
return any of my instances; raise an error, if there is none
-
derivedInstanceCount
-
return the number of instances of myself and of subclasses
-
hasDerivedInstances
-
return true, if there are any instances of myself or of any subclass
-
hasImmediateInstances
-
return true if this class has immediate instances
i.e. if the instances are represented in the pointer itself and
no real object header/storage is used for the object.
Redefined in classes which have so (only SmallInteger and UndefinedObject)
-
hasInstances
-
return true, if there are any instances of myself
-
hasSharedInstances
-
return true if this class has shared instances, that is, instances
with the same value are identical.
False is returned here, only redefined in classes which have unified
instances (or should be treated so).
-
instanceCount
-
return the number of instances of myself.
queries-instlayout
-
elementByteSize
-
for bit-like containers, return the number of bytes stored per
element. For pointer indexed classes, 0 is returned
-
isBits
-
return true, if instances have indexed byte or short instance variables.
Ignore long, float and double arrays, since ST-80 code using isBits are probably
not prepared to handle them correctly.
-
isBitsExtended
-
return true, if instances have indexed byte, short, long or longlong instance variables.
Ignore float and double arrays.
This is really the thing we expect #isBits to return, however, #isBits
is defined to only return true for byte- and wordIndexed instances.
This avoids confusion of ST80 code, which is not prepared for long or longLong
instVars.
-
isBytes
-
return true, if instances have indexed byte instance variables
-
isDoubles
-
return true, if instances have indexed double instance variables
-
isFixed
-
return true, if instances do not have indexed instance variables
-
isFloats
-
return true, if instances have indexed float instance variables
-
isFloatsOrDoubles
-
return true, if instances have indexed float or double instance variables
-
isLongLongs
-
return true, if instances have indexed long-long instance variables (8 byte uints)
-
isLongs
-
return true, if instances have indexed long instance variables (4 byte uints)
-
isPointers
-
return true, if instances have pointer instance variables
i.e. are either non-indexed or have indexed pointer variables
-
isSignedLongLongs
-
return true, if instances have indexed signed long-long instance variables (8 byte ints)
-
isSignedLongs
-
return true, if instances have indexed signed long instance variables (4 byte ints)
-
isSignedWords
-
return true, if instances have indexed signed short instance variables
-
isVariable
-
return true, if instances have indexed instance variables
-
isWeakPointers
-
return true, if instances have weak pointer instance variables
-
isWords
-
return true, if instances have indexed short instance variables
-
sizeOfInst: n
-
return the number of bytes required for an instance of
myself with n indexed instance variables. The argument n
should be zero for classes without indexed instance variables.
See Behavior>>niceNew: for an application of this.
queries-protocol
-
allSelectors
-
return a collection of all selectors understood by the receiver;
this includes my selectors and all superclass selectors
(i.e. the receivers full protocol)
-
cachedLookupMethodFor: aSelector
-
return the method, which would be executed if aSelector was sent to
an instance of the receiver. I.e. the selector arrays of the receiver
and all of its superclasses are searched for aSelector.
Return the method, or nil if instances do not understand aSelector.
This interface provides exactly the same information as #lookupMethodFor:,
but uses the lookup-cache in the VM for faster search.
However, keep in mind, that doing a lookup through the cache also adds new
entries and can thus slow down the system by polluting the cache with
irrelevant entries. (do NOT loop over all objects calling this method).
Does NOT (currently) handle MI
-
canUnderstand: aSelector
-
return true, if the receiver or one of its superclasses implements aSelector.
(i.e. true if my instances understand aSelector)
-
compiledMethodAt: aSelector
-
return the method for given selector aSelector or nil.
Only methods in the receiver - not in the superclass chain are tested.
-
compiledMethodAt: aSelector ifAbsent: exceptionValue
-
return the method for given selector aSelector or the value
of exceptionValue if not present.
Only methods in the receiver - not in the superclass chain are tested.
-
containsMethod: aMethod
-
Return true, if the argument, aMethod is a method of myself
-
hasMethods
-
return true, if there are any (local) methods in this class
-
implements: aSelector
-
return true, if the receiver implements aSelector.
(i.e. implemented in THIS class - NOT in a superclass).
This is semantically equivalent to includesSelector: (which is ST/80/Squeak compatibility).
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.
-
includesBehavior: aClass
-
return true, if the receiver includes the behavior of aClass;
i.e. if is either identical to a class or inherits from it.
-
includesSelector: aSelector
-
return true, if the methodDictionary of THIS class includes a method for aSelector.
(i.e. if aSelector is implemented in THIS class - NOT in a superclass).
This is semantically equivalent to implements: (ST/80/Squeak compatibility).
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.
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).
-
instAndClassMethods
-
-
lookupMethodFor: aSelector
-
return the method, which would be executed if aSelector was sent to
an instance of the receiver. I.e. the selector arrays of the receiver
and all of its superclasses are searched for aSelector.
Return the method, or nil if instances do not understand aSelector.
EXPERIMENTAL: take care of multiple superclasses.
-
responseTo: aSelector
-
return the method (from here or the inheritance chain),
which implements aSelector; return nil if none.
-
selectorAtMethod: aMethod
-
Return the selector for given method aMethod.
-
selectorAtMethod: aMethod ifAbsent: failBlock
-
return the selector for given method aMethod
or the value of failBlock, if not found.
-
whichClassImplements: aSelector
-
obsolete interface;
use whichClassIncludesSelector: for ST-80 compatibility.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
whichClassIncludesSelector: aSelector
-
return the class in the inheritance chain, which implements the method
for aSelector; return nil if none.
EXPERIMENTAL: handle multiple superclasses
queries-variables
-
allClassVarNames
-
return a collection of all the class variable name-strings
this includes all superclass-class variables
-
allInstVarNames
-
return a collection of all the instance variable name-strings
this includes all superclass-instance variables.
Instvars of superclasses come first (i.e. the position matches
the instVarAt:-index).
-
allInstanceVariableNames
-
alias for allInstVarNames
-
classVarNames
-
return a collection of the class variable name-strings.
Returning empty here, since Behavior does not define any classVariables.
(only Classes do). This allows different Behavior-like objects
(alien classes) to be handled by the browser as well.
-
classVariableString
-
return a string of the class variables names.
Returning empty here, since Behavior does not define any classVariables.
(only Classes do). This allows different Behavior-like objects
(alien classes) to be handled by the browser as well.
-
instVarNameForIndex: index
-
Behavior does not provide this info - generate synthetic names.
-
instVarNames
-
Behavior does not provide this info - generate synthetic names.
-
instanceVariableNames
-
alias for instVarNames.
-
instanceVariableString
-
return a string with dummy names here - typically, your
objects are instances of Class, not Behavior,
so this is only invoked for very artificial behaviors.
-
whichClassDefinesClassVar: aStringOrText
-
-
whichClassDefinesInstVar: aString
-
-
whichSelectorsAssign: instVarName
-
Answer a set of selectors whose methods write the argument, instVarName,
as a named instance variable.
-
whichSelectorsRead: instVarName
-
Answer a set of selectors whose methods read the argument, instVarName,
as a named instance variable.
-
whichSelectorsReferTo: someLiteralConstant
-
return a collection of selectors of methods which refer to the argument.
Search the literal arrays of my methods to do this.
-
whichSelectorsReferToClassVariable: nameOfClassVariable
-
return a collection of selectors of methods which refer to the argument.
Search the literal arrays of my methods to do this.
-
whichSelectorsReferToGlobal: nameOfGlobal
-
return a collection of selectors of methods which refer to the argument.
Search the literal arrays of my methods to do this.
-
whichSelectorsWrite: instVarName
-
Answer a set of selectors whose methods write the argument, instVarName,
as a named instance variable.
snapshots
-
postSnapshot
-
sent by ObjectMemory to all classes, after a snapshot has been written.
Nothing done here. This can be redefined in classes which like to know
about snapshooting.
-
preSnapshot
-
sent by ObjectMemory to all classes, before a snapshot is written.
Nothing done here. This can be redefined in classes which like to know
about snapshooting.
tracing
-
traceInto: aRequestor level: level from: referrer
-
double dispatch into tracer, passing my type implicitely in the selector
visiting
-
acceptVisitor: aVisitor with: aParameter
-
|