Kernel

AdditionalMethodState
I am class holding state for compiled methods. All my instance variables should be actually part of the CompiledMethod itself, but the current implementation of the VM doesn't allow this. Currently I hold the selector and any pragmas or properties the compiled method has. Pragmas and properties are stored in indexable fields; pragmas as instances of Pragma, properties as instances of Association.
I am a reimplementation of much of MethodProperties, but eliminating the explicit properties and pragmas dictionaries. Hence I answer true to isMethodProperties.
analogousCodeTo:
at:
Answer the property value or pragma associated with aKey.
at:ifAbsent:
Answer the property value or pragma associated with aKey or,
if aKey isn't found, answer the result of evaluating aBlock.
at:ifAbsentPut:
Answer the property value or pragma associated with aKey or,
if aKey isn't found, answer the result of evaluating aBlock.
at:put:
Replace the property value or pragma associated with aKey.
copyWith:
<Association|Pragma>
copyWithout:
<Association|Pragma>
forMethod:selector:
hasLiteralSuchThat:
Answer true if litBlock returns true for any literal in this array, even if embedded in further array structure.
This method is only intended for private use by CompiledMethod hasLiteralSuchThat:
hasLiteralThorough:
Answer true if any literal in these properties is literal,
even if embedded in array structure.
includes:
<Association|Pragma>
includesKey:
Test if the property aKey or pragma with selector aKey is present.
includesProperty:
Test if the property aKey is present.
isEmpty
isMethodProperties
keysAndValuesDo:
Enumerate the receiver with all the keys and values.
method:
For decompilation
notEmpty
pragmas
Answer the raw messages comprising my pragmas.
properties
propertyKeysAndValuesDo:
Enumerate the receiver with all the keys and values.
propertyValueAt:
Answer the property value associated with aKey.
propertyValueAt:ifAbsent:
Answer the property value associated with aKey or, if aKey isn't found, answer the result of evaluating aBlock.
refersToLiteral:
Answer true if literal is identical to any literal in this array, even if imbedded in further structures. This is the end of the imbedded structure path so return false.
removeKey:
Remove the property with aKey. Answer the property or raise an error if aKey isn't found.
removeKey:ifAbsent:
Remove the property with aKey. Answer the value or, if aKey isn't found, answer the result of evaluating aBlock.
selector
selector:
selector:with:
setMethod:
BasicClassOrganizer
A BasicClassOrganizer is xxxxxxxxx.
Instance Variables
classComment: <Object>
commentStamp: <Object>
subject: <Object>
classComment
- xxxxx
commentStamp
- xxxxx
subject
- xxxxx
ambiguous
class:
class:defaultList:
classComment
classComment:
Store the comment, aString, associated with the object that refers to the
receiver.
classComment:stamp:
Store the comment, aString, associated with the object that refers to the receiver.
commentRemoteStr
commentStamp
Answer the comment stamp for the class
commentStamp:
dateCommentLastSubmitted
Answer a Date object indicating when my class comment was last submitted. If there is no date stamp, or one of the old-time <historical> guys, return nil
fileOutCommentOn:moveSource:toFile:
Copy the class comment to aFileStream. If moveSource is true (as in compressChanges or compressSources, then update classComment to point to the new file.
hasComment
Answer whether the class classified by the receiver has a comment.
hasNoComment
Answer whether the class classified by the receiver has a comment.
hasSubject
moveChangedCommentToFile:numbered:
If the comment is in the changes file, then move it to a new file.
objectForDataStream:
I am about to be written on an object file. Write a path to me in the other system instead.
putCommentOnFile:numbered:moveSource:forClass:
Store the comment about the class onto file, aFileStream.
setSubject:
subject
Behavior
My instances describe the behavior of other objects. I provide the minimum state necessary for compiling methods, and creating and running instances. Most objects are created as instances of the more fully supported subclass, Class, but I am a good starting point for providing instance-specific behavior (as in Metaclass).
addObsoleteSubclass:
Weakly remember that aClass was a subclass of the receiver and is now obsolete
allCallsOn
Answer a SortedCollection of all the methods that refer to me by name or as part of an association in a global dict.
allCallsOn:
Answer a SortedCollection of all the methods that call on aSymbol.
allClassVarNames
Answer a Set of the names of the receiver's and the receiver's ancestor's
class variables.
allInstVarNames
Answer an Array of the names of the receiver's instance variables. The
Array ordering is the order in which the variables are stored and
accessed by the interpreter.
allInstances
Answer a collection of all current instances of the receiver.
allInstancesDo:
Evaluate the argument, aBlock, for each of the current instances of the
receiver.

Because aBlock might change the class of inst (for example, using become:),
it is essential to compute next before aBlock value: inst.
allInstancesEverywhereDo:
Evaluate the argument, aBlock, for each of the current instances of the receiver. Including those in ImageSegments that are out on the disk. Bring each in briefly.
allLocalCallsOn:
Answer a SortedCollection of all the methods that call on aSymbol, anywhere in my class hierarchy.
allSelectors
Answer all selectors understood by instances of the receiver
allSelectorsAbove
allSelectorsAboveUntil:
allSelectorsBelow:
allSelectorsForCompletionWithout:
allSharedPools
Answer a Set of the names of the pools (Dictionaries or SharedPool subclasses) that the receiver and the receiver's ancestors share.
allSortedSubclassesDo:
Evaluate the argument, aBlock, for each of the receiver's subclasses.
allSubInstances
Answer a list of all current instances of the receiver and all of its subclasses.
allSubInstancesDo:
Evaluate the argument, aBlock, for each of the current instances of the
receiver and all its subclasses.
allSubclasses
Answer a Set of the receiver's and the receiver's descendent's subclasses.
allSubclassesDo:
Evaluate the argument, aBlock, for each of the receiver's subclasses.
allSubclassesDoGently:
Evaluate the argument, aBlock, for each of the receiver's subclasses.
allSubclassesWithLevelDo:startingLevel:
Walk the tree of subclasses, giving the class and its level
allSuperclasses
Answer an OrderedCollection of the receiver's and the receiver's
ancestor's superclasses. The first element is the receiver's immediate
superclass, followed by its superclass; the last element is Object.
allSuperclassesDo:
Evaluate the argument, aBlock, for each of the receiver's superclasses.
allSuperclassesIncluding:
Answer an OrderedCollection of the receiver's and the receiver's
ancestor's superclasses up to aClass included. The first element is the receiver's immediate
superclass up to aClass included.
allUnreferencedInstanceVariables
Return a list of the instance variables known to the receiver which are not referenced in the receiver or any of its subclasses OR superclasses
allUnsentMessages
Answer an array of all the messages defined by the receiver that are not sent anywhere in the system.
allowsSubInstVars
Classes that allow instances to change classes among its subclasses will want to override this and return false, so inst vars are not accidentally added to its subclasses.
asAnnouncement
basicLocalSelectors
Direct accessor for the instance variable localSelectors.
Because of hardcoded ivar indexes of Behavior and Class in the VM, Class and
Metaclass declare the needed ivar and override this method as an accessor.
By returning nil instead of declaring this method as a subclass responsibility,
Behavior can be instantiated for creating anonymous classes.
basicLocalSelectors:
basicNew
Primitive. Answer an instance of the receiver (which is a class) with no
indexable variables. Fail if the class is indexable. Essential. See Object
documentation whatIsAPrimitive.
basicNew:
Primitive. Answer an instance of this class with the number
of indexable variables specified by the argument, sizeRequested.
Fail if this class is not indexable or if the argument is not a
positive Integer, or if there is not enough memory available.
Essential. See Object documentation whatIsAPrimitive.
becomeCompact
Here are the restrictions on compact classes in order for export segments to work: A compact class index may not be reused. If a class was compact in a release of Squeak, no other class may use that index. The class might not be compact later, and there should be nil in its place in the array.
becomeCompactSimplyAt:
Make me compact, but don't update the instances. For importing segments.
becomeUncompact
bindingOf:
Answer the binding of some variable resolved in the scope of the receiver
canPerform:
Answer whether the receiver can safely perform to the message whose selector
is the argument: it is not an abstract or cancelled method
canUnderstand:
Answer whether the receiver can respond to the message whose selector
is the argument. The selector can be in the method dictionary of the
receiver's class or any of its superclasses.
canZapMethodDictionary
Return true if it is safe to zap the method dictionary on #obsolete
classAndMethodFor:do:ifAbsent:
Looks up the selector aSymbol in the class chain. If it is found, binaryBlock is evaluated
with the class that defines the selector and the associated method. Otherwise
absentBlock is evaluated.
classBindingOf:
Answer the binding of some variable resolved in the scope of the receiver's class
classDepth
classVarNames
Answer a Set of the receiver's class variable names.
classesComposedWithMe
commentsAt:
Answer a string representing the first comment in the method associated with selector. Return an empty string if the relevant source file is not available, or if the method's source code does not contain a comment. Not smart enough to bypass quotes in string constants, but does map doubled quote into a single quote.
commentsIn:
computeSelfSendersFromInheritedSelfSenders:localSelfSenders:
Compute the set of all self-senders from the set of inherited self-senders and the set of local self-senders.
computeTranslationsAndUpdateUnreachableSet:
This method computes the set of unreachable selectors in the superclass by altering the set of unreachable selectors in this class. In addition, it builds a dictionary mapping super-sent selectors to the selectors of methods sending these selectors.
findSelfSendersOf:unreachable:noInheritedSelfSenders:
This method answers a subset of all the reachable methods (local or inherited) that self-send selector (empty set => no self-senders).
See Nathanael Sch䲬i's PhD for more details.
firstPrecodeCommentFor:
If there is a comment in the source code at the given selector that preceeds the body of the method, return it here, else return nil
flushCache
Tell the interpreter to remove the contents of its method lookup cache, if it has
one. Essential. See Object documentation whatIsAPrimitive.
flushObsoleteSubclasses
forgetDoIts
get rid of old DoIt methods
format
Answer an Integer that encodes the kinds and numbers of variables of
instances of the receiver.
fullName
In VW, will include the namespace
hasTraitComposition
includesBehavior:
indexIfCompact
If these 5 bits are non-zero, then instances of this class
will be compact. It is crucial that there be an entry in
Smalltalk compactClassesArray for any class so optimized.
See the msgs becomeCompact and becomeUncompact.
inheritsFrom:
Answer whether the argument, aClass, is on the receiver's superclass
chain.
initialize
moved here from the class side's #new
initializeObsoleteSubclasses
initializedInstance
Answer an instance of the receiver which in some sense is initialized. In the case of Morphs, this will yield an instance that can be attached to the Hand after having received the same kind of basic initialization that would be obtained from an instance chosen from the 'new morph' menu. Return nil if the receiver is reluctant for some reason to return such a thing
inspectAllInstances
Inpsect all instances of the receiver. 1/26/96 sw
inspectSubInstances
Inspect all instances of the receiver and all its subclasses. CAUTION - don't do this for something as generic as Object! 1/26/96 sw
instSize
Answer the number of named instance variables
(as opposed to indexed variables) of the receiver.
instSpec
instVarNames
Answer an Array of the instance variable names. Behaviors must make
up fake local instance variable names because Behaviors have instance
variables for the purpose of compiling methods, but these are not named
instance variables.
instVarNamesAndOffsetsDo:
This is part of the interface between the compiler and a class's instance or field names.
The class should enumerate aBinaryBlock with the instance variable name strings and
their integer offsets. The order is important. Names evaluated later will override the
same names occurring earlier.
instanceCount
Answer the number of instances of the receiver that are currently in
use.
isBehavior
Return true if the receiver is a behavior
isBits
Answer whether the receiver contains just bits (not pointers).
isBytes
Answer whether the receiver has 8-bit instance variables.
isFixed
Answer whether the receiver does not have a variable (indexable) part.
isMeta
isObsolete
Return true if the receiver is obsolete.
isPointers
Answer whether the receiver contains just pointers (not bits).
isVariable
Answer whether the receiver has indexable variables.
isWeak
Answer whether the receiver has contains weak references.
isWords
Answer whether the receiver has 16-bit instance variables.
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:
Look up the given selector in my methodDictionary.
Return the corresponding method if found.
Otherwise chase the superclass chain and try again.
Return nil if no method is found.
methodDict
methodDict:
name
Answer a String that is the name of the receiver.
new
Answer a new initialized instance of the receiver (which is a class) with no indexable variables. Fail if the class is indexable.
new:
Answer an initialized instance of this class with the number of indexable
variables specified by the argument, sizeRequested.
nextQuotePosIn:startingFrom:
nonMetaSubclassesDo:
Evaluate the argument, aBlock, for each of the receiver's immediate non-meta subclasses.
nonObsoleteClass
Attempt to find and return the current version of this obsolete class
obsoleteSubclasses
Return all the weakly remembered obsolete subclasses of the receiver
parseTreeFor:
precodeCommentOrInheritedCommentFor:
Answer a string representing the first comment in the method associated
with selector, considering however only comments that occur before the
beginning of the actual code. If the version recorded in the receiver is
uncommented, look up the inheritance chain. Return nil if none found.
printHierarchy
Answer a description containing the names and instance variable names
of all of the subclasses and superclasses of the receiver.
printOn:
Refer to the comment in Object|printOn:.
printOnStream:
Refer to the comment in Object|printOn:.
printWithClosureAnalysisOn:
Refer to the comment in Object|printOn:.
removeAllObsoleteSubclasses
Remove all the obsolete subclasses of the receiver
removeObsoleteSubclass:
Remove aClass from the weakly remembered obsolete subclasses
requiredSelectors
requiredSelectorsCache
rootStubInImageSegment:
selectSubclasses:
Evaluate the argument, aBlock, with each of the receiver's (next level)
subclasses as its argument. Collect into a Set only those subclasses for
which aBlock evaluates to true. In addition, evaluate aBlock for the
subclasses of each of these successful subclasses and collect into the set
those for which aBlock evaluates true. Answer the resulting set.
selectSuperclasses:
Evaluate the argument, aBlock, with the receiver's superclasses as the
argument. Collect into an OrderedCollection only those superclasses for
which aBlock evaluates to true. In addition, evaluate aBlock for the
superclasses of each of these successful superclasses and collect into the
OrderedCollection ones for which aBlock evaluates to true. Answer the
resulting OrderedCollection.
selectorsWithArgs:
Return all selectors defined in this class that take this number of arguments
sendCaches
setFormat:
only use this method with extreme care since it modifies the format of the class
ie a description of the number of instance variables and whether the class is
compact, variable sized
sharedPools
Answer a Set of the names of the pools (Dictionaries) that the receiver
shares.
9/12/96 tk sharedPools have an order now
shouldNotBeRedefined
Return true if the receiver should not be redefined.
The assumption is that compact classes,
classes in Smalltalk specialObjects and
Behaviors should not be redefined
shutDown
This message is sent on system shutdown to registered classes
shutDown:
This message is sent on system shutdown to registered classes
someInstance
Primitive. Answer the first instance in the enumeration of all instances
of the receiver. Fails if there are none. Essential. See Object
documentation whatIsAPrimitive.
startUp
This message is sent to registered classes when the system is coming up.
startUp:
This message is sent to registered classes when the system is coming up.
startUpFrom:
Override this when a per-instance startUp message needs to be sent. For example, to correct the order of 16-bit non-pointer data when it came from a different endian machine.
subclassDefinerClass
Answer an evaluator class appropriate for evaluating definitions of new
subclasses of this class.
subclassInstVarNames
Answer a Set of the names of the receiver's subclasses' instance
variables.
subclasses
slow implementation since Behavior does not keep trace of subclasses
superclass
Answer the receiver's superclass, a Class.
superclass:
Change the receiver's superclass to be aClass.
superclass:methodDictionary:format:
Basic initialization of the receiver.
Must only be sent to a new instance; else we would need Object flushCache.
supermostPrecodeCommentFor:
Answer a string representing the precode comment in the most distant
superclass's implementation of the selector. Return nil if none found.
thoroughWhichSelectorsReferTo:special:byte:
Answer a set of selectors whose methods access the argument as a
literal. Dives into the compact literal notation, making it slow but
thorough
traitComposition
traitComposition:
translateReachableSelfSenders:translations:
typeOfClass
Answer a symbol uniquely describing the type of the receiver
ultimateSourceCodeAt:ifAbsent:
Return the source code at selector, deferring to superclass if necessary
unreferencedInstanceVariables
Return a list of the instance variables defined in the receiver which are not referenced in the receiver or any of its subclasses.
updateRequiredStatusFor:inSubclasses:
Updates the requirements cache to reflect whether selector is required in this class and some of its subclasses.
updateRequiredStatusFor:inSubclasses:parentSelfSenders:providedInParent:noInheritedSelfSenders:
Updates the requirements cache to reflect whether selector is required in this class and all of its subclasses. The parameter inheritedSelfSenders is a subset of the methods in the parent of this class that are known to self-send selector. providedBoolean indicates whether selector is provided in the parent. noInheritedBoolean is true if no self-senders could be found in the superclass.
See Nathanael Sch䲬i's PhD for more details.
updateRequiredStatusFor:inSubclasses:parentSelfSenders:providedInParent:noInheritedSelfSenders:accumulatingInto:
Updates the requirements cache to reflect whether selector is required in this class and all of its subclasses. The parameter inheritedSelfSenders is a subset of the methods in the parent of this class that are known to self-send selector. providedBoolean indicates whether selector is provided in the parent. noInheritedBoolean is true if no self-senders could be found in the superclass.
See Nathanael Sch䲬i's PhD for more details.
variablesAndOffsetsDo:
This is the interface between the compiler and a class's instance or field names. The
class should enumerate aBinaryBlock with the field definitions (with nil offsets) followed
by the instance variable name strings and their integer offsets (1-relative). The order is
important; names evaluated later will override the same names occurring earlier.
whichClassDefinesClassVar:
whichClassDefinesInstVar:
whichClassIncludesSelector:
Answer the class on the receiver's superclass chain where the
argument, aSymbol (a message selector), will be found. Answer nil if none found.
whichSelectorsAccess:
Answer a set of selectors whose methods access the argument,
instVarName, as a named instance variable.
whichSelectorsAssign:
Answer a Set of selectors whose methods store into the argument,
instVarName, as a named instance variable.
whichSelectorsRead:
Answer a Set of selectors whose methods access the argument,
instVarName, as a named instance variable.
whichSelectorsStoreInto:
Answer a Set of selectors whose methods access the argument,
instVarName, as a named instance variable.
whichSuperclassSatisfies:
withAllSortedSubclassesDo:
withAllSubAndSuperclassesDo:
withAllSubclasses
Answer a Set of the receiver, the receiver's descendent's, and the
receiver's descendent's subclasses.
withAllSubclassesDo:
Evaluate the argument, aBlock, for the receiver and each of its
subclasses.
withAllSuperAndSubclassesDoGently:
withAllSuperclassesDo:
Evaluate the argument, aBlock, for each of the receiver's superclasses.
withInheritanceTraitCompositionIncludes:
zapAllMethods
Remove all methods in this class which is assumed to be obsolete
BlockClosure
I am a block closure for Eliot's closure implementation. Not to be confused with the old BlockClosure.
argumentCount
Answer the number of arguments that must be used to evaluate this block
asContext
Create a MethodContext that is ready to execute self. Assumes self takes no args (if it does the args will be nil)
asContextWithSender:
Inner private support method for evaluation. Do not use unless you know what you're doing.
asMinimalRepresentation
Answer the receiver.
asText
assert
bench
See how many times I can value in 5 seconds. I'll answer a meaningful description.
bindings
Answers the Dynamic Bindings that are currently visible in the receiver's context. This is kind of a hack...we could do a better job of this if we used the exception handling primitives directly, however, this implementation has the benefit of being slightly more portable.
copiedValueAt:
copyForSaving
Answer a copy of the receiver suitable for serialization.
Notionally, if the receiver's outerContext has been returned from then nothing
needs to be done and we can use the receiver. But there's a race condition
determining if the receiver has been returned from (it could be executing in a
different process). So answer a copy anyway.
decompile
doPostProcessingFor:response:
The method is to provide compatibility with HttpAdaptor's post processing.
The receiver is expected to accept two arguments.
doWhileFalse:
Evaluate the receiver once, then again as long the value of conditionBlock is false.
doWhileTrue:
Evaluate the receiver once, then again as long the value of conditionBlock is true.
durationToRun
Answer the duration taken to execute this block.
ensure:
Evaluate a termination block after evaluating the receiver, regardless of whether the receiver's evaluation completes.
fixCallbackTemps
fixTemps
Fix the values of the temporary variables used in the block that
are ordinarily shared with the method in which the block is defined.
This is a no-op for closures, provided for backward-compatibility with
old BlockContexts that needed the fixTemps hack to persist.
fork
Create and schedule a Process running the code in the receiver.
forkAndWait
Suspend current process and execute self in new process, when it completes resume current process
forkAt:
Create and schedule a Process running the code in the receiver at the given priority. Answer the newly created process.
forkAt:named:
Create and schedule a Process running the code in the receiver at the
given priority and having the given name. Answer the newly created
process.
forkNamed:
Create and schedule a Process running the code in the receiver and
having the given name.
forkWithBindings
Create and schedule a new process that has the same
dynamic bindings as the active process
forkWithBindings:
Create and schedule a new process with the given dynamic bindings
forkWithClampedBindings
forkWithClampedBindings:
forkWithIsolatedBindings
forkWithIsolatedBindings:
fullPrintOn:
handleRequest:
hasMethodReturn
Answer whether the receiver has a method-return ('^') in its code.
home
ifCurtailed:
Evaluate the receiver with an abnormal termination action.
Evaluate aBlock only if execution is unwound during execution
of the receiver. If execution of the receiver finishes normally
do not evaluate aBlock.
ifError:
Evaluate the block represented by the receiver, and normally return it's value. If an error occurs, the errorHandlerBlock is evaluated, and it's value is instead returned. The errorHandlerBlock must accept zero, one, or two parameters (the error message and the receiver).
isBlock
isClosure
isDead
Has self finished
isValid
Answer the receiver.
method
newProcess
Answer a Process running the code in the receiver. The process is not
scheduled.
newProcessWith:
Answer a Process running the code in the receiver. The receiver's block
arguments are bound to the contents of the argument, anArray. The
process is not scheduled.
newProcessWithBindings
Create a new process that has the same dynamic bindings
as the active process
newProcessWithBindings:
Create a new process with the given dynamic bindings
newProcessWithClampedBindings
Create a new process with a nested set of the dynamicBindings of
the active process
newProcessWithClampedBindings:
Create a new process with a nested set of the given dynamicBindings
newProcessWithIsolatedBindings
Create a new process with a copy of the dynamicBindings of the
acitve process
newProcessWithIsolatedBindings:
Create a new process with a copy of the given dynamicBindings
numArgs
Answer the number of arguments that must be used to evaluate this block
numArgsError:
numCopiedValues
Answer the number of copied values of the receiver. Since these are
stored in the receiver's indexable fields this is the receiver's basic size.
Primitive. Answer the number of indexable variables in the receiver.
This value is the same as the largest legal subscript.
on:do:
Evaluate the receiver in the scope of an exception handler.
onDNU:do:
Catch MessageNotUnderstood exceptions but only those of the given selector (DNU stands for doesNotUnderstand:)
outerContext
outerContext:startpc:numArgs:copiedValues:
postCopy
To render a copy safe we need to provide a new outerContext that
cannot be returned from and a copy of any remoteTemp vectors.
When a block is active it makes no reference to state in its nested
contexts (this is the whole point of the indirect temps scheme; any
indirect state is either copied or in indirect temp vectors. So we
need to substitute a dummy outerContext and copy the copiedValues,
copying anything looking like a remote temp vector. if we accidentally
copy an Array that isn't actually an indirect temp vector we do extra work
but don't break anything.
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
processHttp
<Boolean> The receiver should answer a boolean to indicate whether
there is an HttpResponse available (accessed by HttpResponse current).
If the receiver takes no arguments, then assume that it answers a Boolean
and uses dyanmic bindings to access the current request/response, otherwise
pass in the current request and set the current response.
processHttpRequest:
<HttpResponse> The receiver should answer an HttpResponse for sending
to the client.
processVisitor:
receiver
reentrant
Answer a version of the recever that can be reentered.
Closures are reentrant (unlike BlockContect) so simply answer self.
renderOn:
Override this method to customize how objects (not components) are rendered when passed as an argument to #render:. The default is the return value of #displayString.
Just remember that you can not use #callback:, #on:of:, or #call:
repeat
Evaluate the receiver repeatedly, ending only if the block explicitly returns.
repeatWithGCIf:
run the receiver, and if testBlock returns true, garbage collect and run the receiver again
sender
Answer the context that sent the message that created the receiver.
setAuthorInMetacelloConfig:
setBlessingInMetacelloConfig:
setDescriptionInMetacelloConfig:
setPackage:withInMetacelloConfig:
setProject:withInMetacelloConfig:
setTimestampInMetacelloConfig:
simulateValueWithArguments:caller:
split:
startpc
timeToRun
Answer the number of milliseconds taken to execute this block.
validateForStack:
Do nothing, provided to provide compatibility with ComancheModule
value
Activate the receiver, creating a closure activation (MethodContext)
whose closure is the receiver and whose caller is the sender of this message.
Supply the copied values to the activation as its arguments and copied temps.
Primitive. Optional (but you're going to want this for performance).
value:
Activate the receiver, creating a closure activation (MethodContext)
whose closure is the receiver and whose caller is the sender of this message.
Supply the argument and copied values to the activation as its arguments and copied temps.
Primitive. Optional (but you're going to want this for performance).
value:value:
Activate the receiver, creating a closure activation (MethodContext)
whose closure is the receiver and whose caller is the sender of this message.
Supply the arguments and copied values to the activation as its arguments and copied temps.
Primitive. Optional (but you're going to want this for performance).
value:value:value:
Activate the receiver, creating a closure activation (MethodContext)
whose closure is the receiver and whose caller is the sender of this message.
Supply the arguments and copied values to the activation as its arguments and copied temps.
Primitive. Optional (but you're going to want this for performance).
value:value:value:value:
Activate the receiver, creating a closure activation (MethodContext)
whose closure is the receiver and whose caller is the sender of this message.
Supply the arguments and copied values to the activation as its arguments and copied temps.
Primitive. Optional (but you're going to want this for performance).
valueAt:
Evaluate the receiver (block), with another priority as the actual one
and restore it afterwards. The caller should be careful with using
higher priorities.
valueNoContextSwitch
An exact copy of BlockClosure>>value except that this version will not preempt
the current process on block activation if a higher-priority process is runnable.
Primitive. Essential.
valueNoContextSwitch:
An exact copy of BlockClosure>>value: except that this version will not preempt
the current process on block activation if a higher-priority process is runnable.
Primitive. Essential.
valueSupplyingAnswer:
valueSupplyingAnswers:
evaluate the block using a list of questions / answers that might be called upon to
automatically respond to Object>>confirm: or FillInTheBlank requests
valueSupplyingMetacelloAnswers:
evaluate the block using a list of questions / answers that might be called upon to
automatically respond to Object>>confirm: or FillInTheBlank requests
valueSuppressingAllMessages
valueSuppressingMessages:
valueSuppressingMessages:supplyingAnswers:
valueUninterruptably
Prevent remote returns from escaping the sender. Even attempts to terminate (unwind) this process will be halted and the process will resume here. A terminate message is needed for every one of these in the sender chain to get the entire process unwound.
valueUnpreemptively
Evaluate the receiver (block), without the possibility of preemption by higher priority processes. Use this facility VERY sparingly!
valueWithArguments:
Activate the receiver, creating a closure activation (MethodContext)
whose closure is the receiver and whose caller is the sender of this message.
Supply the arguments in an anArray and copied values to the activation as its arguments and copied temps.
Primitive. Optional (but you're going to want this for performance).
valueWithBindings:
Evaluate the receiver in the context of the given dynamicBindings
valueWithBindingsContext:
Private. Evaluate the receiver in the context of the
given dynamicBindings context
valueWithEnoughArguments:
call me with enough arguments from anArray
valueWithExit
valueWithPossibleArgs:
valueWithPossibleArgument:
Evaluate the block represented by the receiver.
If the block requires one argument, use anArg, if it requires more than one,
fill up the rest with nils.
valueWithRequestor:
To do later: make the fillInTheBlank display more informative captions.
Include the description of the service, and maybe record steps
valueWithin:onTimeout:
Evaluate the receiver.
If the evaluation does not complete in less than aDuration evaluate the timeoutBlock instead
visitWithValuable:
whileFalse
Ordinarily compiled in-line, and therefore not overridable.
This is in case the message is sent to other than a literal block.
Evaluate the receiver, as long as its value is false.
whileFalse:
Ordinarily compiled in-line, and therefore not overridable.
This is in case the message is sent to other than a literal block.
Evaluate the argument, aBlock, as long as the value of the receiver is false.
whileNil:
Unlike #whileTrue/False: this is not compiled inline.
whileNotNil:
Unlike #whileTrue/False: this is not compiled inline.
whileTrue
Ordinarily compiled in-line, and therefore not overridable.
This is in case the message is sent to other than a literal block.
Evaluate the receiver, as long as its value is true.
whileTrue:
Ordinarily compiled in-line, and therefore not overridable.
This is in case the message is sent to other than a literal block.
Evaluate the argument, aBlock, as long as the value of the receiver is true.
BlockContext
My instances function similarly to instances of MethodContext, but they hold the dynamic state for execution of a block in Smalltalk. They access all temporary variables and the method sender via their home pointer, so that those values are effectively shared. Their indexable part is used to store their independent value stack during execution.

My instance must hold onto its home in order to work. This can cause circularities if the home is also pointing (via a temp, perhaps) to the instance. In the rare event that this happens (as in SortedCollection sortBlock:) the message fixTemps will replace home with a copy of home, thus defeating the sharing of temps but, nonetheless, eliminating the circularity.
BlockContexts must only be created using the method newForMethod:. Note that it is impossible to determine the real object size of a BlockContext except by asking for the frameSize of its method. Any fields above the stack pointer (stackp) are truly invisible -- even (and especially!) to the garbage collector. Any store into stackp other than by the primitive method stackp: is potentially fatal.
=
Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.
aboutToReturn:through:
Called from VM when an unwindBlock is found between self and its home. Return to home's sender, executing unwind blocks on the way.
activeHome
Search senders for the home context. If the home
context is not found on the sender chain answer nil.
argumentCount
Added for ANSI compatibility.
asContext
asMinimalRepresentation
Answer the receiver.
assert
bench
See how many times I can value in 5 seconds. I'll answer a meaningful description.
blockReturnTop
Simulate the interpreter's action when a ReturnTopOfStack bytecode is
encountered in the receiver.
caller
cannotReturn:
The receiver tried to return result to a method context that no longer exists.
closureHome
Answer the context from which an ^-return should return from.
contextForLocalVariables
Answer the context in which local variables (temporaries) are stored.
copyForSaving
Fix the values of the temporary variables used in the block that are
ordinarily shared with the method in which the block is defined.
copyTo:blocks:
Copy self and my sender chain down to, but not including, aContext. End of copied chain will have nil sender. BlockContexts whose home is also copied will point to the copy. However, blockContexts that are not on the stack but may be later will not have their home pointing in the new copied thread. So an error will be raised if one of these tries to return directly to its home.
decompile
decompileString
doPostProcessingFor:response:
The method is to provide compatibility with HttpAdaptor's post processing.
The receiver is expected to accept two arguments.
doWhileFalse:
Evaluate the receiver once, then again as long the value of conditionBlock is false.
doWhileTrue:
Evaluate the receiver once, then again as long the value of conditionBlock is true.
durationToRun
Answer the duration taken to execute this block.
endPC
Determine end of block from long jump preceding it
ensure:
Evaluate a termination block after evaluating the receiver, regardless of whether the receiver's evaluation completes.
fixCallbackTemps
Fix the values of the temporary variables used in the block that are
ordinarily shared with the method in which the block is defined.
This is needed because Squeak is a crappy Smalltalk implementation
that does not have full blcck closures.
fixTemps
Fix the values of the temporary variables used in the block that are
ordinarily shared with the method in which the block is defined.
fork
Create and schedule a Process running the code in the receiver.
forkAndWait
Suspend current process and execute self in new process, when it completes resume current process
forkAt:
Create and schedule a Process running the code in the receiver at the given priority. Answer the newly created process.
forkAt:named:
Create and schedule a Process running the code in the receiver at the
given priority and having the given name. Answer the newly created
process.
forkNamed:
Create and schedule a Process running the code in the receiver and
having the given name.
forkWithBindings
Create and schedule a new process that has the same
dynamic bindings as the active process
forkWithBindings:
Create and schedule a new process with the given dynamic bindings
forkWithClampedBindings
forkWithClampedBindings:
forkWithIsolatedBindings
forkWithIsolatedBindings:
fullPrintOn:
handleRequest:
hasInstVarRef
Answer whether the receiver references an instance variable.
hasMethodReturn
Answer whether the receiver has a return ('^') in its code.
hash
Answer a SmallInteger whose value is related to the receiver's identity.
May be overridden, and should be overridden in any classes that define =
home
Answer the context in which the receiver was defined.
home:startpc:nargs:
This is the initialization message. The receiver has been initialized with
the correct size only.
ifCurtailed:
Evaluate the receiver with an abnormal termination action.
ifError:
Evaluate the block represented by the receiver, and normally return it's value. If an error occurs, the errorHandlerBlock is evaluated, and it's value is instead returned. The errorHandlerBlock must accept zero, one, or two parameters (the error message and the receiver).
instVarAt:put:
Primitive. Store a value into a fixed variable in the receiver. The
numbering of the variables corresponds to the named instance variables.
Fail if the index is not an Integer or is not the index of a fixed variable.
Answer the value stored as the result. Using this message violates the
principle that each object has sovereign control over the storing of
values into its instance variables. Essential. See Object documentation
whatIsAPrimitive.
isBlock
isExecutingBlock
isValid
Answer true so we can be used in event dispatching.
method
Answer the compiled method in which the receiver was defined.
methodReturnContext
Answer the context from which an ^-return should return from.
myEnv
polymorphic with MethodContext
newProcess
Answer a Process running the code in the receiver. The process is not
scheduled.
newProcessWith:
Answer a Process running the code in the receiver. The receiver's block
arguments are bound to the contents of the argument, anArray. The
process is not scheduled.
newProcessWithBindings
Create a new process that has the same dynamic bindings
as the active process
newProcessWithBindings:
Create a new process with the given dynamic bindings
newProcessWithClampedBindings
Create a new process with a nested set of the dynamicBindings of
the active process
newProcessWithClampedBindings:
Create a new process with a nested set of the given dynamicBindings
newProcessWithIsolatedBindings
Create a new process with a copy of the dynamicBindings of the
acitve process
newProcessWithIsolatedBindings:
Create a new process with a copy of the given dynamicBindings
numArgs
Answer the number of arguments that must be used to evaluate this block
on:do:
Evaluate the receiver in the scope of an exception handler.
onDNU:do:
Catch MessageNotUnderstood exceptions but only those of the given selector (DNU stands for doesNotUnderstand:)
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
printOnStream:
privHome:
privRefresh
Reinitialize the receiver so that it is in the state it was at its creation.
processHttp
<Boolean> The receiver should answer a boolean to indicate whether
there is an HttpResponse available (accessed by HttpResponse current).
If the receiver takes no arguments, then assume that it answers a Boolean
and uses dyanmic bindings to access the current request/response, otherwise
pass in the current request and set the current response.
processHttpRequest:
<HttpResponse> The receiver should answer an HttpResponse for sending
to the client.
processVisitor:
pushArgs:from:
Simulates action of the value primitive.
receiver
Refer to the comment in ContextPart|receiver.
reentrant
Copy before calling so multiple activations can exist
renderOn:
Override this method to customize how objects (not components) are rendered when passed as an argument to #render:. The default is the return value of #displayString.
Just remember that you can not use #callback:, #on:of:, or #call:
repeat
Evaluate the receiver repeatedly, ending only if the block explicitly returns.
repeatWithGCIf:
run the receiver, and if testBlock returns true, garbage collect and run the receiver again
split:
startpc
for use by the System Tracer only
stepToSendOrReturn
Simulate the execution of bytecodes until either sending a message or
returning a value to the receiver (that is, until switching contexts).
tempAt:
Refer to the comment in ContextPart|tempAt:.
tempAt:put:
Refer to the comment in ContextPart|tempAt:put:.
tempNamed:
Answer the value of the temporary variable whose name is the
argument, aName.
tempNamed:put:
Store the argument, value, as the temporary variable whose name is the
argument, aName.
tempVarRefs
timeToRun
Answer the number of milliseconds taken to execute this block.
validateForStack:
Do nothing, provided to provide compatibility with ComancheModule
value
Primitive. Evaluate the block represented by the receiver. Fail if the
block expects any arguments or if the block is already being executed.
Optional. No Lookup. See Object documentation whatIsAPrimitive.
value:
Primitive. Evaluate the block represented by the receiver. Fail if the
block expects other than one argument or if the block is already being
executed. Optional. No Lookup. See Object documentation
whatIsAPrimitive.
value:value:
Primitive. Evaluate the block represented by the receiver. Fail if the
block expects other than two arguments or if the block is already being
executed. Optional. See Object documentation whatIsAPrimitive.
value:value:value:
Primitive. Evaluate the block represented by the receiver. Fail if the
block expects other than three arguments or if the block is already being
executed. Optional. See Object documentation whatIsAPrimitive.
value:value:value:value:
Primitive. Evaluate the block represented by the receiver. Fail if the
block expects other than three arguments or if the block is already being
executed. Optional. See Object documentation whatIsAPrimitive.
valueAt:
Evaluate the receiver (block), with another priority as the actual one
and restore it afterwards. The caller should be careful with using
higher priorities.
valueError
valueSupplyingAnswer:
valueSupplyingAnswers:
evaluate the block using a list of questions / answers that might be called upon to
automatically respond to Object>>confirm: or FillInTheBlank requests
valueSuppressingAllMessages
valueSuppressingMessages:
valueSuppressingMessages:supplyingAnswers:
valueUninterruptably
Temporarily make my home Context unable to return control to its sender, to guard against circumlocution of the ensured behavior.
valueUnpreemptively
Evaluate the receiver (block), without the possibility of preemption by higher priority processes. Use this facility VERY sparingly!
valueWithArguments:
Primitive. Evaluate the block represented by the receiver. The argument
is an Array whose elements are the arguments for the block. Fail if the
length of the Array is not the same as the the number of arguments that
the block was expecting. Fail if the block is already being executed.
Essential. See Object documentation whatIsAPrimitive.
valueWithBindings:
Evaluate the receiver in the context of the given dynamicBindings
valueWithBindingsContext:
Private. Evaluate the receiver in the context of the
given dynamicBindings context
valueWithEnoughArguments:
call me with enough arguments from anArray
valueWithExit
valueWithPossibleArgs:
Evaluate the block represented by the receiver.
If the block requires arguments, take them from anArray. If anArray is too
large, the rest is ignored, if it is too small, use nil for the other arguments
valueWithPossibleArgument:
Evaluate the block represented by the receiver.
If the block requires one argument, use anArg, if it requires more than one,
fill up the rest with nils.
valueWithRequestor:
To do later: make the fillInTheBlank display more informative captions.
Include the description of the service, and maybe record steps
valueWithin:onTimeout:
Evaluate the receiver.
If the evaluation does not complete in less than aDuration evaluate the timeoutBlock instead
visitWithValuable:
whileFalse
Ordinarily compiled in-line, and therefore not overridable.
This is in case the message is sent to other than a literal block.
Evaluate the receiver, as long as its value is false.
whileFalse:
Ordinarily compiled in-line, and therefore not overridable.
This is in case the message is sent to other than a literal block.
Evaluate the argument, aBlock, as long as the value of the receiver is false.
whileTrue
Ordinarily compiled in-line, and therefore not overridable.
This is in case the message is sent to other than a literal block.
Evaluate the receiver, as long as its value is true.
whileTrue:
Ordinarily compiled in-line, and therefore not overridable.
This is in case the message is sent to other than a literal block.
Evaluate the argument, aBlock, as long as the value of the receiver is true.
BlockStartLocator
A BlockStartLocator is xxxxxxxxx.
Instance Variables
nextJumpIsAroundBlock: <Object>
nextJumpIsAroundBlock
- xxxxx
initialize
Subclasses should redefine this method to perform initializations on instance creation
jump:
If this jump is around a block answer the size of that block.
pushClosureCopyNumCopiedValues:numArgs:blockSize:
Answer the size of the block
send:super:numArgs:
Send Message With Selector, selector, bytecode. The argument,
supered, indicates whether the receiver of the message is specified with
'super' in the source method. The arguments of the message are found in
the top numArguments locations on the stack and the receiver just
below them.
Boolean
Boolean is an abstract class defining the protocol for logic testing operations and conditional control structures for the logical values represented by the instances of its subclasses True and False.
Boolean redefines #new so no instances of Boolean can be created. It also redefines several messages in the 'copying' protocol to ensure that only one instance of each of its subclasses True (the global true, logical assertion) and False (the global false, logical negation) ever exist in the system.
&
Evaluating conjunction. Evaluate the argument. Then answer true if
both the receiver and the argument are true.
==>
The material conditional, also known as the material implication or truth functional conditional.
Correspond to not ... or ... and does not correspond to the English if...then... construction.

known as:
b if a
a implies b
if a then b
b is a consequence of a
a therefore b (but note: 'it is raining therefore it is cloudy' is implication; 'it is autumn therefore the leaves are falling' is equivalence).

Here is the truth table for material implication:

p | q | p ==> q
-------|-------|-------------
T | T | T
T | F | F
F | T | T
F | F | T
and:
Nonevaluating conjunction. If the receiver is true, answer the value of
the argument, alternativeBlock; otherwise answer false without
evaluating the argument.
and:and:
Nonevaluating conjunction without deep nesting.
The receiver is evaluated, followed by the blocks in order.
If any of these evaluates as false, then return false immediately,
without evaluating any further blocks.
If all return true, then return true.
and:and:and:
Nonevaluating conjunction without deep nesting.
The receiver is evaluated, followed by the blocks in order.
If any of these evaluates as false, then return false immediately,
without evaluating any further blocks.
If all return true, then return true.
and:and:and:and:
Nonevaluating conjunction without deep nesting.
The receiver is evaluated, followed by the blocks in order.
If any of these evaluates as false, then return false immediately,
without evaluating any further blocks.
If all return true, then return true.
basicType
Answer a symbol representing the inherent type of the receiver
clone
Receiver has two concrete subclasses, True and False.
Only one instance of each should be made, so return self.
deepCopy
Receiver has two concrete subclasses, True and False.
Only one instance of each should be made, so return self.
eqv:
Answer true if the receiver is equivalent to aBoolean.
ifFalse:
If the receiver is true (i.e., the condition is true), then the value is the
true alternative, which is nil. Otherwise answer the result of evaluating
the argument, alternativeBlock. Create an error notification if the
receiver is nonBoolean. Execution does not actually reach here because
the expression is compiled in-line.
ifFalse:ifTrue:
Same as ifTrue:ifFalse:.
ifTrue:
If the receiver is false (i.e., the condition is false), then the value is the
false alternative, which is nil. Otherwise answer the result of evaluating
the argument, alternativeBlock. Create an error notification if the
receiver is nonBoolean. Execution does not actually reach here because
the expression is compiled in-line.
ifTrue:ifFalse:
If the receiver is true (i.e., the condition is true), then answer the value
of the argument trueAlternativeBlock. If the receiver is false, answer the
result of evaluating the argument falseAlternativeBlock. If the receiver
is a nonBoolean then create an error notification. Execution does not
actually reach here because the expression is compiled in-line.
initializedInstance
isLiteral
Answer whether the receiver has a literal text form recognized by the
compiler.
isSelfEvaluating
new
not
Negation. Answer true if the receiver is false, answer false if the
receiver is true.
or:
Nonevaluating disjunction. If the receiver is false, answer the value of
the argument, alternativeBlock; otherwise answer true without
evaluating the argument.
or:or:
Nonevaluating alternation without deep nesting.
The receiver is evaluated, followed by the blocks in order.
If any of these evaluates as true, then return true immediately,
without evaluating any further blocks.
If all return false, then return false.
or:or:or:
Nonevaluating alternation without deep nesting.
The receiver is evaluated, followed by the blocks in order.
If any of these evaluates as true, then return true immediately,
without evaluating any further blocks.
If all return false, then return false.
or:or:or:or:
Nonevaluating alternation without deep nesting.
The receiver is evaluated, followed by the blocks in order.
If any of these evaluates as true, then return true immediately,
without evaluating any further blocks.
If all return false, then return false.
or:or:or:or:or:
Nonevaluating alternation without deep nesting.
The receiver is evaluated, followed by the blocks in order.
If any of these evaluates as true, then return true immediately,
without evaluating any further blocks.
If all return false, then return false.
shallowCopy
Receiver has two concrete subclasses, True and False.
Only one instance of each should be made, so return self.
storeOn:
Refer to the comment in Object|storeOn:.
veryDeepCopyWith:
Return self. I can't be copied. Do not record me.
|
Evaluating disjunction (OR). Evaluate the argument. Then answer true
if either the receiver or the argument is true.
Categorizer
A Categorizer is xxxxxxxxx.
Instance Variables
categoryArray: <Object>
categoryStops: <Object>
elementArray: <Object>
categoryArray
- xxxxx
categoryStops
- xxxxx
elementArray
- xxxxx
addCategory:
addCategory:before:
Add a new category named heading.
If default category exists and is empty, remove it.
If nextCategory is nil, then add the new one at the end,
otherwise, insert it before nextCategory.
allCategory
allMethodSelectors
give a list of all method selectors.
assertInvariant
basicRemoveElement:
Remove the selector, element, from all categories.
categories
Answer an Array of categories (names).
categories:
Reorder my categories to be in order of the argument, anArray. If the
resulting organization does not include all elements, then give an error.
categoryOfElement:
Answer the category associated with the argument, element.
changeFromCategorySpecs:
Tokens is an array of categorySpecs as scanned from a browser 'reorganize' pane, or built up by some other process, such as a scan of an environment.
changeFromString:
Parse the argument, aString, and make this be the receiver's structure.
classify:under:
classify:under:suppressIfDefault:
Store the argument, element, in the category named heading. If aBoolean is true, then invoke special logic such that the classification is NOT done if the new heading is the Default and the element already had a non-Default classification -- useful for filein
classifyAll:under:
default
defaultList:
documentation
elementArray
elementCategoryDict
firstIndexOfCategoryNumber:
initialize
Subclasses should redefine this method to perform initializations on instance creation
isEmptyCategoryNamed:
isEmptyCategoryNumber:
lastIndexOfCategoryNumber:
listAtCategoryNamed:
Answer the array of elements associated with the name, categoryName.
listAtCategoryNumber:
Answer the array of elements stored at the position indexed by anInteger. Answer nil if anInteger is larger than the number of categories.
nullCategory
numberOfCategoryOfElement:
Answer the index of the category with which the argument, element, is
associated.
printOn:
Refer to the comment in Object|printOn:.
printOnStream:
Refer to the comment in Object|printOn:.
printString
Answer a String whose characters are a description of the receiver.
If you want to print without a character limit, use fullPrintString.
removeCategory:
Remove the category named, cat. Create an error notificiation if the
category has any elements in it.
removeElement:
removeEmptyCategories
Remove empty categories.
renameCategory:toBe:
Rename a category. No action if new name already exists, or if old name does not exist.
scanFrom:
Reads in the organization from the next chunk on aStream.
Categories or elements not found in the definition are not affected.
New elements are ignored.
setDefaultList:
sortAllCategories
sortCategories
ChronologyConstants
ChronologyConstants is a SharedPool for the constants used by the Kernel-Chronology classes.
initialize
Subclasses should redefine this method to perform initializations on instance creation
Class
I add a number of facilities to those in ClassDescription:
A set of all my subclasses (defined in ClassDescription, but only used here and below)
A name by which I can be found in a SystemDictionary
A classPool for class variables shared between this class and its metaclass
A list of sharedPools which probably should be supplanted by some better mechanism.
My instances describe the representation and behavior of objects. I add more comprehensive programming support facilities to the basic attributes of Behavior and the descriptive facilities of ClassDescription.
The slot 'subclasses' is a redundant structure. It is never used during execution, but is used by the development system to simplify or speed certain operations.
addClassVarName:
Add the argument, aString, as a class variable of the receiver.
Signal an error if the first character of aString is not capitalized,
or if it is already a variable named in the class.
addInstVarName:
Add the argument, aString, as one of the receiver's instance variables.
addSharedPool:
Add the argument, aSharedPool, as one of the receiver's shared pools.
Create an error if the shared pool is already one of the pools.
This method will work with shared pools that are plain Dictionaries or thenewer SharedPool subclasses
addSubclass:
Make the argument, aSubclass, be one of the subclasses of the receiver.
Create an error notification if the argument's superclass is not the receiver.
allClassVarNames
Answer a Set of the names of the receiver's class variables, including those
defined in the superclasses of the receiver.
allSharedPools
Answer a Set of the pools the receiver shares, including those defined
in the superclasses of the receiver.
applyChangesOfNewTraitCompositionReplacing:
See Trait>>applyChangesOfNewTraitCompositionReplacing:
asClassDefinition
asClassSideNode
asNode
basicCategory
basicCategory:
basicLocalSelectors
Direct accessor for the instance variable localSelectors.
Since localSelectors is lazily initialized, this may
return nil, which means that all selectors are local.
basicLocalSelectors:
binding
bindingOf:
Answer the binding of some variable resolved in the scope of the receiver
canFindWithoutEnvironment:
This method is used for analysis of system structure -- see senders.
classDefinitions
classPool
Answer the dictionary of class variables.
classPool:
classPoolFrom:
share the classPool with aClass.
classVarNames
Answer a Set of the names of the class variables defined in the receiver.
compileAll
compileAllFrom:
Recompile all the methods in the receiver's method dictionary (not the
subclasses). Also recompile the methods in the metaclass.
copy
Answer a copy of the receiver without a list of subclasses.
declare:
Declare class variables common to all instances. Answer whether
recompilation is advisable.
duplicateClassWithNewName:
ensureClassPool
environment
Return the environment in which the receiver is visible
environment:
externalName
Answer a name by which the receiver can be known.
fileOut
Create a file whose name is the name of the receiver with '.st' as the
extension, and file a description of the receiver onto it.
fileOutInitializerOn:
fileOutOn:moveSource:toFile:
File a description of the receiver on aFileStream. If the boolean argument,
moveSource, is true, then set the trailing bytes to the position of aFileStream and
to fileIndex in order to indicate where to find the source code.
fileOutOn:moveSource:toFile:initializing:
File a description of the receiver on aFileStream. If the boolean argument,
moveSource, is true, then set the trailing bytes to the position of aFileStream and
to fileIndex in order to indicate where to find the source code.
fileOutPool:
fileOutPool:onFileStream:
fileOutSharedPoolsOn:
file out the shared pools of this class after prompting the user about each pool
hasMethods
Answer a Boolean according to whether any methods are defined for the
receiver (includes whether there are methods defined in the receiver's
metaclass).
hasSharedPools
hasTraitComposition
isObsolete
Return true if the receiver is obsolete.
isSelfEvaluating
isSystemDefined
Answer true if the receiver is a system-defined class, and not a UniClass (an instance-specific lightweight class)
name
Answer the name of the receiver.
nameForViewer
Answer the name to be shown in the header of a viewer looking at the receiver
newSubclass
niConfiguration
nonMetaSubclassesDo:
Evaluate the argument, aBlock, for each of the receiver's immediate non-meta subclasses.
objectForDataStream:
I am about to be written on an object file. Write a reference to a class in Smalltalk instead.
obsolete
Change the receiver and all of its subclasses to an obsolete class.
officialClass
I am not a UniClass. (See Player officialClass). Return the class you use to make new subclasses.
poolDictionaryNames
possibleVariablesFor:continuedFrom:
reformatAll
Reformat all methods in this class.
Leaves old code accessible to version browsing
removeClassVarName:
Remove the class variable whose name is the argument, aString, from
the names defined in the receiver, a class. Create an error notification if
aString is not a class variable or if it is still being used in the code of
the class.
removeFromChanges
References to the receiver, a class, and its metaclass should no longer be included in the system ChangeSet.
7/18/96 sw: call removeClassAndMetaClassChanges:
removeFromSystem
Forget the receiver from the Smalltalk global dictionary. Any existing
instances will refer to an obsolete version of the receiver.
removeFromSystem:
Forget the receiver from the Smalltalk global dictionary. Any existing
instances will refer to an obsolete version of the receiver.
removeFromSystemUnlogged
Forget the receiver from the Smalltalk global dictionary. Any existing instances will refer to an obsolete version of the receiver. Do not log the removal either to the current change set nor to the system changes log
removeInstVarName:
Remove the argument, aString, as one of the receiver's instance variables.
removeSharedPool:
Remove the pool dictionary, aDictionary, as one of the receiver's pool
dictionaries. Create an error notification if the dictionary is not one of
the pools.
: Note that it removes the wrong one if there are two empty Dictionaries in the list.
removeSubclass:
If the argument, aSubclass, is one of the receiver's subclasses, remove it.
rename:
The new name of the receiver is the argument, aString.
rootsOfTheWorld
setName:
Private - set the name of the class
sharedPools
Answer a Set of the pool dictionaries declared in the receiver.
sharedPools:
sharing:
Set up sharedPools. Answer whether recompilation is advisable.
shouldFileOutPool:
respond with true if the user wants to file out aPoolName
shouldFileOutPools
respond with true if the user wants to file out the shared pools
spaceUsed
Object spaceUsed
storeDataOn:
I don't get stored. Use a DiskProxy
subclass:
subclass:instanceVariableNames:
subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class (the receiver).
subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:
subclasses
Answer a Set containing the receiver's subclasses.
subclassesDo:
Evaluate the argument, aBlock, for each of the receiver's immediate subclasses.
subclassesDoGently:
Evaluate the argument, aBlock, for each of the receiver's immediate subclasses.
superclass:methodDict:format:name:organization:instVarNames:classPool:sharedPools:
Answer an instance of me, a new class, using the arguments of the
message as the needed information.
Must only be sent to a new instance; else we would need Object flushCache.
superclass:methodDictionary:format:
Basic initialization of the receiver
template:
templateForSubclassOf:category:
traitComposition
traitComposition:
unload
Sent when a the class is removed. Does nothing, but may be overridden by (class-side) subclasses.
variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class (the receiver) in which the subclass is to
have indexable byte-sized nonpointer variables.
variableByteSubclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class (the receiver) in which the subclass is to
have indexable byte-sized nonpointer variables.
variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class (the receiver) in which the subclass is to
have indexable pointer variables.
variableSubclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class (the receiver) in which the subclass is to
have indexable pointer variables.
variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class (the receiver) in which the subclass is to
have indexable word-sized nonpointer variables.
variableWordSubclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class (the receiver) in which the subclass is to
have indexable word-sized nonpointer variables.
weakSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a subclass of an existing class (the receiver) in which the subclass is to have weak indexable pointer variables.
weakSubclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class (the receiver) in which the subclass is to
have weak indexable pointer variables.
withClassVersion:
ClassBuilder
Responsible for creating a new class or changing the format of an existing class (from a class definition in a browser or a fileIn). This includes validating the definition, computing the format of instances, creating or modifying the accompanying Metaclass, setting up the class and metaclass objects themselves, registering the class as a global, recompiling methods, modifying affected subclasses, mutating existing instances to the new format, and more.
You typically only need to use or modify this class, or even know how it works, when making fundamental changes to how the Smalltalk system and language works.
Implementation notes:
ClassBuilder relies on the assumption that it can see ALL subclasses of some class. If there are any existing subclasses of some class, regardless of whether they have instances or not, regardless of whether they are considered obsolete or not, ClassBuilder MUST SEE THEM.
beSilent:
beSilentDuring:
checkClassHierarchyConsistency
checkClassHierarchyConsistency:
checkClassHierarchyConsistencyFor:
class:instanceVariableNames:
This is the basic initialization message to change the definition of
an existing Metaclass
class:instanceVariableNames:unsafe:
This is the basic initialization message to change the definition of
an existing Metaclass
cleanupAndCheckClassHierarchy
cleanupAndCheckClassHierarchy:
cleanupClassHierarchy
cleanupClassHierarchy:
cleanupClassHierarchyFor:
computeFormat:instSize:forSuper:ccIndex:
Compute the new format for making oldClass a subclass of newSuper.
Return the format or nil if there is any problem.
countReallyObsoleteClassesAndMetaclasses
doneCompiling:
The receiver has finished modifying the class hierarchy.
Do any necessary cleanup.
format:variable:words:pointers:weak:
Compute the format for the given instance specfication.
informUserDuring:
initialize
Subclasses should redefine this method to perform initializations on instance creation
isReallyObsolete:
isSilent
moveInstVarNamed:from:to:after:
Move the given instVar from srcClass to dstClass
mutate:to:
Mutate the old class and subclasses into newClass and subclasses.
Note: This method is slightly different from: #mutate:toSuper: since
here we are at the root of reshaping and have two distinct roots.
name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:
Define a new class in the given environment
name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:unsafe:
Define a new class in the given environment.
If unsafe is true do not run any validation checks.
This facility is provided to implement important system changes.
needsSubclassOf:type:instanceVariables:from:
Answer whether we need a new subclass to conform to the requested changes
newSubclassOf:type:instanceVariables:from:
Create a new subclass of the given superclass with the given specification.
privateNewSubclassOf:
Create a new meta and non-meta subclass of newSuper
privateNewSubclassOf:from:
Create a new meta and non-meta subclass of newSuper using oldClass as template
reallyObsoleteClasses
reallyObsoleteMetaclasses
recompile:from:to:mutate:
Do the necessary recompilation after changine oldClass to newClass.
If required (e.g., when oldClass ~~ newClass) mutate oldClass to newClass
and all its subclasses. If forceMutation is true force a mutation even
if oldClass and newClass are the same.
recordClass:replacedBy:
Keep the changes up to date when we're moving instVars around
reservedNames
Return a list of names that must not be used for variables
reshapeClass:toSuper:
Reshape the given class to the new super class. Recompile all the methods in the newly created class. Answer the new class.
showProgressFor:
Announce that we're processing aClass
silentlyMoveInstVarNamed:from:to:after:
Move the instvar from srcClass to dstClass.
Do not perform any checks.
superclass:subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class.
superclass:variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class in which the subclass is to
have indexable byte-sized nonpointer variables.
superclass:variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class in which the subclass is to
have indexable pointer variables.
superclass:variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class in which the subclass is to
have indexable word-sized nonpointer variables.
superclass:weakSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
This is the standard initialization message for creating a new class as a
subclass of an existing class (the receiver) in which the subclass is to
have weak indexable pointer variables.
tooDangerousClasses
Return a list of class names which will not be modified in the public interface
update:to:
Convert oldClass, all its instances and possibly its meta class into newClass, instances of newClass and possibly its meta class. The process is surprisingly simple in its implementation and surprisingly complex in its nuances and potentially bad side effects.
We can rely on two assumptions (which are critical):
#1: The method #updateInstancesFrom: will not create any lasting pointers to 'old' instances ('old' is quote on quote since #updateInstancesFrom: will do a become of the old vs. the new instances and therefore it will not create pointers to *new* instances before the #become: which are *old* afterwards)
#2: The non-preemptive execution of the critical piece of code guarantees that nobody can get a hold by 'other means' (such as process interruption and reflection) on the old instances.
Given the above two, we know that after #updateInstancesFrom: there are no pointer to any old instances. After the forwarding become there will be no pointers to the old class or meta class either. Meaning that if we throw in a nice fat GC at the end of the critical block, everything will be gone (but see the comment right there). There's no need to worry.
validateClass:forMoving:downTo:
Make sure that we don't have any accesses to the instVar left
validateClass:forMoving:upTo:
Make sure we don't have this instvar already
validateClassName:
Validate the new class name
validateClassvars:from:forSuper:
Check if any of the classVars of oldClass conflict with the new superclass
validateInstvars:from:forSuper:
Check if any of the instVars of oldClass conflict with the new superclass
validateSubclass:canKeepLayoutFrom:forSubclassFormat:
Returns whether the immediate subclasses of oldClass can keep its layout
validateSubclassFormat:from:forSuper:extra:
Validate the # of instVars and the format of the subclasses
validateSuperclass:forSubclass:
Check if it is okay to use aSuperClass as the superclass of aClass
ClassCategoryReader
I represent a mechanism for retrieving class descriptions stored on a file.
scanFrom:
File in methods from the stream, aStream.
scanFromNoCompile:
Just move the source code for the methods from aStream.
scanFromNoCompile:forSegment:
setClass:category:
setClass:category:changeStamp:
theClass
ClassCommentReader
A ClassCommentReader is xxxxxxxxx.
Instance Variables
forClass:
scanFrom:
File in the class comment from aStream. Not string-i-fied, just a text, exactly as it is in the browser. Move to changes file.
scanFromNoCompile:
File in the class comment from aStream. Not string-i-fied, just a text, exactly as it is in the browser. Move to changes file.
ClassDescription
I add a number of facilities to basic Behaviors:
Named instance variables
Category organization for methods
The notion of a name of this class (implemented as subclass responsibility)
The maintenance of a ChangeSet, and logging changes on a file
Most of the mechanism for fileOut.

I am an abstract class, in particular, my facilities are intended for inheritance by two subclasses, Class and Metaclass.
The slots 'organization' and 'methodDict' should ONLY be accessed by message in order for things to work during ImageSegment>>discoverActiveClasses (q.v.).
addInstVarName:
Add the argument, aString, as one of the receiver's instance variables.
allInstVarNamesEverywhere
Answer the set of inst var names used by the receiver, all superclasses, and all subclasses
allMethodCategoriesIntegratedThrough:
Answer a list of all the method categories of the receiver and all its superclasses, up through mostGenericClass
allMethodsInCategory:
Answer a list of all the methods of the receiver and all its
superclasses that are in the category named aName
allUnreferencedClassVariables
Answer a list of the names of all the receiver's unreferenced class vars, including those defined in superclasses
asCommentNode
browserIcon
Answer an icon to be show in the browser for the receiving class.
browserIcon:selector:
Answer an icon to be shown for the selector aSymbol in aClassDescription.
categoryForSelector:
Starting from the receiver, find the category for the given selector (if any).
checkForInstVarsOK:
Return true if instVarString does no include any names used in a subclass
chooseClassVarName
Present the user with a list of class variable names and answer the one selected, or nil if none
chooseInstVarAlphabeticallyThenDo:
Put up a menu of all the instance variables in the receiver, presented in alphabetical order, and when the user chooses one, evaluate aBlock with the chosen variable as its parameter.
chooseInstVarThenDo:
Put up a menu of all the instance variables in the receiver, and when
the user chooses one, evaluate aBlock with the chosen variable as its
parameter. If the list is 6 or larger, then offer an alphabetical
formulation as an alternative. triggered by a 'show alphabetically' item
at the top of the list.
classCommentBlank
classSide
classThatDefinesClassVariable:
Answer the class that defines the given class variable
classThatDefinesInstanceVariable:
classVariablesString
Answer a string of my class variable names separated by spaces.
classVersion
Default. Any class may return a later version to inform readers that use ReferenceStream. 8/17/96 tk
classesThatImplementAllOf:
Return an array of any classes that implement all the messages in selectorSet.
commentFollows
Answer a ClassCommentReader who will scan in the comment.
commentInventory
Answer a string with a count of the classes with and without comments
for all the classes in the package of which this class is a member.
definition
Answer a String that defines the receiver.
fileOutCategory:
fileOutChangedMessages:on:moveSource:toFile:
File a description of the messages of this class that have been
changed (i.e., are entered into the argument, aSet) onto aFileStream. If
moveSource, is true, then set the method source pointer to the new file position.
Note when this method is called with moveSource=true, it is condensing the
.changes file, and should only write a preamble for every method.
fileOutChangedMessagesHistorically:on:moveSource:toFile:
File all historical description of the messages of this class that have been
changed (i.e., are entered into the argument, aSet) onto aFileStream. If
moveSource, is true, then set the method source pointer to the new file position.
Note when this method is called with moveSource=true, it is condensing the
.changes file, and should only write a preamble for every method.
fileOutMethod:
Write source code of a single method on a file. Make up a name for the file.
forceNewFrom:
Create a new instance of the class and fill
its instance variables up with the array.
forgetDoIts
get rid of old DoIt methods and bogus entries in the ClassOrganizer.
induceMDFault
Stache a copy of the methodDict in the organization slot (hack!),
and set the methodDict to nil. This will induce an MD fault on any message send.
See: ClassDescription>>recoverFromMDFault
and ImageSegment>>discoverActiveClasses.
instVarIndexFor:
Answer the index of the named instance variable.
instVarIndexFor:ifAbsent:
Answer the index of the named instance variable.
instVarMappingFrom:
Return the mapping from instVars of oldClass to new class that is used for converting old instances of oldClass.
instVarNameForIndex:
Answer the named instance variable with index index or nil if none.
instVarNames
Answer an Array of the receiver's instance variable names.
instVarNamesAndOffsetsDo:
This is part of the interface between the compiler and a class's instance or field names.
The class should enumerate aBinaryBlock with the instance variable name strings and
their integer offsets. The order is important. Names evaluated later will override the
same names occurring earlier.
instanceSide
instanceVariablesString
Answer a string of my instance variable names separated by spaces.
isOverridden:
isOverride:
linesOfCode
An approximate measure of lines of code.
Includes comments, but excludes blank lines.
logMethodSource:forMethodWithNode:inCategory:withStamp:notifying:
metaclass
methodsInCategory:
Answer a list of the methods of the receiver that are in category named aName
moveChangesWithVersionsTo:
Used in the process of condensing changes, this message requests that
the source code of all methods of the receiver that have been changed
should be moved to newFile.
moveInstVarNamed:to:after:
Move the given instance variable to another class.
newInstanceFrom:variable:size:map:
Create a new instance of the receiver based on the given old instance.
The supplied map contains a mapping of the old instVar names into
the receiver's instVars
niDescription
nonMetaclass
numberOfMethods
cound all methods that are local (not comming from a trait)
obsolete
Make the receiver obsolete.
organization
Answer the instance of ClassOrganizer that represents the organization
of the messages of the receiver.
organization:
Install an instance of ClassOrganizer that represents the organization of the messages of the receiver.
package
printMethodChunkHistorically:on:moveSource:toFile:
Copy all source codes historically for the method associated with selector onto the
fileStream. If moveSource true, then also set the source code pointer of the method.
printSubclassesOn:level:
As part of the algorithm for printing a description of the receiver, print the
subclass on the file stream, aStream, indenting level times.
printWithClosureAnalysisOn:
Refer to the comment in Object|printOn:.
recoverFromMDFault
This method handles methodDict faults to support, eg, discoverActiveClasses (qv).
recoverFromMDFaultWithTrace
This method handles emthodDict faults to support, eg, discoverActiveClasses (qv).
reformatMethodAt:
removeInstVarName:
Remove the argument, aString, as one of the receiver's instance
variables. Create an error notification if the argument is not found.
removeUninstantiatedSubclassesSilently
Remove the classes of any subclasses that have neither instances nor subclasses. Answer the number of bytes reclaimed
renameInstVar:to:
renameSilentlyInstVar:to:
replaceSilently:to:
text-replace any part of a method. Used for class and pool variables. Don't touch the header. Not guaranteed to work if name appears in odd circumstances
setInstVarNames:
Private - for class initialization only
sharedPoolsString
Answer a string of my shared pool names separated by spaces.
subclasses
slow implementation since Behavior does not keep trace of subclasses
subclassesDo:
Evaluate the argument, aBlock, for each of the receiver's immediate subclasses.
superclass:methodDictionary:format:
Basic initialization of the receiver
theMetaClass
Sent to a class or metaclass, always return the metaclass
theNonMetaClass
Sent to a class or metaclass, always return the class
updateInstances:from:isMeta:
Recreate any existing instances of the argument, oldClass, as instances of the receiver, which is a newly changed class. Permute variables as necessary. Return the array of old instances (none of which should be pointed to legally by anyone but the array).
updateInstancesFrom:
Recreate any existing instances of the argument, oldClass, as instances of
the receiver, which is a newly changed class. Permute variables as
necessary. Return the array of old instances (none of which should be
pointed to legally by anyone but the array).
version
Allows polymoprhism with TraitDescription>>version
ClassOrganizer
I represent method categorization information for classes. The handling of class comments has gone through a tortuous evolution. Grandfathered class comments (before late aug 98) have no time stamps, and historically, fileouts of class comments always substituted the timestamp reflecting the author and date/time at the moment of fileout; and historically any timestamps in a filed out class comment were dropped on the floor, with the author & time prevailing at the moment of filein being substituted. Such grandfathered comments now go out on fileouts with '<historical>' timestamp; class comments created after the 8/98 changes will have their correct timestamps preserved, though there is not yet a decent ui for reading those stamps other than filing out and looking at the file; nor is there yet any ui for browsing and recovering past versions of such comments. Everything in good time!
addCategory:before:
Add a new category named heading.
If default category exists and is empty, remove it.
If nextCategory is nil, then add the new one at the end,
otherwise, insert it before nextCategory.
changeFromCategorySpecs:
Tokens is an array of categorySpecs as scanned from a browser 'reorganize' pane, or built up by some other process, such as a scan of an environment.
classify:under:suppressIfDefault:
Store the argument, element, in the category named heading. If aBoolean is true, then invoke special logic such that the classification is NOT done if the new heading is the Default and the element already had a non-Default classification -- useful for filein
hasCategoryFor:
isClassOrganizer
notifyOfChangedCategoriesFrom:to:
notifyOfChangedCategoryFrom:to:
notifyOfChangedSelector:from:to:
notifyOfChangedSelectorsOldDict:newDict:
removeCategory:
Remove the category named, cat. Create an error notificiation if the
category has any elements in it.
removeElement:
removeEmptyCategories
Remove empty categories.
renameCategory:toBe:
Rename a category. No action if new name already exists, or if old name does not exist.
setDefaultList:
sortCategories
uncategorizedSelectors
CompiledMethod
My instances are methods suitable for interpretation by the virtual machine. This is the only class in the system whose instances intermix both indexable pointer fields and indexable integer fields.

The current format of a CompiledMethod is as follows:
header (4 bytes)
literals (4 bytes each)
bytecodes (variable)
trailer (variable)
The header is a 30-bit integer with the following format:
(index 0) 9 bits: main part of primitive number (#primitive)
(index 9) 8 bits: number of literals (#numLiterals)
(index 17) 1 bit: whether a large frame size is needed (#frameSize)
(index 18) 6 bits: number of temporary variables (#numTemps)
(index 24) 4 bits: number of arguments to the method (#numArgs)
(index 28) 1 bit: high-bit of primitive number (#primitive)
(index 29) 1 bit: flag bit, ignored by the VM (#flag)
The trailer has two variant formats. In the first variant, the last byte is at least 252 and the last four bytes represent a source pointer into one of the sources files (see #sourcePointer). In the second variant, the last byte is less than 252, and the last several bytes are a compressed version of the names of the method's temporary variables. The number of bytes used for this purpose is the value of the last byte in the method.
=
Answer whether the receiver implements the same code as the
argument, method.
abstractMarkers
abstractPCForConcretePC:
Answer the abstractPC matching concretePC.
abstractSymbolic
Answer a String that contains a list of all the byte codes in a method with a
short description of each, using relative addresses and not including code bytes.
allEmbeddedBlockMethods
allLiterals
asNINode
asString
Convert to a String with Characters for each byte.
Fast code uses primitive that avoids character conversion
basicNew:
blockExtentsInto:from:to:scanner:numberer:
Support routine for startpcsToBlockExtents
blockExtentsToTempsMap
If the receiver has been copied with temp names answer a
map from blockExtent to temps map in the same format as
BytecodeEncoder>>blockExtentsToTempNamesMap. if the
receiver has not been copied with temps answer nil.
category
checkOKToAdd:at:
Issue several warnings as the end of the changes file approaches its limit,
and finally halt with an error when the end is reached.
classBinding
clearFlag
Clear the user-level flag bit
compilerClass
conflictMarker
containsBlockClosures
copyWithTempNames:
copyWithTempsFromMethodNode:
copyWithTrailerBytes:
Testing:
(CompiledMethod compiledMethodAt: #copyWithTrailerBytes:)
tempNamesPut: 'copy end '
createBlock:
dateMethodLastSubmitted
Answer a Date object indicating when a method was last submitted. If there is no date stamp, return nil
debuggerMap
decompile
Return the decompiled parse tree that represents self
decompileString
decompileWithTemps
Return the decompiled parse tree that represents self, but get the temp names
by compiling the sourcecode...
decompilerClass
defaultSelector
Invent and answer an appropriate message selector (a Symbol) for me,
that is, one that will parse with the correct number of arguments.
disabledMarker
embeddedBlockMethods
endPC
Answer the index of the last bytecode.
equivalentTo:
does not work yet with non-RB parseTrees
explicitRequirementMarker
explorerContents
(CompiledMethod compiledMethodAt: #explorerContents) explore
fileIndex
filePosition
flag
Answer the user-level flag bit
flushCache
Tell the interpreter to remove all references to this method from its method lookup cache, if it has one. This primitive must be called whenever a method is defined or removed.
NOTE: Only one of two selective flush methods needs to be used.
Squeak 2.2 and earlier uses 119 (See Symbol flushCache).
Squeak 2.3 and later uses 116 (See CompiledMethod flushCache).
frameSize
Answer the size of temporary frame needed to run the receiver.
fullFrameSize
getPreambleFrom:at:
getSource
getSourceFor:in:
Retrieve or reconstruct the source code for this method.
getSourceFromFile
Read the source code from file, determining source file index and
file position from the last 3 bytes of this method.
getSourceReplacingSelectorWith:
hasBreakpoint
hasInstVarRef
Answer whether the method references an instance variable.
hasLiteral:
Answer whether the receiver references the argument, literal.
hasLiteralSuchThat:
Answer true if litBlock returns true for any literal in this method, even if embedded in array structure.
hasLiteralThorough:
Answer true if any literal in this method is literal,
even if embedded in array structure.
hasNewPropertyFormat
As of the closure compiler all methods have (or better have) the new
format where the penultimate literal is either the method's selector
or its properties and the ultimate literal is the class association.
hasReportableSlip
Answer whether the receiver contains anything that should be brought
to the attention of the author when filing out. Customize the lists here
to suit your preferences. If slips do not get reported in spite of your
best efforts here, make certain that the Preference 'checkForSlips' is set
to true.
header
Answer the word containing the information about the form of the
receiver and the form of the context needed to run the receiver.
headerDescription
Answer a description containing the information about the form of the
receiver and the form of the context needed to run the receiver.
holdsTempNames
Are tempNames stored in trailer bytes
implicitRequirementMarker
indexOfLiteral:
Answer the literal index of the argument, literal, or zero if none.
initialPC
Answer the program counter for the receiver's first bytecode.
initialize
Subclasses should redefine this method to perform initializations on instance creation
inspectorClass
Answer the class of the inspector to be used on the receiver. Called by inspect;
use basicInspect to get a normal (less useful) type of inspector.
isAbstract
isBlockMethod
Is this a sub-method (embedded block's method) of another method. If so the last literal points to its outer method
isBlockMethod:
Use the sign bit in the header to mark methods that are sub-methods of an outer method. The outer method will be held in my last literal.
isBlueBookCompiled
Answer whether the receiver was compiled using the closure compiler.
This is used to help DebuggerMethodMap choose which mechanisms to
use to inspect activations of the receiver.
This method answers false negatives in that it only identifies methods
that create old BlockClosures or use the new BlockClosure bytecodes.
It cannot tell if a method which uses neither the old nor the new block
bytecodes is compiled with the blue-book compiler or the new compiler.
But since methods that don't create blocks have essentially the same
code when compiled with either compiler this makes little difference.
isClosureCompiled
Answer whether the receiver was compiled using the closure compiler.
This is used to help DebuggerMethodMap choose which mechanisms to
use to inspect activations of the receiver.
This method answers false negatives in that it only identifies methods
that create new BlockClosures or use the new BlockClosure bytecodes.
But since methods that don't create blocks have essentially the same
code when compiled with either compiler this makes little difference.
isClosureCompiled:
Use the sign bit in the header to mark methods that have been compiled using the new closure compiler (Parser2).
isCompiledMethod
isConflict
isDisabled
isDisabled:
isExplicitlyRequired
isExplicitlyRequired:
isImplicitlyRequired
isImplicitlyRequired:
isInstalled
isProvided
isProvided:
isQuick
Answer whether the receiver is a quick return (of self or of an instance
variable).
isRequired
isRequired:
isReturnField
Answer whether the receiver is a quick return of an instance variable.
isReturnSelf
Answer whether the receiver is a quick return of self.
isReturnSpecial
Answer whether the receiver is a quick return of self or constant.
isSubclassResponsibility
isSubclassResponsibility:
linesOfCode
An approximate measure of lines of code.
Includes comments, but excludes blank lines.
literalAt:
Answer the literal indexed by the argument.
literalAt:put:
Replace the literal indexed by the first argument with the second
argument. Answer the second argument.
literalStrings
literals
Answer an Array of the literals referenced by the receiver.
literalsDo:
Evaluate aBlock for each of the literals referenced by the receiver.
longPrintOn:
List of all the byte codes in a method with a short description of each
longPrintOn:indent:
List of all the byte codes in a method with a short description of each
longPrintRelativeOn:indent:
List of all the byte codes in a method with a short description of each
mapFromBlockKeys:toSchematicTemps:
Decode a schematicTempNamesString that encodes the layout of temp names
in a method and any closures/blocks within it, matching keys in keys to
vectors of temp names.
markerOrNil
If I am a marker method, answer the symbol used to mark me. Otherwise
answer nil.
What is a marker method? It is method with body like
'self subclassResponsibility' or '^ self subclassResponsibility'
used to indicate ('mark') a special property.
Marker methods compile to bytecode like:
9 <70> self
10 <D0> send: <literal 1>
11 <87> pop
12 <78> returnSelf
for the first form, or
9 <70> self
10 <D0> send: <literal 1>
11 <7C> returnTop
for the second form.
messages
Answer a Set of all the message selectors sent by this method.
messagesDo:
messagesSequence
Answer a Set of all the message selectors sent by this method.
method
polymorphic with closure
methodClass
answer the class that I am installed in
methodClass:
set the class binding in the last literal to aClass
methodClassAssociation
answer the association to the class that I am installed in, or nil if none.
methodNode
Return the parse tree that represents self
methodNodeFormatted
Answer a method node made from pretty-printed (and colorized, if decorate is true)
source text.
methodReference
needsFrameSize:
Set the largeFrameBit to accomodate the newFrameSize
new
new:
newBytes:trailerBytes:nArgs:nTemps:nStack:nLits:primitive:
newBytes:trailerBytes:nArgs:nTemps:nStack:nLits:primitive:flag:
newFrom:
newInstanceFrom:variable:size:map:
newMethod:header:
niDescription
niLabel
numArgs
Answer the number of arguments the receiver takes.
numLiterals
Answer the number of literals used by the receiver.
numTemps
Answer the number of temporary variables used by the receiver.
objectAt:
Primitive. Answer the method header (if index=1) or a literal (if index
>1) from the receiver. Essential. See Object documentation
whatIsAPrimitive.
objectAt:put:
Primitive. Store the value argument into a literal in the receiver. An
index of 2 corresponds to the first literal. Fails if the index is less than 2
or greater than the number of literals. Answer the value as the result.
Normally only the compiler sends this message, because only the
compiler stores values in CompiledMethods. Essential. See Object
documentation whatIsAPrimitive.
objectForDataStream:
Return an object to store on an external data stream.
origin
parseTree
parserClass
pcPreviousTo:
penultimateLiteral
Answer the penultimate literal of the receiver, which holds either
the receiver's selector or its properties (which will hold the selector).
penultimateLiteral:
Answer the penultimate literal of the receiver, which holds either
the receiver's selector or its properties (which will hold the selector).
pragmaAt:
Answer the pragma with selector aKey, or nil if none.
pragmas
primitive
Answer the primitive index associated with the receiver.
Zero indicates that this is not a primitive method.
We currently allow 10 bits of primitive index, but they are in two places
for backward compatibility. The time to unpack is negligible,
since the reconstituted full index is stored in the method cache.
primitive:numArgs:numTemps:stackSize:literals:bytecodes:trailer:
primitiveErrorVariableName
Answer the primitive error code temp name, or nil if none.
printOn:
Overrides method inherited from the byte arrayed collection.
printOnStream:
Overrides method inherited from the byte arrayed collection.
printPrimitiveOn:
Print the primitive on aStream
properties
Answer the method properties of the receiver.
properties:
Set the method-properties of the receiver to aMethodProperties.
propertyKeysAndValuesDo:
Enumerate the receiver with all the keys and values.
propertyValueAt:
propertyValueAt:ifAbsent:
propertyValueAt:put:
Set or add the property with key propName and value propValue.
If the receiver does not yet have a method properties create one and replace
the selector with it. Otherwise, either relace propValue in the method properties
or replace method properties with one containing the new property.
putSource:fromParseNode:class:category:inFile:priorMethod:
putSource:fromParseNode:class:category:withStamp:inFile:priorMethod:
putSource:fromParseNode:inFile:withPreamble:
Store the source code for the receiver on an external file.
If no sources are available, i.e., SourceFile is nil, then store
temp names for decompilation at the end of the method.
If the fileIndex is 1, print on *.sources; if it is 2, print on *.changes,
in each case, storing a 4-byte source code pointer at the method end.
qCompress:
A very simple text compression routine designed for method temp names.
Most common 11 chars get values 1-11 packed in one 4-bit nibble;
the next most common get values 12-15 (2 bits) * 16 plus next nibble;
unusual ones get three nibbles, the first being the escape nibble 0.
CompiledMethod>>endPC determines the maximum length of encoded
output, which means 1 to (251 - 128) * 128 + 127, or 15871 bytes
qCompress:firstTry:
A very simple text compression routine designed for method temp names.
Most common 12 chars get values 0-11 packed in one 4-bit nibble;
others get values 12-15 (2 bits) * 16 plus next nibble.
Last char of str must be a space so it may be dropped without
consequence if output ends on odd nibble.
Normal call is with firstTry == true.
qDecompress:
Decompress strings compressed by qCompress:.
Most common 12 chars get values 0-11 packed in one 4-bit nibble;
others get values 12-15 (2 bits) * 16 plus next nibble
qDecompressFrom:
<ReadStream on: ByteArray> ^<String>
readDataFrom:size:
Fill in my fields. My header and number of literals are already installed. Must read both objects for the literals and bytes for the bytecodes.
readsField:
Answer whether the receiver loads the instance variable indexed by the
argument.
readsRef:
Answer whether the receiver loads the argument.
refersToLiteral:
Answer true if any literal in this method is literal, even if embedded in array structure or within its pragmas.
remoteReturns
For closure methods only
removeProperty:
Remove the property propName if it exists.
Do _not_ raise an error if the property is missing.
removeProperty:ifAbsent:
Remove the property propName if it exists.
Answer the evaluation of aBlock if the property is missing.
replace:with:in:
returnField
Answer the index of the instance variable returned by a quick return
method.
scanFor:
Answer whether the receiver contains the argument as a bytecode.
scanLongLoad:
Answer whether the receiver contains a long load whose extension is the
argument.
scanLongStore:
Answer whether the receiver contains a long store whose extension is
the argument.
scanVeryLongLoad:offset:
Answer whether the receiver contains a long load whose extension is the
argument.
scanVeryLongStore:offset:
Answer whether the receiver contains a long load with the given offset.
Note that the constant +32 is the known difference between a
store and a storePop for instVars, and it will always fail on literal variables,
but these only use store (followed by pop) anyway.
scanner
searchForClass
search me in all classes, if found, return my class. Slow!
searchForSelector
search me in all classes, if found, return my selector. Slow!
searchImageForHomeMethod
selector
Answer a method's selector. This is either the penultimate literal,
or, if the method has any properties or pragmas, the selector of
the MethodProperties stored in the penultimate literal.
selector:
Set a method's selector. This is either the penultimate literal,
or, if the method has any properties or pragmas, the selector of
the MethodProperties stored in the penultimate literal.
sendsSelector:
sendsToSuper
Answer whether the receiver sends any message to super.
setMySourcePointer:
setSourcePointer:
setSourcePosition:inFile:
smallFrameSize
sourceClass
Get my receiver class (method class) from the preamble of my source. Return nil if not found.
sourceFileStream
Answer the sources file stream with position set at the beginning of my source string
sourcePointer
Answer the integer which can be used to find the source file and position for this method.
The returned value is either 0 (if no source is stored) or a number between 16r1000000 and 16r4FFFFFF.
The actual interpretation of this number is up to the SourceFileArray stored in the global variable SourceFiles.
sourceSelector
Answer my selector extracted from my source. If no source answer nil
startpcsToBlockExtents
Answer a Dictionary of startpc to Interval of blockExtent, using the
identical numbering scheme described in and orchestrated by
BlockNode>>analyseArguments:temporaries:rootNode:. This is
used in part to find the temp names for any block in a method, as
needed by the debugger. The other half is to recompile the method,
obtaining the temp names for each block extent. By indirecting through
the blockExtent instead of using the startpc directly we decouple the
debugger's access to temp names from the exact bytecode; insulating
debugging from minor changes in the compiler (e.g. changes in literal
pooling, adding prefix bytecodes, adding inst vars to CompiledMethod
in literals towards the end of the literal frame, etc). If the recompilation
doesn't produce exactly the same bytecode at exactly the same offset
no matter; the blockExtents will be the same.
storeDataOn:
Store myself on a DataStream. I am a mixture of objects and raw data bytes. Only use this for blocks. Normal methodDictionaries should not be put out using ReferenceStreams. Their fileOut should be attached to the beginning of the file.
storeLiteralsOn:forClass:
Store the literals referenced by the receiver on aStream, each terminated by a space.
storeOn:
Refer to the comment in Object|storeOn:.
subclassResponsibilityMarker
symbolic
Answer a String that contains a list of all the byte codes in a method
with a short description of each.
symbolicLinesDo:
Evaluate aBlock with each of the lines in the symbolic output.
tempNames
tempNamesString
Decompress the encoded temp names into a schematicTempNames string.
tempsSubSequenceFrom:
timeStamp
Answer the authoring time-stamp for the given method, retrieved from the sources or changes file. Answer the empty string if no time stamp is available.
toReturnConstant:trailerBytes:
toReturnField:trailerBytes:
toReturnSelf
toReturnSelfTrailerBytes:
trailer
usesClosureBytecodes
Answer whether the receiver was compiled using the closure compiler.
This is used to help DebuggerMethodMap choose which mechanisms to
use to inspect activations of the receiver.
This method answers false negatives in that it only identifies methods
that use the new BlockClosure bytecodes.
But since methods that don't create blocks have essentially the same
code when compiled with either compiler this makes little difference.
valueWithReceiver:arguments:
veryDeepCopyWith:
Return self. I am always shared. Do not record me. Only use this for blocks. Normally methodDictionaries should not be copied this way.
who
Answer an Array of the class in which the receiver is defined and the
selector to which it corresponds.
writesField:
Answer whether the receiver stores into the instance variable indexed
by the argument.
writesRef:
Answer whether the receiver stores into the argument.
zapSourcePointer
clobber the source pointer since it will be wrong
Complex
I represent a complex number.
real -- real part of the complex number
imaginary -- imaginary part of the complex number
Complex number constructors:
5 i
6 + 7 i.
5.6 - 8 i.
Complex real: 10 imaginary: 5.
Complex abs: 5 arg: (Float pi / 4)
Arithmetic operation with other complex or non-complex numbers work.
(5 - 6 i) + (-5 + 8 i). "Arithmetic between two complex numbers."
5 * (5 - 6 i). "Arithmetic between a non-complex and a complex number."

It is also possible to perform arithmetic operations between a complex number
and a array of (complex) numbers:
2 * {1 + 2i.
3 + 4i.
5 + 6i}
5 + 5i * {1 + 2i.
3.
5 + 6i}
It behaves analogously as it is with normal numbers and an array.
NOTE: Although Complex something similiar to the Smalltalk's Number class, it would
not be a good idea to make a Complex to be a subclass of a Number because:
- Number is subclass of Magnitude and Complex is certainly not a magnitude.
Complex does not behave very well as a Magnitude. Operations such as
<
>
<=
>=
do not have sense in case of complex numbers.
- Methods in the following Number methods' categories do not have sense for a Complex numbers
trucation and round off
testing
intervals
comparing
- However the following Number methods' categories do have sense for a Complex number
arithmetic (with the exception of operation
//
\\
quo:
rem:
mathematical functions
Thus Complex is somewhat similar to a Number but it is not a subclass of it. Some operations
we would like to inherit (e.g. #abs, #negated, #reciprocal) but some of the Number operation
do not have sens to inherit or to overload. Classes are not always neat mechanism.
!!! We had to COPY the implementation of the
abs
negated
reciprocal
log:
isZero
reciprocal
...
methods from the Number class to the Complex class. Awful solution. Now I begin to
appreciate the Self.
Missing methods
String | converting | asComplex
Complex | mathematical functions | arcSin
Complex | mathematical functions | arcCos
Complex | mathematical functions | arcTan
*
Answer the result of multiplying the receiver by aNumber.
+
Answer the sum of the receiver and aNumber.
-
Answer the difference between the receiver and aNumber.
/
Answer the result of dividing receiver by aNumber
=
Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.
abs
Answer the distance of the receiver from zero (0 + 0 i).
abs:arg:
adaptToCollection:andSend:
If I am involved in arithmetic with a Collection, return a Collection of
the results of each element combined with me in that expression.
adaptToFloat:andSend:
If I am involved in arithmetic with a Float, convert it to a Complex number.
adaptToFraction:andSend:
If I am involved in arithmetic with a Fraction, convert it to a Complex number.
adaptToInteger:andSend:
If I am involved in arithmetic with an Integer, convert it to a Complex number.
arg
Answer the argument of the receiver.
cos
Answer receiver's cosine.
cosh
Answer receiver's hyperbolic cosine.
divideFastAndSecureBy:
Answer the result of dividing receiver by aNumber
divideSecureBy:
Answer the result of dividing receiver by aNumber
exp
Answer the exponential of the receiver.
hash
Hash is reimplemented because = is implemented.
imaginary
imaginary:
isComplex
Answer true if receiver is a Complex number. False by default.
isNumber
Overridden to return true in Number, natch
isZero
ln
Answer the natural log of the receiver.
log:
Answer the log base aNumber of the receiver.
negated
Answer a Number that is the negation of the receiver.
new
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
real
real:
real:imaginary:
reciprocal
Answer 1 divided by the receiver. Create an error notification if the
receiver is 0.
sin
Answer receiver's sine.
sinh
Answer receiver's hyperbolic sine.
squared
Answer the receiver multipled by itself.
tan
Answer receivers tangent.
ContextPart
To the instruction parsing ability of InstructionStream I add the actual semantics for execution. The execution state is stored in the indexable fields of my subclasses. This includes temporary variables and a stack of values used in evaluating expressions. The actual semantics of execution can be found in my category "system simulation" and "instruction decode". These methods exactly parallel the operation of the Smalltalk machine itself.

The simulator is a group of my methods that do what the Smalltalk interpreter does: execute Smalltalk bytecodes. By adding code to the simulator, you may take statistics on the running of Smalltalk methods. For example,
Transcript show: (ContextPart runSimulated: [3 factorial]) printString.
activateMethod:withArgs:receiver:class:
Answer a ContextPart initialized with the arguments.
activateReturn:value:
Activate 'aContext return: value' in place of self, so execution will return to aContext's sender
arguments
returns the arguments of a message invocation
at:
Primitive. Assumes receiver is indexable. Answer the value of an
indexable element in the receiver. Fail if the argument index is not an
Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive. Override the default primitive to give latitude to
the VM in context management.
at:put:
Primitive. Assumes receiver is indexable. Answer the value of an
indexable element in the receiver. Fail if the argument index is not
an Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive. Override the default primitive to give latitude to
the VM in context management.
basicAt:
Primitive. Assumes receiver is indexable. Answer the value of an
indexable element in the receiver. Fail if the argument index is not an
Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive. Override the default primitive to give latitude to
the VM in context management.
basicAt:put:
Primitive. Assumes receiver is indexable. Answer the value of an
indexable element in the receiver. Fail if the argument index is not
an Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive. Override the default primitive to give latitude to
the VM in context management.
basicNew:
basicSize
Primitive. Answer the number of indexable variables in the receiver.
This value is the same as the largest legal subscript. Essential. Do not
override in any subclass. See Object documentation whatIsAPrimitive. Override the default primitive to give latitude to
the VM in context management.
bindings
Answers the Dynamic Bindings that are currently visible in the receiver's context. This is kind of a hack...we could do a better job of this if we used the exception handling primitives directly, however, this implementation has the benefit of being slightly more portable.
blockCopy:
Primitive. Distinguish a block of code from its enclosing method by
creating a new BlockContext for that block. The compiler inserts into all
methods that contain blocks the bytecodes to send the message
blockCopy:. Do not use blockCopy: in code that you write! Only the
compiler can decide to send the message blockCopy:. Fail if numArgs is
not a SmallInteger. Optional. No Lookup. See Object documentation
whatIsAPrimitive.
bottomContext
Return the last context (the first context invoked) in my sender chain
canHandleSignal:
Sent to handler (on:do:) contexts only. If my exception class (first arg) handles exception then return true, otherwise forward this message to the next handler context. If none left, return false (see nil>>canHandleSignal:)
cannotReturn:to:
The receiver tried to return result to homeContext that no longer exists.
carefullyPrint:on:
client
Answer the client, that is, the object that sent the message that created this context.
closureCopy:copiedValues:
Distinguish a block of code from its enclosing method by
creating a BlockClosure for that block. The compiler inserts into all
methods that contain blocks the bytecodes to send the message
closureCopy:copiedValues:. Do not use closureCopy:copiedValues: in code that you write! Only the
compiler can decide to send the message closureCopy:copiedValues:. Fail if numArgs is
not a SmallInteger. Optional. No Lookup. See Object documentation
whatIsAPrimitive.
completeCallee:
Simulate the execution of bytecodes until a return to the receiver.
contextEnsure:
contextForLocalVariables
Answer the context in which local variables (temporaries) are stored.
contextOn:do:
contextStack
Answer an Array of the contexts on the receiver's sender chain.
copyStack
copyTo:
Copy self and my sender chain down to, but not including, aContext. End of copied chain will have nil sender. BlockContexts whose home is also copied will point to the copy. However, blockContexts that are not on the stack but may be later will not have their home pointing in the new copied thread. So an error will be raised if one of these tries to return directly to its home. It is best to use BlockClosures instead. They only hold a ContextTag, which will work for all copies of the original home context.
copyTo:blocks:
Copy self and my sender chain down to, but not including, aContext. End of copied chain will have nil sender. BlockContexts whose home is also copied will point to the copy. However, blockContexts that are not on the stack but may be later will not have their home pointing in the new copied thread. So an error will be raised if one of these tries to return directly to its home.
cut:
Cut aContext and its senders from my sender chain
depthBelow:
Answer how many calls there are between this and aContext.
doDup
Simulate the action of a 'duplicate top of stack' bytecode.
doPop
Simulate the action of a 'remove top of stack' bytecode.
doPrimitive:method:receiver:args:
Simulate a primitive method whose index is primitiveIndex. The
simulated receiver and arguments are given as arguments to this message.
Any primitive which provikes execution needs to be intercepted and simulated
to avoid execution running away.
errorReportOn:
Write a detailed error report on the stack (above me) on a
stream. For both the error file, and emailing a bug report.
Suppress any errors while getting printStrings. Limit the length.
findContextSuchThat:
Search self and my sender chain for first one that satisfies testBlock. Return nil if none satisfy
findNextHandlerContextStarting
Return the next handler marked context, returning nil if there is none. Search starts with self and proceeds up to nil.
findNextUnwindContextUpTo:
Return the next unwind marked above the receiver, returning nil if there is none. Search proceeds up to but not including aContext.
findSecondToOldestSimilarSender
Search the stack for the second-to-oldest occurance of self's method. Very useful for an infinite recursion. Gets back to the second call so you can see one complete recursion cycle, and how it was called at the beginning.
findSimilarSender
Return the closest sender with the same method, return nil if none found
handleSignal:
Sent to handler (on:do:) contexts only. If my exception class (first arg) handles exception then execute my handle block (second arg), otherwise forward this message to the next handler context. If none left, execute exception's defaultAction (see nil>>handleSignal:).
hasContext:
Answer whether aContext is me or one of my senders
hasSender:
Answer whether the receiver is strictly above context on the stack.
home
Answer the context in which the receiver was defined.
initialize
Subclasses should redefine this method to perform initializations on instance creation
initializedInstance
insertSender:
Insert aContext and its sender chain between me and my sender. Return new callee of my original sender.
isBottomContext
Answer if this is the last context (the first context invoked) in my sender chain
isClosureContext
isContext
isContextClass
isDead
Has self finished
isHandlerContext
isUnwindContext
jump
Abandon thisContext and resume self instead (using the same current process). You may want to save thisContext's sender before calling this so you can jump back to it.
Self MUST BE a top context (ie. a suspended context or a abandoned context that was jumped out of). A top context already has its return value on its stack (see Interpreter>>primitiveSuspend and other suspending primitives).
thisContext's sender is converted to a top context (by pushing a nil return value on its stack) so it can be jump back to.
jump:
Simulate the action of a 'unconditional jump' bytecode whose offset is
the argument, distance.
jump:if:
Simulate the action of a 'conditional jump' bytecode whose offset is the
argument, distance, and whose condition is the argument, condition.
localAt:
localAt:put:
localSize
longStack
Answer a String showing the top 100 contexts on my sender chain.
method
Answer the method of this context.
methodClass
Answer the class in which the receiver's method was found.
methodNode
methodReturnConstant:
Simulate the action of a 'return constant' bytecode whose value is the
argument, value. This corresponds to a source expression like '^0'.
methodReturnContext
Answer the context from which an ^-return should return from.
methodReturnReceiver
Simulate the action of a 'return receiver' bytecode. This corresponds to
the source expression '^self'.
methodReturnTop
Simulate the action of a 'return top of stack' bytecode. This corresponds
to source expressions like '^something'.
methodSelector
namedTempAt:
Answer the value of the temp at index in the receiver's sequence of tempNames.
namedTempAt:put:
Set the value of the temp at index in the receiver's sequence of tempNames.
(Note that if the value is a copied value it is also set out along the lexical chain,
but alas not in along the lexical chain.).
new
new:
newForMethod:
nextHandlerContext
pop
Answer the top of the receiver's stack and remove the top of the stack.
popIntoLiteralVariable:
Simulate the action of bytecode that removes the top of the stack and
stores it into a literal variable of my method.
popIntoReceiverVariable:
Simulate the action of bytecode that removes the top of the stack and
stores it into an instance variable of my receiver.
popIntoRemoteTemp:inVectorAt:
Simulate the action of bytecode that removes the top of the stack and stores
it into an offset in one of my local variables being used as a remote temp vector.
popIntoTemporaryVariable:
Simulate the action of bytecode that removes the top of the stack and
stores it into one of my temporary variables.
primitiveFailToken
print:on:
Safely print anObject in the face of direct ProtoObject subclasses
printDetails:
Put my class>>selector and arguments and temporaries on the stream. Protect against errors during printing.
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
privSender:
push:
Push val on the receiver's stack.
push:fromIndexable:
Push the elements of anIndexableCollection onto the receiver's stack.
Do not call directly. Called indirectly by {1. 2. 3} constructs.
pushActiveContext
Simulate the action of bytecode that pushes the the active context on the
top of its own stack.
pushClosureCopyNumCopiedValues:numArgs:blockSize:
Simulate the action of a 'closure copy' bytecode whose result is the
new BlockClosure for the following code
pushConstant:
Simulate the action of bytecode that pushes the constant, value, on the
top of the stack.
pushLiteralVariable:
Simulate the action of bytecode that pushes the contents of the literal
variable whose index is the argument, index, on the top of the stack.
pushNewArrayOfSize:
pushReceiver
Simulate the action of bytecode that pushes the active context's receiver
on the top of the stack.
pushReceiverVariable:
Simulate the action of bytecode that pushes the contents of the receiver's
instance variable whose index is the argument, index, on the top of the
stack.
pushRemoteTemp:inVectorAt:
Simulate the action of bytecode that pushes the value at remoteTempIndex
in one of my local variables being used as a remote temp vector.
pushTemporaryVariable:
Simulate the action of bytecode that pushes the contents of the
temporary variable whose index is the argument, index, on the top of
the stack.
quickSend:to:with:super:
Send the given selector with arguments in an environment which closely resembles the non-simulating environment, with an interjected unwind-protected block to catch nonlocal returns.
Attention: don't get lost!
quickStep
If the next instruction is a send, just perform it.
Otherwise, do a normal step.
receiver
Answer the receiver of the message that created this context.
release
Remove information from the receiver and all of the contexts on its
sender chain in order to break circularities.
releaseTo:
Remove information from the receiver and the contexts on its sender
chain up to caller in order to break circularities.
restart
Unwind thisContext to self and resume from beginning. Execute unwind blocks when unwinding. ASSUMES self is a sender of thisContext
resume
Roll back thisContext to self and resume. Execute unwind blocks when rolling back. ASSUMES self is a sender of thisContext
resume:
Unwind thisContext to self and resume with value as result of last send. Execute unwind blocks when unwinding. ASSUMES self is a sender of thisContext
return
Unwind until my sender is on top
return:
Unwind thisContext to self and return value to self's sender. Execute any unwind blocks while unwinding. ASSUMES self is a sender of thisContext
return:from:
For simulation. Roll back self to aSender and return value from it. Execute any unwind blocks on the way. ASSUMES aSender is a sender of self
return:to:
Simulate the return of value to sendr.
runSimulated:
runSimulated:contextAtEachStep:
Simulate the execution of the argument, aBlock, until it ends. aBlock
MUST NOT contain an '^'. Evaluate block2 with the current context
prior to each instruction executed. Answer the simulated value of aBlock.
runUntilErrorOrReturnFrom:
ASSUMES aSender is a sender of self. Execute self's stack until aSender returns or an unhandled exception is raised. Return a pair containing the new top context and a possibly nil exception. The exception is not nil if it was raised before aSender returned and it was not handled. The exception is returned rather than openning the debugger, giving the caller the choice of how to handle it.
secondFromBottom
Return the second from bottom of my sender chain
selector
Answer the selector of the method that created the receiver.
send:super:numArgs:
Simulate the action of bytecodes that send a message with selector,
selector. The argument, superFlag, tells whether the receiver of the
message was specified with 'super' in the source method. The arguments
of the message are found in the top numArgs locations on the stack and
the receiver just below them.
send:to:with:super:
Simulate the action of sending a message with selector, selector, and
arguments, args, to receiver. The argument, superFlag, tells whether the
receiver of the message was specified with 'super' in the source method.
sender
Answer the context that sent the message that created the receiver.
shortStack
Answer a String showing the top ten contexts on my sender chain.
singleRelease
Remove information from the receiver in order to break circularities.
size
Primitive. Answer the number of indexable variables in the receiver.
This value is the same as the largest legal subscript. Essential. See Object
documentation whatIsAPrimitive. Override the default primitive to give latitude to
the VM in context management.
sourceCode
stack
Answer an Array of the contexts on the receiver's sender chain.
stackDo:
Iterates the sender chain, evaluating aBlock for each context
stackOfSize:
Answer an OrderedCollection of the top 'limit' contexts
on the receiver's sender chain.
stackPtr
For use only by the SystemTracer and the Debugger, Inspectors etc
stackp:
Storing into the stack pointer is a potentially dangerous thing.
This primitive stores nil into any cells that become accessible as a result,
and it performs the entire operation atomically.
step
Simulate the execution of the receiver's next bytecode. Answer the
context that would be the active context after this bytecode.
stepToCallee
Step to callee or sender
stepToSendOrReturn
Simulate the execution of bytecodes until either sending a message or
returning a value to the receiver (that is, until switching contexts).
storeDataOn:
Contexts are not allowed go to out in DataStreams. They must be included inside an ImageSegment.
storeIntoLiteralVariable:
Simulate the action of bytecode that stores the top of the stack into a
literal variable of my method.
storeIntoReceiverVariable:
Simulate the action of bytecode that stores the top of the stack into an
instance variable of my receiver.
storeIntoRemoteTemp:inVectorAt:
Simulate the action of bytecode that stores the top of the stack at
an offset in one of my local variables being used as a remote temp vector.
storeIntoTemporaryVariable:
Simulate the action of bytecode that stores the top of the stack into one
of my temporary variables.
swapSender:
Replace the receiver's sender with coroutine and answer the receiver's
previous sender. For use in coroutining.
tallyInstructions:
tallyMethods:
tempAt:
Answer the value of the temporary variable whose index is the
argument, index.
tempAt:put:
Store the argument, value, as the temporary variable whose index is the
argument, index.
tempNamed:
Answer the value of the temporary variable whose name is the
argument, aName.
tempNamed:put:
Store the argument, value, as the temporary variable whose name is the
argument, aName.
tempNames
Answer a SequenceableCollection of the names of the receiver's temporary
variables, which are strings.
tempScopedNames
Answer a SequenceableCollection of the names of the receiver's temporary
variables, which are strings.
tempsAndValues
Return a string of the temporary variabls and their current values
tempsAndValuesLimitedTo:indent:
Return a string of the temporary variabls and their current values
terminate
Make myself unresumable.
terminateTo:
Terminate all the Contexts between me and previousContext, if previousContext is on my Context stack. Make previousContext my sender.
theReturnMethod
top
Answer the top of the receiver's stack.
trace:
trace:on:
trace:onFileNamed:
tryNamedPrimitiveIn:for:withArgs:
Hack. Attempt to execute the named primitive from the given compiled method
tryPrimitiveFor:receiver:args:
If this method has a primitive index, then run the primitive and return its result.
Otherwise (and also if the primitive fails) return PrimitiveFailToken,
as an indication that the method should be activated and run as bytecodes.
unwindTo:
Date
Instances of Date are Timespans with duration of 1 day.
Their default creation assumes a start of midnight in the local time zone.
addDays:
addMonths:
asDate
asSeconds
Answer the seconds since the Squeak epoch: 1 January 1901
dateAndTimeNow
dayMonthYearDo:
Supply integers for day, month and year to aBlock and return the result
dayOfWeek:
daysInMonth:forYear:
daysInYear:
easterDateFor:
firstWeekdayOfMonth:year:
fromDays:
fromSeconds:
fromString:
indexOfMonth:
javascriptMonthIndex
javascriptOn:
julianDayNumber:
leap
Answer whether the receiver's year is a leap year.
leapYear:
mmddyyyy
Answer the receiver rendered in standard U.S.A format mm/dd/yyyy.
Note that the name here is slightly misleading -- the month and day numbers don't show leading zeros,
so that for example February 1 1996 is 2/1/96
month
monthIndex
nameOfDay:
nameOfMonth:
newDay:month:year:
newDay:monthNumber:year:
newDay:year:
onNextMonth
onPreviousMonth
orthodoxEasterDateFor:
previous:
Answer the previous date whose weekday name is dayName.
printFormat:
Answer a String describing the receiver using the argument formatArray.
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
printOn:format:
Print a description of the receiver on aStream using the format
denoted the argument, formatArray:

#(item item item sep monthfmt yearfmt twoDigits)

items: 1=day 2=month 3=year will appear in the order given,

separated by sep which is eaither an ascii code or character.

monthFmt: 1=09 2=Sep 3=September

yearFmt: 1=1996 2=96

digits: (missing or)1=9 2=09.

See the examples in printOn: and mmddyy
readFrom:
starting:
storeOn:
Append to the argument aStream a sequence of characters that is an
expression whose evaluation creates an object similar to the receiver.
subtractDate:
Answer the number of days between self and aDate
subtractDays:
today
tomorrow
weekday
Answer the name of the day of the week on which the receiver falls.
weekdayIndex
Sunday=1, ... , Saturday=7
year:day:
year:month:day:
yesterday
yyyymmdd
Format the date in ISO 8601 standard like '2002-10-22'.
DateAndTime
I represent a point in UTC time as defined by ISO 8601. I have zero duration.
My implementation uses three SmallIntegers and a Duration:
jdn - julian day number.
seconds - number of seconds since midnight.
nanos - the number of nanoseconds since the second.
offset - duration from UTC.
The nanosecond attribute is almost always zero but it defined for full ISO compliance and is suitable for timestamping.
+
operand conforms to protocol Duration
-
operand conforms to protocol DateAndTime or protocol Duration
<
comparand conforms to protocol DateAndTime,
or can be converted into something that conforms.
=
comparand conforms to protocol DateAndTime,
or can be converted into something that conforms.
asDate
asDateAndTime
asDuration
Answer the duration since midnight.
asLocal
asMonth
asNanoSeconds
Answer the number of nanoseconds since midnight
asSeconds
Return the number of seconds since the Squeak epoch
asTime
asTimeStamp
asUTC
asUnixTime
asWeek
asYear
clockPrecision
current
date:time:
day
dayMonthYearDo:
Evaluation the block with three arguments: day month, year.
dayOfMonth
Answer which day of the month is represented by the receiver.
dayOfWeek
Sunday=1, ... , Saturday=7
dayOfWeekAbbreviation
dayOfWeekName
dayOfYear
This code was contributed by Dan Ingalls. It is equivalent to the terser
^ jdn - (Year year: self year) start julianDayNumber + 1 but much quicker.
daysInMonth
Answer the number of days in the month represented by the receiver.
daysInYear
Answer the number of days in the year represented by the receiver.
daysLeftInYear
Answer the number of days in the year after the date of the receiver.
duration
epoch
firstDayOfMonth
fromSeconds:
fromString:
fromUnixTime:
hasEqualTicks:
hash
Hash must be redefined whenever = is redefined.
hour
hour12
Answer an <integer> between 1 and 12, inclusive, representing the hour
of the day in the 12-hour clock of the local time of the receiver.
hour24
hours
isLeapYear
javascriptMonthIndex
javascriptOn:
julianDayNumber
julianDayNumber:
localOffset
localTimeZone
localTimeZone:
meridianAbbreviation
middleOf:
Return a Timespan where the receiver is the middle of the Duration
midnight
Answer a DateAndTime starting at midnight local time
millisecondClockValue
minute
minutes
month
monthAbbreviation
monthIndex
monthName
nanoSecond
new
noon
Answer a DateAndTime starting at noon
normalize:ticks:base:
now
offset
offset:
Answer a <DateAndTime> equivalent to the receiver but with its local time
being offset from UTC by offset.
printHMSOn:
Print just hh:mm:ss
printOn:
Print as per ISO 8601 sections 5.3.3 and 5.4.1.
Prints either:
'YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for positive years) or '-YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for negative years)
printOn:withLeadingSpace:
Print as per ISO 8601 sections 5.3.3 and 5.4.1.
If printLeadingSpaceToo is false, prints either:
'YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for positive years) or '-YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for negative years)
If printLeadingSpaceToo is true, prints either:
' YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for positive years) or '-YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for negative years)
printYMDOn:
Print just YYYY-MM-DD part.
If the year is negative, prints out '-YYYY-MM-DD'.
printYMDOn:withLeadingSpace:
Print just the year, month, and day on aStream.
If printLeadingSpaceToo is true, then print as:
' YYYY-MM-DD' (if the year is positive) or '-YYYY-MM-DD' (if the year is negative)
otherwise print as:
'YYYY-MM-DD' or '-YYYY-MM-DD'
readFrom:
second
seconds
secondsSinceMidnight
setJdn:seconds:nano:offset:
setTimestampInMetacelloVersion:
ticks
Private - answer an array with our instance variables. Assumed to be UTC
ticks:offset:
ticks is {julianDayNumber. secondCount. nanoSeconds}
timeZoneAbbreviation
timeZoneName
to:
Answer a Timespan. anEnd conforms to protocol DateAndTime or protocol Timespan
to:by:
Answer a Timespan. anEnd conforms to protocol DateAndTime or protocol Timespan
to:by:do:
Answer a Timespan. anEnd conforms to protocol DateAndTime or protocol Timespan
today
tomorrow
totalSeconds
utcOffset:
Answer a <DateAndTime> equivalent to the receiver but offset from UTC by anOffset
year
year:day:
year:day:hour:minute:second:
year:day:hour:minute:second:offset:
year:month:day:
year:month:day:hour:minute:
year:month:day:hour:minute:second:
year:month:day:hour:minute:second:nanoSecond:offset:
year:month:day:hour:minute:second:offset:
yesterday
Delay
I am the main way that a process may pause for some amount of time. The simplest usage is like this:
(Delay forSeconds: 5) wait.
An instance of Delay responds to the message 'wait' by suspending the caller's process for a certain amount of time. The duration of the pause is specified when the Delay is created with the message forMilliseconds: or forSeconds:. A Delay can be used again when the current wait has finished. For example, a clock process might repeatedly wait on a one-second Delay.
The maximum delay is (SmallInteger maxVal // 2) milliseconds, or about six days. A delay in progress when an image snapshot is saved is resumed when the snapshot is re-started. Delays work across millisecond clock roll-overs.
For a more complex example, see #testDelayOf:for:rect: .
A word of advice:
This is THE highest priority code which is run in Squeak, in other words it is time-critical. The speed of this code is critical for accurate responses, it is critical for network services, it affects every last part of the system.
In short: Don't fix it if it ain't broken! This code isn't supposed to be beautiful, it's supposed to be fast! The reason for duplicating code is to make it fast. The reason for not using ifNil:[]ifNotNil:[] is that the compiler may not inline those. Since the effect of changes are VERY hard to predict it is best to leave things as they are for now unless there is an actual need to change anything
adjustResumptionTimeOldBase:newBase:
Private! Adjust the value of the system's millisecond clock at which this Delay will be awoken. Used to adjust resumption times after a snapshot or clock roll-over.
anyActive
beingWaitedOn
Answer whether this delay is currently scheduled, e.g., being waited on
beingWaitedOn:
Indicate whether this delay is currently scheduled, e.g., being waited on
delayDuration
delaySemaphore
forDuration:
forMilliseconds:
forSeconds:
handleTimerEvent
initialize
Subclasses should redefine this method to perform initializations on instance creation
isExpired
nextWakeUpTime
primSignal:atMilliseconds:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
restoreResumptionTimes
resumptionTime
Answer the value of the system's millisecondClock at which the receiver's suspended Process will resume.
runTimerEventLoop
saveResumptionTimes
schedule
Schedule this delay
scheduleDelay:
setDelay:forSemaphore:
Private! Initialize this delay to signal the given semaphore after the given number of milliseconds.
shutDown
signalWaitingProcess
The delay time has elapsed; signal the waiting process.
startTimerEventLoop
startUp
stopTimerEventLoop
testDelayOf:for:rect:
timeoutSemaphore:afterMSecs:
unschedule
unscheduleDelay:
wait
Schedule this Delay, then wait on its semaphore. The current process will be suspended for the amount of time specified when this Delay was created.
DelayWaitTimeout
DelayWaitTimeout is a special kind of Delay used in waitTimeoutMSecs: to avoid signaling the underlying semaphore when the wait times out.
isExpired
Did this timeout fire before the associated semaphore was signaled?
setDelay:forSemaphore:
Private! Initialize this delay to signal the given semaphore after the given number of milliseconds.
signalWaitingProcess
Release the given process from the semaphore it is waiting on.
This method relies on running at highest priority so that it cannot be preempted
by the process being released.
wait
Wait until either the semaphore is signaled or the delay times out
DependentsArray
An array of (weak) dependents of some object.
copyWith:
Re-implemented to not copy any niled out dependents.
do:
Refer to the comment in Collection|do:.
select:
Refer to the comment in Collection|select:.
size
No nil verification required. See do: implementation that only evaluates not nil objects
Duration
I represent a duration of time. I have nanosecond precision
*
operand is a Number
+
operand is a Duration
-
operand is a Duration
/
operand is a Duration or a Number
//
operand is a Duration or a Number
<
Answer whether the receiver is less than the argument.
=
Answer whether the argument is a <Duration> representing the same
period of time as the receiver.
\\
modulo. Remainder defined in terms of //. Answer a Duration with the
same sign as aDuration. operand is a Duration or a Number.
abs
asDelay
asDuration
asMilliSeconds
asNanoSeconds
asSeconds
days
Answer the number of days the receiver represents.
days:
days:hours:minutes:seconds:
days:hours:minutes:seconds:nanoSeconds:
days:seconds:
fromString:
hash
Hash must be redefined whenever = is redefined.
hours
Answer the number of hours the receiver represents.
hours:
initialize
Subclasses should redefine this method to perform initializations on instance creation
isZero
javascriptOn:
milliSeconds:
minutes
Answer the number of minutes the receiver represents.
minutes:
month:
nanoSeconds
nanoSeconds:
negated
negative
positive
printOn:
Format as per ANSI 5.8.2.16: [-]D:HH:MM:SS[.S]
readFrom:
roundTo:
e.g. if the receiver is 5 minutes, 37 seconds, and aDuration is 2 minutes, answer 6 minutes.
seconds
Answer the number of seconds the receiver represents.
seconds:
seconds:nanoSeconds:
Private - only used by Duration class
storeOn:
Append to the argument aStream a sequence of characters that is an
expression whose evaluation creates an object similar to the receiver.
ticks
Answer an array {days. seconds. nanoSeconds}. Used by DateAndTime and Time.
truncateTo:
e.g. if the receiver is 5 minutes, 37 seconds, and aDuration is 2 minutes, answer 4 minutes.
weeks:
zero
DynamicVariable
My subclasses are dynamic variables: each subclass represents a variable
whose value persists inside the block passed to #value:during:. There is
no way to change the value inside such a block, but it is possible to
temporarirly rebind it in a nested manner.
value:during:
EventSensorConstants
An EventSensorConstants is xxxxxxxxx.
Instance Variables
initialize
Subclasses should redefine this method to perform initializations on instance creation
False
False defines the behavior of its single instance, false -- logical negation. Notice how the truth-value checks become direct message sends, without the need for explicit testing.
Be aware however that most of these methods are not sent as real messages in normal use. Most are inline coded by the compiler as test and jump bytecodes - avoiding the overhead of the full message sends. So simply redefining these methods here will have no effect.
&
Evaluating conjunction -- answer false since receiver is false.
and:
Nonevaluating conjunction -- answer with false since the receiver is false.
asBit
ifFalse:
Answer the value of alternativeBlock. Execution does not actually
reach here because the expression is compiled in-line.
ifFalse:ifTrue:
Answer the value of falseAlternativeBlock. Execution does not
actually reach here because the expression is compiled in-line.
ifTrue:
Since the condition is false, answer the value of the false alternative,
which is nil. Execution does not actually reach here because the
expression is compiled in-line.
ifTrue:ifFalse:
Answer the value of falseAlternativeBlock. Execution does not
actually reach here because the expression is compiled in-line.
initializedInstance
not
Negation -- answer true since the receiver is false.
or:
Nonevaluating disjunction -- answer value of alternativeBlock.
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
xor:
Posted by Eliot Miranda to squeak-dev on 3/24/2009
|
Evaluating disjunction (OR) -- answer with the argument, aBoolean.
Float
My instances represent IEEE-754 floating-point double-precision numbers. They have about 16 digits of accuracy and their range is between plus and minus 10^307. Some valid examples are:

8.0 13.3 0.3 2.5e6 1.27e-30 1.27e-31 -12.987654e12
Mainly: no embedded blanks, little e for tens power, and a digit on both sides of the decimal point. It is actually possible to specify a radix for Squeak Float constants. This is great for teaching about numbers, but may be confusing to the average reader:
3r20.2 --> 6.66666666666667
8r20.2 --> 16.25
If you don't have access to the definition of IEEE-754, you can figure out what is going on by printing various simple values in Float hex. It may help you to know that the basic format is...
sign 1 bit
exponent 11 bits with bias of 1023 (16r3FF) to produce an exponent
in the range -1023 .. +1024
- 16r000:
significand = 0: Float zero
significand ~= 0: Denormalized number (exp = -1024, no hidden '1' bit)
- 16r7FF:
significand = 0: Infinity
significand ~= 0: Not A Number (NaN) representation
mantissa 53 bits, but only 52 are stored (20 in the first word, 32 in the second). This is because a normalized mantissa, by definition, has a 1 to the right of its floating point, and IEEE-754 omits this redundant bit to gain an extra bit of precision instead. People talk about the mantissa without its leading one as the FRACTION, and with its leading 1 as the SIGNFICAND.
The single-precision format is...
sign 1 bit
exponent 8 bits, with bias of 127, to represent -126 to +127
- 0x0 and 0xFF reserved for Float zero (mantissa is ignored)
- 16r7F reserved for Float underflow/overflow (mantissa is ignored)
mantissa 24 bits, but only 23 are stored
This format is used in FloatArray (qv), and much can be learned from the conversion routines, Float asIEEE32BitWord, and Float class fromIEEE32Bit:.
Thanks to Rich Harmon for asking many questions and to Tim Olson, Bruce Cohen, Rick Zaccone and others for the answers that I have collected here.
*
Primitive. Answer the result of multiplying the receiver by aNumber.
Fail if the argument is not a Float. Essential. See Object documentation
whatIsAPrimitive.
+
Primitive. Answer the sum of the receiver and aNumber. Essential.
Fail if the argument is not a Float. See Object documentation
whatIsAPrimitive.
-
Primitive. Answer the difference between the receiver and aNumber.
Fail if the argument is not a Float. Essential. See Object documentation
whatIsAPrimitive.
/
Primitive. Answer the result of dividing receiver by aNumber.
Fail if the argument is not a Float. Essential. See Object documentation
whatIsAPrimitive.
<
Primitive. Compare the receiver with the argument and return true
if the receiver is less than the argument. Otherwise return false.
Fail if the argument is not a Float. Essential. See Object documentation
whatIsAPrimitive.
<=
Primitive. Compare the receiver with the argument and return true
if the receiver is less than or equal to the argument. Otherwise return
false. Fail if the argument is not a Float. Optional. See Object
documentation whatIsAPrimitive.
=
Primitive. Compare the receiver with the argument and return true
if the receiver is equal to the argument. Otherwise return false.
Fail if the argument is not a Float. Essential. See Object documentation
whatIsAPrimitive.
>
Primitive. Compare the receiver with the argument and return true
if the receiver is greater than the argument. Otherwise return false.
Fail if the argument is not a Float. Essential. See Object documentation
whatIsAPrimitive.
>=
Primitive. Compare the receiver with the argument and return true
if the receiver is greater than or equal to the argument. Otherwise return
false. Fail if the argument is not a Float. Optional. See Object documentation
whatIsAPrimitive.
abs
This is faster than using Number abs.
absByteEncode:base:
Print my value on a stream in the given base. Assumes that my value is strictly
positive; negative numbers, zero, and NaNs have already been handled elsewhere.
Based upon the algorithm outlined in:
Robert G. Burger and R. Kent Dybvig
Printing Floating Point Numbers Quickly and Accurately
ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation
June 1996.
This version performs all calculations with Floats instead of LargeIntegers, and loses
about 3 lsbs of accuracy compared to an exact conversion.
absPrintExactlyOn:base:
Print my value on a stream in the given base. Assumes that my value is strictly
positive; negative numbers, zero, and NaNs have already been handled elsewhere.
Based upon the algorithm outlined in:
Robert G. Burger and R. Kent Dybvig
Printing Floating Point Numbers Quickly and Accurately
ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation
June 1996.
This version guarantees that the printed representation exactly represents my value
by using exact integer arithmetic.
absPrintOn:base:
Print my value on a stream in the given base. Assumes that my value is strictly
positive; negative numbers, zero, and NaNs have already been handled elsewhere.
Based upon the algorithm outlined in:
Robert G. Burger and R. Kent Dybvig
Printing Floating Point Numbers Quickly and Accurately
ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation
June 1996.
This version performs all calculations with Floats instead of LargeIntegers, and loses
about 3 lsbs of accuracy compared to an exact conversion.
absPrintOn:base:digitCount:
Print me in the given base, using digitCount significant figures.
adaptToComplex:andSend:
If I am involved in arithmetic with a Complex number, convert me to a Complex number.
adaptToFraction:andCompare:
If I am involved in comparison with a Fraction, convert myself to a
Fraction. This way, no bit is lost and comparison is exact.
adaptToFraction:andSend:
If I am involved in arithmetic with a Fraction, convert it to a Float.
adaptToInteger:andCompare:
If I am involved in comparison with an Integer, convert myself to a
Fraction. This way, no bit is lost and comparison is exact.
adaptToInteger:andSend:
If I am involved in arithmetic with an Integer, convert it to a Float.
arcCos
Answer the angle in radians.
arcSin
Answer the angle in radians.
arcTan
Answer the angle in radians.
Optional. See Object documentation whatIsAPrimitive.
arcTan:
Answer the angle in radians.
Optional. See Object documentation whatIsAPrimitive.
asApproximateFraction
Answer a Fraction approximating the receiver. This conversion uses the
continued fraction method to approximate a floating point number.
asApproximateFractionAtOrder:
Answer a Fraction approximating the receiver. This conversion uses the
continued fraction method to approximate a floating point number. If maxOrder
is zero, use maximum order
asComplex
Answer a Complex number that represents value of the the receiver.
asFloat
Answer the receiver itself.
asFraction
asIEEE32BitWord
Convert the receiver into a 32 bit Integer value representing the same number in IEEE 32 bit format.
Used for conversion in FloatArrays only.
asTrueFraction
Answer a fraction that EXACTLY represents self,
a double precision IEEE floating point number.
Floats are stored in the same form on all platforms.
(Does handle gradual underflow but not NANs.)
By David N. Smith with significant performance
improvements by Luciano Esteban Notarfrancesco.
(Version of 11April97)
byteEncode:base:
Handle sign, zero, and NaNs; all other values passed to absPrintOn:base:
closeTo:
are these two numbers close?
cos
Answer the cosine of the receiver taken as an angle in radians.
deepCopy
Answer a copy of the receiver with its own copy of each instance
variable.
degreeCos
Answer the cosine of the receiver taken as an angle in degrees.
degreeSin
Answer the sine of the receiver taken as an angle in degrees.
degreesToRadians
Answer the receiver in radians. Assumes the receiver is in degrees.
denormalized
e
emax
emin
epsilon
exp
Answer E raised to the receiver power.
Optional. See Object documentation whatIsAPrimitive.
exponent
Primitive. Consider the receiver to be represented as a power of two
multiplied by a mantissa (between one and two). Answer with the
SmallInteger to whose power two is raised. Optional. See Object
documentation whatIsAPrimitive.
floorLog:
Answer the floor of the log base radix of the receiver.
fmax
fmin
fminDenormalized
fminNormalized
fractionPart
Primitive. Answer a Float whose value is the difference between the
receiver and the receiver's asInteger value. Optional. See Object
documentation whatIsAPrimitive.
fromIEEE32Bit:
halfPi
hasContentsInExplorer
hash
Hash is reimplemented because = is implemented. Both words of the float are used; 8 bits are removed from each end to clear most of the exponent regardless of the byte ordering. (The bitAnd:'s ensure that the intermediate results do not become a large integer.) Slower than the original version in the ratios 12:5 to 2:1 depending on values. (DNS, 11 May, 1997)
hex
If ya really want to know...
infinity
initialize
Subclasses should redefine this method to perform initializations on instance creation
integerPart
Answer a Float whose value is the receiver's truncated value.
isFinite
simple, byte-order independent test for rejecting Not-a-Number and (Negative)Infinity
isFloat
Overridden to return true in Float, natch
isInfinite
Return true if the receiver is positive or negative infinity.
isLiteral
There is no literal representation of NaN.
However, there are literal representations of Infinity, like 1.0e1000.
But since they are not able to print properly, only case of finite Float is considered.
isNaN
simple, byte-order independent test for Not-a-Number
isPowerOfTwo
Return true if the receiver is an integral power of two.
Floats never return true here.
isZero
ln
Answer the natural logarithm of the receiver.
Optional. See Object documentation whatIsAPrimitive.
log
Answer the base 10 logarithm of the receiver.
nan
negated
Answer a Number that is the negation of the receiver.
negativeZero
one
pi
precision
predecessor
printOn:base:
Handle sign, zero, and NaNs; all other values passed to absPrintOn:base:
printPaddedWith:to:
Answer the string containing the ASCII representation of the receiver
padded on the left with aCharacter to be at least on aNumber
integerPart characters and padded the right with aCharacter to be at
least anInteger fractionPart characters.
printShowingDecimalPlaces:
This implementation avoids any rounding error caused by rounded or roundTo:
radiansToDegrees
Answer the receiver in degrees. Assumes the receiver is in radians.
radix
readFrom:
readFrom:ifFail:
reciprocal
Returns the reciprocal.
If self is 0.0 the / signals a ZeroDivide
reciprocalFloorLog:
Quick computation of (self log: radix) floor, when self < 1.0.
Avoids infinite recursion problems with denormalized numbers
reciprocalLogBase2
optimized for self = 10, for use in conversion for printing
reduce
If self is close to an integer, return that integer
rounded
Answer the integer nearest the receiver.
Implementation note: super would not handle tricky inexact arithmetic
safeArcCos
Answer the angle in radians.
shallowCopy
Answer a copy of the receiver which shares the receiver's instance variables.
sign
Answer 1 if the receiver is greater than 0, -1 if less than 0, else 0.
Handle IEEE-754 negative-zero by reporting a sign of -1
significand
significandAsInteger
sin
Answer the sine of the receiver taken as an angle in radians.
Optional. See Object documentation whatIsAPrimitive.
sqrt
Answer the square root of the receiver.
Optional. See Object documentation whatIsAPrimitive.
storeOn:base:
Defined here to handle special cases of NaN Infinity and negative zero
successor
tan
Answer the tangent of the receiver taken as an angle in radians.
threePi
timesTwoPower:
Primitive. Answer with the receiver multiplied by 2.0 raised
to the power of the argument.
Optional. See Object documentation whatIsAPrimitive.
truncated
Answer with a SmallInteger equal to the value of the receiver without
its fractional part. The primitive fails if the truncated value cannot be
represented as a SmallInteger. In that case, the code below will compute
a LargeInteger truncated value.
Essential. See Object documentation whatIsAPrimitive.
twoPi
veryDeepCopyWith:
Return self. Do not record me.
~=
Primitive. Compare the receiver with the argument and return true
if the receiver is not equal to the argument. Otherwise return false.
Fail if the argument is not a Float. Optional. See Object documentation
whatIsAPrimitive.
Fraction
Fraction provides methods for dealing with fractions like 1/3 as fractions (not as 0.33333...). All public arithmetic operations answer reduced fractions (see examples).
instance variables: 'numerator denominator '
Examples: (note the parentheses required to get the right answers in Smalltalk and Squeak):
(2/3) + (2/3)
(2/3) + (1/2) "answers shows the reduced fraction"
(2/3) raisedToInteger: 5 "fractions also can have exponents"
*
Answer the result of multiplying the receiver by aNumber.
+
Answer the sum of the receiver and aNumber.
-
Answer the difference between the receiver and aNumber.
/
Answer the result of dividing the receiver by aNumber.
<
Answer whether the receiver is less than the argument.
=
Compare the receiver with the argument and answer with true if the
receiver is equal to the argument. Otherwise answer false.
adaptToComplex:andSend:
If I am involved in arithmetic with a Complex number, convert me to a Complex number.
adaptToInteger:andSend:
If I am involved in arithmetic with an Integer, convert it to a Fraction.
asComplex
Answer a Complex number that represents value of the the receiver.
asFloat
Answer a Float that closely approximates the value of the receiver.
This implementation will answer the closest floating point number to
the receiver.
It uses the IEEE 754 round to nearest even mode
(can happen in case denominator is a power of two)
asFraction
Answer the receiver itself.
denominator
hash
Hash is reimplemented because = is implemented.
Care is taken that a Fraction equal to a Float also have an equal hash
isFraction
Answer true if the receiver is a Fraction.
isSelfEvaluating
negated
Refer to the comment in Number|negated.
numerator
numerator:denominator:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
printOn:base:
This method should print a representation of the number for the given base,
excluding the base prefix (and the letter r for radix)
raisedToInteger:
See Number | raisedToInteger:
reciprocal
Returns the reciprocal of self.
In case self is 0 the / signals ZeroDivide
reduced
setNumerator:denominator:
squared
See Fraction (Number) | squared
storeOn:base:
This method should print a representation of the number for the given base,
including the base prefix (with letter r for radix)
truncated
Refer to the comment in Number|truncated.
InputEventFetcher
EventFetcher is responsible for fetching the raw VM events and forward them to the registered event handlers. Event fetching is done in a high priority process, so even with other processes (e.g. the Morphic UI process) being busy events will still be fetched.
Instance Variables
inputSemaphore: <Semaphore>
eventHandlers <OrderedCollection>
fetcherProcess <Process>
inputSemaphore
- a semaphore registered with the VM to signal availability of an event. Currently not supported on all platforms.
eventHandlers
- registered event handlers. Event buffers are cloned before sent to each handler.
fetcherProcess
- a process that fetches the events from the VM. Either polling (InputEventPollingFetcher) or waiting on the inputSemaphore.
Event format:
The current event format is very simple. Each event is recorded into an 8 element array. All events must provide some SmallInteger ID (the first field in the event buffer) and a time stamp (the second field in the event buffer), so that the difference between the time stamp of an event and the current time can be reported.
Currently, the following events are defined:
Null event
=============
The Null event is returned when the ST side asks for more events but no more events are available.
Structure:
[1] - event type 0
[2-8] - unused
Mouse event structure
==========================
Mouse events are generated when mouse input is detected.
Structure:
[1] - event type 1
[2] - time stamp
[3] - mouse x position
[4] - mouse y position
[5] - button state; bitfield with the following entries:
1 - yellow (e.g., right) button
2 - blue (e.g., middle) button
4 - red (e.g., left) button
[all other bits are currently undefined]
[6] - modifier keys; bitfield with the following entries:
1 - shift key
2 - ctrl key
4 - (Mac specific) option key
8 - Cmd/Alt key
[all other bits are currently undefined]
[7] - reserved.
[8] - reserved.
Keyboard events
====================
Keyboard events are generated when keyboard input is detected.
[1] - event type 2
[2] - time stamp
[3] - character code
For now the character code is in Mac Roman encoding.
[4] - press state; integer with the following meaning
0 - character
1 - key press (down)
2 - key release (up)
[5] - modifier keys (same as in mouse events)
[6] - reserved.
[7] - reserved.
[8] - reserved.
default
deinstall
eventHandlers
eventLoop
Fetch pending raw events from the VM.
This method is run at high priority.
install
installEventLoop
Initialize the event loop process. Terminate the old process if any.
primGetNextEvent:
Store the next OS event available into the provided array.
Essential.
primInterruptSemaphore:
Primitive. Install the argument as the semaphore to be signalled whenever the user presses the interrupt key. The semaphore will be signaled once each time the interrupt key is pressed.
primSetInputSemaphore:
Set the input semaphore the VM should use for asynchronously signaling the availability of events. Primitive. Optional.
registerHandler:
shutDown
signalEvent:
Signal the event buffer to all registered event handlers.
Handlers need make sure to copy the buffer or extract the data otherwise, as the buffer will be reused.
startUp
terminateEventLoop
Terminate the event loop process. Terminate the old process if any.
unregisterHandler:
waitForInput
InputEventHandler
An InputEventHandler is the abstract superclass for all input event handlers.
Subclasses need to implement handleEvent:.
Instance Variables
eventFetcher: <InputEventFetcher>
eventFetcher
- the event fetcher I'm registered with and receiving my events from.
handleEvent:
registerIn:
unregister
InputEventPollingFetcher
An InputEventPollingFetcher is a subclass of the event fetcher using polling instead of the input semaphore.
EventPollDelay
- Delay used to wait on within the polling loop
eventPollDelay
eventPollPeriod:
resetEventPollDelay
terminateEventLoop
Terminate the event loop process. Terminate the old process if any.
waitForInput
InputEventSensor
An InputEventSensor is a replacement for the old Morphic EventSensor framework.
It updates its state when events are received so that all state based users of Sensor (e.g., Sensor keyboard, Sensor leftShiftDown, Sensor mouseButtons) will work exactly as before. The usage of these funtions is discouraged.
Instance variables:
mouseButtons <Integer> - mouse button state as replacement for primMouseButtons
mousePosition <Point> - mouse position as replacement for primMousePt
eventQueue <SharedQueue> - an optional event queue for event driven applications
modifiers <Integer> - modifier states
Class variables:
ButtonDecodeTable
KeyDecodeTable
anyButtonPressed
Answer whether at least one mouse button is currently being pressed.
anyModifierKeyPressed
ignore, however, the shift keys 'cause that's not REALLY a command key
blueButtonPressed
Answer whether only the blue mouse button is being pressed.
This is the third mouse button or cmd+click on the Mac.
characterForEvent:
commandKeyPressed
Answer whether the command key on the keyboard is being held down.
controlKeyPressed
Answer whether the control key on the keyboard is being held down.
currentCursor
The current cursor is maintained in class Cursor.
currentCursor:
The current cursor is maintained in class Cursor.
cursorPoint
Answer a Point indicating the cursor location.
cursorPoint:
Set aPoint to be the current cursor location.
default
defaultCrossPlatformKeys
duplicateAllControlAndAltKeysChanged
duplicateControlAndAltKeys:
duplicateControlAndAltKeysChanged
flushAllButDandDEvents
flushKeyboard
Remove all characters from the keyboard buffer.
flushNonKbdEvents
handleEvent:
hasTablet
Answer true if there is a pen tablet available on this computer.
initialize
Initialize the receiver
installDuplicateKeyEntryFor:
installEventSensorFramework
installEventSensorFramework:
installKeyDecodeTable
installMouseDecodeTable
installPollingEventSensorFramework
installSwappedKeyEntryFor:
isKbdEvent:
joystickButtons:
joystickOn:
joystickXY:
keyboard
Answer the next character from the keyboard.
keyboardPeek
Answer the next character in the keyboard buffer without removing it, or nil if it is empty.
keyboardPressed
Answer true if keystrokes are available.
leftShiftDown
Answer whether the shift key on the keyboard is being held down. The name of this message is a throwback to the Alto, which had independent left and right shift keys.
mapButtons:modifiers:
Map the buttons to yellow or blue based on the given modifiers.
If only the red button is pressed, then map
Ctrl-RedButton -> BlueButton.
Cmd-RedButton -> YellowButton.
modifiers
modifier keys; bitfield with the following entries:
1 - shift key
2 - ctrl key
4 - (Mac specific) option key
8 - Cmd/Alt key
mouseButtons
button state; bitfield with the following entries:
1 - yellow (e.g., right) button
2 - blue (e.g., middle) button
4 - red (e.g., left) button
[all other bits are currently undefined]
nextEvent
Return the next event from the receiver.
nextKeyboardEvent
Allows for use of old Sensor protocol to get at the keyboard,
as when running kbdTest or the InterpreterSimulator in Morphic
noButtonPressed
Answer whether any mouse button is not being pressed.
peekEvent
Look ahead at the next event.
peekKeyboardEvent
Allows for use of old Sensor protocol to get at the keyboard,
as when running kbdTest or the InterpreterSimulator in Morphic
peekMousePt
peekPosition
primReadJoystick:
Return the joystick input word for the joystick with the given index in the range [1..16]. Returns zero if the index does not correspond to a currently installed joystick.
primTabletGetParameters:
Answer the pen tablet parameters. For parameters that differ from cursor to cursor, answer those associated with the cursor having the given index. Answer nil if there is no pen tablet. The parameters are:
1. tablet width, in tablet units
2. tablet height, in tablet units
3. number of tablet units per inch
4. number of cursors (pens, pucks, etc; some tablets have more than one)
5. this cursor index
6. and 7. x scale and x offset for scaling tablet coordintes (e.g., to fit the screen)
8. and 9. y scale and y offset for scaling tablet coordintes (e.g., to fit the screen)
10. number of pressure levels
11. presure threshold needed close pen tip switch
12. number of pen tilt angles
primTabletRead:
Answer the pen tablet data for the cursor having the given index. Answer nil if there is no pen tablet. The data is:
1. index of the cursor to which this data applies
2. timestamp of the last state chance for this cursor
3., 4., and 5. x, y, and z coordinates of the cursor (z is typically 0)
6. and 7. xTilt and yTilt of the cursor; (signed)
8. type of cursor (0 = unknown, 1 = pen, 2 = puck, 3 = eraser)
9. cursor buttons
10. cursor pressure, downward
11. cursor pressure, tangential
12. flags
processEvent:
Process a single event. This method is run at high priority.
processMenuEvent:
queueEvent:
Queue the given event in the event queue
redButtonPressed
Answer true if only the red mouse button is being pressed.
This is the first mouse button, usually the left one.
shiftPressed
Answer whether the shift key on the keyboard is being held down.
shutDown
startUp
swapControlAndAltKeys:
swapControlAndAltKeysChanged
swapMouseButtons:
tabletExtent
Answer the full tablet extent in tablet coordinates.
tabletPoint
Answer the current position of the first tablet pointing device (pen, puck, or eraser) in tablet coordinates.
tabletPressure
Answer the current pressure of the first tablet pointing device (pen, puck, or eraser), a number between 0.0 (no pressure) and 1.0 (max pressure)
tabletTimestamp
Answer the time (in tablet clock ticks) at which the tablet's primary pen last changed state. This can be used in polling loops; if this timestamp hasn't changed, then the pen state hasn't changed either.
testJoystick:
Sensor testJoystick: 3
waitButton
Wait for the user to press any mouse button and then answer with the
current location of the cursor.
waitButtonOrKeyboard
Wait for the user to press either any mouse button or any key.
Answer the current cursor location or nil if a keypress occured.
waitClickButton
Wait for the user to click (press and then release) any mouse button and
then answer with the current location of the cursor.
waitNoButton
Wait for the user to release any mouse button and then answer the current location of the cursor.
yellowButtonPressed
Answer whether only the yellow mouse button is being pressed.
This is the second mouse button or option+click on the Mac.
InstVarRefLocator
My job is to scan bytecodes for instance variable references.
BlockContext allInstances collect: [ :x |
{x. x hasInstVarRef}
].
interpretNextInstructionUsing:
popIntoReceiverVariable:
Remove Top Of Stack And Store Into Instance Variable bytecode.
pushReceiverVariable:
Push Contents Of the Receiver's Instance Variable Whose Index
is the argument, offset, On Top Of Stack bytecode.
storeIntoReceiverVariable:
Store Top Of Stack Into Instance Variable Of Method bytecode.
InstructionClient
My job is to make it easier to implement clients for InstructionStream. See InstVarRefLocator
as an example.
blockReturnTop
Return Top Of Stack bytecode.
doDup
Duplicate Top Of Stack bytecode.
doPop
Remove Top Of Stack bytecode.
jump:
Unconditional Jump bytecode.
jump:if:
Conditional Jump bytecode.
methodReturnConstant:
Return Constant bytecode.
methodReturnReceiver
Return Self bytecode.
methodReturnTop
Return Top Of Stack bytecode.
popIntoLiteralVariable:
Remove Top Of Stack And Store Into Literal Variable bytecode.
popIntoReceiverVariable:
Remove Top Of Stack And Store Into Instance Variable bytecode.
popIntoRemoteTemp:inVectorAt:
Remove Top Of Stack And Store Into Offset of Temp Vector bytecode.
popIntoTemporaryVariable:
Remove Top Of Stack And Store Into Temporary Variable bytecode.
pushActiveContext
Push Active Context On Top Of Its Own Stack bytecode.
pushClosureCopyNumCopiedValues:numArgs:blockSize:
Push Closure bytecode.
pushConsArrayWithElements:
Push Cons Array of size numElements popping numElements items from the stack into the array bytecode.
pushConstant:
Push Constant, value, on Top Of Stack bytecode.
pushLiteralVariable:
Push Contents Of anAssociation On Top Of Stack bytecode.
pushNewArrayOfSize:
Push New Array of size numElements bytecode.
pushReceiver
Push Active Context's Receiver on Top Of Stack bytecode.
pushReceiverVariable:
Push Contents Of the Receiver's Instance Variable Whose Index
is the argument, offset, On Top Of Stack bytecode.
pushRemoteTemp:inVectorAt:
Push Contents at Offset in Temp Vector bytecode.
pushTemporaryVariable:
Push Contents Of Temporary Variable Whose Index Is the
argument, offset, On Top Of Stack bytecode.
send:super:numArgs:
Send Message With Selector, selector, bytecode. The argument,
supered, indicates whether the receiver of the message is specified with
'super' in the source method. The arguments of the message are found in
the top numArguments locations on the stack and the receiver just
below them.
storeIntoLiteralVariable:
Store Top Of Stack Into Literal Variable Of Method bytecode.
storeIntoReceiverVariable:
Store Top Of Stack Into Instance Variable Of Method bytecode.
storeIntoRemoteTemp:inVectorAt:
Store Top Of Stack And Store Into Offset of Temp Vector bytecode.
storeIntoTemporaryVariable:
Store Top Of Stack Into Temporary Variable Of Method bytecode.
InstructionPrinter
My instances can print the object code of a CompiledMethod in symbolic format. They print into an instance variable, stream, and uses oldPC to determine how many bytes to print in the listing. The variable method is used to hold the method being printed.
blockReturnTop
Print the Return Top Of Stack bytecode.
doDup
Print the Duplicate Top Of Stack bytecode.
doPop
Print the Remove Top Of Stack bytecode.
indent
indent:
jump:
Print the Unconditional Jump bytecode.
jump:if:
Print the Conditional Jump bytecode.
method
method:
methodReturnConstant:
Print the Return Constant bytecode.
methodReturnReceiver
Print the Return Self bytecode.
methodReturnTop
Print the Return Top Of Stack bytecode.
on:
popIntoLiteralVariable:
Print the Remove Top Of Stack And Store Into Literal Variable bytecode.
popIntoReceiverVariable:
Print the Remove Top Of Stack And Store Into Instance Variable
bytecode.
popIntoRemoteTemp:inVectorAt:
Remove Top Of Stack And Store Into Offset of Temp Vector bytecode.
popIntoTemporaryVariable:
Print the Remove Top Of Stack And Store Into Temporary Variable
bytecode.
print:
Append to the receiver a description of the bytecode, instruction.
printClass:
printInstructionsOn:
Append to the stream, aStream, a description of each bytecode in the
instruction stream.
printInstructionsOn:do:
Append to the stream, aStream, a description of each bytecode in the
instruction stream. Evaluate aBlock with the receiver, the scanner and
the stream after each instruction.
printPC
printPC:
pushActiveContext
Print the Push Active Context On Top Of Its Own Stack bytecode.
pushClosureCopyNumCopiedValues:numArgs:blockSize:
Push Closure bytecode.
pushConsArrayWithElements:
Push Cons Array of size numElements popping numElements items from the stack into the array bytecode.
pushConstant:
Print the Push Constant, obj, on Top Of Stack bytecode.
pushLiteralVariable:
Print the Push Contents Of anAssociation On Top Of Stack bytecode.
pushNewArrayOfSize:
Push New Array of size numElements bytecode.
pushReceiver
Print the Push Active Context's Receiver on Top Of Stack bytecode.
pushReceiverVariable:
Print the Push Contents Of the Receiver's Instance Variable Whose Index
is the argument, offset, On Top Of Stack bytecode.
pushRemoteTemp:inVectorAt:
Push Contents at Offset in Temp Vector bytecode.
pushTemporaryVariable:
Print the Push Contents Of Temporary Variable Whose Index Is the
argument, offset, On Top Of Stack bytecode.
send:super:numArgs:
Print the Send Message With Selector, selector, bytecode. The argument,
supered, indicates whether the receiver of the message is specified with
'super' in the source method. The arguments of the message are found in
the top numArguments locations on the stack and the receiver just
below them.
storeIntoLiteralVariable:
Print the Store Top Of Stack Into Literal Variable Of Method bytecode.
storeIntoReceiverVariable:
Print the Store Top Of Stack Into Instance Variable Of Method bytecode.
storeIntoRemoteTemp:inVectorAt:
Store Top Of Stack And Store Into Offset of Temp Vector bytecode.
storeIntoTemporaryVariable:
Print the Store Top Of Stack Into Temporary Variable Of Method
bytecode.
InstructionStream
My instances can interpret the byte-encoded Smalltalk instruction set. They maintain a program counter (pc) for streaming through CompiledMethods. My subclasses are Contexts, which inherit this capability. They store the return pointer in the instance variable sender, and the current position in their method in the instance variable pc. For other users, sender can hold a method to be similarly interpreted. The unclean re-use of sender to hold the method was to avoid a trivial subclass for the stand-alone scanning function.
abstractPC
addSelectorTo:
If this instruction is a send, add its selector to set.
atEnd
debuggerMap
firstByte
Answer the first byte of the current bytecode.
followingByte
Answer the next bytecode.
fourthByte
Answer the fourth byte of the current bytecode.
initialize
Subclasses should redefine this method to perform initializations on instance creation
instVarNamesAndOffsetsDo:
interpret
interpretExtension:in:for:
interpretJump
interpretJumpIfCond
interpretNextInstructionFor:
Send to the argument, client, a message that specifies the type of the
next instruction.
isContextClass
method
Answer the compiled method that supplies the receiver's bytecodes.
method:pc:
nextByte
Answer the next bytecode.
nextInstruction
Return the next bytecode instruction as a message that an InstructionClient would understand. This advances the pc by one instruction.
on:
pc
Answer the index of the next bytecode.
pc:
peekInstruction
Return the next bytecode instruction as a message that an InstructionClient would understand. The pc remains unchanged.
previousPc
scanFor:
Answer the index of the first bytecode for which scanBlock answer true
when supplied with that bytecode.
secondByte
Answer the second byte of the current bytecode.
selectorToSendOrSelf
If this instruction is a send, answer the selector, otherwise answer self.
skipBackBeforeJump
Assuming that the receiver is positioned jast after a jump, skip back one or two bytes, depending on the size of the previous jump instruction.
thirdByte
Answer the third byte of the current bytecode.
willBlockReturn
willJump
unconditionally
willJumpIfFalse
Answer whether the next bytecode is a jump-if-false.
willJumpIfTrue
Answer whether the next bytecode is a jump-if-true.
willJustPop
willReallySend
Answer whether the next bytecode is a real message-send,
not blockCopy:.
willReturn
Answer whether the next bytecode is a return.
willSend
Answer whether the next bytecode is a message-send.
willStore
Answer whether the next bytecode is a store or store-pop
willStorePop
Answer whether the next bytecode is a store-pop.
Integer
I am a common abstract superclass for all Integer implementations. My implementation subclasses are SmallInteger, LargePositiveInteger, and LargeNegativeInteger.

Integer division consists of:
/ exact division, answers a fraction if result is not a whole integer
// answers an Integer, rounded towards negative infinity
\\ is modulo rounded towards negative infinity
quo: truncated division, rounded towards zero
*
Refer to the comment in Number *
+
Refer to the comment in Number +
-
Refer to the comment in Number -
/
Refer to the comment in Number /
//
Integer quotient defined by division with truncation toward negative
infinity. 9//4 = 2, -9//4 = -3. -0.9//0.4 = -3. \\ answers the remainder
from this division.
<
Answer whether the receiver is less than the argument.
<<
left shift
=
Compare the receiver with the argument and answer with true if the
receiver is equal to the argument. Otherwise answer false.
>
Answer whether the receiver is greater than the argument.
>>
right shift
\\\
a modulo method for use in DSA. Be careful if you try to use this elsewhere.
adaptToComplex:andSend:
If I am involved in arithmetic with a Complex number, convert me to a Complex number.
adaptToFraction:andSend:
If I am involved in arithmetic with a Fraction, convert me to a Fraction.
alignedTo:
Answer the smallest number not less than receiver that is a multiple of anInteger.
allMask:
Treat the argument as a bit mask. Answer whether all of the bits that
are 1 in the argument are 1 in the receiver.
anyBitOfMagnitudeFrom:to:
Tests for any magnitude bits in the interval from start to stopArg.
anyMask:
Treat the argument as a bit mask. Answer whether any of the bits that
are 1 in the argument are 1 in the receiver.
asArray
asByteArray
asByteArrayOfSize:
Answer a ByteArray of aSize with my value, most-significant byte first.
asCharacter
Answer the Character whose value is the receiver.
asColorOfDepth:
Return a color value representing the receiver as color of the given depth
asComplex
Answer a Complex number that represents value of the the receiver.
asFloat
Answer a Float that represents the value of the receiver.
This is the nearest possible Float according to IEEE 754 round to nearest even mode.
If the receiver is too large, then answer with Float infinity.
asFraction
Answer a Fraction that represents value of the the receiver.
asHexDigit
asInteger
Answer with the receiver itself.
asLargerPowerOfTwo
Convert the receiver into a power of two which is not less than the receiver
asPowerOfTwo
Convert the receiver into a power of two
asPrecedenceName
asSmallerPowerOfTwo
Convert the receiver into a power of two which is not larger than the receiver
asStringWithCommas
123456789 asStringWithCommas
asStringWithCommasSigned
123456789 asStringWithCommasSigned
asTwoCharacterString
Answer a two-character string representing the receiver, with leading zero if required. Intended for use with integers in the range 0 to 99, but plausible replies given for other values too
asWords
SmallInteger maxVal asWords
asYear
atRandom
Answer a random integer from 1 to self. This implementation uses a
shared generator. Heavy users should their own implementation or use
Interval>atRandom: directly.
atRandom:
Answer a random integer from 1 to self picked from aGenerator.
basicNew
benchFib
Handy send-heavy benchmark
benchmark
Handy bytecode-heavy benchmark
bitAnd:
Answer an Integer whose bits are the logical AND of the receiver's bits
and those of the argument, n.
bitAt:
Answer 1 if the bit at position anInteger is set to 1, 0 otherwise.
self is considered an infinite sequence of bits, so anInteger can be any strictly positive integer.
Bit at position 1 is the least significant bit.
Negative numbers are in two-complements.

This is a naive implementation that can be refined in subclass for speed
bitClear:
Answer an Integer equal to the receiver, except with all bits cleared that are set in aMask.
bitInvert
Answer an Integer whose bits are the logical negation of the receiver's bits.
Numbers are interpreted as having 2's-complement representation.
bitInvert32
Answer the 32-bit complement of the receiver.
bitOr:
Answer an Integer whose bits are the logical OR of the receiver's bits
and those of the argument, n.
bitShift:
Answer an Integer whose value (in twos-complement representation) is
the receiver's value (in twos-complement representation) shifted left by
the number of bits indicated by the argument. Negative arguments
shift right. Zeros are shifted in from the right in left shifts.
bitShiftMagnitude:
Answer an Integer whose value (in magnitude representation) is
the receiver's value (in magnitude representation) shifted left by
the number of bits indicated by the argument. Negative arguments
shift right. Zeros are shifted in from the right in left shifts.
bitXor:
Answer an Integer whose bits are the logical XOR of the receiver's bits
and those of the argument, n.
byte1:byte2:byte3:byte4:
byteEncode:base:
ceiling
Refer to the comment in Number|ceiling.
copyto:
crossSumBase:
Precondition
destinationBuffer:
digitAdd:
digitBuffer:
digitCompare:
Compare the magnitude of self with that of arg.
Return a code of 1, 0, -1 for self >, = , < arg
digitDiv:neg:
Answer with an array of (quotient, remainder).
digitLogic:op:length:
digitLshift:
digitMultiply:neg:
digitRshift:bytes:lookfirst:
Shift right 8*b+anInteger bits, 0<=n<8.
Discard all digits beyond a, and all zeroes at or below a.
digitSubtract:
even
Refer to the comment in Number|even.
explorerContents
factorial
Answer the factorial of the receiver.
floor
Refer to the comment in Number|floor.
gcd:
See Knuth, Vol 2, 4.5.2, Algorithm L
growby:
growto:
hasContentsInExplorer
hash
Hash is reimplemented because = is implemented.
hex
highBit
Answer the index of the high order bit of the receiver, or zero if the
receiver is zero. Raise an error if the receiver is negative, since
negative integers are defined to have an infinite number of leading 1's
in 2's-complement arithmetic. Use >>highBitOfMagnitude if you want to
get the highest bit of the magnitude.
highBitOfMagnitude
Answer the index of the high order bit of the magnitude of the
receiver, or zero if the receiver is zero.
initializedInstance
isInteger
True for all subclasses of Integer.
isLiteral
Answer whether the receiver has a literal text form recognized by the
compiler.
isPowerOfTwo
Return true if the receiver is an integral power of two.
isPrime
See isProbablyPrimeWithK:andQ: for the algoritm description.
isProbablyPrimeWithK:andQ:
Algorithm P, probabilistic primality test, from
Knuth, Donald E. 'The Art of Computer Programming', Vol 2,
Third Edition, section 4.5.4, page 395, P1-P5 refer to Knuth description.
largePrimesUpTo:
largePrimesUpTo:do:
lastDigit
Answer the last digit of the integer base 256. LargePositiveInteger uses bytes of base two number, and each is a 'digit'.
lcm:
Answer the least common multiple of the receiver and n.
lowBit
Answer the index of the low order bit of this number.
metacelloIntegerLessThanSelf:
metacelloStringLessThanSelf:
string version components are always '<' integer component
metacelloVersionComponentLessThan:
new
new:neg:
noMask:
Treat the argument as a bit mask. Answer whether none of the bits that
are 1 in the argument are 1 in the receiver.
normalize
SmallInts OK; LgInts override
numberOfDigits
Return how many digits are necessary to print this number in base 10.
This does not count any place for minus sign, radix prefix or whatever.
numberOfDigitsInBase:
Return how many digits are necessary to print this number in base b.
This does not count any place for minus sign, radix prefix or whatever.
Note that this algorithm may cost a few operations on LargeInteger.
primesUpTo:
primesUpTo:do:
print:on:prefix:length:padded:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
printOn:base:
This method should print a representation of the number for the given base,
excluding the base prefix (and the letter r for radix)
printOn:base:length:padded:
printOn:base:nDigits:
Append a representation of this number in base b on aStream using nDigits.
self must be positive.
printOn:base:showRadix:
Write a sequence of characters that describes the receiver in radix
baseInteger with optional radix specifier.
The result is undefined if baseInteger less than 2 or greater than 36.
printPaddedWith:to:
Answer the string containing the ASCII representation of the receiver
padded on the left with aCharacter to be at least anInteger characters.
printPaddedWith:to:base:
Answer the string containing the ASCII representation of the receiver
padded on the left with aCharacter to be at least anInteger characters.
printString
For Integer, prefer the stream version to the string version for efficiency
printStringAsCents
printStringBase:length:padded:
printStringHex
printStringLength:
printStringLength:padded:
printStringPadded:
printStringRadix:
Return a string containing a sequence of characters that represents the
numeric value of the receiver in the radix specified by the argument.
If the receiver is negative, a minus sign ('-') is prepended to the
sequence of characters.
The result is undefined if baseInteger less than 2 or greater than 36.
printStringRoman
quo:
Refer to the comment in Number quo:
radix:
raisedTo:modulo:
Answer the modular exponential. Code by Jesse Welton.
raisedToInteger:modulo:
readFrom:
readFrom:base:
readFrom:ifFail:
readFrom:radix:
replaceFrom:to:with:startingAt:
Catches failure if LgInt replace primitive fails
romanDigits:for:on:
rounded
Refer to the comment in Number|rounded.
storeOn:base:
Print a representation of the receiver on the stream
<aStream> in base <base> where
2 <= <baseInteger> <= 16. If <base> is other than 10
it is written first separated by $r followed by the number
like for example: 16rFCE2
storeOn:base:length:padded:
storeStringBase:length:padded:
storeStringHex
take:
Return the number of combinations of (self) elements taken kk at a time. For 6 take 3, this is 6*5*4 / (1*2*3). Zero outside of Pascal's triangle. Use a trick to go faster.
timesRepeat:
Evaluate the argument, aBlock, the number of times represented by the
receiver.
tinyBenchmarks
Report the results of running the two tiny Squeak benchmarks.
ar 9/10/1999: Adjusted to run at least 1 sec to get more stable results
truncated
Refer to the comment in Number|truncated.
verbosePrimesUpTo:
verbosePrimesUpTo:do:
LargeNegativeInteger
Just like LargePositiveInteger, but represents a negative number.
abs
Answer a Number that is the absolute value (positive magnitude) of the
receiver.
bitAt:
super would not work because we have to pretend we are in two-complement.
this has to be tricky...
highBit
Answer the index of the high order bit of the receiver, or zero if the
receiver is zero. Raise an error if the receiver is negative, since
negative integers are defined to have an infinite number of leading 1's
in 2's-complement arithmetic. Use >>highBitOfMagnitude if you want to
get the highest bit of the magnitude.
initializedInstance
negated
Answer a Number that is the negation of the receiver.
negative
Answer whether the receiver is mathematically negative.
normalize
Check for leading zeroes and return shortened copy if so
positive
Answer whether the receiver is positive or equal to 0. (ST-80 protocol).
See also strictlyPositive
printOn:base:
Append a representation of this number in base b on aStream.
sign
Optimization. Answer -1 since receiver is less than 0.
strictlyPositive
Answer whether the receiver is mathematically positive.
LargePositiveInteger
I represent positive integers of more than 30 bits (ie, >= 1073741824). These values are beyond the range of SmallInteger, and are encoded here as an array of 8-bit digits. Care must be taken, when new values are computed, that any result that COULD BE a SmallInteger IS a SmallInteger (see normalize).
Note that the bit manipulation primitives, bitAnd:, bitShift:, etc., = and ~= run without failure (and therefore fast) if the value fits in 32 bits. This is a great help to the simulator.
*
Primitive. Multiply the receiver by the argument and answer with an
Integer result. Fail if either the argument or the result is not a
SmallInteger or a LargePositiveInteger less than 2-to-the-30th (1073741824). Optional. See
Object documentation whatIsAPrimitive.
+
Primitive. Add the receiver to the argument and answer with an
Integer result. Fail if either the argument or the result is not a
SmallInteger or a LargePositiveInteger less than 2-to-the-30th (1073741824). Optional. See
Object documentation whatIsAPrimitive.
-
Primitive. Subtract the argument from the receiver and answer with an
Integer result. Fail if either the argument or the result is not a
SmallInteger or a LargePositiveInteger less than 2-to-the-30th (1073741824). Optional. See
Object documentation whatIsAPrimitive.
/
Primitive. Divide the receiver by the argument and answer with the
result if the division is exact. Fail if the result is not a whole integer.
Fail if the argument is 0. Fail if either the argument or the result is not
a SmallInteger or a LargePositiveInteger less than 2-to-the-30th (1073741824). Optional. See
Object documentation whatIsAPrimitive.
//
Primitive. Divide the receiver by the argument and return the result.
Round the result down towards negative infinity to make it a whole
integer. Fail if the argument is 0. Fail if either the argument or the
result is not a SmallInteger or a LargePositiveInteger less than 2-to-the-30th (1073741824).
Optional. See Object documentation whatIsAPrimitive.
<
Primitive. Compare the receiver with the argument and answer true if
the receiver is less than the argument. Otherwise answer false. Fail if the
argument is not a SmallInteger or a LargePositiveInteger less than 2-to-the-30th (1073741824).
Optional. See Object documentation whatIsAPrimitive.
<=
Primitive. Compare the receiver with the argument and answer true if
the receiver is less than or equal to the argument. Otherwise answer false.
Fail if the argument is not a SmallInteger or a LargePositiveInteger less
than 2-to-the-30th (1073741824). Optional. See Object documentation whatIsAPrimitive.
=
Primitive. Compare the receiver with the argument and answer true if
the receiver is equal to the argument. Otherwise answer false. Fail if the
receiver or argument is negative or greater than 32 bits.
Optional. See Object documentation whatIsAPrimitive.
>
Primitive. Compare the receiver with the argument and answer true if
the receiver is greater than the argument. Otherwise answer false. Fail if
the argument is not a SmallInteger or a LargePositiveInteger less than
2-to-the-30th (1073741824). Optional. See Object documentation whatIsAPrimitive.
>=
Primitive. Compare the receiver with the argument and answer true if
the receiver is greater than or equal to the argument. Otherwise answer
false. Fail if the argument is not a SmallInteger or a LargePositiveInteger
less than 2-to-the-30th (1073741824). Optional. See Object documentation whatIsAPrimitive.
\\
Primitive. Take the receiver modulo the argument. The result is the
remainder rounded towards negative infinity, of the receiver divided
by the argument. Fail if the argument is 0. Fail if either the argument
or the result is not a SmallInteger or a LargePositiveInteger less than
2-to-the-30th (1073741824). Optional. See Object documentation whatIsAPrimitive.
\\\
a faster modulo method for use in DSA. Be careful if you try to use this elsewhere
abs
Answer a Number that is the absolute value (positive magnitude) of the
receiver.
as31BitSmallInt
This is only for 31 bit numbers. Keep my 31 bits the same, but put them in a small int. The small int will be negative since my 31st bit is 1. We know my 31st bit is 1 because otherwise I would already be a positive small int.
bitAnd:
Primitive. Answer an Integer whose bits are the logical AND of the
receiver's bits and those of the argument. Fail if the receiver or argument
is greater than 32 bits. See Object documentation whatIsAPrimitive.
bitAt:
Optimize super algorithm to avoid long bit operations.
Instead work on digits which are known to be SmallInteger and fast.
Note that this algorithm does not work for negative integers.
bitOr:
Primitive. Answer an Integer whose bits are the logical OR of the
receiver's bits and those of the argument. Fail if the receiver or argument
is greater than 32 bits. See Object documentation whatIsAPrimitive.
bitShift:
Primitive. Answer an Integer whose value (in twos-complement
representation) is the receiver's value (in twos-complement
representation) shifted left by the number of bits indicated by the
argument. Negative arguments shift right. Zeros are shifted in from the
right in left shifts. The sign bit is extended in right shifts.
Fail if the receiver or result is greater than 32 bits.
See Object documentation whatIsAPrimitive.
bitXor:
Primitive. Answer an Integer whose bits are the logical XOR of the
receiver's bits and those of the argument. Fail if the receiver or argument
is greater than 32 bits. See Object documentation whatIsAPrimitive.
digitAt:
Primitive. Answer the value of an indexable field in the receiver. LargePositiveInteger uses bytes of base two number, and each is a 'digit' base 256. Fail if the argument (the index) is not an Integer or is out of bounds. Essential. See Object documentation whatIsAPrimitive.
digitAt:put:
Primitive. Store the second argument (value) in the indexable field of
the receiver indicated by index. Fail if the value is negative or is larger
than 255. Fail if the index is not an Integer or is out of bounds. Answer
the value that was stored. Essential. See Object documentation
whatIsAPrimitive.
digitLength
Primitive. Answer the number of indexable fields in the receiver. This
value is the same as the largest legal subscript. Essential. See Object
documentation whatIsAPrimitive.
hash
Hash is reimplemented because = is implemented.
hashMultiply
Truncate to 28 bits and try again
highBit
Answer the index of the high order bit of the receiver, or zero if the
receiver is zero. Raise an error if the receiver is negative, since
negative integers are defined to have an infinite number of leading 1's
in 2's-complement arithmetic. Use >>highBitOfMagnitude if you want to
get the highest bit of the magnitude.
highBitOfMagnitude
Answer the index of the high order bit of the magnitude of the
receiver, or zero if the receiver is zero.
This method is used for LargeNegativeIntegers as well,
since Squeak's LargeIntegers are sign/magnitude.
initializedInstance
isLarge
negated
Answer a Number that is the negation of the receiver.
negative
Answer whether the receiver is mathematically negative.
normalize
Check for leading zeroes and return shortened copy if so
positive
Answer whether the receiver is positive or equal to 0. (ST-80 protocol).
See also strictlyPositive
printOn:base:
Append a representation of this number in base b on aStream.
In order to reduce cost of LargePositiveInteger ops, split the number in approximately two equal parts in number of digits.
printOn:base:nDigits:
Append a representation of this number in base b on aStream using n digits.
In order to reduce cost of LargePositiveInteger ops, split the number of digts approximatily in two
Should be invoked with: 0 <= self < (b raisedToInteger: n)
printStringBase:
For LargeIntegers, it's faster to use the stream version.
This reproduces Number implementation to avoid speed down if one defines Integer>>#printStringBase:
This method should be removed if Integer>>#printStringBase: is removed.
Note: tests preallocating stream space with exact numberOfDigitsInBase: did not gain speed
quo:
Primitive. Divide the receiver by the argument and return the result.
Round the result down towards zero to make it a whole integer. Fail if
the argument is 0. Fail if either the argument or the result is not a
SmallInteger or a LargePositiveInteger less than 2-to-the-30th (1073741824). Optional. See
Object documentation whatIsAPrimitive.
replaceFrom:to:with:startingAt:
Primitive. This destructively replaces elements from start to stop in the receiver starting at index, repStart, in the collection, replacement. Answer the receiver. Range checks are performed in the primitive only. Optional. See Object documentation whatIsAPrimitive.
sign
Optimization. Answer 1 since receiver is greater than 0.
strictlyPositive
Answer whether the receiver is mathematically positive.
withAtLeastNDigits:
~=
Primitive. Compare the receiver with the argument and answer true if
the receiver is equal to the argument. Otherwise answer false. Fail if the
receiver or argument is negative or greater than 32 bits.
Optional. See Object documentation whatIsAPrimitive.
Magnitude
I'm the abstract class Magnitude that provides common protocol for objects that have
the ability to be compared along a linear dimension, such as dates or times.
Subclasses of Magnitude include Date, ArithmeticValue, and Time, as well as
Character and LookupKey.


My subclasses should implement
< aMagnitude
= aMagnitude
hash
Here are some example of my protocol:
3 > 4
5 = 6
100 max: 9
7 between: 5 and: 10
<
Answer whether the receiver is less than the argument.
<=
Answer whether the receiver is less than or equal to the argument.
=
Compare the receiver with the argument and answer with true if the
receiver is equal to the argument. Otherwise answer false.
>
Answer whether the receiver is greater than the argument.
>=
Answer whether the receiver is greater than or equal to the argument.
between:and:
Answer whether the receiver is less than or equal to the argument, max,
and greater than or equal to the argument, min.
browserIcon
hash
Hash must be redefined whenever = is redefined.
max:
Answer the receiver or the argument, whichever has the greater
magnitude.
min:
Answer the receiver or the argument, whichever has the lesser
magnitude.
min:max:
putOn:
Message
I represent a selector and its argument values.

Generally, the system does not use instances of Message for efficiency reasons. However, when a message is not understood by its receiver, the interpreter will make up an instance of me in order to capture the information involved in an actual message transmission. This instance is sent it as an argument with the message doesNotUnderstand: to the receiver.
analogousCodeTo:
For MethodPropertires comparison.
argument
Answer the first (presumably sole) argument
argument:
Change the first argument to newValue and answer self
arguments
Answer the arguments of the receiver.
createStubMethod
lookupClass
lookupClass:
numArgs
Answer the number of arguments in this message
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
pushReceiver
selector
Answer the selector of the receiver.
selector:
selector:argument:
selector:arguments:
sendTo:
answer the result of sending this message to receiver
sends:
answer whether this message's selector is aSelector
sentTo:
answer the result of sending this message to receiver
setSelector:
setSelector:arguments:
storeOn:
Refer to the comment in Object|storeOn:.
MessageCatcher
Any message sent to me is returned as a Message object.
"Message catcher" creates an instance of me.
doesNotUnderstand:
privAccumulator
privAccumulator:
MessageSend
Instances of MessageSend encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed.
Use #value to perform a message send with its predefined arguments and #valueWithArguments: if additonal arguments have to supplied.
Structure:
receiver Object -- object receiving the message send
selector Symbol -- message selector
arguments Array -- bound arguments
=
Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.
arguments
arguments:
asMinimalRepresentation
collectArguments:
Private
doPostProcessingFor:response:
The method is to provide compatibility with HttpAdaptor's post processing.
The receiver is expected to accept two arguments.
evaluateWithArguments:
fixCallbackTemps
for polymorphism with BlockContext >> #fixCallbackTemps
hash
Answer a SmallInteger whose value is related to the receiver's identity.
May be overridden, and should be overridden in any classes that define =
isMessageSend
isValid
numArgs
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
processHttp
<Boolean> The receiver should answer a boolean to indicate whether
there is an HttpResponse available (accessed by HttpResponse current).
If the receiver takes no arguments, then assume that it answers a Boolean
and uses dyanmic bindings to access the current request/response, otherwise
pass in the current request and set the current response.
processHttpRequest:
<HttpResponse> The receiver should answer an HttpResponse for sending
to the client.
processVisitor:
receiver
receiver:
receiver:selector:
receiver:selector:argument:
receiver:selector:arguments:
renderOn:
Override this method to customize how objects (not components) are rendered when passed as an argument to #render:. The default is the return value of #displayString.
Just remember that you can not use #callback:, #on:of:, or #call:
selector
selector:
stringFor:
Return a string suitable for compiling. Literal or reference from global ref dictionary. self is always named via the ref dictionary.
validateForStack:
Do nothing, provided to provide compatibility with ComancheModule
value
Send the message and answer the return value
value:
valueWithArguments:
valueWithEnoughArguments:
call the selector with enough arguments from arguments and anArray
valueWithPossibleArgs:
valueWithPossibleArgument:
Evaluate the block represented by the receiver.
If the block requires one argument, use anArg, if it requires more than one,
fill up the rest with nils.
visitWithValuable:
Metaclass
My instances add instance-specific behavior to various class-describing objects in the system. This typically includes messages for initializing class variables and instance creation messages particular to a class. There is only one instance of a particular Metaclass, namely the class which is being described. A Metaclass shares the class variables of its instance.

[Subtle] In general, the superclass hierarchy for metaclasses parallels that for classes. Thus,
Integer superclass == Number, and
Integer class superclass == Number class.
However there is a singularity at Object. Here the class hierarchy terminates, but the metaclass hierarchy must wrap around to Class, since ALL metaclasses are subclasses of Class. Thus,
Object superclass == nil, and
Object class superclass == Class.
[Subtle detail] A class is know by name to an environment. Typically this is the SystemDictionary named Smalltalk. If we ever make lightweight classes that are not in Smalltalk, they must be in some environment. Specifically, the code that sets 'wasPresent' in name:inEnvironment:subclassOf:instanceVariableNames:variable:words:pointers:classVariableNames:poolDictionaries:category:comment:changed: must continue to work.
acceptsLoggingOfCompilation
Answer whether the receiver's method submisions and class defintions should be logged to the changes file and to the current change set. The metaclass follows the rule of the class itself. 6/18/96 sw
addInstVarName:
Add the argument, aString, as one of the receiver's instance variables.
addObsoleteSubclass:
Do nothing.
addSubclass:
Do nothing.
adoptInstance:from:
Recreate any existing instances of the argument, oldClass, as instances of
the receiver, which is a newly changed class. Permute variables as
necessary.
allInstances
Answer a collection of all current instances of the receiver.
allInstancesDo:
There should be only one
allInstancesEverywhereDo:
There should be only one
asClassSideNode
asNode
basicLocalSelectors
Direct accessor for the instance variable localSelectors.
Since localSelectors is lazily initialized, this may
return nil, which means that all selectors are local.
basicLocalSelectors:
bindingOf:
Answer the binding of some variable resolved in the scope of the receiver
canZapMethodDictionary
Return true if it is safe to zap the method dictionary on #obsolete
classPool
Answer the dictionary of class variables.
classVarNames
Answer a set of the names of the class variables defined in the receiver's instance.
copy
Make a copy of the receiver without a list of subclasses. Share the
reference to the sole instance.
definition
Refer to the comment in ClassDescription|definition.
environment
Return the environment in which the receiver is visible
fileOutInitializerOn:
fileOutOn:moveSource:toFile:
File a description of the receiver on aFileStream. If the boolean
argument, moveSource, is true, then set the trailing bytes to the position
of aFileStream and to fileIndex in order to indicate where to find the
source code.
fileOutOn:moveSource:toFile:initializing:
hasTraitComposition
instanceVariableNames:
Declare additional named variables for my instance.
isMeta
isObsolete
Return true if the receiver is obsolete
isSelfEvaluating
isSystemDefined
Answer false if I am a UniClass (an instance-specific lightweight class)
name
Answer a String that is the name of the receiver, either 'Metaclass' or
the name of the receiver's class followed by ' class'.
new
The receiver can only have one instance. Create it or complain that
one already exists.
nonTrivial
Answer whether the receiver has any methods or instance variables.
objectForDataStream:
I am about to be written on an object file. Write a reference to a class in Smalltalk instead.
obsoleteSubclasses
Answer the receiver's subclasses.
possibleVariablesFor:continuedFrom:
removeInstVarName:
Remove the argument, aString, as one of the receiver's instance variables.
removeObsoleteSubclass:
Do nothing.
removeSubclass:
Do nothing.
replaceObsoleteInstanceWith:
soleInstance
The receiver has only one instance. Answer it.
storeDataOn:
I don't get stored. Use a DiskProxy
subclasses
Answer the receiver's subclasses.
subclassesDo:
Evaluate aBlock for each of the receiver's immediate subclasses.
subclassesDoGently:
Evaluate aBlock for each of the receiver's immediate subclasses.
theMetaClass
Sent to a class or metaclass, always return the metaclass
theNonMetaClass
Sent to a class or metaclass, always return the class
traitComposition
traitComposition:
uses:instanceVariableNames:
veryDeepCopyWith:
Return self. Must be created, not copied. Do not record me.
wantsChangeSetLogging
Answer whether code submitted for the receiver should be remembered by the changeSet mechanism.The metaclass follows the rule of the class itself. 7/12/96 sw
wantsRecompilationProgressReported
The metaclass follows the rule of the class itself.
MethodContext
My instances hold all the dynamic state associated with the execution of either a method activation resulting from a message send or a block activation resulting from a block evaluation. In addition to their inherited state, this includes the receiver (self), the closure for a BlockClosure activation (which is nil for a method activation), a CompiledMethod, and space in the variable part of the context for arguments and temporary variables.

MethodContexts, though normal in their variable size, are actually only used in two sizes, small and large, which are determined by the temporary space required by the method being executed.
MethodContexts must only be created using the method newForMethod:. Note that it is impossible to determine the real object size of a MethodContext except by asking for the frameSize of its method. Any fields above the stack pointer (stackp) are truly invisible -- even (and especially!) to the garbage collector. Any store into stackp other than by the primitive method stackp: is potentially fatal.
aboutToReturn:through:
Called from VM when an unwindBlock is found between self and its home.
Return to home's sender, executing unwind blocks on the way.
activeHome
If executing closure, search senders for the activation of the original
(outermost) method that (indirectly) created my closure (the closureHome).
If the closureHome is not found on the sender chain answer nil.
activeOuterContext
If executing closure, search senders for the activation in which the receiver's
closure was created (the receiver's outerContext). If the outerContext is not
found on the sender chain answer nil.
asContext
blockReturnTop
Simulate the interpreter's action when a ReturnTopOfStackToCaller bytecode is
encountered in the receiver. This should only happen in a closure activation.
cachedStackTop
WARNING - this method depends on a very dirty trick, viz. snitching information off the variable stack of a particular CompiledMethod. So if you add/remove a temp in BlockContext>>valueUninterruptably, this method will fail, probably with some horrible consequences I'd rather not think through just now ... assumption is that the variable declaration in that method looks like:
| sendingContext result homeSender |
cannotReturn:
capturedTempNames
closure
contextForLocalVariables
Answer the context in which local variables (temporaries) are stored.
contextTag
Context tags may be used for referring to contexts instead of contexts themselves as they can be copied and will continue to work in other processes (continuations). By default, we use the context itself to as its tag.
doItScope
scope (environment) for expressions executed within a method context. self will be the receiver of the do-it method. We want temp vars directly accessible
freeNames
freeNamesAndValues
hasInstVarRef
Answer whether the receiver references an instance variable.
hasMethodReturn
home
Answer the context in which the receiver was defined.
instVarAt:put:
Primitive. Store a value into a fixed variable in the receiver. The
numbering of the variables corresponds to the named instance variables.
Fail if the index is not an Integer or is not the index of a fixed variable.
Answer the value stored as the result. Using this message violates the
principle that each object has sovereign control over the storing of
values into its instance variables. Essential. See Object documentation
whatIsAPrimitive.
isClosureContext
isExecutingBlock
Is this executing a block versus a method? In the new closure
implemetation this is true if closureOrNil is not nil, in which case
it should be holding a BlockClosure.
isHandlerContext
is this context for method that is marked?
isUnwindContext
is this context for method that is marked?
method
Answer the method of this context.
methodReturnContext
Answer the context from which an ^-return should return from.
myEnvFieldIndex
outerContext
Answer the context within which the receiver is nested.
printDetails:
Put my class>>selector and instance variables and arguments and temporaries on the stream. Protect against errors during printing.
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
printString
Answer an emphasized string in case of a breakpoint method
privRefresh
Reinitialize the receiver so that it is in the state it was at its creation.
privRefreshWith:
Reinitialize the receiver as though it had been for a different method.
Used by a Debugger when one of the methods to which it refers is
recompiled.
pushArgs:from:
<Array>
pushConsArrayWithElements:
receiver
Refer to the comment in ContextPart|receiver.
receiver:
removeSelf
Nil the receiver pointer and answer its former value.
restartWithNewReceiver:
sender:receiver:method:arguments:
setSender:receiver:method:arguments:
Create the receiver's initial state.
setSender:receiver:method:closure:startpc:
Create the receiver's initial state.
startpc
swapReceiver:
tempAt:
Answer the value of the temporary variable whose index is the
argument, index. Primitive. Assumes receiver is indexable. Answer the
value of an indexable element in the receiver. Fail if the argument index
is not an Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive. Override the default at: primitive to give latitude to the
VM in context management.
tempAt:put:
Store the argument, value, as the temporary variable whose index is the
argument, index. Primitive. Assumes receiver is indexable. Answer the
value of an indexable element in the receiver. Fail if the argument index
is not an Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive. Override the default at:put: primitive to give latitude to
the VM in context management.
tempNamed:
Answer the value of the temporary variable whose name is the
argument, aName.
tempNamed:put:
Store the argument, value, as the temporary variable whose name is the
argument, aName.
MethodDictionary
I am just like a normal Dictionary, except that I am implemented differently. Each Class has an instances of MethodDictionary to hold the correspondence between selectors (names of methods) and methods themselves.
In a normal Dictionary, the instance variable 'array' holds an array of Associations. Since there are thousands of methods in the system, these Associations waste space.
Each MethodDictionary is a variable object, with the list of keys (selector Symbols) in the variable part of the instance. The variable 'array' holds the values, which are CompiledMethods.
add:
Include newObject as one of the receiver's elements, but only if
not already present. Answer newObject.
associationsDo:
Evaluate aBlock for each of the receiver's elements (key/value
associations).
at:ifAbsent:
Answer the value associated with the key or, if key isn't found,
answer the result of evaluating aBlock.
at:put:
Set the value at key to be value.
copy
Must copy the associations, or later store will affect both the
original and the copy
do:
Evaluate aBlock with each of the receiver's elements as the argument.
grow
Grow the elements array and reinsert the old elements
includesKey:
This override assumes that pointsTo is a fast primitive
keyAt:
May be overridden by subclasses so that fixCollisions will work
keyAtIdentityValue:ifAbsent:
Answer the key whose value equals the argument, value. If there is
none, answer the result of evaluating exceptionBlock.
keyAtValue:ifAbsent:
Answer the key whose value equals the argument, value. If there is
none, answer the result of evaluating exceptionBlock.
keys
Since method all method selectors are symbols it is more efficient
to use an IdentitySet rather than a Set.
keysAndValuesDo:
Enumerate the receiver with all the keys and values passed to the block
keysDo:
Evaluate aBlock for each of the receiver's keys.
methodArray
new
new:
rehash
Smalltalk rehash.
rehashWithoutBecome
removeDangerouslyKey:ifAbsent:
This is not really dangerous. But if normal removal
were done WHILE a MethodDict were being used, the
system might crash. So instead we make a copy, then do
this operation (which is NOT dangerous in a copy that is
not being used), and then use the copy after the removal.
removeKey:ifAbsent:
The interpreter might be using this MethodDict while
this method is running! Therefore we perform the removal
in a copy, and then atomically become that copy
removeKeyNoBecome:
The interpreter might be using this MethodDict while
this method is running! Therefore we perform the removal
in a copy, and then return the copy for subsequent installation
scanFor:
Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or zero if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements.
swap:with:
May be overridden by subclasses so that fixCollisions will work
valuesDo:
Evaluate aBlock for each of the receiver's values.
MethodProperties
I am class holding state for compiled methods. All my instance variables should be actually part of the CompiledMethod itself, but the current implementation of the VM doesn't allow this.
I am a compact class and optimized for size and speed, since every CompiledMethod points onto an instance of myself. I am mostly polymorphic to the protocol of an identity-dictionary, so that key-value pairs can be easily stored and retreived without the need to add new variables. However keep in mind that instantiating a dictionary consumes much more memory than adding an instance-variable, so it might be clever to add a new variable if the property is going to be used by every compiled method.
=
Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.
addPragma:
analogousCodeTo:
at:
Answer the property value associated with aKey.
at:ifAbsent:
Answer the property value associated with aKey or, if aKey isn't found, answer the result of evaluating aBlock.
at:ifAbsentPut:
Answer the property associated with aKey or, if aKey isn't found store the result of evaluating aBlock as new value.
at:put:
Set the property at aKey to be anObject. If aKey is not found, create a new entry for aKey and set is value to anObject. Answer anObject.
hasAtLeastTheSamePropertiesAs:
Answer if the recever has at least the same properties as the argument.
N.B. The receiver may have additional properties and still answer true.
hasLiteralSuchThat:
Answer true if litBlock returns true for any literal in this array, even if embedded in further array structure.
This method is only intended for private use by CompiledMethod hasLiteralSuchThat:
hasLiteralThorough:
Answer true if any literal in this method is literal,
even if embedded in array structure.
includesKey:
Test if the property aKey is present.
initialize
Subclasses should redefine this method to perform initializations on instance creation
isEmpty
isMethodProperties
keysAndValuesDo:
Enumerate the receiver with all the keys and values.
method:
For forward compatibility wth AdditionalMethodState, for decompilation
notEmpty
postCopy
self is a shallow copy, subclasses should copy fields as necessary to complete the full copy
pragmas
pragmas:
properties
propertiesIsNil
propertyKeysAndValuesDo:
Enumerate the receiver with all the keys and values.
propertyValueAt:ifAbsent:
Answer the property value associated with aKey or, if aKey isn't found, answer the result of evaluating aBlock.
refersToLiteral:
Answer true if literal is identical to any literal in this array, even if imbedded in further structures. This is the end of the imbedded structure path so return false.
removeKey:
Remove the property with aKey. Answer the property or raise an error if aKey isn't found.
removeKey:ifAbsent:
Remove the property with aKey. Answer the value or, if aKey isn't found, answer the result of evaluating aBlock.
selector
selector:
setMethod:
For forward compatibility wth AdditionalMethodState
Model
Provides a superclass for classes that function as models. The only behavior provided is fast dependents maintenance, which bypasses the generic DependentsFields mechanism. 1/23/96 sw
addItem:
Make a linked message list and put this method in it
arrowKey:from:
backstop; all the PluggableList* classes actually handle arrow keys, and the models handle other keys.
buildWith:
canDiscardEdits
Answer true if none of the views on this model has unaccepted edits that matter.
containingWindow
Answer the window that holds the receiver. The dependents technique is
odious and may not be airtight, if multiple windows have the same
model.
hasUnacceptedEdits
Answer true if any of the views on this model has unaccepted edits.
myDependents
Private. Answer a list of all the receiver's dependents.
myDependents:
Private. Set (or remove) the receiver's dependents list.
perform:orSendTo:
Selector was just chosen from a menu by a user. If can respond, then perform it on myself. If not, send it to otherTarget, presumably the editPane from which the menu was invoked.
selectedClass
All owners of TextViews are asked this during a doIt
step
Default for morphic models is no-op
topView
Find the first top view on me. Is there any danger of their being two
with the same model? Any danger from ungarbage collected old views?
Ask if schedulled?
trash
What should be displayed if a trash pane is restored to initial state
trash:
Whatever the user submits to the trash, it need not be saved.
veryDeepFixupWith:
See if the dependents are being copied also. If so, point at the new copies. (The dependent has self as its model.)
Dependents handled in class Object, when the model is not a Model, are fixed up in Object veryDeepCopy.
Monitor
A monitor provides process synchronization that is more high level than the one provided by a Semaphore. Similar to the classical definition of a Monitor it has the following properties:
1) At any time, only one process can execute code inside a critical section of a monitor.
2) A monitor is reentrant, which means that the active process in a monitor never gets blocked when it enters a (nested) critical section of the same monitor.
3) Inside a critical section, a process can wait for an event that may be coupled to a certain condition. If the condition is not fulfilled, the process leaves the monitor temporarily (in order to let other processes enter) and waits until another process signals the event. Then, the original process checks the condition again (this is often necessary because the state of the monitor could have changed in the meantime) and continues if it is fulfilled.
4) The monitor is fair, which means that the process that is waiting on a signaled condition the longest gets activated first.
5) The monitor allows you to define timeouts after which a process gets activated automatically.
Basic usage:
Monitor>>critical: aBlock
Critical section.
Executes aBlock as a critical section. At any time, only one process can execute code in a critical section.
NOTE: All the following synchronization operations are only valid inside the critical section of the monitor!
Monitor>>wait
Unconditional waiting for the default event.
The current process gets blocked and leaves the monitor, which means that the monitor allows another process to execute critical code. When the default event is signaled, the original process is resumed.
Monitor>>waitWhile: aBlock
Conditional waiting for the default event.
The current process gets blocked and leaves the monitor only if the argument block evaluates to true. This means that another process can enter the monitor. When the default event is signaled, the original process is resumed, which means that the condition (argument block) is checked again. Only if it evaluates to false, does execution proceed. Otherwise, the process gets blocked and leaves the monitor again...
Monitor>>waitUntil: aBlock
Conditional waiting for the default event.
See Monitor>>waitWhile: aBlock.
Monitor>>signal
One process waiting for the default event is woken up.
Monitor>>signalAll
All processes waiting for the default event are woken up.
Using non-default (specific) events:
Monitor>>waitFor: aSymbol
Unconditional waiting for the non-default event represented by the argument symbol.
Same as Monitor>>wait, but the process gets only reactivated by the specific event and not the default event.
Monitor>>waitWhile: aBlock for: aSymbol
Confitional waiting for the non-default event represented by the argument symbol.
Same as Monitor>>waitWhile:for:, but the process gets only reactivated by the specific event and not the default event.
Monitor>>waitUntil: aBlock for: aSymbol
Confitional waiting for the non-default event represented by the argument symbol.
See Monitor>>waitWhile:for: aBlock.
Monitor>>signal: aSymbol
One process waiting for the given event is woken up. If there is no process waiting for this specific event, a process waiting for the default event gets resumed.
Monitor>>signalAll: aSymbol
All process waiting for the given event or the default event are woken up.
Monitor>>signalReallyAll
All processes waiting for any events (default or specific) are woken up.
Using timeouts
Monitor>>waitMaxMilliseconds: anInteger
Monitor>>waitFor: aSymbol maxMilliseconds: anInteger
Same as Monitor>>wait (resp. Monitor>>waitFor:), but the process gets automatically woken up when the specified time has passed.
Monitor>>waitWhile: aBlock maxMilliseconds: anInteger
Monitor>>waitWhile: aBlock for: aSymbol maxMilliseconds: anInteger
Same as Monitor>>waitWhile: (resp. Monitor>>waitWhile:for:), but the process gets automatically woken up when the specified time has passed.
Monitor>>waitUntil: aBlock maxMilliseconds: anInteger
Monitor>>waitUntil: aBlock for: aSymbol maxMilliseconds: anInteger
Same as Monitor>>waitUntil: (resp. Monitor>>waitUntil:for:), but the process gets automatically woken up when the specified time has passed.
checkOwnerProcess
cleanup
critical:
Critical section.
Executes aBlock as a critical section. At any time, only one process can be executing code
in a critical section.
NOTE: All the following synchronization operations are only valid inside the critical section
of the monitor!
defaultQueue
enter
exit
exitAndWaitInQueue:maxMilliseconds:
initialize
Subclasses should redefine this method to perform initializations on instance creation
isOwnerProcess
privateCleanup
queueDict
queueFor:
signal
One process waiting for the default event is woken up.
signal:
One process waiting for the given event is woken up. If there is no process waiting
for this specific event, a process waiting for the default event gets resumed.
signalAll
All processes waiting for the default event are woken up.
signalAll:
All process waiting for the given event or the default event are woken up.
signalAllInQueue:
signalLock:inQueue:
signalQueue:
signalReallyAll
All processes waiting for any events (default or specific) are woken up.
wait
Unconditional waiting for the default event.
The current process gets blocked and leaves the monitor, which means that the monitor
allows another process to execute critical code. When the default event is signaled, the
original process is resumed.
waitFor:
Unconditional waiting for the non-default event represented by the argument symbol.
Same as Monitor>>wait, but the process gets only reactivated by the specific event and
not the default event.
waitFor:maxMilliseconds:
Same as Monitor>>waitFor:, but the process gets automatically woken up when the
specified time has passed.
waitFor:maxSeconds:
Same as Monitor>>waitFor:, but the process gets automatically woken up when the
specified time has passed.
waitInQueue:maxMilliseconds:
waitMaxMilliseconds:
Same as Monitor>>wait, but the process gets automatically woken up when the
specified time has passed.
waitMaxSeconds:
Same as Monitor>>wait, but the process gets automatically woken up when the
specified time has passed.
waitUntil:
Conditional waiting for the default event.
See Monitor>>waitWhile: aBlock.
waitUntil:for:
Confitional waiting for the non-default event represented by the argument symbol.
See Monitor>>waitWhile:for: aBlock.
waitUntil:for:maxMilliseconds:
Same as Monitor>>waitUntil:for:, but the process gets automatically woken up when the
specified time has passed.
waitUntil:for:maxSeconds:
Same as Monitor>>waitUntil:for:, but the process gets automatically woken up when the
specified time has passed.
waitUntil:maxMilliseconds:
Same as Monitor>>waitUntil:, but the process gets automatically woken up when the
specified time has passed.
waitUntil:maxSeconds:
Same as Monitor>>waitUntil:, but the process gets automatically woken up when the
specified time has passed.
waitWhile:
Conditional waiting for the default event.
The current process gets blocked and leaves the monitor only if the argument block
evaluates to true. This means that another process can enter the monitor. When the
default event is signaled, the original process is resumed, which means that the condition
(argument block) is checked again. Only if it evaluates to false, does execution proceed.
Otherwise, the process gets blocked and leaves the monitor again...
waitWhile:for:
Confitional waiting for the non-default event represented by the argument symbol.
Same as Monitor>>waitWhile:for:, but the process gets only reactivated by the specific
event and not the default event.
waitWhile:for:maxMilliseconds:
Same as Monitor>>waitWhile:for:, but the process gets automatically woken up when the
specified time has passed.
waitWhile:for:maxSeconds:
Same as Monitor>>waitWhile:for:, but the process gets automatically woken up when the
specified time has passed.
waitWhile:inQueue:maxMilliseconds:
waitWhile:maxMilliseconds:
Same as Monitor>>waitWhile:, but the process gets automatically woken up when the
specified time has passed.
waitWhile:maxSeconds:
Same as Monitor>>waitWhile:, but the process gets automatically woken up when the
specified time has passed.
MonitorDelay
This is a specialization of the class Delay that is used for the implementation of the class Monitor.
setDelay:forSemaphore:monitor:queue:
signalLock:afterMSecs:inMonitor:queue:
signalWaitingProcess
The delay time has elapsed; signal the waiting process.
Month
I represent a month.
asMonth
daysInMonth
daysInMonth:forYear:
index
indexOfMonth:
month:year:
name
Answer a name for the receiver. This is used generically in the title of certain inspectors, such as the referred-to inspector, and specificially by various subsystems. By default, we let the object just print itself out..
nameOfMonth:
previous
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
readFrom:
starting:duration:
Mutex
A Mutex is a light-weight MUTual EXclusion object being used when two or more processes need to access a shared resource concurrently. A Mutex grants ownership to a single process and will suspend any other process trying to aquire the mutex while in use. Waiting processes are granted access to the mutex in the order the access was requested.
Instance variables:
semaphore <Semaphore> The (primitive) semaphore used for synchronization.
owner <Process> The process owning the mutex.
critical:
Evaluate aBlock protected by the receiver.
initialize
Subclasses should redefine this method to perform initializations on instance creation
MutexSet
A MutexSet helps with aquiring a set of mutexes.
critical:
Evaluate aBlock aquiring all mutexes
pvtCritical:startingAt:
withAll:
Number
Class Number holds the most general methods for dealing with numbers. Subclasses Float, Fraction, and Integer, and their subclasses, provide concrete representations of a numeric quantity.
All of Number's subclasses participate in a simple type coercion mechanism that supports mixed-mode arithmetic and comparisons. It works as follows: If
self<typeA> op: arg<typeB>
fails because of incompatible types, then it is retried in the following guise:
(arg adaptTypeA: self) op: arg adaptToTypeA.
This gives the arg of typeB an opportunity to resolve the incompatibility, knowing exactly what two types are involved. If self is more general, then arg will be converted, and viceVersa. This mechanism is extensible to any new number classes that one might wish to add to Squeak. The only requirement is that every subclass of Number must support a pair of conversion methods specific to each of the other subclasses of Number.
*
Answer the result of multiplying the receiver by aNumber.
+
Answer the sum of the receiver and aNumber.
-
Answer the difference between the receiver and aNumber.
/
Answer the result of dividing the receiver by aNumber.
//
Integer quotient defined by division with truncation toward negative
infinity. 9//4 = 2, -9//4 = -3. -0.9//0.4 = -3. \\ answers the remainder
from this division.
@
Primitive. Answer a Point whose x value is the receiver and whose y
value is the argument. Optional. No Lookup. See Object documentation
whatIsAPrimitive.
\\
modulo. Remainder defined in terms of //. Answer a Number with the
same sign as aNumber. e.g. 9\\4 = 1, -9\\4 = 3, 9\\-4 = -3, 0.9\\0.4 = 0.1.
abs
Answer a Number that is the absolute value (positive magnitude) of the
receiver.
adaptToCollection:andSend:
If I am involved in arithmetic with a Collection, return a Collection of
the results of each element combined with me in that expression.
adaptToFloat:andCompare:
If I am involved in comparison with a Float, convert rcvr to a
Fraction. This way, no bit is lost and comparison is exact.
adaptToFloat:andSend:
If I am involved in arithmetic with a Float, convert me to a Float.
adaptToFraction:andSend:
If I am involved in arithmetic with a Fraction, convert us and evaluate exprBlock.
adaptToInteger:andSend:
If I am involved in arithmetic with a Integer, convert us and evaluate exprBlock.
adaptToPoint:andSend:
If I am involved in arithmetic with a Point, convert me to a Point.
adaptToString:andSend:
If I am involved in arithmetic with a String, convert it to a Number.
arcCos
The receiver is the cosine of an angle. Answer the angle measured in
radians.
arcSin
The receiver is the sine of an angle. Answer the angle measured in
radians.
arcTan
The receiver is the tangent of an angle. Answer the angle measured in
radians.
arcTan:
The receiver is the tangent of an angle. Answer the angle measured in
radians.
arg
Answer the argument of the receiver (see Complex | arg).
asB3DVector3
asDuration
asFloatD
Answer a d precision floating-point number approximating the receiver.
asFloatE
Answer a floating-point number approximating the receiver.
asFloatQ
Answer a floating-point number approximating the receiver.
asInteger
Answer an Integer nearest the receiver toward zero.
asNumber
asPoint
Answer a Point with the receiver as both coordinates; often used to
supply the same value in two dimensions, as with symmetrical gridding
or scaling.
asScaledDecimal
Answer a scaled decimal number approximating the receiver.
asScaledDecimal:
Answer the receiver converted to a ScaledDecimal.
asSmallAngleDegrees
Return the receiver normalized to lie within the range (-180, 180)
asSmallPositiveDegrees
Return the receiver normalized to lie within the range (0, 360)
basicType
Answer a symbol representing the inherent type of the receiver
byteEncode:
ceiling
Answer the integer nearest the receiver toward positive infinity.
closeTo:
are these two numbers close?
cos
The receiver represents an angle measured in radians. Answer its cosine.
day
days
defaultLabelForInspector
Answer the default label to be used for an Inspector window on the receiver.
degreeCos
Answer the cosine of the receiver taken as an angle in degrees.
degreeSin
Answer the sine of the receiver taken as an angle in degrees.
degreesToRadians
The receiver is assumed to represent degrees. Answer the conversion to
radians.
detentBy:atMultiplesOf:snap:
Map all values that are within detent/2 of any multiple of grid to that multiple. Otherwise, if snap is true, return self, meaning that the values in the dead zone will never be returned. If snap is false, then expand the range between dead zones so that it covers the range between multiples of the grid, and scale the value by that factor.
even
Answer whether the receiver is an even number.
exp
Answer the exponential of the receiver as a floating point number.
floor
Answer the integer nearest the receiver toward negative infinity.
floorLog:
Answer the floor of the log base radix of the receiver.
fractionPart
Added for ANSI compatibility
hour
hours
i
integerPart
Added for ANSI compatibility
interpolateTo:at:
isDivisibleBy:
isInf
isInfinite
isNaN
isNumber
Overridden to return true in Number, natch
isOrAreStringWith:
isZero
ln
Answer the natural log of the receiver.
log
Answer the base-10 log of the receiver.
log:
Answer the log base aNumber of the receiver.
milliSecond
milliSeconds
minute
minutes
nanoSecond
nanoSeconds
negated
Answer a Number that is the negation of the receiver.
negative
Answer whether the receiver is mathematically negative.
odd
Answer whether the receiver is an odd number.
one
positive
Answer whether the receiver is positive or equal to 0. (ST-80 protocol).
See also strictlyPositive
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
printOn:base:
This method should print a representation of the number for the given base,
excluding the base prefix (and the letter r for radix)
printShowingDecimalPlaces:
Print the receiver showing precisely the given number of places desired. If placesDesired is positive, a decimal point and that many digits after the decimal point will always be shown. If placesDesired is zero, a whole number will be shown, without a decimal point.
printString
Answer a String whose characters are a description of the receiver.
If you want to print without a character limit, use fullPrintString.
printStringBase:
quo:
Integer quotient defined by division with truncation toward zero. -9 quo:
4 = -2, -0.9 quo: 0.4 = -2. rem: answers the remainder from this division.
radiansToDegrees
The receiver is assumed to represent radians. Answer the conversion to
degrees.
raisedTo:
Answer the receiver raised to aNumber.
raisedToInteger:
The 0 raisedToInteger: 0 is an special case. In some contexts must be 1 and in others must
be handled as an indeterminate form.
I take the first context because that's the way that was previously handled.
Maybe further discussion is required on this topic.
readExactlyFrom:
readExponent:base:from:
readFrom:
readFrom:base:
readFrom:ifFail:
readRemainderOf:from:base:withSign:
readScaledDecimal:fractionPart:digits:base:sign:from:
reciprocal
Returns the reciprocal of self.
In case self is 0 the / signals ZeroDivide
reduce
If self is close to an integer, return that integer
rem:
Remainder defined in terms of quo:. Answer a Number with the same
sign as self. e.g. 9 rem: 4 = 1, -9 rem: 4 = -1. 0.9 rem: 0.4 = 0.1.
roundTo:
Answer the nearest number that is a multiple of quantum.
roundUpTo:
Answer the next multiple of aNumber toward infinity that is nearest the
receiver.
rounded
Answer the integer nearest the receiver.
second
seconds
sign
Answer 1 if the receiver is greater than 0, -1 if less than 0, else 0.
sign:
Return a Number with the same sign as aNumber
sin
The receiver represents an angle measured in radians. Answer its sine.
sqrt
Answer the square root of the receiver.
squared
Answer the receiver multipled by itself.
storeOn:
Append to the argument aStream a sequence of characters that is an
expression whose evaluation creates an object similar to the receiver.
storeOn:base:
This method should print a representation of the number for the given base,
including the base prefix (with letter r for radix)
storeStringBase:
strictlyPositive
Answer whether the receiver is mathematically positive.
stringForReadout
tan
The receiver represents an angle measured in radians. Answer its
tangent.
to:
Answer an Interval from the receiver up to the argument, stop,
incrementing by 1.
to:by:
Answer an Interval from the receiver up to the argument, stop,
incrementing by step.
to:by:do:
Normally compiled in-line, and therefore not overridable.
Evaluate aBlock for each element of the interval (self to: stop by:
step).
to:do:
Normally compiled in-line, and therefore not overridable.
Evaluate aBlock for each element of the interval (self to: stop by: 1).
truncateTo:
Answer the next multiple of aNumber toward zero that is nearest the
receiver.
truncated
Answer an integer nearest the receiver toward zero.
week
weeks
Object
Object is the root class for almost all of the other classes in the class hierarchy. The exceptions are ProtoObject (the superclass of Object) and its subclasses.
Class Object provides default behavior common to all normal objects, such as access, copying, comparison, error handling, message sending, and reflection. Also utility messages that all objects should respond to are defined here.
Object has no instance variables, nor should any be added. This is due to several classes of objects that inherit from Object that have special implementations (SmallInteger and UndefinedObject for example) or the VM knows about and depends on the structure and layout of certain standard classes.
Class Variables:
DependentsFields an IdentityDictionary
Provides a virtual 'dependents' field so that any object may have one
or more dependent views, synchronized by the changed:/update: protocol.
Note that class Model has a real slot for its dependents, and overrides
the associated protocol with more efficient implementations.
EventsFields an IdentityDictionary that maps each object to its dependents.
Registers a message send (consisting of a selector and a receiver object)
which should be performed when anEventSymbol is triggered by the receiver.
Part of a new event notification framework which could eventually replace
the existing changed/update mechanism. It is intended to be compatible
with Dolphin Smalltalk and VSE as much as possible.
Because Object is the root of the inheritance tree, methods are often defined in Object to give all objects special behaviors needed by certain subsystems or applications, or to respond to certain general test messages such as isMorph.
->
Answer an Association between self and anObject
=
Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.
acceptDroppingMorph:event:inMorph:
actAsExecutor
Prepare the receiver to act as executor for any resources associated with it
actionForEvent:
Answer the action to be evaluated when <anEventSelector> has been triggered.
actionForEvent:ifAbsent:
Answer the action to be evaluated when <anEventSelector> has been triggered.
actionMap
actionSequenceForEvent:
actionsDo:
adaptToFloat:andCompare:
If I am involved in comparison with a Float.
Default behaviour is to process comparison as any other selectors.
adaptToFloat:andSend:
If no method has been provided for adapting an object to a Float,
then it may be adequate to simply adapt it to a number.
adaptToFraction:andCompare:
If I am involved in comparison with a Fraction.
Default behaviour is to process comparison as any other selectors.
adaptToFraction:andSend:
If no method has been provided for adapting an object to a Fraction,
then it may be adequate to simply adapt it to a number.
adaptToInteger:andCompare:
If I am involved in comparison with an Integer.
Default behaviour is to process comparison as any other selectors.
adaptToInteger:andSend:
If no method has been provided for adapting an object to a Integer,
then it may be adequate to simply adapt it to a number.
adaptedToWorld:
If I refer to a world or a hand, return the corresponding items in the new world.
addDependent:
Make the given object one of the receiver's dependents.
addInstanceVarNamed:withValue:
Add an instance variable named aName and give it value aValue
addModelItemsToWindowMenu:
aMenu is being constructed to be presented to the user in response to the user's pressing on the menu widget in the title bar of a morphic window. Here, the model is given the opportunity to add any model-specific items to the menu, whose default target is the SystemWindow itself.
addModelMenuItemsTo:forMorph:hand:
The receiver serves as the model for aMorph; a menu is being constructed for the morph, and here the receiver is able to add its own items
addModelYellowButtonMenuItemsTo:forMorph:hand:
The receiver serves as the model for aMorph; a menu is being constructed for the morph, and here the receiver is able to add its own items
appendTo:
double dispatch for join:
as:
Create an object of class aSimilarClass that has similar contents to the receiver.
asActionSequence
asActionSequenceTrappingErrors
asAnnouncement
asDraggableMorph
asExplorerString
asFunction
asFunction:
asHtmlDocumentForRequest:
asHttpResponseTo:
asJavascript
asMorph
Open a morph, as best one can, on the receiver
asOop
Primitive. Answer a SmallInteger whose value is half of the receiver's
object pointer (interpreting object pointers as 16-bit signed quantities).
Fail if the receiver is a SmallInteger. Essential. See Object documentation
whatIsAPrimitive.
asOrderedCollection
Answer an OrderedCollection with the receiver as its only element.
asString
Answer a string that represents the receiver.
asStringMorph
Open a StringMorph, as best one can, on the receiver
asStringOrText
Answer a string that represents the receiver.
asTextMorph
Open a TextMorph, as best one can, on the receiver
assert:
Throw an assertion error if aBlock does not evaluates to true.
assert:description:
Throw an assertion error if aBlock does not evaluates to true.
assert:descriptionBlock:
Throw an assertion error if aBlock does not evaluate to true.
at:
Primitive. Assumes receiver is indexable. Answer the value of an
indexable element in the receiver. Fail if the argument index is not an
Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive.
at:modify:
Replace the element of the collection with itself transformed by the block
at:put:
Primitive. Assumes receiver is indexable. Store the argument value in
the indexable element of the receiver indicated by index. Fail if the
index is not an Integer or is out of bounds. Or fail if the value is not of
the right type for this kind of collection. Answer the value that was
stored. Essential. See Object documentation whatIsAPrimitive.
backwardCompatibilityOnly:
Warn that the sending method has been deprecated. Methods that are tagt with #backwardCompatibility:
are kept for compatibility.
basicAt:
Primitive. Assumes receiver is indexable. Answer the value of an
indexable element in the receiver. Fail if the argument index is not an
Integer or is out of bounds. Essential. Do not override in a subclass. See
Object documentation whatIsAPrimitive.
basicAt:put:
Primitive. Assumes receiver is indexable. Store the second argument
value in the indexable element of the receiver indicated by index. Fail
if the index is not an Integer or is out of bounds. Or fail if the value is
not of the right type for this kind of collection. Answer the value that
was stored. Essential. Do not override in a subclass. See Object
documentation whatIsAPrimitive.
basicInspect
Create and schedule an Inspector in which the user can examine the
receiver's variables. This method should not be overriden.
basicShallowCopy
Answer a copy of the receiver which shares the receiver's instance variables.
basicSize
Primitive. Answer the number of indexable variables in the receiver.
This value is the same as the largest legal subscript. Essential. Do not
override in any subclass. See Object documentation whatIsAPrimitive.
beMutable
for VW compatibility, a hack that allows to cache a value in a literal array
becomeForward:
Primitive. All variables in the entire system that used to point
to the receiver now point to the argument.
Fails if either argument is a SmallInteger.
becomeForward:copyHash:
Primitive. All variables in the entire system that used to point to the receiver now point to the argument.
If copyHash is true, the argument's identity hash bits will be set to those of the receiver.
Fails if either argument is a SmallInteger.
binding
Answer the DynamicBinding for the receiver (if any)
binding:
Set the dynamic binding for the receiver, if anObject is nil, then
remove the receiver's dynamic binding (if any)
bindingOf:
break
This is a simple message to use for inserting breakpoints during debugging.
The debugger is opened by sending a signal. This gives a chance to restore
invariants related to multiple processes.
breakDependents
Remove all of the receiver's dependents.
browse
browseHierarchy
browseOwnClassSubProtocol
Open up a ProtocolBrowser on the subprotocol of the receiver
byteEncode:
canDiscardEdits
Answer true if none of the views on this model has unaccepted edits that matter.
capturedState
May be overridden in subclasses.
caseError
Report an error from an in-line or explicit case statement.
caseOf:
The elements of aBlockAssociationCollection are associations between blocks.
Answer the evaluated value of the first association in aBlockAssociationCollection
whose evaluated key equals the receiver. If no match is found, report an error.
caseOf:otherwise:
The elements of aBlockAssociationCollection are associations between blocks.
Answer the evaluated value of the first association in aBlockAssociationCollection
whose evaluated key equals the receiver. If no match is found, answer the result
of evaluating aBlock.
changed
Receiver changed in a general way; inform all the dependents by
sending each dependent an update: message.
changed:
Receiver changed. The change is denoted by the argument aParameter.
Usually the argument is a Symbol that is part of the dependent's change
protocol. Inform all of the dependents.
changed:with:
Receiver changed. The change is denoted by the argument anAspect.
Usually the argument is a Symbol that is part of the dependent's change
protocol. Inform all of the dependents. Also pass anObject for additional information.
checkHaltCountExpired
chooseUniqueClassName
class
Primitive. Answer the object which is the receiver's class. Essential. See
Object documentation whatIsAPrimitive.
className
Answer a string characterizing the receiver's class, for use in list views for example
clearHaltOnce
Turn on the halt once flag.
clone
closeTo:
Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.
codeStrippedOut:
When a method is stripped out for external release, it is replaced by a method that calls this
comeFullyUpOnReload:
Normally this read-in object is exactly what we want to store. 7/26/96 tk
commandHistory
Return the command history for the receiver
complexContents
confirm:
Put up a yes/no menu with caption queryString. Answer true if the
response is yes, false if no. This is a modal question--the user must
respond yes or no.
confirm:orCancel:
Put up a yes/no/cancel menu with caption aString. Answer true if
the response is yes, false if no. If cancel is chosen, evaluate
cancelBlock. This is a modal question--the user must respond yes or no.
contentType
contentsChanged
copy
Answer another instance just like the receiver. Subclasses typically override postCopy; they typically do not override shallowCopy.
copyAddedStateFrom:
Copy over the values of instance variables added by the receiver's class from anotherObject to the receiver. These will be remapped in mapUniClasses, if needed.
copyFrom:
Copy to myself all instance variables I have in common with anotherObject. This is dangerous because it ignores an object's control over its own inst vars.
copySameFrom:
Copy to myself all instance variables named the same in otherObject.
This ignores otherObject's control over its own inst vars.
copyTwoLevel
one more level than a shallowCopy
couldOpenInMorphic
is there an obvious morphic world in which to open a new morph?
createActionMap
createFrom:size:version:
creationStamp
Answer a string which reports the creation particulars of the receiver. Intended perhaps for list views, but this is presently a feature not easily accessible
currentEvent
Answer the current Morphic event. This method never returns nil.
currentHand
Return a usable HandMorph -- the one associated with the object's current environment. This method will always return a hand, even if it has to conjure one up as a last resort. If a particular hand is actually handling events at the moment (such as a remote hand or a ghost hand), it will be returned.
currentWorld
Answer a morphic world that is the current UI focus.
If in an embedded world, it's that world.
If in a morphic project, it's that project's world.
This method will never return nil, it will always return its best effort at returning a relevant world morph, but if need be -- if there are no worlds anywhere, it will create a new one.
customizeExplorerContents
decrementAndCheckHaltCount
decrementHaltCount
deepCopy
Answer a copy of the receiver with its own copy of each instance
variable.
defaultBackgroundColor
Answer the color to be used as the base window color for a window whose model is an object of the receiver's class
defaultFloatPrecisionFor:
Answer a number indicating the default float precision to be used in a numeric readout for which the receiver is the model.
defaultLabelForInspector
Answer the default label to be used for an Inspector window on the receiver.
defaultNameStemForInstances
Answer a basis for names of default instances of the receiver. The default is to let the class specify, but certain instances will want to override. (PasteUpMorphs serving as Worlds come to mind
dependents
Answer a collection of objects that are 'dependent' on the receiver;
that is, all objects that should be notified if the receiver changes.
deprecated:
Warn that the sending method has been deprecated.
deprecated:block:
Warn that the sender has been deprecated. Answer the value of aBlock on resumption.
(Note that deprecated: is the preferred method.)
deprecated:on:in:
Warn that the sending method has been deprecated
deprecatedApi
deprecatedApi:
displayString
doExpiredHaltCount
doExpiredHaltCount:
doExpiredInspectCount
doesNotUnderstand:
Handle the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message (typically sent from the machine when a message is sent to the receiver and no method is defined for that selector).
dpsTrace:
dpsTrace:levels:
dpsTrace:levels:withContext:
dragPassengerFor:inMorph:
dragTransferType
dragTransferTypeForMorph:
drawOnCanvas:
elementSeparator
encodeOn:
encodePostscriptOn:
error
Throw a generic Error exception.
error:
Throw a generic Error exception.
errorImproperStore
Create an error notification that an improper store was attempted.
errorNonIntegerIndex
Create an error notification that an improper object was used as an index.
errorNotIndexable
Create an error notification that the receiver is not indexable.
errorSubscriptBounds:
Create an error notification that an improper integer was used as an index.
evaluate:wheneverChangeIn:
evaluateUnloggedForSelf:
executor
Return an object which can act as executor for finalization of the receiver
explicitRequirement
explore
exploreAndYourself
i.e. explore; yourself. Thisway i can peek w/o typing all the parentheses
exploreWithLabel:
externalName
Answer an external name by which the receiver is known. Generic implementation here is a transitional backstop. probably
fileReaderServicesForDirectory:
fileReaderServicesForFile:suffix:
finalizationRegistry
Answer the finalization registry associated with the receiver.
finalize
Finalize the resource associated with the receiver. This message should only be sent during the finalization process. There is NO garantuee that the resource associated with the receiver hasn't been free'd before so take care that you don't run into trouble - this all may happen with interrupt priority.
fixUponLoad:seg:
change the object due to conventions that have changed on
the project level. (sent to all objects in the incoming project).
Specific classes should reimplement this.
flash
Do nothing.
flattenOnStream:
flushDependents
flushEvents
fullDrawPostscriptOn:
fullPrintString
Answer a String whose characters are a description of the receiver.
graphicForViewerTab
When a Viewer is open on the receiver, its tab needs some graphic to show to the user. Answer a form or a morph to serve that purpose. A generic image is used for arbitrary objects, but note my reimplementors
halt
This is the typical message to use for inserting breakpoints during
debugging. It behaves like halt:, but does not call on halt: in order to
avoid putting this message on the stack. Halt is especially useful when
the breakpoint message is an arbitrary one.
halt:
This is the typical message to use for inserting breakpoints during
debugging. It creates and schedules a Notifier with the argument,
aString, as the label.
halt:onCount:
haltIf:
This is the typical message to use for inserting breakpoints during
debugging. Param can be a block or expression, halt if true.
If the Block has one arg, the receiver is bound to that.
If the condition is a selector, we look up in the callchain. Halt if
any method's selector equals selector.
haltIfNil
haltOnCount:
haltOnce
Halt unless we have already done it once.
haltOnce:
Halt unless we have already done it once.
haltOnceEnabled
handles:
This method exists in case a non exception class is the first arg in an on:do: (for instance using a exception class that is not loaded). We prefer this to raising an error during error handling itself. Also, semantically it makes sense that the exception handler is not active if its exception class is not loaded
hasActionForEvent:
Answer true if there is an action associated with anEventSelector
hasActionsWithReceiver:
hasBinding
Answer whether or not the receiver has a dynamic binding
hasContentsInExplorer
hasHaltCount
hasLiteralSuchThat:
This is the end of the imbedded structure path so return false.
hasModelYellowButtonMenuItems
hasUnacceptedEdits
Answer true if any of the views on this object has unaccepted edits.
hash
Answer a SmallInteger whose value is related to the receiver's identity.
May be overridden, and should be overridden in any classes that define =
howToModifyPrimitives
iconOrThumbnailOfSize:
Answer an appropiate form to represent the receiver
identityHashPrintString
'fred' identityHashPrintString
ifNil:ifNotNilDo:
Evaluate aBlock with the receiver as its argument.
ifNotNilDo:
Evaluate the given block with the receiver as its argument.
ifNotNilDo:ifNil:
Evaluate aBlock with the receiver as its argument.
in:
Evaluate the given block with the receiver as its argument.
indexIfCompact
inform:
Display a message for the user to read and then dismiss. 6/9/96 sw
inheritsFromAnyIn:
Answer whether the receiver inherits from any class represented by any element in the list. The elements of the list can be classes, class name symbols, or strings representing possible class names. This allows speculative membership tests to be made even when some of the classes may not be known to the current image, and even when their names are not interned symbols.
initialExtent
Answer the desired extent for the receiver when a view on it is first opened on the screen.
5/22/96 sw: in the absence of any override, obtain from RealEstateAgent
initialInstance
initialize
Subclasses should redefine this method to perform initializations on instance creation
initializeDependentsFields
initializedInstance
inline:
For translation only; noop when running in Smalltalk.
inspect
Create and schedule an Inspector in which the user can examine the receiver's variables.
inspectOnCount:
inspectOnce
Inspect unless we have already done it once.
inspectUntilCount:
inspectWithLabel:
Create and schedule an Inspector in which the user can examine the receiver's variables.
inspectorClass
Answer the class of the inspector to be used on the receiver. Called by inspect;
use basicInspect to get a normal (less useful) type of inspector.
inspectorFields
instVarAt:
Primitive. Answer a fixed variable in an object. The numbering of the
variables corresponds to the named instance variables. Fail if the index
is not an Integer or is not the index of a fixed variable. Essential. See
Object documentation whatIsAPrimitive.
instVarAt:put:
Primitive. Store a value into a fixed variable in the receiver. The
numbering of the variables corresponds to the named instance variables.
Fail if the index is not an Integer or is not the index of a fixed variable.
Answer the value stored as the result. Using this message violates the
principle that each object has sovereign control over the storing of
values into its instance variables. Essential. See Object documentation
whatIsAPrimitive.
instVarNamed:
Return the value of the instance variable in me with that name. Slow and unclean, but very useful.
instVarNamed:put:
Store into the value of the instance variable in me of that name. Slow and unclean, but very useful.
instanceVariableValues
Answer a collection whose elements are the values of those instance variables of the receiver which were added by the receiver's class
isArray
isBehavior
Return true if the receiver is a behavior.
Note: Do not override in any class except behavior.
isBlock
isCharacter
isClosure
isCollection
Return true if the receiver is some sort of Collection and responds to basic collection messages such as #size and #do:
isColor
Answer true if receiver is a Color. False by default.
isColorForm
isComancheModule
isCompiledMethod
isComplex
Answer true if receiver is a Complex number. False by default.
isConflict
isContext
isDictionary
isFloat
Overridden to return true in Float, natch
isForm
isFraction
Answer true if the receiver is a Fraction.
isHeap
isInteger
Overridden to return true in Integer.
isInterval
isKindOf:
Answer whether the class, aClass, is a superclass or class of the receiver.
isKindOf:orOf:
Answer whether the class, aClass, is a superclass or class of the receiver.
isLiteral
Answer whether the receiver has a literal text form recognized by the
compiler.
isMemberOf:
Answer whether the receiver is an instance of the class, aClass.
isMessageSend
isMethodProperties
isMorph
isMorphicEvent
isMorphicModel
Return true if the receiver is a morphic model
isNumber
Overridden to return true in Number, natch
isPoint
Overridden to return true in Point.
isPseudoContext
isRectangle
isSelfEvaluating
isSketchMorph
isStream
Return true if the receiver responds to the stream protocol
isString
Overridden to return true in String, natch
isSymbol
isSystemWindow
answer whatever the receiver is a SystemWindow
isText
isThisEverCalled
isThisEverCalled:
Send this message, with some useful printable argument, from methods or branches of methods which you believe are never reached. 2/5/96 sw
isTrait
isVariableBinding
Return true if I represent a literal variable binding
isWebBrowser
whether this object is a web browser. See class: Scamper
javascriptOn:
join:
joinTo:
double dispatch for join:
knownName
If a formal name has been handed out for this object, answer it, else nil
labelForSelector:
lastMetacelloVersionLoad
launchPartVia:
Obtain a morph by sending aSelector to self, and attach it to the morphic hand. This provides a general protocol for parts bins
launchPartVia:label:
Obtain a morph by sending aSelector to self, and attach it to the morphic hand. This provides a general protocol for parts bins
literalEqual:
localeChanged
logEntry
logExecution
logExit
longPrintOn:
Append to the argument, aStream, the names and values of all
of the receiver's instance variables.
longPrintOn:limitedTo:indent:
Append to the argument, aStream, the names and values of all of the receiver's instance variables. Limit is the length limit for each inst var.
longPrintString
Answer a String whose characters are a description of the receiver.
longPrintStringLimitedTo:
Answer a String whose characters are a description of the receiver.
metacelloIntegerLessThanSelf:
metacelloStringLessThanSelf:
metacelloVersion:loads:
metacelloVersionComponentLessThan:
modelSleep
A window with me as model is being exited or collapsed or closed.
Default response is no-op
modelWakeUp
A window with me as model is being entered or expanded. Default response is no-op
modelWakeUpIn:
A window with me as model is being entered or expanded. Default response is no-op
mouseUpBalk:
A button I own got a mouseDown, but the user moved out before letting up. Certain kinds of objects (so-called 'radio buttons', for example, and other structures that must always have some selection, e.g. PaintBoxMorph) wish to take special action in this case; this default does nothing.
mustBeBoolean
Catches attempts to test truth of non-Booleans. This message is sent from the VM. The sending context is rewound to just before the jump causing this exception.
mustBeBooleanIn:
context is the where the non-boolean error occurred. Rewind context to before jump then raise error.
myDependents
Private. Answer a list of all the receiver's dependents.
myDependents:
Private. Set (or remove) the receiver's dependents list.
name
Answer a name for the receiver. This is used generically in the title of certain inspectors, such as the referred-to inspector, and specificially by various subsystems. By default, we let the object just print itself out..
nameForViewer
Answer a name to be shown in a Viewer that is viewing the receiver
needsWork
newFrom:
nominallyUnsent:
From within the body of a method which is not formally sent within the system, but which you intend to have remain in the system (for potential manual invocation, or for documentation, or perhaps because it's sent by commented-out-code that you anticipate uncommenting out someday, send this message, with the selector itself as the argument.
This will serve two purposes:
(1) The method will not be returned by searches for unsent selectors (because it, in a manner of speaking, sends itself).
(2) You can locate all such methods by browsing senders of #nominallyUnsent:
notNil
Coerces nil to false and everything else to true.
notYetImplemented
noteSelectionIndex:for:
backstop
notify:
Create and schedule a Notifier with the argument as the message in
order to request confirmation before a process can proceed.
notify:at:
Create and schedule a Notifier with the argument as the message in
order to request confirmation before a process can proceed. Subclasses can
override this and insert an error message at location within aString.
notifyWithLabel:
Create and schedule a Notifier with aString as the window label as well as the contents of the window, in order to request confirmation before a process can proceed.
objectForDataStream:
Return an object to store on an external data stream.
objectRepresented
most objects represent themselves; this provides a hook for aliases to grab on to
okToChange
Allows a controller to ask this of any model
okToClose
Sent to models when a window closing.
Allows this check to be independent of okToChange.
oopString
Answer a string that represents the oop of the receiver
openAsMorph
Open a morph, as best one can, on the receiver
perform:
Send the unary selector, aSymbol, to the receiver.
Fail if the number of arguments expected by the selector is not zero.
Primitive. Optional. See Object documentation whatIsAPrimitive.
perform:orSendTo:
If I wish to intercept and handle selector myself, do it; else send it to otherTarget
perform:with:
Send the selector, aSymbol, to the receiver with anObject as its argument.
Fail if the number of arguments expected by the selector is not one.
Primitive. Optional. See Object documentation whatIsAPrimitive.
perform:with:with:
Send the selector, aSymbol, to the receiver with the given arguments.
Fail if the number of arguments expected by the selector is not two.
Primitive. Optional. See Object documentation whatIsAPrimitive.
perform:with:with:with:
Send the selector, aSymbol, to the receiver with the given arguments.
Fail if the number of arguments expected by the selector is not three.
Primitive. Optional. See Object documentation whatIsAPrimitive.
perform:withArguments:
Send the selector, aSymbol, to the receiver with arguments in argArray.
Fail if the number of arguments expected by the selector
does not match the size of argArray.
Primitive. Optional. See Object documentation whatIsAPrimitive.
perform:withArguments:inSuperclass:
NOTE: This is just like perform:withArguments:, except that
the message lookup process begins, not with the receivers's class,
but with the supplied superclass instead. It will fail if lookupClass
cannot be found among the receiver's superclasses.
Primitive. Essential. See Object documentation whatIsAPrimitive.
perform:withEnoughArguments:
Send the selector, aSymbol, to the receiver with arguments in argArray.
Only use enough arguments for the arity of the selector; supply nils for missing ones.
postCopy
self is a shallow copy, subclasses should copy fields as necessary to complete the full copy
presenter
Answer the presenter object associated with the receiver. For morphs, there is in effect a clear containment hierarchy of presenters (accessed via their association with PasteUpMorphs); for arbitrary objects the hook is simply via the current world, at least at present.
primitiveChangeClassTo:
Primitive. Change the class of the receiver into the class of the argument given that the format of the receiver matches the format of the argument's class. Fail if receiver or argument are SmallIntegers, or the receiver is an instance of a compact class and the argument isn't, or when the argument's class is compact and the receiver isn't, or when the format of the receiver is different from the format of the argument's class, or when the arguments class is fixed and the receiver's size differs from the size that an instance of the argument's class should have.
Note: The primitive will fail in most cases that you think might work. This is mostly because of a) the difference between compact and non-compact classes, and b) because of differences in the format. As an example, '(Array new: 3) primitiveChangeClassTo: Morph basicNew' would fail for three of the reasons mentioned above. Array is compact, Morph is not (failure #1). Array is variable and Morph is fixed (different format - failure #2). Morph is a fixed-field-only object and the array is too short (failure #3).
The facility is really provided for certain, very specific applications (mostly related to classes changing shape) and not for casual use.
primitiveError:
This method is called when the error handling results in a recursion in
calling on error: or halt or halt:.
primitiveFail
primitiveFail may be invoked by certain methods whose code is translated in C. In such a case primitiveFail and not primitiveFailed
should be invoked. The reason is that this code is translated to C by VMMaker. #primitiveFail is
implemented in Interpreter of VMMaker.
primitiveFailed
Announce that a primitive has failed and there is no appropriate
Smalltalk code to run.
printDirectlyToDisplay
For debugging: write the receiver's printString directly to the display at (0, 100); senders of this are detected by the check-for-slips mechanism.
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
printOnStream:
printString
Answer a String whose characters are a description of the receiver.
If you want to print without a character limit, use fullPrintString.
printStringLimitedTo:
Answer a String whose characters are a description of the receiver.
If you want to print without a character limit, use fullPrintString.
printWithClosureAnalysisOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
purgeAllCommands
Purge all commands for this object
putOn:
reInitializeDependentsFields
readCarefullyFrom:
readDataFrom:size:
Fill in the fields of self based on the contents of aDataStream. Return self.
Read in the instance-variables written by Object>>storeDataOn:.
NOTE: This method must send beginReference: before reading any objects from aDataStream that might reference it.
Allow aDataStream to have fewer inst vars. See SmartRefStream.
readFrom:
readFromString:
Create an object based on the contents of aString.
redoFromCapturedState:
May be overridden in subclasses. See also capturedState
refersToLiteral:
Answer true if literal is identical to any literal in this array, even if imbedded in further structures. This is the end of the imbedded structure path so return false.
refineRedoTarget:selector:arguments:in:
Any object can override this method to refine its redo specification
refineUndoTarget:selector:arguments:in:
Any object can override this method to refine its undo specification
refusesToAcceptCode
Answer whether the receiver is a code-bearing instrument which at the moment refuses to allow its contents to be submitted
release
Remove references to objects that may refer to the receiver. This message
should be overridden by subclasses with any cycles, in which case the
subclass should also include the expression super release.
releaseActionMap
releaseExternalSettings
rememberCommand:
Remember the given command for undo
rememberUndoableAction:named:
removeAction:forEvent:
removeActionsForEvent:
removeActionsSatisfying:
removeActionsSatisfying:forEvent:
removeActionsWithReceiver:
removeActionsWithReceiver:forEvent:
removeBinding
Remove the dynamic binding associated with the receiver
removeDependent:
Remove the given object as one of the receiver's dependents.
removeHaltCount
renameInternal:
Change the internal name (because of a conflict) but leave the external name unchanged. Change Player class name, but do not change the names that appear in tiles. Any object that might be pointed to in the References dictionary might get this message sent to it upon reload
renameTo:
If the receiver has an inherent idea about its own name, it should take action here. Any object that might be pointed to in the References dictionary might get this message sent to it upon reload
renderOn:
Override this method to customize how objects (not components) are rendered when passed as an argument to #render:. The default is the return value of #displayString.
Just remember that you can not use #callback:, #on:of:, or #call:
reportableSize
Answer a string that reports the size of the receiver -- useful for showing in a list view, for example
requestor
returns the focused window's requestor
requirement
respondsTo:
Answer whether the method dictionary of the receiver's class contains
aSymbol as a message selector.
restoreFromSnapshot:
retryWithGC:until:
Retry execBlock as long as testBlock returns false. Do an incremental GC after the first try, a full GC after the second try.
rootStubInImageSegment:
saveOnFile
Ask the user for a filename and save myself on a SmartReferenceStream file. Writes out the version and class structure. The file is fileIn-able. Does not file out the class of the object. tk 6/26/97 13:48
services
setActionSequence:forEvent:
setHaltCountTo:
setHaltOnce
Turn on the halt once flag.
shallowCopy
Answer a copy of the receiver which shares the receiver's instance variables.
shouldBeImplemented
Announce that this message should be implemented
shouldNotImplement
Announce that, although the receiver inherits this message, it should
not implement it.
showDiffs
Answer whether the receiver, serving as the model of a text-bearing entity, is 'showing differences' -- if it is, the editor may wish to show special feedback
size
Primitive. Answer the number of indexable variables in the receiver.
This value is the same as the largest legal subscript. Essential. See Object
documentation whatIsAPrimitive.
snapshotCopy
someObject
Primitive. Answer the first object in the enumeration of all
objects.
species
Answer the preferred class for reconstructing the receiver. For example,
collections create new collections whenever enumeration messages such as
collect: or select: are invoked. The new kind of collection is determined by
the species of the original collection. Species and class are not always the
same. For example, the species of Interval is Array.
split:
stepAt:in:
stepIn:
stepTime
stepTimeIn:
storeAt:inTempFrame:
This message had to get sent to an expression already on the stack
as a Block argument being accessed by the debugger.
Just re-route it to the temp frame.
storeDataOn:
Store myself on a DataStream. Answer self. This is a low-level DataStream/ReferenceStream method. See also objectToStoreOnDataStream. NOTE: This method must send 'aDataStream beginInstance:size:' and then (nextPut:/nextPutWeak:) its subobjects. readDataFrom:size: reads back what we write here.
storeOn:
Append to the argument aStream a sequence of characters that is an
expression whose evaluation creates an object similar to the receiver.
storeOnStream:
storeString
Answer a String representation of the receiver from which the receiver
can be reconstructed.
stringForReadout
stringRepresentation
Answer a string that represents the receiver. For most objects this is simply its printString, but for strings themselves, it's themselves. 6/12/96 sw
subclassResponsibility
This message sets up a framework for the behavior of the class' subclasses.
Announce that the subclass should have implemented this message.
systemNavigation
taskbarIcon
Answer the icon for the receiver in a task bar
or nil for the default.
taskbarLabel
Answer the label string for the receiver in a task bar
or nil for the default.
toFinalizeSend:to:with:
When I am finalized (e.g., garbage collected) close the associated resource handle by sending aSelector to the appropriate finalizer (the guy who knows how to get rid of the resource).
WARNING: Neither the finalizer nor the resource handle are allowed to reference me. If they do, then I will NEVER be garbage collected. Since this cannot be validated here, it is up to the client to make sure this invariant is not broken.
toggleHaltOnce
traitConflict
triggerEvent:
Evaluate all actions registered for <anEventSelector>. Return the value of the last registered action.
triggerEvent:ifNotHandled:
Evaluate all actions registered for <anEventSelector>. Return the value of the last registered action.
triggerEvent:with:
triggerEvent:with:ifNotHandled:
triggerEvent:withArguments:
triggerEvent:withArguments:ifNotHandled:
undoFromCapturedState:
May be overridden in subclasses. See also capturedState
update:
Receive a change notice from an object of whom the receiver is a
dependent. The default behavior is to do nothing; a subclass might want
to change itself in some way.
update:with:
Receive a change notice from an object of whom the receiver is a
dependent. The default behavior is to call update:,
which by default does nothing; a subclass might want
to change itself in some way.
updateListsAndCodeIn:
updateableActionMap
validationError:
value
valueWithArguments:
var:declareC:
For translation only; noop when running in Smalltalk.
veryDeepCopy
Do a complete tree copy using a dictionary. An object in the tree twice is only copied once. All references to the object in the copy of the tree will point to the new copy.
veryDeepCopySibling
Do a complete tree copy using a dictionary. Substitute a clone of oldPlayer for the root. Normally, a Player or non systemDefined object would have a new class. We do not want one this time. An object in the tree twice, is only copied once. All references to the object in the copy of the tree will point to the new copy.
veryDeepCopyUsing:
Do a complete tree copy using a dictionary. An object in the tree twice is only copied once. All references to the object in the copy of the tree will point to the new copy.
Same as veryDeepCopy except copier (with dictionary) is supplied.
** do not delete this method, even if it has no callers **
veryDeepCopyWith:
Copy me and the entire tree of objects I point to. An object in the tree twice is copied once, and both references point to him. deepCopier holds a dictionary of objects we have seen. Some classes refuse to be copied. Some classes are picky about which fields get deep copied.
veryDeepFixupWith:
I have no fields and no superclass. Catch the super call.
veryDeepInner:
No special treatment for inst vars of my superclasses. Override when some need to be weakly copied. Object>>veryDeepCopyWith: will veryDeepCopy any inst var whose class does not actually define veryDeepInner:
wantsDiffFeedback
Answer whether the receiver, serving as the model of a text-bearing entity, would like for 'diffs' green pane-border feedback to be shown
wantsDroppedMorph:event:inMorph:
wantsSteps
Overridden by morphic classes whose instances want to be stepped,
or by model classes who want their morphic views to be stepped.
wantsStepsIn:
whatIsAPrimitive
when:evaluate:
when:send:to:
when:send:to:exclusive:
when:send:to:with:
when:send:to:with:exclusive:
when:send:to:withArguments:
when:send:to:withArguments:exclusive:
when:sendOnce:to:
when:sendOnce:to:with:
when:sendOnce:to:withArguments:
windowActiveOnFirstClick
Return true if my window should be active on first click.
windowColorSpecification
windowIsClosing
This message is used to inform a models that its window is closing. Most models do nothing, but some, such as the Debugger, must do some cleanup. Note that this mechanism must be used with care by models that support multiple views, since one view may be closed while others left open.
windowReqNewLabel:
My window's title has been edited.
Return true if this is OK, and override for further behavior.
withoutListWrapper
writeOnFilterStream:
xxxClass
For subclasses of nil, such as ObjectOut
yourself
Answer self.
~=
Answer whether the receiver and the argument do not represent the
same object.
ObjectTracer
An ObjectTracer can be wrapped around another object, and then give you a chance to inspect it whenever it receives messages from the outside. For instance...
(ObjectTracer on: Display) flash: (50@50 extent: 50@50)
will give control to a debugger just before the message flash is sent.
Obviously this facility can be embellished in many useful ways.
See also the even more perverse subclass, ObjectViewer, and its example.
doesNotUnderstand:
All external messages (those not caused by the re-send) get trapped here
on:
xxxUnTrace
xxxViewedObject
This message name must not clash with any other (natch).
xxxViewedObject:
This message name must not clash with any other (natch).
ObjectViewer
ObjectViewers offers the same kind of interception of messages (via doesnotUnderstand:) as ObjectTracers, but instead of just being wrappers, they actually replace the object being viewed. This makes them a lot more dangerous to use, but one can do amazing things. For instance, the example below actually intercepts the InputSensor object, and prints the mouse coordinates asynchronously, every time they change:
Sensor evaluate: [Sensor cursorPoint printString displayAt: 0@0]
wheneverChangeIn: [Sensor cursorPoint].
To exit from this example, execute:
Sensor xxxUnTrace
doesNotUnderstand:
Check for change after sending aMessage
on:evaluate:wheneverChangeIn:
xxxViewedObject:evaluate:wheneverChangeIn:
This message name must not clash with any other (natch).
ParagraphEditor
I am a Controller for editing a Paragraph. I am a kind of ScrollController, so that more text can be created for the Paragraph than can be viewed on the screen. Editing messages are sent by issuing commands from a yellow button menu or from keys on the keyboard. My instances keep control as long as the cursor is within the view when the red or yellow mouse button is pressed; they give up control if the blue button is pressed.
abandonChangeText
accept
Save the current text of the text being edited as the current acceptable version for purposes of canceling.
activateTextActions
adjustSelection:
Helper function for Cursor movement. Always moves point thus allowing selections to shrink.
afterSelectionInsertAndSelect:
again
Text substitution. If the left shift key is down, the substitution is made
throughout the entire Paragraph. Otherwise, only the next possible
substitution is made.
Undoer & Redoer: #undoAgain:andReselect:typedKey:.
againOnce:
Find the next occurrence of FindText. If none, answer false.
Append the start index of the occurrence to the stream indices, and, if
ChangeText is not the same object as FindText, replace the occurrence by it.
Note that the search is case-sensitive for replacements, otherwise not.
againOrSame:
Subroutine of search: and again. If useOldKeys, use same FindText and ChangeText as before.
1/26/96 sw: real worked moved to againOrSame:many:
againOrSame:many:
Subroutine of search: and again. If useOldKeys, use same FindText and ChangeText as before. If many is true, do it repeatedly. Created 1/26/96 sw by adding the many argument to #againOrSame.
align
Align text according to the next greater alignment value--cycling among
left flush, right flush, center, justified. No effect on the undoability of the pre
preceding command.
align:
Triggered by Cmd-u; cycle through alignment alternatives. 8/11/96 sw
argAdvance:
Invoked by Ctrl-a. Useful after Ctrl-q.
Search forward from the end of the selection for a colon followed by
a space. Place the caret after the space. If none are found, place the
caret at the end of the text. Does not affect the undoability of the
previous command.
backTo:
During typing, backspace to startIndex. Deleted characters fall into three
clusters, from left to right in the text: (1) preexisting characters that were
backed over; (2) newly typed characters that were backed over (excluding
typeahead, which never even appears); (3) preexisting characters that
were highlighted before typing began. If typing has not yet been opened,
open it and watch for the first and third cluster. If typing has been opened,
watch for the first and second cluster. Save characters from the first and third
cluster in UndoSelection. Tally characters from the first cluster in UndoMessage's parameter.
Delete all the clusters. Do not alter Undoer or UndoInterval (except via
openTypeIn). The code is shorter than the comment.
backWord:
If the selection is not a caret, delete it and leave it in the backspace buffer.
Else if there is typeahead, delete it.
Else, delete the word before the caret.
backspace:
Backspace over the last character.
blinkParenAt:
blinkPrevParen:
browseChangeSetsWithSelector
Determine which, if any, change sets have at least one change for the selected selector, independent of class
browseIt
Launch a browser for the class indicated by the
current selection.
If multiple classes matching the selection exist, let
the user choose among them.
browseIt:
Triggered by Cmd-B; browse the thing represented by the current selection, if plausible. 1/18/96 sw
browseItHere
Retarget the receiver's window to look at the selected class, if appropriate. 3/1/96 sw
browseItHere:
Triggered by Cmd-shift-B; browse the thing represented by the current selection, if plausible, in the receiver's own window. 3/1/96 sw
cancel
Restore the text of the paragraph to be the text saved since initialization
or the last accept. Undoer & Redoer: undoAndReselect:redoAndReselect:.
This used to call controlTerminate and controlInitialize but this seemed illogical.
Sure enough, nobody overrode them who had cancel in the menu, and if
anybody really cared they could override cancel.
cancel:
Cancel unsubmitted changes. Flushes typeahead. 1/12/96 sw
1/22/96 sw: put in control terminate/init
caret
changeAlignment
changeCaretDuring:
changeEmphasis
changeEmphasis:keyEvent:
Change the emphasis of the current selection or prepare to
accept characters with the change in emphasis. Emphasis
change amounts to a font change. Keeps typeahead.
changeEmphasisOrAlignment
changeLfToCr:
Replace all LFs by CRs.
Triggered by Cmd-U -- useful when getting code from FTP sites
changeParagraph:
Install aParagraph as the one to be edited by the receiver.
changeStyle
Let user change styles for the current text pane
Moved from experimentalCommand to its own method
changeStyle:
Put up the style-change menu
changeStyleTo:
chooseAlignment
chooseColor
Make a new Text Color Attribute, let the user pick a color, and return the attribute. This is the non-Morphic version.
classCommentsContainingIt
Open a browser class comments which contain the current selection somewhere in them.
classNamesContainingIt
Open a browser on classes whose names contain the selected string
clearParens
clipboardText
clipboardText:
clipboardTextPut:
closeTypeIn
See comment in openTypeIn. It is important to call closeTypeIn before executing
any non-typing key, making a new selection, etc. It is called automatically for
menu commands.
Typing commands can call 'closeTypeIn: aCharacterStream' instead of this to
save typeahead. Undoer & Redoer: undoAndReselect:redoAndReselect:.
closeTypeIn:
Call instead of closeTypeIn when you want typeahead to be inserted before the
control character is executed, e.g., from Ctrl-V.
comment
All key actions that are neither editing nor typing actions have to
send closeTypeIn at first. See comment in openTypeIn closeTypeIn
compareToClipboard
Check to see if whether the receiver's text is the same as the text currently on the clipboard, and inform the user.
compareToClipboard:
Compare the receiver to the text on the clipboard. Flushes typeahead. 5/1/96 sw
compileSelectionAsBlock
Treat the current selection as an expression; evaluate it and return the result
compileSelectionFor:in:
completeSymbol:lastOffering:
Invoked by Ctrl-q when there is only a caret.
Do selector-completion, i.e., try to replace the preceding identifier by a
selector that begins with those characters & has as many keywords as possible.
Leave two spaces after each colon (only one after the last) as space for
arguments. Put the caret after the space after the first keyword. If the
user types Ctrl-q again immediately, choose a different selector.
Undoer: #undoQuery:lastOffering:; Redoer: itself.
If redoing, just redisplay the last offering, selector[OrNil].
computeIntervalFrom:to:
Select the designated characters, inclusive. Make no visual changes.
controlInitialize
controlTerminate
copyHiddenInfo
In TextLinks, TextDoits, TextColor, and TextURLs, there is hidden
info. Copy that to the clipboard. You can paste it and see what it is.
Usually enclosed in <>.
copySelection
Copy the current selection and store it in the paste buffer, unless a caret. Undoer & Redoer: undoCutCopy
copySelection:
Copy the current text selection. Flushes typeahead.
correctFrom:to:with:
Make a correction in the model that the user has authorised from somewhere else in the system (such as from the compilier). The user's selection is not changed, only corrected.
crWithIndent:
Replace the current text selection with CR followed by as many tabs
as on the current line (+/- bracket count) -- initiated by Shift-Return.
cursorDown:
Private - Move cursor from position in current line to same position in
next line. If next line too short, put at end. If shift key down,
select.
cursorEnd:
Private - Move cursor end of current line.
cursorHome:
Private - Move cursor from position in current line to beginning of
current line. If control key is pressed put cursor at beginning of text
cursorLeft:
Private - Move cursor left one character if nothing selected, otherwise
move cursor to beginning of selection. If the shift key is down, start
selecting or extending current selection. Don't allow cursor past
beginning of text
cursorPageDown:
cursorPageUp:
cursorRight:
Private - Move cursor right one character if nothing selected,
otherwise move cursor to end of selection. If the shift key is down,
start selecting characters or extending already selected characters.
Don't allow cursor past end of text
cursorTopHome:
Put cursor at beginning of text -- invoked from cmd-H shortcut, useful for keyboards that have no home key.
cursorUp:
Private - Move cursor from position in current line to same position in
prior line. If prior line too short, put at end
cut
Cut out the current selection and redisplay the paragraph if necessary. Undoer & Redoer: undoCutCopy:
cut:
Cut out the current text selection. Flushes typeahead.
debug:receiver:in:
debugIt
debugIt:
Triggered by Cmd-D; browse the thing represented by the current selection, if plausible
deselect
If the text selection is visible on the screen, reverse its highlight.
disabledCommandActions
Answer the command actions available when disabled.
dispatchOnEnterWith:
Enter key hit. Treat is as an 'accept', viz a synonym for cmd-s. If cmd key is down, treat is as a synonym for print-it.
dispatchOnKeyEvent:with:
Carry out the action associated with this character, if any.
Type-ahead is passed so some routines can flush or use it.
display
Redisplay the paragraph.
displayIfFalse:
Replace the current text selection with the text 'ifFalse:'--initiated by
ctrl-f.
displayIfTrue:
Replace the current text selection with the text 'ifTrue:'--initiated by
ctrl-t.
doAgainMany:
Do the previous thing again repeatedly. 1/26/96 sw
doAgainOnce:
Do the previous thing again once. 1/26/96 sw
doIt
Set the context to include pool vars of the model. Then evaluate.
doIt:
Called when user hits cmd-d. Select the current line, if relevant, then evaluate and execute. 2/1/96 sw.
2/29/96 sw: don't call selectLine; it's done by doIt now
doneTyping
duplicate:
Paste the current selection over the prior selection, if it is non-overlapping and
legal. Flushes typeahead. Undoer & Redoer: undoAndReselect.
enclose:keyEvent:
Insert or remove bracket characters around the current selection.
Flushes typeahead.
encompassLine:
Return an interval that encompasses the entire line
escapeToDesktop:
Pop up a morph to field keyboard input in the context of the desktop
evaluateSelection
Treat the current selection as an expression; evaluate it and return the result
exchange
See comment in exchangeWith:
exchange:
Exchange the current and prior selections. Keeps typeahead.
exchangeWith:
If the prior selection is non-overlapping and legal, exchange the text of
it with the current selection and leave the currently selected text selected
in the location of the prior selection (or leave a caret after a non-caret if it was
exchanged with a caret). If both selections are carets, flash & do nothing.
Don't affect the paste buffer. Undoer: itself; Redoer: Undoer.
experimentalCommand
Use for experimental command-key implementation. Using this,
you can try things out without forever needing to reinitialize the
ParagraphEditor.
exploreIt
exploreIt:
Explore the selection -- invoked via cmd-shift-I. If there is no current selection, use the current line.
fileItIn
Make a Stream on the text selection and fileIn it.
1/24/96 sw: moved here from FileController; this function can be useful from any text window that shows stuff in chunk format
fileItIn:
File in the selection; invoked via a keyboard shortcut, -- for now, cmd-shift-G.
find
Prompt the user for a string to search for, and search the receiver from the current selection onward for it. 1/26/96 sw
find:
Prompt the user for what to find, then find it, searching from the current selection onward. 1/24/96 sw
findAgain
Find the text-to-find again. 1/24/96 sw
findAgain:
Find the desired text again. 1/24/96 sw
fit
Make the bounding rectangle of the paragraph contain all the text while
not changing the width of the view of the paragraph. No effect on undoability
of the preceding command.
flash
Causes the view of the paragraph to complement twice in succession.
forwardDelete:keyEvent:
Delete forward over the next character.
Make Undo work on the whole type-in, not just the one char.
wod 11/3/1998: If there was a selection use #zapSelectionWith: rather than #backspace: which was 'one off' in deleting the selection. Handling of things like undo or typeIn area were not fully considered.
handleDisabledKey:
Handle a key character when the text morph is disabled.
hasCaret
hasSelection
hiddenInfo
In TextLinks, TextDoits, TextColor, and TextURLs, there is hidden info. Return the entire string that was used by Cmd-6 to create this text attribute. Usually enclosed in < >.
implementorsOfIt
Open an implementors browser on the selected selector
implementorsOfIt:
Triggered by Cmd-m; browse implementors of the selector represented by the current selection, if plausible. 2/1/96 sw
inOutdent:delta:
Add/remove a tab at the front of every line occupied by the selection. Flushes typeahead. Derived from work by Larry Tesler back in December 1985. Now triggered by Cmd-L and Cmd-R. 2/29/96 sw
indent:
Add a tab at the front of every line occupied by the selection. Flushes typeahead. Invoked from keyboard via cmd-shift-R. 2/29/96 sw
indent:fromStream:toStream:
Append the contents of inStream to outStream, adding or deleting delta or -delta
tabs at the beginning, and after every CR except a final CR. Do not add tabs
to totally empty lines, and be sure nothing but tabs are removed from lines.
initialText
initialize
Subclasses should redefine this method to perform initializations on instance creation
initializeCmdKeyShortcuts
initializeSelection
Do the initial activity when starting up the receiver. For example, in the
ParagraphEditor highlight the current selection.
initializeShiftCmdKeyShortcuts
insertAndSelect:at:
insertTypeAhead:
inspectIt
1/13/96 sw: minor fixup
inspectIt:
Inspect the selection -- invoked via cmd-i. If there is no current selection, use the current line. 1/17/96 sw
2/29/96 sw: don't call selectLine; it's done by inspectIt now
isCaretBehindChar
isDisjointFrom:
Answer true if anInterval is a caret not touching or within the current
interval, or if anInterval is a non-caret that does not overlap the current
selection.
isDoing
Call from a doer/undoer/redoer any time to see which it is.
isRedoing
Call from a doer/undoer/redoer any time to see which it is.
isUndoing
Call from a doer/undoer/redoer any time to see which it is.
keystroke:
Key struck on the keyboard. Find out which one and, if special, carry
out the associated special action. Otherwise, add the character to the
stream of characters. Undoer & Redoer: see closeTypeIn.
lineSelectAndEmptyCheck:
If the current selection is an insertion point, expand it to be the entire current line; if after that's done the selection is still empty, then evaluate the returnBlock, which will typically consist of '[^ self]' in the caller -- check senders of this method to understand this.
lines
Other than my member paragraph i compute lines based on logical
line breaks, not optical (which may change due to line wrapping of the editor)
makeCapitalized:
Force the current selection to be capitalized. Triggered by Cmd-Z.
makeLowercase:
Force the current selection to lowercase. Triggered by Cmd-X.
makeUppercase:
Force the current selection to uppercase. Triggered by Cmd-Y.
mark
markBlock
markBlock:
markIndex
methodNamesContainingIt
Open a browser on methods names containing the selected string
methodNamesContainingIt:
Browse methods whose selectors containing the selection in their names
methodSourceContainingIt
Open a browser on methods which contain the current selection in their source (case-sensitive full-text search of source). Slow!
methodStringsContainingIt:
Invoked from cmd-E -- open a browser on all methods holding string constants containing it. Flushes typeahead.
methodStringsContainingit
Open a browser on methods which contain the current selection as part of a string constant.
model
Answer the receiver's model which is the same as the model of the
receiver's view.
model:
Controller|model: and Controller|view: are sent by View|controller: in
order to coordinate the links between the model, view, and controller. In
ordinary usage, the receiver is created and passed as the parameter to
View|controller: so that the receiver's model and view links can be set
up by the view.
moveCursor:forward:specialBlock:
Private - Move cursor.
directionBlock is a one argument Block that computes the new Position from a given one.
specialBlock is a one argumentBlock that computes the new position from a given one under the alternate semantics.
Note that directionBlock always is evaluated first.
multiRedoOverride
new
newParagraph:
nextTokenFrom:direction:
simple token-finder for compiler automated corrections
nextWord:
noUndoer
The Undoer to use when the command can not be undone. Checked for
specially by readKeyboard.
noop:
Unimplemented keyboard command; just ignore it.
normalCharacter:character:
A nonspecial character is to be added to the stream of characters.
notify:at:in:
The compilation of text failed. The syntax error is noted as the argument,
aString. Insert it in the text at starting character position anInteger.
nullText
objectsReferencingIt
Open a list inspector on all objects that reference the object that results when the current selection is evaluated.
offerFontMenu
Present a menu of available fonts, and if one is chosen, apply it to the current selection.
Use only names of Fonts of this paragraph
offerFontMenu:
The user typed the command key that requests a font change; Offer the font menu. 5/27/96 sw
Keeps typeahead. (?? should flush?)
offerMenuFromEsc:
openTypeIn
Set up UndoSelection to null text (to be added to by readKeyboard and backTo:),
beginTypeInBlock to keep track of the leftmost backspace, and UndoParameter to tally
how many deleted characters were backspaced over rather than 'cut'.
You can't undo typing until after closeTypeIn.
outdent:
Remove a tab from the front of every line occupied by the selection. Flushes typeahead. Invoked from keyboard via cmd-shift-L. 2/29/96 sw
pageHeight
paste
Paste the text from the shared buffer over the current selection and
redisplay if necessary. Undoer & Redoer: undoAndReselect.
paste:
Replace the current text selection by the text in the shared buffer.
Keeps typeahead.
pasteInitials:
Replace the current text selection by an authorship name/date stamp; invoked by cmd-shift-v, easy way to put an authorship stamp in the comments of an editor.
Keeps typeahead.
pasteRecent
Paste an item chose from RecentClippings.
pointBlock
pointBlock:
pointIndex
prettyPrint
Reformat the contents of the receiver's view (a Browser).
previousWord:
printIt
Treat the current text selection as an expression; evaluate it. Insert the
description of the result of evaluation after the selection and then make
this description the new text selection.
printIt:
Print the results of evaluting the selection -- invoked via cmd-p. If there is no current selection, use the current line. 1/17/96 sw
2/29/96 sw: don't call selectLine now, since it's called by doIt
printerSetup
querySymbol:
Invoked by Ctrl-q to query the Symbol table and display alternate symbols.
See comment in completeSymbol:lastOffering: for details.
raiseContextMenu:
AFAIK, this is never called in morphic, because a subclass overrides it. Which is good, because a ParagraphEditor doesn't know about Morphic and thus duplicates the text-editing actions that really belong in the specific application, not the controller. So the context menu this would raise is likely to be out of date.
recomputeInterval
The same characters are selected but their coordinates may have changed.
recomputeSelection
Redetermine the selection according to the start and stop block indices;
do not highlight.
referencesToIt
Open a references browser on the selected symbol
referencesToIt:
Triggered by Cmd-N; browse references to the current selection
replace:with:and:
Replace the text in oldInterval with newText and execute selectingBlock to establish the new selection. Create an undoAndReselect:redoAndReselect: undoer to allow perfect undoing.
replaceSelectionWith:
Remember the selection text in UndoSelection.
Deselect, and replace the selection text by aText.
Remember the resulting selectionInterval in UndoInterval and PriorInterval.
Set up undo to use UndoReplace.
resetState
Establish the initial conditions for editing the paragraph: place caret
before first character, set the emphasis to that of the first character,
and save the paragraph for purposes of canceling.
reverseSelection
Reverse the valence of the current selection highlighting.
sameColumn:newLine:forward:
Private - Compute the index in my text
with the line number derived from lineBlock,
save:
Submit the current text. Equivalent to 'accept' 1/18/96 sw
Keeps typeahead.
scrollBy:
Move the paragraph by heightToMove, and reset the text selection.
scrollToBottom
Scroll so that the tail end of the text is visible in the view. 5/6/96 sw
scrollToTop
Scroll so that the paragraph is at the top of the view.
scrollView:
Paragraph scrolling uses opposite polarity
search:
Invoked by Ctrl-S. Same as 'again', but always uses the existing FindText
and ChangeText regardless of the last edit.
select
If the text selection is visible on the screen, highlight it.
selectAll
Make the selection be all the characters of the receiver
selectAll:
select everything, invoked by cmd-a. 1/17/96 sw
selectAndScroll
Scroll until the selection is in the view and then highlight it.
selectAndScrollToTop
Scroll until the selection is in the view and then highlight it.
selectAt:
Deselect, then place the caret before the character at characterIndex.
Be sure it is in view.
selectCurrentTypeIn:
Select what would be replaced by an undo (e.g., the last typeIn).
selectFrom:to:
Deselect, then select the specified characters inclusive.
Be sure the selection is in view.
selectInterval:
Deselect, then select the specified characters inclusive.
Be sure the selection is in view.
selectInvisiblyFrom:to:
Select the designated characters, inclusive. Make no visual changes.
selectInvisiblyMark:point:
Select the designated characters, inclusive. Make no visual changes.
selectLine
Make the receiver's selection, if it currently consists of an insertion point only, encompass the current line.
selectMark:point:
Deselect, then select the specified characters inclusive.
Be sure the selection is in view.
selectPrecedingIdentifier
Invisibly select the identifier that ends at the end of the selection, if any.
selectWord
Select delimited text or word--the result of double-clicking.
selectWord:
selectedSelector
Try to make a selector out of the current text selection
selectedSymbol
Return the currently selected symbol, or nil if none. Spaces, tabs and returns are ignored
selection
Answer the text in the paragraph that is currently selected.
selectionAsStream
Answer a ReadStream on the text in the paragraph that is currently
selected.
selectionInterval
Answer the interval that is currently selected.
selectionPosition:
sendersOfIt
Open a senders browser on the selected selector
sendersOfIt:
Triggered by Cmd-n; browse implementors of the selector represented by the current selection, if plausible. 2/1/96 sw
setAlignment:
setEmphasis:
Change the emphasis of the current selection.
setEmphasisHere
setIndices:forward:
Little helper method that sets the moving and fixed indices according to some flags.
setMark:
setPoint:
setSearch:
Set the FindText and ChangeText to seek aString; except if already seeking aString, leave ChangeText alone so again will repeat last replacement.
setSearchString
Make the current selection, if any, be the current search string.
setSearchString:
Establish the current selection as the current search string.
shiftEnclose:keyEvent:
Insert or remove bracket characters around the current selection.
Flushes typeahead.
shiftedYellowButtonMenu
simulatedBackspace
Backspace over the last character, derived from hand-char recognition. 2/5/96 sw
simulatedKeystroke:
Accept char as if it were struck on the keyboard. This version does not yet deal with command keys, and achieves update in the receiver's typically inactive window via the sledge-hammer of uncache-bits.
specialShiftCmdKeys
startBlock
startBlock:
startIndex
startOfTyping
Compatibility during change from characterBlock to integer
stateArray
stateArrayPut:
stopBlock
stopBlock:
stopIndex
swapChars:
Triggered byCmd-Y;. Swap two characters, either those straddling the insertion point, or the two that comprise the selection. Suggested by Ted Kaehler.
tallyIt
tallySelection
Treat the current selection as an expression; evaluate and tally it.
tempCommand:
Experimental. Triggered by Cmd-t; put trial cmd-key commands here to see how they work, before hanging them on their own cmd accelerators.
terminateAndInitializeAround:
1/12/96 sw
text
Answer the text of the paragraph being edited.
totalTextHeight
undo
Reset the state of the paragraph prior to the previous edit.
If another ParagraphEditor instance did that edit, UndoInterval is invalid;
just recover the contents of the undo-buffer at the start of the paragraph.
undo:
Undo the last edit. Keeps typeahead, so undo twice is a full redo.
undoAgain:andReselect:typedKey:
The last command was again. Undo it. Redoer: itself.
undoAndReselect:redoAndReselect:
Undo typing, cancel, paste, and other operations that are like replaces
but the selection is not the whole restored text after undo, redo, or both.
undoHighlight is selected after this phase and redoHighlight after the next phase.
Redoer: itself.
undoCutCopy:
Undo of a cut, copy, or any edit that changed CurrentSelection. Be sure
undo-copy does not lock the model. Redoer: itself, so never isRedoing.
undoMessage:forRedo:
Call this from an undoer/redoer to set up UndoMessage as the
corresponding redoer/undoer. Also set up UndoParagraph, as well
as the state variable Undone. It is assumed that UndoInterval has been
established (generally by zapSelectionWith:) and that UndoSelection has been
saved (generally by replaceSelectionWith: or replace:With:and:).
undoQuery:lastOffering:
Undo ctrl-q. selectorOrNil (if not nil) is the previously offered selector.
hintText is the original hint. Redoer: completeSymbol.
undoReplace
Undo of any command that replaced a selection by other text that it left
highlighted, and that is undone and redone by simple reversal of the
operation. This is the most common Undoer; call replaceSelectionWith:
to get this setup. Redoer: itself, so never isRedoing.
undoer:
See comment in undoMessage:. Use this version when aSelector has no arguments, and you are doing or redoing and want to prepare for undoing.
undoer:with:
See comment in undoMessage:. Use this version when aSelector has one argument, and you are doing or redoing and want to prepare for undoing.
undoer:with:with:
See comment in undoMessage:. Use this version when aSelector has two arguments, and you are doing or redoing and want to prepare for undoing.
undoer:with:with:with:
See comment in undoMessage:. Use this version when aSelector has three arguments, and you are doing or redoing and want to prepare for undoing.
unselect
updateMarker
A variation of computeMarkerRegion--only redisplay the marker in the scrollbar if an actual change has occurred in the positioning of the paragraph.
userHasEdited
Note that the user has edited my text. Here it is just a noop so that the Character Recognizer won't fail when used with a vanilla ParagrahEditor.
visibleHeight
watchIt
wordAtCaret
yellowButtonExpertMenu
yellowButtonMenu
yellowButtonNoviceMenu
zapSelectionWith:
Deselect, and replace the selection text by aText.
Remember the resulting selectionInterval in UndoInterval and otherInterval.
Do not set up for undo.
Pragma
I represent an occurrence of a pragma in a compiled method. A pragma is a literal message pattern that occurs between angle brackets at the start of a method after any temporaries. A common example is the primitive pragma:
<primitive: 123 errorCode: 'errorCode'>
but one can add one's own and use them as metadata attached to a method. Because pragmas are messages one can browsse senders and implementors and perform them. One can query a method for its pragmas by sendng it the pragmas message, which answers an Array of instances of me, one for each pragma in the method.
I can provide information about the defining class, method, its selector, as well as the information about the pragma keyword and its arguments. See the two 'accessing' protocols for details. 'accessing-method' provides information about the method the pragma is found in, while 'accessing-pragma' is about the pragma itself.
Instances are retrieved using one of the pragma search methods of the 'finding' protocol on the class side.
To browse all methods with pragmas in the system evaluate
SystemNavigation default browseAllSelect: [:m| m pragmas notEmpty]
and to browse all nonprimitive methods with pragmas evaluate
SystemNavigation default browseAllSelect: [:m| m primitive isZero and: [m pragmas notEmpty]]
allNamed:from:to:
allNamed:from:to:sortedByArgument:
allNamed:from:to:sortedUsing:
allNamed:in:
allNamed:in:sortedByArgument:
allNamed:in:sortedUsing:
analogousCodeTo:
argumentAt:
Answer one of the arguments of the pragma.
arguments
Answer the arguments of the receiving pragma. For a pragma defined as <key1: val1 key2: val2> this will answer #(val1 val2).
for:selector:arguments:
hasLiteral:
hasLiteralSuchThat:
Answer true if litBlock returns true for any literal in the receiver, even if embedded in further array structure.
This method is only intended for private use by CompiledMethod hasLiteralSuchThat:
key
Answer the keyword of the pragma (the selector of its message pattern).
This accessor provides polymorphism with Associations used for properties.
keyword
Answer the keyword of the pragma (the selector of its message pattern).
For a pragma defined as <key1: val1 key2: val2> this will answer #key1:key2:.
keyword:arguments:
message
Answer the message of the receiving pragma.
method
Answer the compiled-method containing the pragma.
methodClass
Answer the class of the method containing the pragma.
numArgs
Answer the number of arguments in the pragma.
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
selector
Answer the selector of the method containing the pragma.
Do not confuse this with the selector of the pragma's message pattern.
sendTo:
Send the pragma keyword together with its arguments to anObject and answer the result.
setArguments:
setKeyword:
setMethod:
withArgumentsDo:
Pass the arguments of the receiving pragma into aBlock and answer the result.
withPragmasIn:do:
Process
I represent an independent path of control in the system. This path of control may be stopped (by sending the message suspend) in such a way that it can later be restarted (by sending the message resume). When any one of several paths of control can be advanced, the single instance of ProcessorScheduler named Processor determines which one will actually be advanced partly using the value of priority.
(If anyone ever makes a subclass of Process, be sure to use allSubInstances in anyProcessesAbove:.)
activateReturn:value:
Activate 'aContext return: value', so execution will return to aContext's sender
browserPrintString
browserPrintStringWith:
calleeOf:
Return the context whose sender is aContext. Return nil if aContext is on top. Raise error if aContext is not in process chain.
complete:
Run self until aContext is popped or an unhandled error is raised. Return self's new top context, unless an unhandled error was raised then return the signaler context (rather than open a debugger).
completeStep:
Resume self until aContext is on top, or if already on top, complete next step
completeTo:
Resume self until aContext is on top
copyStack
debug
debug:title:
Open debugger on self with context shown on top
debug:title:full:
Open debugger on self with context shown on top
debugWithTitle:
Open debugger on self
environmentAt:
environmentAt:ifAbsent:
environmentAt:put:
environmentKeyNotFound
environmentRemoveKey:
environmentRemoveKey:ifAbsent:
errorHandler
errorHandler:
forContext:priority:
install:
Replace the suspendedContext with aContext.
isActiveProcess
isSuspended
isTerminated
longPrintOn:
Append to the argument, aStream, the names and values of all
of the receiver's instance variables.
name
Answer a name for the receiver. This is used generically in the title of certain inspectors, such as the referred-to inspector, and specificially by various subsystems. By default, we let the object just print itself out..
name:
objectForDataStream:
I am not allowed to be written on an object file.
offList
OBSOLETE. Process>>suspend will atomically reset myList if the process is suspended.
There should never be a need to send #offList but some older users may not be aware
of the changed semantics to suspend and may try the old hickadidoo seen here:
(suspendingList := process suspendingList) == nil
ifTrue: [process == Processor activeProcess ifTrue: [process suspend]]
ifFalse: [suspendingList remove: process ifAbsent:[].
process offList].
Usages like the above should be replaced by a simple 'process suspend'
okToTerminate
popTo:
Pop self down to aContext by remote returning from aContext's callee. Unwind blocks will be executed on the way.
This is done by pushing a new context on top which executes 'aContext callee return' then resuming self until aContext is reached. This way any errors raised in an unwind block will get handled by senders in self and not by senders in the activeProcess.
If an unwind block raises an error that is not handled then the popping stops at the error and the signalling context is returned, othewise aContext is returned.
popTo:value:
Replace the suspendedContext with aContext, releasing all contexts
between the currently suspendedContext and it.
primitiveResume
Primitive. Allow the process that the receiver represents to continue. Put
the receiver in line to become the activeProcess. Fail if the receiver is
already waiting in a queue (in a Semaphore or ProcessScheduler).
Essential. See Object documentation whatIsAPrimitive.
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
priority
Answer the priority of the receiver.
priority:
Set the receiver's priority to anInteger.
pvtSignal:list:
Private. This method is used to signal an exception from another
process...the receiver must be the active process. If the receiver
was previously waiting on a Semaphore, then return the process
to the waiting state after signaling the exception and if the Semaphore
has not been signaled in the interim
restartTop
Rollback top context and replace with new method. Assumes self is suspended
restartTopWith:
Rollback top context and replace with new method. Assumes self is suspended
resume
Allow the process that the receiver represents to continue. Put
the receiver in line to become the activeProcess. Check for a nil
suspendedContext, which indicates a previously terminated Process that
would cause a vm crash if the resume attempt were permitted
return:value:
Pop thread down to aContext's sender. Execute any unwind blocks on the way. See #popTo: comment and #runUntilErrorOrReturnFrom: for more details.
run
Suspend current process and execute self instead
signalException:
Signal an exception in the receiver process...if the receiver is currently
suspended, the exception will get signaled when the receiver is resumed. If
the receiver is blocked on a Semaphore, it will be immediately re-awakened
and the exception will be signaled; if the exception is resumed, then the receiver
will return to a blocked state unless the blocking Semaphore has excess signals
step
step:
Resume self until aContext is on top, or if already on top, do next step
stepToCallee
Step until top context changes
stepToHome:
Resume self until the home of top context is aContext. Top context may be a block context.
stepToSendOrReturn
suspend
Primitive. Stop the process that the receiver represents in such a way
that it can be restarted at a later time (by sending the receiver the
message resume). If the receiver represents the activeProcess, suspend it.
Otherwise remove the receiver from the list of waiting processes.
The return value of this method is the list the receiver was previously on (if any).
suspendedContext
Answer the context the receiver has suspended.
suspendedContext:
suspendingList
Answer the list on which the receiver has been suspended.
termMethod
terminate
Stop the process that the receiver represents forever. Unwind to execute pending ensure:/ifCurtailed: blocks before terminating.
terminationOkDuring:
ProcessLocalVariable
My subclasses have values specific to the active process. They can be read with #value and set with #value:
value:
ProcessSpecificVariable
My subclasses (not instances of them) keep state specific to the current process.
There are two kinds of process-specific variables: process-local (state available
for read and write in all methods inside the process), and dynamic variables
(implementing dynamic scope).
default
hash
Answer a SmallInteger whose value is related to the receiver's identity.
May be overridden, and should be overridden in any classes that define =
initialize
Subclasses should redefine this method to perform initializations on instance creation
value
ProcessorScheduler
My single instance, named Processor, coordinates the use of the physical processor by all Processes requiring service.
activePriority
Answer the priority level of the currently running Process.
activeProcess
Answer the currently running Process.
anyProcessesAbove:
Do any instances of Process exist with higher priorities?
backgroundProcess
Answer the background process
highIOPriority
Answer the priority at which the most time critical input/output
processes should run. An example is the process handling input from a
network.
highestPriority
Answer the number of priority levels currently available for use.
highestPriority:
Change the number of priority levels currently available for use.
idleProcess
initialize
Subclasses should redefine this method to perform initializations on instance creation
isSelfEvaluating
lowIOPriority
Answer the priority at which most input/output processes should run.
Examples are the process handling input from the user (keyboard,
pointing device, etc.) and the process distributing input from a network.
lowestPriority
Return the lowest priority that is allowed with the scheduler
new
nextReadyProcess
objectForDataStream:
I am about to be written on an object file. Write a path to me in the other system instead.
preemptedProcess
Return the process that the currently active process just preempted.
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
relinquishProcessorForMicroseconds:
remove:ifAbsent:
Remove aProcess from the list on which it is waiting for the processor
and answer aProcess. If it is not waiting, evaluate aBlock.
startUp
suspendFirstAt:
Suspend the first Process that is waiting to run with priority aPriority.
suspendFirstAt:ifNone:
Suspend the first Process that is waiting to run with priority aPriority. If
no Process is waiting, evaluate the argument, noneBlock.
sweepHandIdleProcess
systemBackgroundPriority
Answer the priority at which system background processes should run.
Examples are an incremental garbage collector or status checker.
tallyCPUUsageFor:
Start a high-priority process that will tally the next ready process for the given
number of seconds. Answer a Block that will return the tally (a Bag) after the task
is complete
tallyCPUUsageFor:every:
Start a high-priority process that will tally the next ready process for the given
number of seconds. Answer a Block that will return the tally (a Bag) after the task
is complete
terminateActive
Terminate the process that is currently running.
timingPriority
Answer the priority at which the system processes keeping track of real
time should run.
userBackgroundPriority
Answer the priority at which user background processes should run.
userInterruptPriority
Answer the priority at which user processes desiring immediate service
should run. Processes run at this level will preempt the window
scheduler and should, therefore, not consume the processor forever.
userSchedulingPriority
Answer the priority at which the window scheduler should run.
waitingProcessesAt:
Return the list of processes at the given priority level.
yield
Give other Processes at the current priority a chance to run.
ProtoObject
ProtoObject establishes minimal behavior required of any object in Squeak, even objects that should balk at normal object behavior. Generally these are proxy objects designed to read themselves in from the disk, or to perform some wrapper behavior, before responding to a message. Current examples are ObjectOut and ImageSegmentRootStub, and one could argue that ObjectTracer should also inherit from this class.
ProtoObject has no instance variables, nor should any be added.
==
Primitive. Answer whether the receiver and the argument are the same
object (have the same object pointer). Do not redefine the message == in
any other class! Essential. No Lookup. Do not override in any subclass.
See Object documentation whatIsAPrimitive.
asNINode
become:
Primitive. Swap the object pointers of the receiver and the argument.
All variables in the entire system that used to point to the
receiver now point to the argument, and vice-versa.
Fails if either object is a SmallInteger
cannotInterpret:
Handle the fact that there was an attempt to send the given message to the receiver but a null methodDictionary was encountered while looking up the message selector. Hopefully this is the result of encountering a stub for a swapped out class which induces this exception on purpose.
chasePointers
Open a PointerFinder on self
classStylePrintString
doOnlyOnce:
If the 'one-shot' mechanism is armed, evaluate aBlock once and disarm the one-shot mechanism. To rearm the mechanism, evaluate 'self rearmOneShot' manually.
doesNotUnderstand:
executeMethod:
Execute compiledMethod against the receiver with no args
flag:
Send this message, with a relevant symbol as argument, to flag a message for subsequent retrieval. For example, you might put the following line in a number of messages:
self flag: #returnHereUrgently
Then, to retrieve all such messages, browse all senders of #returnHereUrgently.
identityHash
Answer a SmallInteger whose value is related to the receiver's identity.
This method must not be overridden, except by SmallInteger.
Primitive. Fails if the receiver is a SmallInteger. Essential.
See Object documentation whatIsAPrimitive.
Do not override.
ifNil:
Return self, or evaluate the block if I'm == nil (q.v.)
ifNil:ifNotNil:
Evaluate the block, unless I'm == nil (q.v.)
ifNotNil:
Evaluate the block, unless I'm == nil (q.v.)
ifNotNil:ifNil:
If I got here, I am not nil, so evaluate the block ifNotNilBlock
initialize
Subclasses should redefine this method to perform initializations on instance creation
initializedInstance
isInMemory
All normal objects are.
isNil
Coerces nil to true and everything else to false.
nextInstance
Primitive. Answer the next instance after the receiver in the
enumeration of all instances of this class. Fails if all instances have been
enumerated. Essential. See Object documentation whatIsAPrimitive.
nextObject
Primitive. Answer the next object after the receiver in the
enumeration of all objects. Return 0 when all objects have been
enumerated.
niActions
niChildrenBlockForFixedFields
niChildrenBlockForMethods
niConfiguration
niDescription
niIcon
niIconName
niLabel
pointsTo:
This method returns true if self contains a pointer to anObject,
and returns false otherwise
printStringWithIndex:
privGetInstVar:
The compiler generates this message when accessing to instance variables of objects other than the receiver. Do not override or change this unless you also modify the compiler and recompile everything
privRemoteReturnTo:
Generated from compiler to return to the home of a block. self is the value return and contextTag is the tag of the home context. Do not override or change this unless you also modify the compiler and recompile everything
privSetInHolder:
The compiler generates this message to place values in global variables. Do not override or change this unless you also modify the compiler and recompile everything
privSetInstVar:put:
privStoreIn:instVar:
The compiler generates this message when assigning to instance variables of objects that have been captured by a block closure. Do not override or change this unless you also modify the compiler and recompile everything
rearmOneShot
Call this manually to arm the one-shot mechanism; use the mechanism in code by calling
self doOnlyOnce: <a block>
rehash
Do nothing. Here so sending this to a Set does not have to do a time consuming respondsTo:
tryNamedPrimitive
This method is a template that the Smalltalk simulator uses to
execute primitives. See Object documentation whatIsAPrimitive.
tryNamedPrimitive:
This method is a template that the Smalltalk simulator uses to
execute primitives. See Object documentation whatIsAPrimitive.
tryNamedPrimitive:with:
This method is a template that the Smalltalk simulator uses to
execute primitives. See Object documentation whatIsAPrimitive.
tryNamedPrimitive:with:with:
This method is a template that the Smalltalk simulator uses to
execute primitives. See Object documentation whatIsAPrimitive.
tryNamedPrimitive:with:with:with:
This method is a template that the Smalltalk simulator uses to
execute primitives. See Object documentation whatIsAPrimitive.
tryNamedPrimitive:with:with:with:with:
This method is a template that the Smalltalk simulator uses to
execute primitives. See Object documentation whatIsAPrimitive.
tryNamedPrimitive:with:with:with:with:with:
This method is a template that the Smalltalk simulator uses to
execute primitives. See Object documentation whatIsAPrimitive.
tryNamedPrimitive:with:with:with:with:with:with:
This method is a template that the Smalltalk simulator uses to
execute primitives. See Object documentation whatIsAPrimitive.
tryNamedPrimitive:with:with:with:with:with:with:with:
This method is a template that the Smalltalk simulator uses to
execute primitives. See Object documentation whatIsAPrimitive.
tryPrimitive:withArgs:
This method is a template that the Smalltalk simulator uses to
execute primitives. See Object documentation whatIsAPrimitive.
with:executeMethod:
Execute compiledMethod against the receiver and arg1
with:with:executeMethod:
Execute compiledMethod against the receiver and arg1 & arg2
with:with:with:executeMethod:
Execute compiledMethod against the receiver and arg1, arg2, & arg3
with:with:with:with:executeMethod:
Execute compiledMethod against the receiver and arg1, arg2, arg3, & arg4
withArgs:executeMethod:
Execute compiledMethod against the receiver and args in argArray
~~
Answer whether the receiver and the argument are not the same object
(do not have the same object pointer).
PseudoContext
I represent cached context state within the virtual machine. I have the same format as normal method and block contexts, but my fields are never referenced directly from Smalltalk. Whenever a message is sent to me I will magically transform myself into a real context which will respond to all the usual messages.
I rely on the fact that block and method contexts have exactly the same number of fixed fields.
contextCacheDepth
contextCacheDepth:
definition
isPseudoContext
nextObject
See Object>>nextObject.
Random
This Random Number Generator graciously contributed by David N. Smith. It is an adaptation of the Park-Miller RNG which uses Floats to avoid the need for LargeInteger arithmetic.
If you just want a quick random integer, use:
10 atRandom
Every integer interval can give a random number:
(6 to: 12) atRandom
SequenceableCollections can give randomly selected elements:
'pick one of these letters randomly' atRandom
SequenceableCollections also respond to shuffled, as in:
($A to: $Z) shuffled
The correct way to use class Random is to store one in an instance or class variable:
myGenerator _ Random new.
Then use it every time you need another number between 0.0 and 1.0 (excluding)
myGenerator next
You can also generate a positive integer
myGenerator nextInt: 10
bucketTest:
initialize
Set a reasonable Park-Miller starting seed
next
Answer a random Float in the interval [0 to 1).
next:
next:into:
nextInt:
Answer a random integer in the interval [1, anInteger].
Handle large numbers too (for cryptography).
nextValue
This method generates random instances of Integer in the interval
0 to 16r7FFFFFFF. This method does NOT update the seed; repeated sends
answer the same value.
The algorithm is described in detail in 'Random Number Generators:
Good Ones Are Hard to Find' by Stephen K. Park and Keith W. Miller
(Comm. Asso. Comp. Mach., 31(10):1192--1201, 1988).
seed
seed:
theItsCompletelyBrokenTest
RelativeInstructionPrinter
A RelativeInstructionPrinter is xxxxxxxxx.
Instance Variables
labelling: <Object>
labels: <Object>
printCode: <Object>
labelling
- xxxxx
labels
- xxxxx
printCode
- xxxxx
jump:
Print the Unconditional Jump bytecode.
jump:if:
Print the Conditional Jump bytecode.
print:
Append to the receiver a description of the bytecode, instruction.
printCode
printCode:
printInstructionsOn:
Append to the stream, aStream, a description of each bytecode in the instruction stream.
printInstructionsOn:do:
Append to the stream, aStream, a description of each bytecode in the instruction stream.
Evaluate aBlock with the receiver, the scanner and the stream after each instruction.
send:super:numArgs:
Print the Send Message With Selector, selector, bytecode. The argument,
supered, indicates whether the receiver of the message is specified with
'super' in the source method. The arguments of the message are found in
the top numArguments locations on the stack and the receiver just
below them.
ScaledDecimal
ScaledDecimal implement a special kind of Fraction that prints in decimal notation.
It uses a limited number of digits (scale) after the decimal separation dot and round the result.
Note that a ScaledDecimal does not printOn: exactly, however it will storeOn: exactly because the full precision fraction is kept in memory.
This is mostly usefull with denominators being powers of 10.
*
Answer the result of multiplying the receiver by aNumber.
+
Answer the sum of the receiver and aNumber.
-
Answer the difference between the receiver and aNumber.
/
Answer the result of dividing the receiver by aNumber.
<
Answer whether the receiver is less than the argument.
=
Compare the receiver with the argument and answer with true if the
receiver is equal to the argument. Otherwise answer false.
adaptToFraction:andSend:
If I am involved in arithmetic with a Fraction, convert it to a ScaledDecimal.
adaptToInteger:andSend:
If I am involved in arithmetic with an Integer, convert it to a ScaledDecimal.
asFraction
Convert the receiver to a Fraction.
Avoid using numerator / denominator to save a useless and costly gcd: computation
coerce:
Note: this quick hack could be replaced by double dispatching
isFraction
Though kind of Fraction, pretend we are not a Fraction to let coercion works correctly
isLiteral
Answer if this number could be a well behaved literal.
Well, it would only if evaluating back to self.
This is not the case of all ScaledDecimals.
Some have an infinite precision and would need an infinite number of digits to print literally.
Try for example (3.00s2 reciprocal).
literalEqual:
Testing equality is not enough.
It is also necessary to test number of decimal places (scale).
Otherwise we cannot compile both literals 0.5s1 and 0.50s2 in the same method
negated
Refer to the comment in Number|negated.
newFromNumber:scale:
printOn:
Append an approximated representation of the receiver on aStream.
Use prescribed number of digits after decimal point (the scale) using a rounding operation if not exact
printOn:base:
This method should print a representation of the number for the given base,
excluding the base prefix (and the letter r for radix)
raisedTo:
Answer the receiver raised to aNumber.
raisedToInteger:
See Number | raisedToInteger:
readFrom:
reciprocal
Returns the reciprocal of self.
In case self is 0 the / signals ZeroDivide
scale
setNumerator:denominator:scale:
squared
See Fraction (Number) | squared
storeOn:
ScaledDecimal sometimes have more digits than they print (potentially an infinity).
In this case, do not use printOn: because it would loose some extra digits.
Schedule
I represent a powerful class for implementing recurring schedules.
between:and:do:
from Cuis 99
dateAndTimes
everyDayAtSameTimes
Answer false if unknown
includes:
schedule
schedule:
scheduleDo:
scheduleDuration
Semaphore
I provide synchronized communication of a single bit of information (a "signal") between Processes. A signal is sent by sending the message signal and received by sending the message wait. If no signal has been sent when a wait message is sent, the sending Process will be suspended until a signal is sent.
=
Answer true if the receiver is equivalent to the otherCollection.
First test for identity, then rule out different species and sizes of
collections. As a last resort, examine each element of the receiver
and the otherCollection.
critical:
Evaluate mutuallyExcludedBlock only if the receiver is not currently in
the process of running the critical: message. If the receiver is, evaluate
mutuallyExcludedBlock after the other critical: message is finished.
critical:ifCurtailed:
Evaluate mutuallyExcludedBlock only if the receiver is not currently in
the process of running the critical: message. If the receiver is, evaluate
mutuallyExcludedBlock after the other critical: message is finished.
critical:ifError:
Evaluate mutuallyExcludedBlock only if the receiver is not currently in
the process of running the critical: message. If the receiver is, evaluate
mutuallyExcludedBlock after the other critical: message is finished.
critical:ifLocked:
Evaluate mutuallyExcludedBlock only if the receiver is not currently in
the process of running the critical: message. If the receiver is, evaluate
mutuallyExcludedBlock after the other critical: message is finished.
forMutualExclusion
hash
Answer an integer hash value for the receiver such that,
-- the hash value of an unchanged object is constant over time, and
-- two equal objects have equal hash values
initSignals
Consume any excess signals the receiver may have accumulated.
isSignaled
Return true if this semaphore is currently signaled
new
resumeProcess:
Remove the given process from the list of waiting processes (if it's there) and resume it. This is used when a process asked for its wait to be timed out.
signal
Primitive. Send a signal through the receiver. If one or more processes
have been suspended trying to receive a signal, allow the first one to
proceed. If no process is waiting, remember the excess signal. Essential.
See Object documentation whatIsAPrimitive.
terminateProcess
Terminate the process waiting on this semaphore, if any.
wait
Primitive. The active Process must receive a signal through the receiver
before proceeding. If no signal has been sent, the active Process will be
suspended until one is sent. Essential. See Object documentation
whatIsAPrimitive.
waitTimeoutMSecs:
Wait on this semaphore for up to the given number of milliseconds, then timeout.
Return true if the deadline expired, false otherwise.
waitTimeoutSeconds:
Wait on this semaphore for up to the given number of seconds, then timeout.
Return true if the deadline expired, false otherwise.
SmallInteger
My instances are 31-bit numbers, stored in twos complement form. The allowable range is approximately +- 1 billion (see SmallInteger minVal, maxVal).
*
Primitive. Multiply the receiver by the argument and answer with the
result if it is a SmallInteger. Fail if the argument or the result is not a
SmallInteger. Essential. No Lookup. See Object documentation whatIsAPrimitive.
+
Primitive. Add the receiver to the argument and answer with the result
if it is a SmallInteger. Fail if the argument or the result is not a
SmallInteger Essential No Lookup. See Object documentation whatIsAPrimitive.
-
Primitive. Subtract the argument from the receiver and answer with the
result if it is a SmallInteger. Fail if the argument or the result is not a
SmallInteger. Essential. No Lookup. See Object documentation
whatIsAPrimitive.
/
Primitive. This primitive (for /) divides the receiver by the argument
and returns the result if the division is exact. Fail if the result is not a
whole integer. Fail if the argument is 0 or is not a SmallInteger. Optional.
No Lookup. See Object documentation whatIsAPrimitive.
//
Primitive. Divide the receiver by the argument and answer with the
result. Round the result down towards negative infinity to make it a
whole integer. Fail if the argument is 0 or is not a SmallInteger.
Essential. No Lookup. See Object documentation whatIsAPrimitive.
<
Primitive. Compare the receiver with the argument and answer with
true if the receiver is less than the argument. Otherwise answer false.
Fail if the argument is not a SmallInteger. Essential. No Lookup. See
Object documentation whatIsAPrimitive.
<=
Primitive. Compare the receiver with the argument and answer true if
the receiver is less than or equal to the argument. Otherwise answer
false. Fail if the argument is not a SmallInteger. Optional. No Lookup.
See Object documentation whatIsAPrimitive.
=
Primitive. Compare the receiver with the argument and answer true if
the receiver is equal to the argument. Otherwise answer false. Fail if the
argument is not a SmallInteger. Essential. No Lookup. See Object
documentation whatIsAPrimitive.
>
Primitive. Compare the receiver with the argument and answer true if
the receiver is greater than the argument. Otherwise answer false. Fail if
the argument is not a SmallInteger. Essential. No Lookup. See Object
documentation whatIsAPrimitive.
>=
Primitive. Compare the receiver with the argument and answer true if
the receiver is greater than or equal to the argument. Otherwise answer
false. Fail if the argument is not a SmallInteger. Optional. No Lookup.
See Object documentation whatIsAPrimitive.
\\
Primitive. Take the receiver modulo the argument. The result is the
remainder rounded towards negative infinity, of the receiver divided by
the argument Fail if the argument is 0 or is not a SmallInteger. Optional.
No Lookup. See Object documentation whatIsAPrimitive.
as31BitSmallInt
Polymorphic with LargePositiveInteger (see comment there).
Return self since all SmallIntegers are 31 bits
asFloat
Primitive. Answer a Float that represents the value of the receiver.
Essential. See Object documentation whatIsAPrimitive.
asOop
Answer an object pointer as an integer, return negative number for SmallInteger
basicNew
bitAnd:
Primitive. Answer an Integer whose bits are the logical OR of the
receiver's bits and those of the argument, arg.
Numbers are interpreted as having 2's-complement representation.
Essential. See Object documentation whatIsAPrimitive.
bitOr:
Primitive. Answer an Integer whose bits are the logical OR of the
receiver's bits and those of the argument, arg.
Numbers are interpreted as having 2's-complement representation.
Essential. See Object documentation whatIsAPrimitive.
bitShift:
Primitive. Answer an Integer whose value is the receiver's value shifted
left by the number of bits indicated by the argument. Negative arguments
shift right. The receiver is interpreted as having 2's-complement representation.
Essential. See Object documentation whatIsAPrimitive.
bitXor:
Primitive. Answer an Integer whose bits are the logical XOR of the
receiver's bits and those of the argument, arg.
Numbers are interpreted as having 2's-complement representation.
Essential. See Object documentation whatIsAPrimitive.
ccgCanConvertFrom:
clone
decimalDigitLength
Answer the number of digits printed out in base 10.
Note that this only works for positive SmallIntegers.
deepCopy
Answer a copy of the receiver with its own copy of each instance
variable.
destinationBuffer:
digitAt:
Answer the value of an indexable field in the receiver. LargePositiveInteger uses bytes of base two number, and each is a 'digit' base 256. Fail if the argument (the index) is not an Integer or is out of bounds.
digitAt:put:
Fails. The digits of a small integer can not be modified.
digitLength
Answer the number of indexable fields in the receiver. This value is the
same as the largest legal subscript. Included so that a SmallInteger can
behave like a LargePositiveInteger or LargeNegativeInteger.
even
Refer to the comment in Number|even.
fromString:radix:
gcd:
See SmallInteger (Integer) | gcd:
guideToDivision
hash
Hash is reimplemented because = is implemented.
hashMultiply
highBit
Answer the index of the high order bit of the receiver, or zero if the
receiver is zero. Raise an error if the receiver is negative, since
negative integers are defined to have an infinite number of leading 1's
in 2's-complement arithmetic. Use >>highBitOfMagnitude if you want to
get the highest bit of the magnitude.
highBitOfMagnitude
Answer the index of the high order bit of the receiver, or zero if the
receiver is zero. This method is used for negative SmallIntegers as well,
since Squeak's LargeIntegers are sign/magnitude.
highBitOfPositiveReceiver
Answer the index of the high order bit of the receiver, or zero if the
receiver is zero. Receiver has to be positive!
identityHash
Answer a SmallInteger whose value is related to the receiver's identity.
This method must not be overridden, except by SmallInteger.
Primitive. Fails if the receiver is a SmallInteger. Essential.
See Object documentation whatIsAPrimitive.
Do not override.
instVarAt:
Small integer has to be specially handled.
isLarge
lowBit
Answer the index of the low order one bit.
2r00101000 lowBit (Answers: 4)
2r-00101000 lowBit (Answers: 4)
First we skip bits in groups of 4, then single bits.
While not optimal, this is a good tradeoff; long
integer #lowBit always invokes us with bytes.
maxVal
minVal
new
nextInstance
SmallIntegers can't be enumerated this way. There are a finite number of them from from (SmallInteger minVal) to (SmallInteger maxVal), but you'll have to enumerate them yourself with:
(SmallInteger minVal) to: (SmallInteger maxVal) do: [:integer | <your code here>].
nextObject
SmallIntegers are immediate objects, and, as such, do not have successors in object memory.
numberOfDigitsInBase:
Return how many digits are necessary to print this number in base b.
Mostly same as super but an optimized version for base 10 case
odd
Answer whether the receiver is an odd number.
printOn:base:
Append a representation of this number in base b on aStream.
printOn:base:nDigits:
Append a representation of this number in base b on aStream using nDigits.
self must be positive.
printString
Highly optimized version for base 10
and that we know it is a SmallInteger.
printStringBase:
Return a String representation of this number in base b.
For SmallIntegers, it is more efficient to print directly in a String,
rather than using a Stream like super.
printStringBase:nDigits:
Return a string representation of this number in base b with n digits (left padded with 0).
Should be invoked with: 0 <= self < (b raisedToInteger: n).
quo:
Primitive. Divide the receiver by the argument and answer with the
result. Round the result down towards zero to make it a whole integer.
Fail if the argument is 0 or is not a SmallInteger. Optional. See Object
documentation whatIsAPrimitive.
shallowCopy
Answer a copy of the receiver which shares the receiver's instance variables.
threeDigitName
veryDeepCopyWith:
Return self. I can't be copied. Do not record me.
~=
Primitive. Compare the receiver with the argument and answer true if
the receiver is not equal to the argument. Otherwise answer false. Fail if
the argument is not a SmallInteger. Essential. No Lookup. See Object
documentation whatIsAPrimitive.
SqNumberParser
This is a class specialized in parsing and building numbers.
Number syntax should follow Smalltalk syntax.
If you have to read foreign number syntax, create a subclass.
expected:
exponentLetters
answer the list of possible exponents for Numbers.
Note: this parser will not honour precision attached to the exponent.
different exponent do not lead to different precisions.
only IEEE 754 floating point numbers will be created
fail
failBlock:
makeFloatFromMantissa:exponent:base:
Convert infinite precision arithmetic into Floating point.
This alogrithm rely on correct IEEE rounding mode
being implemented in Integer>>asFloat and Fraction>>asFloat
makeIntegerOrScaledInteger
at this point, there is no digit, nor fractionPart.
maybe it can be a scaled decimal with fraction omitted...
makeScaledDecimalWithNumberOfNonZeroFractionDigits:andNumberOfTrailingZeroInFractionPart:
at this point integerPart fractionPart and scale have been read out (in inst var).
Form a ScaledDecimal.
Care of eliminating trailing zeroes from the fractionPart
nextElementaryLargeIntegerBase:
Form an unsigned integer with incoming digits from sourceStream.
Return this integer, or zero if no digits found.
Stop reading if end of digits or if a LargeInteger is formed.
Count the number of digits and the position of lastNonZero digit and store them in instVar
nextIntegerBase:
Form an integer with following digits.
Fail if no digit found
nextIntegerBase:ifFail:
Form an integer with following digits
nextLargeIntegerBase:nPackets:
Form a Large integer with incoming digits from sourceStream.
Return this integer, or zero if no digits found.
Stop reading when no more digits or when nPackets elementary LargeInteger have been encountered.
Count the number of digits and the lastNonZero digit and store them in instVar
nextNumber
main method for reading a number.
This one can read Float Integer and ScaledDecimal
nextNumberBase:
Method for reading a number without radix prefix.
This one can read Float Integer and ScaledDecimal
nextScaledDecimal
Main method for reading a (scaled) decimal number.
Good Gracious, do not accept a decimal in another base than 10!
In other words, do not accept radix notation like 2r1.1, even not 10r5.3
Do not accept exponent notation neither, like 1.0e-3
nextUnsignedIntegerBase:
Form an unsigned integer with incoming digits from sourceStream.
Fail if no digit found.
Count the number of digits and the lastNonZero digit and store int in instVar
nextUnsignedIntegerBase:ifFail:
Form an unsigned integer with incoming digits from sourceStream.
Answer this integer, or execute errorBlock if no digit found.
Count the number of digits and the position of lastNonZero digit and store them in instVar
nextUnsignedIntegerOrNilBase:
Form an unsigned integer with incoming digits from sourceStream.
Answer this integer, or nil if no digit found.
Count the number of digits and the position of lastNonZero digit and store them in instVar
on:
parse:
parse:onError:
readExponent
read the exponent if any (stored in instVar).
Answer true if found, answer false if none.
If exponent letter is not followed by a digit,
this is not considered as an error.
Exponent are always read in base 10.
readNamedFloatOrFail
This method is used when there is no digit encountered:
It try and read a named Float NaN or Infinity.
Negative sign for -Infinity has been read before sending this method, and is indicated in the neg inst.var.
Fail if no named Float is found
readNumberWithFractionPartNumberOfTrailingZeroInIntegerPart:
at this stage, sign integerPart and a decimal point have been read.
try and form a number with a fractionPart
readScale
read the scale if any (stored in instVar).
Answer true if found, answer false if none.
If scale letter is not followed by a digit, this is not considered as an error.
Scales are always read in base 10, though i do not see why...
requestor:
Stopwatch
A Stopwatch maintains a collection of timespans.
activate
duration
end
isActive
isSuspended
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
reActivate
reset
start
state
state:
suspend
timespans
Time
This represents a particular point in time during any given day. For example, '5:19:45 pm'.
If you need a point in time on a particular day, use DateAndTime. If you need a duration of time, use Duration.
<
Answer whether the receiver is less than the argument.
=
Compare the receiver with the argument and answer with true if the
receiver is equal to the argument. Otherwise answer false.
addSeconds:
Answer a Time that is nSeconds after the receiver.
addTime:
Answer a Time that is timeInterval after the receiver. timeInterval is an
instance of Date or Time.
asDate
asDateAndTime
asDuration
Answer the duration since midnight
asMonth
asNanoSeconds
Answer the number of nanoseconds since midnight
asSeconds
Answer the number of seconds since midnight of the receiver.
asTime
asTimeStamp
asWeek
asYear
benchmarkMillisecondClock
benchmarkPrimitiveResponseDelay
condenseBunches:
current
dateAndTimeFromSeconds:
dateAndTimeNow
deadlineSecs:
duration
fromSeconds:
fromString:
hash
Hash must be redefined whenever = is redefined.
hhmm24
Return a string of the form 1123 (for 11:23 am), 2154 (for 9:54 pm), of exactly 4 digits
hour
hour12
Answer an <integer> between 1 and 12, inclusive, representing the hour
of the day in the 12-hour clock of the local time of the receiver.
hour24
hour:minute:second:
hour:minute:second:nanoSecond:
hours
humanWordsForSecondsAgo:
intervalString
Treat the time as a difference. Give it in hours and minutes with two digits of accuracy.
meridianAbbreviation
midnight
millisecondClockValue
milliseconds:since:
millisecondsSince:
millisecondsToRun:
minute
minutes
namesForTimes:
nanoSecond
new
noon
now
primMillisecondClock
primSecondsClock
print24
Return as 8-digit string 'hh:mm:ss', with leading zeros if needed
print24:on:
Format is 'hh:mm:ss' or 'h:mm:ss am'
print24:showSeconds:on:
Format is 'hh:mm:ss' or 'h:mm:ss am' or, if showSeconds is false, 'hh:mm' or 'h:mm am'
printMinutes
Return as string 'hh:mm pm'
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
readFrom:
second
seconds
seconds:
Private - only used by Time class.
seconds:nanoSeconds:
Private - only used by Time class.
storeOn:
Append to the argument aStream a sequence of characters that is an
expression whose evaluation creates an object similar to the receiver.
subtractTime:
Answer a Time that is timeInterval before the receiver. timeInterval is
an instance of Date or Time.
ticks
Answer an Array: { seconds. nanoSeconds }
ticks:
ticks is an Array: { days. seconds. nanoSeconds }
to:
Answer a Timespan. anEnd must respond to #asDateAndTime
totalSeconds
TimeStamp
This represents a duration of 0 length that marks a particular point in time.
asTimeStamp
Answer the receiver as an instance of TimeStamp.
current
date
Answer the date of the receiver.
dateAndTime
Answer a two element Array containing the receiver's date and time.
fromMethodTimeStamp:
fromString:
minusDays:
Answer a TimeStamp which is anInteger days before the receiver.
minusSeconds:
Answer a TimeStamp which is anInteger number of seconds before the receiver.
now
plusDays:
Answer a TimeStamp which is anInteger days after the receiver.
plusSeconds:
Answer a TimeStamp which is anInteger number of seconds after the receiver.
printCLFFormatOn:
printCLFFormatOn:timezoneOffset:
printHttpFormat
printHttpFormatOn:
Print receiver's date and time on aStream in HTTP format;
'<day>, DD <mth> YYYY HH:MM:SS GMT' -> 'Thu, 01 Dec 1994 16:00:00 GMT'
printOn:
Print receiver's date and time on aStream.
readFrom:
storeOn:
Append to the argument aStream a sequence of characters that is an
expression whose evaluation creates an object similar to the receiver.
time
Answer the time of the receiver.
TimeZone
TimeZone is a simple class to colect the information identifying a UTC time zone.

offset - Duration - the time zone's offset from UTC
abbreviation - String - the abbreviated name for the time zone.
name - String - the name of the time zone.

TimeZone class >> #timeZones returns an array of the known time zones
TimeZone class >> #default returns the default time zone (Grenwich Mean Time)
abbreviation
abbreviation:
default
name
Answer a name for the receiver. This is used generically in the title of certain inspectors, such as the referred-to inspector, and specificially by various subsystems. By default, we let the object just print itself out..
name:
offset
offset:
offset:name:abbreviation:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
timeZones
Timespan
I represent a duration starting on a specific DateAndTime.
+
operand conforms to protocol Duration
-
operand conforms to protocol DateAndTime or protocol Duration
<
Answer whether the receiver is less than the argument.
=
Compare the receiver with the argument and answer with true if the
receiver is equal to the argument. Otherwise answer false.
asDate
asDateAndTime
asDuration
asMonth
asTime
asTimeStamp
asWeek
asYear
current
dates
datesDo:
day
Answer the day of the year represented by the receiver.
dayOfMonth
Answer the day of the month represented by the receiver.
dayOfWeek
Answer the day of the week represented by the receiver.
dayOfWeekName
Answer the day of the week represented by the receiver.
dayOfYear
Answer the day of the year represented by the receiver.
daysInMonth
daysInYear
Answer the number of days in the month represented by the receiver.
daysLeftInYear
do:with:
do:with:when:
duration
Answer the Duration of this timespan
duration:
Set the Duration of this timespan
end
every:do:
firstDayOfMonth
hash
Hash must be redefined whenever = is redefined.
includes:
includesAllOf:
Answer whether all the elements of aCollection are in the receiver.
includesAnyOf:
Answer whether any element of aCollection is included in the receiver
intersection:
Return the Timespan both have in common, or nil
isLeapYear
javascriptOn:
julianDayNumber
month
monthAbbreviation
monthIndex
monthName
months
monthsDo:
new
next
previous
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
start
Answer the start DateAndTime of this timespan
start:
Store the start DateAndTime of this timespan
starting:
starting:duration:
starting:ending:
to:
Answer an Timespan. anEnd must be aDateAndTime or a Timespan
union:
Return the Timespan spanned by both
weeks
weeksDo:
workDatesDo:
Exclude Saturday and Sunday
year
years
yearsDo:
True
True defines the behavior of its single instance, true -- logical assertion. Notice how the truth-value checks become direct message sends, without the need for explicit testing.
Be aware however that most of these methods are not sent as real messages in normal use. Most are inline coded by the compiler as test and jump bytecodes - avoiding the overhead of the full message sends. So simply redefining these methods here will have no effect.
&
Evaluating conjunction -- answer aBoolean since receiver is true.
and:
Nonevaluating conjunction -- answer the value of alternativeBlock since
the receiver is true.
asBit
ifFalse:
Since the condition is true, the value is the true alternative, which is nil.
Execution does not actually reach here because the expression is compiled
in-line.
ifFalse:ifTrue:
Answer the value of trueAlternativeBlock. Execution does not
actually reach here because the expression is compiled in-line.
ifTrue:
Answer the value of alternativeBlock. Execution does not actually
reach here because the expression is compiled in-line.
ifTrue:ifFalse:
Answer with the value of trueAlternativeBlock. Execution does not
actually reach here because the expression is compiled in-line.
initializedInstance
not
Negation--answer false since the receiver is true.
or:
Nonevaluating disjunction -- answer true since the receiver is true.
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
xor:
Posted by Eliot Miranda to squeak-dev on 3/24/2009
|
Evaluating disjunction (OR) -- answer true since the receiver is true.
UndefinedObject
I describe the behavior of my sole instance, nil. nil represents a prior value for variables that have not been initialized, or for results which are meaningless.
addDependent:
Refer to the comment in Object|dependents.
addSubclass:
Ignored -- necessary to support disjoint class hierarchies
allSuperclassesDo:
asHttpResponseTo:
asMetacelloVersionNumber
canHandleSignal:
When no more handler (on:do:) context left in sender chain this gets called
clone
Only one instance of UndefinedObject should ever be made, so answer
with self.
deepCopy
Only one instance of UndefinedObject should ever be made, so answer
with self.
encodeOn:
environment
Necessary to support disjoint class hierarchies.
haltIfNil
handleSignal:
When no more handler (on:do:) context left in sender chain this gets called. Return from signal with default action.
ifNil:
A convenient test, in conjunction with Object ifNil:
ifNil:ifNotNil:
Evaluate the block for nil because I'm == nil
ifNil:ifNotNilDo:
Evaluate the block for nil because I'm == nil
ifNotNil:
A convenient test, in conjunction with Object ifNotNil:
ifNotNil:ifNil:
If I got here, I am nil, so evaluate the block nilBlock
ifNotNilDo:
Override to do nothing.
ifNotNilDo:ifNil:
If I got here, I am nil, so evaluate the block nilBlock
initializedInstance
isClassBrowser
isEmptyOrNil
Answer whether the receiver contains any elements, or is nil. Useful in numerous situations where one wishes the same reaction to an empty collection or to nil
isLiteral
Answer whether the receiver has a literal text form recognized by the
compiler.
isNil
Refer to the comment in Object|isNil.
javascriptOn:
literalScannedAs:notifying:
new
notNil
Refer to the comment in Object|notNil.
parserClass
printOn:
Refer to the comment in Object|printOn:.
release
Nil release is a no-op
removeObsoleteSubclass:
Ignored -- necessary to support disjoint class hierarchies
removeSubclass:
Ignored -- necessary to support disjoint class hierarchies
renderOn:
Override this method to customize how objects (not components) are rendered when passed as an argument to #render:. The default is the return value of #displayString.
Just remember that you can not use #callback:, #on:of:, or #call:
setAuthorInMetacelloVersion:
setBlessingInMetacelloVersion:
setDescriptionInMetacelloVersion:
setProject:withInMetacelloConfig:
setTimestampInMetacelloVersion:
shallowCopy
Only one instance of UndefinedObject should ever be made, so answer
with self.
storeOn:
Refer to the comment in Object|storeOn:.
subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
Calling this method is now considered an accident. If you really want to create a class with a nil superclass, then create the class and then set the superclass using #superclass:
subclassDefinerClass
For disjunct class hierarchies -- how should subclasses of nil be evaluated
subclasses
Return all the subclasses of nil
subclassesDo:
Evaluate aBlock with all subclasses of nil.
subclassesDoGently:
Evaluate aBlock with all subclasses of nil. Others are not direct subclasses of Class.
suspend
Kills off processes that didn't terminate properly
typeOfClass
Necessary to support disjoint class hierarchies.
veryDeepCopyWith:
Return self. I can't be copied. Do not record me.
UserInterruptHandler
An UserInterruptHandler watches incoming input events and checks for the user interrupt key.
If encountered it interrupts the current process and opens a notifier..
Instance Variables
interruptKey: <Object>
interruptKey
- definition of the user interrupt key
handleEvent:
Store the event in the queue if there's any
handleUserInterrupt
[Project interruptName: 'User Interrupt' preemptedProcess: Project uiProcess] fork
new
setInterruptKeyValue:
WeakActionSequence
A WeakActionSequence is xxxxxxxxx.
Instance Variables
asActionSequence
asActionSequenceTrappingErrors
asMinimalRepresentation
printOn:
Append a sequence of characters that identify the receiver to aStream.
value
Answer the result of evaluating the elements of the receiver.
Actually, return just the last result.
valueWithArguments:
Return the last result
WeakMessageSend
Instances of WeakMessageSend encapsulate message sends to objects, like MessageSend. Unlike MessageSend it is not necessarily a valid mesage. A request to value only results in a send if infact it is valid.
See MessageSendComments also. WeakMessageSend is used primarily for event regristration.
Unlike MessageSend WeakMessageSend stoes receiver (object receiving the message send) as a the first and only element of its array as opposed to a named ivar.
But like MessageSend, it does have
selector Symbol -- message selector
arguments Array -- bound arguments
and it also has
shouldBeNil Boolean -- used to ensure array of arguments is not all nils
=
Compare equal to equivalent MessageSend
arguments
arguments:
asMessageSend
asMinimalRepresentation
collectArguments:
Private
ensureArguments
Return true if my arguments haven't gone away
ensureReceiver
Return true if my receiver hasn't gone away
ensureReceiverAndArguments
Return true if my receiver hasn't gone away
hash
work like MessageSend>>hash
isAnyArgumentGarbage
Make sure that my arguments haven't gone away
isMessageSend
isReceiverGarbage
Make sure that my receiver hasn't gone away
isReceiverOrAnyArgumentGarbage
Make sure that my receiver hasn't gone away
isValid
new
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
receiver
receiver:
receiver:selector:
receiver:selector:argument:
receiver:selector:arguments:
selector
selector:
value
valueWithArguments:
valueWithEnoughArguments:
call the selector with enough arguments from arguments and anArray
Week
I represent a week.
asWeek
dayNames
index
indexOfDay:
nameOfDay:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
startDay
startDay:
starting:duration:
Year
I represent a year.
asYear
current
daysInMonth
daysInYear
Answer the number of days in the month represented by the receiver.
daysInYear:
isLeapYear:
leapYear:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
starting:duration:
year: