MC logo

GNU Smalltalk Class Reference


GNU Smalltalk Documentation

Class Heirarchy

Object
    Behavior
        ClassDescription
            Class
            Metaclass
    BlockClosure
    Boolean
        False
        True
    Browser
    CFunctionDescriptor
    CObject
        CAggregate
            CArray
            CPtr
        CScalar
            CChar
            CDouble
            CFloat
            CInt
            CLong
            CShort
            CSmalltalk
            CString
            CUChar
                CByte
                    CBoolean
            CUInt
            CULong
            CUShort
        CStruct
    Collection
        Bag
        MappedCollection
        SequenceableCollection
            ArrayedCollection
                Array
                ByteArray
                CompiledMethod
                Interval
                String
                    Symbol
            LinkedList
                Semaphore
            OrderedCollection
                RunArray
                SortedCollection
        Set
            Dictionary
                IdentityDictionary
                SystemDictionary
            IdentitySet
    ContextPart
        BlockContext
        MethodContext
    CType
        CArrayCType
        CPtrCType
        CScalarCType
    Delay
    DLD
    DumperProxy
    ExceptionHandler
    File
        Directory
    FileSegment
    Link
        Process
        SymLink
    Magnitude
        Association
        Character
        Date
        Number
            Float
            Fraction
            Integer
                LargeInteger
                    LargeNegativeInteger
                    LargePositiveInteger
                        LargeZeroInteger
        Time
    Memory
        ByteMemory
        WordMemory
    Message
        DirectedMessage
    MethodInfo
    NullProxy
    PackageLoader
    Point
    ProcessorScheduler
    Rectangle
    SharedQueue
    Signal
    Stream
        ObjectDumper
        PositionableStream
            ReadStream
            WriteStream
                ReadWriteStream
                    ByteStream
                        FileStream
        Random
        TokenStream
        TranscriptInterface
    TrappableEvent
        Exception
        ExceptionCollection
    UndefinedObject
    ValueAdaptor
        NullValueHolder
        PluggableAdaptor
            DelayedAdaptor
        ValueHolder


[Up: Class Index]

Array

Category: Collections-Sequenceable
My instances are objects that have array-like properties: they are directly indexable by integers starting at 1, and they are fixed in size. I inherit object creation behavior messages such as #with:, as well as iteration and general access behavior from SequenceableCollection.


[ Next: | Up:Array ]

Array: built ins

at: anIndex
Answer the index-th indexed instance variable of the receiver.


at: anIndex put: value
Store value in the index-th indexed instance variable of the receiver


basicAt: anIndex
Answer the index-th indexed instance variable of the receiver. This method must not be overridden, override at: instead


basicAt: anIndex put: value
Store value in the index-th indexed instance variable of the receiver This method must not be overridden, override at:put: instead


[ Next: | Previous:Array-built ins | Up:Array ]

Array: mutating objects

multiBecome: anArray
Transform every object in the receiver in each corresponding object in anArray. anArray and the receiver must have the same size


[ Next: | Previous:Array-mutating objects | Up:Array ]

Array: printing

printOn: aStream
Print a representation for the receiver on aStream


[ Previous:Array-printing | Up:Array ]

Array: testing

isArray
Answer `false'.


[Up: Class Index]

ArrayedCollection

Category: Collections-Sequenceable
My instances are objects that are generally fixed size, and are accessed by an integer index. The ordering of my instance's elements is determined externally; I will not rearrange the order of the elements.


[ Next: | Up:ArrayedCollection ]

ArrayedCollection class: instance creation

new
Answer an empty collection


new: size withAll: anObject
Answer a collection with the given size, whose elements are all set to anObject


with: element1
Answer a collection whose only element is element1


with: element1 with: element2
Answer a collection whose only elements are the parameters in the order they were passed


with: element1 with: element2 with: element3
Answer a collection whose only elements are the parameters in the order they were passed


with: element1 with: element2 with: element3 with: element4
Answer a collection whose only elements are the parameters in the order they were passed


withAll: aCollection
Answer a collection whose elements are the same as those in aCollection


[ Next: | Previous:ArrayedCollection class-instance creation | Up:ArrayedCollection ]

ArrayedCollection: basic

, aSequenceableCollection
Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by all the elements in aSequenceableCollection


add: value
This method should not be called for instances of this class.


copyWithout: oldElement
Answer a copy of the receiver to which all occurrences of oldElement are removed


[ Next: | Previous:ArrayedCollection-basic | Up:ArrayedCollection ]

ArrayedCollection: built ins

size
Answer the size of the receiver


[ Next: | Previous:ArrayedCollection-built ins | Up:ArrayedCollection ]

ArrayedCollection: copying Collections

copyWith: newElement
Answer a new instance of an ArrayedCollection containing all the receiver's elements and, at the end, newElement


reverse
Answer the receivers' contents in reverse order


[ Next: | Previous:ArrayedCollection-copying Collections | Up:ArrayedCollection ]

ArrayedCollection: enumerating the elements of a collection

collect: aBlock
Answer a new instance of an ArrayedCollection containing all the results of evaluating aBlock passing each of the receiver's elements


reject: aBlock
Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer false


select: aBlock
Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer true


[ Previous:ArrayedCollection-enumerating the elements of a collection | Up:ArrayedCollection ]

ArrayedCollection: storing

storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


[Up: Class Index]

Association

Category: Language-Data types
My instances represent a mapping between two objects. Typically, my "key" object is a symbol, but I don't require this. My "value" object has no conventions associated with it; it can be any object at all.


[ Next: | Up:Association ]

Association class: basic

key: aKey value: aValue
Answer a new association with the given key and value


[ Next: | Previous:Association class-basic | Up:Association ]

Association: accessing

key
Answer the association's key


key: aKey value: aValue
Set the association's key to aKey, and its value to aValue


value
Answer the association's value


value: aValue
Set the association's value to aValue


[ Next: | Previous:Association-accessing | Up:Association ]

Association: printing

printOn: aStream
Put on aStream a representation of the receiver


[ Next: | Previous:Association-printing | Up:Association ]

Association: storing

storeOn: aStream
Put on aStream some Smalltalk code compiling to the receiver


[ Previous:Association-storing | Up:Association ]

Association: testing

< anAssociation
Answer whether the association's key is less than anAssociation's


= anAssociation
Answer whether the association's key and value are the same as anAssociation's, or false if anAssociation is not an Association


hash
Answer an hash value for the receiver


[Up: Class Index]

Bag

Category: Collections-Unordered
My instances are unordered collections of objects. You can think of me as a set with a memory; that is, if the same object is added to me twice, then I will report that that element has been stored twice.


[ Next: | Up:Bag ]

Bag class: basic

new
Answer a new instance of the receiver


[ Next: | Previous:Bag class-basic | Up:Bag ]

Bag: Adding to a collection

add: newObject
Add an occurrence of newObject to the receiver. Answer newObject


add: newObject withOccurrences: anInteger
If anInteger > 0, add anInteger occurrences of newObject to the receiver. If anInteger < 0, remove them. Answer newObject


[ Next: | Previous:Bag-Adding to a collection | Up:Bag ]

Bag: enumerating the elements of a collection

do: aBlock
Evaluate the block for all members in the collection.


[ Next: | Previous:Bag-enumerating the elements of a collection | Up:Bag ]

Bag: printing

printOn: aStream
Put on aStream a representation of the receiver


[ Next: | Previous:Bag-printing | Up:Bag ]

Bag: Removing from a collection

remove: oldObject ifAbsent: anExceptionBlock
Remove oldObject from the collection and return it. If can't be found, answer instead the result of evaluationg anExceptionBlock


[ Next: | Previous:Bag-Removing from a collection | Up:Bag ]

Bag: storing

storeOn: aStream
Put on aStream some Smalltalk code compiling to the receiver


[ Previous:Bag-storing | Up:Bag ]

Bag: testing collections

= aBag
Answer whether the receiver and aBag contain the same objects


hash
Answer an hash value for the receiver


occurrencesOf: anObject
Answer the number of occurrences of anObject found in the receiver


size
Answer the total number of objects found in the receiver


[Up: Class Index]

Behavior

Category: Language-Implementation
I am the parent class of all "class" type methods. My instances know about the subclass/superclass relationships between classes, contain the description that instances are created from, and hold the method dictionary that's associated with each class. I provide methods for compiling methods, modifying the class inheritance hierarchy, examining the method dictionary, and iterating over the class hierarchy.


[ Next: | Up:Behavior ]

Behavior class: C interface

defineCFunc: cFuncNameString
withSelectorArgs: selectorAndArgs forClass: aClass returning: returnTypeSymbol args: argsArray Lookup the part on the C interface in this manual - it is too complex to describe it here ;-) Anyway this is private and kept for backward com- patibility. You should use defineCFunc:withSelectorArgs:returning:args: which also checks if the function is present in the DLD libraries.


[ Next: | Previous:Behavior class-C interface | Up:Behavior ]

Behavior class: creating lightweight classes

new
Create a new class. Having an instanceSpec defined this way won't be very useful, but at least it doesn't result in access violations!


[ Next: | Previous:Behavior class-creating lightweight classes | Up:Behavior ]

Behavior: accessing class hierarchy

allSubclasses
Answer the direct and indirect subclasses of the receiver in a Set


allSuperclasses
Answer all the receiver's superclasses in a collection


subclasses
Answer the direct subclasses of the receiver in a Set


superclass
Answer the receiver's superclass (if any, otherwise answer nil)


withAllSubclasses
Answer a Set containing the receiver together with its direct and indirect subclasses


withAllSuperclasses
Answer the receiver and all of its superclasses in a collection


[ Next: | Previous:Behavior-accessing class hierarchy | Up:Behavior ]

Behavior: accessing instances and variables

allClassVarNames
Return all the class variables understood by the receiver


allInstances
Returns a set of all instances of the receiver - you might get some nils in it: just discard them.


allInstVarNames
Answer all the instance variables for instances of the receiver


allSharedPools
Return the names of the shared pools defined by the class and any of its superclasses


classPool
Answer the class pool dictionary. Since Behavior does not support classes with class variables, we answer an empty one; adding variables to it results in an error.


classVarNames
Answer all the class variables for instances of the receiver


instanceCount
Return a count of all the instances of the receiver


instVarNames
Return all the instance variables added to the hierarchy by the receiver


sharedPools
Return the names of the shared pools defined by the class


subclassInstVarNames
Return all the instance variables inherited from the hierarchy by the receiver


[ Next: | Previous:Behavior-accessing instances and variables | Up:Behavior ]

Behavior: accessing the methodDictionary

>> selector
Return the compiled method associated with selector, from the local method dictionary. Error if not found.


allSelectors
Answer a Set of all the selectors understood by the receiver


compiledMethodAt: selector
Return the compiled method associated with selector, from the local method dictionary. Error if not found.


selectorAt: method
Return selector for the given compiledMethod


selectors
Answer a Set of the receiver's selectors


sourceCodeAt: selector
Answer source code (if available) for the given compiledMethod


sourceMethodAt: selector
This is too dependent on the original implementation


[ Next: | Previous:Behavior-accessing the methodDictionary | Up:Behavior ]

Behavior: browsing

getAllMethods
Answer the receiver's complete method dictionary - including inherited and not overridden methods. Each value in the dictionary is an Association, whose key is the class which defines the method, and whose value is the actual CompiledMethod


getDirectMethods
Answer the receiver's method dictionary; each value in the dictionary is not a CompiledMethod, but an Association, whose key is the class which defines the method (always the receiver), and whose value is the actual CompiledMethod


getIndirectMethods
Answer a dictionary of the receiver's inherited and not overridden methods. Each value in the dictionary is an Association, whose key is the class which defines the method, and whose value is the actual CompiledMethod


getMethods
Answer the receiver's complete method dictionary - including inherited and not overridden methods


getMethodsFor: aSelector
Get a dictionary with all the definitions of the given selector along the hierarchy. Each key in the dictionary is a class which defines the method, and each value in the dictionary is an Association, whose key is the class again, and whose value is the actual CompiledMethod


methodDictionary
Answer the receiver's method dictionary


newGetMethods
Answer the receiver's complete method dictionary - including inherited and not overridden methods. Each value in the dictionary is an Association, whose key is the class which defines the method, and whose value is the actual CompiledMethod


[ Next: | Previous:Behavior-browsing | Up:Behavior ]

Behavior: built ins

basicNew
Create a new instance of a class with no indexed instance variables


basicNew: numInstanceVariables
Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables.


compileString: aString
Compile the code in aString, with no category. Fail if the code does not obey Smalltalk syntax. Answer the generated CompiledMethod if it does


compileString: aString ifError: aBlock
Compile the code in aString, with no category. Evaluate aBlock (passing the file name, line number and description of the error) if the code does not obey Smalltalk syntax. Answer the generated CompiledMethod if it does


flushCache
Invalidate the method cache kept by the virtual machine. This message should not need to be called by user programs.


makeDescriptorFor: funcNameString
returning: returnTypeSymbol withArgs: argsArray Private - Answer a CFunctionDescriptor


methodsFor: category ifTrue: condition
Compile the following code inside the receiver, with the given category, if condition is true; else ignore it


new
Create a new instance of a class with no indexed instance variables


new: numInstanceVariables
Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables.


someInstance
Private - Answer the first instance of the receiver in the object table


[ Next: | Previous:Behavior-built ins | Up:Behavior ]

Behavior: C callout

defineCFunc: cFuncName
withSelectorArgs: selector returning: aReturnType args: argsArray Too complex to describe it here - Look up the C interface in the manual.


[ Next: | Previous:Behavior-C callout | Up:Behavior ]

Behavior: compilation (alternative)

methods
Don't use this, it's only present to file in from Smalltalk/V


methodsFor
Don't use this, it's only present to file in from Dolphin Smalltalk


methodsFor: category ifFeatures: features
Start compiling methods in the receiver if this implementation of Smalltalk has the given features, else skip the section


methodsFor: category stamp: notUsed
Don't use this, it's only present to file in from Squeak


privateMethods
Don't use this, it's only present to file in from IBM Smalltalk


publicMethods
Don't use this, it's only present to file in from IBM Smalltalk


[ Next: | Previous:Behavior-compilation (alternative) | Up:Behavior ]

Behavior: creating a class hierarchy

addSubclass: aClass
Add aClass asone of the receiver's subclasses.


removeSubclass: aClass
Remove aClass from the list of the receiver's subclasses


superclass: aClass
Set the receiver's superclass.


[ Next: | Previous:Behavior-creating a class hierarchy | Up:Behavior ]

Behavior: creating method dictionary

addSelector: selector withMethod: compiledMethod
Add the given compiledMethod to the method dictionary, giving it the passed selector. Answer compiledMethod


compile: code
Compile method source. If there are parsing errors, answer nil. Else, return a CompiledMethod result of compilation


compile: code ifError: block
Compile method source. If there are parsing errors, invoke exception block, 'block' passing file name, line number and error. description. Return a CompiledMethod result of compilation


compile: code notifying: requestor
Compile method source. If there are parsing errors, send #error: to the requestor object, else return a CompiledMethod result of compilation


compileAll
Recompile all selectors in the receiver. Ignore errors.


compileAll: aNotifier
Recompile all selectors in the receiver. Notify aNotifier by sen- ding #error: messages if something goes wrong.


compileAllSubclasses
Recompile all selector of all subclasses. Notify aNotifier by sen- ding #error: messages if something goes wrong.


compileAllSubclasses: aNotifier
Recompile all selector of all subclasses. Notify aNotifier by sen- ding #error: messages if something goes wrong.


createGetMethod: what
Create a method accessing the variable `what'.


createGetMethod: what default: value
Create a method accessing the variable `what', with a default value of `value', using lazy initialization


createSetMethod: what
Create a method which sets the variable `what'.


decompile: selector
Decompile the bytecodes for the given selector.


edit: selector
Open Emacs to edit the method with the passed selector, then compile it


methodDictionary: aDictionary
Set the receiver's method dictionary to aDictionary


recompile: selector
Recompile the given selector, answer nil if something goes wrong or the new CompiledMethod if everything's ok.


recompile: selector notifying: aNotifier
Recompile the given selector. If there are parsing errors, send #error: to the aNotifier object, else return a CompiledMethod result of compilation


removeSelector: selector
Remove the given selector from the method dictionary, answer the CompiledMethod attached to that selector


removeSelector: selector ifAbsent: aBlock
Remove the given selector from the method dictionary, answer the CompiledMethod attached to that selector. If the selector cannot be found, answer the result of evaluating aBlock.


[ Next: | Previous:Behavior-creating method dictionary | Up:Behavior ]

Behavior: enumerating

allInstancesDo: aBlock
Invokes aBlock for all instances of the receiver


allSubclassesDo: aBlock
Invokes aBlock for all subclasses, both direct and indirect.


allSubinstancesDo: aBlock
Invokes aBlock for all instances of each of the receiver's subclasses.


allSuperclassesDo: aBlock
Invokes aBlock for all superclasses, both direct and indirect.


selectSubclasses: aBlock
Return a Set of subclasses of the receiver satisfying aBlock.


selectSuperclasses: aBlock
Return a Set of superclasses of the receiver satisfying aBlock.


subclassesDo: aBlock
Invokes aBlock for all direct subclasses.


withAllSubclassesDo: aBlock
Invokes aBlock for the receiver and all subclasses, both direct and indirect.


withAllSuperclassesDo: aBlock
Invokes aBlock for the receiver and all superclasses, both direct and indirect.


[ Next: | Previous:Behavior-enumerating | Up:Behavior ]

Behavior: evaluating

evalString: aString to: anObject
Answer the stack top at the end of the evaluation of the code in aString. The code is executed as part of anObject


evalString: aString to: anObject ifError: aBlock
Answer the stack top at the end of the evaluation of the code in aString. If aString cannot be parsed, evaluate aBlock (see compileString:ifError:). The code is executed as part of anObject


evaluate: code
Evaluate Smalltalk expression in 'code' and return result.


evaluate: code ifError: block
Evaluate 'code'. If a parsing error is detected, invoke 'block'


evaluate: code notifying: requestor
Evaluate Smalltalk expression in 'code'. If a parsing error is encountered, invoke error block, 'block'


evaluate: code to: anObject
Evaluate Smalltalk expression as part of anObject's method definition


evaluate: code to: anObject ifError: block
Evaluate Smalltalk expression as part of anObject's method definition. This method is used to support Inspector expression evaluation. If a parsing error is encountered, invoke error block, 'block'


[ Next: | Previous:Behavior-evaluating | Up:Behavior ]

Behavior: hierarchy browsing

printHierarchy
Print my entire subclass hierarchy on the terminal.


printHierarchyEmacs
Print my entire subclass hierarchy on the terminal, in a format suitable for Emacs parsing.


[ Next: | Previous:Behavior-hierarchy browsing | Up:Behavior ]

Behavior: support for lightweight classes

name
Answer the class name - a dummy one, since Behavior does not support names. This class name is used, for example, to print the receiver.


[ Next: | Previous:Behavior-support for lightweight classes | Up:Behavior ]

Behavior: testing the class hierarchy

inheritsFrom: aClass
Returns true if aClass is a superclass of the receiver


kindOfSubclass
Return a string indicating the type of class the receiver is


[ Next: | Previous:Behavior-testing the class hierarchy | Up:Behavior ]

Behavior: testing the form of the instances

instSize
Answer how many fixed instance variables are reserved to each of the receiver's instances


isBits
Answer whether the instance variables of the receiver's instances are bytes or words


isBytes
Answer whether the instance variables of the receiver's instances are bytes


isFixed
Answer whether the receiver's instances have no indexed instance variables


isIdentity
Answer whether x = y implies x == y for instances of the receiver


isImmediate
Answer whether, if x is an instance of the receiver, x copy == x


isPointers
Answer whether the instance variables of the receiver's instances are objects


isVariable
Answer whether the receiver's instances have indexed instance variables


isWords
Answer whether the instance variables of the receiver's instances are words


[ Previous:Behavior-testing the form of the instances | Up:Behavior ]

Behavior: testing the method dictionary

canUnderstand: selector
Returns true if the instances of the receiver understand the given selector


hasMethods
Return whether the receiver has any methods defined


includesSelector: selector
Returns true if the local method dictionary contains the given selector


scopeHas: name ifTrue: aBlock
If methods understood by the receiver's instances have access to a symbol named 'name', evaluate aBlock


whichClassIncludesSelector: selector
Answer which class in the receiver's hierarchy contains the implementation of selector used by instances of the class (nil if none does)


whichSelectorsAccess: instVarName
Answer a Set of selectors which access the given instance variable


whichSelectorsReferTo: anObject
Returns a Set of selectors that refer to anObject


whichSelectorsReferToByteCode: aByteCode
Return the collection of selectors in the class which reference the byte code, aByteCode


[Up: Class Index]

BlockClosure

Category: Language-Implementation
I am a factotum class. My instances represent Smalltalk blocks, portions of executeable code that have access to the environment that they were declared in, take parameters, and can be passed around as objects to be executed by methods outside the current class. Block closures are sent a message to compute their value and create a new execution context; this property can be used in the construction of control flow methods. They also provide some methods that are used in the creation of Processes from blocks.

Implementation note: here is the use of the variable storage: - byte 1 = number of args - byte 2 = number of temps - bytes 3/4 = initial IP in machine order.


[ Next: | Up:BlockClosure ]

BlockClosure: accessing

argumentCount
Answer the number of arguments passed to the receiver


initialIP
Answer the initial instruction pointer into the receiver


numTemps
Answer the number of temporary variables used by the receiver


outerContext
Answer the method/block context which is the immediate outer of the receiver


[ Next: | Previous:BlockClosure-accessing | Up:BlockClosure ]

BlockClosure: basic

whileFalse
Evaluate the receiver until it returns true


whileFalse: aBlock
Evaluate the receiver. If it returns false, evaluate aBlock and re- start


whileTrue
Evaluate the receiver until it returns false


whileTrue: aBlock
Evaluate the receiver. If it returns true, evaluate aBlock and re- start


[ Next: | Previous:BlockClosure-basic | Up:BlockClosure ]

BlockClosure: built ins

value
Evaluate the receiver passing no parameters


value: arg1
Evaluate the receiver passing arg1 as the only parameter


value: arg1 value: arg2
Evaluate the receiver passing arg1 and arg2 as the parameters


value: arg1 value: arg2 value: arg3
Evaluate the receiver passing arg1, arg2 and arg3 as the parameters


valueWithArguments: argumentsArray
Evaluate the receiver passing argArray's elements as the parameters


[ Next: | Previous:BlockClosure-built ins | Up:BlockClosure ]

BlockClosure: exception handling

ensure: aBlock
Evaluate the receiver; when any exception is signaled exit returning the result of evaluating aBlock; if no exception is raised, return the result of evaluating aBlock when the receiver has ended


ifCurtailed: aBlock
Evaluate the receiver; when any exception is signaled exit returning the result of evaluating aBlock; if no exception is raised, return the result of evaluating the receiver


on: anException do: aBlock
Evaluate the receiver; when anException is signaled, evaluate aBlock passing a Signal describing the exception. Answer either the result of evaluating the receiver or the parameter of a Signal>>#return:


on: e1 do: b1 on: e2 do: b2
Evaluate the receiver; when e1 or e2 are signaled, evaluate respectively b1 or b2, passing a Signal describing the exception. Answer either the result of evaluating the receiver or the argument of a Signal>>#return:


on: e1 do: b1 on: e2 do: b2 on: e3 do: b3
Evaluate the receiver; when e1, e2 or e3 are signaled, evaluate respectively b1, b2 or b3, passing a Signal describing the exception. Answer either the result of evaluating the receiver or the parameter of a Signal>>#return:


on: e1 do: b1 on: e2 do: b2 on: e3 do: b3 on: e4 do: b4
Evaluate the receiver; when e1, e2, e3 or e4 are signaled, evaluate respectively b1, b2, b3 or b4, passing a Signal describing the exception. Answer either the result of evaluating the receiver or the parameter of a Signal>>#return:


on: e1 do: b1 on: e2 do: b2 on: e3 do: b3 on: e4 do: b4 on: e5 do: b5
Evaluate the receiver; when e1, e2, e3, e4 or e5 are signaled, evaluate respectively b1, b2, b3, b4 or b5, passing a Signal describing the exception. Answer either the result of evaluating the receiver or the parameter of a Signal>>#return:


valueWithUnwind
Evaluate the receiver. Any errors caused by the block will cause a backtrace, but execution will continue in the method that sent #valueWithUnwind, after that call. Example: [ 1 / 0 ] valueWithUnwind. 'unwind works!' printNl. Important: this method is public, but it is intended to be used in very special cases. You should usually rely on #ensure: and #on:do:


[ Previous:BlockClosure-exception handling | Up:BlockClosure ]

BlockClosure: multiple process

fork
Create a new process executing the receiver and start it


forkAt: priority
Create a new process executing the receiver with given priority and start it


newProcess
Create a new process executing the receiver in suspended state. The priority is the same as for the calling process. The receiver must not contain returns


newProcessWith: anArray
Create a new process executing the receiver with the passed arguments, and leave it in suspended state. The priority is the same as for the calling process. The receiver must not contain returns


[Up: Class Index]

BlockContext

Category: Language-Implementation
My instances represent executing Smalltalk blocks, which are portions of executeable code that have access to the environment that they were declared in, take parameters, and result from BlockClosure objects created to be executed by methods outside the current class. Block contexts are created by messages sent to compute a closure's value. They contain a stack and also provide some methods that can be used in inspection or debugging.


[ Next: | Up:BlockContext ]

BlockContext: accessing

caller
Answer the context that called the receiver


home
Answer the MethodContext to which the receiver refers


isBlock
Answer whether the receiver is a block context


method
Return the CompiledMethod being executed


numArgs
Answer the number of arguments passed to the receiver


numTemps
Answer the number of temporaries used by the receiver


outerContext
Answer the outer block/method context for the receiver


receiver
Return the receiver (self) for the method being executed


selector
Return the selector for the method being executed


[ Previous:BlockContext-accessing | Up:BlockContext ]

BlockContext: printing

printOn: aStream
Print a representation for the receiver on aStream


[Up: Class Index]

Boolean

Category: Language-Data types
I have two instances in the Smalltalk system: true and false. I provide methods that are conditional on boolean values, such as conditional execution and loops, and conditional testing, such as conditional and and conditional or. I should say that I appear to provide those operations; my subclasses True and False actually provide those operations.


[ Next: | Up:Boolean ]

Boolean class: testing

isIdentity
Answer whether x = y implies x == y for instances of the receiver


isImmediate
Answer whether, if x is an instance of the receiver, x copy == x


[ Next: | Previous:Boolean class-testing | Up:Boolean ]

Boolean: basic

& aBoolean
This method's functionality should be implemented by subclasses of Boolean


and: aBlock
This method's functionality should be implemented by subclasses of Boolean


eqv: aBoolean
This method's functionality should be implemented by subclasses of Boolean


ifFalse: falseBlock
This method's functionality should be implemented by subclasses of Boolean


ifFalse: falseBlock ifTrue: trueBlock
This method's functionality should be implemented by subclasses of Boolean


ifTrue: trueBlock
This method's functionality should be implemented by subclasses of Boolean


ifTrue: trueBlock ifFalse: falseBlock
This method's functionality should be implemented by subclasses of Boolean


not
This method's functionality should be implemented by subclasses of Boolean


or: aBlock
This method's functionality should be implemented by subclasses of Boolean


xor: aBoolean
This method's functionality should be implemented by subclasses of Boolean


| aBoolean
This method's functionality should be implemented by subclasses of Boolean


[ Next: | Previous:Boolean-basic | Up:Boolean ]

Boolean: C hacks

asCBooleanValue
This method's functionality should be implemented by subclasses of Boolean


[ Next: | Previous:Boolean-C hacks | Up:Boolean ]

Boolean: overriding

deepCopy
Answer the receiver.


shallowCopy
Answer the receiver.


[ Previous:Boolean-overriding | Up:Boolean ]

Boolean: storing

storeOn: aStream
Store on aStream some Smalltalk code which compiles to the receiver


[Up: Class Index]

Browser

Category: Language-Implementation


[ Up:Browser ]

Browser class: browsing

browseHierarchy
Tell Emacs tp browse the Smalltalk class hierarchy


browseMethods: methods forClass: class inBuffer: bufferName
Send to Emacs code that browses the methods in the `methods' Dictionary, showing them as part of the `class' class in a buffer with the given name


emacsFunction: funcName on: aBlock
Send to Emacs something like (funcName <aBlock is evaluated here>)


emacsListFunction: funcName on: aBlock
Send to Emacs something like (funcName '(<aBlock is evaluated here>))


finishEmacsMessage
Finish a message to be processed by emacs - does nothing for now


getAllSelectors: selector inBuffer: bufferName
Send to Emacs code that browses the implementors of the given selectors in a buffer with the given name


initialize
Initialize the Emacs browsing system


loadClassNames
Tell Emacs the class names (new version)


oldloadClassNames
Tell Emacs the class names


oldShowInstanceMethods: class
Send to Emacs code that browses instance methods for class


oldShowMethods: class for: methodType
Send to Emacs code that browses methods of the given type for class (methodType is either `class' or `instance')


selectorsForEmacs
Tell Emacs the names of ALL the defined selectors


showAllMethods: class inBuffer: bufferName
Send to Emacs code that browses ALL the methods understood by instances of the given class, in a buffer with the given name


showDirectMethods: class inBuffer: bufferName
Send to Emacs code that browses methods defined in the given class, in a buffer with the given name


showIndirectMethods: class inBuffer: bufferName
Send to Emacs code that browses the methods inherited (and not overridden) by the given class, in a buffer with the given name


showMethods: class for: methodType
Send to Emacs code that browses methods of the given type for class (methodType is either `class' or `instance')


startEmacsMessage
Start a message to be processed by emacs as Lisp


testMethods: aClass for: methodType
Send to Emacs code that browses methods of the given type for class (methodType is either `class' or `instance')


withGcOff: aBlock
Evaluate aBlock while the `GC flipping...' message is off


[Up: Class Index]

ByteArray

Category: Collections-Unordered
My instances are similar to strings in that they are both represented as a sequence of bytes, but my individual elements are integers, where as a String's elements are characters.


[ Next: | Up:ByteArray ]

ByteArray: built ins

asCData: aCType
Convert the receiver to a CObject with the given type


byteAt: index
Answer the index-th indexed instance variable of the receiver


byteAt: index put: value
Store the `value' byte in the index-th indexed instance variable of the receiver


hash
Answer an hash value for the receiver


primReplaceFrom: start to: stop with: aByteArray startingAt: srcIndex
Private - Replace the characters from start to stop with the ASCII codes contained in aString (which, actually, can be any variable byte class), starting at the srcIndex location of aString


replaceFrom: start to: stop withString: aString startingAt: srcIndex
Replace the characters from start to stop with the ASCII codes contained in aString (which, actually, can be any variable byte class), starting at the srcIndex location of aString


[ Next: | Previous:ByteArray-built ins | Up:ByteArray ]

ByteArray: converting

asString
Answer a String whose character's ASCII codes are the receiver's contents


[ Next: | Previous:ByteArray-converting | Up:ByteArray ]

ByteArray: copying

deepCopy
Answer a shallow copy of the receiver


shallowCopy
Answer a shallow copy of the receiver


[ Previous:ByteArray-copying | Up:ByteArray ]

ByteArray: more advanced accessing

charAt: index
Access the C char at the given index in the receiver. The value is returned as a Smalltalk Character. Indices are 1-based just like for other Smalltalk access.


charAt: index put: value
Store as a C char the Smalltalk Character or Integer object identified by `value', at the given index in the receiver, using sizeof(char) bytes - i.e. 1 byte. Indices are 1-based just like for other Smalltalk access.


doubleAt: index
Access the C double at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.


doubleAt: index put: value
Store the Smalltalk Float object identified by `value', at the given index in the receiver, writing it like a C double. Indices are 1-based just like for other Smalltalk access.


floatAt: index
Access the C float at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.


floatAt: index put: value
Store the Smalltalk Float object identified by `value', at the given index in the receiver, writing it like a C float. Indices are 1-based just like for other Smalltalk access.


intAt: index
Access the C int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.


intAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(int) bytes. Indices are 1-based just like for other Smalltalk access.


longAt: index
Access the C long int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.


longAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(long) bytes. Indices are 1-based just like for other Smalltalk access.


objectAt: index
Access the Smalltalk object (OOP) at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.


objectAt: index put: value
Store a pointer (OOP) to the Smalltalk object identified by `value', at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.


shortAt: index
Access the C short int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.


shortAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(short) bytes. Indices are 1-based just like for other Smalltalk access.


stringAt: index
Access the string pointed by the C `char *' at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.


stringAt: index put: value
Store the Smalltalk String object identified by `value', at the given index in the receiver, writing it like a *FRESHLY ALLOCATED* C string. It is the caller's responsibility to free it if necessary. Indices are 1-based just like for other Smalltalk access.


unsignedCharAt: index
Access the C unsigned char at the given index in the receiver. The value is returned as a Smalltalk Character. Indices are 1-based just like for other Smalltalk access.


unsignedCharAt: index put: value
Store as a C char the Smalltalk Character or Integer object identified by `value', at the given index in the receiver, using sizeof(char) bytes - i.e. 1 byte. Indices are 1-based just like for other Smalltalk access.


unsignedIntAt: index
Access the C unsigned int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.


unsignedIntAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(int) bytes. Indices are 1-based just like for other Smalltalk access.


unsignedLongAt: index
Access the C unsigned long int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.


unsignedLongAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(long) bytes. Indices are 1-based just like for other Smalltalk access.


unsignedShortAt: index
Access the C unsigned short int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.


unsignedShortAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(short) bytes. Indices are 1-based just like for other Smalltalk access.


[Up: Class Index]

ByteMemory

Category: Language-Implementation
I have no instances. I provide messages to my class that access real memory as bytes. An alternative implementation would be to have a single instance of byte memory that represented all memory, and at: and at:put: accessor methods, but since you'd typically refer to that instance via a global variable, and since the global variable would probably be named ByteMemory, the actual method invocations are exactly the same in either case.


[ Up:ByteMemory ]

ByteMemory class: basic

at: address
Returns the byte at address as an integer


at: address put: value
Sets the byte at ADDRESS (an integer) to be VALUE (INTEGER 0..255)


[Up: Class Index]

ByteStream

Category: Streams-Collections
My instances are read/write streams specially crafted for ByteArrays. They are able to write binary data to them.


[ Up:ByteStream ]

ByteStream: basic

next
Return the next *character* in the ByteArray


nextByte
Return the next byte in the byte array


nextByteArray: numBytes
Return the next numBytes bytes in the byte array


nextLong
Return the next 4 bytes in the byte array, interpreted as a 32 bit signed int


nextPut: aChar
Store aChar on the byte array


nextPutAll: aCollection
Write all the objects in aCollection to the receiver


nextPutByte: anInteger
Store anInteger (range: -128..255) on the byte array


nextPutByteArray: aByteArray
Store aByteArray on the byte array


nextPutLong: anInteger
Store anInteger (range: -2^31..2^32-1) on the byte array as 4 bytes


nextPutShort: anInteger
Store anInteger (range: -32768..65535) on the byte array as 2 bytes


nextShort
Return the next 2 bytes in the byte array, interpreted as a 16 bit signed int


nextSignedByte
Return the next byte in the byte array, interpreted as a 8 bit signed number


nextUlong
Return the next 4 bytes in the byte array, interpreted as a 32 bit unsigned int


nextUshort
Return the next 2 bytes in the byte array, interpreted as a 16 bit unsigned int


[Up: Class Index]

CAggregate

Category: Language-C interface


[ Next: | Up:CAggregate ]

CAggregate class: accessing

alignof
Answer the receiver's instances required aligment


sizeof
Answer the receiver's instances size


[ Previous:CAggregate class-accessing | Up:CAggregate ]

CAggregate: accessing

+ anInteger
Return another CString pointing at &receiver[anInteger] (or, if you prefer, what `receiver + anInteger' does in C).


- intOrPtr
If intOrPtr is an integer, return another CString pointing at &receiver[-anInteger] (or, if you prefer, what `receiver - anInteger' does in C). If it is a CString, return the difference in chars, i.e. in bytes, between the two pointed addresses (or, if you prefer, what `receiver - anotherCharPtr' does in C)


addressAt: anIndex
Access the array, returning a new Smalltalk CObject of the element type, corresponding to the given indexed element of the array. anIndex is zero-based, just like with all other C-style accessing.


at: anIndex
Access the array, returning a new Smalltalk object of the element type, corresponding to the given indexed element of the array. anIndex is zero-based, just like with all other C-style accessing.


at: anIndex put: aValue
Store in the array the passed Smalltalk object `aValue', which should be of the element type, corresponding to the given indexed element. anIndex is zero-based, just like with all other C-style accessing.


decr
Adjust the pointer by sizeof(elementType) bytes down (i.e. -receiver)


decrBy: anInteger
Adjust the pointer by anInteger elements down (i.e. receiver -= anInteger)


deref
Access the object, returning a new Smalltalk object of the element type, corresponding to the dereferenced pointer or to the first element of the array.


deref: aValue
Modify the object, storing the object of the element type into the pointed address or to the first element of the array.


incr
Adjust the pointer by sizeof(elementType) bytes up (i.e. ++receiver)


incrBy: anInteger
Adjust the pointer by anInteger elements up (i.e. receiver += anInteger)


value
Access the array, returning a new Smalltalk object of the element type, corresponding to the first element of the array.


value: aValue
Modify the array, storing the object of the element type into the first element of the array.


[Up: Class Index]

CArray

Category: Language-C interface


[ Up:CArray ]

CArray: accessing

alignof
Answer the receiver's required aligment


sizeof
Answer the receiver's size


[Up: Class Index]

CArrayCType

Category: Language-C interface


[ Next: | Up:CArrayCType ]

CArrayCType class: instance creation

elementType: aCType numberOfElements: anInteger
Answer a new instance of CPtrCType that maps an array whose elements are of the given CType, and whose size is exactly anInteger elements (of course, anInteger only matters for allocation, not for access, since no out-of-bounds protection is provided for C objects).


[ Previous:CArrayCType class-instance creation | Up:CArrayCType ]

CArrayCType: accessing

alignof
Answer the alignment of the receiver's instances


elementType
Answer the type of the elements in the receiver's instances


numberOfElements
Answer the number of elements in the receiver's instances


sizeof
Answer the size of the receiver's instances


[Up: Class Index]

CBoolean

Category: Language-C interface
I return true if a byte is not zero, false otherwise.


[ Up:CBoolean ]

CBoolean: accessing

value
Get the receiver's value - answer true if it is != 0, false if it is 0.


value: aBoolean
Set the receiver's value - it's the same as for CBytes, but we get a Boolean, not a Character


[Up: Class Index]

CByte

Category: Language-C interface
You're a marine. You adapt - you improvise - you overcome

- Gunnery Sgt. Thomas Highway Heartbreak Ridge


[ Next: | Up:CByte ]

CByte class: conversion

scalarIndex
Nothing special in the default case - answer a CType for the receiver


type
Nothing special in the default case - answer a CType for the receiver


[ Previous:CByte class-conversion | Up:CByte ]

CByte: accessing

scalarIndex
Nothing special in the default case - answer the receiver's CType


type
Answer a CType for the receiver


value
Get the receiver's value - it's the same as for CUChars, but we convert the result to ASCII


value: anInteger
Set the receiver's value - it's the same as for CUChars, but we get an Integer, not a Character


[Up: Class Index]

CChar

Category: Language-C interface


[ Next: | Up:CChar ]

CChar class: accessing

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's instances size


[ Previous:CChar class-accessing | Up:CChar ]

CChar: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's size


[Up: Class Index]

CDouble

Category: Language-C interface


[ Next: | Up:CDouble ]

CDouble class: accessing

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's instances size


[ Previous:CDouble class-accessing | Up:CDouble ]

CDouble: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's size


[Up: Class Index]

CFloat

Category: Language-C interface


[ Next: | Up:CFloat ]

CFloat class: accessing

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's instances size


[ Previous:CFloat class-accessing | Up:CFloat ]

CFloat: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's size


[Up: Class Index]

CFunctionDescriptor

Category: Language-C interface
I am not part of the Smalltalk definition. My instances contain information about C functions that can be called from within Smalltalk, such as number and type of parameters. This information is used by the C callout mechanism to perform the actual call-out to C routines.


[ Next: | Up:CFunctionDescriptor ]

CFunctionDescriptor class: testing

addressOf: function
Answer the address (CObject) of the function which is registered (on the C side) with the given name, or zero if no such a function is registered.


isFunction: function
Answer whether a function is registered (on the C side) with the given name or is dynamically loadable.


[ Next: | Previous:CFunctionDescriptor class-testing | Up:CFunctionDescriptor ]

CFunctionDescriptor: accessing

address
Answer the address (CObject) of the function represented by the receiver


isValid
Answer whether the function represented by the receiver is actually a registered one


name
Answer the name of the function (on the C side) represented by the receiver


[ Previous:CFunctionDescriptor-accessing | Up:CFunctionDescriptor ]

CFunctionDescriptor: printing

printOn: aStream
Print a representation of the receiver onto aStream


[Up: Class Index]

Character

Category: Language-Data types
My instances represent the 256 characters of the character set. I provide messages to translate between integers and character objects, and provide names for some of the common unprintable characters.


[ Next: | Up:Character ]

Character class: built ins

asciiValue: anInteger
Returns the character object corresponding to anInteger. Error if anInteger is not an integer, or not in 0..255.


value: anInteger
Returns the character object corresponding to anInteger. Error if anInteger is not an integer, or not in 0..255.


[ Next: | Previous:Character class-built ins | Up:Character ]

Character class: constants

backspace
Returns the character 'backspace'


cr
Returns the character 'cr'


eof
Returns the character 'eof', aka 'sub'


esc
Returns the character 'esc'


newPage
Returns the character 'newPage', aka 'ff'


nl
Returns the character 'nl'


nul
Returns the character 'nul'


space
Returns the character 'space'


tab
Returns the character 'tab'


[ Next: | Previous:Character class-constants | Up:Character ]

Character class: initializing lookup tables

initialize
Initialize the lookup table which is used to make case and digit-to-char conversions faster. Indices in Table are ASCII values incremented by one. Indices 1-256 classify chars (0 = nothing special, 2 = separator, 48 = digit, 55 = uppercase, 3 = lowercase), indices 257-512 map to lowercase chars, indices 513-768 map to uppercase chars.


[ Next: | Previous:Character class-initializing lookup tables | Up:Character ]

Character class: Instance creation

digitValue: anInteger
Returns a character that corresponds to anInteger. 0-9 map to $0-$9, 10-35 map to $A-$Z


[ Next: | Previous:Character class-Instance creation | Up:Character ]

Character class: testing

isIdentity
Answer whether x = y implies x == y for instances of the receiver


isImmediate
Answer whether, if x is an instance of the receiver, x copy == x


[ Next: | Previous:Character class-testing | Up:Character ]

Character: built ins

= char
Boolean return value; true if the characters are equal


asciiValue
Returns the integer value corresponding to self


asInteger
Returns the integer value corresponding to self


value
Returns the integer value corresponding to self


[ Next: | Previous:Character-built ins | Up:Character ]

Character: Coercion methods

asLowercase
Returns self as a lowercase character if it's an uppercase letter, otherwise returns the character unchanged.


asString
Returns the character self as a string.


asSymbol
Returns the character self as a symbol.


asUppercase
Returns self as a uppercase character if it's an lowercase letter, otherwise returns the character unchanged.


[ Next: | Previous:Character-Coercion methods | Up:Character ]

Character: comparing

< aCharacter
Compare the character's ASCII value. Answer whether the receiver's is the least.


<= aCharacter
Compare the character's ASCII value. Answer whether the receiver's is the least or their equal.


> aCharacter
Compare the character's ASCII value. Answer whether the receiver's is the greatest.


>= aCharacter
Compare the character's ASCII value. Answer whether the receiver's is the greatest or their equal.


[ Next: | Previous:Character-comparing | Up:Character ]

Character: converting

digitValue
Returns the value of self interpreted as a digit. Here, 'digit' means either 0-9, or A-Z, which maps to 10-35.


[ Next: | Previous:Character-converting | Up:Character ]

Character: printing

printOn: aStream
Store a representation of the receiver on aStream


[ Next: | Previous:Character-printing | Up:Character ]

Character: storing

storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


[ Next: | Previous:Character-storing | Up:Character ]

Character: testing

isAlphaNumeric
True if self is a letter or a digit


isDigit
True if self is a 0-9 digit


isLetter
True if self is an upper- or lowercase letter


isLowercase
True if self is a lowercase letter


isSeparator
Returns true if self is a space, cr, tab, nl, or newPage


isUppercase
True if self is uppercase


isVowel
Returns true if self is a, e, i, o, or u; case insensitive


[ Previous:Character-testing | Up:Character ]

Character: testing functionality

isCharacter
Answer True. We're definitely characters


[Up: Class Index]

CInt

Category: Language-C interface


[ Next: | Up:CInt ]

CInt class: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's size


[ Previous:CInt class-accessing | Up:CInt ]

CInt: accessing

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's instances size


[Up: Class Index]

Class

Category: Language-Implementation
I am THE class object. My instances are the classes of the system


[ Next: | Up:Class ]

Class: accessing instances and variables

addClassVarName: aString
Add a class variable with the given name to the class pool dictionary


addSharedPool: aDictionary
Add the given shared pool to the list of the class' pool dictionaries


allClassVarNames
Answer the names of the variables in the receiver's class pool dictionary and in each of the superclasses' class pool dictionaries


classPool
Answer the class pool dictionary


classVarNames
Answer the names of the variables in the class pool dictionary


initialize
redefined in children (?)


removeClassVarName: aString
Removes the class variable from the class, error if not present, or still in use.


removeSharedPool: aDictionary
Remove the given dictionary to the list of the class' pool dictionaries


sharedPools
Return the names of the shared pools defined by the class


[ Next: | Previous:Class-accessing instances and variables | Up:Class ]

Class: filing

fileOutDeclarationOn: aFileStream
File out class definition to aFileStream


fileOutHeaderOn: aFileStream
Write date and time stamp to aFileStream


fileOutOn: aFileStream
File out complete class description: class definition, class and instance methods


[ Next: | Previous:Class-filing | Up:Class ]

Class: instance creation

subclass: classNameString
instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a fixed subclass of the receiver with the given name, instance variables, class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed.


variableByteSubclass: classNameString
instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a byte variable subclass of the receiver with the given name, instance variables (must be "), class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed.


variableSubclass: classNameString
instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a variable pointer subclass of the receiver with the given name, instance variables, class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed.


variableWordSubclass: classNameString
instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a word variable subclass of the receiver with the given name, instance variables (must be "), class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed.


[ Next: | Previous:Class-instance creation | Up:Class ]

Class: instance creation - alternative

categoriesFor: method are: categories
Don't use this, it is only present to file in from IBM Smalltalk


subclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


subclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableByteSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableByteSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableWordSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableWordSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


[ Next: | Previous:Class-instance creation - alternative | Up:Class ]

Class: printing

printOn: aStream
Print a representation of the receiver on aStream


storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


[ Next: | Previous:Class-printing | Up:Class ]

Class: testing

= aClass
Returns true if the two class objects are to be considered equal.


[ Previous:Class-testing | Up:Class ]

Class: testing functionality

asClass
Answer the receiver.


isClass
Answer `true'.


[Up: Class Index]

ClassDescription

Category: Language-Implementation
My instances record information generally attributed to classes and metaclasses; namely, the class name, class comment (you wouldn't be reading this if it weren't for me), a list of the instance variables of the class, and the class category. I provide methods that access classes by category, and allow whole categories of classes to be filed out to external disk files.


[ Next: | Up:ClassDescription ]

ClassDescription: accessing class description

addInstVarName: aString
Add the given instance variable to instance of the receiver


comment
Answer the class comment


comment: aString
Change the class name


name
Answer the class name


removeInstVarName: aString
Remove the given instance variable from the receiver and recompile all of the receiver's subclasses


[ Next: | Previous:ClassDescription-accessing class description | Up:ClassDescription ]

ClassDescription: accessing instances and variables

allInstVarNames
Answer the names of every instance variables the receiver contained in the receiver's instances


instVarNames
Answer an Array containing the instance variables defined by the receiver


subclassInstVarNames
Answer the names of the instance variables the receiver inherited from its superclass


[ Next: | Previous:ClassDescription-accessing instances and variables | Up:ClassDescription ]

ClassDescription: compiling

compile: code classified: categoryName
Compile code in the receiver, assigning the method to the given category. Answer the newly created CompiledMethod, or nil if an error was found.


compile: code classified: categoryName ifError: block
Compile method source and install in method category, categoryName. If there are parsing errors, invoke exception block, 'block' (see compile:ifError:). Return the method


compile: code classified: categoryName notifying: requestor
Compile method source and install in method category, categoryName. If there are parsing errors, send an error message to requestor


[ Next: | Previous:ClassDescription-compiling | Up:ClassDescription ]

ClassDescription: copying

copy: selector from: aClass
Copy the given selector from aClass, assigning it the same category


copy: selector from: aClass classified: categoryName
Copy the given selector from aClass, assigning it the given category


copyAll: arrayOfSelectors from: class
Copy all the selectors in arrayOfSelectors from class, assigning them the same category they have in class


copyAll: arrayOfSelectors from: class classified: categoryName
Copy all the selectors in arrayOfSelectors from aClass, assigning them the given category


copyAllCategoriesFrom: aClass
Copy all the selectors in aClass, assigning them the original category


copyCategory: categoryName from: aClass
Copy all the selectors in from aClass that belong to the given category


copyCategory: categoryName from: aClass classified: newCategoryName
Copy all the selectors in from aClass that belong to the given category, reclassifying them as belonging to the given category


[ Next: | Previous:ClassDescription-copying | Up:ClassDescription ]

ClassDescription: filing

fileOut: fileName
Open the given file and to file out a complete class description to it


fileOutCategory: categoryName to: fileName
File out all the methods belonging to the method category, categoryName, to the fileName file


fileOutCategory: category toStream: aFileStream
File out all the methods belonging to the method category, categoryName, to aFileStream


fileOutOn: aFileStream
File out complete class description: class definition, class and instance methods


fileOutSelector: selector to: fileName
File out the given selector to fileName


[ Next: | Previous:ClassDescription-filing | Up:ClassDescription ]

ClassDescription: organization of messages and classes

category
Answer the class category


category: aString
Change the class category to aString


createGetMethod: what
Create a method accessing the variable `what'.


createGetMethod: what default: value
Create a method accessing the variable `what', with a default value of `value', using lazy initialization


createSetMethod: what
Create a method which sets the variable `what'.


defineCFunc: cFuncNameString
withSelectorArgs: selectorAndArgs returning: returnTypeSymbol args: argsArray See documentation. Too complex to describe it here ;-)


removeCategory: aString
Remove from the receiver every method belonging to the given category


whichCategoryIncludesSelector: selector
Answer the category for the given selector, or nil if the selector is not found


[ Previous:ClassDescription-organization of messages and classes | Up:ClassDescription ]

ClassDescription: printing

classVariableString
This method's functionality should be implemented by subclasses of ClassDescription


instanceVariableString
Answer a string containing the name of the receiver's instance variables.


sharedVariableString
This method's functionality should be implemented by subclasses of ClassDescription


[Up: Class Index]

CLong

Category: Language-C interface


[ Next: | Up:CLong ]

CLong class: accessing

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's instances size


[ Previous:CLong class-accessing | Up:CLong ]

CLong: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's size


[Up: Class Index]

CObject

Category: Language-C interface
I am not part of the standard Smalltalk kernel class hierarchy. My instances contain values that are not interpreted by the Smalltalk system; they frequently hold "pointers" to data outside of the Smalltalk environment. The C callout mechanism allows my instances to be transformed into their corresponding C values for use in external routines.


[ Next: | Up:CObject ]

CObject class: conversion

scalarIndex
Nothing special in the default case - answer a CType for the receiver


type
Nothing special in the default case - answer a CType for the receiver


[ Next: | Previous:CObject class-conversion | Up:CObject ]

CObject class: instance creation

address: anInteger
Answer a new object pointing to the passed address, anInteger


alloc: nBytes
Allocate nBytes bytes and return an instance of the receiver


alloc: nBytes type: cTypeObject
Allocate nBytes bytes and return a CObject of the given type


new: nBytes
Allocate nBytes bytes and return an instance of the receiver


[ Next: | Previous:CObject class-instance creation | Up:CObject ]

CObject: accessing

address
Answer the address the receiver is pointing to.


address: anInteger
Set the receiver to point to the passed address, anInteger


printOn: aStream
Print a representation of the receiver


type: aCType
Set the receiver's type to aCType.


value
What can I return? So fail


value: anObject
What can I set? So fail


[ Next: | Previous:CObject-accessing | Up:CObject ]

CObject: C data access

at: byteOffset put: aValue type: aType
Store aValue as data of the given type from byteOffset bytes after the pointer stored in the receiver


at: byteOffset type: aType
Answer some data of the given type from byteOffset bytes after the pointer stored in the receiver


free
Free the receiver's pointer and set it to null. Big trouble hits you if the receiver doesn't point to the base of a malloc-ed area.


[ Next: | Previous:CObject-C data access | Up:CObject ]

CObject: conversion

castTo: aType
Answer another CObject, pointing to the same address as the receiver, but belonging to the aType CType.


scalarIndex
Nothing special in the default case - answer the receiver's CType


type
Answer a CType for the receiver


[ Previous:CObject-conversion | Up:CObject ]

CObject: finalization

finalize
To make the VM call this, use #addToBeFinalized. It frees automatically any memory pointed to by the CObject. It is not automatically enabled because big trouble hits you if you use #free and the receiver doesn't point to the base of a malloc-ed area.


[Up: Class Index]

Collection

Category: Collections
I am an abstract class. My instances are collections of objects. My subclasses may place some restrictions or add some definitions to how the objects are stored or organized; I say nothing about this. I merely provide some object creation and access routines for general collections of objects.


[ Next: | Up:Collection ]

Collection class: instance creation

with: anObject
Answer a collection whose only element is anObject


with: firstObject with: secondObject
Answer a collection whose only elements are the parameters in the order they were passed


with: firstObject with: secondObject with: thirdObject
Answer a collection whose only elements are the parameters in the order they were passed


with: firstObject with: secondObject with: thirdObject with: fourthObject
Answer a collection whose only elements are the parameters in the order they were passed


withAll: aCollection
Answer a collection whose elements are all those in aCollection


[ Next: | Previous:Collection class-instance creation | Up:Collection ]

Collection: Adding to a collection

add: newObject
Add newObject to the receiver, answer it


addAll: aCollection
Adds all the elements of 'aCollection' to the receiver, answer aCollection


[ Next: | Previous:Collection-Adding to a collection | Up:Collection ]

Collection: converting

asArray
Answer an Array containing all the elements in the receiver


asBag
Answer a Bag containing all the elements in the receiver


asByteArray
Answer a ByteArray containing all the elements in the receiver


asOrderedCollection
Answer an OrderedCollection containing all the elements in the receiver


asRunArray
Answer the receiver converted to a RunArray. If the receiver is not ordered the order of the elements in the RunArray might not be the #do: order.


asSet
Answer a Set containing all the elements in the receiver with no duplicates


asSortedCollection
Answer a SortedCollection containing all the elements in the receiver with the default sort block - [ :a :b | a <= b ]


asSortedCollection: aBlock
Answer a SortedCollection whose elements are the elements of the receiver, sorted according to the sort block aBlock


[ Next: | Previous:Collection-converting | Up:Collection ]

Collection: copying Collections

copyReplacing: targetObject withObject: newObject
Copy replacing each object which is = to targetObject with newObject


copyWith: newElement
Answer a copy of the receiver to which newElement is added


copyWithout: oldElement
Answer a copy of the receiver to which all occurrences of oldElement are removed


[ Next: | Previous:Collection-copying Collections | Up:Collection ]

Collection: enumerating the elements of a collection

allSatisfy: aBlock
Search the receiver for an element for which aBlock returns false. Answer true if none does, false otherwise.


anyOne
Answer an unspecified element of the collection. Example usage: ^coll inject: coll anyOne into: [ :max :each | max max: each ] to be used when you don't have a valid lowest-possible-value (which happens in common cases too, such as with arbitrary numbers


anySatisfy: aBlock
Search the receiver for an element for which aBlock returns true. Answer true if some does, false otherwise.


collect: aBlock
Answer a new instance of a Collection containing all the results of evaluating aBlock passing each of the receiver's elements


conform: aBlock
Search the receiver for an element for which aBlock returns false. Answer true if none does, false otherwise.


contains: aBlock
Search the receiver for an element for which aBlock returns true. Answer true if some does, false otherwise.


detect: aBlock
Search the receiver for an element for which aBlock returns true. If some does, answer it. If none does, fail


detect: aBlock ifNone: exceptionBlock
Search the receiver for an element for which aBlock returns true. If some does, answer it. If none does, answer the result of evaluating aBlock


do: aBlock
Enumerate each object of the receiver, passing them to aBlock


do: aBlock separatedBy: separatorBlock
Enumerate each object of the receiver, passing them to aBlock. Between every two invocations of aBlock, invoke separatorBlock


inject: thisValue into: binaryBlock
Pass to binaryBlock receiver thisValue and the first element of the receiver; for each subsequent element, pass the result of the previous evaluation and an element. Answer the result of the last invocation.


reject: aBlock
Answer a new instance of a Collection containing all the elements in the receiver which, when passed to aBlock, don't answer true


select: aBlock
Answer a new instance of a Collection containing all the elements in the receiver which, when passed to aBlock, answer true


[ Next: | Previous:Collection-enumerating the elements of a collection | Up:Collection ]

Collection: printing

inspect
Print all the instance variables and objects in the receiver on the Transcript


printOn: aStream
Print a representation of the receiver on aStream


[ Next: | Previous:Collection-printing | Up:Collection ]

Collection: Removing from a collection

remove: oldObject
Remove oldObject from the receiver. If absent, fail, else answer oldObject.


remove: oldObject ifAbsent: anExceptionBlock
Remove oldObject from the receiver. If absent, evaluate anExceptionBlock and answer the result, else answer oldObject.


removeAll: aCollection
Remove each object in aCollection, answer aCollection, fail if some of them is absent. Warning: this could leave the collection in a semi-updated state.


removeAll: aCollection ifAbsent: aBlock
Remove each object in aCollection, answer aCollection; if some element is absent, pass it to aBlock.


[ Next: | Previous:Collection-Removing from a collection | Up:Collection ]

Collection: storing

storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


[ Previous:Collection-storing | Up:Collection ]

Collection: testing collections

capacity
Answer how many elements the receiver can hold before having to grow.


includes: anObject
Answer whether we include anObject


isEmpty
Answer whether we are (still) empty


notEmpty
Answer whether we include at least one object


occurrencesOf: anObject
Answer how many occurrences of anObject we include


size
Answer how many objects we include


[Up: Class Index]

CompiledMethod

Category: Language-Implementation
I represent methods that have been compiled. I can recompile methods from their source code, I can invoke Emacs to edit the source code for one of my instances, and I know how to access components of my instances.


[ Next: | Up:CompiledMethod ]

CompiledMethod class: instance creation

literals: lits numArgs: numArg numTemps: numTemp
primitive: primIndex bytecodes: bytecodes depth: depth Answer a full fledged CompiledMethod. Construct the method header from the parameters, and set the literals and bytecodes to the provided ones.


newMethod: numBytecodes header: anInteger literals: literals
Answer a new CompiledMethod with room for the given bytes and the given header


newMethod: numBytecodes header: anInteger numLiterals: numLiterals
Answer a new CompiledMethod with room for the given bytes and the given header


[ Next: | Previous:CompiledMethod class-instance creation | Up:CompiledMethod ]

CompiledMethod class: lean images

stripSourceCode
Remove all the references to method source code from the system


[ Next: | Previous:CompiledMethod class-lean images | Up:CompiledMethod ]

CompiledMethod: accessing

bytecodeAt: anIndex
Answer the anIndex-th bytecode


bytecodeAt: anIndex put: aValue
Store aValue as the anIndex-th bytecode


flags
Private - Answer the optimization flags for the receiver


literalAt: anIndex
Answer the anIndex-th literal


literalAt: anInteger put: aValue
Store aValue as the anIndex-th literal


literals
Not commented.


numArgs
Answer the number of arguments for the receiver


numLiterals
Answer the number of literals for the receiver


numTemps
Answer the number of temporaries for the receiver


primitive
Answer the primitive called by the receiver


stackDepth
Answer the number of stack slots needed for the receiver


[ Next: | Previous:CompiledMethod-accessing | Up:CompiledMethod ]

CompiledMethod: basic

= aMethod
Answer whether the receiver and aMethod are equal


hash
Answer an hash value for the receiver


methodCategory
Answer the method category


methodCategory: aCategory
Set the method category to the given string


methodSourceCode
Answer the method source code (a FileSegment or String or nil)


methodSourceFile
Answer the file where the method source code is stored


methodSourcePos
Answer the location where the method source code is stored in the methodSourceFile


methodSourceString
Answer the method source code as a string


[ Next: | Previous:CompiledMethod-basic | Up:CompiledMethod ]

CompiledMethod: copying

copy
Answer a shallow copy of the receiver


deepCopy
Answer a deep copy of the receiver


shallowCopy
Answer a shallow copy of the receiver


[ Next: | Previous:CompiledMethod-copying | Up:CompiledMethod ]

CompiledMethod: debugging

breakAtLine: lineNumber
This method's functionality has not been implemented yet.


breakpointAt: byteIndex
Put a break-point at the given bytecode


inspect
Print the contents of the receiver in a verbose way.


removeBreakpointAt: byteIndex
Remove the break-point at the given bytecode (don't fail if none was set


[ Next: | Previous:CompiledMethod-debugging | Up:CompiledMethod ]

CompiledMethod: printing

printOn: aStream
Print the receiver's source code on aStream


storeOn: aStream
Print code to create the receiver on aStream


[ Previous:CompiledMethod-printing | Up:CompiledMethod ]

CompiledMethod: testing accesses

accesses: instVarIndex
Answer whether the receiver access the instance variable with the given index


containsLiteral: anObject
Answer if the receiver contains a literal which is equal to anObject.


refersTo: anObject
Answer whether the receiver refers to the given object


[Up: Class Index]

ContextPart

Category: Language-Implementation
My instances represent executing Smalltalk code, which represent the local environment of executable code. They contain a stack and also provide some methods that can be used in inspection or debugging.


[ Next: | Up:ContextPart ]

ContextPart class: exception handling

backtrace
Print a backtrace from the caller to the bottom of the stack on the Transcript


backtraceOn: aStream
Print a backtrace from the caller to the bottom of the stack on aStream


lastUnwindPoint
Private - Return the last context marked as an unwind point, or our en- vironment if the last unwind point belongs to another environment.


removeLastUnwindPoint
Private - Return and remove the last context marked as an unwind point, or our environment if the last unwind point belongs to another environment.


unwind
Return execution to the last context marked as an unwind point, returning nil on that stack.


unwind: returnValue
Return execution to the last context marked as an unwind point, returning returnValue on that stack.


unwindPoints
Answer an OrderedCollection of contexts marked as unwind points.


[ Next: | Previous:ContextPart class-exception handling | Up:ContextPart ]

ContextPart: accessing

environment
To create a valid execution environment for the interpreter even before it starts, GST creates a fake context whose selector is nil and which can be used as a marker for the current execution environment. This method answers that context. For processes, it answers the process block itself


hasBlock
Answer whether the receiver is the outer context for a BlockContext


home
Answer the MethodContext to which the receiver refers


ip
Answer the current instruction pointer into the receiver


ip: newIP
Set the instruction pointer for the receiver


isBlock
Answer whether the receiver is a block context


isProcess
Answer whether the receiver represents a process context, i.e. a context created by BlockClosure>>#newProcess. Such a context can be recognized because it has no parent but its selector is not nil, unlike the contexts created by the VM's prepareExecutionEnvironment function.


method
Return the CompiledMethod being executed


parentContext
Answer the context that called the receiver


receiver
Return the receiver (self) for the method being executed


selector
Return the selector for the method being executed


size
Answer the number of valid fields for the receiver. Any read access from (self size + 1) to (self basicSize) has undefined results - even crashing


sp
Answer the current stack pointer into the receiver


sp: newSP
Set the stack pointer for the receiver


validSize
Answer how many elements in the receiver should be inspected


[ Next: | Previous:ContextPart-accessing | Up:ContextPart ]

ContextPart: built ins

blockCopy: numArgs temporaries: numTemps
Generate a BlockClosure starting execution two bytecodes after the end of the 'send special message #blockCopy:' bytecode


[ Next: | Previous:ContextPart-built ins | Up:ContextPart ]

ContextPart: exception handling

mark
Add the receiver as a possible unwind point


returnTo: aContext
Set the context to which the receiver will return


unmark
Remove the receiver from the contexts to which an unwind operation might return


[ Next: | Previous:ContextPart-exception handling | Up:ContextPart ]

ContextPart: printing

backtrace
Print a backtrace from the receiver to the bottom of the stack on the Transcript.


backtraceOn: aStream
Print a backtrace from the caller to the bottom of the stack on aStream.


[ Previous:ContextPart-printing | Up:ContextPart ]

ContextPart: processes

nowHasBlock
Private - Tell the VM that the receiver has references in other objects


[Up: Class Index]

CPtr

Category: Language-C interface


[ Up:CPtr ]

CPtr: accessing

alignof
Answer the receiver's required aligment


sizeof
Answer the receiver's size


[Up: Class Index]

CPtrCType

Category: Language-C interface


[ Next: | Up:CPtrCType ]

CPtrCType class: instance creation

elementType: aCType
Answer a new instance of CPtrCType that maps pointers to the given CType


[ Previous:CPtrCType class-instance creation | Up:CPtrCType ]

CPtrCType: accessing

elementType
Answer the type of the elements in the receiver's instances


[Up: Class Index]

CScalar

Category: Language-C interface


[ Next: | Up:CScalar ]

CScalar class: instance creation

type
Answer a CType for the receiver - for example, CByteType if the receiver is CByte.


value: anObject
Answer a newly allocated CObject containing the passed value, anObject. Remember to call #addToBeFinalized if you want the CObject to be automatically freed


[ Previous:CScalar class-instance creation | Up:CScalar ]

CScalar: accessing

value
Answer the value the receiver is pointing to. The exact returned value depends on the receiver's class


value: aValue
Set the receiver to point to the value, aValue. The exact meaning of aValue depends on the receiver's class


[Up: Class Index]

CScalarCType

Category: Language-C interface


[ Next: | Up:CScalarCType ]

CScalarCType: accessing

valueType
valueType is used as a means to communicate to the interpreter the underlying type of the data. For scalars, it is supplied by the CObject subclass.


[ Previous:CScalarCType-accessing | Up:CScalarCType ]

CScalarCType: storing

storeOn: aStream
Store Smalltalk code that compiles to the receiver


[Up: Class Index]

CShort

Category: Language-C interface


[ Next: | Up:CShort ]

CShort class: accessing

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's instances size


[ Previous:CShort class-accessing | Up:CShort ]

CShort: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's size


[Up: Class Index]

CSmalltalk

Category: Language-C interface


[ Next: | Up:CSmalltalk ]

CSmalltalk class: accessing

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's instances size


[ Previous:CSmalltalk class-accessing | Up:CSmalltalk ]

CSmalltalk: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's size


[Up: Class Index]

CString

Category: Language-C interface
Technically, CString is really a pointer to type char. However, it's so darn useful as a distinct datatype, and it is a separate datatype in Smalltalk, so we allow developers to express their semantics more precisely by using a more descriptive type.

In general, I behave like a cross between an array of characters and a pointer to a character. I provide the protocol for both data types. My #value method returns a Smalltalk String, as you would expect for a scalar datatype.


[ Next: | Up:CString ]

CString class: getting info

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's size


[ Next: | Previous:CString class-getting info | Up:CString ]

CString: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's size


[ Previous:CString-accessing | Up:CString ]

CString: pointer like behavior

+ anInteger
Return another CString pointing at &receiver[anInteger] (or, if you prefer, what `receiver + anInteger' does in C).


- intOrPtr
If intOrPtr is an integer, return another CString pointing at &receiver[-anInteger] (or, if you prefer, what `receiver - anInteger' does in C). If it is a CString, return the difference in chars, i.e. in bytes, between the two pointed addresses (or, if you prefer, what `receiver - anotherCharPtr' does in C)


addressAt: anIndex
Access the string, returning a Smalltalk CChar corresponding to the given indexed element of the string. anIndex is zero-based, just like with all other C-style accessing.


at: anIndex
Access the string, returning the Smalltalk Character corresponding to the given indexed element of the string. anIndex is zero-based, just like with all other C-style accessing.


at: anIndex put: aCharacter
Store in the string a Smalltalk Character, at the given indexed element of the string. anIndex is zero-based, just like with all other C-style accessing.


decr
Adjust the pointer by one byte down (i.e. -receiver)


decrBy: anInteger
Adjust the pointer by anInteger bytes down (i.e. receiver -= anInteger). Note that, unlike #-, #decrBy: does not support passing another CString as its parameter, since neither C supports something like `charPtr -= anotherCharPtr'


deref
Access the string, returning the Smalltalk CChar corresponding to the first element of the string. This may not make much sense, but it resembles what `*string' does in C.


deref: aCChar
Access the string, setting the first element of the string to the value of the passed CChar. This may not make much sense, but it resembles what we get in C if we do *string = 's'.


incr
Adjust the pointer by one byte up (i.e. ++receiver)


incrBy: anInteger
Adjust the pointer by anInteger bytes up (i.e. receiver += anInteger)


replaceWith: aString
Overwrite memory starting at the receiver's address, with the contents of the Smalltalk String aString, null-terminating it. Ensure there is free space enough, or big trouble will hit you!


[Up: Class Index]

CStruct

Category: Language-C interface


[ Next: | Up:CStruct ]

CStruct class: instance creation

new
Allocate a new instance of the receiver. To free the memory after GC, remember to call #addToBeFinalized.


type
Answer a CType for the receiver


[ Next: | Previous:CStruct class-instance creation | Up:CStruct ]

CStruct class: subclass creation

compileSize: size align: alignment for: aClass
Private - Compile sizeof and alignof methods


computeAggregateType: type block: aBlock
Private - Called by computeTypeString:block: for pointers/arrays. Format of type: (array int 3) or (ptr FooStruct)


computeArrayType: type block: aBlock
Private - Called by computeAggregateType:block: for arrays


computePtrType: type block: aBlock
Private - Called by computeAggregateType:block: for pointers


computeTypeString: type block: aBlock
Private - Pass the size, alignment, and description of CType for aBlock, given the field description in `type' (the second element of each pair).


emitInspectTo: str for: name
Private - Emit onto the given stream the code for adding the given selector to the CStruct's inspector.


initialize
Initialize the receiver's TypeMap


newStruct: structName declaration: array
Create a new class with the given name that contains code to implement the given C struct - see documentation for more information


[ Previous:CStruct class-subclass creation | Up:CStruct ]

CStruct: instance creation

inspect
Inspect the contents of the receiver


inspectSelectorList
Answer a list of selectors whose return values should be inspected by #inspect.


[Up: Class Index]

CType

Category: Language-C interface
I am not part of the standard Smalltalk kernel class hierarchy. I contain type information used by subclasses of CObject, which represents external C data items.

My subclasses have instances which represent the actual data types; for the scalar types, there is only one instance created of each, but for the aggregate types, there is at least one instance per base type and/or number of elements.


[ Next: | Up:CType ]

CType class: C instance creation

cObjectType: aCObjectSubclass
Create a new CType for the given subclass of CObject


[ Next: | Previous:CType class-C instance creation | Up:CType ]

CType: accessing

alignof
Answer the size of the receiver's instances


cObjectType
Answer the CObject subclass whose instance is created when new is sent to the receiver


sizeof
Answer the size of the receiver's instances


valueType
valueType is used as a means to communicate to the interpreter the underlying type of the data. For anything but scalars, it's just 'self'


[ Next: | Previous:CType-accessing | Up:CType ]

CType: C instance creation

new
Allocate a new CObject with the type (class) identified by the receiver. It is the caller's responsibility to free the memory allocated for it.


new: cObjOrInt
Create a new CObject with the type (class) identified by the receiver, pointing to the given address (identified by an Integer or CObject).


[ Previous:CType-C instance creation | Up:CType ]

CType: storing

storeOn: aStream
Store Smalltalk code that compiles to the receiver


[Up: Class Index]

CUChar

Category: Language-C interface


[ Next: | Up:CUChar ]

CUChar class: getting info

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's instances size


[ Previous:CUChar class-getting info | Up:CUChar ]

CUChar: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's size


[Up: Class Index]

CUInt

Category: Language-C interface


[ Next: | Up:CUInt ]

CUInt class: accessing

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's instances size


[ Previous:CUInt class-accessing | Up:CUInt ]

CUInt: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's size


[Up: Class Index]

CULong

Category: Language-C interface


[ Next: | Up:CULong ]

CULong class: accessing

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's instances size


[ Previous:CULong class-accessing | Up:CULong ]

CULong: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's size


[Up: Class Index]

CUShort

Category: Language-C interface


[ Next: | Up:CUShort ]

CUShort class: accessing

alignof
Answer the receiver's instances required aligment


scalarIndex
Private - Answer an index referring to the receiver's instances scalar type


sizeof
Answer the receiver's instances size


[ Previous:CUShort class-accessing | Up:CUShort ]

CUShort: accessing

alignof
Answer the receiver's required aligment


scalarIndex
Private - Answer an index referring to the receiver's scalar type


sizeof
Answer the receiver's size


[Up: Class Index]

Date

Category: Language-Data types
My instances represent dates. My base date is defined to be Jan 1, 1901. I provide methods for instance creation (including via "symbolic" dates, such as "Date newDay: 14 month: #Feb year: 1990".

PLEASE BE WARNED - use this class only for dates after 1582 AD; that's the beginning of the epoch. Dates before 1582 will not be correctly printed. In addition, since ten days were lost from October 5 through October 15, operations between a Gregorian date (after 15-Oct-1582) and a Julian date (before 5-Oct-1582) will give incorrect results; or, 4-Oct-1582 + 2 days will yield 6-Oct-1582 (a non-existent day!), not 16-Oct-1582.

In fact, if you pass a year < 1582 to a method like #newDay:month:year: it will assume that it is a two-digit year (e.g. 90=1990, 1000=2900). The only way to create Julian calendar dates is with the #fromDays: instance creation method.


[ Next: | Up:Date ]

Date class: basic

dateAndTimeNow
Answer an array containing the current date and time


dayOfWeek: dayName
Answer the index of the day of week corresponding to the given name


daysInMonth: monthName forYear: yearInteger
Answer the number of days in the given (named) month for the given year


daysInYear: yearInteger
Answer the number of days in the given year


indexOfMonth: monthName
Answer the index of the month corresponding to the given name


initDayNameDict
Initialize the DayNameDict to the names of the days


initialize
Initialize the receiver


initMonthNameDict
Initialize the MonthNameDict to the names of the months


nameOfDay: dayIndex
Answer the name of the day of week corresponding to the given index


nameOfMonth: monthIndex
Answer the name of the month corresponding to the given index


shortNameOfMonth: monthIndex
Answer the name of the month corresponding to the given index


[ Next: | Previous:Date class-basic | Up:Date ]

Date class: instance creation

fromDays: dayCount
Answer a Date denoting dayCount days past 1/1/1901


fromJulian: jd
Answer a Date denoting the jd-th day in the astronomical Julian calendar.


fromSeconds: time
Answer a Date denoting the date time seconds past Jan 1st, 2000


newDay: day month: monthName year: yearInteger
Answer a Date denoting the dayCount day of the given (named) month and year


newDay: day monthIndex: monthIndex year: yearInteger
Answer a Date denoting the dayCount day of the given (as a number) month and year


newDay: dayCount year: yearInteger
Answer a Date denoting the dayCount day of the yearInteger year


today
Answer a Date denoting the current date


[ Next: | Previous:Date class-instance creation | Up:Date ]

Date: basic

addDays: dayCount
Answer a new Date pointing dayCount past the receiver


subtractDate: aDate
Answer the number of days between aDate and the receiver (negative if the receiver is before aDate)


subtractDays: dayCount
Answer a new Date pointing dayCount before the receiver


[ Next: | Previous:Date-basic | Up:Date ]

Date: date computations

asSeconds
Answer the date as the number of seconds from 1/1/1901.


day
Answer the day represented by the receiver


dayName
Answer the day of week of the receiver as a Symbol


dayOfWeek
Answer the day of week of the receiver. 1 = Monday, 7 = Sunday


dayOfYear
Answer the days passed since 31/12 of last year; e.g. New Year's Day is 1


daysFromBaseDay
Answer the days passed since 1/1/1901


daysInMonth
Answer the days in the month represented by the receiver


daysInYear
Answer the days in the year represented by the receiver


daysLeftInMonth
Answer the days to the end of the month represented by the receiver


daysLeftInYear
Answer the days to the end of the year represented by the receiver


firstDayOfMonth
Answer a Date representing the first day of the month represented by the receiver


lastDayOfMonth
Answer a Date representing the last day of the month represented by the receiver


month
Answer the month represented by the receiver


monthName
Answer the name of the month represented by the receiver


year
Answer the year represented by the receiver


[ Next: | Previous:Date-date computations | Up:Date ]

Date: printing

printOn: aStream
Print a representation for the receiver on aStream


[ Next: | Previous:Date-printing | Up:Date ]

Date: storing

storeOn: aStream
Store on aStream Smalltalk code compiling to the receiver


[ Previous:Date-storing | Up:Date ]

Date: testing

< aDate
Answer whether the receiver indicates a date preceding aDate


= aDate
Answer whether the receiver indicates the same date as aDate


hash
Answer an hash value for the receievr


[Up: Class Index]

Delay

Category: Language-Processes
I am the ultimate agent for frustration in the world. I cause things to wait (typically much more than is appropriate, but it is those losing operating system's fault). When a process sends one of my instances a wait message, that process goes to sleep for the interval specified when the instance was created.


[ Next: | Up:Delay ]

Delay class: general inquiries

millisecondClockValue
Private - Answer the number of milliseconds since midnight


[ Next: | Previous:Delay class-general inquiries | Up:Delay ]

Delay class: initialization

initialize
Private - Initialize the receiver and the associated process


[ Next: | Previous:Delay class-initialization | Up:Delay ]

Delay class: instance creation

forMilliseconds: millisecondCount
Answer a Delay waiting for millisecondCount milliseconds


forSeconds: secondCount
Answer a Delay waiting for secondCount seconds


untilMilliseconds: millisecondCount
Answer a Delay waiting for millisecondCount milliseconds after midnight


[ Next: | Previous:Delay class-instance creation | Up:Delay ]

Delay: accessing

resumptionTime
Answer the time when a process waiting on a Delay will resume


[ Next: | Previous:Delay-accessing | Up:Delay ]

Delay: comparing

= aDelay
Answer whether the receiver and aDelay denote the same delay


hash
Answer an hash value for the receiver


[ Previous:Delay-comparing | Up:Delay ]

Delay: process delay

wait
Wait until the amount of time represented by the instance of Delay elapses


[Up: Class Index]

DelayedAdaptor

Category: Language-Data types
I can be used where many expensive updates must be performed. My in- stances buffer the last value that was set, and only actually set the value when the #trigger message is sent. Apart from this, I'm equi- valent to PluggableAdaptor.


[ Up:DelayedAdaptor ]

DelayedAdaptor: accessing

trigger
Really set the value of the receiver.


value
Get the value of the receiver.


value: anObject
Set the value of the receiver - actually, the value is cached and is not set until the #trigger method is sent.


[Up: Class Index]

Dictionary

Category: Collections-Keyed
I implement a dictionary, which is an object that is indexed by unique objects (typcially instances of Symbol), and associates another object with that index. I use the equality operator = to determine equality of indices.


[ Next: | Up:Dictionary ]

Dictionary class: instance creation

new
Create a new dictionary with a default size


[ Next: | Previous:Dictionary class-instance creation | Up:Dictionary ]

Dictionary: accessing

add: newObject
Add the newObject association to the receiver


associationAt: key
Answer the key/value Association for the given key. Fail if the key is not found


associationAt: key ifAbsent: aBlock
Answer the key/value Association for the given key. Evaluate aBlock (answering the result) if the key is not found


at: key
Answer the value associated to the given key. Fail if the key is not found


at: key ifAbsent: aBlock
Answer the value associated to the given key, or the result of evaluating aBlock if the key is not found


at: aKey ifAbsentPut: aBlock
Answer the value associated to the given key. If the key is not found, evaluate aBlock and associate the result to aKey before returning.


at: aKey ifPresent: aBlock
If aKey is absent, answer nil. Else, evaluate aBlock passing the associated value and answer the result of the invocation


at: key put: value
Store value as associated to the given key


keyAtValue: value
Answer the key associated to the given value. Evaluate exceptionBlock (answering the result) if the value is not found


keyAtValue: value ifAbsent: exceptionBlock
Answer the key associated to the given value. Evaluate exceptionBlock (answering the result) if the value is not found. IMPORTANT: == is used to compare values


keys
Answer a kind of Set containing the keys of the receiver


values
Answer a Bag containing the values of the receiver


[ Next: | Previous:Dictionary-accessing | Up:Dictionary ]

Dictionary: awful ST-80 compatibility hacks

findKeyIndex: key
Tries to see if key exists as a the key of an indexed variable. As soon as nil or an association with the correct key is found, the index of that slot is answered


[ Next: | Previous:Dictionary-awful ST-80 compatibility hacks | Up:Dictionary ]

Dictionary: dictionary enumerating

associationsDo: aBlock
Pass each association in the dictionary to aBlock


collect: aBlock
Answer a new dictionary where the keys are the same and the values are obtained by passing each value to aBlock and collecting the return values


do: aBlock
Pass each value in the dictionary to aBlock


keysAndValuesDo: aBlock
Pass each key/value pair in the dictionary as two distinct parameters to aBlock


keysDo: aBlock
Pass each key in the dictionary to aBlock


reject: aBlock
Answer a new dictionary containing the key/value pairs for which aBlock returns false. aBlock only receives the value part of the pairs.


select: aBlock
Answer a new dictionary containing the key/value pairs for which aBlock returns true. aBlock only receives the value part of the pairs.


[ Next: | Previous:Dictionary-dictionary enumerating | Up:Dictionary ]

Dictionary: dictionary removing

remove: anObject
This method should not be called for instances of this class.


remove: anObject ifAbsent: aBlock
This method should not be called for instances of this class.


removeAllKeys: keys
Remove all the keys in keys, without raising any errors


removeAllKeys: keys ifAbsent: aBlock
Remove all the keys in keys, passing the missing keys as parameters to aBlock as they're encountered


removeAssociation: anAssociation
Remove anAssociation's key from the dictionary


removeKey: key
Remove the passed key from the dictionary, fail if it is not found


removeKey: key ifAbsent: aBlock
Remove the passed key from the dictionary, answer the result of evaluating aBlock if it is not found


[ Next: | Previous:Dictionary-dictionary removing | Up:Dictionary ]

Dictionary: dictionary testing

includes: anObject
Answer whether the receiver contains anObject as one of its values


includesAssociation: anAssociation
Answer whether the receiver contains the key which is anAssociation's key and its value is anAssociation's value


includesKey: key
Answer whether the receiver contains the given key


occurrencesOf: aValue
Answer whether the number of occurrences of aValue as one of the receiver's values


[ Next: | Previous:Dictionary-dictionary testing | Up:Dictionary ]

Dictionary: printing

printOn: aStream
Print a representation of the receiver on aStream


[ Next: | Previous:Dictionary-printing | Up:Dictionary ]

Dictionary: storing

storeOn: aStream
Print Smalltalk code compiling to the receiver on aStream


[ Previous:Dictionary-storing | Up:Dictionary ]

Dictionary: testing

= aDictionary
Answer whether the receiver and aDictionary are equal


hash
Answer the hash value for the receiver


[Up: Class Index]

DirectedMessage

Category: Language-Implementation
I represent a message send: I contain the receiver, selector and arguments for a message.


[ Next: | Up:DirectedMessage ]

DirectedMessage class: creating instances

selector: aSymbol arguments: anArray
This method should not be called for instances of this class.


selector: aSymbol arguments: anArray receiver: anObject
Create a new instance of the receiver


[ Next: | Previous:DirectedMessage class-creating instances | Up:DirectedMessage ]

DirectedMessage: accessing

receiver
Answer the receiver


receiver: anObject
Change the receiver


[ Previous:DirectedMessage-accessing | Up:DirectedMessage ]

DirectedMessage: basic

printOn: aStream
Print a representation of the receiver on aStream


send
Send the message


[Up: Class Index]

Directory

Category: Streams-Files


[ Next: | Up:Directory ]

Directory class: C functions

primRemove: fileName
C call-out to rmdir. Do not modify!


primWorking: dirName
C call-out to chdir. Do not modify!


working
C call-out to getCurDirName. Do not modify!


[ Next: | Previous:Directory class-C functions | Up:Directory ]

Directory class: file operations

working: dirName
Change the current working directory to dirName.


[ Next: | Previous:Directory class-file operations | Up:Directory ]

Directory class: reading system defaults

home
Answer the path to the user's home directory


image
Answer the path to GNU Smalltalk's image file


kernel
Answer the path to the GNU Smalltalk kernel's Smalltalk source files


[ Next: | Previous:Directory class-reading system defaults | Up:Directory ]

Directory: accessing

contents
Answer an Array with the names of the files in the directory represented by the receiver.


do: aBlock
Evaluate aBlock once for each file in the directory represented by the receiver, passing its name.


[ Previous:Directory-accessing | Up:Directory ]

Directory: C functions

extractDirentName: dirent
C call-out to extractDirentName. Do not modify!


readDir: dirObject
C call-out to readdir. Do not modify!


rewindDir: dirObject
C call-out to rewinddir. Do not modify!


[Up: Class Index]

DLD

Category: Language-C interface
...and Gandalf said: "Many folk like to know beforehand what is to be set on the table; but those who have laboured to prepare the feast like to keep their secret; for wonder makes the words of praise louder."

I am just an ancillary class used to reference some C functions. Most of my actual functionality is used by redefinitions of methods in CFunctionDescriptor and Behavior.


[ Next: | Up:DLD ]

DLD class: C functions

defineCFunc: aName as: aFuncAddr
C call-out to defineCFunc. Do not modify!


library: libHandle getFunc: aFuncString
C call-out to dldGetFunc. Do not modify!


linkFile: aFileName
C call-out to dldLink. Do not modify!


[ Previous:DLD class-C functions | Up:DLD ]

DLD class: Dynamic Linking

addLibrary: library
Add library to the search path of libraries to be used by DLD


defineExternFunc: aFuncName
This method calls #primDefineExternFunc: to try to link to a function with the given name, and answers whether the linkage was successful. You can redefine this method to restrict the ability to do dynamic linking.


defineExternFunc: aFuncName
withSelectorArgs: selector forClass: aClass returning: aReturnType args: argsArray Obsolete - Mantained for compatibility. This method does NOT look for statically linked functions.


initialize
Private - Initialize the receiver's class variables


libraryList
Answer a copy of the search path of libraries to be used by DLD


primDefineExternFunc: aFuncName
This method tries to link to a function with the given name, and answers whether the linkage was successful. It should not be overridden.


reset
Called on startup - Make DLD forget the handles of the libraries it used in the last session.


[Up: Class Index]

DumperProxy

Category: Streams-Files
I am an helper class for ObjectDumper. When an object cannot be saved in the standard way, you can register a subclass of me to provide special means to save that object.


[ Next: | Up:DumperProxy ]

DumperProxy class: instance creation

on: anObject
Answer a proxy to be used to save anObject. IMPORTANT: the newly constructed DumperProxy must NOT have anObject in one of its in- stance variable, because that would result in an infinite loop!


[ Previous:DumperProxy class-instance creation | Up:DumperProxy ]

DumperProxy: reconstructing

object
Reconstruct the object stored in the proxy and answer it


[Up: Class Index]

Exception

Category: Language-Exceptions
My instances describe a single event that can be trapped using #on:do:..., contain whether such execution can be resumed after such an event, a description of what happened, and a block that is used as an handler by default. Using my methods you can raise exceptions and create new exceptions. Exceptions are organized in a kind of hierarchy (different from the class hierarchy): intercepting an exception will intercept all its children too.


[ Next: | Up:Exception ]

Exception class: instance creation

new
Create a new exception whose parent is ExAll


[ Next: | Previous:Exception class-instance creation | Up:Exception ]

Exception: accessing

defaultHandler
Answer the default handler for the receiver


defaultHandler: aBlock
Set the default handler of the receiver to aBlock. A Signal object will be passed to aBlock


description
Answer a description of the receiver


description: aString
Set the description of the receiver to aString


isResumable
Answer true if the receiver is resumable


isResumable: aBoolean
Set the resumable flag of the receiver to aBoolean


parent
Answer the parent of the receiver


[ Next: | Previous:Exception-accessing | Up:Exception ]

Exception: basic

copy
Answer a copy of the receiver


[ Next: | Previous:Exception-basic | Up:Exception ]

Exception: enumerating

allExceptionsDo: aBlock
Private - Evaluate aBlock for every exception in the receiver. As it contains just one exception, evaluate it just once, passing the receiver


handles: exception
Answer whether the receiver handles `exception'.


[ Next: | Previous:Exception-enumerating | Up:Exception ]

Exception: exception handling

signal
Raise the exception described by the receiver, passing no parameters


signalWith: arg
Raise the exception described by the receiver, passing the parameter arg


signalWith: arg with: arg2
Raise the exception described by the receiver, passing the parameters arg and arg2


signalWithArguments: args
Raise the exception described by the receiver, passing the parameters in args


[ Previous:Exception-exception handling | Up:Exception ]

Exception: instance creation

newChild
Answer a child exception of the receiver. Its properties are set to those of the receiver


[Up: Class Index]

ExceptionCollection

Category: Language-Exceptions
My instances are not real exceptions: they can only be used as arguments to #on:do:... methods in BlockClosure. They act as shortcuts that allows you to use the same handler for many exceptions without having to write duplicate code


[ Next: | Up:ExceptionCollection ]

ExceptionCollection class: instance creation

new
Private - Answer a new, empty ExceptionCollection


[ Previous:ExceptionCollection class-instance creation | Up:ExceptionCollection ]

ExceptionCollection: enumerating

allExceptionsDo: aBlock
Private - Evaluate aBlock for every exception in the receiver. Answer the receiver


handles: exception
Answer whether the receiver handles `exception'.


[Up: Class Index]

ExceptionHandler

Category: Language-Exceptions
I am used internally by the exception handling system. My instances record the handler for an exception, the receiver of the #on:do:... method that established that handler, and a block that leaves that #on:do:... method


[ Next: | Up:ExceptionHandler ]

ExceptionHandler class: instance creation

onDoBlock: wdBlock exitBlock: eBlock handlerBlock: hBlock
Answer an ExceptionHandler instance with the given values for its instance variables.


[ Previous:ExceptionHandler class-instance creation | Up:ExceptionHandler ]

ExceptionHandler: accessing

exitBlock
Answer `exitBlock'.


handlerBlock
Answer `handlerBlock'.


isDisabled
Answer whether the receiver is disabled by a #valueWithUnwind.


onDoBlock
Answer `onDoBlock'.


onDoBlock: wdBlock exitBlock: eBlock handlerBlock: hBlock
Initialize the receiver's instance variables.


[Up: Class Index]

False

Category: Language-Data types
I always tell lies. I have a single instance in the system, which represents the value false.


[ Next: | Up:False ]

False: basic

& aBoolean
We are false - anded with anything, we always answer false


and: aBlock
We are false - anded with anything, we always answer false


eqv: aBoolean
Answer whether the receiver and aBoolean represent the same boolean value


ifFalse: falseBlock
We are false - evaluate the falseBlock


ifFalse: falseBlock ifTrue: trueBlock
We are false - evaluate the falseBlock


ifTrue: trueBlock
We are false - answer nil


ifTrue: trueBlock ifFalse: falseBlock
We are false - evaluate the falseBlock


not
We are false - answer true


or: aBlock
We are false - ored with anything, we always answer the other operand, so evaluate aBlock


xor: aBoolean
Answer whether the receiver and aBoolean represent different boolean values


| aBoolean
We are false - ored with anything, we always answer the other operand


[ Next: | Previous:False-basic | Up:False ]

False: C hacks

asCBooleanValue
Answer `0'.


[ Previous:False-C hacks | Up:False ]

False: printing

printOn: aStream
Print a representation of the receiver on aStream


[Up: Class Index]

File

Category: Streams-Files


[ Next: | Up:File ]

File class: C functions

errno
C call-out to errno. Do not modify!


primRemove: fileName
C call-out to unlink. Do not modify!


primRename: oldFileName to: newFileName
C call-out to rename. Do not modify!


[ Next: | Previous:File class-C functions | Up:File ]

File class: file operations

checkError
Return whether an error had been reported or not. If there had been one, raise an exception too


checkError: errno
The error with the C code `errno' has been reported. If errno >= 1, raise an exception


remove: fileName
Remove the file with the given path name


rename: oldFileName to: newFileName
Rename the file with the given path name oldFileName to newFileName


[ Next: | Previous:File class-file operations | Up:File ]

File class: initialization

initialize
Initialize the receiver's class variables


[ Next: | Previous:File class-initialization | Up:File ]

File class: instance creation

name: aName
Answer a new file with the given path. The path is not validated until some of the fields of the newly created objects are accessed


[ Next: | Previous:File class-instance creation | Up:File ]

File class: reading system defaults

image
Answer the full path to the image being used.


[ Next: | Previous:File class-reading system defaults | Up:File ]

File class: testing

exists: fileName
Answer whether a file with the given name exists


[ Next: | Previous:File class-testing | Up:File ]

File: accessing

creationTime
Answer the creation time of the file identified by the receiver. On some operating systems, this could actually be the last change time (the `last change time' has to do with permissions, ownership and the like).


lastAccessTime
Answer the last access time of the file identified by the receiver


lastChangeTime
Answer the last change time of the file identified by the receiver (the `last change time' has to do with permissions, ownership and the like). On some operating systems, this could actually be the file creation time.


lastModifyTime
Answer the last modify time of the file identified by the receiver (the `last modify time' has to do with the actual file contents).


name
Answer the name of the file identified by the receiver


refresh
Refresh the statistics for the receiver


size
Answer the size of the file identified by the receiver


[ Next: | Previous:File-accessing | Up:File ]

File: C functions

closeDir: dirObject
C call-out to closedir. Do not modify!


openDir: dirName
C call-out to opendir. Do not modify!


statOn: fileName into: statStruct
C call-out to stat. Do not modify!


[ Next: | Previous:File-C functions | Up:File ]

File: file operations

contents
Open a read-only FileStream on the receiver, read its contents, close the stream and answer the contents


open: mode
Open the receiver in the given mode (as answered by FileStream's class constant methods)


readStream
Open a read-only FileStream on the receiver


remove
Remove the file identified by the receiver


renameTo: newName
Remove the file identified by the receiver


writeStream
Open a write-only FileStream on the receiver


[ Previous:File-file operations | Up:File ]

File: testing

exists
Answer whether a file with the name contained in the receiver does exist.


isDirectory
Answer whether a file with the name contained in the receiver does exist and identifies a directory.


isFile
Answer whether a file with the name contained in the receiver does exist and does not identify a directory.


[Up: Class Index]

FileSegment

Category: Language-Implementation
My instances represent sections of files. I am primarily used by the compiler to record source code locations. I am not a part of the normal Smalltalk-80 kernel; I am specific to the GNU Smalltalk implementation.


[ Next: | Up:FileSegment ]

FileSegment class: basic

on: aFile startingAt: startPos for: lengthInteger
Create a new FileSegment referring to the contents of the given file, from the startPos-th byte and for lengthInteger bytes


[ Next: | Previous:FileSegment class-basic | Up:FileSegment ]

FileSegment: basic

asString
Answer a String containing the required segment of the file


fileName
Answer the name of the file containing the segment


filePos
Answer the position in the file where the segment starts


[ Previous:FileSegment-basic | Up:FileSegment ]

FileSegment: equality

= aFileSegment
Answer whether the receiver and aFileSegment are equal.


hash
Answer an hash value for the receiver.


[Up: Class Index]

FileStream

Category: Streams-Files
My instances are what conventional programmers think of as files. My instance creation methods accept the name of a disk file (or any named file object, such as /dev/rmt0 on UNIX or MTA0: on VMS).


[ Next: | Up:FileStream ]

FileStream class: basic

append
Open for writing. The file is created if it does not exist. The stream is positioned at the end of the file.


create
Open for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the beginning of the file.


new
This method should not be called for instances of this class.


open: fileName
Open fileName in read-write mode - fail if the file cannot be opened. Else answer a new FileStream. The file will be automatically closed upon GC if the object is not referenced anymore, but you should close it with #close anyway. To keep a file open, send it #removeToBeFinalized


open: fileName mode: fileMode
Open fileName in the required mode - answered by #append, #create, #readWrite, #read or #write - and fail if the file cannot be opened. Else answer a new FileStream. For mode anyway you can use any standard C non-binary fopen mode. The file will be automatically closed upon GC if the object is not referenced anymore, but it is better to close it as soon as you're finished with it anyway, using #close. To keep a file open even when no references exist anymore, send it #removeToBeFinalized


open: fileName mode: fileMode ifFail: aBlock
Open fileName in the required mode - answered by #append, #create, #readWrite, #read or #write - and evaluate aBlock if the file cannot be opened. Else answer a new FileStream. For mode anyway you can use any The file will be automatically closed upon GC if the object is not referenced anymore, but it is better to close it as soon as you're finished with it anyway, using #close. To keep a file open even when no references exist anymore, send it #removeToBeFinalized


popen: commandName dir: direction
Open a pipe on the given command and fail if the file cannot be opened. Else answer a new FileStream. The pipe will not be automatically closed upon GC, even if the object is not referenced anymore, because when you close a pipe you have to wait for the associated process to terminate. To enforce automatic closing of the pipe, send it #addToBeFinalized. direction is returned by #read or #write ('r' or 'w') and is interpreted from the point of view of Smalltalk: reading means Smalltalk reads the standard output of the command, writing means Smalltalk writes the standard input of the command. The other channel (stdin when reading, stdout when writing) is the same as GST's, unless commandName alters it.


popen: commandName dir: direction ifFail: aBlock
Open a pipe on the given command and evaluate aBlock file cannot be opened. Else answer a new FileStream. The pipe will not be automatically closed upon GC, even if the object is not referenced anymore, because when you close a pipe you have to wait for the associated process to terminate. To enforce automatic closing of the pipe, send it #addToBeFinalized. direction is interpreted from the point of view of Smalltalk: reading means that Smalltalk reads the standard output of the command, writing means that Smalltalk writes the standard input of the command


read
Open text file for reading. The stream is positioned at the beginning of the file.


readWrite
Open for reading and writing. The stream is positioned at the beginning of the file.


write
Truncate file to zero length or create text file for writing. The stream is positioned at the beginning of the file.


[ Next: | Previous:FileStream class-basic | Up:FileStream ]

FileStream class: file-in

fileIn: aFileName
File in the aFileName file


fileIn: aFileName ifMissing: aSymbol
Conditionally do a file in, only if the key (often a class) specified by 'aSymbol' is not present in the Smalltalk system dictionary already


fileIn: aFileName ifTrue: aBoolean
Conditionally do a file in, only if the supplied boolean is true


fileIn: aFileName line: lineInteger from: realFileName at: aCharPos
File in the aFileName file giving errors such as if it was loaded from the given line, file name and starting position (instead of 1)


generateMakefileOnto: aStream
Generate a make file for the file-ins since record was last set to true. Store it on aStream


record: recordFlag
Set whether Smalltalk should record information aboutnested file-ins. When recording is enabled, use #generateMakefileOnto: to automatically generate a valid makefile for the intervening file-ins.


require: assoc
Conditionally do a file in from the value of assoc, only if the key of assoc is not present in the Smalltalk system dictionary already


verbose: verboseFlag
Set whether Smalltalk should output debugging messages when filing in


[ Next: | Previous:FileStream class-file-in | Up:FileStream ]

FileStream class: initialization

initialize
Initialize the receiver's class variables


[ Next: | Previous:FileStream class-initialization | Up:FileStream ]

FileStream: accessing

isPipe
Return whether the file is a pipe or an actual disk file


name
Return the name of the file


[ Next: | Previous:FileStream-accessing | Up:FileStream ]

FileStream: basic

close
Close the file


contents
Answer the whole contents of the file


copyFrom: start to: end
Answer the contents of the file between the two given positions


finalize
Close the file if it is still open by the time the object becomes garbage.


flush
Flush the output buffer


next
Return the next character in the file, or nil at eof


nextByte
Return the next byte in the file, or nil at eof


nextPut: aChar
Store aChar on the file


nextPutByte: anInteger
Store aChar on the file


nextPutByteArray: aByteArray
Store aByteArray on the file


peek
Peek a character in the file, don't change the position


peekFor: aCharacter
Peek a character in the file, don't change the position


position
Return the position of the file pointer in the receiver


position: bytePosition
Set the position of the file pointer in the receiver


reset
Reset the stream to its beginning


size
Return the current size of the file, in bytes


[ Next: | Previous:FileStream-basic | Up:FileStream ]

FileStream: built ins

fileIn
File in the contents of the receiver


fileInLine: lineNum fileName: aString at: charPosInt
Private - Much like a preprocessor #line directive


fileOp: ioFuncIndex
Private - Used to limit the number of primitives used by FileStreams


fileOp: ioFuncIndex ifFail: aBlock
Private - Used to limit the number of primitives used by FileStreams.


fileOp: ioFuncIndex with: arg1
Private - Used to limit the number of primitives used by FileStreams


fileOp: ioFuncIndex with: arg1 ifFail: aBlock
Private - Used to limit the number of primitives used by FileStreams.


fileOp: ioFuncIndex with: arg1 with: arg2
Private - Used to limit the number of primitives used by FileStreams


fileOp: ioFuncIndex with: arg1 with: arg2 ifFail: aBlock
Private - Used to limit the number of primitives used by FileStreams.


[ Next: | Previous:FileStream-built ins | Up:FileStream ]

FileStream: class type methods

isBinary
We answer characters, so answer false


isText
We answer characters, so answer true


species
Answer `String'.


[ Next: | Previous:FileStream-class type methods | Up:FileStream ]

FileStream: overriding inherited methods

isEmpty
Answer whether the receiver is empty


next: anInteger
return the next 'anInteger' characters from the stream, as a String.


nextPutAll: aCollection
Put all the characters in aCollection in the file


reverseContents
Return the contents of the file from the last byte to the first


setToEnd
Reset the file pointer to the end of the file


skip: anInteger
Skip anInteger bytes in the file


[ Next: | Previous:FileStream-overriding inherited methods | Up:FileStream ]

FileStream: printing

printOn: aStream
Print a representation of the receiver on aStream


[ Previous:FileStream-printing | Up:FileStream ]

FileStream: testing

atEnd
Answer whether data has come to an end


[Up: Class Index]

Float

Category: Language-Data types
My instances represent floating point numbers that have 64 bits of precision (well, less than that in precision; they are precisely the same as C's "double" datatype). Besides the standard numerical operations, I provide transcendental operations too.


[ Next: | Up:Float ]

Float class: basic

e
Returns the value of e. Hope is that it is precise enough


epsilon
Return the smallest Float x for which is 1 + x ~= 1


infinity
Return a Float that represents positive infinity. I hope that it is big enough, IEEE 8 byte floating point values (C doubles) overflow at 1e308.


largest
Return the largest normalized Float that is not infinite.


log10Base2
Returns the value of log2 10. Hope is that it is precise enough


mantissaBits
Answer `53'.


nan
Return a Float that represents a mathematically indeterminate value (e.g. Inf - Inf, Inf / Inf)


negativeInfinity
Return a Float that represents negative infinity. I hope that it is big enough, IEEE 8 byte floating point values (C doubles) overflow at -1e308.


pi
Returns the value of pi. Hope is that it is precise enough


smallest
Return the smallest normalized Float that is not infinite.


smallestAbs
Return the smallest normalized Float that is > 0


[ Next: | Previous:Float class-basic | Up:Float ]

Float class: byte-order dependancies

exponentByte
Not commented.


leastSignificantMantissaByte
Not commented.


[ Next: | Previous:Float class-byte-order dependancies | Up:Float ]

Float class: converting

coerce: aNumber
Answer aNumber converted to a Float


[ Next: | Previous:Float class-converting | Up:Float ]

Float: arithmetic

// aNumber
Return the integer quotient of dividing the receiver by aNumber with truncation towards negative infinity.


\\ aNumber
Return the remainder of dividing the receiver by aNumber with truncation towards negative infinity.


integerPart
Return the receiver's integer part


[ Next: | Previous:Float-arithmetic | Up:Float ]

Float: built ins

* arg
Multiply the receiver and arg and answer another Number


+ arg
Sum the receiver and arg and answer another Number


- arg
Subtract arg from the receiver and answer another Number


/ arg
Divide the receiver by arg and answer another Float


< arg
Answer whether the receiver is less than arg


<= arg
Answer whether the receiver is less than or equal to arg


= arg
Answer whether the receiver is equal to arg


> arg
Answer whether the receiver is greater than arg


>= arg
Answer whether the receiver is greater than or equal to arg


arcCos
Answer the arc-cosine of the receiver


arcSin
Answer the arc-sine of the receiver


arcTan
Answer the arc-tangent of the receiver


ceiling
Answer the integer part of the receiver, truncated towards +infinity


cos
Answer the cosine of the receiver


exp
Answer 'e' (2.718281828459...) raised to the receiver


exponent
Answer the exponent of the receiver in mantissa*2^exponent representation ( |mantissa|<=1 )


floor
Answer the integer part of the receiver, truncated towards -infinity


fractionPart
Answer the fractional part of the receiver


ln
Answer the logarithm of the receiver in base 'e' (2.718281828459...)


raisedTo: aNumber
Answer the receiver raised to its aNumber power


sin
Answer the sine of the receiver


sqrt
Answer the square root of the receiver


tan
Answer the tangent of the receiver


timesTwoPower: arg
Answer the receiver multiplied by 2^arg


truncated
Truncate the receiver towards zero and answer the result


~= arg
Answer whether the receiver is not equal to arg


[ Next: | Previous:Float-built ins | Up:Float ]

Float: coercing

asExactFraction
Convert the receiver into a fraction with optimal approximation, but with usually huge terms.


asFloat
Just defined for completeness. Return the receiver.


asFraction
Convert the receiver into a fraction with a good (but undefined) approximation


coerce: aNumber
Coerce aNumber to the receiver's class


estimatedLog
Answer an estimate of (self abs floorLog: 10)


generality
Answer the receiver's generality


hash
Returns the hash value for the receiver (a Float). If it's representable as an integer, we use that value, since it's likely to be much more random, but if not, we scale the number so that it's within the integer range and then return the integer part


unity
Coerce 1 to the receiver's class


zero
Coerce 0 to the receiver's class


[ Next: | Previous:Float-coercing | Up:Float ]

Float: printing

printOn: aStream
Print a representation of the receiver on aStream


[ Next: | Previous:Float-printing | Up:Float ]

Float: storing

storeOn: aStream
Print a representation of the receiver on aStream


[ Next: | Previous:Float-storing | Up:Float ]

Float: testing

isInfinite
Answer whether the receiver represents positive or negative infinity


isNaN
Answer whether the receiver represents a NaN


negative
Answer whether the receiver is negative


positive
Answer whether the receiver is positive


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


strictlyPositive
Answer whether the receiver is > 0


[ Previous:Float-testing | Up:Float ]

Float: testing functionality

isFloat
Answer `true'.


[Up: Class Index]

Fraction

Category: Language-Data types
I represent rational numbers in the form (p/q) where p and q are integers. The arithmetic operations *, +, -, /, on fractions, all return a reduced fraction.


[ Next: | Up:Fraction ]

Fraction class: converting

coerce: aNumber
Answer aNumber converted to a Fraction


[ Next: | Previous:Fraction class-converting | Up:Fraction ]

Fraction class: instance creation

initialize
Initialize the receiver's class variables


numerator: nInteger denominator: dInteger
Answer a new instance of fraction (nInteger/dInteger)


[ Next: | Previous:Fraction class-instance creation | Up:Fraction ]

Fraction: accessing

denominator
Answer the receiver's denominator


numerator
Answer the receiver's numerator


[ Next: | Previous:Fraction-accessing | Up:Fraction ]

Fraction: arithmetic

* aNumber
Multiply two numbers and answer the result.


+ aNumber
Sum two numbers and answer the result.


- aNumber
Subtract aNumber from the receiver and answer the result.


/ aNumber
Divide the receiver by aNumber and answer the result.


// aNumber
Return the integer quotient of dividing the receiver by aNumber with truncation towards negative infinity.


\\ aNumber
Return the remainder from dividing the receiver by aNumber, (using //).


estimatedLog
Answer an estimate of (self abs floorLog: 10)


[ Next: | Previous:Fraction-arithmetic | Up:Fraction ]

Fraction: coercing

coerce: aNumber
Coerce aNumber to the receiver's class


generality
Return the receiver's generality


truncated
Truncate the receiver and return the truncated result


unity
Coerce 1 to the receiver's class


zero
Coerce 0 to the receiver's class


[ Next: | Previous:Fraction-coercing | Up:Fraction ]

Fraction: comparing

< arg
Test if the receiver is less than arg.


<= arg
Test if the receiver is less than or equal to arg.


= arg
Test if the receiver equals arg.


> arg
Test if the receiver is more than arg.


>= arg
Test if the receiver is greater than or equal to arg.


hash
Answer an hash value for the receiver


[ Next: | Previous:Fraction-comparing | Up:Fraction ]

Fraction: converting

asFloat
Answer the receiver converted to a Float


asFraction
Answer the receiver converted to a Fraction


[ Next: | Previous:Fraction-converting | Up:Fraction ]

Fraction: optimized cases

negated
Return the receiver, with its sign changed.


raisedToInteger: anInteger
Return self raised to the anInteger-th power.


reciprocal
Return the reciprocal of the receiver.


squared
Return the square of the receiver.


[ Next: | Previous:Fraction-optimized cases | Up:Fraction ]

Fraction: printing

printOn: aStream
Print a representation of the receiver on aStream


storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


[ Previous:Fraction-printing | Up:Fraction ]

Fraction: testing

isRational
Answer whether the receiver is rational - true


[Up: Class Index]

IdentityDictionary

Category: Collections-Keyed
I am similar to dictionary, except that my representation is different, and I use the object identity comparision message == to determine equivalence of indices.


[ Next: | Up:IdentityDictionary ]

IdentityDictionary class: instance creation

new
Create a new dictionary with a default size


new: anInteger
Create a new dictionary with the given size


[ Next: | Previous:IdentityDictionary class-instance creation | Up:IdentityDictionary ]

IdentityDictionary: accessing

add: anAssociation
Add the anAssociation key to the receiver


associationAt: key ifAbsent: aBlock
Answer the key/value Association for the given key. Evaluate aBlock (answering the result) if the key is not found


at: key ifAbsent: aBlock
Answer the value associated to the given key, or the result of evaluating aBlock if the key is not found


at: aKey ifPresent: aBlock
If aKey is absent, answer nil. Else, evaluate aBlock passing the associated value and answer the result of the invocation


at: key put: value
Store value as associated to the given key


[ Next: | Previous:IdentityDictionary-accessing | Up:IdentityDictionary ]

IdentityDictionary: dictionary enumerating

associationsDo: aBlock
Pass each association in the dictionary to aBlock


keysAndValuesDo: aBlock
Pass each key/value pair in the dictionary as two distinct parameters to aBlock


[ Next: | Previous:IdentityDictionary-dictionary enumerating | Up:IdentityDictionary ]

IdentityDictionary: dictionary removing

removeKey: key ifAbsent: aBlock
Remove the passed key from the dictionary, answer the result of evaluating aBlock if it is not found


[ Next: | Previous:IdentityDictionary-dictionary removing | Up:IdentityDictionary ]

IdentityDictionary: rehashing

rehash
Rehash the receiver


[ Previous:IdentityDictionary-rehashing | Up:IdentityDictionary ]

IdentityDictionary: storing

storeOn: aStream
Print Smalltalk code compiling to the receiver on aStream


[Up: Class Index]

IdentitySet

Category: Collections-Unordered
I am the typical set object; I can store any objects uniquely. I use the == operator to determine duplication of objects.


[Up: Class Index]

Integer

Category: Language-Data types
I am the integer class of the GNU Smalltalk system. My instances can represent signed 30 bit integers and are as efficient as possible.


[ Next: | Up:Integer ]

Integer class: converting

coerce: aNumber
Answer aNumber converted to a kind of Integer


[ Next: | Previous:Integer class-converting | Up:Integer ]

Integer class: getting limits

bits
Answer the number of bits (excluding the sign) that can be represented directly in an object pointer


largest
Answer the largest integer represented directly in an object pointer


smallest
Answer the smallest integer represented directly in an object pointer


[ Next: | Previous:Integer class-getting limits | Up:Integer ]

Integer class: testing

isIdentity
Answer whether x = y implies x == y for instances of the receiver


[ Next: | Previous:Integer class-testing | Up:Integer ]

Integer: accessing

denominator
Answer `1'.


numerator
Answer the receiver.


[ Next: | Previous:Integer-accessing | Up:Integer ]

Integer: bit operators

allMask: anInteger
True if all 1 bits in anInteger are 1 in the receiver


anyMask: anInteger
True if any 1 bits in anInteger are 1 in the receiver


bitAt: index
Answer the index-th bit of the receiver (LSB: index = 1


bitClear: aMask
Answer an Integer equal to the receiver, except that all the bits that are set in aMask are cleared.


bitInvert
Return the 1's complement of the bits of the receiver


clearBit: index
Clear the index-th bit of the receiver and answer a new Integer


highBit
Return the index of the highest order 1 bit of the receiver


isBitSet: index
Answer whether the index-th bit of the receiver is set


noMask: anInteger
True if no 1 bits in anInteger are 1 in the receiver


setBit: index
Set the index-th bit of the receiver and answer a new Integer


[ Next: | Previous:Integer-bit operators | Up:Integer ]

Integer: built ins

* arg
Multiply the receiver and arg and answer another Number


+ arg
Sum the receiver and arg and answer another Number


- arg
Subtract arg from the receiver and answer another Number


/ arg
Divide the receiver by arg and answer another Integer or Fraction


// arg
Dividing receiver by arg (with truncation towards -infinity) and answer the result


< arg
Answer whether the receiver is less than arg


<= arg
Answer whether the receiver is less than or equal to arg


= arg
Answer whether the receiver is equal to arg


== arg
Answer whether the receiver is the same object as arg


> arg
Answer whether the receiver is greater than arg


>= arg
Answer whether the receiver is greater than or equal to arg


\\ arg
Calculate the remainder of dividing receiver by arg (with truncation towards -infinity) and answer it


asFloat
Convert the receiver to a Float, answer the result


asObject
Answer the object whose index is in the receiver, fail if no object found at that index


asObjectNoFail
Answer the object whose index is in the receiver, or nil if no object is found at that index


bitAnd: arg
Do a bitwise AND between the receiver and arg, answer the result


bitOr: arg
Do a bitwise OR between the receiver and arg, answer the result


bitShift: arg
Shift the receiver by arg places to the left if arg > 0, by arg places to the right if arg < 0, answer another Number


bitXor: arg
Do a bitwise XOR between the receiver and arg, answer the result


quo: arg
Dividing receiver by arg (with truncation towards zero) and answer the result


~= arg
Answer whether the receiver is not equal to arg


~~ arg
Answer whether the receiver is not the same object as arg


[ Next: | Previous:Integer-built ins | Up:Integer ]

Integer: Coercion methods (heh heh heh)

asCharacter
Return self as an ascii character


ceiling
Return the receiver - it's already truncated


coerce: aNumber
Coerce aNumber to the receiver's class


floor
Return the receiver - it's already truncated


generality
Return the receiver's generality


rounded
Return the receiver - it's already truncated


truncated
Return the receiver - it's already truncated


unity
Coerce 1 to the receiver's class


zero
Coerce 0 to the receiver's class


[ Next: | Previous:Integer-Coercion methods (heh heh heh) | Up:Integer ]

Integer: converting

asFraction
Return the receiver converted to a fraction


[ Next: | Previous:Integer-converting | Up:Integer ]

Integer: extension

alignTo: anInteger
Answer the receiver, truncated to the first higher or equal multiple of anInteger (which must be a power of two)


[ Next: | Previous:Integer-extension | Up:Integer ]

Integer: Math methods

estimatedLog
Answer an estimate of (self abs floorLog: 10)


even
Return whether the receiver is even


factorial
Return the receiver's factorial


floorLog: radix
return (self log: radix) floor. Optimized to answer an integer.


gcd: anInteger
Return the greatest common divisor (Euclid's algorithm) between the receiver and anInteger


lcm: anInteger
Return the least common multiple between the receiver and anInteger


odd
Return whether the receiver is odd


[ Next: | Previous:Integer-Math methods | Up:Integer ]

Integer: Misc math operators

hash
Answer an hash value for the receiver


[ Next: | Previous:Integer-Misc math operators | Up:Integer ]

Integer: Other iterators

timesRepeat: aBlock
Evaluate aBlock a number of times equal to the receiver's value. Compiled in-line for no argument aBlocks without temporaries, and therefore not overridable.


[ Next: | Previous:Integer-Other iterators | Up:Integer ]

Integer: printing

printOn: aStream
Print on aStream the base 10 representation of the receiver


printOn: aStream base: b
Print on aStream the base b representation of the receiver


printString: baseInteger
Return the base b representation of the receiver


radix: baseInteger
Return the base b representation of the receiver, with BBr in front of it


storeOn: aStream base: b
Print on aStream Smalltalk code compiling to the receiver, represented in base b


[ Next: | Previous:Integer-printing | Up:Integer ]

Integer: storing

storeOn: aStream
Print on aStream the base 10 representation of the receiver


[ Previous:Integer-storing | Up:Integer ]

Integer: testing functionality

isInteger
Answer `true'.


isRational
Answer whether the receiver is rational - true


isSmallInteger
Answer `true'.


[Up: Class Index]

Interval

Category: Collections-Sequenceable
My instances represent ranges of objects, typically Number type objects. I provide iteration/enumeration messages for producing all the members that my instance represents.


[ Next: | Up:Interval ]

Interval class: instance creation

from: startInteger to: stopInteger
Answer an Interval going from startInteger to the stopInteger, with a step of 1


from: startInteger to: stopInteger by: stepInteger
Answer an Interval going from startInteger to the stopInteger, with a step of stepInteger


[ Next: | Previous:Interval class-instance creation | Up:Interval ]

Interval: basic

at: index
Answer the index-th element of the receiver.


at: index put: anObject
This method should not be called for instances of this class.


collect: aBlock
Evaluate the receiver for each element in aBlock, collect in an array the result of the evaluations.


do: aBlock
Evaluate the receiver for each element in aBlock


reverse
Not commented.


size
Answer the number of elements in the receiver.


species
Answer `Array'.


[ Next: | Previous:Interval-basic | Up:Interval ]

Interval: printing

printOn: aStream
Print a representation for the receiver on aStream


[ Next: | Previous:Interval-printing | Up:Interval ]

Interval: storing

storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


[ Previous:Interval-storing | Up:Interval ]

Interval: testing

= anInterval
Answer whether anInterval is the same interval as the receiver


hash
Answer an hash value for the receiver


[Up: Class Index]

LargeInteger

Category: Language-Data types
I represent a large integer, which has to be stored as a long sequence of bytes. I have methods to do arithmetics and comparisons, but I need some help from my children, LargePositiveInteger and LargeNegativeInteger, to speed them up a bit.


[ Next: | Up:LargeInteger ]

LargeInteger class: testing

isIdentity
Answer whether x = y implies x == y for instances of the receiver


[ Next: | Previous:LargeInteger class-testing | Up:LargeInteger ]

LargeInteger: arithmetic

* aNumber
Multiply aNumber and the receiver, answer the result


/ aNumber
Divide aNumber and the receiver, answer the result (an Integer or Fraction)


// aNumber
Divide aNumber and the receiver, answer the result truncated towards -infinity


\\ aNumber
Divide aNumber and the receiver, answer the remainder truncated towards -infinity


estimatedLog
Answer an estimate of (self abs floorLog: 10)


negated
Answer the receiver's negated


quo: aNumber
Divide aNumber and the receiver, answer the result truncated towards 0


rem: aNumber
Divide aNumber and the receiver, answer the remainder truncated towards 0


[ Next: | Previous:LargeInteger-arithmetic | Up:LargeInteger ]

LargeInteger: bit operations

bitAnd: aNumber
Answer the receiver ANDed with aNumber


bitAt: aNumber
Answer the aNumber-th bit in the receiver, where the LSB is 1


bitInvert
Answer the receiver's 1's complement


bitOr: aNumber
Answer the receiver ORed with aNumber


bitShift: aNumber
Answer the receiver shifted by aNumber places


bitXor: aNumber
Answer the receiver XORed with aNumber


[ Next: | Previous:LargeInteger-bit operations | Up:LargeInteger ]

LargeInteger: built-ins

at: anIndex
Answer the anIndex-th byte in the receiver's representation


at: anIndex put: aNumber
Answer the anIndex-th byte in the receiver's representation


digitAt: anIndex
Answer the anIndex-th base-256 digit in the receiver's representation


digitAt: anIndex put: aNumber
Answer the anIndex-th base-256 digit in the receiver's representation


digitLength
Answer the number of base-256 digits in the receiver


hash
Answer an hash value for the receiver


primReplaceFrom: start to: stop with: replacementString
startingAt: replaceStart Private - Replace the characters from start to stop with new characters contained in replacementString (which, actually, can be any variable byte class, starting at the replaceStart location of replacementString


size
Answer the number of indexed instance variable in the receiver


[ Next: | Previous:LargeInteger-built-ins | Up:LargeInteger ]

LargeInteger: coercion

coerce: aNumber
Truncate the number; if needed, convert it to LargeInteger representation.


generality
Answer the receiver's generality


unity
Coerce 1 to the receiver's class


zero
Coerce 0 to the receiver's class


[ Next: | Previous:LargeInteger-coercion | Up:LargeInteger ]

LargeInteger: disabled

asObject
This method always fails. The number of OOPs is far less than the minimum number represented with a LargeInteger.


asObjectNoFail
Answer `nil'.


[ Next: | Previous:LargeInteger-disabled | Up:LargeInteger ]

LargeInteger: primitive operations

basicLeftShift: totalShift
Private - Left shift the receiver by aNumber places


basicRightShift: totalShift
Private - Right shift the receiver by 'shift' places


largeNegated
Private - Same as negated, but always answer a LargeInteger


[ Next: | Previous:LargeInteger-primitive operations | Up:LargeInteger ]

LargeInteger: testing

< aNumber
Answer whether the receiver is smaller than aNumber


<= aNumber
Answer whether the receiver is smaller than aNumber or equal to it


= aNumber
Answer whether the receiver and aNumber identify the same number


> aNumber
Answer whether the receiver is greater than aNumber


>= aNumber
Answer whether the receiver is greater than aNumber or equal to it


~= aNumber
Answer whether the receiver and aNumber identify the same number


[ Previous:LargeInteger-testing | Up:LargeInteger ]

LargeInteger: testing functionality

isSmallInteger
Answer `false'.


[Up: Class Index]

LargeNegativeInteger

Category: Language-Data types
Just like my brother LargePositiveInteger, I provide a few methods that allow LargeInteger to determine the sign of a large integer in a fast way during its calculations. For example, I can tell him I am smaller than any LargePositiveInteger


[ Next: | Up:LargeNegativeInteger ]

LargeNegativeInteger: arithmetic

+ aNumber
Sum the receiver and aNumber, answer the result


- aNumber
Sum the receiver and aNumber, answer the result


highBit
Answer the receiver's highest bit's index


[ Next: | Previous:LargeNegativeInteger-arithmetic | Up:LargeNegativeInteger ]

LargeNegativeInteger: converting

asFloat
Answer the receiver converted to a Float


[ Previous:LargeNegativeInteger-converting | Up:LargeNegativeInteger ]

LargeNegativeInteger: numeric testing

abs
Answer the receiver's absolute value.


negative
Answer whether the receiver is < 0


positive
Answer whether the receiver is >= 0


sign
Answer the receiver's sign


strictlyPositive
Answer whether the receiver is > 0


[Up: Class Index]

LargePositiveInteger

Category: Language-Data types
Just like my brother LargeNegativeInteger, I provide a few methods that allow LargeInteger to determine the sign of a large integer in a fast way during its calculations. For example, I can tell him I am larger than any LargeNegativeInteger


[ Next: | Up:LargePositiveInteger ]

LargePositiveInteger: arithmetic

+ aNumber
Sum the receiver and aNumber, answer the result


- aNumber
Subtract aNumber from the receiver, answer the result


gcd: anInteger
Calculate the GCD between the receiver and anInteger


highBit
Answer the receiver's highest bit's index


[ Next: | Previous:LargePositiveInteger-arithmetic | Up:LargePositiveInteger ]

LargePositiveInteger: converting

asFloat
Answer the receiver converted to a Float


reverseStringBase: radix on: str
Return in a string the base radix representation of the receiver in reverse order


[ Next: | Previous:LargePositiveInteger-converting | Up:LargePositiveInteger ]

LargePositiveInteger: helper byte-level methods

bytes: byteArray1 from: j compare: byteArray2
Private - Answer the sign of byteArray2 - byteArray1; the j-th byte of byteArray1 is compared with the first of byteArray2, the j+1-th with the second, and so on.


bytes: byteArray1 from: j subtract: byteArray2
Private - Sutract the bytes in byteArray2 from those in byteArray1


bytes: bytes multiply: anInteger
Private - Multiply the bytes in bytes by anInteger, which must be < 255. Put the result back in bytes.


bytesLeftShift: aByteArray
Private - Left shift by 1 place the bytes in aByteArray


bytesLeftShift: aByteArray big: totalShift
Private - Left shift the bytes in aByteArray by totalShift places


bytesLeftShift: aByteArray n: shift
Private - Left shift by shift places the bytes in aByteArray (shift <= 7)


bytesRightShift: aByteArray big: totalShift
Private - Right shift the bytes in aByteArray by totalShift places


bytesRightShift: bytes n: aNumber
Private - Right shift the bytes in `bytes' by 'aNumber' places (shift <= 7)


bytesTrailingZeros: bytes
Private - Answer the number of trailing zero bits in the receiver


primDivide: rhs
Private - Implements Knuth's divide and correct algorithm from `Seminumerical Algorithms' 3rd Edition, section 4.3.1 (which is basically an enhanced version of the divide `algorithm' for two-digit divisors which is taught in primary school!!!)


[ Next: | Previous:LargePositiveInteger-helper byte-level methods | Up:LargePositiveInteger ]

LargePositiveInteger: numeric testing

abs
Answer the receiver's absolute value


negative
Answer whether the receiver is < 0


positive
Answer whether the receiver is >= 0


sign
Answer the receiver's sign


strictlyPositive
Answer whether the receiver is > 0


[ Previous:LargePositiveInteger-numeric testing | Up:LargePositiveInteger ]

LargePositiveInteger: primitive operations

divide: aNumber using: aBlock
Private - Divide the receiver by aNumber (unsigned division). Evaluate aBlock passing the result ByteArray, the remainder ByteArray, and whether the division had a remainder


isSmall
Private - Answer whether the receiver is small enough to employ simple scalar algorithms for division and multiplication


multiply: aNumber
Private - Multiply the receiver by aNumber (unsigned multiply)


[Up: Class Index]

LargeZeroInteger

Category: Language-Data types
I am quite a strange class. Indeed, the concept of a "large integer" that is zero is a weird one. Actually my only instance is zero but is represented like LargeIntegers, has the same generality as Lar- geIntegers, and so on. That only instance is stored in the class variable Zero, and is used in arithmetical methods, when we have to coerce a parameter that is zero.


[ Next: | Up:LargeZeroInteger ]

LargeZeroInteger: accessing

at: anIndex
Answer `0'.


hash
Answer `0'.


size
Answer `0'.


[ Next: | Previous:LargeZeroInteger-accessing | Up:LargeZeroInteger ]

LargeZeroInteger: arithmetic

* aNumber
Multiply aNumber and the receiver, answer the result


+ aNumber
Sum the receiver and aNumber, answer the result


- aNumber
Subtract aNumber from the receiver, answer the result


/ aNumber
Divide aNumber and the receiver, answer the result (an Integer or Fraction)


// aNumber
Divide aNumber and the receiver, answer the result truncated towards -infinity


\\ aNumber
Divide aNumber and the receiver, answer the remainder truncated towards -infinity


quo: aNumber
Divide aNumber and the receiver, answer the result truncated towards 0


rem: aNumber
Divide aNumber and the receiver, answer the remainder truncated towards 0


[ Next: | Previous:LargeZeroInteger-arithmetic | Up:LargeZeroInteger ]

LargeZeroInteger: numeric testing

sign
Answer the receiver's sign


strictlyPositive
Answer whether the receiver is > 0


[ Previous:LargeZeroInteger-numeric testing | Up:LargeZeroInteger ]

LargeZeroInteger: printing

reverseStringBase: radix on: str
Return in a string the base radix representation of the receiver in reverse order


[Up: Class Index]

Link

Category: Collections-Sequenceable
I represent simple linked lists. Generally, I am not used by myself, but rather a subclass adds other instance variables that hold the information for each node, and I hold the glue that keeps them together.


[ Next: | Up:Link ]

Link class: instance creation

nextLink: aLink
Create an instance with the given next link


[ Previous:Link class-instance creation | Up:Link ]

Link: basic

nextLink
Answer the next item in the list


nextLink: aLink
Set the next item in the list


[Up: Class Index]

LinkedList

Category: Collections-Sequenceable
I provide methods that access and manipulate linked lists. I assume that the elements of the linked list are subclasses of Link, because I use the methods that class Link supplies to implement my methods.


[ Next: | Up:LinkedList ]

LinkedList: accessing

at: index
Return the element that is index into the linked list.


at: index put: object
This method should not be called for instances of this class.


[ Next: | Previous:LinkedList-accessing | Up:LinkedList ]

LinkedList: adding

add: aLink
Add aLink at the end of the list; return aLink.


addFirst: aLink
Add aLink at the head of the list; return aLink.


addLast: aLink
Add aLink at then end of the list; return aLink.


remove: aLink ifAbsent: aBlock
Remove aLink from the list and return it, or invoke aBlock if it's not found in the list.


removeFirst
Remove the first element from the list and return it, or error if the list is empty.


removeLast
Remove the final element from the list and return it, or error if the list is empty.


[ Next: | Previous:LinkedList-adding | Up:LinkedList ]

LinkedList: enumerating

do: aBlock
Enumerate each object in the list, passing it to aBlock


[ Previous:LinkedList-enumerating | Up:LinkedList ]

LinkedList: testing

isEmpty
Returns true if the list contains no members


[Up: Class Index]

Magnitude

Category: Language-Data types
I am an abstract class. My objects represent things that are discrete and map to a number line. My instances can be compared with < and >.


[ Next: | Up:Magnitude ]

Magnitude: basic

< aMagnitude
Answer whether the receiver is less than aMagnitude


<= aMagnitude
Answer whether the receiver is less than or equal to aMagnitude


= aMagnitude
Answer whether the receiver is equal to aMagnitude


> aMagnitude
Answer whether the receiver is greater than aMagnitude


>= aMagnitude
Answer whether the receiver is greater than or equal to aMagnitude


[ Previous:Magnitude-basic | Up:Magnitude ]

Magnitude: misc methods

between: min and: max
Returns true if object is inclusively between min and max.


max: aMagnitude
Returns the greatest object between the receiver and aMagnitude


min: aMagnitude
Returns the least object between the receiver and aMagnitude


[Up: Class Index]

MappedCollection

Category: Collections-Keyed
I represent collections of objects that are indirectly indexed by names. There are really two collections involved: domain and a map. The map maps between external names and indices into domain, which contains the real association. In order to work properly, the domain must be an instance of a subclass of SequenceableCollection, and the map must be an instance of Dictionary, or of a subclass of SequenceableCollection.

As an example of using me, consider implenting a Dictionary whose elements are indexed. The domain would be a SequenceableCollection with n elements, the map a Dictionary associating each key to an index in the domain. To access by key, to perform enumeration, etc. you would ask an instance of me; to access by index, you would access the domain directly.


[ Next: | Up:MappedCollection ]

MappedCollection class: instance creation

collection: aCollection map: aMap
Answer a new MappedCollection using the given domain (aCollection) and map


new
self shouldNotImplement


[ Previous:MappedCollection class-instance creation | Up:MappedCollection ]

MappedCollection: basic

add: anObject
This method should not be called for instances of this class.


at: key
Answer the object at the given key


at: key put: value
Store value at the given key


collect: aBlock
Answer a MappedCollection with a copy of the receiver's map and a domain obtained by passing each object through aBlock


contents
Answer a bag with the receiver's values


do: aBlock
Evaluate aBlock for each object


domain
Answer the domain


map
Answer the map


reject: aBlock
Answer the objects in the domain for which aBlock returns false


select: aBlock
Answer the objects in the domain for which aBlock returns true


size
Answer the receiver's size


[Up: Class Index]

Memory

Category: Language-Implementation
I provide access to actual machine addresses of OOPs and objects. I have no instances; you send messages to my class to map between an object and the address of its OOP or object. In addition I provide direct memory access with different C types (ints, chars, OOPs, floats,...).


[ Next: | Up:Memory ]

Memory class: accessing

at: anAddress
Access the Smalltalk object (OOP) at the given address.


at: anAddress put: aValue
Store a pointer (OOP) to the Smalltalk object identified by `value' at the given address.


charAt: anAddress
Access the C char at the given address. The value is returned as a Smalltalk Character.


charAt: anAddress put: aValue
Store as a C char the Smalltalk Character or Integer object identified by `value', at the given address, using sizeof(char) bytes - i.e. 1 byte.


deref: anAddress
Access the C int pointed by the given address


doubleAt: anAddress
Access the C double at the given address.


doubleAt: anAddress put: aValue
Store the Smalltalk Float object identified by `value', at the given address, writing it like a C double.


floatAt: anAddress
Access the C float at the given address.


floatAt: anAddress put: aValue
Store the Smalltalk Float object identified by `value', at the given address, writing it like a C float.


intAt: anAddress
Access the C int at the given address.


intAt: anAddress put: aValue
Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(int) bytes.


longAt: anAddress
Access the C long int at the given address.


longAt: anAddress put: aValue
Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(long) bytes.


shortAt: anAddress
Access the C short int at the given address.


shortAt: anAddress put: aValue
Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(short) bytes.


stringAt: anAddress
Access the string pointed by the C `char *' at the given given address.


stringAt: anAddress put: aValue
Store the Smalltalk String object identified by `value', at the given address in memory, writing it like a *FRESHLY ALLOCATED* C string. It is the caller's responsibility to free it if necessary.


unsignedCharAt: anAddress
Access the C unsigned char at the given address. The value is returned as a Smalltalk Character.


unsignedCharAt: anAddress put: aValue
Store as a C char the Smalltalk Character or Integer object identified by `value', at the given address, using sizeof(char) bytes - i.e. 1 byte.


unsignedIntAt: anAddress
Access the C unsigned int at the given address.


unsignedIntAt: anAddress put: aValue
Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(int) bytes.


unsignedLongAt: anAddress
Access the C unsigned long int at the given address.


unsignedLongAt: anAddress put: aValue
Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(long) bytes.


unsignedShortAt: anAddress
Access the C unsigned short int at the given address.


unsignedShortAt: anAddress put: aValue
Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(short) bytes.


[ Previous:Memory class-accessing | Up:Memory ]

Memory class: basic

addressOf: anObject
Returns the address of the actual object that anObject references. The result might be invalidated after a garbage collection occurs.


addressOfOOP: anObject
Returns the address of the OOP (object table slot) for anObject. The result is still valid after a garbage collection occurs.


type: aType at: anAddress
Returns a particular type object from memory at anAddress


type: aType at: anAddress put: aValue
Sets the memory location anAddress to aValue


[Up: Class Index]

Message

Category: Language-Implementation
I am a virtually existent class. By that I mean that logically instances of my class are created whenever a message is sent to an object, but in reality my instances are only created to hold a message that has failed, so that error reporting methods can examine the sender and arguments.


[ Next: | Up:Message ]

Message class: creating instances

selector: aSymbol arguments: anArray
Create a new Message with the given selector and arguments


[ Next: | Previous:Message class-creating instances | Up:Message ]

Message: accessing

arguments
Answer the receiver's arguments


arguments: anArray
Set the receiver's arguments


selector
Answer the receiver's selector


selector: aSymbol
Set the receiver's selector


[ Previous:Message-accessing | Up:Message ]

Message: basic

printOn: aStream
Print a representation of the receiver on aStream


reinvokeFor: aReceiver
Resend to aReceiver - present for compatibility


sendTo: aReceiver
Resend to aReceiver


[Up: Class Index]

Metaclass

Category: Language-Implementation
I am the root of the class hierarchy. My instances are metaclasses, one for each real class. My instances have a single instance, which they hold onto, which is the class that they are the metaclass of. I provide methods for creation of actual class objects from metaclass object, and the creation of metaclass objects, which are my instances. If this is confusing to you, it should be...the Smalltalk metaclass system is strange and complex.


[ Next: | Up:Metaclass ]

Metaclass class: instance creation

subclassOf: superMeta
Answer a new metaclass representing a subclass of superMeta


[ Next: | Previous:Metaclass class-instance creation | Up:Metaclass ]

Metaclass: accessing

instanceClass
Answer the only instance of the metaclass


primaryInstance
Answer the only instance of the metaclass - present for compatibility


soleInstance
Answer the only instance of the metaclass - present for compatibility


[ Next: | Previous:Metaclass-accessing | Up:Metaclass ]

Metaclass: basic

instanceVariableNames: classInstVarNames
Set the class-instance variables for the receiver to be those in classInstVarNames


name: newName
environment: aSystemDictionary subclassOf: superclass instanceVariableNames: stringOfInstVarNames variable: variableBoolean words: wordBoolean pointers: pointerBoolean classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryName Private - create a full featured class and install it, or change an existing one


newMeta: newName
environment: aSystemDictionary subclassOf: superclass instanceVariableNames: stringOfInstVarNames variable: variableBoolean words: wordBoolean pointers: pointerBoolean classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryName Private - create a full featured class and install it


[ Next: | Previous:Metaclass-basic | Up:Metaclass ]

Metaclass: delegation

addClassVarName: aString
Add a class variable with the given name to the class pool dictionary


addSharedPool: aDictionary
Add the given shared pool to the list of the class' pool dictionaries


allClassVarNames
Answer the names of the variables in the receiver's class pool dictionary and in each of the superclasses' class pool dictionaries


allSharedPools
Return the names of the shared pools defined by the class and any of its superclasses


classPool
Answer the class pool dictionary


classVarNames
Answer the names of the variables in the class pool dictionary


removeClassVarName: aString
Removes the class variable from the class, error if not present, or still in use.


removeSharedPool: aDictionary
Remove the given dictionary to the list of the class' pool dictionaries


sharedPools
Return the names of the shared pools defined by the class


[ Next: | Previous:Metaclass-delegation | Up:Metaclass ]

Metaclass: filing

fileOutOn: aFileStream
File out complete class description: class definition, class and instance methods


[ Next: | Previous:Metaclass-filing | Up:Metaclass ]

Metaclass: printing

printOn: aStream
Print a represention of the receiver on aStream


storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


[ Previous:Metaclass-printing | Up:Metaclass ]

Metaclass: testing functionality

asClass
Answer `instanceClass'.


isMetaclass
Answer `true'.


[Up: Class Index]

MethodContext

Category: Language-Implementation
My instances represent an actively executing method. They record various bits of information about the execution environment, and contain the execution stack.


[ Next: | Up:MethodContext ]

MethodContext: accessing

home
Answer the MethodContext to which the receiver refers (i.e. the receiver itself)


isBlock
Answer whether the receiver is a block context


method
Return the CompiledMethod being executed


methodClass
Return the class in which the CompiledMethod being executed is defined


receiver
Return the receiver (self) for the method being executed


selector
Return the selector for the method being executed


sender
Return the context from which the receiver was sent


[ Previous:MethodContext-accessing | Up:MethodContext ]

MethodContext: printing

printOn: aStream
Print a representation for the receiver on aStream


[Up: Class Index]

MethodInfo

Category: Language-Implementation
I provide information about particular methods. I can produce the category that a method was filed under, and can be used to access the source code of the method.


[ Next: | Up:MethodInfo ]

MethodInfo: accessing

category
Answer the method category


category: aCategory
Set the method category


sourceCode
Answer a FileSegment or String or nil containing the method source code


sourceFile
Answer the name of the file where the method source code is


sourcePos
Answer the starting position of the method source code in the sourceFile


sourceString
Answer a String containing the method source code


stripSourceCode
Remove the reference to the source code for the method


[ Previous:MethodInfo-accessing | Up:MethodInfo ]

MethodInfo: equality

= aMethodInfo
Compare the receiver and aMethodInfo, answer whether they're equal


hash
Answer an hash value for the receiver


[Up: Class Index]

NullProxy

Category: Streams-Files
I am a proxy that does no special processing on the object to be saved - it uses about the same format as a #dump: without a proxy. It can be used to disable proxies for particular subclasses.


[ Next: | Up:NullProxy ]

NullProxy class: instance creation

on: anObject
Answer a proxy to be used to save anObject. IMPORTANT: the newly constructed DumperProxy must NOT have anObject in one of its in- stance variable, because that would result in an infinite loop!


[ Previous:NullProxy class-instance creation | Up:NullProxy ]

NullProxy: accessing

object
Reconstruct the object stored in the proxy and answer it


object: theObject
Private - Set the object to be dumped to theObject. This is set by the #on: class method; note that NullProxies don't conform to the rule that proxies must not have their object in an instance variable, because they are treated different from all other proxy objects in the ObjectDumper.


[Up: Class Index]

NullValueHolder

Category: Language-Data types
I pretend to store my value in a variable, but I don't actually. You can use the only instance of my class (returned by `ValueHolder null') if you're not interested in a value that is returned as described in ValueHolder's comment.


[ Next: | Up:NullValueHolder ]

NullValueHolder class: creating instances

new
Not used - use `ValueHolder null' instead


[ Previous:NullValueHolder class-creating instances | Up:NullValueHolder ]

NullValueHolder: accessing

value
Retrive the value of the receiver. Always answer nil


value: anObject
Set the value of the receiver. Do nothing, discard the value


[Up: Class Index]

Number

Category: Language-Data types
I am an abstract class that provides operations on numbers, both floating point and integer. I provide some generic predicates, and supply the implicit type coercing code for binary operations.


[ Next: | Up:Number ]

Number class: converting

coerce: aNumber
Answer aNumber - whatever class it belongs to, it is good


readFrom: aStream
Answer the number read from the rest of aStream, converted to an instance of the receiver. If the receiver is number, the class of the result is undefined - but the result is good.


[ Next: | Previous:Number class-converting | Up:Number ]

Number class: testing

isImmediate
Answer whether, if x is an instance of the receiver, x copy == x


[ Next: | Previous:Number class-testing | Up:Number ]

Number: arithmetic

* aNumber
Subtract the receiver and aNumber, answer the result


+ aNumber
Sum the receiver and aNumber, answer the result


- aNumber
Subtract aNumber from the receiver, answer the result


/ aNumber
Divide the receiver by aNumber, answer the result (no loss of precision)


// aNumber
Divide the receiver by aNumber, answer the result truncated towards -infinity


\\ aNumber
Divide the receiver by aNumber truncating towards -infinity, answer the remainder


quo: aNumber
Return the integer quotient of dividing the receiver by aNumber with truncation towards zero.


reciprocal
Return the reciprocal of the receiver


rem: aNumber
Return the remainder of dividing the receiver by aNumber with truncation towards zero.


[ Next: | Previous:Number-arithmetic | Up:Number ]

Number: converting

asRectangle
Answer an empty rectangle whose origin is (self asPoint)


coerce: aNumber
Answer aNumber - whatever class it belongs to, it is good


degreesToRadians
Convert the receiver to radians


generality
Answer the receiver's generality


radiansToDegrees
Convert the receiver from radians to degrees


retry: aSymbol coercing: aNumber
Coerce the number (between the receiver and aNumber) which has the lowest generality to the other's number class, and retry calling aSymbol.


unity
Coerce 1 to the receiver's class. The default implementation works, but is inefficient


zero
Coerce 0 to the receiver's class. The default implementation works, but is inefficient


[ Next: | Previous:Number-converting | Up:Number ]

Number: copying

deepCopy
Return the receiver - it's an immediate (immutable) object


shallowCopy
Return the receiver - it's an immediate (immutable) object


[ Next: | Previous:Number-copying | Up:Number ]

Number: Intervals & iterators

to: stop
Return an interval going from the receiver to stop by 1


to: stop by: step
Return an interval going from the receiver to stop with the given step


to: stop by: step do: aBlock
Evaluate aBlock for each value in the interval going from the receiver to stop with the given step. Compiled in-line for integer literal steps, and for one-argument aBlocks without temporaries, and therefore not overridable.


to: stop do: aBlock
Evaluate aBlock for each value in the interval going from the receiver to stop by 1. Compiled in-line for one-argument aBlocks without temporaries, and therefore not overridable.


[ Next: | Previous:Number-Intervals & iterators | Up:Number ]

Number: misc math

abs
Answer the absolute value of the receiver


arcCos
return the arc cosine of the receiver


arcSin
return the arc sine of the receiver


arcTan
return the arc tangent of the receiver


cos
return the cosine of the receiver


estimatedLog
Answer an estimate of (self abs floorLog: 10). This method should be overridden by subclasses, but Number's implementation does not raise errors - simply, it gives a correct result, so it is slow.


exp
return e raised to the receiver


floorLog: radix
return (self log: radix) floor. Optimized to answer an integer.


ln
return log base e of the receiver


log: aNumber
return log base aNumber of the receiver


negated
Answer the negated of the receiver


raisedTo: aNumber
Return self raised to aNumber power


raisedToInteger: anInteger
Return self raised to the anInteger-th power


sin
return the sine of the receiver


sqrt
return the square root of the receiver


squared
Answer the square of the receiver


tan
return the tangent of the receiver


[ Next: | Previous:Number-misc math | Up:Number ]

Number: point creation

@ y
Answer a new point whose x is the receiver and whose y is y


asPoint
Answer a new point, self @ self


[ Next: | Previous:Number-point creation | Up:Number ]

Number: testing

even
Returns true if self is divisible by 2


isNumber
Answer `true'.


isRational
Answer whether the receiver is rational - false by default


negative
Answer whether the receiver is < 0


odd
Returns true if self is not divisible by 2


positive
Answer whether the receiver is >= 0


sign
Returns the sign of the receiver.


strictlyPositive
Answer whether the receiver is > 0


[ Previous:Number-testing | Up:Number ]

Number: truncation and round off

asInteger
Answer the receiver, truncated towards zero


floor
Return the integer nearest the receiver toward negative infinity.


rounded
Returns the integer nearest the receiver


roundTo: aNumber
Answer the receiver, truncated to the nearest multiple of aNumber


truncated
Answer the receiver, truncated towards zero


truncateTo: aNumber
Answer the receiver, truncated towards zero to a multiple of aNumber


[Up: Class Index]

Object

Category: Language-Implementation
I am the root of the Smalltalk class system. All classes in the system are subclasses of me.


[ Next: | Up:Object ]

Object: built ins

= arg
Answer whether the receiver is equal to arg. The equality test is by default the same as that for equal objects. = must not fail; answer false if the receiver cannot be compared to arg


== arg
Answer whether the receiver is the same object as arg. This is a very fast test and is called 'identity'


addToBeFinalized
Add the object to the list of objects to be finalized when there are no more references to them


asOop
Answer the object index associated to the receiver. The object index doesn't change when garbage collection is performed.


at: anIndex
Answer the index-th indexed instance variable of the receiver


at: anIndex put: value
Store value in the index-th indexed instance variable of the receiver


basicAt: anIndex
Answer the index-th indexed instance variable of the receiver. This method must not be overridden, override at: instead


basicAt: anIndex put: value
Store value in the index-th indexed instance variable of the receiver This method must not be overridden, override at:put: instead


basicPrint
Print a basic representation of the receiver


basicSize
Answer the number of indexed instance variable in the receiver


become: otherObject
Change all references to the receiver into references to otherObject. Depending on the implementation, references to otherObject might or might not be transformed into the receiver (respectively, 'two-way become' and 'one-way become'). Implementations doing one-way become answer the receiver (so that it is not lost). Most implementations doing two-way become answer otherObject, but this is not assured - so do answer the receiver for consistency. GNU Smalltalk does two-way become and answers otherObject, but this might change in future versions: programs should not rely on the behavior and results of #become: .


checkIndexableBounds: index
Private - Check the reason why an access to the given indexed instance variable failed


class
Answer the class to which the receiver belongs


doesNotUnderstand: aMessage
Called by the system when a selector was not found. message is a Message containing information on the receiver


error: message
Display a walkback for the receiver, with the given error message. Signal ExError


halt
Called to enter the debugger


halt: message
Display a walkback for the receiver, with the given error message. Signal ExHalt


hash
Answer an hash value for the receiver. This hash value is ok for objects that do not redefine ==.


identityHash
Answer an hash value for the receiver. This method must not be overridden


instVarAt: index
Answer the index-th instance variable of the receiver. This method must not be overridden.


instVarAt: index put: value
Store value in the index-th instance variable of the receiver. This method must not be overridden.


isReadOnly
Answer whether the object's indexed instance variables can be written


makeReadOnly: aBoolean
Set whether the object's indexed instance variables can be written


makeWeak
Make the object a 'weak' one. When an object is only referenced by weak objects, it is collected and the slots in the weak objects are changed to nils by the VM


mark: aSymbol
Private - use this method to mark code which needs to be reworked, removed, etc. You can then find all senders of #mark: to find all marked methods or you can look for all senders of the symbol that you sent to #mark: to find a category of marked methods.


nextInstance
Private - answer another instance of the receiver's class, or nil if the entire object table has been walked


notYetImplemented
Called when a method defined by a class is not yet implemented, but is going to be


perform: selectorOrMessage
Send the unary message named selectorOrMessage (if a Symbol) to the receiver, or the message and arguments it identifies (if a Message or DirectedMessage). This method should not be overridden


perform: selector with: arg1
Send the message named selector (a Symbol) to the receiver, passing arg1 to it. This method should not be overridden


perform: selector with: arg1 with: arg2
Send the message named selector (a Symbol) to the receiver, passing arg1 and arg2 to it. This method should not be overridden


perform: selector with: arg1 with: arg2 with: arg3
Send the message named selector (a Symbol) to the receiver, passing arg1, arg2 and arg3 to it. This method should not be overridden


perform: selector withArguments: argumentsArray
Send the message named selector (a Symbol) to the receiver, passing every element of argumentsArray to it. This method should not be overridden


primError: message
This might start the debugger... Note that we use #basicPrint 'cause #printOn: might invoke an error.


primitiveFailed
Called when a VM primitive fails


removeToBeFinalized
Remove the object from the list of objects to be finalized when there are no more references to them


shouldNotImplement
Called when objects belonging to a class should not answer a selector defined by a superclass


size
Answer the number of indexed instance variable in the receiver


specialBasicAt: index
Similar to basicAt: but without bounds checking. This method is used to support instance mutation when an instance's class definition is changed. This method must not be overriddent


subclassResponsibility
Called when a method defined by a class should be overridden in a subclass


userInterrupt
Display a walkback for the receiver, signalling ExUserBreak.


[ Next: | Previous:Object-built ins | Up:Object ]

Object: change and update

broadcast: aSymbol
Send the unary message aSymbol to each of the receiver's dependents


broadcast: aSymbol with: anObject
Send the message aSymbol to each of the receiver's dependents, passing anObject


broadcast: aSymbol withArguments: anArray
Send the message aSymbol to each of the receiver's dependents, passing the parameters in anArray


broadcast: aSymbol withBlock: aBlock
Send the message aSymbol to each of the receiver's dependents, passing the result of evaluating aBlock with each dependent as the parameter


changed
Send update: for each of the receiver's dependents, passing them the receiver


changed: aParameter
Send update: for each of the receiver's dependents, passing them aParameter


update: aParameter
Default behavior is to do nothing. Called by #changed and #changed:


[ Next: | Previous:Object-change and update | Up:Object ]

Object: class type methods

species
This method has no unique definition. Generally speaking, methods which always return the same type usually don't use #class, but #species. For example, a PositionableStream's species is the class of the collection on which it is streaming (used by upTo:, upToAll:, upToEnd). Stream uses species for obtaining the class of next:'s return value, Collection uses it in its #copyEmpty: message, which in turn is used by all collection-re- turning methods. An Interval's species is Array (used by collect:, select:, reject:, etc.).


yourself
Answer the receiver


[ Next: | Previous:Object-class type methods | Up:Object ]

Object: copying

copy
Returns a shallow copy of the receiver (the instance variables are not copied). The shallow copy receives the message postCopy and is then passed back


deepCopy
Returns a shallow copy of the receiver (the instance variables are copies of the receiver's instance variables)


postCopy
Performs any changes required to do on a copied object. This is the place where one could, for example, put code to replace objects with copies of the objects


shallowCopy
Returns a shallow copy of the receiver (the instance variables are not copied)


[ Next: | Previous:Object-copying | Up:Object ]

Object: debugging

breakpoint: context return: return
Called back by the system. Must return the value passed through the second parameter


inspect
Print all the instance variables of the receiver on the Transcript


validSize
Answer how many elements in the receiver should be inspected


[ Next: | Previous:Object-debugging | Up:Object ]

Object: dependents access

addDependent: anObject
Add anObject to the set of the receiver's dependents. Important: if an object has dependents, it won't be garbage collected.


dependents
Answer a collection of the receiver's dependents.


release
Remove all of the receiver's dependents from the set and allow the receiver to be garbage collected.


removeDependent: anObject
Remove anObject to the set of the receiver's dependents. No problem if anObject is not in the set of the receiver's dependents.


[ Next: | Previous:Object-dependents access | Up:Object ]

Object: finalization

finalize
Do nothing by default


[ Next: | Previous:Object-finalization | Up:Object ]

Object: printing

basicPrintNl
Print a basic representation of the receiver, followed by a new line.


print
Print a represention of the receiver on the Transcript (stdout the GUI is not active)


printNl
Print a represention of the receiver on stdout, put a new line the Transcript (stdout the GUI is not active)


printOn: aStream
Print a represention of the receiver on aStream


printString
Answer a String representing the receiver


[ Next: | Previous:Object-printing | Up:Object ]

Object: Relational operators

~= anObject
Answer whether the receiver and anObject are not equal


~~ anObject
Answer whether the receiver and anObject are not the same object


[ Next: | Previous:Object-Relational operators | Up:Object ]

Object: storing

store
Put a String of Smalltalk code compiling to the receiver on the Transcript (stdout the GUI is not active)


storeNl
Put a String of Smalltalk code compiling to the receiver, followed by a new line, on the Transcript (stdout the GUI is not active)


storeOn: aStream
Put Smalltalk code compiling to the receiver on aStream


storeString
Answer a String of Smalltalk code compiling to the receiver


[ Next: | Previous:Object-storing | Up:Object ]

Object: subclassed

TexinfoClassPublisher
Not commented


[ Next: | Previous:Object-subclassed | Up:Object ]

Object: syntax shortcuts

-> anObject
Creates a new instance of Association with the receiver being the key and the argument becoming the value


[ Next: | Previous:Object-syntax shortcuts | Up:Object ]

Object: testing functionality

ifNil: nilBlock
Evaluate nilBlock if the receiver is nil, else answer self


ifNil: nilBlock ifNotNil: notNilBlock
Evaluate nilBlock if the receiver is nil, else evaluate notNilBlock, passing the receiver.


ifNotNil: notNilBlock
Evaluate notNiilBlock if the receiver is not nil, passing the receiver. Else answer nil.


ifNotNil: notNilBlock ifNotNil: nilBlock
Evaluate nilBlock if the receiver is nil, else evaluate notNilBlock, passing the receiver.


isArray
Answer `false'.


isCharacter
Answer `false'.


isClass
Answer `false'.


isFloat
Answer `false'.


isInteger
Answer `false'.


isKindOf: aClass
Answer whether the receiver's class is aClass or a subclass of aClass


isMemberOf: aClass
Returns true if the receiver is an instance of the class 'aClass'


isMeta
Same as isMetaclass


isMetaclass
Answer `false'.


isMetaClass
Same as isMetaclass


isNil
Answer whether the receiver is nil


isNumber
Answer `false'.


isSmallInteger
Answer `false'.


isString
Answer `false'.


isSymbol
Answer `false'.


notNil
Answer whether the receiver is not nil


respondsTo: aSymbol
Returns true if the receiver understands the given selector


[ Previous:Object-testing functionality | Up:Object ]

Object: VM callbacks

badReturnError
Called back when a block performs a bad return


mustBeBoolean
Called by the system when ifTrue:*, ifFalse:*, and: or or: are sent to anything but a boolean


noRunnableProcess
Called back when all processes are suspended


[Up: Class Index]

ObjectDumper

Category: Streams-Files
I'm not part of a normal Smalltalk system, but most Smalltalks provide a similar feature: that is, support for storing objects in a binary format; there are many advantages in using me instead of #storeOn: and the Smalltalk compiler - My instances store data in a very compact format - Loading is much faster when compared with compiling the Smalltalk code prepared by #storeOn: - Almost all Smalltalks don't allow programmers to ship the compiler as part of the run-time image - My instances support circular references between objects, while #storeOn: supports it only if you know of such references at design time and you override #storeOn: to deal with them


[ Next: | Up:ObjectDumper ]

ObjectDumper class: establishing proxy classes

disableProxyFor: aClass
Disable proxies for instances of aClass and its descendants


hasProxyFor: aClass
Answer whether a proxy class has been registered for instances of aClass.


proxyFor: anObject
Answer a valid proxy for an object, or nil if none could be found


registerProxyClass: aProxyClass for: aClass
Register the proxy class aProxyClass - descendent of DumperProxy - to be used for instances of aClass and its descendants


[ Next: | Previous:ObjectDumper class-establishing proxy classes | Up:ObjectDumper ]

ObjectDumper class: instance creation

new
This method should not be called for instances of this class.


on: aFileStream
Answer an ObjectDumper working on aFileStream.


[ Next: | Previous:ObjectDumper class-instance creation | Up:ObjectDumper ]

ObjectDumper class: shortcuts

dump: anObject to: aFileStream
Dump anObject to aFileStream. Answer anObject


loadFrom: aFileStream
Load an object from aFileStream and answer it


[ Next: | Previous:ObjectDumper class-shortcuts | Up:ObjectDumper ]

ObjectDumper class: testing

example
This is a real torture test: it outputs recursive objects, identical objects multiple times, classes, metaclasses, integers and characters!


[ Next: | Previous:ObjectDumper class-testing | Up:ObjectDumper ]

ObjectDumper: accessing

stream
Answer `stream'.


[ Next: | Previous:ObjectDumper-accessing | Up:ObjectDumper ]

ObjectDumper: loading/dumping objects

dump: anObject
Dump anObject on the stream associated with the receiver. Answer anObject


load
Load an object from the stream associated with the receiver and answer it


[ Previous:ObjectDumper-loading/dumping objects | Up:ObjectDumper ]

ObjectDumper: stream interface

atEnd
Answer whether the underlying stream is at EOF


next
Load an object from the underlying stream


nextPut: anObject
Store an object on the underlying stream


[Up: Class Index]

OrderedCollection

Category: Collections-Sequenceable
My instances represent ordered collections of arbitrary typed objects which are not directly accessible by an index. They can be accessed indirectly through an index, and can be manipulated by adding to the end or based on content (such as add:after:)


[ Next: | Up:OrderedCollection ]

OrderedCollection class: instance creation

new
Answer an OrderedCollection of default size


new: anInteger
Answer an OrderedCollection of size anInteger


[ Next: | Previous:OrderedCollection class-instance creation | Up:OrderedCollection ]

OrderedCollection: accessing

after: oldObject
Return the element after oldObject. Error if oldObject not found or if no following object is available


at: anIndex
Answer the anIndex-th item of the receiver


at: anIndex put: anObject
Store anObject at the anIndex-th item of the receiver, answer anObject


before: oldObject
Return the element after oldObject. Error if oldObject not found or if no following object is available


size
Return the number of objects in the receiver


[ Next: | Previous:OrderedCollection-accessing | Up:OrderedCollection ]

OrderedCollection: adding

add: anObject
Add anObject in the receiver, answer it


add: newObject after: oldObject
Add newObject in the receiver just after oldObject, answer it. Fail if oldObject can't be found


add: newObject afterIndex: i
Add newObject in the receiver just after the i-th, answer it. Fail if i < 0 or i > self size


add: newObject before: oldObject
Add newObject in the receiver just before oldObject, answer it. Fail if oldObject can't be found


add: newObject beforeIndex: i
Add newObject in the receiver just before the i-th, answer it. Fail if i < 1 or i > self size + 1


addAll: aCollection
Add every item of aCollection to the receiver, answer it


addAll: newCollection after: oldObject
Add every item of newCollection to the receiver just after oldObject, answer it. Fail if oldObject is not found


addAll: newCollection afterIndex: i
Add every item of newCollection to the receiver just after the i-th, answer it. Fail if i < 0 or i > self size


addAll: newCollection before: oldObject
Add every item of newCollection to the receiver just before oldObject, answer it. Fail if oldObject is not found


addAll: newCollection beforeIndex: i
Add every item of newCollection to the receiver just before the i-th, answer it. Fail if i < 1 or i > self size + 1


addAllFirst: aCollection
Add every item of newCollection to the receiver right at the start of the receiver. Answer aCollection


addAllLast: aCollection
Add every item of newCollection to the receiver right at the end of the receiver. Answer aCollection


addFirst: newObject
Add newObject to the receiver right at the start of the receiver. Answer newObject


addLast: newObject
Add newObject to the receiver right at the end of the receiver. Answer newObject


[ Previous:OrderedCollection-adding | Up:OrderedCollection ]

OrderedCollection: removing

remove: anObject ifAbsent: aBlock
Remove anObject from the receiver. If it can't be found, answer the result of evaluating aBlock


removeAtIndex: anIndex
Remove the object at index anIndex from the receiver. Fail if the index is out of bounds


removeFirst
Remove an object from the start of the receiver. Fail if the receiver is empty


removeLast
Remove an object from the end of the receiver. Fail if the receiver is empty


[Up: Class Index]

PackageLoader

Category: Language-Data types
I am not part of a standard Smalltalk system. I provide methods for loading packages into a Smalltalk image, correctly handling dependencies.


[ Next: | Up:PackageLoader ]

PackageLoader class: accessing

addPackage: package directory: dir fileIn: fileIns needs: prerequisites
Add the given package to the `packages' file, with the given directory (if relative, it is relative to the kernel directory), fileIns and prerequisites. fileIns and prerequisites should be two Collections of Strings. Note that none of this fields are optional. If there are no prere- quisites, just use #('Kernel') as the prerequisites.


directoryFor: package
Answer a complete path to the given package's file-in


fileInsFor: package
Answer a Set of Strings containing the filenames of the given package's file-ins (relative to the directory answered by #directoryFor:)


prerequisitesFor: package
Answer a Set of Strings containing the prerequisites for the given package


refreshDependencies
Reload the `packages' file in the image directory


[ Next: | Previous:PackageLoader class-accessing | Up:PackageLoader ]

PackageLoader class: loading

extractDependenciesFor: packagesList onError: aBlock
Answer an OrderedCollection containing all the packages which you have to load to enable the packages in packagesList, in an appropriate order. For example PackageLoader extractDependenciesFor: #('BloxTestSuite' 'Blox' 'Browser') on a newly built image will evaluate to an OrderedCollection containing 'Kernel', 'C:tclInit', 'Blox', 'BloxTestSuite' and 'Browser'. Note that Blox has been moved before BloxTestSuite. Pass an error message to aBlock if any of the packages needs C call-outs which are not defined.


fileInPackage: package
File in the given package into GNU Smalltalk.


fileInPackages: packagesList
File in all the packages in packagesList into GNU Smalltalk.


[ Previous:PackageLoader class-loading | Up:PackageLoader ]

PackageLoader class: testing

canLoad: package
Answer whether all the needed C call-outs are registered within GNU Smalltalk


[Up: Class Index]

PluggableAdaptor

Category: Language-Data types
I mediate between complex get/set behavior and the #value/#value: protocol used by ValueAdaptors. The get/set behavior can be implemented by two blocks, or can be delegated to another object with messages such as #someProperty to get and #someProperty: to set.


[ Next: | Up:PluggableAdaptor ]

PluggableAdaptor class: creating instances

getBlock: getBlock putBlock: putBlock
Answer a PluggableAdaptor using the given blocks to implement #value and #value:


on: anObject aspect: aSymbol
Answer a PluggableAdaptor using anObject's aSymbol message to implement #value, and anObject's aSymbol: message (aSymbol followed by a colon) to implement #value:


on: anObject getSelector: getSelector putSelector: putSelector
Answer a PluggableAdaptor using anObject's getSelector message to implement #value, and anObject's putSelector message to implement #value:


on: anObject index: anIndex
Answer a PluggableAdaptor using anObject's #at: and #at:put: message to implement #value and #value:; the first parameter of #at: and #at:put: is anIndex


on: aDictionary key: aKey
Same as #on:index:. Provided for clarity and completeness.


[ Previous:PluggableAdaptor class-creating instances | Up:PluggableAdaptor ]

PluggableAdaptor: accessing

value
Get the value of the receiver.


value: anObject
Set the value of the receiver.


[Up: Class Index]

Point

Category: Language-Data types
Beginning of a Point class for simple display manipulation. Has not been exhaustively tested but appears to work for the basic primitives and for the needs of the Rectangle class.


[ Next: | Up:Point ]

Point class: instance creation

new
Create a new point with both coordinates set to 0


x: xInteger y: yInteger
Create a new point with the given coordinates


[ Next: | Previous:Point class-instance creation | Up:Point ]

Point: accessing

x
Answer the x coordinate


x: aNumber
Set the x coordinate to aNumber


x: anXNumber y: aYNumber
Set the x and y coordinate to anXNumber and aYNumber, respectively


y
Answer the y coordinate


y: aNumber
Set the y coordinate to aNumber


[ Next: | Previous:Point-accessing | Up:Point ]

Point: arithmetic

* scale
Multiply the receiver by scale, which can be a Number or a Point


+ delta
Sum the receiver and delta, which can be a Number or a Point


- delta
Subtract delta, which can be a Number or a Point, from the receiver


/ scale
Divide the receiver by scale, which can be a Number or a Point, with no loss of precision


// scale
Divide the receiver by scale, which can be a Number or a Point, with truncation towards -infinity


abs
Answer a new point whose coordinates are the absolute values of the receiver's


[ Next: | Previous:Point-arithmetic | Up:Point ]

Point: comparing

< aPoint
Answer whether the receiver is higher and to the left of aPoint


<= aPoint
Answer whether aPoint is equal to the receiver, or the receiver is higher and to the left of aPoint


= aPoint
Answer whether the receiver is equal to aPoint


> aPoint
Answer whether the receiver is lower and to the right of aPoint


>= aPoint
Answer whether aPoint is equal to the receiver, or the receiver is lower and to the right of aPoint


max: aPoint
Answer self if it is lower and to the right of aPoint, aPoint otherwise


min: aPoint
Answer self if it is higher and to the left of aPoint, aPoint otherwise


[ Next: | Previous:Point-comparing | Up:Point ]

Point: converting

asPoint
Answer the receiver.


asRectangle
Answer an empty rectangle whose origin is self


corner: aPoint
Answer a Rectangle whose origin is the receiver and whose corner is aPoint


extent: aPoint
Answer a Rectangle whose origin is the receiver and whose extent is aPoint


hash
Answer an hash value for the receiver


[ Next: | Previous:Point-converting | Up:Point ]

Point: point functions

arcTan
Answer the angle (measured counterclockwise) between the receiver and a ray starting in (0, 0) and moving towards (1, 0) - i.e. 3 o'clock


dist: aPoint
Answer the distance between the receiver and aPoint


dotProduct: aPoint
Answer the dot product between the receiver and aPoint


grid: aPoint
Answer a new point whose coordinates are rounded towards the nearest multiple of aPoint


normal
Rotate the Point 90degrees clockwise and get the unit vector


transpose
Answer a new point whose coordinates are the receiver's coordinates exchanged (x becomes y, y becomes x)


truncatedGrid: aPoint
Answer a new point whose coordinates are rounded towards -infinity, to a multiple of grid (which must be a Point)


[ Next: | Previous:Point-point functions | Up:Point ]

Point: printing

printOn: aStream
Print a representation for the receiver on aStream


[ Next: | Previous:Point-printing | Up:Point ]

Point: storing

storeOn: aStream
Print Smalltalk code compiling to the receiver on aStream


[ Previous:Point-storing | Up:Point ]

Point: truncation and round off

rounded
Answer a new point whose coordinates are rounded to the nearest integer


truncateTo: grid
Answer a new point whose coordinates are rounded towards -infinity, to a multiple of grid (which must be a Number)


[Up: Class Index]

PositionableStream

Category: Streams-Collections
My instances represent streams where explicit positioning is permitted. Thus, my streams act in a manner to normal disk files: you can read or write sequentially, but also position the file to a particular place whenever you choose. Generally, you'll want to use ReadStream, WriteStream or ReadWriteStream instead of me to create and use streams.


[ Next: | Up:PositionableStream ]

PositionableStream class: instance creation

on: aCollection
Answer an instance of the receiver streaming on the whole contents of aCollection


on: aCollection from: firstIndex to: lastIndex
Answer an instance of the receiver streaming from the firstIndex-th item of aCollection to the lastIndex-th


[ Next: | Previous:PositionableStream class-instance creation | Up:PositionableStream ]

PositionableStream: accessing-reading

contents
Returns a collection of the same type that the stream accesses, up to and including the final element.


copyFrom: start to: end
Answer the collection on which the receiver is streaming, from the start-th item to the end-th


next
Answer the next item of the receiver


nextLine
Returns a collection of the same type that the stream accesses, up to but not including the object anObject. Returns the entire rest of the stream's contents if anObject is not present.


peek
Returns the next element of the stream without moving the pointer. Returns nil when at end of stream.


peekFor: anObject
Returns true and gobbles the next element from the stream of it is equal to anObject, returns false and doesn't gobble the next element if the next element is not equal to anObject.


reverseContents
Returns a collection of the same type that the stream accesses, up to and including the final element, but in reverse order.


upTo: anObject
Returns a collection of the same type that the stream accesses, up to but not including the object anObject. Returns the entire rest of the stream's contents if anObject is not present.


upToAll: aCollection
If there is a sequence of objects remaining in the stream that is equal to the sequence in aCollection, set the stream position just past that sequence and answer the elements up to, but not including, the sequence. Else, set the stream position to its end and answer all the remaining elements.


upToEnd
Answer every item in the collection on which the receiver is streaming, from the next one to the last


[ Next: | Previous:PositionableStream-accessing-reading | Up:PositionableStream ]

PositionableStream: class type methods

species
The collections returned by #upTo: etc. are the same kind as those returned by the collection with methods such as #select:


[ Next: | Previous:PositionableStream-class type methods | Up:PositionableStream ]

PositionableStream: positioning

basicPosition: anInteger
Move the stream pointer to the anInteger-th object


position
Answer the current value of the stream pointer


position: anInteger
Move the stream pointer to the anInteger-th object


reset
Move the stream back to its first element. For write-only streams, the stream is truncated there.


setToEnd
Move the current position to the end of the stream.


skip: anInteger
Move the current position by anInteger places, either forwards or backwards.


skipTo: anObject
Move the current position to after the next occurrence of anObject and return true if anObject was found. If anObject doesn't exist, the pointer is atEnd, and false is returned.


skipToAll: aCollection
If there is a sequence of objects remaining in the stream that is equal to the sequence in aCollection, set the stream position just past that sequence and answer true. Else, set the stream position to its end and answer false.


[ Next: | Previous:PositionableStream-positioning | Up:PositionableStream ]

PositionableStream: testing

atEnd
Answer whether the objects in the stream have reached an end


basicAtEnd
Answer whether the objects in the stream have reached an end. This method must NOT be overridden.


isEmpty
Answer whether the stream has no objects


[ Previous:PositionableStream-testing | Up:PositionableStream ]

PositionableStream: truncating

truncate
Truncate the receiver to the current position - only valid for writing streams


[Up: Class Index]

Process

Category: Language-Processes
I represent a unit of computation. My instances are independantly executable blocks that have a priority associated with them, and they can suspend themselves and resume themselves however they wish.


[ Next: | Up:Process ]

Process class: basic

on: aBlockContext at: aPriority
Private - Create a process running aBlockContext at the given priority


[ Next: | Previous:Process class-basic | Up:Process ]

Process: accessing

name
Answer `name'.


name: aString
Give the name aString to the process


priority
Answer the receiver's priority


priority: anInteger
Change the receiver's priority to anInteger


queueInterrupt: aBlock
Force the receiver to be interrupted and to evaluate aBlock as soon as it becomes the active process (this could mean NOW if the receiver is active). Answer the receiver


[ Next: | Previous:Process-accessing | Up:Process ]

Process: basic

forceResume
Private - Force a resume of the process from whatever status it was in (even if it was waiting on a semaphore). This is BAD practice, it is present only for some future possibility.


suspend
Do nothing if we're already suspended. Note that the blue book made suspend a primitive - but the real primitive is yielding control to another process. Suspending is nothing more than taking ourselves out of every scheduling list and THEN yield control to another process


terminate
Terminate the receiver - This is nothing more than prohibiting to resume the process, then suspending it.


[ Next: | Previous:Process-basic | Up:Process ]

Process: builtins

resume
Resume the receiver's execution


yield
Yield control from the receiver to other processes


[ Previous:Process-builtins | Up:Process ]

Process: printing

printOn: aStream
Print a representation of the receiver on aStream


[Up: Class Index]

ProcessorScheduler

Category: Language-Processes
I provide methods that control the execution of processes.


[ Next: | Up:ProcessorScheduler ]

ProcessorScheduler: basic

activePriority
Answer the active process' priority


activeProcess
Answer the active process


changePriorityOf: aProcess to: aPriority
Private - Move aProcess to the execution list for aPriority, answer the new execution list


processesAt: aPriority
Private - Answer a linked list of processes at the given priority


terminateActive
Private - Terminate the active process


yield
Let the active process yield control to other processes


[ Next: | Previous:ProcessorScheduler-basic | Up:ProcessorScheduler ]

ProcessorScheduler: priorities

highIOPriority
Answer the priority for system high-priority I/O processes


lowIOPriority
Answer the priority for system low-priority I/O processes


priorityName: priority
Private - Answer a name for the given process priority


systemBackgroundPriority
Answer the priority for system background-priority processes


timingPriority
Answer the priority for system real-time processes


userBackgroundPriority
Answer the priority for user background-priority processes


userInterruptPriority
Answer the priority for user interrupt-priority processes


userSchedulingPriority
Answer the priority for user standard-priority processes


[ Previous:ProcessorScheduler-priorities | Up:ProcessorScheduler ]

ProcessorScheduler: timed invocation

isTimeoutProgrammed
Private - Answer whether there is a pending call to #signal:atMilliseconds:


signal: aSemaphore atMilliseconds: millis
Private - signal 'aSemaphore' after 'millis' milliseconds have elapsed


signal: aSemaphore onInterrupt: anIntegerSignalNumber
Private - signal 'aSemaphore' when the given C signal occurs


[Up: Class Index]

Random

Category: Streams
My instances are generator streams that produce random numbers, which are floating point values between 0 and 1.


[ Next: | Up:Random ]

Random class: instance creation

new
Create a new random number generator whose seed is given by the current time on the millisecond clock


seed: aFloat
Create a new random number generator whose seed is aFloat


[ Next: | Previous:Random class-instance creation | Up:Random ]

Random: basic

atEnd
This stream never ends. Always answer false


next
Return the next random number in the sequence


nextPut: value
This method should not be called for instances of this class.


[ Previous:Random-basic | Up:Random ]

Random: testing

chiSquare
returns under Pentium II, NT 4.0, 93.0


chiSquare: n range: r
Return the chi-square deduced from calculating n random numbers in the 0..r range


[Up: Class Index]

ReadStream

Category: Streams-Collections
I implement the set of read-only stream objects. You may read from my objects, but you may not write to them.


[ Next: | Up:ReadStream ]

ReadStream class: instance creation

on: aCollection
Answer a new stream working on aCollection from its start.


[ Previous:ReadStream class-instance creation | Up:ReadStream ]

ReadStream: accessing-reading

reverseContents
May be faster than generic stream reverseContents.


size
Answer the receiver's size.


[Up: Class Index]

ReadWriteStream

Category: Streams-Collections
I am the class of streams that may be read and written from simultaneously. In some sense, I am the best of both ReadStream and WriteStream.


[ Next: | Up:ReadWriteStream ]

ReadWriteStream class: instance creation

on: aCollection
Answer a new stream working on aCollection from its end. You can use #skip: or #position: to move back.


onEmpty: aCollection
Extension: do not require the use of the entire stream - pretend that the stream is empty, regardless of the size of the collection that it operates over. Answer a new stream working on aCollection from its start.


[ Previous:ReadWriteStream class-instance creation | Up:ReadWriteStream ]

ReadWriteStream: positioning

position: anInteger
Unlike WriteStreams, ReadWriteStreams don't truncate the stream


skip: anInteger
Unlike WriteStreams, ReadWriteStreams don't truncate the stream


[Up: Class Index]

Rectangle

Category: Language-Data types
Beginning of the Rectangle class for simple display manipulation. Rectangles require the Point class to be available. An extension to the Point class is made here that since it requires Rectangles to be defined (see converting)


[ Next: | Up:Rectangle ]

Rectangle class: instance creation

left: leftNumber right: rightNumber top: topNumber bottom: bottomNumber
Answer a rectangle with the given coordinates


new
Answer the (0 @ 0 corner: 0 @ 0) rectangle


origin: originPoint corner: cornerPoint
Answer a rectangle with the given corners


origin: originPoint extent: extentPoint
Answer a rectangle with the given origin and size


[ Next: | Previous:Rectangle class-instance creation | Up:Rectangle ]

Rectangle: accessing

bottom
Answer the corner's y of the receiver


bottom: aNumber
Set the corner's y of the receiver


bottomCenter
Answer the center of the receiver's bottom side


bottomLeft
Answer the bottom-left corner of the receiver


bottomLeft: aPoint
Answer the receiver with the bottom-left changed to aPoint


bottomRight
Answer the bottom-right corner of the receiver


bottomRight: aPoint
Change the bottom-right corner of the receiver


center
Answer the center of the receiver


corner
Answer the corner of the receiver


corner: aPoint
Set the corner of the receiver


extent
Answer the extent of the receiver


extent: aPoint
Change the size of the receiver, keeping the origin the same


height
Answer the height of the receiver


height: aNumber
Set the height of the receiver


left
Answer the x of the left edge of the receiver


left: aValue
Set the x of the left edge of the receiver


left: l top: t right: r bottom: b
Change all four the coordinates of the receiver's corners


leftCenter
Answer the center of the receiver's left side


origin
Answer the top-left corner of the receiver


origin: aPoint
Change the top-left corner of the receiver to aPoint


origin: pnt1 corner: pnt2
Change both the origin (top-left corner) and the corner (bottom-right corner) of the receiver


origin: pnt1 extent: pnt2
Change the top-left corner and the size of the receiver


right
Answer the x of the bottom-right corner of the receiver


right: aNumber
Change the x of the bottom-right corner of the receiver


rightCenter
Answer the center of the receiver's right side


top
Answer the y of the receiver's top-left corner


top: aValue
Change the y of the receiver's top-left corner


topCenter
Answer the center of the receiver's top side


topLeft
Answer the receiver's top-left corner


topLeft: aPoint
Change the receiver's top-left corner's coordinates to aPoint


topRight
Answer the receiver's top-right corner


topRight: aPoint
Change the receiver's top-right corner to aPoint


width
Answer the receiver's width


width: aNumber
Change the receiver's width to aNumber


[ Next: | Previous:Rectangle-accessing | Up:Rectangle ]

Rectangle: printing

printOn: aStream
Print a representation of the receiver on aStream


storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


[ Next: | Previous:Rectangle-printing | Up:Rectangle ]

Rectangle: rectangle functions

amountToTranslateWithin: aRectangle
Answer a Point so that if aRectangle is translated by that point, its origin coincides with the receiver's.


area
Answer the receiver's area. The area is the width times the height, so it is possible for it to be negative if the rectangle is not normalized.


areasOutside: aRectangle
Answer a collection of rectangles containing the parts of the receiver outside of aRectangle. For all points in the receiver, but outside aRectangle, exactly one rectangle in the collection will contain that point.


expandBy: delta
Answer a new rectangle that is the receiver expanded by aValue: if aValue is a rectangle, calculate origin=origin-aValue origin, corner=corner+aValue corner; else calculate origin=origin-aValue, corner=corner+aValue.


insetBy: delta
Answer a new rectangle that is the receiver inset by aValue: if aValue is a rectangle, calculate origin=origin+aValue origin, corner=corner-aValue corner; else calculate origin=origin+aValue, corner=corner-aValue.


insetOriginBy: originDelta corner: cornerDelta
Answer a new rectangle that is the receiver inset so that origin=origin+originDelta, corner=corner-cornerDelta. The deltas can be points or numbers


intersect: aRectangle
Returns the rectangle (if any) created by the overlap of rectangles A and B.


merge: aRectangle
Answer a new rectangle which is the smallest rectangle containing both the receiver and aRectangle.


[ Next: | Previous:Rectangle-rectangle functions | Up:Rectangle ]

Rectangle: testing

= aRectangle
Answer whether the receiver is equal to aRectangle


contains: aRectangle
Answer true if the receiver contains (see containsPoint:) both aRectangle's origin and aRectangle's corner


containsPoint: aPoint
Answer true if aPoint is equal to, or below and to the right of, the receiver's origin; and aPoint is above and to the left of the receiver's corner


hash
Answer an hash value for the receiver


intersects: aRectangle
Answer true if the receiver intersect aRectangle, i.e. if it contains (see containsPoint:) any of aRectangle corners or if aRectangle contains the receiver


[ Next: | Previous:Rectangle-testing | Up:Rectangle ]

Rectangle: transforming

moveBy: aPoint
Change the receiver so that the origin and corner are shifted by aPoint


moveTo: aPoint
Change the receiver so that the origin moves to aPoint and the size remains unchanged


scaleBy: scale
Answer a copy of the receiver in which the origin and corner are multiplied by scale


translateBy: factor
Answer a copy of the receiver in which the origin and corner are shifted by aPoint


[ Previous:Rectangle-transforming | Up:Rectangle ]

Rectangle: truncation and round off

rounded
Answer a copy of the receiver with the coordinates rounded to the nearest integers


[Up: Class Index]

RunArray

Category: Collection-Sequenceable
My instances are OrderedCollections that automatically apply Run Length Encoding compression to the things they store. Be careful when using me: I can provide great space savings, but my instances don't grant linear access time. RunArray's behavior currently is similar to that of OrderedCollection (you can add elements to RunArrays); maybe it should behave like an ArrayedCollection.


[ Next: | Up:RunArray ]

RunArray class: instance creation

new
Answer an empty RunArray


new: aSize
Answer a RunArray with space for aSize runs


[ Next: | Previous:RunArray class-instance creation | Up:RunArray ]

RunArray: accessing

at: anIndex
Answer the element at index anIndex


at: anIndex put: anObject
Replace the element at index anIndex with anObject and answer anObject


[ Next: | Previous:RunArray-accessing | Up:RunArray ]

RunArray: adding

add: anObject afterIndex: anIndex
Add anObject after the element at index anIndex


addAll: aCollection afterIndex: anIndex
Add all the elements of aCollection after the one at index anIndex. If aCollection is unordered, its elements could be added in an order which is not the #do: order


addAllFirst: aCollection
Add all the elements of aCollection at the beginning of the receiver. If aCollection is unordered, its elements could be added in an order which is not the #do: order


addAllLast: aCollection
Add all the elements of aCollection at the end of the receiver. If aCol- lection is unordered, its elements could be added in an order which is not the #do: order


addFirst: anObject
Add anObject at the beginning of the receiver. Watch out: this operation can cause serious performance pitfalls


addLast: anObject
Add anObject at the end of the receiver


[ Next: | Previous:RunArray-adding | Up:RunArray ]

RunArray: basic

first
Answer the first element in the receiver


last
Answer the last element of the receiver


size
Answer the number of elements in the receiver


[ Next: | Previous:RunArray-basic | Up:RunArray ]

RunArray: copying

deepCopy
Answer a copy of the receiver containing copies of the receiver's elements (#copy is used to obtain them)


shallowCopy
Answer a copy of the receiver. The elements are not copied


[ Next: | Previous:RunArray-copying | Up:RunArray ]

RunArray: enumerating

do: aBlock
Enumerate all the objects in the receiver, passing each one to aBlock


objectsAndRunLengthsDo: aBlock
Enumerate all the runs in the receiver, passing to aBlock two parameters for every run: the first is the repeated object, the second is the number of copies


[ Next: | Previous:RunArray-enumerating | Up:RunArray ]

RunArray: removing

removeAtIndex: anIndex
Remove the object at index anIndex from the receiver and answer the removed object


removeFirst
Remove the first object from the receiver and answer the removed object


removeLast
Remove the last object from the receiver and answer the removed object


[ Next: | Previous:RunArray-removing | Up:RunArray ]

RunArray: searching

indexOf: anObject startingAt: anIndex ifAbsent: aBlock
Answer the index of the first copy of anObject in the receiver, starting the search at the element at index anIndex. If no equal object is found, answer the result of evaluating aBlock


[ Previous:RunArray-searching | Up:RunArray ]

RunArray: testing

= anObject
Answer true if the receiver is equal to anObject


hash
Answer an hash value for the receiver


[Up: Class Index]

Semaphore

Category: Language-Processes
My instances represent counting semaphores. I provide methods for signalling the semaphore's availability, and methods for waiting for its availability. I also provide some methods for implementing critical sections. I currently do not (because the underlying system does not) support asynchronous signals, such as might be generated by C signals.


[ Next: | Up:Semaphore ]

Semaphore class: instance creation

forMutualExclusion
Answer a new semaphore with a signal on it. These semaphores are a useful shortcut when you use semaphores as critical sections.


new
Answer a new semaphore


[ Next: | Previous:Semaphore class-instance creation | Up:Semaphore ]

Semaphore: builtins

signal
Signal the receiver, resuming a waiting process' if there is one


wait
Wait for the receiver to be signalled, suspending the executing process if it is not yet


[ Previous:Semaphore-builtins | Up:Semaphore ]

Semaphore: mutual exclusion

critical: aBlock
Wait for the receiver to be free, execute aBlock and signal the receiver again. Return the result of evaluating aBlock. aBlock MUST NOT CONTAIN A RETURN!!!


[Up: Class Index]

SequenceableCollection

Category: Collections-Sequenceable
My instances represent collections of objects that are ordered. I provide some access and manipulation methods.


[ Next: | Up:SequenceableCollection ]

SequenceableCollection: basic

after: oldObject
Return the element after oldObject. Error if oldObject not found or if no following object is available


atAll: aCollection put: anObject
Put anObject at every index contained in aCollection


atAllPut: anObject
Put anObject at every index in the receiver


before: oldObject
Return the element before oldObject. Error if oldObject not found or if no preceding object is available


first
Answer the first item in the receiver


indexOf: anElement
Answer the index of the first occurrence of anElement in the receiver. Answer 0 if no item is found


indexOf: anElement ifAbsent: exceptionBlock
Answer the index of the first occurrence of anElement in the receiver. Invoke exceptionBlock and answer its result if no item is found


indexOf: anElement startingAt: anIndex
Answer the first index > anIndex which contains anElement. Answer 0 if no item is found


indexOf: anElement startingAt: anIndex ifAbsent: exceptionBlock
Answer the first index > anIndex which contains anElement. Invoke exceptionBlock and answer its result if no item is found


indexOfSubCollection: aSubCollection
Answer the first index > anIndex at which starts a sequence of items matching aSubCollection. Answer 0 if no such sequence is found.


indexOfSubCollection: aSubCollection ifAbsent: exceptionBlock
Answer the first index > anIndex at which starts a sequence of items matching aSubCollection. Answer 0 if no such sequence is found.


indexOfSubCollection: aSubCollection startingAt: anIndex
Answer the first index > anIndex at which starts a sequence of items matching aSubCollection. Answer 0 if no such sequence is found.


indexOfSubCollection: aSubCollection startingAt: anIndex ifAbsent: exceptionBlock
Answer the first index > anIndex at which starts a sequence of items matching aSubCollection. Invoke exceptionBlock and answer its result if no such sequence is found


last
Answer the last item in the receiver


[ Next: | Previous:SequenceableCollection-basic | Up:SequenceableCollection ]

SequenceableCollection: copying SequenceableCollections

, aSequenceableCollection
Append aSequenceableCollection at the end of the receiver (using #add:), and answer a new collection


copyFrom: start to: stop
Answer a new collection containing all the items in the receiver from the start-th and to the stop-th


copyReplaceAll: oldSubCollection with: newSubCollection
Answer a new collection in which all the sequences matching oldSubCollection are replaced with newSubCollection


copyReplaceFrom: start to: stop with: replacementCollection
Answer a new collection of the same class as the receiver that contains the same elements as the receiver, in the same order, except for elements from index `start' to index `stop'. If start < stop, these are replaced by the contents of the replacementCollection. Instead, If start = (stop + 1), like in `copyReplaceFrom: 4 to: 3 with: anArray', then every element of the receiver will be present in the answered copy; the operation will be an append if stop is equal to the size of the receiver or, if it is not, an insert before index `start'.


copyReplaceFrom: start to: stop withObject: anObject
Answer a new collection of the same class as the receiver that contains the same elements as the receiver, in the same order, except for elements from index `start' to index `stop'. If start < stop, these are replaced by the single element anObject. Instead, If start = (stop + 1), then every element of the receiver will be present in the answered copy; the operation will be an append if stop is equal to the size of the receiver or, if it is not, an insert before index `start'.


[ Next: | Previous:SequenceableCollection-copying SequenceableCollections | Up:SequenceableCollection ]

SequenceableCollection: enumerating

do: aBlock
Evaluate aBlock for all elements in the sequenceable collection


doWithIndex: aBlock
Evaluate aBlock for all elements in the sequenceable collection, passing the index of each element as the second parameter


findFirst: aBlock
Returns the index of the first element of the sequenceable collection for which aBlock returns true, or 0 if none


findLast: aBlock
Returns the index of the last element of the sequenceable collection for which aBlock returns true, or 0 if none does


from: startIndex to: stopIndex do: aBlock
Evaluate aBlock for all elements in the sequenceable collection whose indices are in the range index to stopIndex


from: startIndex to: stopIndex doWithIndex: aBlock
Evaluate aBlock for all elements in the sequenceable collection whose indices are in the range index to stopIndex, passing the index of each element as the second parameter


readStream
Answer a ReadStream streaming on the receiver


readWriteStream
Answer a ReadWriteStream which streams on the receiver


reverse
Answer the receivers' contents in reverse order


reverseDo: aBlock
Evaluate aBlock for all elements in the sequenceable collection, from the last to the first.


with: aSequenceableCollection do: aBlock
Evaluate aBlock for each pair of elements took respectively from the re- ceiver and from aSequenceableCollection. Fail if the receiver has not the same size as aSequenceableCollection.


writeStream
Answer a WriteStream streaming on the receiver


[ Next: | Previous:SequenceableCollection-enumerating | Up:SequenceableCollection ]

SequenceableCollection: replacing items

replaceFrom: start to: stop with: replacementCollection
Replace the items from start to stop with replacementCollection's items from 1 to stop-start+1


replaceFrom: start to: stop with: replacementCollection startingAt: repStart
Replace the items from start to stop with replacementCollection's items from repStart to repStart+stop-start


replaceFrom: anIndex to: stopIndex withObject: replacementObject
Replace every item from start to stop with replacementObject.


[ Previous:SequenceableCollection-replacing items | Up:SequenceableCollection ]

SequenceableCollection: testing

= aCollection
Answer whether the receiver's items match those in aCollection


hash
Answer an hash value for the receiver


inspect
Print all the instance variables and context of the receiver on the Transcript


[Up: Class Index]

Set

Category: Collections-Unordered
I am the typical set object; I can store any objects uniquely. I use the = operator to determine duplication of objects.


[ Next: | Up:Set ]

Set class: instance creation

new
Answer a new instance of the receiver with a default size


new: anInteger
Answer a new instance of the receiver with the given size


[ Next: | Previous:Set class-instance creation | Up:Set ]

Set: accessing

add: newObject
Add newObject to the set, if and only if the set doesn't already contain an occurrence of it. Don't fail if a duplicate is found. Answer anObject


at: index
This method should not be called for instances of this class.


at: index put: value
This method should not be called for instances of this class.


[ Next: | Previous:Set-accessing | Up:Set ]

Set: awful ST-80 compatibility hacks

findObjectIndex: object
Tries to see if anObject exists as an indexed variable. As soon as nil or anObject is found, the index of that slot is answered


[ Next: | Previous:Set-awful ST-80 compatibility hacks | Up:Set ]

Set: enumerating the elements of a collection

do: aBlock
Enumerate all the non-nil members of the set


[ Next: | Previous:Set-enumerating the elements of a collection | Up:Set ]

Set: rehashing

rehash
Rehash the receiver


[ Next: | Previous:Set-rehashing | Up:Set ]

Set: Removing from a collection

remove: oldObject ifAbsent: anExceptionBlock
Remove oldObject to the set. If it is found, answer oldObject. Otherwise, evaluate anExceptionBlock and return its value.


[ Next: | Previous:Set-Removing from a collection | Up:Set ]

Set: storing

storeOn: aStream
Store on aStream some Smalltalk code which compiles to the receiver


[ Previous:Set-storing | Up:Set ]

Set: testing collections

= aSet
Returns true if the two sets have the same membership, false if not


capacity
Answer how many elements the receiver can hold before having to grow.


hash
Return the hash code for the members of the set. Since order is unimportant, we use a commutative operator to compute the hash value.


includes: anObject
Answer whether the receiver contains an instance of anObject.


isEmpty
Answer whether the receiver is empty.


occurrencesOf: anObject
Return the number of occurrences of anObject. Since we're a set, this is either 0 or 1. Nil is never directly in the set, so we special case it (the result is always 1).


size
Answer the receiver's size


[Up: Class Index]

SharedQueue

Category: Language-Processes
My instances provide a guaranteed safe mechanism to allow for communication between processes. All access to the underlying data structures is controlled with critical sections so that things proceed smoothly.


[ Next: | Up:SharedQueue ]

SharedQueue class: instance creation

new
Create a new instance of the receiver


[ Previous:SharedQueue class-instance creation | Up:SharedQueue ]

SharedQueue: accessing

next
Wait for an object to be on the queue, then remove it and answer it


nextPut: value
Put value on the queue and answer it


[Up: Class Index]

Signal

Category: Language-Exceptions
My instances describe an exception that has happened, and are passed to exception handlers. Apart from containing information on the generated exception and its arguments, they contain methods that allow you to resume execution, leave the #on:do:... snippet, and pass the exception to an handler with a lower priority.


[ Next: | Up:Signal ]

Signal: accessing

argument
Answer the first argument of the receiver


argumentCount
Answer how many arguments the receiver has


arguments
Answer the arguments of the receiver


description
Answer the description of the raised exception


exception
Answer the exception that was raised


[ Previous:Signal-accessing | Up:Signal ]

Signal: exception handling

defaultAction
Execute the default handler for the raised exception


isNested
Answer whether the current exception handler is within the scope of another handler for the same exception.


outer
Raise the exception that instantiated the receiver, passing the same parameters. If the receiver is resumable and the evaluated exception action resumes then the result returned from #outer will be the resumption value of the evaluated exception action. If the receiver is not resumable or if the exception action does not resume then this message will not return, and #outer will be equivalent to #pass.


pass
Yield control to the enclosing exception action for the receiver. Similar to #outer, but control does not return to the currently active exception handler.


resume
If the exception is resumable, resume the execution of the block that raised the exception; the method that was used to signal the exception will answer the receiver. Use this method IF AND ONLY IF you know who caused the exception and if it is possible to resume it in that particular case


resume: anObject
If the exception is resumable, resume the execution of the block that raised the exception; the method that was used to signal the exception will answer anObject. Use this method IF AND ONLY IF you know who caused the exception and if it is possible to resume it in that particular case


retry
Re-execute the receiver of the #on:do: message. All handlers are reinstated: watch out, this can easily cause an infinite loop.


retryUsing: aBlock
Execute aBlock reinstating all handlers, and return its result from the #signal method.


return
Exit the #on:do: snippet, answering anObject to its caller


return: anObject
Exit the #on:do: snippet, answering anObject to its caller


[Up: Class Index]

SortedCollection

Category: Collections-Sequenceable
I am a collection of objects, stored and accessed according to some sorting criteria. I store things using a bubble sort. My instances have a comparison block associated with them; this block takes two arguments and is a predicate which returns true if the first argument should be sorted earlier than the second. The default block is [ :a :b | a <= b ], but I will accept any block that conforms to the above criteria.


[ Next: | Up:SortedCollection ]

SortedCollection class: hacking

defaultSortBlock
Answer a default sort block for the receiver.


[ Next: | Previous:SortedCollection class-hacking | Up:SortedCollection ]

SortedCollection class: instance creation

new
Answer a new collection with a default size and sort block


new: aSize
Answer a new collection with a default sort block and the given size


sortBlock: aSortBlock
Answer a new collection with a default size and the given sort block


[ Next: | Previous:SortedCollection class-instance creation | Up:SortedCollection ]

SortedCollection: basic

add: anObject
Add anObject into the collection at the proper place


add: anObject afterIndex: i
This method should not be called for instances of this class.


addAll: aCollection
Add all the elements in aCollection to the receiver in their proper places


addAll: aCollection afterIndex: i
This method should not be called for instances of this class.


addAllFirst: aCollection
This method should not be called for instances of this class.


addAllLast: aCollection
This method should not be called for instances of this class.


addFirst: anObject
This method should not be called for instances of this class.


addLast: anObject
This method should not be called for instances of this class.


at: index put: anObject
This method should not be called for instances of this class.


reverse
Answer an OrderedCollection containing the data in the receiver in reverse ordering


[ Next: | Previous:SortedCollection-basic | Up:SortedCollection ]

SortedCollection: copying

copyEmpty: newSize
Answer an empty copy of the receiver, with the same sort block as the receiver


[ Next: | Previous:SortedCollection-copying | Up:SortedCollection ]

SortedCollection: enumerating

collect: aBlock
Answer an OrderedCollection containing the data in the receiver filtered through the given block


[ Next: | Previous:SortedCollection-enumerating | Up:SortedCollection ]

SortedCollection: instance protocol

sortBlock
Answer the receiver's sort criteria


sortBlock: aSortBlock
Change the sort criteria for a sorted collection, resort the elements of the collection, and return it.


[ Previous:SortedCollection-instance protocol | Up:SortedCollection ]

SortedCollection: searching

includes: anObject
Private - Answer whether the receiver includes an item which is equal to anObject


indexOf: anObject startingAt: index ifAbsent: aBlock
Answer the first index > anIndex which contains anElement. Invoke exceptionBlock and answer its result if no item is found


occurrencesOf: anObject
Answer how many occurrences of anObject can be found in the receiver


[Up: Class Index]

Stream

Category: Streams
I am an abstract class that provides interruptable sequential access to objects. I can return successive objects from a source, or accept successive objects and store them sequentially on a sink. I provide some simple iteration over the contents of one of my instances, and provide for writing collections sequentially.


[ Next: | Up:Stream ]

Stream: accessing-reading

contents
Answer the whole contents of the receiver, from the next object to the last


next
Return the next object in the receiver


next: anInteger
Return the next anInteger objects in the receiver


nextMatchFor: anObject
Answer whether the next object is equal to anObject. Even if it does not, anObject is lost


[ Next: | Previous:Stream-accessing-reading | Up:Stream ]

Stream: accessing-writing

next: anInteger put: anObject
Write anInteger copies of anObject to the receiver


nextPut: anObject
Write anObject to the receiver


nextPutAll: aCollection
Write all the objects in aCollection to the receiver


[ Next: | Previous:Stream-accessing-writing | Up:Stream ]

Stream: basic

species
Answer `Array'.


[ Next: | Previous:Stream-basic | Up:Stream ]

Stream: character writing

cr
Store a cr on the receiver


crTab
Store a cr and a tab on the receiver


nl
Store a new line on the receiver


nlTab
Store a new line and a tab on the receiver


space
Store a space on the receiver


tab
Store a tab on the receiver


[ Next: | Previous:Stream-character writing | Up:Stream ]

Stream: enumerating

do: aBlock
Evaluate aBlock once for every object in the receiver


[ Next: | Previous:Stream-enumerating | Up:Stream ]

Stream: filing out

fileOut: aClass
File out aClass on the receiver. If aClass is not a metaclass, file out class and instance methods; if aClass is a metaclass, file out only the class methods


[ Next: | Previous:Stream-filing out | Up:Stream ]

Stream: printing

print: anObject
Print anObject on the receiver by sending printOn: to anObject. This method is provided so that you can use cascading and obtain better-looking code


[ Next: | Previous:Stream-printing | Up:Stream ]

Stream: providing consistent protocols

close
Do nothing. This is provided for consistency with file streams


[ Next: | Previous:Stream-providing consistent protocols | Up:Stream ]

Stream: storing

store: anObject
Print Smalltalk code compiling to anObject on the receiver, by sending storeOn: to anObject. This method is provided so that you can use cascading and obtain better-looking code


[ Previous:Stream-storing | Up:Stream ]

Stream: testing

atEnd
Answer whether the stream has got to an end


[Up: Class Index]

String

Category: Language-Data types
My instances represent string data types. I provide accessing and manipulation methods for string data types.


[ Next: | Up:String ]

String class: basic

fromString: aString
But we are already strings! So just answer a fresh copy of aString.


lineDelimiter
Answer a String which one can use as a line delimiter.


[ Next: | Previous:String class-basic | Up:String ]

String class: instance creation

fromCData: aCObject size: anInteger
Answer a String containing anInteger bytes starting at the location pointed to by aCObject


[ Next: | Previous:String class-instance creation | Up:String ]

String: built ins

asCData: aCType
Convert the receiver to a CObject with the given type


at: index
Answer the index-th character of the receiver.


at: index put: value
Change the index-th character of the receiver.


basicAt: index
Answer the index-th character of the receiver. This method must not be overridden; override at: instead. String overrides it so that it looks like it contains character objects even though it contains bytes


basicAt: index put: value
Change the index-th character of the receiver. This method must not be overridden; override at: instead. String overrides it so that it looks like it contains character objects even though it contains bytes


hash
Answer an hash value for the receiver


primReplaceFrom: start to: stop with: replacementString
startingAt: replaceStart Private - Replace the characters from start to stop with new characters contained in replacementString (which, actually, can be any variable byte class, starting at the replaceStart location of replacementString


replaceFrom: start to: stop with: aString startingAt: replaceStart
Replace the characters from start to stop with new characters whose ASCII codes are contained in aString, starting at the replaceStart location of aString


replaceFrom: start to: stop withByteArray: byteArray startingAt: replaceStart
Replace the characters from start to stop with new characters whose ASCII codes are contained in byteArray, starting at the replaceStart location of byteArray


size
Answer the size of the receiver


valueAt: index
Answer the ascii value of index-th character variable of the receiver


valueAt: index put: value
Store (Character value: value) in the index-th indexed instance variable of the receiver


[ Next: | Previous:String-built ins | Up:String ]

String: comparing

< aString
Return true if the receiver is less than aString, ignoring case differences.


<= aString
Returns true if the receiver is less than or equal to aString, ignoring case differences. If is receiver is an initial substring of aString, it is considered to be less than aString.


> aString
Return true if the receiver is greater than aString, ignoring case differences.


>= aString
Returns true if the receiver is greater than or equal to aString, ignoring case differences. If is aString is an initial substring of the receiver, it is considered to be less than the receiver.


indexOf: aString matchCase: aBoolean startingAt: anIndex
Answer an Interval of indices in the receiver which match the aString pattern. # in aString means 'match any character', * in aString means 'match any sequence of characters'. The first item of the returned in- terval is >= anIndex. If aBoolean is false, the search is case-insen- sitive, else it is case-sensitive. If no Interval matches the pattern, answer nil.


match: aString
Answer whether the receiver matches the aString pattern. # in aString means 'match any character', * in aString means 'match any sequence of characters'


sameAs: aString
Returns true if the receiver is the same string as aString, ignoring case differences.


[ Next: | Previous:String-comparing | Up:String ]

String: converting

asByteArray
Return the receiver, converted to a ByteArray of ASCII values


asClassPoolKey
Return the receiver, ready to be put in a class pool dictionary


asGlobalKey
Return the receiver, ready to be put in the Smalltalk dictionary


asInteger
Parse an Integer number from the receiver until the input character is invalid and answer the result at this point


asLowercase
Returns a copy of self as a lowercase string


asNumber
Parse a Number from the receiver until the input character is invalid and answer the result at this point


asPoolKey
Return the receiver, ready to be put in a pool dictionary


asString
But I already am a string! Really!


asSymbol
Returns the symbol corresponding to the string


asUppercase
Returns a copy of self as an uppercase string


fileName
But I don't HAVE a file name!


filePos
But I don't HAVE a file position!


isNumeric
Answer whether the receiver denotes a number


[ Next: | Previous:String-converting | Up:String ]

String: copying

, aString
Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by all the elements in aSequenceableCollection


deepCopy
Returns a deep copy of the receiver. This is the same thing as a shallow copy for strings


replaceFrom: start to: stop with: replacementCollection
Replace the items from start to stop with replacementCollection's items from repStart to repStart+stop-start


shallowCopy
Returns a shallow copy of the receiver


[ Next: | Previous:String-copying | Up:String ]

String: printing

printOn: aStream
Print a representation of the receiver on aStream


[ Next: | Previous:String-printing | Up:String ]

String: storing

storeOn: aStream
Print Smalltalk code compiling to the receiver on aStream


[ Next: | Previous:String-storing | Up:String ]

String: string processing

bindWith: s1
Answer the receiver with every %1 replaced by s1


bindWith: s1 with: s2
Answer the receiver with every %1 or %2 replaced by s1 or s2, respectively


bindWith: s1 with: s2 with: s3
Answer the receiver with every %1, %2 or %3 replaced by s1, s2 or s3, respectively


bindWith: s1 with: s2 with: s3 with: s4
Answer the receiver with every %1, %2, %3 or %4 replaced by s1, s2, s3 or s4, respectively


bindWithArguments: anArray
Answer the receiver with every %n (1<=n<=9) replaced by the n-th element of anArray


substrings
Answer an OrderedCollection of substrings of the receiver. A new substring start at the start of the receiver, or after every sequence of white space characters


substrings: aCharacter
Answer an OrderedCollection of substrings of the receiver. A new substring start at the start of the receiver, or after every sequence of characters matching aCharacter


[ Next: | Previous:String-string processing | Up:String ]

String: testing functionality

isString
Answer `true'.


[ Previous:String-testing functionality | Up:String ]

String: useful functionality

linesDo: aBlock
Send 'aBlock' a substring of the receiver for each newline delimited line in the receiver


trimSeparators
Trim leading and trailing separators from the receiver and answer a new string


[Up: Class Index]

Symbol

Category: Language-Implementation
My instances are unique throughout the Smalltalk system. My instances behave for the most part like strings, except that they print differently, and I guarantee that any two instances that have the same printed representation are in fact the same instance.


[ Next: | Up:Symbol ]

Symbol class: built ins

intern: aString
Private - Same as 'aString asSymbol'


[ Next: | Previous:Symbol class-built ins | Up:Symbol ]

Symbol class: instance creation

internCharacter: aCharacter
Answer the one-character symbol associated to the given character.


isSymbolString: aString
Answer whether aString has already been interned. Note that this works because String>>#hash calculates the same hash value used when interning strings into the SymbolTable. Changing one of the hashing methods without changing the other will break this method.


new
This method should not be called for instances of this class.


new: size
This method should not be called for instances of this class.


with: element1
Answer a collection whose only element is element1


with: element1 with: element2
Answer a collection whose only elements are the parameters in the order they were passed


with: element1 with: element2 with: element3
Answer a collection whose only elements are the parameters in the order they were passed


with: element1 with: element2 with: element3 with: element4
Answer a collection whose only elements are the parameters in the order they were passed


[ Next: | Previous:Symbol class-instance creation | Up:Symbol ]

Symbol: basic

argumentCount
Answer the number of arguments supported by the receiver, which is supposed to be a valid message name (#+, #not, #printOn:, #ifTrue:ifFalse:, etc.)


[ Next: | Previous:Symbol-basic | Up:Symbol ]

Symbol: built ins

= aSymbol
Answer whether the receiver and aSymbol are the same object


hash
Answer an hash value for the receiver. Symbols are optimized for speed


[ Next: | Previous:Symbol-built ins | Up:Symbol ]

Symbol: converting

asString
Answer a String with the same characters as the receiver


asSymbol
But we are already a Symbol, and furthermore, Symbols are identity objects! So answer the receiver.


[ Next: | Previous:Symbol-converting | Up:Symbol ]

Symbol: misc

species
Answer `String'.


[ Next: | Previous:Symbol-misc | Up:Symbol ]

Symbol: storing

storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


[ Previous:Symbol-storing | Up:Symbol ]

Symbol: testing functionality

isString
Answer `false'.


isSymbol
Answer `true'.


[Up: Class Index]

SymLink

Category: Language-Implementation
I am used to implement the Smalltalk symbol table. My instances are links that contain symbols, and the symbol table basically a hash table that points to chains of my instances.


[ Next: | Up:SymLink ]

SymLink: iteration

do: aBlock
Evaluate aBlock for each symbol in the list


[ Previous:SymLink-iteration | Up:SymLink ]

SymLink: printing

printOn: aStream
Print a representation of the receiver on aStream.


[Up: Class Index]

SystemDictionary

Category: Language-Implementation
I am a special form of dictionary. Typically I only have one instance, called "Smalltalk", which is known to the Smalltalk interpreter. I define several methods that are "system" related, such as #quitPrimitive. My instance also helps keep track of dependencies between objects.


[ Next: | Up:SystemDictionary ]

SystemDictionary: basic

halt
Interrupt interpreter


initialize
Initialize the globals


printOn: aStream
Print a representation of the receiver


storeOn: aStream
Store Smalltalk code compiling to the receiver


[ Next: | Previous:SystemDictionary-basic | Up:SystemDictionary ]

SystemDictionary: builtins

byteCodeCounter
Answer the number of bytecodes executed by the VM


compact
Force a full garbage collection


debug
for DBX. Set breakpoint in debug() and invoke this primitive near where you want to stop


declarationTrace
Answer whether compiled bytecodes are printed on stdout


declarationTrace: aBoolean
Set whether compiled bytecodes are printed on stdout


enableGC: aBoolean
Enable GC of Smalltalk objects referenced in callins/callouts


executionTrace
Answer whether executed bytecodes are printed on stdout


executionTrace: aBoolean
Set whether executed bytecodes are printed on stdout


gcMessage
Answer whether messages indicating that garbage collection is taking place are printed on stdout


gcMessage: aBoolean
Set whether messages indicating that garbage collection is taking place are printed on stdout


getTraceFlag: anIndex
Private - Returns a boolean value which is one of the interpreter's tracing flags


growThresholdPercent
Answer the percentage of the amount of memory used by the system grows which has to be full for the system to allocate more memory


growThresholdPercent: growPercent
Set the percentage of the amount of memory used by the system grows which has to be full for the system to allocate more memory


growTo: numBytes
Grow the amount of memory used by the system grows to numBytes.


monitor: aBoolean
Start or stop profiling the VM's execution (if GNU Smalltalk was compiled with support for monitor(2), of course).


printStatistics
Print statistics about what the VM did since #resetStatistics was last called. Meaningful only if gst was made with `make profile' or `make profile_vm'


quitPrimitive
Quit the Smalltalk environment. Whether files are closed and other similar cleanup occurs depends on the platform


quitPrimitive: exitStatus
Quit the Smalltalk environment, passing the exitStatus integer to the OS. Whether files are closed and other similar cleanup occurs depends on the platform


resetStatistics
Reset the statistics about the VM which #printStatistics can print.


setTraceFlag: anIndex to: aBoolean
Private - Sets the value of one of the interpreter's tracing flags (indicated by 'anIndex') to the value aBoolean.


snapshot: aString
Save an image on the aString file


spaceGrowRate
Answer the rate with which the amount of memory used by the system grows


spaceGrowRate: rate
Set the rate with which the amount of memory used by the system grows


verboseTrace
Answer whether execution tracing prints the object on the stack top


verboseTrace: aBoolean
Set whether execution tracing prints the object on the stack top


[ Next: | Previous:SystemDictionary-builtins | Up:SystemDictionary ]

SystemDictionary: C functions

getArgc
C call-out to getArgc. Do not modify!


getArgv: index
C call-out to getArgv. Do not modify!


getenv: aString
C call-out to getenv. Do not modify!


putenv: aString
C call-out to putenv. Do not modify!


system: aString
C call-out to system. Do not modify!


[ Next: | Previous:SystemDictionary-C functions | Up:SystemDictionary ]

SystemDictionary: initialization

addInit: aBlock
Adds 'aBlock' to the array of blocks to be invoked after every start of the system. If the kernel has been already initialized, evaluate the block


doInits
Called after the system has loaded the image, this will invoke any init blocks that have been installed.


[ Next: | Previous:SystemDictionary-initialization | Up:SystemDictionary ]

SystemDictionary: miscellaneous

arguments
Return the command line arguments after the -a switch


backtrace
Print a backtrace on the Transcript.


snapshot
Save a snapshot on the image file that was loaded on startup


[ Previous:SystemDictionary-miscellaneous | Up:SystemDictionary ]

SystemDictionary: special accessing

addFeature: aFeature
Add the aFeature feature to the Features set


allBehaviorsDo: aBlock
Evaluate aBlock once for each class and metaclass in the system. Trick: the class objects for classes directly derived from nil (for example `Object class') are subclasses of *Class* (see UndefinedObject>>#subclass:instanceVariableNames:...)


allClassesDo: aBlock
Evaluate aBlock once for each class in the system. Trick: the class objects for classes directly derived from nil (for example `Object class') are subclasses of *Class* (see UndefinedObject>>#subclass:instanceVariableNames:...)


allClassObjectsDo: aBlock
Evaluate aBlock once for each class and metaclass in the system. Trick: the class objects for classes directly derived from nil (for example `Object class') are subclasses of *Class* (see UndefinedObject>>#subclass:instanceVariableNames:...)


allMetaclassesDo: aBlock
Evaluate aBlock once for each metaclass in the system. Trick: the class objects for classes directly derived from nil (for example `Object class') are subclasses of *Class* (see UndefinedObject>>#subclass:instanceVariableNames:...)


classAt: aKey
Answer the value corrisponding to aKey if it is a class. Fail if either aKey is not found or it is associated to something different from a class.


classAt: aKey ifAbsent: aBlock
Answer the value corrisponding to aKey if it is a class. Evaluate aBlock and answer its result if either aKey is not found or it is associated to something different from a class.


dependenciesAt: anObject
Answer the dependants of anObject (or nil if there's no key for anObject in the Dependencies IdentityDictionary)


hasFeatures: features
Returns true if the feature or features in 'features' is one of the implementation dependent features present


removeFeature: aFeature
Remove the aFeature feature to the Features set


version
Answer the current version of the GNU Smalltalk environment


[Up: Class Index]

Time

Category: Language-Data types
My instances represent times of the day. I provide methods for instance creation, methods that access components (hours, minutes, and seconds) of a time value, and a block execution timing facility.


[ Next: | Up:Time ]

Time class: basic

fromSeconds: secondCount
Answer a Time representing secondCount seconds past midnight


initialize
(99 * 365 + 25) * 86400 secs/day.


millisecondClock
Answer the number of milliseconds since startup


millisecondClockValue
Answer the number of milliseconds since startup


millisecondsPerDay
Answer the number of milliseconds in a day


millisecondsToRun: timedBlock
Answer the number of milliseconds which timedBlock took to run


new
Answer a Time representing midnight


now
Answer a time representing the current time of day


onStartup
Private - Called on startup


secondClock
Answer the number of seconds since the midnight of 1/1/1901


[ Next: | Previous:Time class-basic | Up:Time ]

Time class: builtins

primMillisecondClock
Returns the number of milliseconds since midnight.


primSecondClock
Returns the number of seconds to/from 1/1/2000.


[ Next: | Previous:Time class-builtins | Up:Time ]

Time: accessing

asSeconds
Answer `seconds'.


hours
Answer the number of hours in the receiver


minutes
Answer the number of minutes in the receiver


seconds
Answer the number of seconds in the receiver


[ Next: | Previous:Time-accessing | Up:Time ]

Time: arithmetic

addTime: timeAmount
Answer a new Time that is timeAmount seconds after the receiver


printOn: aStream
Print a representation of the receiver on aStream


subtractTime: timeAmount
Answer a new Time that is timeAmount seconds before the receiver


[ Previous:Time-arithmetic | Up:Time ]

Time: comparing

< aTime
Answer whether the receiver is less than aTime


= aTime
Answer whether the receiver is equal to aTime


hash
Answer an hash value for the receiver


[Up: Class Index]

TokenStream

Category: Streams-Collections
I am not a typical part of the Smalltalk kernel class hierarchy. I operate on a stream of characters and return distinct whitespace-delimited groups of characters; I am used to parse the parameters of class-creation methods.

Basically, I parse off whitespace separated tokens as substrings and return them (next). If the entire contents of the string are requested, I return them as an Array containing the individual strings.


[ Next: | Up:TokenStream ]

TokenStream class: instance creation

on: aString
Answer a TokenStream working on aString


onStream: aStream
Answer a TokenStream working on the collection on which aStream is in turn streaming.


[ Next: | Previous:TokenStream class-instance creation | Up:TokenStream ]

TokenStream: basic

atEnd
Answer whether the input stream has no more tokens.


next
Answer a new whitespace-separated token from the input stream


[ Previous:TokenStream-basic | Up:TokenStream ]

TokenStream: write methods

nextPut: anObject
This method should not be called for instances of this class.


[Up: Class Index]

TranscriptInterface

Category: Streams


[ Next: | Up:TranscriptInterface ]

TranscriptInterface class: accessing

new
Answer the only instance of the receiver - which is stored in the global variable Transcript.


[ Next: | Previous:TranscriptInterface class-accessing | Up:TranscriptInterface ]

TranscriptInterface: accessing

cr
Emit a new-line (carriage return) to the Transcript


next: anInteger put: anObject
Write anInteger copies of anObject to the Transcript


nextPut: aCharacter
Emit aCharacter to the Transcript


nextPutAll: aString
Write aString to the Transcript


show: aString
Write aString to the Transcript


showCr: aString
Write aString to the Transcript, followed by a new-line character


showOnNewLine: aString
Write aString to the Transcript, preceded by a new-line character


[ Next: | Previous:TranscriptInterface-accessing | Up:TranscriptInterface ]

TranscriptInterface: printing

print: anObject
Print anObject's representation to the Transcript


printOn: aStream
Print a representation of the receiver onto aStream


[ Next: | Previous:TranscriptInterface-printing | Up:TranscriptInterface ]

TranscriptInterface: set up

message
Private - Answer an association representing the message to be sent to perform write operations. The key is the receiver, the value is the selector


message: anAssociation
Private - Set the message to be sent to perform write operations to the one represented by anAssociation. anAssociation's key is the receiver, while its value is the selector


[ Previous:TranscriptInterface-set up | Up:TranscriptInterface ]

TranscriptInterface: storing

store: anObject
Print Smalltalk code which evaluates to anObject on the Transcript


storeOn: aStream
Print Smalltalk code which evaluates to the receiver onto aStream


[Up: Class Index]

TrappableEvent

Category: Language-Exceptions
I am an abstract class for arguments passed to #on:do:... methods in BlockClosure. I define a bunch of methods that apply to Exceptions and ExceptionCollections: they allow you to create ExceptionCollections and examine all the exceptions to be trapped.


[ Next: | Up:TrappableEvent ]

TrappableEvent: enumerating

allExceptionsDo: aBlock
Execute aBlock, passing it an Exception for every exception in the receiver.


handles: exception
Answer whether the receiver handles `exception'.


[ Previous:TrappableEvent-enumerating | Up:TrappableEvent ]

TrappableEvent: instance creation

, aTrappableEvent
Answer an ExceptionCollection containing all the exceptions in the receiver and all the exceptions in aTrappableEvent


[Up: Class Index]

True

Category: Language-Data types
I represent truth and justice in the world. My motto is "semper veritatis".


[ Next: | Up:True ]

True: basic

& aBoolean
We are true - anded with anything, we always answer the other operand


and: aBlock
We are true - anded with anything, we always answer the other operand, so evaluate aBlock


eqv: aBoolean
Answer whether the receiver and aBoolean represent the same boolean value


ifFalse: falseBlock
We are true - answer nil


ifFalse: falseBlock ifTrue: trueBlock
We are true - evaluate trueBlock


ifTrue: trueBlock
We are true - evaluate trueBlock


ifTrue: trueBlock ifFalse: falseBlock
We are true - evaluate trueBlock


not
We are true - answer false


or: aBlock
We are true - ored with anything, we always answer true


xor: aBoolean
Answer whether the receiver and aBoolean represent different boolean values


| aBoolean
We are true - ored with anything, we always answer true


[ Next: | Previous:True-basic | Up:True ]

True: C hacks

asCBooleanValue
Answer `1'.


[ Previous:True-C hacks | Up:True ]

True: printing

printOn: aStream
Print a representation of the receiver on aStream


[Up: Class Index]

UndefinedObject

Category: Language-Implementation
I have the questionable distinction of being a class with only one instance, which is the object "nil". I suspect that I should be sent messages when errors occur, but currently I am not.


[ Next: | Up:UndefinedObject ]

UndefinedObject: class creation

metaclassFor: classNameString
Create a Metaclass object for the given class name. The metaclass is a subclass of Class


subclass: classNameString
instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a fixed subclass of the receiver with the given name, instance variables, class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed.


variableByteSubclass: classNameString
instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a byte variable subclass of the receiver with the given name, instance variables, class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed.


variableSubclass: classNameString
instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a variable pointer subclass of the receiver with the given name, instance variables, class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed.


variableWordSubclass: classNameString
instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a word variable subclass of the receiver with the given name, instance variables, class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed.


[ Next: | Previous:UndefinedObject-class creation | Up:UndefinedObject ]

UndefinedObject: class creation - alternative

subclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


subclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableByteSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableByteSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableWordSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


variableWordSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames
Don't use this, it is only present to file in from IBM Smalltalk


[ Next: | Previous:UndefinedObject-class creation - alternative | Up:UndefinedObject ]

UndefinedObject: printing

printOn: aStream
Print a representation of the receiver on aStream.


[ Next: | Previous:UndefinedObject-printing | Up:UndefinedObject ]

UndefinedObject: storing

storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream.


[ Previous:UndefinedObject-storing | Up:UndefinedObject ]

UndefinedObject: testing

ifNil: nilBlock
Evaluate nilBlock if the receiver is nil, else answer nil


ifNil: nilBlock ifNotNil: notNilBlock
Evaluate nilBlock if the receiver is nil, else evaluate notNilBlock, passing the receiver.


ifNotNil: notNilBlock
Evaluate notNilBlock if the receiver is not nil, passing the receiver. Else answer nil


ifNotNil: notNilBlock ifNotNil: nilBlock
Evaluate nilBlock if the receiver is nil, else evaluate notNilBlock, passing the receiver.


isNil
Answer whether the receiver is the undefined object nil. Always answer true.


notNil
Answer whether the receiver is not the undefined object nil. Always answer false.


[Up: Class Index]

ValueAdaptor

Category: Language-Data types
My subclasses are used to access data from different objects with a consistent protocol. However, I'm an abstract class.


[ Next: | Up:ValueAdaptor ]

ValueAdaptor class: creating instances

new
We don't know enough of subclasses to have a shared implementation of new


[ Next: | Previous:ValueAdaptor class-creating instances | Up:ValueAdaptor ]

ValueAdaptor: accessing

value
Retrive the value of the receiver. Must be implemented by ValueAdaptor's subclasses


value: anObject
Set the value of the receiver. Must be implemented by ValueAdaptor's subclasses


[ Previous:ValueAdaptor-accessing | Up:ValueAdaptor ]

ValueAdaptor: basic

printOn: aStream
Print a representation of the receiver


[Up: Class Index]

ValueHolder

Category: Language-Data types
I store my value in a variable. For example, you can use me to pass num- bers by reference. Just instance me before calling a method and ask for my value after that method. There are a lot of other creative uses for my intances, though.


[ Next: | Up:ValueHolder ]

ValueHolder class: creating instances

new
Create a ValueHolder whose starting value is nil


null
Not commented.


with: anObject
Create a ValueHolder whose starting value is anObject


[ Previous:ValueHolder class-creating instances | Up:ValueHolder ]

ValueHolder: accessing

value
Get the value of the receiver.


value: anObject
Set the value of the receiver.


[Up: Class Index]

WordMemory

Category: Language-Implementation
I have no instances. I provide messages to my class that access real memory as 32-bit words. An alternative implementation would be to have a single instance of word memory that represented all memory, and at: and at:put: accessor methods, but since you'd typically refer to that instance via a global variable, and since the global variable would probably be named WordMemory, the actual method invocations are exactly the same in either case.


[ Up:WordMemory ]

WordMemory class: accessing

at: address
Access a 32-bit word at the given address


at: address put: value
Store value as a 32-bit word at the given address


[Up: Class Index]

WriteStream

Category: Streams-Collection
I am the class of writeable streams. I only allow write operations to my instances; reading is strictly forbidden.


[ Next: | Up:WriteStream ]

WriteStream class: instance creation

on: aCollection
Answer a new instance of the receiver which streams on aCollection. Every item of aCollection is discarded.


with: aCollection
Answer a new instance of the receiver which streams from the end of aCollection.


with: aCollection from: firstIndex to: lastIndex
Answer a new instance of the receiver which streams from the firstIndex-th item of aCollection to the lastIndex-th. The pointer is moved to the last item in that range.


[ Next: | Previous:WriteStream class-instance creation | Up:WriteStream ]

WriteStream: accessing

size
Answer how many objects have been written


[ Next: | Previous:WriteStream-accessing | Up:WriteStream ]

WriteStream: accessing-writing

nextPut: anObject
Store anObject as the next item in the receiver. Grow the collection if necessary


[ Previous:WriteStream-accessing-writing | Up:WriteStream ]

WriteStream: positioning

emptyStream
Extension - Reset the stream


position: anInteger
Skip to the anInteger-th item backwards in the stream. Fail if anInteger>self position. The stream is truncated after the pointer


skip: anInteger
Skip (anInteger negated) items backwards in the stream. Fail if anInteger>0. The stream is truncated after the pointer